1 @c Copyright (C) 1988-2018 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
10 @c man begin COPYRIGHT
11 Copyright @copyright{} 1988-2018 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 -fopenacc -fopenmp -fopenmp-simd @gol
201 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness} @gol
202 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
203 -fsigned-bitfields -fsigned-char @gol
204 -funsigned-bitfields -funsigned-char}
206 @item C++ Language Options
207 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
208 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
209 -faligned-new=@var{n} -fargs-in-order=@var{n} -fcheck-new @gol
210 -fconstexpr-depth=@var{n} -fconstexpr-loop-limit=@var{n} @gol
211 -fno-elide-constructors @gol
212 -fno-enforce-eh-specs @gol
213 -fno-gnu-keywords @gol
214 -fno-implicit-templates @gol
215 -fno-implicit-inline-templates @gol
216 -fno-implement-inlines -fms-extensions @gol
217 -fnew-inheriting-ctors @gol
218 -fnew-ttp-matching @gol
219 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
220 -fno-optional-diags -fpermissive @gol
221 -fno-pretty-templates @gol
222 -frepo -fno-rtti -fsized-deallocation @gol
223 -ftemplate-backtrace-limit=@var{n} @gol
224 -ftemplate-depth=@var{n} @gol
225 -fno-threadsafe-statics -fuse-cxa-atexit @gol
226 -fno-weak -nostdinc++ @gol
227 -fvisibility-inlines-hidden @gol
228 -fvisibility-ms-compat @gol
229 -fext-numeric-literals @gol
230 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
231 -Wdelete-non-virtual-dtor -Wdeprecated-copy -Wliteral-suffix @gol
232 -Wmultiple-inheritance -Wno-init-list-lifetime @gol
233 -Wnamespaces -Wnarrowing @gol
234 -Wpessimizing-move -Wredundant-move @gol
235 -Wnoexcept -Wnoexcept-type -Wclass-memaccess @gol
236 -Wnon-virtual-dtor -Wreorder -Wregister @gol
237 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
238 -Wno-non-template-friend -Wold-style-cast @gol
239 -Woverloaded-virtual -Wno-pmf-conversions @gol
240 -Wno-class-conversion -Wno-terminate @gol
241 -Wsign-promo -Wvirtual-inheritance}
243 @item Objective-C and Objective-C++ Language Options
244 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
245 Objective-C and Objective-C++ Dialects}.
246 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
247 -fgnu-runtime -fnext-runtime @gol
248 -fno-nil-receivers @gol
249 -fobjc-abi-version=@var{n} @gol
250 -fobjc-call-cxx-cdtors @gol
251 -fobjc-direct-dispatch @gol
252 -fobjc-exceptions @gol
255 -fobjc-std=objc1 @gol
256 -fno-local-ivars @gol
257 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
258 -freplace-objc-classes @gol
261 -Wassign-intercept @gol
262 -Wno-protocol -Wselector @gol
263 -Wstrict-selector-match @gol
264 -Wundeclared-selector}
266 @item Diagnostic Message Formatting Options
267 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
268 @gccoptlist{-fmessage-length=@var{n} @gol
269 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
270 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
271 -fdiagnostics-format=@r{[}text@r{|}json@r{]} @gol
272 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
273 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
274 -fdiagnostics-minimum-margin-width=@var{width} @gol
275 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
276 -fdiagnostics-show-template-tree -fno-elide-type @gol
279 @item Warning Options
280 @xref{Warning Options,,Options to Request or Suppress Warnings}.
281 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
282 -pedantic-errors @gol
283 -w -Wextra -Wall -Waddress -Waggregate-return -Waligned-new @gol
284 -Walloc-zero -Walloc-size-larger-than=@var{byte-size} @gol
285 -Walloca -Walloca-larger-than=@var{byte-size} @gol
286 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
287 -Wno-attributes -Wno-attribute-alias @gol
288 -Wbool-compare -Wbool-operation @gol
289 -Wno-builtin-declaration-mismatch @gol
290 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
291 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
292 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
293 -Wchar-subscripts -Wcatch-value -Wcatch-value=@var{n} @gol
294 -Wclobbered -Wcomment -Wconditionally-supported @gol
295 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
296 -Wdelete-incomplete @gol
297 -Wno-attribute-warning @gol
298 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
299 -Wdisabled-optimization @gol
300 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
301 -Wno-div-by-zero -Wdouble-promotion @gol
302 -Wduplicated-branches -Wduplicated-cond @gol
303 -Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol
304 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
305 -Wfloat-equal -Wformat -Wformat=2 @gol
306 -Wno-format-contains-nul -Wno-format-extra-args @gol
307 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
308 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
309 -Wformat-y2k -Wframe-address @gol
310 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
311 -Wjump-misses-init @gol
312 -Wif-not-aligned @gol
313 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
314 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
315 -Wimplicit-function-declaration -Wimplicit-int @gol
316 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
317 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
318 -Winvalid-pch -Wlarger-than=@var{byte-size} @gol
319 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
320 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
321 -Wmisleading-indentation -Wno-missing-attributes -Wmissing-braces @gol
322 -Wmissing-field-initializers -Wmissing-format-attribute @gol
323 -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-profile @gol
324 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
325 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
326 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
327 -Woverride-init-side-effects -Woverlength-strings @gol
328 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
329 -Wparentheses -Wno-pedantic-ms-format @gol
330 -Wplacement-new -Wplacement-new=@var{n} @gol
331 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
332 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
333 -Wrestrict -Wno-return-local-addr @gol
334 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
335 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
336 -Wshift-overflow -Wshift-overflow=@var{n} @gol
337 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
338 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
339 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
340 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
341 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
342 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
343 -Wstringop-overflow=@var{n} -Wstringop-truncation -Wsubobject-linkage @gol
344 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
345 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
346 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
347 -Wswitch-unreachable -Wsync-nand @gol
348 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
349 -Wtype-limits -Wundef @gol
350 -Wuninitialized -Wunknown-pragmas @gol
351 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
352 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
353 -Wunused-parameter -Wno-unused-result @gol
354 -Wunused-value -Wunused-variable @gol
355 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
356 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
357 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
358 -Wvla -Wvla-larger-than=@var{byte-size} -Wvolatile-register-var @gol
360 -Wzero-as-null-pointer-constant -Whsa}
362 @item C and Objective-C-only Warning Options
363 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
364 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
365 -Wold-style-declaration -Wold-style-definition @gol
366 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
367 -Wdeclaration-after-statement -Wpointer-sign}
369 @item Debugging Options
370 @xref{Debugging Options,,Options for Debugging Your Program}.
371 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
372 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
373 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
374 -gas-loc-support -gno-as-loc-support @gol
375 -gas-locview-support -gno-as-locview-support @gol
376 -gcolumn-info -gno-column-info @gol
377 -gstatement-frontiers -gno-statement-frontiers @gol
378 -gvariable-location-views -gno-variable-location-views @gol
379 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
380 -ginline-points -gno-inline-points @gol
381 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
382 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
383 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
384 -fno-eliminate-unused-debug-types @gol
385 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
386 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
387 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
388 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
389 -fvar-tracking -fvar-tracking-assignments}
391 @item Optimization Options
392 @xref{Optimize Options,,Options that Control Optimization}.
393 @gccoptlist{-faggressive-loop-optimizations @gol
394 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
395 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
396 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
397 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
398 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
399 -fauto-inc-dec -fbranch-probabilities @gol
400 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
401 -fbtr-bb-exclusive -fcaller-saves @gol
402 -fcombine-stack-adjustments -fconserve-stack @gol
403 -fcompare-elim -fcprop-registers -fcrossjumping @gol
404 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
405 -fcx-limited-range @gol
406 -fdata-sections -fdce -fdelayed-branch @gol
407 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
408 -fdevirtualize-at-ltrans -fdse @gol
409 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
410 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
411 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
412 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
413 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
414 -fif-conversion2 -findirect-inlining @gol
415 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
416 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
417 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
418 -fipa-reference -fipa-reference-addressable @gol
419 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
420 -fira-region=@var{region} -fira-hoist-pressure @gol
421 -fira-loop-pressure -fno-ira-share-save-slots @gol
422 -fno-ira-share-spill-slots @gol
423 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
424 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
425 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
426 -floop-block -floop-interchange -floop-strip-mine @gol
427 -floop-unroll-and-jam -floop-nest-optimize @gol
428 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
429 -flto-partition=@var{alg} -fmerge-all-constants @gol
430 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
431 -fmove-loop-invariants -fno-branch-count-reg @gol
432 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
433 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
434 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
435 -fno-sched-spec -fno-signed-zeros @gol
436 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
437 -fomit-frame-pointer -foptimize-sibling-calls @gol
438 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
439 -fprefetch-loop-arrays @gol
440 -fprofile-correction @gol
441 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
442 -fprofile-reorder-functions @gol
443 -freciprocal-math -free -frename-registers -freorder-blocks @gol
444 -freorder-blocks-algorithm=@var{algorithm} @gol
445 -freorder-blocks-and-partition -freorder-functions @gol
446 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
447 -frounding-math -fsave-optimization-record @gol
448 -fsched2-use-superblocks -fsched-pressure @gol
449 -fsched-spec-load -fsched-spec-load-dangerous @gol
450 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
451 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
452 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
453 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
454 -fschedule-fusion @gol
455 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
456 -fselective-scheduling -fselective-scheduling2 @gol
457 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
458 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
459 -fsignaling-nans @gol
460 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
462 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
463 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
464 -fthread-jumps -ftracer -ftree-bit-ccp @gol
465 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
466 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
467 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
468 -ftree-loop-if-convert -ftree-loop-im @gol
469 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
470 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
471 -ftree-loop-vectorize @gol
472 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
473 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
474 -ftree-switch-conversion -ftree-tail-merge @gol
475 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
476 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
477 -funsafe-math-optimizations -funswitch-loops @gol
478 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
479 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
480 --param @var{name}=@var{value}
481 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
483 @item Program Instrumentation Options
484 @xref{Instrumentation Options,,Program Instrumentation Options}.
485 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
486 -fprofile-abs-path @gol
487 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
488 -fprofile-update=@var{method} -fprofile-filter-files=@var{regex} @gol
489 -fprofile-exclude-files=@var{regex} @gol
490 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
491 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
492 -fsanitize-undefined-trap-on-error -fbounds-check @gol
493 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
494 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
495 -fstack-protector-explicit -fstack-check @gol
496 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
497 -fno-stack-limit -fsplit-stack @gol
498 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
499 -fvtv-counts -fvtv-debug @gol
500 -finstrument-functions @gol
501 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
502 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
504 @item Preprocessor Options
505 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
506 @gccoptlist{-A@var{question}=@var{answer} @gol
507 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
508 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
509 -dD -dI -dM -dN -dU @gol
510 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
511 -fexec-charset=@var{charset} -fextended-identifiers @gol
512 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
513 -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
514 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
515 -fwide-exec-charset=@var{charset} -fworking-directory @gol
516 -H -imacros @var{file} -include @var{file} @gol
517 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
518 -no-integrated-cpp -P -pthread -remap @gol
519 -traditional -traditional-cpp -trigraphs @gol
520 -U@var{macro} -undef @gol
521 -Wp,@var{option} -Xpreprocessor @var{option}}
523 @item Assembler Options
524 @xref{Assembler Options,,Passing Options to the Assembler}.
525 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
528 @xref{Link Options,,Options for Linking}.
529 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
530 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
531 -e @var{entry} --entry=@var{entry} @gol
532 -pie -pthread -r -rdynamic @gol
533 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
534 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
535 -shared -shared-libgcc -symbolic @gol
536 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
537 -u @var{symbol} -z @var{keyword}}
539 @item Directory Options
540 @xref{Directory Options,,Options for Directory Search}.
541 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
542 -idirafter @var{dir} @gol
543 -imacros @var{file} -imultilib @var{dir} @gol
544 -iplugindir=@var{dir} -iprefix @var{file} @gol
545 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
546 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
547 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
548 -nostdinc -nostdinc++ --sysroot=@var{dir}}
550 @item Code Generation Options
551 @xref{Code Gen Options,,Options for Code Generation Conventions}.
552 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
553 -ffixed-@var{reg} -fexceptions @gol
554 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
555 -fasynchronous-unwind-tables @gol
557 -finhibit-size-directive -fno-common -fno-ident @gol
558 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
559 -fno-jump-tables @gol
560 -frecord-gcc-switches @gol
561 -freg-struct-return -fshort-enums -fshort-wchar @gol
562 -fverbose-asm -fpack-struct[=@var{n}] @gol
563 -fleading-underscore -ftls-model=@var{model} @gol
564 -fstack-reuse=@var{reuse_level} @gol
565 -ftrampolines -ftrapv -fwrapv @gol
566 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
567 -fstrict-volatile-bitfields -fsync-libcalls}
569 @item Developer Options
570 @xref{Developer Options,,GCC Developer Options}.
571 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
572 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
573 -fdbg-cnt=@var{counter-value-list} @gol
574 -fdisable-ipa-@var{pass_name} @gol
575 -fdisable-rtl-@var{pass_name} @gol
576 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
577 -fdisable-tree-@var{pass_name} @gol
578 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
579 -fdump-debug -fdump-earlydebug @gol
580 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
581 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
582 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
583 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
585 -fdump-lang-@var{switch} @gol
586 -fdump-lang-@var{switch}-@var{options} @gol
587 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
589 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
590 -fdump-statistics @gol
592 -fdump-tree-@var{switch} @gol
593 -fdump-tree-@var{switch}-@var{options} @gol
594 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
595 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
596 -fenable-@var{kind}-@var{pass} @gol
597 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
598 -fira-verbose=@var{n} @gol
599 -flto-report -flto-report-wpa -fmem-report-wpa @gol
600 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
601 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
602 -fprofile-report @gol
603 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
604 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
605 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
606 -fvar-tracking-assignments-toggle -gtoggle @gol
607 -print-file-name=@var{library} -print-libgcc-file-name @gol
608 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
609 -print-prog-name=@var{program} -print-search-dirs -Q @gol
610 -print-sysroot -print-sysroot-headers-suffix @gol
611 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
613 @item Machine-Dependent Options
614 @xref{Submodel Options,,Machine-Dependent Options}.
615 @c This list is ordered alphanumerically by subsection name.
616 @c Try and put the significant identifier (CPU or system) first,
617 @c so users have a clue at guessing where the ones they want will be.
619 @emph{AArch64 Options}
620 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
621 -mgeneral-regs-only @gol
622 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
623 -mstrict-align -mno-strict-align @gol
624 -momit-leaf-frame-pointer @gol
625 -mtls-dialect=desc -mtls-dialect=traditional @gol
626 -mtls-size=@var{size} @gol
627 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
628 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
629 -mpc-relative-literal-loads @gol
630 -msign-return-address=@var{scope} @gol
631 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
632 -moverride=@var{string} -mverbose-cost-dump -mtrack-speculation}
634 @emph{Adapteva Epiphany Options}
635 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
636 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
637 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
638 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
639 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
640 -msplit-vecmove-early -m1reg-@var{reg}}
643 @gccoptlist{-mbarrel-shifter -mjli-always @gol
644 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
645 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
646 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
647 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
648 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
649 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
650 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
651 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
652 -mvolatile-cache -mtp-regno=@var{regno} @gol
653 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
654 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
655 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
656 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
657 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
658 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
659 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
660 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
663 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
664 -mabi=@var{name} @gol
665 -mapcs-stack-check -mno-apcs-stack-check @gol
666 -mapcs-reentrant -mno-apcs-reentrant @gol
667 -msched-prolog -mno-sched-prolog @gol
668 -mlittle-endian -mbig-endian @gol
670 -mfloat-abi=@var{name} @gol
671 -mfp16-format=@var{name}
672 -mthumb-interwork -mno-thumb-interwork @gol
673 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
674 -mtune=@var{name} -mprint-tune-info @gol
675 -mstructure-size-boundary=@var{n} @gol
676 -mabort-on-noreturn @gol
677 -mlong-calls -mno-long-calls @gol
678 -msingle-pic-base -mno-single-pic-base @gol
679 -mpic-register=@var{reg} @gol
680 -mnop-fun-dllimport @gol
681 -mpoke-function-name @gol
682 -mthumb -marm -mflip-thumb @gol
683 -mtpcs-frame -mtpcs-leaf-frame @gol
684 -mcaller-super-interworking -mcallee-super-interworking @gol
685 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
686 -mword-relocations @gol
687 -mfix-cortex-m3-ldrd @gol
688 -munaligned-access @gol
689 -mneon-for-64bits @gol
690 -mslow-flash-data @gol
691 -masm-syntax-unified @gol
693 -mverbose-cost-dump @gol
698 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
699 -mbranch-cost=@var{cost} @gol
700 -mcall-prologues -mgas-isr-prologues -mint8 @gol
701 -mn_flash=@var{size} -mno-interrupts @gol
702 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
703 -mfract-convert-truncate @gol
704 -mshort-calls -nodevicelib @gol
705 -Waddr-space-convert -Wmisspelled-isr}
707 @emph{Blackfin Options}
708 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
709 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
710 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
711 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
712 -mno-id-shared-library -mshared-library-id=@var{n} @gol
713 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
714 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
715 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
719 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
720 -msim -msdata=@var{sdata-type}}
723 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
724 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
725 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
726 -mstack-align -mdata-align -mconst-align @gol
727 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
728 -melf -maout -melinux -mlinux -sim -sim2 @gol
729 -mmul-bug-workaround -mno-mul-bug-workaround}
732 @gccoptlist{-mmac @gol
733 -mcr16cplus -mcr16c @gol
734 -msim -mint32 -mbit-ops
735 -mdata-model=@var{model}}
738 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
739 -mbig-endian -EB -mlittle-endian -EL @gol
740 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
741 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
742 -mdsp -medsp -mvdsp @gol
743 -mdiv -msmart -mhigh-registers -manchor @gol
744 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
745 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
747 @emph{Darwin Options}
748 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
749 -arch_only -bind_at_load -bundle -bundle_loader @gol
750 -client_name -compatibility_version -current_version @gol
752 -dependency-file -dylib_file -dylinker_install_name @gol
753 -dynamic -dynamiclib -exported_symbols_list @gol
754 -filelist -flat_namespace -force_cpusubtype_ALL @gol
755 -force_flat_namespace -headerpad_max_install_names @gol
757 -image_base -init -install_name -keep_private_externs @gol
758 -multi_module -multiply_defined -multiply_defined_unused @gol
759 -noall_load -no_dead_strip_inits_and_terms @gol
760 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
761 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
762 -private_bundle -read_only_relocs -sectalign @gol
763 -sectobjectsymbols -whyload -seg1addr @gol
764 -sectcreate -sectobjectsymbols -sectorder @gol
765 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
766 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
767 -segprot -segs_read_only_addr -segs_read_write_addr @gol
768 -single_module -static -sub_library -sub_umbrella @gol
769 -twolevel_namespace -umbrella -undefined @gol
770 -unexported_symbols_list -weak_reference_mismatches @gol
771 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
772 -mkernel -mone-byte-bool}
774 @emph{DEC Alpha Options}
775 @gccoptlist{-mno-fp-regs -msoft-float @gol
776 -mieee -mieee-with-inexact -mieee-conformant @gol
777 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
778 -mtrap-precision=@var{mode} -mbuild-constants @gol
779 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
780 -mbwx -mmax -mfix -mcix @gol
781 -mfloat-vax -mfloat-ieee @gol
782 -mexplicit-relocs -msmall-data -mlarge-data @gol
783 -msmall-text -mlarge-text @gol
784 -mmemory-latency=@var{time}}
787 @gccoptlist{-msmall-model -mno-lsim}
790 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
793 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
794 -mhard-float -msoft-float @gol
795 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
796 -mdouble -mno-double @gol
797 -mmedia -mno-media -mmuladd -mno-muladd @gol
798 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
799 -mlinked-fp -mlong-calls -malign-labels @gol
800 -mlibrary-pic -macc-4 -macc-8 @gol
801 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
802 -moptimize-membar -mno-optimize-membar @gol
803 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
804 -mvliw-branch -mno-vliw-branch @gol
805 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
806 -mno-nested-cond-exec -mtomcat-stats @gol
810 @emph{GNU/Linux Options}
811 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
812 -tno-android-cc -tno-android-ld}
814 @emph{H8/300 Options}
815 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
818 @gccoptlist{-march=@var{architecture-type} @gol
819 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
820 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
821 -mfixed-range=@var{register-range} @gol
822 -mjump-in-delay -mlinker-opt -mlong-calls @gol
823 -mlong-load-store -mno-disable-fpregs @gol
824 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
825 -mno-jump-in-delay -mno-long-load-store @gol
826 -mno-portable-runtime -mno-soft-float @gol
827 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
828 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
829 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
830 -munix=@var{unix-std} -nolibdld -static -threads}
833 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
834 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
835 -mconstant-gp -mauto-pic -mfused-madd @gol
836 -minline-float-divide-min-latency @gol
837 -minline-float-divide-max-throughput @gol
838 -mno-inline-float-divide @gol
839 -minline-int-divide-min-latency @gol
840 -minline-int-divide-max-throughput @gol
841 -mno-inline-int-divide @gol
842 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
843 -mno-inline-sqrt @gol
844 -mdwarf2-asm -mearly-stop-bits @gol
845 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
846 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
847 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
848 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
849 -msched-spec-ldc -msched-spec-control-ldc @gol
850 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
851 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
852 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
853 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
856 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
857 -msign-extend-enabled -muser-enabled}
859 @emph{M32R/D Options}
860 @gccoptlist{-m32r2 -m32rx -m32r @gol
862 -malign-loops -mno-align-loops @gol
863 -missue-rate=@var{number} @gol
864 -mbranch-cost=@var{number} @gol
865 -mmodel=@var{code-size-model-type} @gol
866 -msdata=@var{sdata-type} @gol
867 -mno-flush-func -mflush-func=@var{name} @gol
868 -mno-flush-trap -mflush-trap=@var{number} @gol
872 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
874 @emph{M680x0 Options}
875 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
876 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
877 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
878 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
879 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
880 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
881 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
882 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
883 -mxgot -mno-xgot -mlong-jump-table-offsets}
886 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
887 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
888 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
889 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
890 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
893 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
894 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
895 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
896 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
899 @emph{MicroBlaze Options}
900 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
901 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
902 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
903 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
904 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
905 -mpic-data-is-text-relative}
908 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
909 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
910 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
911 -mips16 -mno-mips16 -mflip-mips16 @gol
912 -minterlink-compressed -mno-interlink-compressed @gol
913 -minterlink-mips16 -mno-interlink-mips16 @gol
914 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
915 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
916 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
917 -mno-float -msingle-float -mdouble-float @gol
918 -modd-spreg -mno-odd-spreg @gol
919 -mabs=@var{mode} -mnan=@var{encoding} @gol
920 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
923 -mvirt -mno-virt @gol
926 -mginv -mno-ginv @gol
927 -mmicromips -mno-micromips @gol
929 -mloongson-mmi -mno-loongson-mmi @gol
930 -mloongson-ext -mno-loongson-ext @gol
931 -mloongson-ext2 -mno-loongson-ext2 @gol
932 -mfpu=@var{fpu-type} @gol
933 -msmartmips -mno-smartmips @gol
934 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
935 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
936 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
937 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
938 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
939 -membedded-data -mno-embedded-data @gol
940 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
941 -mcode-readable=@var{setting} @gol
942 -msplit-addresses -mno-split-addresses @gol
943 -mexplicit-relocs -mno-explicit-relocs @gol
944 -mcheck-zero-division -mno-check-zero-division @gol
945 -mdivide-traps -mdivide-breaks @gol
946 -mload-store-pairs -mno-load-store-pairs @gol
947 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
948 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
949 -mfix-24k -mno-fix-24k @gol
950 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
951 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
952 -mfix-vr4120 -mno-fix-vr4120 @gol
953 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
954 -mflush-func=@var{func} -mno-flush-func @gol
955 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
956 -mcompact-branches=@var{policy} @gol
957 -mfp-exceptions -mno-fp-exceptions @gol
958 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
959 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
960 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
961 -mframe-header-opt -mno-frame-header-opt}
964 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
965 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
966 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
967 -mno-base-addresses -msingle-exit -mno-single-exit}
969 @emph{MN10300 Options}
970 @gccoptlist{-mmult-bug -mno-mult-bug @gol
971 -mno-am33 -mam33 -mam33-2 -mam34 @gol
972 -mtune=@var{cpu-type} @gol
973 -mreturn-pointer-on-d0 @gol
974 -mno-crt0 -mrelax -mliw -msetlb}
977 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
979 @emph{MSP430 Options}
980 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
982 -mcode-region= -mdata-region= @gol
983 -msilicon-errata= -msilicon-errata-warn= @gol
987 @gccoptlist{-mbig-endian -mlittle-endian @gol
988 -mreduced-regs -mfull-regs @gol
989 -mcmov -mno-cmov @gol
990 -mext-perf -mno-ext-perf @gol
991 -mext-perf2 -mno-ext-perf2 @gol
992 -mext-string -mno-ext-string @gol
993 -mv3push -mno-v3push @gol
994 -m16bit -mno-16bit @gol
995 -misr-vector-size=@var{num} @gol
996 -mcache-block-size=@var{num} @gol
997 -march=@var{arch} @gol
998 -mcmodel=@var{code-model} @gol
1001 @emph{Nios II Options}
1002 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1003 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1005 -mno-bypass-cache -mbypass-cache @gol
1006 -mno-cache-volatile -mcache-volatile @gol
1007 -mno-fast-sw-div -mfast-sw-div @gol
1008 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1009 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1010 -mcustom-fpu-cfg=@var{name} @gol
1011 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1012 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1014 @emph{Nvidia PTX Options}
1015 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1017 @emph{OpenRISC Options}
1018 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1019 -msoft-mul -msoft-div @gol
1020 -mcmov -mror -msext -msfimm -mshftimm}
1022 @emph{PDP-11 Options}
1023 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1024 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1025 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1027 @emph{picoChip Options}
1028 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1029 -msymbol-as-address -mno-inefficient-warnings}
1031 @emph{PowerPC Options}
1032 See RS/6000 and PowerPC Options.
1034 @emph{PowerPC SPE Options}
1035 @gccoptlist{-mcpu=@var{cpu-type} @gol
1036 -mtune=@var{cpu-type} @gol
1037 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb @gol
1038 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1039 -m32 -mxl-compat -mno-xl-compat @gol
1040 -malign-power -malign-natural @gol
1041 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1042 -msingle-float -mdouble-float @gol
1043 -mupdate -mno-update @gol
1044 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1045 -mstrict-align -mno-strict-align -mrelocatable @gol
1046 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1047 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1048 -msingle-pic-base @gol
1049 -mprioritize-restricted-insns=@var{priority} @gol
1050 -msched-costly-dep=@var{dependence_type} @gol
1051 -minsert-sched-nops=@var{scheme} @gol
1052 -mcall-sysv -mcall-netbsd @gol
1053 -maix-struct-return -msvr4-struct-return @gol
1054 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1055 -mblock-move-inline-limit=@var{num} @gol
1056 -misel -mno-isel @gol
1057 -misel=yes -misel=no @gol
1059 -mspe=yes -mspe=no @gol
1060 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
1061 -mprototype -mno-prototype @gol
1062 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1063 -msdata=@var{opt} -mvxworks -G @var{num} @gol
1064 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1065 -mno-recip-precision @gol
1066 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1067 -msave-toc-indirect -mno-save-toc-indirect @gol
1068 -mcompat-align-parm -mno-compat-align-parm @gol
1069 -mfloat128 -mno-float128 @gol
1070 -mgnu-attribute -mno-gnu-attribute @gol
1071 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1072 -mstack-protector-guard-offset=@var{offset}}
1074 @emph{RISC-V Options}
1075 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1077 -mabi=@var{ABI-string} @gol
1078 -mfdiv -mno-fdiv @gol
1080 -march=@var{ISA-string} @gol
1081 -mtune=@var{processor-string} @gol
1082 -mpreferred-stack-boundary=@var{num} @gol
1083 -msmall-data-limit=@var{N-bytes} @gol
1084 -msave-restore -mno-save-restore @gol
1085 -mstrict-align -mno-strict-align @gol
1086 -mcmodel=medlow -mcmodel=medany @gol
1087 -mexplicit-relocs -mno-explicit-relocs @gol
1091 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1092 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1093 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1095 @emph{RS/6000 and PowerPC Options}
1096 @gccoptlist{-mcpu=@var{cpu-type} @gol
1097 -mtune=@var{cpu-type} @gol
1098 -mcmodel=@var{code-model} @gol
1100 -maltivec -mno-altivec @gol
1101 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1102 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1103 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1104 -mfprnd -mno-fprnd @gol
1105 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
1106 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1107 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1108 -malign-power -malign-natural @gol
1109 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1110 -mupdate -mno-update @gol
1111 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1112 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1113 -mstrict-align -mno-strict-align -mrelocatable @gol
1114 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1115 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1116 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
1117 -mprioritize-restricted-insns=@var{priority} @gol
1118 -msched-costly-dep=@var{dependence_type} @gol
1119 -minsert-sched-nops=@var{scheme} @gol
1120 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1121 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1122 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1123 -mtraceback=@var{traceback_type} @gol
1124 -maix-struct-return -msvr4-struct-return @gol
1125 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1126 -mblock-move-inline-limit=@var{num} @gol
1127 -mblock-compare-inline-limit=@var{num} @gol
1128 -mblock-compare-inline-loop-limit=@var{num} @gol
1129 -mstring-compare-inline-limit=@var{num} @gol
1130 -misel -mno-isel @gol
1131 -mvrsave -mno-vrsave @gol
1132 -mmulhw -mno-mulhw @gol
1133 -mdlmzb -mno-dlmzb @gol
1134 -mprototype -mno-prototype @gol
1135 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1136 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1137 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1138 -mno-recip-precision @gol
1139 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1140 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1141 -msave-toc-indirect -mno-save-toc-indirect @gol
1142 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1143 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1144 -mquad-memory -mno-quad-memory @gol
1145 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1146 -mcompat-align-parm -mno-compat-align-parm @gol
1147 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1148 -mgnu-attribute -mno-gnu-attribute @gol
1149 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1150 -mstack-protector-guard-offset=@var{offset}}
1153 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1155 -mbig-endian-data -mlittle-endian-data @gol
1158 -mas100-syntax -mno-as100-syntax@gol
1160 -mmax-constant-size=@gol
1163 -mallow-string-insns -mno-allow-string-insns@gol
1165 -mno-warn-multiple-fast-interrupts@gol
1166 -msave-acc-in-interrupts}
1168 @emph{S/390 and zSeries Options}
1169 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1170 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1171 -mlong-double-64 -mlong-double-128 @gol
1172 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1173 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1174 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1175 -mhtm -mvx -mzvector @gol
1176 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1177 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1178 -mhotpatch=@var{halfwords},@var{halfwords}}
1180 @emph{Score Options}
1181 @gccoptlist{-meb -mel @gol
1185 -mscore5 -mscore5u -mscore7 -mscore7d}
1188 @gccoptlist{-m1 -m2 -m2e @gol
1189 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1191 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1192 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1193 -mb -ml -mdalign -mrelax @gol
1194 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1195 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1196 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1197 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1198 -maccumulate-outgoing-args @gol
1199 -matomic-model=@var{atomic-model} @gol
1200 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1201 -mcbranch-force-delay-slot @gol
1202 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1203 -mpretend-cmove -mtas}
1205 @emph{Solaris 2 Options}
1206 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1209 @emph{SPARC Options}
1210 @gccoptlist{-mcpu=@var{cpu-type} @gol
1211 -mtune=@var{cpu-type} @gol
1212 -mcmodel=@var{code-model} @gol
1213 -mmemory-model=@var{mem-model} @gol
1214 -m32 -m64 -mapp-regs -mno-app-regs @gol
1215 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1216 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1217 -mhard-quad-float -msoft-quad-float @gol
1218 -mstack-bias -mno-stack-bias @gol
1219 -mstd-struct-return -mno-std-struct-return @gol
1220 -munaligned-doubles -mno-unaligned-doubles @gol
1221 -muser-mode -mno-user-mode @gol
1222 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1223 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1224 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1225 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1226 -mpopc -mno-popc -msubxc -mno-subxc @gol
1227 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1231 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1232 -msafe-dma -munsafe-dma @gol
1234 -msmall-mem -mlarge-mem -mstdmain @gol
1235 -mfixed-range=@var{register-range} @gol
1237 -maddress-space-conversion -mno-address-space-conversion @gol
1238 -mcache-size=@var{cache-size} @gol
1239 -matomic-updates -mno-atomic-updates}
1241 @emph{System V Options}
1242 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1244 @emph{TILE-Gx Options}
1245 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1246 -mcmodel=@var{code-model}}
1248 @emph{TILEPro Options}
1249 @gccoptlist{-mcpu=@var{cpu} -m32}
1252 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1253 -mprolog-function -mno-prolog-function -mspace @gol
1254 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1255 -mapp-regs -mno-app-regs @gol
1256 -mdisable-callt -mno-disable-callt @gol
1257 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1258 -mv850e -mv850 -mv850e3v5 @gol
1269 @gccoptlist{-mg -mgnu -munix}
1271 @emph{Visium Options}
1272 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1273 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1276 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1277 -mpointer-size=@var{size}}
1279 @emph{VxWorks Options}
1280 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1281 -Xbind-lazy -Xbind-now}
1284 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1285 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1286 -mfpmath=@var{unit} @gol
1287 -masm=@var{dialect} -mno-fancy-math-387 @gol
1288 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1289 -mno-wide-multiply -mrtd -malign-double @gol
1290 -mpreferred-stack-boundary=@var{num} @gol
1291 -mincoming-stack-boundary=@var{num} @gol
1292 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1293 -mrecip -mrecip=@var{opt} @gol
1294 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1295 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1296 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1297 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1298 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1299 -mptwrite -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1300 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1301 -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp @gol
1302 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1303 -mshstk -mforce-indirect-call -mavx512vbmi2 @gol
1304 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1305 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1306 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1307 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1308 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1309 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1310 -mregparm=@var{num} -msseregparm @gol
1311 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1312 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1313 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1314 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1315 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1316 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1317 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1318 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1319 -mstack-protector-guard-reg=@var{reg} @gol
1320 -mstack-protector-guard-offset=@var{offset} @gol
1321 -mstack-protector-guard-symbol=@var{symbol} @gol
1322 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1323 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1324 -mindirect-branch-register}
1326 @emph{x86 Windows Options}
1327 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1328 -mnop-fun-dllimport -mthread @gol
1329 -municode -mwin32 -mwindows -fno-set-stack-executable}
1331 @emph{Xstormy16 Options}
1334 @emph{Xtensa Options}
1335 @gccoptlist{-mconst16 -mno-const16 @gol
1336 -mfused-madd -mno-fused-madd @gol
1338 -mserialize-volatile -mno-serialize-volatile @gol
1339 -mtext-section-literals -mno-text-section-literals @gol
1340 -mauto-litpools -mno-auto-litpools @gol
1341 -mtarget-align -mno-target-align @gol
1342 -mlongcalls -mno-longcalls}
1344 @emph{zSeries Options}
1345 See S/390 and zSeries Options.
1349 @node Overall Options
1350 @section Options Controlling the Kind of Output
1352 Compilation can involve up to four stages: preprocessing, compilation
1353 proper, assembly and linking, always in that order. GCC is capable of
1354 preprocessing and compiling several files either into several
1355 assembler input files, or into one assembler input file; then each
1356 assembler input file produces an object file, and linking combines all
1357 the object files (those newly compiled, and those specified as input)
1358 into an executable file.
1360 @cindex file name suffix
1361 For any given input file, the file name suffix determines what kind of
1362 compilation is done:
1366 C source code that must be preprocessed.
1369 C source code that should not be preprocessed.
1372 C++ source code that should not be preprocessed.
1375 Objective-C source code. Note that you must link with the @file{libobjc}
1376 library to make an Objective-C program work.
1379 Objective-C source code that should not be preprocessed.
1383 Objective-C++ source code. Note that you must link with the @file{libobjc}
1384 library to make an Objective-C++ program work. Note that @samp{.M} refers
1385 to a literal capital M@.
1387 @item @var{file}.mii
1388 Objective-C++ source code that should not be preprocessed.
1391 C, C++, Objective-C or Objective-C++ header file to be turned into a
1392 precompiled header (default), or C, C++ header file to be turned into an
1393 Ada spec (via the @option{-fdump-ada-spec} switch).
1396 @itemx @var{file}.cp
1397 @itemx @var{file}.cxx
1398 @itemx @var{file}.cpp
1399 @itemx @var{file}.CPP
1400 @itemx @var{file}.c++
1402 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1403 the last two letters must both be literally @samp{x}. Likewise,
1404 @samp{.C} refers to a literal capital C@.
1408 Objective-C++ source code that must be preprocessed.
1410 @item @var{file}.mii
1411 Objective-C++ source code that should not be preprocessed.
1415 @itemx @var{file}.hp
1416 @itemx @var{file}.hxx
1417 @itemx @var{file}.hpp
1418 @itemx @var{file}.HPP
1419 @itemx @var{file}.h++
1420 @itemx @var{file}.tcc
1421 C++ header file to be turned into a precompiled header or Ada spec.
1424 @itemx @var{file}.for
1425 @itemx @var{file}.ftn
1426 Fixed form Fortran source code that should not be preprocessed.
1429 @itemx @var{file}.FOR
1430 @itemx @var{file}.fpp
1431 @itemx @var{file}.FPP
1432 @itemx @var{file}.FTN
1433 Fixed form Fortran source code that must be preprocessed (with the traditional
1436 @item @var{file}.f90
1437 @itemx @var{file}.f95
1438 @itemx @var{file}.f03
1439 @itemx @var{file}.f08
1440 Free form Fortran source code that should not be preprocessed.
1442 @item @var{file}.F90
1443 @itemx @var{file}.F95
1444 @itemx @var{file}.F03
1445 @itemx @var{file}.F08
1446 Free form Fortran source code that must be preprocessed (with the
1447 traditional preprocessor).
1452 @item @var{file}.brig
1453 BRIG files (binary representation of HSAIL).
1462 D documentation code (Ddoc).
1464 @item @var{file}.ads
1465 Ada source code file that contains a library unit declaration (a
1466 declaration of a package, subprogram, or generic, or a generic
1467 instantiation), or a library unit renaming declaration (a package,
1468 generic, or subprogram renaming declaration). Such files are also
1471 @item @var{file}.adb
1472 Ada source code file containing a library unit body (a subprogram or
1473 package body). Such files are also called @dfn{bodies}.
1475 @c GCC also knows about some suffixes for languages not yet included:
1483 @itemx @var{file}.sx
1484 Assembler code that must be preprocessed.
1487 An object file to be fed straight into linking.
1488 Any file name with no recognized suffix is treated this way.
1492 You can specify the input language explicitly with the @option{-x} option:
1495 @item -x @var{language}
1496 Specify explicitly the @var{language} for the following input files
1497 (rather than letting the compiler choose a default based on the file
1498 name suffix). This option applies to all following input files until
1499 the next @option{-x} option. Possible values for @var{language} are:
1501 c c-header cpp-output
1502 c++ c++-header c++-cpp-output
1503 objective-c objective-c-header objective-c-cpp-output
1504 objective-c++ objective-c++-header objective-c++-cpp-output
1505 assembler assembler-with-cpp
1508 f77 f77-cpp-input f95 f95-cpp-input
1514 Turn off any specification of a language, so that subsequent files are
1515 handled according to their file name suffixes (as they are if @option{-x}
1516 has not been used at all).
1519 If you only want some of the stages of compilation, you can use
1520 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1521 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1522 @command{gcc} is to stop. Note that some combinations (for example,
1523 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1528 Compile or assemble the source files, but do not link. The linking
1529 stage simply is not done. The ultimate output is in the form of an
1530 object file for each source file.
1532 By default, the object file name for a source file is made by replacing
1533 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1535 Unrecognized input files, not requiring compilation or assembly, are
1540 Stop after the stage of compilation proper; do not assemble. The output
1541 is in the form of an assembler code file for each non-assembler input
1544 By default, the assembler file name for a source file is made by
1545 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1547 Input files that don't require compilation are ignored.
1551 Stop after the preprocessing stage; do not run the compiler proper. The
1552 output is in the form of preprocessed source code, which is sent to the
1555 Input files that don't require preprocessing are ignored.
1557 @cindex output file option
1560 Place output in file @var{file}. This applies to whatever
1561 sort of output is being produced, whether it be an executable file,
1562 an object file, an assembler file or preprocessed C code.
1564 If @option{-o} is not specified, the default is to put an executable
1565 file in @file{a.out}, the object file for
1566 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1567 assembler file in @file{@var{source}.s}, a precompiled header file in
1568 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1573 Print (on standard error output) the commands executed to run the stages
1574 of compilation. Also print the version number of the compiler driver
1575 program and of the preprocessor and the compiler proper.
1579 Like @option{-v} except the commands are not executed and arguments
1580 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1581 This is useful for shell scripts to capture the driver-generated command lines.
1585 Print (on the standard output) a description of the command-line options
1586 understood by @command{gcc}. If the @option{-v} option is also specified
1587 then @option{--help} is also passed on to the various processes
1588 invoked by @command{gcc}, so that they can display the command-line options
1589 they accept. If the @option{-Wextra} option has also been specified
1590 (prior to the @option{--help} option), then command-line options that
1591 have no documentation associated with them are also displayed.
1594 @opindex target-help
1595 Print (on the standard output) a description of target-specific command-line
1596 options for each tool. For some targets extra target-specific
1597 information may also be printed.
1599 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1600 Print (on the standard output) a description of the command-line
1601 options understood by the compiler that fit into all specified classes
1602 and qualifiers. These are the supported classes:
1605 @item @samp{optimizers}
1606 Display all of the optimization options supported by the
1609 @item @samp{warnings}
1610 Display all of the options controlling warning messages
1611 produced by the compiler.
1614 Display target-specific options. Unlike the
1615 @option{--target-help} option however, target-specific options of the
1616 linker and assembler are not displayed. This is because those
1617 tools do not currently support the extended @option{--help=} syntax.
1620 Display the values recognized by the @option{--param}
1623 @item @var{language}
1624 Display the options supported for @var{language}, where
1625 @var{language} is the name of one of the languages supported in this
1629 Display the options that are common to all languages.
1632 These are the supported qualifiers:
1635 @item @samp{undocumented}
1636 Display only those options that are undocumented.
1639 Display options taking an argument that appears after an equal
1640 sign in the same continuous piece of text, such as:
1641 @samp{--help=target}.
1643 @item @samp{separate}
1644 Display options taking an argument that appears as a separate word
1645 following the original option, such as: @samp{-o output-file}.
1648 Thus for example to display all the undocumented target-specific
1649 switches supported by the compiler, use:
1652 --help=target,undocumented
1655 The sense of a qualifier can be inverted by prefixing it with the
1656 @samp{^} character, so for example to display all binary warning
1657 options (i.e., ones that are either on or off and that do not take an
1658 argument) that have a description, use:
1661 --help=warnings,^joined,^undocumented
1664 The argument to @option{--help=} should not consist solely of inverted
1667 Combining several classes is possible, although this usually
1668 restricts the output so much that there is nothing to display. One
1669 case where it does work, however, is when one of the classes is
1670 @var{target}. For example, to display all the target-specific
1671 optimization options, use:
1674 --help=target,optimizers
1677 The @option{--help=} option can be repeated on the command line. Each
1678 successive use displays its requested class of options, skipping
1679 those that have already been displayed. If @option{--help} is also
1680 specified anywhere on the command line then this takes precedence
1681 over any @option{--help=} option.
1683 If the @option{-Q} option appears on the command line before the
1684 @option{--help=} option, then the descriptive text displayed by
1685 @option{--help=} is changed. Instead of describing the displayed
1686 options, an indication is given as to whether the option is enabled,
1687 disabled or set to a specific value (assuming that the compiler
1688 knows this at the point where the @option{--help=} option is used).
1690 Here is a truncated example from the ARM port of @command{gcc}:
1693 % gcc -Q -mabi=2 --help=target -c
1694 The following options are target specific:
1696 -mabort-on-noreturn [disabled]
1700 The output is sensitive to the effects of previous command-line
1701 options, so for example it is possible to find out which optimizations
1702 are enabled at @option{-O2} by using:
1705 -Q -O2 --help=optimizers
1708 Alternatively you can discover which binary optimizations are enabled
1709 by @option{-O3} by using:
1712 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1713 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1714 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1719 Display the version number and copyrights of the invoked GCC@.
1721 @item -pass-exit-codes
1722 @opindex pass-exit-codes
1723 Normally the @command{gcc} program exits with the code of 1 if any
1724 phase of the compiler returns a non-success return code. If you specify
1725 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1726 the numerically highest error produced by any phase returning an error
1727 indication. The C, C++, and Fortran front ends return 4 if an internal
1728 compiler error is encountered.
1732 Use pipes rather than temporary files for communication between the
1733 various stages of compilation. This fails to work on some systems where
1734 the assembler is unable to read from a pipe; but the GNU assembler has
1737 @item -specs=@var{file}
1739 Process @var{file} after the compiler reads in the standard @file{specs}
1740 file, in order to override the defaults which the @command{gcc} driver
1741 program uses when determining what switches to pass to @command{cc1},
1742 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1743 @option{-specs=@var{file}} can be specified on the command line, and they
1744 are processed in order, from left to right. @xref{Spec Files}, for
1745 information about the format of the @var{file}.
1749 Invoke all subcommands under a wrapper program. The name of the
1750 wrapper program and its parameters are passed as a comma separated
1754 gcc -c t.c -wrapper gdb,--args
1758 This invokes all subprograms of @command{gcc} under
1759 @samp{gdb --args}, thus the invocation of @command{cc1} is
1760 @samp{gdb --args cc1 @dots{}}.
1762 @item -ffile-prefix-map=@var{old}=@var{new}
1763 @opindex ffile-prefix-map
1764 When compiling files residing in directory @file{@var{old}}, record
1765 any references to them in the result of the compilation as if the
1766 files resided in directory @file{@var{new}} instead. Specifying this
1767 option is equivalent to specifying all the individual
1768 @option{-f*-prefix-map} options. This can be used to make reproducible
1769 builds that are location independent. See also
1770 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1772 @item -fplugin=@var{name}.so
1774 Load the plugin code in file @var{name}.so, assumed to be a
1775 shared object to be dlopen'd by the compiler. The base name of
1776 the shared object file is used to identify the plugin for the
1777 purposes of argument parsing (See
1778 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1779 Each plugin should define the callback functions specified in the
1782 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1783 @opindex fplugin-arg
1784 Define an argument called @var{key} with a value of @var{value}
1785 for the plugin called @var{name}.
1787 @item -fdump-ada-spec@r{[}-slim@r{]}
1788 @opindex fdump-ada-spec
1789 For C and C++ source and include files, generate corresponding Ada specs.
1790 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1791 GNAT User's Guide}, which provides detailed documentation on this feature.
1793 @item -fada-spec-parent=@var{unit}
1794 @opindex fada-spec-parent
1795 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1796 Ada specs as child units of parent @var{unit}.
1798 @item -fdump-go-spec=@var{file}
1799 @opindex fdump-go-spec
1800 For input files in any language, generate corresponding Go
1801 declarations in @var{file}. This generates Go @code{const},
1802 @code{type}, @code{var}, and @code{func} declarations which may be a
1803 useful way to start writing a Go interface to code written in some
1806 @include @value{srcdir}/../libiberty/at-file.texi
1810 @section Compiling C++ Programs
1812 @cindex suffixes for C++ source
1813 @cindex C++ source file suffixes
1814 C++ source files conventionally use one of the suffixes @samp{.C},
1815 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1816 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1817 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1818 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1819 files with these names and compiles them as C++ programs even if you
1820 call the compiler the same way as for compiling C programs (usually
1821 with the name @command{gcc}).
1825 However, the use of @command{gcc} does not add the C++ library.
1826 @command{g++} is a program that calls GCC and automatically specifies linking
1827 against the C++ library. It treats @samp{.c},
1828 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1829 files unless @option{-x} is used. This program is also useful when
1830 precompiling a C header file with a @samp{.h} extension for use in C++
1831 compilations. On many systems, @command{g++} is also installed with
1832 the name @command{c++}.
1834 @cindex invoking @command{g++}
1835 When you compile C++ programs, you may specify many of the same
1836 command-line options that you use for compiling programs in any
1837 language; or command-line options meaningful for C and related
1838 languages; or options that are meaningful only for C++ programs.
1839 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1840 explanations of options for languages related to C@.
1841 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1842 explanations of options that are meaningful only for C++ programs.
1844 @node C Dialect Options
1845 @section Options Controlling C Dialect
1846 @cindex dialect options
1847 @cindex language dialect options
1848 @cindex options, dialect
1850 The following options control the dialect of C (or languages derived
1851 from C, such as C++, Objective-C and Objective-C++) that the compiler
1855 @cindex ANSI support
1859 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1860 equivalent to @option{-std=c++98}.
1862 This turns off certain features of GCC that are incompatible with ISO
1863 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1864 such as the @code{asm} and @code{typeof} keywords, and
1865 predefined macros such as @code{unix} and @code{vax} that identify the
1866 type of system you are using. It also enables the undesirable and
1867 rarely used ISO trigraph feature. For the C compiler,
1868 it disables recognition of C++ style @samp{//} comments as well as
1869 the @code{inline} keyword.
1871 The alternate keywords @code{__asm__}, @code{__extension__},
1872 @code{__inline__} and @code{__typeof__} continue to work despite
1873 @option{-ansi}. You would not want to use them in an ISO C program, of
1874 course, but it is useful to put them in header files that might be included
1875 in compilations done with @option{-ansi}. Alternate predefined macros
1876 such as @code{__unix__} and @code{__vax__} are also available, with or
1877 without @option{-ansi}.
1879 The @option{-ansi} option does not cause non-ISO programs to be
1880 rejected gratuitously. For that, @option{-Wpedantic} is required in
1881 addition to @option{-ansi}. @xref{Warning Options}.
1883 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1884 option is used. Some header files may notice this macro and refrain
1885 from declaring certain functions or defining certain macros that the
1886 ISO standard doesn't call for; this is to avoid interfering with any
1887 programs that might use these names for other things.
1889 Functions that are normally built in but do not have semantics
1890 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1891 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1892 built-in functions provided by GCC}, for details of the functions
1897 Determine the language standard. @xref{Standards,,Language Standards
1898 Supported by GCC}, for details of these standard versions. This option
1899 is currently only supported when compiling C or C++.
1901 The compiler can accept several base standards, such as @samp{c90} or
1902 @samp{c++98}, and GNU dialects of those standards, such as
1903 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1904 compiler accepts all programs following that standard plus those
1905 using GNU extensions that do not contradict it. For example,
1906 @option{-std=c90} turns off certain features of GCC that are
1907 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1908 keywords, but not other GNU extensions that do not have a meaning in
1909 ISO C90, such as omitting the middle term of a @code{?:}
1910 expression. On the other hand, when a GNU dialect of a standard is
1911 specified, all features supported by the compiler are enabled, even when
1912 those features change the meaning of the base standard. As a result, some
1913 strict-conforming programs may be rejected. The particular standard
1914 is used by @option{-Wpedantic} to identify which features are GNU
1915 extensions given that version of the standard. For example
1916 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1917 comments, while @option{-std=gnu99 -Wpedantic} does not.
1919 A value for this option must be provided; possible values are
1925 Support all ISO C90 programs (certain GNU extensions that conflict
1926 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1928 @item iso9899:199409
1929 ISO C90 as modified in amendment 1.
1935 ISO C99. This standard is substantially completely supported, modulo
1936 bugs and floating-point issues
1937 (mainly but not entirely relating to optional C99 features from
1938 Annexes F and G). See
1939 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1940 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1945 ISO C11, the 2011 revision of the ISO C standard. This standard is
1946 substantially completely supported, modulo bugs, floating-point issues
1947 (mainly but not entirely relating to optional C11 features from
1948 Annexes F and G) and the optional Annexes K (Bounds-checking
1949 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1955 ISO C17, the 2017 revision of the ISO C standard
1956 (published in 2018). This standard is
1957 same as C11 except for corrections of defects (all of which are also
1958 applied with @option{-std=c11}) and a new value of
1959 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1962 The next version of the ISO C standard, still under development. The
1963 support for this version is experimental and incomplete.
1967 GNU dialect of ISO C90 (including some C99 features).
1971 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1975 GNU dialect of ISO C11.
1976 The name @samp{gnu1x} is deprecated.
1980 GNU dialect of ISO C17. This is the default for C code.
1983 The next version of the ISO C standard, still under development, plus
1984 GNU extensions. The support for this version is experimental and
1989 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1990 additional defect reports. Same as @option{-ansi} for C++ code.
1994 GNU dialect of @option{-std=c++98}.
1998 The 2011 ISO C++ standard plus amendments.
1999 The name @samp{c++0x} is deprecated.
2003 GNU dialect of @option{-std=c++11}.
2004 The name @samp{gnu++0x} is deprecated.
2008 The 2014 ISO C++ standard plus amendments.
2009 The name @samp{c++1y} is deprecated.
2013 GNU dialect of @option{-std=c++14}.
2014 This is the default for C++ code.
2015 The name @samp{gnu++1y} is deprecated.
2019 The 2017 ISO C++ standard plus amendments.
2020 The name @samp{c++1z} is deprecated.
2024 GNU dialect of @option{-std=c++17}.
2025 The name @samp{gnu++1z} is deprecated.
2028 The next revision of the ISO C++ standard, tentatively planned for
2029 2020. Support is highly experimental, and will almost certainly
2030 change in incompatible ways in future releases.
2033 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
2034 and will almost certainly change in incompatible ways in future
2038 @item -fgnu89-inline
2039 @opindex fgnu89-inline
2040 The option @option{-fgnu89-inline} tells GCC to use the traditional
2041 GNU semantics for @code{inline} functions when in C99 mode.
2042 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2043 Using this option is roughly equivalent to adding the
2044 @code{gnu_inline} function attribute to all inline functions
2045 (@pxref{Function Attributes}).
2047 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2048 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2049 specifies the default behavior).
2050 This option is not supported in @option{-std=c90} or
2051 @option{-std=gnu90} mode.
2053 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2054 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2055 in effect for @code{inline} functions. @xref{Common Predefined
2056 Macros,,,cpp,The C Preprocessor}.
2058 @item -fpermitted-flt-eval-methods=@var{style}
2059 @opindex fpermitted-flt-eval-methods
2060 @opindex fpermitted-flt-eval-methods=c11
2061 @opindex fpermitted-flt-eval-methods=ts-18661-3
2062 ISO/IEC TS 18661-3 defines new permissible values for
2063 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2064 a semantic type that is an interchange or extended format should be
2065 evaluated to the precision and range of that type. These new values are
2066 a superset of those permitted under C99/C11, which does not specify the
2067 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2068 conforming to C11 may not have been written expecting the possibility of
2071 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2072 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2073 or the extended set of values specified in ISO/IEC TS 18661-3.
2075 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2077 The default when in a standards compliant mode (@option{-std=c11} or similar)
2078 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2079 dialect (@option{-std=gnu11} or similar) is
2080 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2082 @item -aux-info @var{filename}
2084 Output to the given filename prototyped declarations for all functions
2085 declared and/or defined in a translation unit, including those in header
2086 files. This option is silently ignored in any language other than C@.
2088 Besides declarations, the file indicates, in comments, the origin of
2089 each declaration (source file and line), whether the declaration was
2090 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2091 @samp{O} for old, respectively, in the first character after the line
2092 number and the colon), and whether it came from a declaration or a
2093 definition (@samp{C} or @samp{F}, respectively, in the following
2094 character). In the case of function definitions, a K&R-style list of
2095 arguments followed by their declarations is also provided, inside
2096 comments, after the declaration.
2098 @item -fallow-parameterless-variadic-functions
2099 @opindex fallow-parameterless-variadic-functions
2100 Accept variadic functions without named parameters.
2102 Although it is possible to define such a function, this is not very
2103 useful as it is not possible to read the arguments. This is only
2104 supported for C as this construct is allowed by C++.
2109 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2110 keyword, so that code can use these words as identifiers. You can use
2111 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2112 instead. @option{-ansi} implies @option{-fno-asm}.
2114 In C++, this switch only affects the @code{typeof} keyword, since
2115 @code{asm} and @code{inline} are standard keywords. You may want to
2116 use the @option{-fno-gnu-keywords} flag instead, which has the same
2117 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2118 switch only affects the @code{asm} and @code{typeof} keywords, since
2119 @code{inline} is a standard keyword in ISO C99.
2122 @itemx -fno-builtin-@var{function}
2123 @opindex fno-builtin
2125 @cindex built-in functions
2126 Don't recognize built-in functions that do not begin with
2127 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2128 functions provided by GCC}, for details of the functions affected,
2129 including those which are not built-in functions when @option{-ansi} or
2130 @option{-std} options for strict ISO C conformance are used because they
2131 do not have an ISO standard meaning.
2133 GCC normally generates special code to handle certain built-in functions
2134 more efficiently; for instance, calls to @code{alloca} may become single
2135 instructions which adjust the stack directly, and calls to @code{memcpy}
2136 may become inline copy loops. The resulting code is often both smaller
2137 and faster, but since the function calls no longer appear as such, you
2138 cannot set a breakpoint on those calls, nor can you change the behavior
2139 of the functions by linking with a different library. In addition,
2140 when a function is recognized as a built-in function, GCC may use
2141 information about that function to warn about problems with calls to
2142 that function, or to generate more efficient code, even if the
2143 resulting code still contains calls to that function. For example,
2144 warnings are given with @option{-Wformat} for bad calls to
2145 @code{printf} when @code{printf} is built in and @code{strlen} is
2146 known not to modify global memory.
2148 With the @option{-fno-builtin-@var{function}} option
2149 only the built-in function @var{function} is
2150 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2151 function is named that is not built-in in this version of GCC, this
2152 option is ignored. There is no corresponding
2153 @option{-fbuiltin-@var{function}} option; if you wish to enable
2154 built-in functions selectively when using @option{-fno-builtin} or
2155 @option{-ffreestanding}, you may define macros such as:
2158 #define abs(n) __builtin_abs ((n))
2159 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2165 Enable parsing of function definitions marked with @code{__GIMPLE}.
2166 This is an experimental feature that allows unit testing of GIMPLE
2171 @cindex hosted environment
2173 Assert that compilation targets a hosted environment. This implies
2174 @option{-fbuiltin}. A hosted environment is one in which the
2175 entire standard library is available, and in which @code{main} has a return
2176 type of @code{int}. Examples are nearly everything except a kernel.
2177 This is equivalent to @option{-fno-freestanding}.
2179 @item -ffreestanding
2180 @opindex ffreestanding
2181 @cindex hosted environment
2183 Assert that compilation targets a freestanding environment. This
2184 implies @option{-fno-builtin}. A freestanding environment
2185 is one in which the standard library may not exist, and program startup may
2186 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2187 This is equivalent to @option{-fno-hosted}.
2189 @xref{Standards,,Language Standards Supported by GCC}, for details of
2190 freestanding and hosted environments.
2194 @cindex OpenACC accelerator programming
2195 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2196 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2197 compiler generates accelerated code according to the OpenACC Application
2198 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2199 implies @option{-pthread}, and thus is only supported on targets that
2200 have support for @option{-pthread}.
2202 @item -fopenacc-dim=@var{geom}
2203 @opindex fopenacc-dim
2204 @cindex OpenACC accelerator programming
2205 Specify default compute dimensions for parallel offload regions that do
2206 not explicitly specify. The @var{geom} value is a triple of
2207 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2208 can be omitted, to use a target-specific default value.
2212 @cindex OpenMP parallel
2213 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2214 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2215 compiler generates parallel code according to the OpenMP Application
2216 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2217 implies @option{-pthread}, and thus is only supported on targets that
2218 have support for @option{-pthread}. @option{-fopenmp} implies
2219 @option{-fopenmp-simd}.
2222 @opindex fopenmp-simd
2225 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2226 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2231 When the option @option{-fgnu-tm} is specified, the compiler
2232 generates code for the Linux variant of Intel's current Transactional
2233 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2234 an experimental feature whose interface may change in future versions
2235 of GCC, as the official specification changes. Please note that not
2236 all architectures are supported for this feature.
2238 For more information on GCC's support for transactional memory,
2239 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2240 Transactional Memory Library}.
2242 Note that the transactional memory feature is not supported with
2243 non-call exceptions (@option{-fnon-call-exceptions}).
2245 @item -fms-extensions
2246 @opindex fms-extensions
2247 Accept some non-standard constructs used in Microsoft header files.
2249 In C++ code, this allows member names in structures to be similar
2250 to previous types declarations.
2259 Some cases of unnamed fields in structures and unions are only
2260 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2261 fields within structs/unions}, for details.
2263 Note that this option is off for all targets but x86
2264 targets using ms-abi.
2266 @item -fplan9-extensions
2267 @opindex fplan9-extensions
2268 Accept some non-standard constructs used in Plan 9 code.
2270 This enables @option{-fms-extensions}, permits passing pointers to
2271 structures with anonymous fields to functions that expect pointers to
2272 elements of the type of the field, and permits referring to anonymous
2273 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2274 struct/union fields within structs/unions}, for details. This is only
2275 supported for C, not C++.
2277 @item -fcond-mismatch
2278 @opindex fcond-mismatch
2279 Allow conditional expressions with mismatched types in the second and
2280 third arguments. The value of such an expression is void. This option
2281 is not supported for C++.
2283 @item -flax-vector-conversions
2284 @opindex flax-vector-conversions
2285 Allow implicit conversions between vectors with differing numbers of
2286 elements and/or incompatible element types. This option should not be
2289 @item -funsigned-char
2290 @opindex funsigned-char
2291 Let the type @code{char} be unsigned, like @code{unsigned char}.
2293 Each kind of machine has a default for what @code{char} should
2294 be. It is either like @code{unsigned char} by default or like
2295 @code{signed char} by default.
2297 Ideally, a portable program should always use @code{signed char} or
2298 @code{unsigned char} when it depends on the signedness of an object.
2299 But many programs have been written to use plain @code{char} and
2300 expect it to be signed, or expect it to be unsigned, depending on the
2301 machines they were written for. This option, and its inverse, let you
2302 make such a program work with the opposite default.
2304 The type @code{char} is always a distinct type from each of
2305 @code{signed char} or @code{unsigned char}, even though its behavior
2306 is always just like one of those two.
2309 @opindex fsigned-char
2310 Let the type @code{char} be signed, like @code{signed char}.
2312 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2313 the negative form of @option{-funsigned-char}. Likewise, the option
2314 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2316 @item -fsigned-bitfields
2317 @itemx -funsigned-bitfields
2318 @itemx -fno-signed-bitfields
2319 @itemx -fno-unsigned-bitfields
2320 @opindex fsigned-bitfields
2321 @opindex funsigned-bitfields
2322 @opindex fno-signed-bitfields
2323 @opindex fno-unsigned-bitfields
2324 These options control whether a bit-field is signed or unsigned, when the
2325 declaration does not use either @code{signed} or @code{unsigned}. By
2326 default, such a bit-field is signed, because this is consistent: the
2327 basic integer types such as @code{int} are signed types.
2329 @item -fsso-struct=@var{endianness}
2330 @opindex fsso-struct
2331 Set the default scalar storage order of structures and unions to the
2332 specified endianness. The accepted values are @samp{big-endian},
2333 @samp{little-endian} and @samp{native} for the native endianness of
2334 the target (the default). This option is not supported for C++.
2336 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2337 code that is not binary compatible with code generated without it if the
2338 specified endianness is not the native endianness of the target.
2341 @node C++ Dialect Options
2342 @section Options Controlling C++ Dialect
2344 @cindex compiler options, C++
2345 @cindex C++ options, command-line
2346 @cindex options, C++
2347 This section describes the command-line options that are only meaningful
2348 for C++ programs. You can also use most of the GNU compiler options
2349 regardless of what language your program is in. For example, you
2350 might compile a file @file{firstClass.C} like this:
2353 g++ -g -fstrict-enums -O -c firstClass.C
2357 In this example, only @option{-fstrict-enums} is an option meant
2358 only for C++ programs; you can use the other options with any
2359 language supported by GCC@.
2361 Some options for compiling C programs, such as @option{-std}, are also
2362 relevant for C++ programs.
2363 @xref{C Dialect Options,,Options Controlling C Dialect}.
2365 Here is a list of options that are @emph{only} for compiling C++ programs:
2369 @item -fabi-version=@var{n}
2370 @opindex fabi-version
2371 Use version @var{n} of the C++ ABI@. The default is version 0.
2373 Version 0 refers to the version conforming most closely to
2374 the C++ ABI specification. Therefore, the ABI obtained using version 0
2375 will change in different versions of G++ as ABI bugs are fixed.
2377 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2379 Version 2 is the version of the C++ ABI that first appeared in G++
2380 3.4, and was the default through G++ 4.9.
2382 Version 3 corrects an error in mangling a constant address as a
2385 Version 4, which first appeared in G++ 4.5, implements a standard
2386 mangling for vector types.
2388 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2389 attribute const/volatile on function pointer types, decltype of a
2390 plain decl, and use of a function parameter in the declaration of
2393 Version 6, which first appeared in G++ 4.7, corrects the promotion
2394 behavior of C++11 scoped enums and the mangling of template argument
2395 packs, const/static_cast, prefix ++ and --, and a class scope function
2396 used as a template argument.
2398 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2399 builtin type and corrects the mangling of lambdas in default argument
2402 Version 8, which first appeared in G++ 4.9, corrects the substitution
2403 behavior of function types with function-cv-qualifiers.
2405 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2408 Version 10, which first appeared in G++ 6.1, adds mangling of
2409 attributes that affect type identity, such as ia32 calling convention
2410 attributes (e.g.@: @samp{stdcall}).
2412 Version 11, which first appeared in G++ 7, corrects the mangling of
2413 sizeof... expressions and operator names. For multiple entities with
2414 the same name within a function, that are declared in different scopes,
2415 the mangling now changes starting with the twelfth occurrence. It also
2416 implies @option{-fnew-inheriting-ctors}.
2418 Version 12, which first appeared in G++ 8, corrects the calling
2419 conventions for empty classes on the x86_64 target and for classes
2420 with only deleted copy/move constructors. It accidentally changes the
2421 calling convention for classes with a deleted copy constructor and a
2422 trivial move constructor.
2424 Version 13, which first appeared in G++ 8.2, fixes the accidental
2425 change in version 12.
2427 See also @option{-Wabi}.
2429 @item -fabi-compat-version=@var{n}
2430 @opindex fabi-compat-version
2431 On targets that support strong aliases, G++
2432 works around mangling changes by creating an alias with the correct
2433 mangled name when defining a symbol with an incorrect mangled name.
2434 This switch specifies which ABI version to use for the alias.
2436 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2437 compatibility). If another ABI version is explicitly selected, this
2438 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2439 use @option{-fabi-compat-version=2}.
2441 If this option is not provided but @option{-Wabi=@var{n}} is, that
2442 version is used for compatibility aliases. If this option is provided
2443 along with @option{-Wabi} (without the version), the version from this
2444 option is used for the warning.
2446 @item -fno-access-control
2447 @opindex fno-access-control
2448 @opindex faccess-control
2449 Turn off all access checking. This switch is mainly useful for working
2450 around bugs in the access control code.
2453 @opindex faligned-new
2454 Enable support for C++17 @code{new} of types that require more
2455 alignment than @code{void* ::operator new(std::size_t)} provides. A
2456 numeric argument such as @code{-faligned-new=32} can be used to
2457 specify how much alignment (in bytes) is provided by that function,
2458 but few users will need to override the default of
2459 @code{alignof(std::max_align_t)}.
2461 This flag is enabled by default for @option{-std=c++17}.
2465 Check that the pointer returned by @code{operator new} is non-null
2466 before attempting to modify the storage allocated. This check is
2467 normally unnecessary because the C++ standard specifies that
2468 @code{operator new} only returns @code{0} if it is declared
2469 @code{throw()}, in which case the compiler always checks the
2470 return value even without this option. In all other cases, when
2471 @code{operator new} has a non-empty exception specification, memory
2472 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2473 @samp{new (nothrow)}.
2477 Enable support for the C++ Extensions for Concepts Technical
2478 Specification, ISO 19217 (2015), which allows code like
2481 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2482 template <Addable T> T add (T a, T b) @{ return a + b; @}
2485 @item -fconstexpr-depth=@var{n}
2486 @opindex fconstexpr-depth
2487 Set the maximum nested evaluation depth for C++11 constexpr functions
2488 to @var{n}. A limit is needed to detect endless recursion during
2489 constant expression evaluation. The minimum specified by the standard
2492 @item -fconstexpr-loop-limit=@var{n}
2493 @opindex fconstexpr-loop-limit
2494 Set the maximum number of iterations for a loop in C++14 constexpr functions
2495 to @var{n}. A limit is needed to detect infinite loops during
2496 constant expression evaluation. The default is 262144 (1<<18).
2498 @item -fdeduce-init-list
2499 @opindex fdeduce-init-list
2500 Enable deduction of a template type parameter as
2501 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2504 template <class T> auto forward(T t) -> decltype (realfn (t))
2511 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2515 This deduction was implemented as a possible extension to the
2516 originally proposed semantics for the C++11 standard, but was not part
2517 of the final standard, so it is disabled by default. This option is
2518 deprecated, and may be removed in a future version of G++.
2520 @item -fno-elide-constructors
2521 @opindex fno-elide-constructors
2522 @opindex felide-constructors
2523 The C++ standard allows an implementation to omit creating a temporary
2524 that is only used to initialize another object of the same type.
2525 Specifying this option disables that optimization, and forces G++ to
2526 call the copy constructor in all cases. This option also causes G++
2527 to call trivial member functions which otherwise would be expanded inline.
2529 In C++17, the compiler is required to omit these temporaries, but this
2530 option still affects trivial member functions.
2532 @item -fno-enforce-eh-specs
2533 @opindex fno-enforce-eh-specs
2534 @opindex fenforce-eh-specs
2535 Don't generate code to check for violation of exception specifications
2536 at run time. This option violates the C++ standard, but may be useful
2537 for reducing code size in production builds, much like defining
2538 @code{NDEBUG}. This does not give user code permission to throw
2539 exceptions in violation of the exception specifications; the compiler
2540 still optimizes based on the specifications, so throwing an
2541 unexpected exception results in undefined behavior at run time.
2543 @item -fextern-tls-init
2544 @itemx -fno-extern-tls-init
2545 @opindex fextern-tls-init
2546 @opindex fno-extern-tls-init
2547 The C++11 and OpenMP standards allow @code{thread_local} and
2548 @code{threadprivate} variables to have dynamic (runtime)
2549 initialization. To support this, any use of such a variable goes
2550 through a wrapper function that performs any necessary initialization.
2551 When the use and definition of the variable are in the same
2552 translation unit, this overhead can be optimized away, but when the
2553 use is in a different translation unit there is significant overhead
2554 even if the variable doesn't actually need dynamic initialization. If
2555 the programmer can be sure that no use of the variable in a
2556 non-defining TU needs to trigger dynamic initialization (either
2557 because the variable is statically initialized, or a use of the
2558 variable in the defining TU will be executed before any uses in
2559 another TU), they can avoid this overhead with the
2560 @option{-fno-extern-tls-init} option.
2562 On targets that support symbol aliases, the default is
2563 @option{-fextern-tls-init}. On targets that do not support symbol
2564 aliases, the default is @option{-fno-extern-tls-init}.
2566 @item -fno-gnu-keywords
2567 @opindex fno-gnu-keywords
2568 @opindex fgnu-keywords
2569 Do not recognize @code{typeof} as a keyword, so that code can use this
2570 word as an identifier. You can use the keyword @code{__typeof__} instead.
2571 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2572 @option{-std=c++98}, @option{-std=c++11}, etc.
2574 @item -fno-implicit-templates
2575 @opindex fno-implicit-templates
2576 @opindex fimplicit-templates
2577 Never emit code for non-inline templates that are instantiated
2578 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2579 If you use this option, you must take care to structure your code to
2580 include all the necessary explicit instantiations to avoid getting
2581 undefined symbols at link time.
2582 @xref{Template Instantiation}, for more information.
2584 @item -fno-implicit-inline-templates
2585 @opindex fno-implicit-inline-templates
2586 @opindex fimplicit-inline-templates
2587 Don't emit code for implicit instantiations of inline templates, either.
2588 The default is to handle inlines differently so that compiles with and
2589 without optimization need the same set of explicit instantiations.
2591 @item -fno-implement-inlines
2592 @opindex fno-implement-inlines
2593 @opindex fimplement-inlines
2594 To save space, do not emit out-of-line copies of inline functions
2595 controlled by @code{#pragma implementation}. This causes linker
2596 errors if these functions are not inlined everywhere they are called.
2598 @item -fms-extensions
2599 @opindex fms-extensions
2600 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2601 int and getting a pointer to member function via non-standard syntax.
2603 @item -fnew-inheriting-ctors
2604 @opindex fnew-inheriting-ctors
2605 Enable the P0136 adjustment to the semantics of C++11 constructor
2606 inheritance. This is part of C++17 but also considered to be a Defect
2607 Report against C++11 and C++14. This flag is enabled by default
2608 unless @option{-fabi-version=10} or lower is specified.
2610 @item -fnew-ttp-matching
2611 @opindex fnew-ttp-matching
2612 Enable the P0522 resolution to Core issue 150, template template
2613 parameters and default arguments: this allows a template with default
2614 template arguments as an argument for a template template parameter
2615 with fewer template parameters. This flag is enabled by default for
2616 @option{-std=c++17}.
2618 @item -fno-nonansi-builtins
2619 @opindex fno-nonansi-builtins
2620 @opindex fnonansi-builtins
2621 Disable built-in declarations of functions that are not mandated by
2622 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2623 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2626 @opindex fnothrow-opt
2627 Treat a @code{throw()} exception specification as if it were a
2628 @code{noexcept} specification to reduce or eliminate the text size
2629 overhead relative to a function with no exception specification. If
2630 the function has local variables of types with non-trivial
2631 destructors, the exception specification actually makes the
2632 function smaller because the EH cleanups for those variables can be
2633 optimized away. The semantic effect is that an exception thrown out of
2634 a function with such an exception specification results in a call
2635 to @code{terminate} rather than @code{unexpected}.
2637 @item -fno-operator-names
2638 @opindex fno-operator-names
2639 @opindex foperator-names
2640 Do not treat the operator name keywords @code{and}, @code{bitand},
2641 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2642 synonyms as keywords.
2644 @item -fno-optional-diags
2645 @opindex fno-optional-diags
2646 @opindex foptional-diags
2647 Disable diagnostics that the standard says a compiler does not need to
2648 issue. Currently, the only such diagnostic issued by G++ is the one for
2649 a name having multiple meanings within a class.
2652 @opindex fpermissive
2653 Downgrade some diagnostics about nonconformant code from errors to
2654 warnings. Thus, using @option{-fpermissive} allows some
2655 nonconforming code to compile.
2657 @item -fno-pretty-templates
2658 @opindex fno-pretty-templates
2659 @opindex fpretty-templates
2660 When an error message refers to a specialization of a function
2661 template, the compiler normally prints the signature of the
2662 template followed by the template arguments and any typedefs or
2663 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2664 rather than @code{void f(int)}) so that it's clear which template is
2665 involved. When an error message refers to a specialization of a class
2666 template, the compiler omits any template arguments that match
2667 the default template arguments for that template. If either of these
2668 behaviors make it harder to understand the error message rather than
2669 easier, you can use @option{-fno-pretty-templates} to disable them.
2673 Enable automatic template instantiation at link time. This option also
2674 implies @option{-fno-implicit-templates}. @xref{Template
2675 Instantiation}, for more information.
2680 Disable generation of information about every class with virtual
2681 functions for use by the C++ run-time type identification features
2682 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2683 of the language, you can save some space by using this flag. Note that
2684 exception handling uses the same information, but G++ generates it as
2685 needed. The @code{dynamic_cast} operator can still be used for casts that
2686 do not require run-time type information, i.e.@: casts to @code{void *} or to
2687 unambiguous base classes.
2689 Mixing code compiled with @option{-frtti} with that compiled with
2690 @option{-fno-rtti} may not work. For example, programs may
2691 fail to link if a class compiled with @option{-fno-rtti} is used as a base
2692 for a class compiled with @option{-frtti}.
2694 @item -fsized-deallocation
2695 @opindex fsized-deallocation
2696 Enable the built-in global declarations
2698 void operator delete (void *, std::size_t) noexcept;
2699 void operator delete[] (void *, std::size_t) noexcept;
2701 as introduced in C++14. This is useful for user-defined replacement
2702 deallocation functions that, for example, use the size of the object
2703 to make deallocation faster. Enabled by default under
2704 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2705 warns about places that might want to add a definition.
2707 @item -fstrict-enums
2708 @opindex fstrict-enums
2709 Allow the compiler to optimize using the assumption that a value of
2710 enumerated type can only be one of the values of the enumeration (as
2711 defined in the C++ standard; basically, a value that can be
2712 represented in the minimum number of bits needed to represent all the
2713 enumerators). This assumption may not be valid if the program uses a
2714 cast to convert an arbitrary integer value to the enumerated type.
2716 @item -fstrong-eval-order
2717 @opindex fstrong-eval-order
2718 Evaluate member access, array subscripting, and shift expressions in
2719 left-to-right order, and evaluate assignment in right-to-left order,
2720 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2721 @option{-fstrong-eval-order=some} enables just the ordering of member
2722 access and shift expressions, and is the default without
2723 @option{-std=c++17}.
2725 @item -ftemplate-backtrace-limit=@var{n}
2726 @opindex ftemplate-backtrace-limit
2727 Set the maximum number of template instantiation notes for a single
2728 warning or error to @var{n}. The default value is 10.
2730 @item -ftemplate-depth=@var{n}
2731 @opindex ftemplate-depth
2732 Set the maximum instantiation depth for template classes to @var{n}.
2733 A limit on the template instantiation depth is needed to detect
2734 endless recursions during template class instantiation. ANSI/ISO C++
2735 conforming programs must not rely on a maximum depth greater than 17
2736 (changed to 1024 in C++11). The default value is 900, as the compiler
2737 can run out of stack space before hitting 1024 in some situations.
2739 @item -fno-threadsafe-statics
2740 @opindex fno-threadsafe-statics
2741 @opindex fthreadsafe-statics
2742 Do not emit the extra code to use the routines specified in the C++
2743 ABI for thread-safe initialization of local statics. You can use this
2744 option to reduce code size slightly in code that doesn't need to be
2747 @item -fuse-cxa-atexit
2748 @opindex fuse-cxa-atexit
2749 Register destructors for objects with static storage duration with the
2750 @code{__cxa_atexit} function rather than the @code{atexit} function.
2751 This option is required for fully standards-compliant handling of static
2752 destructors, but only works if your C library supports
2753 @code{__cxa_atexit}.
2755 @item -fno-use-cxa-get-exception-ptr
2756 @opindex fno-use-cxa-get-exception-ptr
2757 @opindex fuse-cxa-get-exception-ptr
2758 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2759 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2760 if the runtime routine is not available.
2762 @item -fvisibility-inlines-hidden
2763 @opindex fvisibility-inlines-hidden
2764 This switch declares that the user does not attempt to compare
2765 pointers to inline functions or methods where the addresses of the two functions
2766 are taken in different shared objects.
2768 The effect of this is that GCC may, effectively, mark inline methods with
2769 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2770 appear in the export table of a DSO and do not require a PLT indirection
2771 when used within the DSO@. Enabling this option can have a dramatic effect
2772 on load and link times of a DSO as it massively reduces the size of the
2773 dynamic export table when the library makes heavy use of templates.
2775 The behavior of this switch is not quite the same as marking the
2776 methods as hidden directly, because it does not affect static variables
2777 local to the function or cause the compiler to deduce that
2778 the function is defined in only one shared object.
2780 You may mark a method as having a visibility explicitly to negate the
2781 effect of the switch for that method. For example, if you do want to
2782 compare pointers to a particular inline method, you might mark it as
2783 having default visibility. Marking the enclosing class with explicit
2784 visibility has no effect.
2786 Explicitly instantiated inline methods are unaffected by this option
2787 as their linkage might otherwise cross a shared library boundary.
2788 @xref{Template Instantiation}.
2790 @item -fvisibility-ms-compat
2791 @opindex fvisibility-ms-compat
2792 This flag attempts to use visibility settings to make GCC's C++
2793 linkage model compatible with that of Microsoft Visual Studio.
2795 The flag makes these changes to GCC's linkage model:
2799 It sets the default visibility to @code{hidden}, like
2800 @option{-fvisibility=hidden}.
2803 Types, but not their members, are not hidden by default.
2806 The One Definition Rule is relaxed for types without explicit
2807 visibility specifications that are defined in more than one
2808 shared object: those declarations are permitted if they are
2809 permitted when this option is not used.
2812 In new code it is better to use @option{-fvisibility=hidden} and
2813 export those classes that are intended to be externally visible.
2814 Unfortunately it is possible for code to rely, perhaps accidentally,
2815 on the Visual Studio behavior.
2817 Among the consequences of these changes are that static data members
2818 of the same type with the same name but defined in different shared
2819 objects are different, so changing one does not change the other;
2820 and that pointers to function members defined in different shared
2821 objects may not compare equal. When this flag is given, it is a
2822 violation of the ODR to define types with the same name differently.
2827 Do not use weak symbol support, even if it is provided by the linker.
2828 By default, G++ uses weak symbols if they are available. This
2829 option exists only for testing, and should not be used by end-users;
2830 it results in inferior code and has no benefits. This option may
2831 be removed in a future release of G++.
2835 Do not search for header files in the standard directories specific to
2836 C++, but do still search the other standard directories. (This option
2837 is used when building the C++ library.)
2840 In addition, these optimization, warning, and code generation options
2841 have meanings only for C++ programs:
2844 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2847 Warn when G++ it generates code that is probably not compatible with
2848 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2849 ABI with each major release, normally @option{-Wabi} will warn only if
2850 there is a check added later in a release series for an ABI issue
2851 discovered since the initial release. @option{-Wabi} will warn about
2852 more things if an older ABI version is selected (with
2853 @option{-fabi-version=@var{n}}).
2855 @option{-Wabi} can also be used with an explicit version number to
2856 warn about compatibility with a particular @option{-fabi-version}
2857 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2858 @option{-fabi-version=2}.
2860 If an explicit version number is provided and
2861 @option{-fabi-compat-version} is not specified, the version number
2862 from this option is used for compatibility aliases. If no explicit
2863 version number is provided with this option, but
2864 @option{-fabi-compat-version} is specified, that version number is
2865 used for ABI warnings.
2867 Although an effort has been made to warn about
2868 all such cases, there are probably some cases that are not warned about,
2869 even though G++ is generating incompatible code. There may also be
2870 cases where warnings are emitted even though the code that is generated
2873 You should rewrite your code to avoid these warnings if you are
2874 concerned about the fact that code generated by G++ may not be binary
2875 compatible with code generated by other compilers.
2877 Known incompatibilities in @option{-fabi-version=2} (which was the
2878 default from GCC 3.4 to 4.9) include:
2883 A template with a non-type template parameter of reference type was
2884 mangled incorrectly:
2887 template <int &> struct S @{@};
2891 This was fixed in @option{-fabi-version=3}.
2894 SIMD vector types declared using @code{__attribute ((vector_size))} were
2895 mangled in a non-standard way that does not allow for overloading of
2896 functions taking vectors of different sizes.
2898 The mangling was changed in @option{-fabi-version=4}.
2901 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2902 qualifiers, and @code{decltype} of a plain declaration was folded away.
2904 These mangling issues were fixed in @option{-fabi-version=5}.
2907 Scoped enumerators passed as arguments to a variadic function are
2908 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2909 On most targets this does not actually affect the parameter passing
2910 ABI, as there is no way to pass an argument smaller than @code{int}.
2912 Also, the ABI changed the mangling of template argument packs,
2913 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2914 a class scope function used as a template argument.
2916 These issues were corrected in @option{-fabi-version=6}.
2919 Lambdas in default argument scope were mangled incorrectly, and the
2920 ABI changed the mangling of @code{nullptr_t}.
2922 These issues were corrected in @option{-fabi-version=7}.
2925 When mangling a function type with function-cv-qualifiers, the
2926 un-qualified function type was incorrectly treated as a substitution
2929 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2932 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2933 unaligned accesses. Note that this did not affect the ABI of a
2934 function with a @code{nullptr_t} parameter, as parameters have a
2937 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2940 Target-specific attributes that affect the identity of a type, such as
2941 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2942 did not affect the mangled name, leading to name collisions when
2943 function pointers were used as template arguments.
2945 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2949 It also warns about psABI-related changes. The known psABI changes at this
2955 For SysV/x86-64, unions with @code{long double} members are
2956 passed in memory as specified in psABI. For example:
2966 @code{union U} is always passed in memory.
2970 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2973 Warn when a type with an ABI tag is used in a context that does not
2974 have that ABI tag. See @ref{C++ Attributes} for more information
2977 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2978 @opindex Wctor-dtor-privacy
2979 @opindex Wno-ctor-dtor-privacy
2980 Warn when a class seems unusable because all the constructors or
2981 destructors in that class are private, and it has neither friends nor
2982 public static member functions. Also warn if there are no non-private
2983 methods, and there's at least one private member function that isn't
2984 a constructor or destructor.
2986 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2987 @opindex Wdelete-non-virtual-dtor
2988 @opindex Wno-delete-non-virtual-dtor
2989 Warn when @code{delete} is used to destroy an instance of a class that
2990 has virtual functions and non-virtual destructor. It is unsafe to delete
2991 an instance of a derived class through a pointer to a base class if the
2992 base class does not have a virtual destructor. This warning is enabled
2995 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
2996 @opindex Wdeprecated-copy
2997 @opindex Wno-deprecated-copy
2998 Warn that the implicit declaration of a copy constructor or copy
2999 assignment operator is deprecated if the class has a user-provided
3000 copy constructor, copy assignment operator, or destructor, in C++11
3001 and up. This warning is enabled by @option{-Wall}.
3003 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3004 @opindex Winit-list-lifetime
3005 @opindex Wno-init-list-lifetime
3006 Do not warn about uses of @code{std::initializer_list} that are likely
3007 to result in dangling pointers. Since the underlying array for an
3008 @code{initializer_list} is handled like a normal C++ temporary object,
3009 it is easy to inadvertently keep a pointer to the array past the end
3010 of the array's lifetime. For example:
3014 If a function returns a temporary @code{initializer_list}, or a local
3015 @code{initializer_list} variable, the array's lifetime ends at the end
3016 of the return statement, so the value returned has a dangling pointer.
3019 If a new-expression creates an @code{initializer_list}, the array only
3020 lives until the end of the enclosing full-expression, so the
3021 @code{initializer_list} in the heap has a dangling pointer.
3024 When an @code{initializer_list} variable is assigned from a
3025 brace-enclosed initializer list, the temporary array created for the
3026 right side of the assignment only lives until the end of the
3027 full-expression, so at the next statement the @code{initializer_list}
3028 variable has a dangling pointer.
3031 // li's initial underlying array lives as long as li
3032 std::initializer_list<int> li = @{ 1,2,3 @};
3033 // assignment changes li to point to a temporary array
3035 // now the temporary is gone and li has a dangling pointer
3036 int i = li.begin()[0] // undefined behavior
3040 When a list constructor stores the @code{begin} pointer from the
3041 @code{initializer_list} argument, this doesn't extend the lifetime of
3042 the array, so if a class variable is constructed from a temporary
3043 @code{initializer_list}, the pointer is left dangling by the end of
3044 the variable declaration statement.
3048 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3049 @opindex Wliteral-suffix
3050 @opindex Wno-literal-suffix
3051 Warn when a string or character literal is followed by a ud-suffix which does
3052 not begin with an underscore. As a conforming extension, GCC treats such
3053 suffixes as separate preprocessing tokens in order to maintain backwards
3054 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3058 #define __STDC_FORMAT_MACROS
3059 #include <inttypes.h>
3064 printf("My int64: %" PRId64"\n", i64);
3068 In this case, @code{PRId64} is treated as a separate preprocessing token.
3070 Additionally, warn when a user-defined literal operator is declared with
3071 a literal suffix identifier that doesn't begin with an underscore. Literal
3072 suffix identifiers that don't begin with an underscore are reserved for
3073 future standardization.
3075 This warning is enabled by default.
3077 @item -Wlto-type-mismatch
3078 @opindex Wlto-type-mismatch
3079 @opindex Wno-lto-type-mismatch
3081 During the link-time optimization warn about type mismatches in
3082 global declarations from different compilation units.
3083 Requires @option{-flto} to be enabled. Enabled by default.
3085 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3087 @opindex Wno-narrowing
3088 For C++11 and later standards, narrowing conversions are diagnosed by default,
3089 as required by the standard. A narrowing conversion from a constant produces
3090 an error, and a narrowing conversion from a non-constant produces a warning,
3091 but @option{-Wno-narrowing} suppresses the diagnostic.
3092 Note that this does not affect the meaning of well-formed code;
3093 narrowing conversions are still considered ill-formed in SFINAE contexts.
3095 With @option{-Wnarrowing} in C++98, warn when a narrowing
3096 conversion prohibited by C++11 occurs within
3100 int i = @{ 2.2 @}; // error: narrowing from double to int
3103 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3105 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3107 @opindex Wno-noexcept
3108 Warn when a noexcept-expression evaluates to false because of a call
3109 to a function that does not have a non-throwing exception
3110 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3111 the compiler to never throw an exception.
3113 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3114 @opindex Wnoexcept-type
3115 @opindex Wno-noexcept-type
3116 Warn if the C++17 feature making @code{noexcept} part of a function
3117 type changes the mangled name of a symbol relative to C++14. Enabled
3118 by @option{-Wabi} and @option{-Wc++17-compat}.
3123 template <class T> void f(T t) @{ t(); @};
3125 void h() @{ f(g); @}
3129 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3130 C++17 it calls @code{f<void(*)()noexcept>}.
3132 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3133 @opindex Wclass-memaccess
3134 @opindex Wno-class-memaccess
3135 Warn when the destination of a call to a raw memory function such as
3136 @code{memset} or @code{memcpy} is an object of class type, and when writing
3137 into such an object might bypass the class non-trivial or deleted constructor
3138 or copy assignment, violate const-correctness or encapsulation, or corrupt
3139 virtual table pointers. Modifying the representation of such objects may
3140 violate invariants maintained by member functions of the class. For example,
3141 the call to @code{memset} below is undefined because it modifies a non-trivial
3142 class object and is, therefore, diagnosed. The safe way to either initialize
3143 or clear the storage of objects of such types is by using the appropriate
3144 constructor or assignment operator, if one is available.
3146 std::string str = "abc";
3147 memset (&str, 0, sizeof str);
3149 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3150 Explicitly casting the pointer to the class object to @code{void *} or
3151 to a type that can be safely accessed by the raw memory function suppresses
3154 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3155 @opindex Wnon-virtual-dtor
3156 @opindex Wno-non-virtual-dtor
3157 Warn when a class has virtual functions and an accessible non-virtual
3158 destructor itself or in an accessible polymorphic base class, in which
3159 case it is possible but unsafe to delete an instance of a derived
3160 class through a pointer to the class itself or base class. This
3161 warning is automatically enabled if @option{-Weffc++} is specified.
3163 @item -Wregister @r{(C++ and Objective-C++ only)}
3165 @opindex Wno-register
3166 Warn on uses of the @code{register} storage class specifier, except
3167 when it is part of the GNU @ref{Explicit Register Variables} extension.
3168 The use of the @code{register} keyword as storage class specifier has
3169 been deprecated in C++11 and removed in C++17.
3170 Enabled by default with @option{-std=c++17}.
3172 @item -Wreorder @r{(C++ and Objective-C++ only)}
3174 @opindex Wno-reorder
3175 @cindex reordering, warning
3176 @cindex warning for reordering of member initializers
3177 Warn when the order of member initializers given in the code does not
3178 match the order in which they must be executed. For instance:
3184 A(): j (0), i (1) @{ @}
3189 The compiler rearranges the member initializers for @code{i}
3190 and @code{j} to match the declaration order of the members, emitting
3191 a warning to that effect. This warning is enabled by @option{-Wall}.
3193 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3194 @opindex Wpessimizing-move
3195 @opindex Wno-pessimizing-move
3196 This warning warns when a call to @code{std::move} prevents copy
3197 elision. A typical scenario when copy elision can occur is when returning in
3198 a function with a class return type, when the expression being returned is the
3199 name of a non-volatile automatic object, and is not a function parameter, and
3200 has the same type as the function return type.
3210 return std::move (t);
3214 But in this example, the @code{std::move} call prevents copy elision.
3216 This warning is enabled by @option{-Wall}.
3218 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3219 @opindex Wredundant-move
3220 @opindex Wno-redundant-move
3221 This warning warns about redundant calls to @code{std::move}; that is, when
3222 a move operation would have been performed even without the @code{std::move}
3223 call. This happens because the compiler is forced to treat the object as if
3224 it were an rvalue in certain situations such as returning a local variable,
3225 where copy elision isn't applicable. Consider:
3234 return std::move (t);
3238 Here, the @code{std::move} call is redundant. Because G++ implements Core
3239 Issue 1579, another example is:
3242 struct T @{ // convertible to U
3252 return std::move (t);
3255 In this example, copy elision isn't applicable because the type of the
3256 expression being returned and the function return type differ, yet G++
3257 treats the return value as if it were designated by an rvalue.
3259 This warning is enabled by @option{-Wextra}.
3261 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3262 @opindex fext-numeric-literals
3263 @opindex fno-ext-numeric-literals
3264 Accept imaginary, fixed-point, or machine-defined
3265 literal number suffixes as GNU extensions.
3266 When this option is turned off these suffixes are treated
3267 as C++11 user-defined literal numeric suffixes.
3268 This is on by default for all pre-C++11 dialects and all GNU dialects:
3269 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3270 @option{-std=gnu++14}.
3271 This option is off by default
3272 for ISO C++11 onwards (@option{-std=c++11}, ...).
3275 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3278 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3281 Warn about violations of the following style guidelines from Scott Meyers'
3282 @cite{Effective C++} series of books:
3286 Define a copy constructor and an assignment operator for classes
3287 with dynamically-allocated memory.
3290 Prefer initialization to assignment in constructors.
3293 Have @code{operator=} return a reference to @code{*this}.
3296 Don't try to return a reference when you must return an object.
3299 Distinguish between prefix and postfix forms of increment and
3300 decrement operators.
3303 Never overload @code{&&}, @code{||}, or @code{,}.
3307 This option also enables @option{-Wnon-virtual-dtor}, which is also
3308 one of the effective C++ recommendations. However, the check is
3309 extended to warn about the lack of virtual destructor in accessible
3310 non-polymorphic bases classes too.
3312 When selecting this option, be aware that the standard library
3313 headers do not obey all of these guidelines; use @samp{grep -v}
3314 to filter out those warnings.
3316 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3317 @opindex Wstrict-null-sentinel
3318 @opindex Wno-strict-null-sentinel
3319 Warn about the use of an uncasted @code{NULL} as sentinel. When
3320 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3321 to @code{__null}. Although it is a null pointer constant rather than a
3322 null pointer, it is guaranteed to be of the same size as a pointer.
3323 But this use is not portable across different compilers.
3325 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3326 @opindex Wno-non-template-friend
3327 @opindex Wnon-template-friend
3328 Disable warnings when non-template friend functions are declared
3329 within a template. In very old versions of GCC that predate implementation
3330 of the ISO standard, declarations such as
3331 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3332 could be interpreted as a particular specialization of a template
3333 function; the warning exists to diagnose compatibility problems,
3334 and is enabled by default.
3336 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3337 @opindex Wold-style-cast
3338 @opindex Wno-old-style-cast
3339 Warn if an old-style (C-style) cast to a non-void type is used within
3340 a C++ program. The new-style casts (@code{dynamic_cast},
3341 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3342 less vulnerable to unintended effects and much easier to search for.
3344 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3345 @opindex Woverloaded-virtual
3346 @opindex Wno-overloaded-virtual
3347 @cindex overloaded virtual function, warning
3348 @cindex warning for overloaded virtual function
3349 Warn when a function declaration hides virtual functions from a
3350 base class. For example, in:
3357 struct B: public A @{
3362 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3373 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3374 @opindex Wno-pmf-conversions
3375 @opindex Wpmf-conversions
3376 Disable the diagnostic for converting a bound pointer to member function
3379 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3380 @opindex Wsign-promo
3381 @opindex Wno-sign-promo
3382 Warn when overload resolution chooses a promotion from unsigned or
3383 enumerated type to a signed type, over a conversion to an unsigned type of
3384 the same size. Previous versions of G++ tried to preserve
3385 unsignedness, but the standard mandates the current behavior.
3387 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3389 @opindex Wno-templates
3390 Warn when a primary template declaration is encountered. Some coding
3391 rules disallow templates, and this may be used to enforce that rule.
3392 The warning is inactive inside a system header file, such as the STL, so
3393 one can still use the STL. One may also instantiate or specialize
3396 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3397 @opindex Wmultiple-inheritance
3398 @opindex Wno-multiple-inheritance
3399 Warn when a class is defined with multiple direct base classes. Some
3400 coding rules disallow multiple inheritance, and this may be used to
3401 enforce that rule. The warning is inactive inside a system header file,
3402 such as the STL, so one can still use the STL. One may also define
3403 classes that indirectly use multiple inheritance.
3405 @item -Wvirtual-inheritance
3406 @opindex Wvirtual-inheritance
3407 @opindex Wno-virtual-inheritance
3408 Warn when a class is defined with a virtual direct base class. Some
3409 coding rules disallow multiple inheritance, and this may be used to
3410 enforce that rule. The warning is inactive inside a system header file,
3411 such as the STL, so one can still use the STL. One may also define
3412 classes that indirectly use virtual inheritance.
3415 @opindex Wnamespaces
3416 @opindex Wno-namespaces
3417 Warn when a namespace definition is opened. Some coding rules disallow
3418 namespaces, and this may be used to enforce that rule. The warning is
3419 inactive inside a system header file, such as the STL, so one can still
3420 use the STL. One may also use using directives and qualified names.
3422 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3424 @opindex Wno-terminate
3425 Disable the warning about a throw-expression that will immediately
3426 result in a call to @code{terminate}.
3428 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3429 @opindex Wno-class-conversion
3430 @opindex Wclass-conversion
3431 Disable the warning about the case when a conversion function converts an
3432 object to the same type, to a base class of that type, or to void; such
3433 a conversion function will never be called.
3436 @node Objective-C and Objective-C++ Dialect Options
3437 @section Options Controlling Objective-C and Objective-C++ Dialects
3439 @cindex compiler options, Objective-C and Objective-C++
3440 @cindex Objective-C and Objective-C++ options, command-line
3441 @cindex options, Objective-C and Objective-C++
3442 (NOTE: This manual does not describe the Objective-C and Objective-C++
3443 languages themselves. @xref{Standards,,Language Standards
3444 Supported by GCC}, for references.)
3446 This section describes the command-line options that are only meaningful
3447 for Objective-C and Objective-C++ programs. You can also use most of
3448 the language-independent GNU compiler options.
3449 For example, you might compile a file @file{some_class.m} like this:
3452 gcc -g -fgnu-runtime -O -c some_class.m
3456 In this example, @option{-fgnu-runtime} is an option meant only for
3457 Objective-C and Objective-C++ programs; you can use the other options with
3458 any language supported by GCC@.
3460 Note that since Objective-C is an extension of the C language, Objective-C
3461 compilations may also use options specific to the C front-end (e.g.,
3462 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3463 C++-specific options (e.g., @option{-Wabi}).
3465 Here is a list of options that are @emph{only} for compiling Objective-C
3466 and Objective-C++ programs:
3469 @item -fconstant-string-class=@var{class-name}
3470 @opindex fconstant-string-class
3471 Use @var{class-name} as the name of the class to instantiate for each
3472 literal string specified with the syntax @code{@@"@dots{}"}. The default
3473 class name is @code{NXConstantString} if the GNU runtime is being used, and
3474 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3475 @option{-fconstant-cfstrings} option, if also present, overrides the
3476 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3477 to be laid out as constant CoreFoundation strings.
3480 @opindex fgnu-runtime
3481 Generate object code compatible with the standard GNU Objective-C
3482 runtime. This is the default for most types of systems.
3484 @item -fnext-runtime
3485 @opindex fnext-runtime
3486 Generate output compatible with the NeXT runtime. This is the default
3487 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3488 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3491 @item -fno-nil-receivers
3492 @opindex fno-nil-receivers
3493 @opindex fnil-receivers
3494 Assume that all Objective-C message dispatches (@code{[receiver
3495 message:arg]}) in this translation unit ensure that the receiver is
3496 not @code{nil}. This allows for more efficient entry points in the
3497 runtime to be used. This option is only available in conjunction with
3498 the NeXT runtime and ABI version 0 or 1.
3500 @item -fobjc-abi-version=@var{n}
3501 @opindex fobjc-abi-version
3502 Use version @var{n} of the Objective-C ABI for the selected runtime.
3503 This option is currently supported only for the NeXT runtime. In that
3504 case, Version 0 is the traditional (32-bit) ABI without support for
3505 properties and other Objective-C 2.0 additions. Version 1 is the
3506 traditional (32-bit) ABI with support for properties and other
3507 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3508 nothing is specified, the default is Version 0 on 32-bit target
3509 machines, and Version 2 on 64-bit target machines.
3511 @item -fobjc-call-cxx-cdtors
3512 @opindex fobjc-call-cxx-cdtors
3513 For each Objective-C class, check if any of its instance variables is a
3514 C++ object with a non-trivial default constructor. If so, synthesize a
3515 special @code{- (id) .cxx_construct} instance method which runs
3516 non-trivial default constructors on any such instance variables, in order,
3517 and then return @code{self}. Similarly, check if any instance variable
3518 is a C++ object with a non-trivial destructor, and if so, synthesize a
3519 special @code{- (void) .cxx_destruct} method which runs
3520 all such default destructors, in reverse order.
3522 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3523 methods thusly generated only operate on instance variables
3524 declared in the current Objective-C class, and not those inherited
3525 from superclasses. It is the responsibility of the Objective-C
3526 runtime to invoke all such methods in an object's inheritance
3527 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3528 by the runtime immediately after a new object instance is allocated;
3529 the @code{- (void) .cxx_destruct} methods are invoked immediately
3530 before the runtime deallocates an object instance.
3532 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3533 support for invoking the @code{- (id) .cxx_construct} and
3534 @code{- (void) .cxx_destruct} methods.
3536 @item -fobjc-direct-dispatch
3537 @opindex fobjc-direct-dispatch
3538 Allow fast jumps to the message dispatcher. On Darwin this is
3539 accomplished via the comm page.
3541 @item -fobjc-exceptions
3542 @opindex fobjc-exceptions
3543 Enable syntactic support for structured exception handling in
3544 Objective-C, similar to what is offered by C++. This option
3545 is required to use the Objective-C keywords @code{@@try},
3546 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3547 @code{@@synchronized}. This option is available with both the GNU
3548 runtime and the NeXT runtime (but not available in conjunction with
3549 the NeXT runtime on Mac OS X 10.2 and earlier).
3553 Enable garbage collection (GC) in Objective-C and Objective-C++
3554 programs. This option is only available with the NeXT runtime; the
3555 GNU runtime has a different garbage collection implementation that
3556 does not require special compiler flags.
3558 @item -fobjc-nilcheck
3559 @opindex fobjc-nilcheck
3560 For the NeXT runtime with version 2 of the ABI, check for a nil
3561 receiver in method invocations before doing the actual method call.
3562 This is the default and can be disabled using
3563 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3564 checked for nil in this way no matter what this flag is set to.
3565 Currently this flag does nothing when the GNU runtime, or an older
3566 version of the NeXT runtime ABI, is used.
3568 @item -fobjc-std=objc1
3570 Conform to the language syntax of Objective-C 1.0, the language
3571 recognized by GCC 4.0. This only affects the Objective-C additions to
3572 the C/C++ language; it does not affect conformance to C/C++ standards,
3573 which is controlled by the separate C/C++ dialect option flags. When
3574 this option is used with the Objective-C or Objective-C++ compiler,
3575 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3576 This is useful if you need to make sure that your Objective-C code can
3577 be compiled with older versions of GCC@.
3579 @item -freplace-objc-classes
3580 @opindex freplace-objc-classes
3581 Emit a special marker instructing @command{ld(1)} not to statically link in
3582 the resulting object file, and allow @command{dyld(1)} to load it in at
3583 run time instead. This is used in conjunction with the Fix-and-Continue
3584 debugging mode, where the object file in question may be recompiled and
3585 dynamically reloaded in the course of program execution, without the need
3586 to restart the program itself. Currently, Fix-and-Continue functionality
3587 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3592 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3593 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3594 compile time) with static class references that get initialized at load time,
3595 which improves run-time performance. Specifying the @option{-fzero-link} flag
3596 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3597 to be retained. This is useful in Zero-Link debugging mode, since it allows
3598 for individual class implementations to be modified during program execution.
3599 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3600 regardless of command-line options.
3602 @item -fno-local-ivars
3603 @opindex fno-local-ivars
3604 @opindex flocal-ivars
3605 By default instance variables in Objective-C can be accessed as if
3606 they were local variables from within the methods of the class they're
3607 declared in. This can lead to shadowing between instance variables
3608 and other variables declared either locally inside a class method or
3609 globally with the same name. Specifying the @option{-fno-local-ivars}
3610 flag disables this behavior thus avoiding variable shadowing issues.
3612 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3613 @opindex fivar-visibility
3614 Set the default instance variable visibility to the specified option
3615 so that instance variables declared outside the scope of any access
3616 modifier directives default to the specified visibility.
3620 Dump interface declarations for all classes seen in the source file to a
3621 file named @file{@var{sourcename}.decl}.
3623 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3624 @opindex Wassign-intercept
3625 @opindex Wno-assign-intercept
3626 Warn whenever an Objective-C assignment is being intercepted by the
3629 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3630 @opindex Wno-protocol
3632 If a class is declared to implement a protocol, a warning is issued for
3633 every method in the protocol that is not implemented by the class. The
3634 default behavior is to issue a warning for every method not explicitly
3635 implemented in the class, even if a method implementation is inherited
3636 from the superclass. If you use the @option{-Wno-protocol} option, then
3637 methods inherited from the superclass are considered to be implemented,
3638 and no warning is issued for them.
3640 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3642 @opindex Wno-selector
3643 Warn if multiple methods of different types for the same selector are
3644 found during compilation. The check is performed on the list of methods
3645 in the final stage of compilation. Additionally, a check is performed
3646 for each selector appearing in a @code{@@selector(@dots{})}
3647 expression, and a corresponding method for that selector has been found
3648 during compilation. Because these checks scan the method table only at
3649 the end of compilation, these warnings are not produced if the final
3650 stage of compilation is not reached, for example because an error is
3651 found during compilation, or because the @option{-fsyntax-only} option is
3654 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3655 @opindex Wstrict-selector-match
3656 @opindex Wno-strict-selector-match
3657 Warn if multiple methods with differing argument and/or return types are
3658 found for a given selector when attempting to send a message using this
3659 selector to a receiver of type @code{id} or @code{Class}. When this flag
3660 is off (which is the default behavior), the compiler omits such warnings
3661 if any differences found are confined to types that share the same size
3664 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3665 @opindex Wundeclared-selector
3666 @opindex Wno-undeclared-selector
3667 Warn if a @code{@@selector(@dots{})} expression referring to an
3668 undeclared selector is found. A selector is considered undeclared if no
3669 method with that name has been declared before the
3670 @code{@@selector(@dots{})} expression, either explicitly in an
3671 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3672 an @code{@@implementation} section. This option always performs its
3673 checks as soon as a @code{@@selector(@dots{})} expression is found,
3674 while @option{-Wselector} only performs its checks in the final stage of
3675 compilation. This also enforces the coding style convention
3676 that methods and selectors must be declared before being used.
3678 @item -print-objc-runtime-info
3679 @opindex print-objc-runtime-info
3680 Generate C header describing the largest structure that is passed by
3685 @node Diagnostic Message Formatting Options
3686 @section Options to Control Diagnostic Messages Formatting
3687 @cindex options to control diagnostics formatting
3688 @cindex diagnostic messages
3689 @cindex message formatting
3691 Traditionally, diagnostic messages have been formatted irrespective of
3692 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3693 options described below
3694 to control the formatting algorithm for diagnostic messages,
3695 e.g.@: how many characters per line, how often source location
3696 information should be reported. Note that some language front ends may not
3697 honor these options.
3700 @item -fmessage-length=@var{n}
3701 @opindex fmessage-length
3702 Try to format error messages so that they fit on lines of about
3703 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3704 done; each error message appears on a single line. This is the
3705 default for all front ends.
3707 Note - this option also affects the display of the @samp{#error} and
3708 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3709 function/type/variable attribute. It does not however affect the
3710 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3712 @item -fdiagnostics-show-location=once
3713 @opindex fdiagnostics-show-location
3714 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3715 reporter to emit source location information @emph{once}; that is, in
3716 case the message is too long to fit on a single physical line and has to
3717 be wrapped, the source location won't be emitted (as prefix) again,
3718 over and over, in subsequent continuation lines. This is the default
3721 @item -fdiagnostics-show-location=every-line
3722 Only meaningful in line-wrapping mode. Instructs the diagnostic
3723 messages reporter to emit the same source location information (as
3724 prefix) for physical lines that result from the process of breaking
3725 a message which is too long to fit on a single line.
3727 @item -fdiagnostics-color[=@var{WHEN}]
3728 @itemx -fno-diagnostics-color
3729 @opindex fdiagnostics-color
3730 @cindex highlight, color
3731 @vindex GCC_COLORS @r{environment variable}
3732 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3733 or @samp{auto}. The default depends on how the compiler has been configured,
3734 it can be any of the above @var{WHEN} options or also @samp{never}
3735 if @env{GCC_COLORS} environment variable isn't present in the environment,
3736 and @samp{auto} otherwise.
3737 @samp{auto} means to use color only when the standard error is a terminal.
3738 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3739 aliases for @option{-fdiagnostics-color=always} and
3740 @option{-fdiagnostics-color=never}, respectively.
3742 The colors are defined by the environment variable @env{GCC_COLORS}.
3743 Its value is a colon-separated list of capabilities and Select Graphic
3744 Rendition (SGR) substrings. SGR commands are interpreted by the
3745 terminal or terminal emulator. (See the section in the documentation
3746 of your text terminal for permitted values and their meanings as
3747 character attributes.) These substring values are integers in decimal
3748 representation and can be concatenated with semicolons.
3749 Common values to concatenate include
3751 @samp{4} for underline,
3753 @samp{7} for inverse,
3754 @samp{39} for default foreground color,
3755 @samp{30} to @samp{37} for foreground colors,
3756 @samp{90} to @samp{97} for 16-color mode foreground colors,
3757 @samp{38;5;0} to @samp{38;5;255}
3758 for 88-color and 256-color modes foreground colors,
3759 @samp{49} for default background color,
3760 @samp{40} to @samp{47} for background colors,
3761 @samp{100} to @samp{107} for 16-color mode background colors,
3762 and @samp{48;5;0} to @samp{48;5;255}
3763 for 88-color and 256-color modes background colors.
3765 The default @env{GCC_COLORS} is
3767 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3768 quote=01:fixit-insert=32:fixit-delete=31:\
3769 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3773 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3774 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3775 @samp{01} is bold, and @samp{31} is red.
3776 Setting @env{GCC_COLORS} to the empty string disables colors.
3777 Supported capabilities are as follows.
3781 @vindex error GCC_COLORS @r{capability}
3782 SGR substring for error: markers.
3785 @vindex warning GCC_COLORS @r{capability}
3786 SGR substring for warning: markers.
3789 @vindex note GCC_COLORS @r{capability}
3790 SGR substring for note: markers.
3793 @vindex range1 GCC_COLORS @r{capability}
3794 SGR substring for first additional range.
3797 @vindex range2 GCC_COLORS @r{capability}
3798 SGR substring for second additional range.
3801 @vindex locus GCC_COLORS @r{capability}
3802 SGR substring for location information, @samp{file:line} or
3803 @samp{file:line:column} etc.
3806 @vindex quote GCC_COLORS @r{capability}
3807 SGR substring for information printed within quotes.
3810 @vindex fixit-insert GCC_COLORS @r{capability}
3811 SGR substring for fix-it hints suggesting text to
3812 be inserted or replaced.
3815 @vindex fixit-delete GCC_COLORS @r{capability}
3816 SGR substring for fix-it hints suggesting text to
3819 @item diff-filename=
3820 @vindex diff-filename GCC_COLORS @r{capability}
3821 SGR substring for filename headers within generated patches.
3824 @vindex diff-hunk GCC_COLORS @r{capability}
3825 SGR substring for the starts of hunks within generated patches.
3828 @vindex diff-delete GCC_COLORS @r{capability}
3829 SGR substring for deleted lines within generated patches.
3832 @vindex diff-insert GCC_COLORS @r{capability}
3833 SGR substring for inserted lines within generated patches.
3836 @vindex type-diff GCC_COLORS @r{capability}
3837 SGR substring for highlighting mismatching types within template
3838 arguments in the C++ frontend.
3841 @item -fno-diagnostics-show-option
3842 @opindex fno-diagnostics-show-option
3843 @opindex fdiagnostics-show-option
3844 By default, each diagnostic emitted includes text indicating the
3845 command-line option that directly controls the diagnostic (if such an
3846 option is known to the diagnostic machinery). Specifying the
3847 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3849 @item -fno-diagnostics-show-caret
3850 @opindex fno-diagnostics-show-caret
3851 @opindex fdiagnostics-show-caret
3852 By default, each diagnostic emitted includes the original source line
3853 and a caret @samp{^} indicating the column. This option suppresses this
3854 information. The source line is truncated to @var{n} characters, if
3855 the @option{-fmessage-length=n} option is given. When the output is done
3856 to the terminal, the width is limited to the width given by the
3857 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3859 @item -fno-diagnostics-show-labels
3860 @opindex fno-diagnostics-show-labels
3861 @opindex fdiagnostics-show-labels
3862 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3863 diagnostics can label ranges of source code with pertinent information, such
3864 as the types of expressions:
3867 printf ("foo %s bar", long_i + long_j);
3873 This option suppresses the printing of these labels (in the example above,
3874 the vertical bars and the ``char *'' and ``long int'' text).
3876 @item -fno-diagnostics-show-line-numbers
3877 @opindex fno-diagnostics-show-line-numbers
3878 @opindex fdiagnostics-show-line-numbers
3879 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3880 a left margin is printed, showing line numbers. This option suppresses this
3883 @item -fdiagnostics-minimum-margin-width=@var{width}
3884 @opindex fdiagnostics-minimum-margin-width
3885 This option controls the minimum width of the left margin printed by
3886 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
3888 @item -fdiagnostics-parseable-fixits
3889 @opindex fdiagnostics-parseable-fixits
3890 Emit fix-it hints in a machine-parseable format, suitable for consumption
3891 by IDEs. For each fix-it, a line will be printed after the relevant
3892 diagnostic, starting with the string ``fix-it:''. For example:
3895 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3898 The location is expressed as a half-open range, expressed as a count of
3899 bytes, starting at byte 1 for the initial column. In the above example,
3900 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3904 00000000011111111112222222222
3905 12345678901234567890123456789
3906 gtk_widget_showall (dlg);
3911 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3912 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3913 (e.g. vertical tab as ``\013'').
3915 An empty replacement string indicates that the given range is to be removed.
3916 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3917 be inserted at the given position.
3919 @item -fdiagnostics-generate-patch
3920 @opindex fdiagnostics-generate-patch
3921 Print fix-it hints to stderr in unified diff format, after any diagnostics
3922 are printed. For example:
3929 void show_cb(GtkDialog *dlg)
3931 - gtk_widget_showall(dlg);
3932 + gtk_widget_show_all(dlg);
3937 The diff may or may not be colorized, following the same rules
3938 as for diagnostics (see @option{-fdiagnostics-color}).
3940 @item -fdiagnostics-show-template-tree
3941 @opindex fdiagnostics-show-template-tree
3943 In the C++ frontend, when printing diagnostics showing mismatching
3944 template types, such as:
3947 could not convert 'std::map<int, std::vector<double> >()'
3948 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3951 the @option{-fdiagnostics-show-template-tree} flag enables printing a
3952 tree-like structure showing the common and differing parts of the types,
3962 The parts that differ are highlighted with color (``double'' and
3963 ``float'' in this case).
3965 @item -fno-elide-type
3966 @opindex fno-elide-type
3967 @opindex felide-type
3968 By default when the C++ frontend prints diagnostics showing mismatching
3969 template types, common parts of the types are printed as ``[...]'' to
3970 simplify the error message. For example:
3973 could not convert 'std::map<int, std::vector<double> >()'
3974 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3977 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
3978 This flag also affects the output of the
3979 @option{-fdiagnostics-show-template-tree} flag.
3981 @item -fno-show-column
3982 @opindex fno-show-column
3983 @opindex fshow-column
3984 Do not print column numbers in diagnostics. This may be necessary if
3985 diagnostics are being scanned by a program that does not understand the
3986 column numbers, such as @command{dejagnu}.
3988 @item -fdiagnostics-format=@var{FORMAT}
3989 @opindex fdiagnostics-format
3990 Select a different format for printing diagnostics.
3991 @var{FORMAT} is @samp{text} or @samp{json}.
3992 The default is @samp{text}.
3994 The @samp{json} format consists of a top-level JSON array containing JSON
3995 objects representing the diagnostics.
3997 The JSON is emitted as one line, without formatting; the examples below
3998 have been formatted for clarity.
4000 Diagnostics can have child diagnostics. For example, this error and note:
4003 misleading-indentation.c:15:3: warning: this 'if' clause does not
4004 guard... [-Wmisleading-indentation]
4007 misleading-indentation.c:17:5: note: ...this statement, but the latter
4008 is misleadingly indented as if it were guarded by the 'if'
4014 might be printed in JSON form (after formatting) like this:
4024 "file": "misleading-indentation.c",
4029 "file": "misleading-indentation.c",
4034 "message": "this \u2018if\u2019 clause does not guard...",
4035 "option": "-Wmisleading-indentation",
4043 "file": "misleading-indentation.c",
4048 "message": "...this statement, but the latter is @dots{}"
4057 where the @code{note} is a child of the @code{warning}.
4059 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
4060 an @code{option} key describing the command-line option controlling the
4063 A diagnostic can contain zero or more locations. Each location has up
4064 to three positions within it: a @code{caret} position and optional
4065 @code{start} and @code{finish} positions. A location can also have
4066 an optional @code{label} string. For example, this error:
4069 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4070 'struct s'@} and 'T' @{aka 'struct t'@})
4071 64 | return callee_4a () + callee_4b ();
4072 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4074 | | T @{aka struct t@}
4075 | S @{aka struct s@}
4079 has three locations. Its primary location is at the ``+'' token at column
4080 23. It has two secondary locations, describing the left and right-hand sides
4081 of the expression, which have labels. It might be printed in JSON form as:
4090 "column": 23, "file": "bad-binary-ops.c", "line": 64
4095 "column": 10, "file": "bad-binary-ops.c", "line": 64
4098 "column": 21, "file": "bad-binary-ops.c", "line": 64
4100 "label": "S @{aka struct s@}"
4104 "column": 25, "file": "bad-binary-ops.c", "line": 64
4107 "column": 36, "file": "bad-binary-ops.c", "line": 64
4109 "label": "T @{aka struct t@}"
4112 "message": "invalid operands to binary + @dots{}"
4116 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4117 consisting of half-open intervals, similar to the output of
4118 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
4119 with a replacement fix-it hint:
4122 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4124 8 | return ptr->colour;
4130 might be printed in JSON form as:
4165 "message": "\u2018struct s\u2019 has no member named @dots{}"
4170 where the fix-it hint suggests replacing the text from @code{start} up
4171 to but not including @code{next} with @code{string}'s value. Deletions
4172 are expressed via an empty value for @code{string}, insertions by
4173 having @code{start} equal @code{next}.
4177 @node Warning Options
4178 @section Options to Request or Suppress Warnings
4179 @cindex options to control warnings
4180 @cindex warning messages
4181 @cindex messages, warning
4182 @cindex suppressing warnings
4184 Warnings are diagnostic messages that report constructions that
4185 are not inherently erroneous but that are risky or suggest there
4186 may have been an error.
4188 The following language-independent options do not enable specific
4189 warnings but control the kinds of diagnostics produced by GCC@.
4192 @cindex syntax checking
4194 @opindex fsyntax-only
4195 Check the code for syntax errors, but don't do anything beyond that.
4197 @item -fmax-errors=@var{n}
4198 @opindex fmax-errors
4199 Limits the maximum number of error messages to @var{n}, at which point
4200 GCC bails out rather than attempting to continue processing the source
4201 code. If @var{n} is 0 (the default), there is no limit on the number
4202 of error messages produced. If @option{-Wfatal-errors} is also
4203 specified, then @option{-Wfatal-errors} takes precedence over this
4208 Inhibit all warning messages.
4213 Make all warnings into errors.
4218 Make the specified warning into an error. The specifier for a warning
4219 is appended; for example @option{-Werror=switch} turns the warnings
4220 controlled by @option{-Wswitch} into errors. This switch takes a
4221 negative form, to be used to negate @option{-Werror} for specific
4222 warnings; for example @option{-Wno-error=switch} makes
4223 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4226 The warning message for each controllable warning includes the
4227 option that controls the warning. That option can then be used with
4228 @option{-Werror=} and @option{-Wno-error=} as described above.
4229 (Printing of the option in the warning message can be disabled using the
4230 @option{-fno-diagnostics-show-option} flag.)
4232 Note that specifying @option{-Werror=}@var{foo} automatically implies
4233 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4236 @item -Wfatal-errors
4237 @opindex Wfatal-errors
4238 @opindex Wno-fatal-errors
4239 This option causes the compiler to abort compilation on the first error
4240 occurred rather than trying to keep going and printing further error
4245 You can request many specific warnings with options beginning with
4246 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4247 implicit declarations. Each of these specific warning options also
4248 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4249 example, @option{-Wno-implicit}. This manual lists only one of the
4250 two forms, whichever is not the default. For further
4251 language-specific options also refer to @ref{C++ Dialect Options} and
4252 @ref{Objective-C and Objective-C++ Dialect Options}.
4254 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4255 options, such as @option{-Wunused}, which may turn on further options,
4256 such as @option{-Wunused-value}. The combined effect of positive and
4257 negative forms is that more specific options have priority over less
4258 specific ones, independently of their position in the command-line. For
4259 options of the same specificity, the last one takes effect. Options
4260 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4261 as if they appeared at the end of the command-line.
4263 When an unrecognized warning option is requested (e.g.,
4264 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4265 that the option is not recognized. However, if the @option{-Wno-} form
4266 is used, the behavior is slightly different: no diagnostic is
4267 produced for @option{-Wno-unknown-warning} unless other diagnostics
4268 are being produced. This allows the use of new @option{-Wno-} options
4269 with old compilers, but if something goes wrong, the compiler
4270 warns that an unrecognized option is present.
4277 @opindex Wno-pedantic
4278 Issue all the warnings demanded by strict ISO C and ISO C++;
4279 reject all programs that use forbidden extensions, and some other
4280 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4281 version of the ISO C standard specified by any @option{-std} option used.
4283 Valid ISO C and ISO C++ programs should compile properly with or without
4284 this option (though a rare few require @option{-ansi} or a
4285 @option{-std} option specifying the required version of ISO C)@. However,
4286 without this option, certain GNU extensions and traditional C and C++
4287 features are supported as well. With this option, they are rejected.
4289 @option{-Wpedantic} does not cause warning messages for use of the
4290 alternate keywords whose names begin and end with @samp{__}. Pedantic
4291 warnings are also disabled in the expression that follows
4292 @code{__extension__}. However, only system header files should use
4293 these escape routes; application programs should avoid them.
4294 @xref{Alternate Keywords}.
4296 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4297 C conformance. They soon find that it does not do quite what they want:
4298 it finds some non-ISO practices, but not all---only those for which
4299 ISO C @emph{requires} a diagnostic, and some others for which
4300 diagnostics have been added.
4302 A feature to report any failure to conform to ISO C might be useful in
4303 some instances, but would require considerable additional work and would
4304 be quite different from @option{-Wpedantic}. We don't have plans to
4305 support such a feature in the near future.
4307 Where the standard specified with @option{-std} represents a GNU
4308 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4309 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4310 extended dialect is based. Warnings from @option{-Wpedantic} are given
4311 where they are required by the base standard. (It does not make sense
4312 for such warnings to be given only for features not in the specified GNU
4313 C dialect, since by definition the GNU dialects of C include all
4314 features the compiler supports with the given option, and there would be
4315 nothing to warn about.)
4317 @item -pedantic-errors
4318 @opindex pedantic-errors
4319 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4320 requires a diagnostic, in some cases where there is undefined behavior
4321 at compile-time and in some other cases that do not prevent compilation
4322 of programs that are valid according to the standard. This is not
4323 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4324 by this option and not enabled by the latter and vice versa.
4329 This enables all the warnings about constructions that some users
4330 consider questionable, and that are easy to avoid (or modify to
4331 prevent the warning), even in conjunction with macros. This also
4332 enables some language-specific warnings described in @ref{C++ Dialect
4333 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4335 @option{-Wall} turns on the following warning flags:
4337 @gccoptlist{-Waddress @gol
4338 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4340 -Wbool-operation @gol
4341 -Wc++11-compat -Wc++14-compat @gol
4342 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4343 -Wchar-subscripts @gol
4345 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4346 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4348 -Wint-in-bool-context @gol
4349 -Wimplicit @r{(C and Objective-C only)} @gol
4350 -Wimplicit-int @r{(C and Objective-C only)} @gol
4351 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4352 -Winit-self @r{(only for C++)} @gol
4353 -Wlogical-not-parentheses @gol
4354 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4355 -Wmaybe-uninitialized @gol
4356 -Wmemset-elt-size @gol
4357 -Wmemset-transposed-args @gol
4358 -Wmisleading-indentation @r{(only for C/C++)} @gol
4359 -Wmissing-attributes @gol
4360 -Wmissing-braces @r{(only for C/ObjC)} @gol
4361 -Wmultistatement-macros @gol
4362 -Wnarrowing @r{(only for C++)} @gol
4364 -Wnonnull-compare @gol
4367 -Wpessimizing-move @r{(only for C++)} @gol
4372 -Wsequence-point @gol
4373 -Wsign-compare @r{(only in C++)} @gol
4374 -Wsizeof-pointer-div @gol
4375 -Wsizeof-pointer-memaccess @gol
4376 -Wstrict-aliasing @gol
4377 -Wstrict-overflow=1 @gol
4379 -Wtautological-compare @gol
4381 -Wuninitialized @gol
4382 -Wunknown-pragmas @gol
4383 -Wunused-function @gol
4386 -Wunused-variable @gol
4387 -Wvolatile-register-var}
4389 Note that some warning flags are not implied by @option{-Wall}. Some of
4390 them warn about constructions that users generally do not consider
4391 questionable, but which occasionally you might wish to check for;
4392 others warn about constructions that are necessary or hard to avoid in
4393 some cases, and there is no simple way to modify the code to suppress
4394 the warning. Some of them are enabled by @option{-Wextra} but many of
4395 them must be enabled individually.
4401 This enables some extra warning flags that are not enabled by
4402 @option{-Wall}. (This option used to be called @option{-W}. The older
4403 name is still supported, but the newer name is more descriptive.)
4405 @gccoptlist{-Wclobbered @gol
4406 -Wcast-function-type @gol
4408 -Wignored-qualifiers @gol
4409 -Wimplicit-fallthrough=3 @gol
4410 -Wmissing-field-initializers @gol
4411 -Wmissing-parameter-type @r{(C only)} @gol
4412 -Wold-style-declaration @r{(C only)} @gol
4413 -Woverride-init @gol
4414 -Wsign-compare @r{(C only)} @gol
4415 -Wredundant-move @r{(only for C++)} @gol
4417 -Wuninitialized @gol
4418 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4419 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4420 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4423 The option @option{-Wextra} also prints warning messages for the
4429 A pointer is compared against integer zero with @code{<}, @code{<=},
4430 @code{>}, or @code{>=}.
4433 (C++ only) An enumerator and a non-enumerator both appear in a
4434 conditional expression.
4437 (C++ only) Ambiguous virtual bases.
4440 (C++ only) Subscripting an array that has been declared @code{register}.
4443 (C++ only) Taking the address of a variable that has been declared
4447 (C++ only) A base class is not initialized in the copy constructor
4452 @item -Wchar-subscripts
4453 @opindex Wchar-subscripts
4454 @opindex Wno-char-subscripts
4455 Warn if an array subscript has type @code{char}. This is a common cause
4456 of error, as programmers often forget that this type is signed on some
4458 This warning is enabled by @option{-Wall}.
4463 Warn about an invalid memory access that is found by Pointer Bounds Checker
4464 (@option{-fcheck-pointer-bounds}).
4466 @item -Wno-coverage-mismatch
4467 @opindex Wno-coverage-mismatch
4468 @opindex Wcoverage-mismatch
4469 Warn if feedback profiles do not match when using the
4470 @option{-fprofile-use} option.
4471 If a source file is changed between compiling with @option{-fprofile-generate}
4472 and with @option{-fprofile-use}, the files with the profile feedback can fail
4473 to match the source file and GCC cannot use the profile feedback
4474 information. By default, this warning is enabled and is treated as an
4475 error. @option{-Wno-coverage-mismatch} can be used to disable the
4476 warning or @option{-Wno-error=coverage-mismatch} can be used to
4477 disable the error. Disabling the error for this warning can result in
4478 poorly optimized code and is useful only in the
4479 case of very minor changes such as bug fixes to an existing code-base.
4480 Completely disabling the warning is not recommended.
4483 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4485 Suppress warning messages emitted by @code{#warning} directives.
4487 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4488 @opindex Wdouble-promotion
4489 @opindex Wno-double-promotion
4490 Give a warning when a value of type @code{float} is implicitly
4491 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4492 floating-point unit implement @code{float} in hardware, but emulate
4493 @code{double} in software. On such a machine, doing computations
4494 using @code{double} values is much more expensive because of the
4495 overhead required for software emulation.
4497 It is easy to accidentally do computations with @code{double} because
4498 floating-point literals are implicitly of type @code{double}. For
4502 float area(float radius)
4504 return 3.14159 * radius * radius;
4508 the compiler performs the entire computation with @code{double}
4509 because the floating-point literal is a @code{double}.
4511 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4512 @opindex Wduplicate-decl-specifier
4513 @opindex Wno-duplicate-decl-specifier
4514 Warn if a declaration has duplicate @code{const}, @code{volatile},
4515 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4519 @itemx -Wformat=@var{n}
4522 @opindex ffreestanding
4523 @opindex fno-builtin
4525 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4526 the arguments supplied have types appropriate to the format string
4527 specified, and that the conversions specified in the format string make
4528 sense. This includes standard functions, and others specified by format
4529 attributes (@pxref{Function Attributes}), in the @code{printf},
4530 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4531 not in the C standard) families (or other target-specific families).
4532 Which functions are checked without format attributes having been
4533 specified depends on the standard version selected, and such checks of
4534 functions without the attribute specified are disabled by
4535 @option{-ffreestanding} or @option{-fno-builtin}.
4537 The formats are checked against the format features supported by GNU
4538 libc version 2.2. These include all ISO C90 and C99 features, as well
4539 as features from the Single Unix Specification and some BSD and GNU
4540 extensions. Other library implementations may not support all these
4541 features; GCC does not support warning about features that go beyond a
4542 particular library's limitations. However, if @option{-Wpedantic} is used
4543 with @option{-Wformat}, warnings are given about format features not
4544 in the selected standard version (but not for @code{strfmon} formats,
4545 since those are not in any version of the C standard). @xref{C Dialect
4546 Options,,Options Controlling C Dialect}.
4553 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4554 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4555 @option{-Wformat} also checks for null format arguments for several
4556 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4557 aspects of this level of format checking can be disabled by the
4558 options: @option{-Wno-format-contains-nul},
4559 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4560 @option{-Wformat} is enabled by @option{-Wall}.
4562 @item -Wno-format-contains-nul
4563 @opindex Wno-format-contains-nul
4564 @opindex Wformat-contains-nul
4565 If @option{-Wformat} is specified, do not warn about format strings that
4568 @item -Wno-format-extra-args
4569 @opindex Wno-format-extra-args
4570 @opindex Wformat-extra-args
4571 If @option{-Wformat} is specified, do not warn about excess arguments to a
4572 @code{printf} or @code{scanf} format function. The C standard specifies
4573 that such arguments are ignored.
4575 Where the unused arguments lie between used arguments that are
4576 specified with @samp{$} operand number specifications, normally
4577 warnings are still given, since the implementation could not know what
4578 type to pass to @code{va_arg} to skip the unused arguments. However,
4579 in the case of @code{scanf} formats, this option suppresses the
4580 warning if the unused arguments are all pointers, since the Single
4581 Unix Specification says that such unused arguments are allowed.
4583 @item -Wformat-overflow
4584 @itemx -Wformat-overflow=@var{level}
4585 @opindex Wformat-overflow
4586 @opindex Wno-format-overflow
4587 Warn about calls to formatted input/output functions such as @code{sprintf}
4588 and @code{vsprintf} that might overflow the destination buffer. When the
4589 exact number of bytes written by a format directive cannot be determined
4590 at compile-time it is estimated based on heuristics that depend on the
4591 @var{level} argument and on optimization. While enabling optimization
4592 will in most cases improve the accuracy of the warning, it may also
4593 result in false positives.
4596 @item -Wformat-overflow
4597 @itemx -Wformat-overflow=1
4598 @opindex Wformat-overflow
4599 @opindex Wno-format-overflow
4600 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4601 employs a conservative approach that warns only about calls that most
4602 likely overflow the buffer. At this level, numeric arguments to format
4603 directives with unknown values are assumed to have the value of one, and
4604 strings of unknown length to be empty. Numeric arguments that are known
4605 to be bounded to a subrange of their type, or string arguments whose output
4606 is bounded either by their directive's precision or by a finite set of
4607 string literals, are assumed to take on the value within the range that
4608 results in the most bytes on output. For example, the call to @code{sprintf}
4609 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4610 the terminating NUL character (@code{'\0'}) appended by the function
4611 to the destination buffer will be written past its end. Increasing
4612 the size of the buffer by a single byte is sufficient to avoid the
4613 warning, though it may not be sufficient to avoid the overflow.
4616 void f (int a, int b)
4619 sprintf (buf, "a = %i, b = %i\n", a, b);
4623 @item -Wformat-overflow=2
4624 Level @var{2} warns also about calls that might overflow the destination
4625 buffer given an argument of sufficient length or magnitude. At level
4626 @var{2}, unknown numeric arguments are assumed to have the minimum
4627 representable value for signed types with a precision greater than 1, and
4628 the maximum representable value otherwise. Unknown string arguments whose
4629 length cannot be assumed to be bounded either by the directive's precision,
4630 or by a finite set of string literals they may evaluate to, or the character
4631 array they may point to, are assumed to be 1 character long.
4633 At level @var{2}, the call in the example above is again diagnosed, but
4634 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4635 @code{%i} directive will write some of its digits beyond the end of
4636 the destination buffer. To make the call safe regardless of the values
4637 of the two variables, the size of the destination buffer must be increased
4638 to at least 34 bytes. GCC includes the minimum size of the buffer in
4639 an informational note following the warning.
4641 An alternative to increasing the size of the destination buffer is to
4642 constrain the range of formatted values. The maximum length of string
4643 arguments can be bounded by specifying the precision in the format
4644 directive. When numeric arguments of format directives can be assumed
4645 to be bounded by less than the precision of their type, choosing
4646 an appropriate length modifier to the format specifier will reduce
4647 the required buffer size. For example, if @var{a} and @var{b} in the
4648 example above can be assumed to be within the precision of
4649 the @code{short int} type then using either the @code{%hi} format
4650 directive or casting the argument to @code{short} reduces the maximum
4651 required size of the buffer to 24 bytes.
4654 void f (int a, int b)
4657 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4662 @item -Wno-format-zero-length
4663 @opindex Wno-format-zero-length
4664 @opindex Wformat-zero-length
4665 If @option{-Wformat} is specified, do not warn about zero-length formats.
4666 The C standard specifies that zero-length formats are allowed.
4671 Enable @option{-Wformat} plus additional format checks. Currently
4672 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4675 @item -Wformat-nonliteral
4676 @opindex Wformat-nonliteral
4677 @opindex Wno-format-nonliteral
4678 If @option{-Wformat} is specified, also warn if the format string is not a
4679 string literal and so cannot be checked, unless the format function
4680 takes its format arguments as a @code{va_list}.
4682 @item -Wformat-security
4683 @opindex Wformat-security
4684 @opindex Wno-format-security
4685 If @option{-Wformat} is specified, also warn about uses of format
4686 functions that represent possible security problems. At present, this
4687 warns about calls to @code{printf} and @code{scanf} functions where the
4688 format string is not a string literal and there are no format arguments,
4689 as in @code{printf (foo);}. This may be a security hole if the format
4690 string came from untrusted input and contains @samp{%n}. (This is
4691 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4692 in future warnings may be added to @option{-Wformat-security} that are not
4693 included in @option{-Wformat-nonliteral}.)
4695 @item -Wformat-signedness
4696 @opindex Wformat-signedness
4697 @opindex Wno-format-signedness
4698 If @option{-Wformat} is specified, also warn if the format string
4699 requires an unsigned argument and the argument is signed and vice versa.
4701 @item -Wformat-truncation
4702 @itemx -Wformat-truncation=@var{level}
4703 @opindex Wformat-truncation
4704 @opindex Wno-format-truncation
4705 Warn about calls to formatted input/output functions such as @code{snprintf}
4706 and @code{vsnprintf} that might result in output truncation. When the exact
4707 number of bytes written by a format directive cannot be determined at
4708 compile-time it is estimated based on heuristics that depend on
4709 the @var{level} argument and on optimization. While enabling optimization
4710 will in most cases improve the accuracy of the warning, it may also result
4711 in false positives. Except as noted otherwise, the option uses the same
4712 logic @option{-Wformat-overflow}.
4715 @item -Wformat-truncation
4716 @itemx -Wformat-truncation=1
4717 @opindex Wformat-truncation
4718 @opindex Wno-format-truncation
4719 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4720 employs a conservative approach that warns only about calls to bounded
4721 functions whose return value is unused and that will most likely result
4722 in output truncation.
4724 @item -Wformat-truncation=2
4725 Level @var{2} warns also about calls to bounded functions whose return
4726 value is used and that might result in truncation given an argument of
4727 sufficient length or magnitude.
4731 @opindex Wformat-y2k
4732 @opindex Wno-format-y2k
4733 If @option{-Wformat} is specified, also warn about @code{strftime}
4734 formats that may yield only a two-digit year.
4739 @opindex Wno-nonnull
4740 Warn about passing a null pointer for arguments marked as
4741 requiring a non-null value by the @code{nonnull} function attribute.
4743 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4744 can be disabled with the @option{-Wno-nonnull} option.
4746 @item -Wnonnull-compare
4747 @opindex Wnonnull-compare
4748 @opindex Wno-nonnull-compare
4749 Warn when comparing an argument marked with the @code{nonnull}
4750 function attribute against null inside the function.
4752 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4753 can be disabled with the @option{-Wno-nonnull-compare} option.
4755 @item -Wnull-dereference
4756 @opindex Wnull-dereference
4757 @opindex Wno-null-dereference
4758 Warn if the compiler detects paths that trigger erroneous or
4759 undefined behavior due to dereferencing a null pointer. This option
4760 is only active when @option{-fdelete-null-pointer-checks} is active,
4761 which is enabled by optimizations in most targets. The precision of
4762 the warnings depends on the optimization options used.
4764 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4766 @opindex Wno-init-self
4767 Warn about uninitialized variables that are initialized with themselves.
4768 Note this option can only be used with the @option{-Wuninitialized} option.
4770 For example, GCC warns about @code{i} being uninitialized in the
4771 following snippet only when @option{-Winit-self} has been specified:
4782 This warning is enabled by @option{-Wall} in C++.
4784 @item -Wimplicit-int @r{(C and Objective-C only)}
4785 @opindex Wimplicit-int
4786 @opindex Wno-implicit-int
4787 Warn when a declaration does not specify a type.
4788 This warning is enabled by @option{-Wall}.
4790 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4791 @opindex Wimplicit-function-declaration
4792 @opindex Wno-implicit-function-declaration
4793 Give a warning whenever a function is used before being declared. In
4794 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4795 enabled by default and it is made into an error by
4796 @option{-pedantic-errors}. This warning is also enabled by
4799 @item -Wimplicit @r{(C and Objective-C only)}
4801 @opindex Wno-implicit
4802 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4803 This warning is enabled by @option{-Wall}.
4805 @item -Wimplicit-fallthrough
4806 @opindex Wimplicit-fallthrough
4807 @opindex Wno-implicit-fallthrough
4808 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4809 and @option{-Wno-implicit-fallthrough} is the same as
4810 @option{-Wimplicit-fallthrough=0}.
4812 @item -Wimplicit-fallthrough=@var{n}
4813 @opindex Wimplicit-fallthrough=
4814 Warn when a switch case falls through. For example:
4832 This warning does not warn when the last statement of a case cannot
4833 fall through, e.g. when there is a return statement or a call to function
4834 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4835 also takes into account control flow statements, such as ifs, and only
4836 warns when appropriate. E.g.@:
4846 @} else if (i < 1) @{
4856 Since there are occasions where a switch case fall through is desirable,
4857 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4858 to be used along with a null statement to suppress this warning that
4859 would normally occur:
4867 __attribute__ ((fallthrough));
4874 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4875 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4876 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4877 Instead of these attributes, it is also possible to add a fallthrough comment
4878 to silence the warning. The whole body of the C or C++ style comment should
4879 match the given regular expressions listed below. The option argument @var{n}
4880 specifies what kind of comments are accepted:
4884 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4886 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4887 expression, any comment is used as fallthrough comment.
4889 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4890 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4892 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4893 following regular expressions:
4897 @item @code{-fallthrough}
4899 @item @code{@@fallthrough@@}
4901 @item @code{lint -fallthrough[ \t]*}
4903 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4905 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4907 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4911 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4912 following regular expressions:
4916 @item @code{-fallthrough}
4918 @item @code{@@fallthrough@@}
4920 @item @code{lint -fallthrough[ \t]*}
4922 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4926 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
4927 fallthrough comments, only attributes disable the warning.
4931 The comment needs to be followed after optional whitespace and other comments
4932 by @code{case} or @code{default} keywords or by a user label that precedes some
4933 @code{case} or @code{default} label.
4948 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
4950 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
4951 @opindex Wif-not-aligned
4952 @opindex Wno-if-not-aligned
4953 Control if warning triggered by the @code{warn_if_not_aligned} attribute
4954 should be issued. This is enabled by default.
4955 Use @option{-Wno-if-not-aligned} to disable it.
4957 @item -Wignored-qualifiers @r{(C and C++ only)}
4958 @opindex Wignored-qualifiers
4959 @opindex Wno-ignored-qualifiers
4960 Warn if the return type of a function has a type qualifier
4961 such as @code{const}. For ISO C such a type qualifier has no effect,
4962 since the value returned by a function is not an lvalue.
4963 For C++, the warning is only emitted for scalar types or @code{void}.
4964 ISO C prohibits qualified @code{void} return types on function
4965 definitions, so such return types always receive a warning
4966 even without this option.
4968 This warning is also enabled by @option{-Wextra}.
4970 @item -Wignored-attributes @r{(C and C++ only)}
4971 @opindex Wignored-attributes
4972 @opindex Wno-ignored-attributes
4973 Warn when an attribute is ignored. This is different from the
4974 @option{-Wattributes} option in that it warns whenever the compiler decides
4975 to drop an attribute, not that the attribute is either unknown, used in a
4976 wrong place, etc. This warning is enabled by default.
4981 Warn if the type of @code{main} is suspicious. @code{main} should be
4982 a function with external linkage, returning int, taking either zero
4983 arguments, two, or three arguments of appropriate types. This warning
4984 is enabled by default in C++ and is enabled by either @option{-Wall}
4985 or @option{-Wpedantic}.
4987 @item -Wmisleading-indentation @r{(C and C++ only)}
4988 @opindex Wmisleading-indentation
4989 @opindex Wno-misleading-indentation
4990 Warn when the indentation of the code does not reflect the block structure.
4991 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
4992 @code{for} clauses with a guarded statement that does not use braces,
4993 followed by an unguarded statement with the same indentation.
4995 In the following example, the call to ``bar'' is misleadingly indented as
4996 if it were guarded by the ``if'' conditional.
4999 if (some_condition ())
5001 bar (); /* Gotcha: this is not guarded by the "if". */
5004 In the case of mixed tabs and spaces, the warning uses the
5005 @option{-ftabstop=} option to determine if the statements line up
5008 The warning is not issued for code involving multiline preprocessor logic
5009 such as the following example.
5014 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5020 The warning is not issued after a @code{#line} directive, since this
5021 typically indicates autogenerated code, and no assumptions can be made
5022 about the layout of the file that the directive references.
5024 This warning is enabled by @option{-Wall} in C and C++.
5026 @item -Wno-missing-attributes
5027 @opindex Wmissing-attributes
5028 @opindex Wno-missing-attributes
5029 Warn when a declaration of a function is missing one or more attributes
5030 that a related function is declared with and whose absence may adversely
5031 affect the correctness or efficiency of generated code. For example,
5032 the warning is issued for declarations of aliases that use attributes
5033 to specify less restrictive requirements than those of their targets.
5034 This typically represents a potential optimization oportunity rather
5035 than a hidden bug. The @option{-Wattribute-alias} option controls warnings
5036 issued for mismatches between declarations of aliases and their targets
5037 that might be indicative of code generation bugs.
5038 Attributes considered include @code{alloc_align}, @code{alloc_size},
5039 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5040 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5041 @code{returns_nonnull}, and @code{returns_twice}.
5043 In C++, the warning is issued when an explicit specialization of a primary
5044 template declared with attribute @code{alloc_align}, @code{alloc_size},
5045 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5046 or @code{nonnull} is declared without it. Attributes @code{deprecated},
5047 @code{error}, and @code{warning} suppress the warning.
5048 (@pxref{Function Attributes}).
5050 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5052 For example, since the declaration of the primary function template
5053 below makes use of both attribute @code{malloc} and @code{alloc_size}
5054 the declaration of the explicit specialization of the template is
5055 diagnosed because it is missing one of the attributes.
5059 T* __attribute__ ((malloc, alloc_size (1)))
5063 void* __attribute__ ((malloc)) // missing alloc_size
5064 allocate<void> (size_t);
5067 @item -Wmissing-braces
5068 @opindex Wmissing-braces
5069 @opindex Wno-missing-braces
5070 Warn if an aggregate or union initializer is not fully bracketed. In
5071 the following example, the initializer for @code{a} is not fully
5072 bracketed, but that for @code{b} is fully bracketed. This warning is
5073 enabled by @option{-Wall} in C.
5076 int a[2][2] = @{ 0, 1, 2, 3 @};
5077 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5080 This warning is enabled by @option{-Wall}.
5082 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5083 @opindex Wmissing-include-dirs
5084 @opindex Wno-missing-include-dirs
5085 Warn if a user-supplied include directory does not exist.
5087 @item -Wmissing-profile
5088 @opindex Wmissing-profile
5089 @opindex Wno-missing-profile
5090 Warn if feedback profiles are missing when using the
5091 @option{-fprofile-use} option.
5092 This option diagnoses those cases where a new function or a new file is added
5093 to the user code between compiling with @option{-fprofile-generate} and with
5094 @option{-fprofile-use}, without regenerating the profiles. In these cases, the
5095 profile feedback data files do not contain any profile feedback information for
5096 the newly added function or file respectively. Also, in the case when profile
5097 count data (.gcda) files are removed, GCC cannot use any profile feedback
5098 information. In all these cases, warnings are issued to inform the user that a
5099 profile generation step is due. @option{-Wno-missing-profile} can be used to
5100 disable the warning. Ignoring the warning can result in poorly optimized code.
5101 Completely disabling the warning is not recommended and should be done only
5102 when non-existent profile data is justified.
5104 @item -Wmultistatement-macros
5105 @opindex Wmultistatement-macros
5106 @opindex Wno-multistatement-macros
5107 Warn about unsafe multiple statement macros that appear to be guarded
5108 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5109 @code{while}, in which only the first statement is actually guarded after
5110 the macro is expanded.
5115 #define DOIT x++; y++
5120 will increment @code{y} unconditionally, not just when @code{c} holds.
5121 The can usually be fixed by wrapping the macro in a do-while loop:
5123 #define DOIT do @{ x++; y++; @} while (0)
5128 This warning is enabled by @option{-Wall} in C and C++.
5131 @opindex Wparentheses
5132 @opindex Wno-parentheses
5133 Warn if parentheses are omitted in certain contexts, such
5134 as when there is an assignment in a context where a truth value
5135 is expected, or when operators are nested whose precedence people
5136 often get confused about.
5138 Also warn if a comparison like @code{x<=y<=z} appears; this is
5139 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5140 interpretation from that of ordinary mathematical notation.
5142 Also warn for dangerous uses of the GNU extension to
5143 @code{?:} with omitted middle operand. When the condition
5144 in the @code{?}: operator is a boolean expression, the omitted value is
5145 always 1. Often programmers expect it to be a value computed
5146 inside the conditional expression instead.
5148 For C++ this also warns for some cases of unnecessary parentheses in
5149 declarations, which can indicate an attempt at a function call instead
5153 // Declares a local variable called mymutex.
5154 std::unique_lock<std::mutex> (mymutex);
5155 // User meant std::unique_lock<std::mutex> lock (mymutex);
5159 This warning is enabled by @option{-Wall}.
5161 @item -Wsequence-point
5162 @opindex Wsequence-point
5163 @opindex Wno-sequence-point
5164 Warn about code that may have undefined semantics because of violations
5165 of sequence point rules in the C and C++ standards.
5167 The C and C++ standards define the order in which expressions in a C/C++
5168 program are evaluated in terms of @dfn{sequence points}, which represent
5169 a partial ordering between the execution of parts of the program: those
5170 executed before the sequence point, and those executed after it. These
5171 occur after the evaluation of a full expression (one which is not part
5172 of a larger expression), after the evaluation of the first operand of a
5173 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5174 function is called (but after the evaluation of its arguments and the
5175 expression denoting the called function), and in certain other places.
5176 Other than as expressed by the sequence point rules, the order of
5177 evaluation of subexpressions of an expression is not specified. All
5178 these rules describe only a partial order rather than a total order,
5179 since, for example, if two functions are called within one expression
5180 with no sequence point between them, the order in which the functions
5181 are called is not specified. However, the standards committee have
5182 ruled that function calls do not overlap.
5184 It is not specified when between sequence points modifications to the
5185 values of objects take effect. Programs whose behavior depends on this
5186 have undefined behavior; the C and C++ standards specify that ``Between
5187 the previous and next sequence point an object shall have its stored
5188 value modified at most once by the evaluation of an expression.
5189 Furthermore, the prior value shall be read only to determine the value
5190 to be stored.''. If a program breaks these rules, the results on any
5191 particular implementation are entirely unpredictable.
5193 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5194 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
5195 diagnosed by this option, and it may give an occasional false positive
5196 result, but in general it has been found fairly effective at detecting
5197 this sort of problem in programs.
5199 The C++17 standard will define the order of evaluation of operands in
5200 more cases: in particular it requires that the right-hand side of an
5201 assignment be evaluated before the left-hand side, so the above
5202 examples are no longer undefined. But this warning will still warn
5203 about them, to help people avoid writing code that is undefined in C
5204 and earlier revisions of C++.
5206 The standard is worded confusingly, therefore there is some debate
5207 over the precise meaning of the sequence point rules in subtle cases.
5208 Links to discussions of the problem, including proposed formal
5209 definitions, may be found on the GCC readings page, at
5210 @uref{http://gcc.gnu.org/@/readings.html}.
5212 This warning is enabled by @option{-Wall} for C and C++.
5214 @item -Wno-return-local-addr
5215 @opindex Wno-return-local-addr
5216 @opindex Wreturn-local-addr
5217 Do not warn about returning a pointer (or in C++, a reference) to a
5218 variable that goes out of scope after the function returns.
5221 @opindex Wreturn-type
5222 @opindex Wno-return-type
5223 Warn whenever a function is defined with a return type that defaults
5224 to @code{int}. Also warn about any @code{return} statement with no
5225 return value in a function whose return type is not @code{void}
5226 (falling off the end of the function body is considered returning
5229 For C only, warn about a @code{return} statement with an expression in a
5230 function whose return type is @code{void}, unless the expression type is
5231 also @code{void}. As a GNU extension, the latter case is accepted
5232 without a warning unless @option{-Wpedantic} is used.
5234 For C++, a function without return type always produces a diagnostic
5235 message, even when @option{-Wno-return-type} is specified. The only
5236 exceptions are @code{main} and functions defined in system headers.
5238 This warning is enabled by default for C++ and is enabled by @option{-Wall}.
5240 @item -Wshift-count-negative
5241 @opindex Wshift-count-negative
5242 @opindex Wno-shift-count-negative
5243 Warn if shift count is negative. This warning is enabled by default.
5245 @item -Wshift-count-overflow
5246 @opindex Wshift-count-overflow
5247 @opindex Wno-shift-count-overflow
5248 Warn if shift count >= width of type. This warning is enabled by default.
5250 @item -Wshift-negative-value
5251 @opindex Wshift-negative-value
5252 @opindex Wno-shift-negative-value
5253 Warn if left shifting a negative value. This warning is enabled by
5254 @option{-Wextra} in C99 and C++11 modes (and newer).
5256 @item -Wshift-overflow
5257 @itemx -Wshift-overflow=@var{n}
5258 @opindex Wshift-overflow
5259 @opindex Wno-shift-overflow
5260 Warn about left shift overflows. This warning is enabled by
5261 default in C99 and C++11 modes (and newer).
5264 @item -Wshift-overflow=1
5265 This is the warning level of @option{-Wshift-overflow} and is enabled
5266 by default in C99 and C++11 modes (and newer). This warning level does
5267 not warn about left-shifting 1 into the sign bit. (However, in C, such
5268 an overflow is still rejected in contexts where an integer constant expression
5269 is required.) No warning is emitted in C++2A mode (and newer), as signed left
5272 @item -Wshift-overflow=2
5273 This warning level also warns about left-shifting 1 into the sign bit,
5274 unless C++14 mode (or newer) is active.
5280 Warn whenever a @code{switch} statement has an index of enumerated type
5281 and lacks a @code{case} for one or more of the named codes of that
5282 enumeration. (The presence of a @code{default} label prevents this
5283 warning.) @code{case} labels outside the enumeration range also
5284 provoke warnings when this option is used (even if there is a
5285 @code{default} label).
5286 This warning is enabled by @option{-Wall}.
5288 @item -Wswitch-default
5289 @opindex Wswitch-default
5290 @opindex Wno-switch-default
5291 Warn whenever a @code{switch} statement does not have a @code{default}
5295 @opindex Wswitch-enum
5296 @opindex Wno-switch-enum
5297 Warn whenever a @code{switch} statement has an index of enumerated type
5298 and lacks a @code{case} for one or more of the named codes of that
5299 enumeration. @code{case} labels outside the enumeration range also
5300 provoke warnings when this option is used. The only difference
5301 between @option{-Wswitch} and this option is that this option gives a
5302 warning about an omitted enumeration code even if there is a
5303 @code{default} label.
5306 @opindex Wswitch-bool
5307 @opindex Wno-switch-bool
5308 Warn whenever a @code{switch} statement has an index of boolean type
5309 and the case values are outside the range of a boolean type.
5310 It is possible to suppress this warning by casting the controlling
5311 expression to a type other than @code{bool}. For example:
5314 switch ((int) (a == 4))
5320 This warning is enabled by default for C and C++ programs.
5322 @item -Wswitch-unreachable
5323 @opindex Wswitch-unreachable
5324 @opindex Wno-switch-unreachable
5325 Warn whenever a @code{switch} statement contains statements between the
5326 controlling expression and the first case label, which will never be
5327 executed. For example:
5339 @option{-Wswitch-unreachable} does not warn if the statement between the
5340 controlling expression and the first case label is just a declaration:
5353 This warning is enabled by default for C and C++ programs.
5355 @item -Wsync-nand @r{(C and C++ only)}
5357 @opindex Wno-sync-nand
5358 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5359 built-in functions are used. These functions changed semantics in GCC 4.4.
5361 @item -Wunused-but-set-parameter
5362 @opindex Wunused-but-set-parameter
5363 @opindex Wno-unused-but-set-parameter
5364 Warn whenever a function parameter is assigned to, but otherwise unused
5365 (aside from its declaration).
5367 To suppress this warning use the @code{unused} attribute
5368 (@pxref{Variable Attributes}).
5370 This warning is also enabled by @option{-Wunused} together with
5373 @item -Wunused-but-set-variable
5374 @opindex Wunused-but-set-variable
5375 @opindex Wno-unused-but-set-variable
5376 Warn whenever a local variable is assigned to, but otherwise unused
5377 (aside from its declaration).
5378 This warning is enabled by @option{-Wall}.
5380 To suppress this warning use the @code{unused} attribute
5381 (@pxref{Variable Attributes}).
5383 This warning is also enabled by @option{-Wunused}, which is enabled
5386 @item -Wunused-function
5387 @opindex Wunused-function
5388 @opindex Wno-unused-function
5389 Warn whenever a static function is declared but not defined or a
5390 non-inline static function is unused.
5391 This warning is enabled by @option{-Wall}.
5393 @item -Wunused-label
5394 @opindex Wunused-label
5395 @opindex Wno-unused-label
5396 Warn whenever a label is declared but not used.
5397 This warning is enabled by @option{-Wall}.
5399 To suppress this warning use the @code{unused} attribute
5400 (@pxref{Variable Attributes}).
5402 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5403 @opindex Wunused-local-typedefs
5404 @opindex Wno-unused-local-typedefs
5405 Warn when a typedef locally defined in a function is not used.
5406 This warning is enabled by @option{-Wall}.
5408 @item -Wunused-parameter
5409 @opindex Wunused-parameter
5410 @opindex Wno-unused-parameter
5411 Warn whenever a function parameter is unused aside from its declaration.
5413 To suppress this warning use the @code{unused} attribute
5414 (@pxref{Variable Attributes}).
5416 @item -Wno-unused-result
5417 @opindex Wunused-result
5418 @opindex Wno-unused-result
5419 Do not warn if a caller of a function marked with attribute
5420 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5421 its return value. The default is @option{-Wunused-result}.
5423 @item -Wunused-variable
5424 @opindex Wunused-variable
5425 @opindex Wno-unused-variable
5426 Warn whenever a local or static variable is unused aside from its
5427 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5428 but not for C++. This warning is enabled by @option{-Wall}.
5430 To suppress this warning use the @code{unused} attribute
5431 (@pxref{Variable Attributes}).
5433 @item -Wunused-const-variable
5434 @itemx -Wunused-const-variable=@var{n}
5435 @opindex Wunused-const-variable
5436 @opindex Wno-unused-const-variable
5437 Warn whenever a constant static variable is unused aside from its declaration.
5438 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5439 for C, but not for C++. In C this declares variable storage, but in C++ this
5440 is not an error since const variables take the place of @code{#define}s.
5442 To suppress this warning use the @code{unused} attribute
5443 (@pxref{Variable Attributes}).
5446 @item -Wunused-const-variable=1
5447 This is the warning level that is enabled by @option{-Wunused-variable} for
5448 C. It warns only about unused static const variables defined in the main
5449 compilation unit, but not about static const variables declared in any
5452 @item -Wunused-const-variable=2
5453 This warning level also warns for unused constant static variables in
5454 headers (excluding system headers). This is the warning level of
5455 @option{-Wunused-const-variable} and must be explicitly requested since
5456 in C++ this isn't an error and in C it might be harder to clean up all
5460 @item -Wunused-value
5461 @opindex Wunused-value
5462 @opindex Wno-unused-value
5463 Warn whenever a statement computes a result that is explicitly not
5464 used. To suppress this warning cast the unused expression to
5465 @code{void}. This includes an expression-statement or the left-hand
5466 side of a comma expression that contains no side effects. For example,
5467 an expression such as @code{x[i,j]} causes a warning, while
5468 @code{x[(void)i,j]} does not.
5470 This warning is enabled by @option{-Wall}.
5475 All the above @option{-Wunused} options combined.
5477 In order to get a warning about an unused function parameter, you must
5478 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5479 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5481 @item -Wuninitialized
5482 @opindex Wuninitialized
5483 @opindex Wno-uninitialized
5484 Warn if an automatic variable is used without first being initialized
5485 or if a variable may be clobbered by a @code{setjmp} call. In C++,
5486 warn if a non-static reference or non-static @code{const} member
5487 appears in a class without constructors.
5489 If you want to warn about code that uses the uninitialized value of the
5490 variable in its own initializer, use the @option{-Winit-self} option.
5492 These warnings occur for individual uninitialized or clobbered
5493 elements of structure, union or array variables as well as for
5494 variables that are uninitialized or clobbered as a whole. They do
5495 not occur for variables or elements declared @code{volatile}. Because
5496 these warnings depend on optimization, the exact variables or elements
5497 for which there are warnings depends on the precise optimization
5498 options and version of GCC used.
5500 Note that there may be no warning about a variable that is used only
5501 to compute a value that itself is never used, because such
5502 computations may be deleted by data flow analysis before the warnings
5505 @item -Winvalid-memory-model
5506 @opindex Winvalid-memory-model
5507 @opindex Wno-invalid-memory-model
5508 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5509 and the C11 atomic generic functions with a memory consistency argument
5510 that is either invalid for the operation or outside the range of values
5511 of the @code{memory_order} enumeration. For example, since the
5512 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5513 defined for the relaxed, release, and sequentially consistent memory
5514 orders the following code is diagnosed:
5519 __atomic_store_n (i, 0, memory_order_consume);
5523 @option{-Winvalid-memory-model} is enabled by default.
5525 @item -Wmaybe-uninitialized
5526 @opindex Wmaybe-uninitialized
5527 @opindex Wno-maybe-uninitialized
5528 For an automatic (i.e.@: local) variable, if there exists a path from the
5529 function entry to a use of the variable that is initialized, but there exist
5530 some other paths for which the variable is not initialized, the compiler
5531 emits a warning if it cannot prove the uninitialized paths are not
5532 executed at run time.
5534 These warnings are only possible in optimizing compilation, because otherwise
5535 GCC does not keep track of the state of variables.
5537 These warnings are made optional because GCC may not be able to determine when
5538 the code is correct in spite of appearing to have an error. Here is one
5539 example of how this can happen:
5559 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5560 always initialized, but GCC doesn't know this. To suppress the
5561 warning, you need to provide a default case with assert(0) or
5564 @cindex @code{longjmp} warnings
5565 This option also warns when a non-volatile automatic variable might be
5566 changed by a call to @code{longjmp}.
5567 The compiler sees only the calls to @code{setjmp}. It cannot know
5568 where @code{longjmp} will be called; in fact, a signal handler could
5569 call it at any point in the code. As a result, you may get a warning
5570 even when there is in fact no problem because @code{longjmp} cannot
5571 in fact be called at the place that would cause a problem.
5573 Some spurious warnings can be avoided if you declare all the functions
5574 you use that never return as @code{noreturn}. @xref{Function
5577 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5579 @item -Wunknown-pragmas
5580 @opindex Wunknown-pragmas
5581 @opindex Wno-unknown-pragmas
5582 @cindex warning for unknown pragmas
5583 @cindex unknown pragmas, warning
5584 @cindex pragmas, warning of unknown
5585 Warn when a @code{#pragma} directive is encountered that is not understood by
5586 GCC@. If this command-line option is used, warnings are even issued
5587 for unknown pragmas in system header files. This is not the case if
5588 the warnings are only enabled by the @option{-Wall} command-line option.
5591 @opindex Wno-pragmas
5593 Do not warn about misuses of pragmas, such as incorrect parameters,
5594 invalid syntax, or conflicts between pragmas. See also
5595 @option{-Wunknown-pragmas}.
5597 @item -Wno-prio-ctor-dtor
5598 @opindex Wno-prio-ctor-dtor
5599 @opindex Wprio-ctor-dtor
5600 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5601 The use of constructor and destructor attributes allow you to assign a
5602 priority to the constructor/destructor to control its order of execution
5603 before @code{main} is called or after it returns. The priority values must be
5604 greater than 100 as the compiler reserves priority values between 0--100 for
5607 @item -Wstrict-aliasing
5608 @opindex Wstrict-aliasing
5609 @opindex Wno-strict-aliasing
5610 This option is only active when @option{-fstrict-aliasing} is active.
5611 It warns about code that might break the strict aliasing rules that the
5612 compiler is using for optimization. The warning does not catch all
5613 cases, but does attempt to catch the more common pitfalls. It is
5614 included in @option{-Wall}.
5615 It is equivalent to @option{-Wstrict-aliasing=3}
5617 @item -Wstrict-aliasing=n
5618 @opindex Wstrict-aliasing=n
5619 This option is only active when @option{-fstrict-aliasing} is active.
5620 It warns about code that might break the strict aliasing rules that the
5621 compiler is using for optimization.
5622 Higher levels correspond to higher accuracy (fewer false positives).
5623 Higher levels also correspond to more effort, similar to the way @option{-O}
5625 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5627 Level 1: Most aggressive, quick, least accurate.
5628 Possibly useful when higher levels
5629 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5630 false negatives. However, it has many false positives.
5631 Warns for all pointer conversions between possibly incompatible types,
5632 even if never dereferenced. Runs in the front end only.
5634 Level 2: Aggressive, quick, not too precise.
5635 May still have many false positives (not as many as level 1 though),
5636 and few false negatives (but possibly more than level 1).
5637 Unlike level 1, it only warns when an address is taken. Warns about
5638 incomplete types. Runs in the front end only.
5640 Level 3 (default for @option{-Wstrict-aliasing}):
5641 Should have very few false positives and few false
5642 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5643 Takes care of the common pun+dereference pattern in the front end:
5644 @code{*(int*)&some_float}.
5645 If optimization is enabled, it also runs in the back end, where it deals
5646 with multiple statement cases using flow-sensitive points-to information.
5647 Only warns when the converted pointer is dereferenced.
5648 Does not warn about incomplete types.
5650 @item -Wstrict-overflow
5651 @itemx -Wstrict-overflow=@var{n}
5652 @opindex Wstrict-overflow
5653 @opindex Wno-strict-overflow
5654 This option is only active when signed overflow is undefined.
5655 It warns about cases where the compiler optimizes based on the
5656 assumption that signed overflow does not occur. Note that it does not
5657 warn about all cases where the code might overflow: it only warns
5658 about cases where the compiler implements some optimization. Thus
5659 this warning depends on the optimization level.
5661 An optimization that assumes that signed overflow does not occur is
5662 perfectly safe if the values of the variables involved are such that
5663 overflow never does, in fact, occur. Therefore this warning can
5664 easily give a false positive: a warning about code that is not
5665 actually a problem. To help focus on important issues, several
5666 warning levels are defined. No warnings are issued for the use of
5667 undefined signed overflow when estimating how many iterations a loop
5668 requires, in particular when determining whether a loop will be
5672 @item -Wstrict-overflow=1
5673 Warn about cases that are both questionable and easy to avoid. For
5674 example the compiler simplifies
5675 @code{x + 1 > x} to @code{1}. This level of
5676 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5677 are not, and must be explicitly requested.
5679 @item -Wstrict-overflow=2
5680 Also warn about other cases where a comparison is simplified to a
5681 constant. For example: @code{abs (x) >= 0}. This can only be
5682 simplified when signed integer overflow is undefined, because
5683 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5684 zero. @option{-Wstrict-overflow} (with no level) is the same as
5685 @option{-Wstrict-overflow=2}.
5687 @item -Wstrict-overflow=3
5688 Also warn about other cases where a comparison is simplified. For
5689 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5691 @item -Wstrict-overflow=4
5692 Also warn about other simplifications not covered by the above cases.
5693 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5695 @item -Wstrict-overflow=5
5696 Also warn about cases where the compiler reduces the magnitude of a
5697 constant involved in a comparison. For example: @code{x + 2 > y} is
5698 simplified to @code{x + 1 >= y}. This is reported only at the
5699 highest warning level because this simplification applies to many
5700 comparisons, so this warning level gives a very large number of
5704 @item -Wstringop-overflow
5705 @itemx -Wstringop-overflow=@var{type}
5706 @opindex Wstringop-overflow
5707 @opindex Wno-stringop-overflow
5708 Warn for calls to string manipulation functions such as @code{memcpy} and
5709 @code{strcpy} that are determined to overflow the destination buffer. The
5710 optional argument is one greater than the type of Object Size Checking to
5711 perform to determine the size of the destination. @xref{Object Size Checking}.
5712 The argument is meaningful only for functions that operate on character arrays
5713 but not for raw memory functions like @code{memcpy} which always make use
5714 of Object Size type-0. The option also warns for calls that specify a size
5715 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5716 The option produces the best results with optimization enabled but can detect
5717 a small subset of simple buffer overflows even without optimization in
5718 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5719 correspond to the standard functions. In any case, the option warns about
5720 just a subset of buffer overflows detected by the corresponding overflow
5721 checking built-ins. For example, the option will issue a warning for
5722 the @code{strcpy} call below because it copies at least 5 characters
5723 (the string @code{"blue"} including the terminating NUL) into the buffer
5727 enum Color @{ blue, purple, yellow @};
5728 const char* f (enum Color clr)
5730 static char buf [4];
5734 case blue: str = "blue"; break;
5735 case purple: str = "purple"; break;
5736 case yellow: str = "yellow"; break;
5739 return strcpy (buf, str); // warning here
5743 Option @option{-Wstringop-overflow=2} is enabled by default.
5746 @item -Wstringop-overflow
5747 @itemx -Wstringop-overflow=1
5748 @opindex Wstringop-overflow
5749 @opindex Wno-stringop-overflow
5750 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5751 to determine the sizes of destination objects. This is the default setting
5752 of the option. At this setting the option will not warn for writes past
5753 the end of subobjects of larger objects accessed by pointers unless the
5754 size of the largest surrounding object is known. When the destination may
5755 be one of several objects it is assumed to be the largest one of them. On
5756 Linux systems, when optimization is enabled at this setting the option warns
5757 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5760 @item -Wstringop-overflow=2
5761 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5762 to determine the sizes of destination objects. At this setting the option
5763 will warn about overflows when writing to members of the largest complete
5764 objects whose exact size is known. It will, however, not warn for excessive
5765 writes to the same members of unknown objects referenced by pointers since
5766 they may point to arrays containing unknown numbers of elements.
5768 @item -Wstringop-overflow=3
5769 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5770 to determine the sizes of destination objects. At this setting the option
5771 warns about overflowing the smallest object or data member. This is the
5772 most restrictive setting of the option that may result in warnings for safe
5775 @item -Wstringop-overflow=4
5776 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5777 to determine the sizes of destination objects. At this setting the option
5778 will warn about overflowing any data members, and when the destination is
5779 one of several objects it uses the size of the largest of them to decide
5780 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5781 setting of the option may result in warnings for benign code.
5784 @item -Wstringop-truncation
5785 @opindex Wstringop-truncation
5786 @opindex Wno-stringop-truncation
5787 Warn for calls to bounded string manipulation functions such as @code{strncat},
5788 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5789 or leave the destination unchanged.
5791 In the following example, the call to @code{strncat} specifies a bound that
5792 is less than the length of the source string. As a result, the copy of
5793 the source will be truncated and so the call is diagnosed. To avoid the
5794 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5797 void append (char *buf, size_t bufsize)
5799 strncat (buf, ".txt", 3);
5803 As another example, the following call to @code{strncpy} results in copying
5804 to @code{d} just the characters preceding the terminating NUL, without
5805 appending the NUL to the end. Assuming the result of @code{strncpy} is
5806 necessarily a NUL-terminated string is a common mistake, and so the call
5807 is diagnosed. To avoid the warning when the result is not expected to be
5808 NUL-terminated, call @code{memcpy} instead.
5811 void copy (char *d, const char *s)
5813 strncpy (d, s, strlen (s));
5817 In the following example, the call to @code{strncpy} specifies the size
5818 of the destination buffer as the bound. If the length of the source
5819 string is equal to or greater than this size the result of the copy will
5820 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5821 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5822 element of the buffer to @code{NUL}.
5825 void copy (const char *s)
5828 strncpy (buf, s, sizeof buf);
5833 In situations where a character array is intended to store a sequence
5834 of bytes with no terminating @code{NUL} such an array may be annotated
5835 with attribute @code{nonstring} to avoid this warning. Such arrays,
5836 however, are not suitable arguments to functions that expect
5837 @code{NUL}-terminated strings. To help detect accidental misuses of
5838 such arrays GCC issues warnings unless it can prove that the use is
5839 safe. @xref{Common Variable Attributes}.
5841 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5842 @opindex Wsuggest-attribute=
5843 @opindex Wno-suggest-attribute=
5844 Warn for cases where adding an attribute may be beneficial. The
5845 attributes currently supported are listed below.
5848 @item -Wsuggest-attribute=pure
5849 @itemx -Wsuggest-attribute=const
5850 @itemx -Wsuggest-attribute=noreturn
5851 @itemx -Wmissing-noreturn
5852 @itemx -Wsuggest-attribute=malloc
5853 @opindex Wsuggest-attribute=pure
5854 @opindex Wno-suggest-attribute=pure
5855 @opindex Wsuggest-attribute=const
5856 @opindex Wno-suggest-attribute=const
5857 @opindex Wsuggest-attribute=noreturn
5858 @opindex Wno-suggest-attribute=noreturn
5859 @opindex Wmissing-noreturn
5860 @opindex Wno-missing-noreturn
5861 @opindex Wsuggest-attribute=malloc
5862 @opindex Wno-suggest-attribute=malloc
5864 Warn about functions that might be candidates for attributes
5865 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5866 only warns for functions visible in other compilation units or (in the case of
5867 @code{pure} and @code{const}) if it cannot prove that the function returns
5868 normally. A function returns normally if it doesn't contain an infinite loop or
5869 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5870 requires option @option{-fipa-pure-const}, which is enabled by default at
5871 @option{-O} and higher. Higher optimization levels improve the accuracy
5874 @item -Wsuggest-attribute=format
5875 @itemx -Wmissing-format-attribute
5876 @opindex Wsuggest-attribute=format
5877 @opindex Wmissing-format-attribute
5878 @opindex Wno-suggest-attribute=format
5879 @opindex Wno-missing-format-attribute
5883 Warn about function pointers that might be candidates for @code{format}
5884 attributes. Note these are only possible candidates, not absolute ones.
5885 GCC guesses that function pointers with @code{format} attributes that
5886 are used in assignment, initialization, parameter passing or return
5887 statements should have a corresponding @code{format} attribute in the
5888 resulting type. I.e.@: the left-hand side of the assignment or
5889 initialization, the type of the parameter variable, or the return type
5890 of the containing function respectively should also have a @code{format}
5891 attribute to avoid the warning.
5893 GCC also warns about function definitions that might be
5894 candidates for @code{format} attributes. Again, these are only
5895 possible candidates. GCC guesses that @code{format} attributes
5896 might be appropriate for any function that calls a function like
5897 @code{vprintf} or @code{vscanf}, but this might not always be the
5898 case, and some functions for which @code{format} attributes are
5899 appropriate may not be detected.
5901 @item -Wsuggest-attribute=cold
5902 @opindex Wsuggest-attribute=cold
5903 @opindex Wno-suggest-attribute=cold
5905 Warn about functions that might be candidates for @code{cold} attribute. This
5906 is based on static detection and generally will only warn about functions which
5907 always leads to a call to another @code{cold} function such as wrappers of
5908 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
5911 @item -Wsuggest-final-types
5912 @opindex Wno-suggest-final-types
5913 @opindex Wsuggest-final-types
5914 Warn about types with virtual methods where code quality would be improved
5915 if the type were declared with the C++11 @code{final} specifier,
5917 declared in an anonymous namespace. This allows GCC to more aggressively
5918 devirtualize the polymorphic calls. This warning is more effective with link
5919 time optimization, where the information about the class hierarchy graph is
5922 @item -Wsuggest-final-methods
5923 @opindex Wno-suggest-final-methods
5924 @opindex Wsuggest-final-methods
5925 Warn about virtual methods where code quality would be improved if the method
5926 were declared with the C++11 @code{final} specifier,
5927 or, if possible, its type were
5928 declared in an anonymous namespace or with the @code{final} specifier.
5930 more effective with link-time optimization, where the information about the
5931 class hierarchy graph is more complete. It is recommended to first consider
5932 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
5935 @item -Wsuggest-override
5936 Warn about overriding virtual functions that are not marked with the override
5940 @opindex Wno-alloc-zero
5941 @opindex Walloc-zero
5942 Warn about calls to allocation functions decorated with attribute
5943 @code{alloc_size} that specify zero bytes, including those to the built-in
5944 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
5945 @code{malloc}, and @code{realloc}. Because the behavior of these functions
5946 when called with a zero size differs among implementations (and in the case
5947 of @code{realloc} has been deprecated) relying on it may result in subtle
5948 portability bugs and should be avoided.
5950 @item -Walloc-size-larger-than=@var{byte-size}
5951 @opindex Walloc-size-larger-than=
5952 @opindex Wno-alloc-size-larger-than
5953 Warn about calls to functions decorated with attribute @code{alloc_size}
5954 that attempt to allocate objects larger than the specified number of bytes,
5955 or where the result of the size computation in an integer type with infinite
5956 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
5957 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
5958 Warnings controlled by the option can be disabled either by specifying
5959 @var{byte-size} of @samp{SIZE_MAX} or more or by
5960 @option{-Wno-alloc-size-larger-than}.
5961 @xref{Function Attributes}.
5963 @item -Wno-alloc-size-larger-than
5964 @opindex Wno-alloc-size-larger-than
5965 Disable @option{-Walloc-size-larger-than=} warnings. The option is
5966 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
5972 This option warns on all uses of @code{alloca} in the source.
5974 @item -Walloca-larger-than=@var{byte-size}
5975 @opindex Walloca-larger-than=
5976 @opindex Wno-alloca-larger-than
5977 This option warns on calls to @code{alloca} with an integer argument whose
5978 value is either zero, or that is not bounded by a controlling predicate
5979 that limits its value to at most @var{byte-size}. It also warns for calls
5980 to @code{alloca} where the bound value is unknown. Arguments of non-integer
5981 types are considered unbounded even if they appear to be constrained to
5984 For example, a bounded case of @code{alloca} could be:
5987 void func (size_t n)
5998 In the above example, passing @code{-Walloca-larger-than=1000} would not
5999 issue a warning because the call to @code{alloca} is known to be at most
6000 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
6001 the compiler would emit a warning.
6003 Unbounded uses, on the other hand, are uses of @code{alloca} with no
6004 controlling predicate constraining its integer argument. For example:
6009 void *p = alloca (n);
6014 If @code{-Walloca-larger-than=500} were passed, the above would trigger
6015 a warning, but this time because of the lack of bounds checking.
6017 Note, that even seemingly correct code involving signed integers could
6021 void func (signed int n)
6031 In the above example, @var{n} could be negative, causing a larger than
6032 expected argument to be implicitly cast into the @code{alloca} call.
6034 This option also warns when @code{alloca} is used in a loop.
6036 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6037 but is usually only effective when @option{-ftree-vrp} is active (default
6038 for @option{-O2} and above).
6040 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6042 @item -Wno-alloca-larger-than
6043 @opindex Wno-alloca-larger-than
6044 Disable @option{-Walloca-larger-than=} warnings. The option is
6045 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6047 @item -Warray-bounds
6048 @itemx -Warray-bounds=@var{n}
6049 @opindex Wno-array-bounds
6050 @opindex Warray-bounds
6051 This option is only active when @option{-ftree-vrp} is active
6052 (default for @option{-O2} and above). It warns about subscripts to arrays
6053 that are always out of bounds. This warning is enabled by @option{-Wall}.
6056 @item -Warray-bounds=1
6057 This is the warning level of @option{-Warray-bounds} and is enabled
6058 by @option{-Wall}; higher levels are not, and must be explicitly requested.
6060 @item -Warray-bounds=2
6061 This warning level also warns about out of bounds access for
6062 arrays at the end of a struct and for arrays accessed through
6063 pointers. This warning level may give a larger number of
6064 false positives and is deactivated by default.
6067 @item -Wattribute-alias=@var{n}
6068 @itemx -Wno-attribute-alias
6069 @opindex -Wattribute-alias
6070 @opindex -Wno-attribute-alias
6071 Warn about declarations using the @code{alias} and similar attributes whose
6072 target is incompatible with the type of the alias.
6073 @xref{Function Attributes,,Declaring Attributes of Functions}.
6074 The @option{-Wattribute-alias=1} is enabled by @option{-Wall}.
6077 @item -Wattribute-alias=1
6078 The default warning level of the @option{-Wattribute-alias} option diagnoses
6079 incompatibilities between the type of the alias declaration and that of its
6080 target. Such incompatibilities are typically indicative of bugs.
6082 @item -Wattribute-alias=2
6083 At this level @option{-Wattribute-alias} also diagnoses mismatches between
6084 the set of attributes of the alias declaration and the attributes applied
6085 to its target. Although in some cases such mismatches may indicate bugs,
6086 in other cases they may be benign and could be resolved simply by adding
6087 the missing attribute to the target.
6090 @item -Wbool-compare
6091 @opindex Wno-bool-compare
6092 @opindex Wbool-compare
6093 Warn about boolean expression compared with an integer value different from
6094 @code{true}/@code{false}. For instance, the following comparison is
6099 if ((n > 1) == 2) @{ @dots{} @}
6101 This warning is enabled by @option{-Wall}.
6103 @item -Wbool-operation
6104 @opindex Wno-bool-operation
6105 @opindex Wbool-operation
6106 Warn about suspicious operations on expressions of a boolean type. For
6107 instance, bitwise negation of a boolean is very likely a bug in the program.
6108 For C, this warning also warns about incrementing or decrementing a boolean,
6109 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
6110 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6112 This warning is enabled by @option{-Wall}.
6114 @item -Wduplicated-branches
6115 @opindex Wno-duplicated-branches
6116 @opindex Wduplicated-branches
6117 Warn when an if-else has identical branches. This warning detects cases like
6124 It doesn't warn when both branches contain just a null statement. This warning
6125 also warn for conditional operators:
6127 int i = x ? *p : *p;
6130 @item -Wduplicated-cond
6131 @opindex Wno-duplicated-cond
6132 @opindex Wduplicated-cond
6133 Warn about duplicated conditions in an if-else-if chain. For instance,
6134 warn for the following code:
6136 if (p->q != NULL) @{ @dots{} @}
6137 else if (p->q != NULL) @{ @dots{} @}
6140 @item -Wframe-address
6141 @opindex Wno-frame-address
6142 @opindex Wframe-address
6143 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6144 is called with an argument greater than 0. Such calls may return indeterminate
6145 values or crash the program. The warning is included in @option{-Wall}.
6147 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6148 @opindex Wno-discarded-qualifiers
6149 @opindex Wdiscarded-qualifiers
6150 Do not warn if type qualifiers on pointers are being discarded.
6151 Typically, the compiler warns if a @code{const char *} variable is
6152 passed to a function that takes a @code{char *} parameter. This option
6153 can be used to suppress such a warning.
6155 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6156 @opindex Wno-discarded-array-qualifiers
6157 @opindex Wdiscarded-array-qualifiers
6158 Do not warn if type qualifiers on arrays which are pointer targets
6159 are being discarded. Typically, the compiler warns if a
6160 @code{const int (*)[]} variable is passed to a function that
6161 takes a @code{int (*)[]} parameter. This option can be used to
6162 suppress such a warning.
6164 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6165 @opindex Wno-incompatible-pointer-types
6166 @opindex Wincompatible-pointer-types
6167 Do not warn when there is a conversion between pointers that have incompatible
6168 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
6169 which warns for pointer argument passing or assignment with different
6172 @item -Wno-int-conversion @r{(C and Objective-C only)}
6173 @opindex Wno-int-conversion
6174 @opindex Wint-conversion
6175 Do not warn about incompatible integer to pointer and pointer to integer
6176 conversions. This warning is about implicit conversions; for explicit
6177 conversions the warnings @option{-Wno-int-to-pointer-cast} and
6178 @option{-Wno-pointer-to-int-cast} may be used.
6180 @item -Wno-div-by-zero
6181 @opindex Wno-div-by-zero
6182 @opindex Wdiv-by-zero
6183 Do not warn about compile-time integer division by zero. Floating-point
6184 division by zero is not warned about, as it can be a legitimate way of
6185 obtaining infinities and NaNs.
6187 @item -Wsystem-headers
6188 @opindex Wsystem-headers
6189 @opindex Wno-system-headers
6190 @cindex warnings from system headers
6191 @cindex system headers, warnings from
6192 Print warning messages for constructs found in system header files.
6193 Warnings from system headers are normally suppressed, on the assumption
6194 that they usually do not indicate real problems and would only make the
6195 compiler output harder to read. Using this command-line option tells
6196 GCC to emit warnings from system headers as if they occurred in user
6197 code. However, note that using @option{-Wall} in conjunction with this
6198 option does @emph{not} warn about unknown pragmas in system
6199 headers---for that, @option{-Wunknown-pragmas} must also be used.
6201 @item -Wtautological-compare
6202 @opindex Wtautological-compare
6203 @opindex Wno-tautological-compare
6204 Warn if a self-comparison always evaluates to true or false. This
6205 warning detects various mistakes such as:
6209 if (i > i) @{ @dots{} @}
6212 This warning also warns about bitwise comparisons that always evaluate
6213 to true or false, for instance:
6215 if ((a & 16) == 10) @{ @dots{} @}
6217 will always be false.
6219 This warning is enabled by @option{-Wall}.
6222 @opindex Wtrampolines
6223 @opindex Wno-trampolines
6224 Warn about trampolines generated for pointers to nested functions.
6225 A trampoline is a small piece of data or code that is created at run
6226 time on the stack when the address of a nested function is taken, and is
6227 used to call the nested function indirectly. For some targets, it is
6228 made up of data only and thus requires no special treatment. But, for
6229 most targets, it is made up of code and thus requires the stack to be
6230 made executable in order for the program to work properly.
6233 @opindex Wfloat-equal
6234 @opindex Wno-float-equal
6235 Warn if floating-point values are used in equality comparisons.
6237 The idea behind this is that sometimes it is convenient (for the
6238 programmer) to consider floating-point values as approximations to
6239 infinitely precise real numbers. If you are doing this, then you need
6240 to compute (by analyzing the code, or in some other way) the maximum or
6241 likely maximum error that the computation introduces, and allow for it
6242 when performing comparisons (and when producing output, but that's a
6243 different problem). In particular, instead of testing for equality, you
6244 should check to see whether the two values have ranges that overlap; and
6245 this is done with the relational operators, so equality comparisons are
6248 @item -Wtraditional @r{(C and Objective-C only)}
6249 @opindex Wtraditional
6250 @opindex Wno-traditional
6251 Warn about certain constructs that behave differently in traditional and
6252 ISO C@. Also warn about ISO C constructs that have no traditional C
6253 equivalent, and/or problematic constructs that should be avoided.
6257 Macro parameters that appear within string literals in the macro body.
6258 In traditional C macro replacement takes place within string literals,
6259 but in ISO C it does not.
6262 In traditional C, some preprocessor directives did not exist.
6263 Traditional preprocessors only considered a line to be a directive
6264 if the @samp{#} appeared in column 1 on the line. Therefore
6265 @option{-Wtraditional} warns about directives that traditional C
6266 understands but ignores because the @samp{#} does not appear as the
6267 first character on the line. It also suggests you hide directives like
6268 @code{#pragma} not understood by traditional C by indenting them. Some
6269 traditional implementations do not recognize @code{#elif}, so this option
6270 suggests avoiding it altogether.
6273 A function-like macro that appears without arguments.
6276 The unary plus operator.
6279 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6280 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6281 constants.) Note, these suffixes appear in macros defined in the system
6282 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6283 Use of these macros in user code might normally lead to spurious
6284 warnings, however GCC's integrated preprocessor has enough context to
6285 avoid warning in these cases.
6288 A function declared external in one block and then used after the end of
6292 A @code{switch} statement has an operand of type @code{long}.
6295 A non-@code{static} function declaration follows a @code{static} one.
6296 This construct is not accepted by some traditional C compilers.
6299 The ISO type of an integer constant has a different width or
6300 signedness from its traditional type. This warning is only issued if
6301 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6302 typically represent bit patterns, are not warned about.
6305 Usage of ISO string concatenation is detected.
6308 Initialization of automatic aggregates.
6311 Identifier conflicts with labels. Traditional C lacks a separate
6312 namespace for labels.
6315 Initialization of unions. If the initializer is zero, the warning is
6316 omitted. This is done under the assumption that the zero initializer in
6317 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6318 initializer warnings and relies on default initialization to zero in the
6322 Conversions by prototypes between fixed/floating-point values and vice
6323 versa. The absence of these prototypes when compiling with traditional
6324 C causes serious problems. This is a subset of the possible
6325 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6328 Use of ISO C style function definitions. This warning intentionally is
6329 @emph{not} issued for prototype declarations or variadic functions
6330 because these ISO C features appear in your code when using
6331 libiberty's traditional C compatibility macros, @code{PARAMS} and
6332 @code{VPARAMS}. This warning is also bypassed for nested functions
6333 because that feature is already a GCC extension and thus not relevant to
6334 traditional C compatibility.
6337 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6338 @opindex Wtraditional-conversion
6339 @opindex Wno-traditional-conversion
6340 Warn if a prototype causes a type conversion that is different from what
6341 would happen to the same argument in the absence of a prototype. This
6342 includes conversions of fixed point to floating and vice versa, and
6343 conversions changing the width or signedness of a fixed-point argument
6344 except when the same as the default promotion.
6346 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6347 @opindex Wdeclaration-after-statement
6348 @opindex Wno-declaration-after-statement
6349 Warn when a declaration is found after a statement in a block. This
6350 construct, known from C++, was introduced with ISO C99 and is by default
6351 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
6356 Warn whenever a local variable or type declaration shadows another
6357 variable, parameter, type, class member (in C++), or instance variable
6358 (in Objective-C) or whenever a built-in function is shadowed. Note
6359 that in C++, the compiler warns if a local variable shadows an
6360 explicit typedef, but not if it shadows a struct/class/enum.
6361 Same as @option{-Wshadow=global}.
6363 @item -Wno-shadow-ivar @r{(Objective-C only)}
6364 @opindex Wno-shadow-ivar
6365 @opindex Wshadow-ivar
6366 Do not warn whenever a local variable shadows an instance variable in an
6369 @item -Wshadow=global
6370 @opindex Wshadow=local
6371 The default for @option{-Wshadow}. Warns for any (global) shadowing.
6373 @item -Wshadow=local
6374 @opindex Wshadow=local
6375 Warn when a local variable shadows another local variable or parameter.
6376 This warning is enabled by @option{-Wshadow=global}.
6378 @item -Wshadow=compatible-local
6379 @opindex Wshadow=compatible-local
6380 Warn when a local variable shadows another local variable or parameter
6381 whose type is compatible with that of the shadowing variable. In C++,
6382 type compatibility here means the type of the shadowing variable can be
6383 converted to that of the shadowed variable. The creation of this flag
6384 (in addition to @option{-Wshadow=local}) is based on the idea that when
6385 a local variable shadows another one of incompatible type, it is most
6386 likely intentional, not a bug or typo, as shown in the following example:
6390 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6392 for (int i = 0; i < N; ++i)
6401 Since the two variable @code{i} in the example above have incompatible types,
6402 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
6403 Because their types are incompatible, if a programmer accidentally uses one
6404 in place of the other, type checking will catch that and emit an error or
6405 warning. So not warning (about shadowing) in this case will not lead to
6406 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
6407 possibly reduce the number of warnings triggered by intentional shadowing.
6409 This warning is enabled by @option{-Wshadow=local}.
6411 @item -Wlarger-than=@var{byte-size}
6412 @opindex Wlarger-than=
6413 @opindex Wlarger-than-@var{byte-size}
6414 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6415 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6416 Warnings controlled by the option can be disabled either by specifying
6417 @var{byte-size} of @samp{SIZE_MAX} or more or by
6418 @option{-Wno-larger-than}.
6420 @item -Wno-larger-than
6421 @opindex Wno-larger-than
6422 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6423 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6425 @item -Wframe-larger-than=@var{byte-size}
6426 @opindex Wframe-larger-than=
6427 @opindex Wno-frame-larger-than
6428 Warn if the size of a function frame exceeds @var{byte-size}.
6429 The computation done to determine the stack frame size is approximate
6430 and not conservative.
6431 The actual requirements may be somewhat greater than @var{byte-size}
6432 even if you do not get a warning. In addition, any space allocated
6433 via @code{alloca}, variable-length arrays, or related constructs
6434 is not included by the compiler when determining
6435 whether or not to issue a warning.
6436 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6437 Warnings controlled by the option can be disabled either by specifying
6438 @var{byte-size} of @samp{SIZE_MAX} or more or by
6439 @option{-Wno-frame-larger-than}.
6441 @item -Wno-frame-larger-than
6442 @opindex Wno-frame-larger-than
6443 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6444 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6446 @item -Wno-free-nonheap-object
6447 @opindex Wno-free-nonheap-object
6448 @opindex Wfree-nonheap-object
6449 Do not warn when attempting to free an object that was not allocated
6452 @item -Wstack-usage=@var{byte-size}
6453 @opindex Wstack-usage
6454 @opindex Wno-stack-usage
6455 Warn if the stack usage of a function might exceed @var{byte-size}.
6456 The computation done to determine the stack usage is conservative.
6457 Any space allocated via @code{alloca}, variable-length arrays, or related
6458 constructs is included by the compiler when determining whether or not to
6461 The message is in keeping with the output of @option{-fstack-usage}.
6465 If the stack usage is fully static but exceeds the specified amount, it's:
6468 warning: stack usage is 1120 bytes
6471 If the stack usage is (partly) dynamic but bounded, it's:
6474 warning: stack usage might be 1648 bytes
6477 If the stack usage is (partly) dynamic and not bounded, it's:
6480 warning: stack usage might be unbounded
6484 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6485 Warnings controlled by the option can be disabled either by specifying
6486 @var{byte-size} of @samp{SIZE_MAX} or more or by
6487 @option{-Wno-stack-usage}.
6489 @item -Wno-stack-usage
6490 @opindex Wno-stack-usage
6491 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6492 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6494 @item -Wunsafe-loop-optimizations
6495 @opindex Wunsafe-loop-optimizations
6496 @opindex Wno-unsafe-loop-optimizations
6497 Warn if the loop cannot be optimized because the compiler cannot
6498 assume anything on the bounds of the loop indices. With
6499 @option{-funsafe-loop-optimizations} warn if the compiler makes
6502 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6503 @opindex Wno-pedantic-ms-format
6504 @opindex Wpedantic-ms-format
6505 When used in combination with @option{-Wformat}
6506 and @option{-pedantic} without GNU extensions, this option
6507 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6508 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6509 which depend on the MS runtime.
6512 @opindex Waligned-new
6513 @opindex Wno-aligned-new
6514 Warn about a new-expression of a type that requires greater alignment
6515 than the @code{alignof(std::max_align_t)} but uses an allocation
6516 function without an explicit alignment parameter. This option is
6517 enabled by @option{-Wall}.
6519 Normally this only warns about global allocation functions, but
6520 @option{-Waligned-new=all} also warns about class member allocation
6523 @item -Wplacement-new
6524 @itemx -Wplacement-new=@var{n}
6525 @opindex Wplacement-new
6526 @opindex Wno-placement-new
6527 Warn about placement new expressions with undefined behavior, such as
6528 constructing an object in a buffer that is smaller than the type of
6529 the object. For example, the placement new expression below is diagnosed
6530 because it attempts to construct an array of 64 integers in a buffer only
6536 This warning is enabled by default.
6539 @item -Wplacement-new=1
6540 This is the default warning level of @option{-Wplacement-new}. At this
6541 level the warning is not issued for some strictly undefined constructs that
6542 GCC allows as extensions for compatibility with legacy code. For example,
6543 the following @code{new} expression is not diagnosed at this level even
6544 though it has undefined behavior according to the C++ standard because
6545 it writes past the end of the one-element array.
6547 struct S @{ int n, a[1]; @};
6548 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6549 new (s->a)int [32]();
6552 @item -Wplacement-new=2
6553 At this level, in addition to diagnosing all the same constructs as at level
6554 1, a diagnostic is also issued for placement new expressions that construct
6555 an object in the last member of structure whose type is an array of a single
6556 element and whose size is less than the size of the object being constructed.
6557 While the previous example would be diagnosed, the following construct makes
6558 use of the flexible member array extension to avoid the warning at level 2.
6560 struct S @{ int n, a[]; @};
6561 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6562 new (s->a)int [32]();
6567 @item -Wpointer-arith
6568 @opindex Wpointer-arith
6569 @opindex Wno-pointer-arith
6570 Warn about anything that depends on the ``size of'' a function type or
6571 of @code{void}. GNU C assigns these types a size of 1, for
6572 convenience in calculations with @code{void *} pointers and pointers
6573 to functions. In C++, warn also when an arithmetic operation involves
6574 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6576 @item -Wpointer-compare
6577 @opindex Wpointer-compare
6578 @opindex Wno-pointer-compare
6579 Warn if a pointer is compared with a zero character constant. This usually
6580 means that the pointer was meant to be dereferenced. For example:
6583 const char *p = foo ();
6588 Note that the code above is invalid in C++11.
6590 This warning is enabled by default.
6593 @opindex Wtype-limits
6594 @opindex Wno-type-limits
6595 Warn if a comparison is always true or always false due to the limited
6596 range of the data type, but do not warn for constant expressions. For
6597 example, warn if an unsigned variable is compared against zero with
6598 @code{<} or @code{>=}. This warning is also enabled by
6601 @item -Wabsolute-value @r{(C and Objective-C only)}
6602 @opindex Wabsolute-value
6603 @opindex Wno-absolute-value
6604 Warn when a wrong absolute value function seems to be used or when it
6605 does not have any effect because its argument is an unsigned type.
6606 This warning be suppressed with an explicit type cast and it is also
6607 enabled by @option{-Wextra}.
6609 @include cppwarnopts.texi
6611 @item -Wbad-function-cast @r{(C and Objective-C only)}
6612 @opindex Wbad-function-cast
6613 @opindex Wno-bad-function-cast
6614 Warn when a function call is cast to a non-matching type.
6615 For example, warn if a call to a function returning an integer type
6616 is cast to a pointer type.
6618 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6619 @opindex Wc90-c99-compat
6620 @opindex Wno-c90-c99-compat
6621 Warn about features not present in ISO C90, but present in ISO C99.
6622 For instance, warn about use of variable length arrays, @code{long long}
6623 type, @code{bool} type, compound literals, designated initializers, and so
6624 on. This option is independent of the standards mode. Warnings are disabled
6625 in the expression that follows @code{__extension__}.
6627 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6628 @opindex Wc99-c11-compat
6629 @opindex Wno-c99-c11-compat
6630 Warn about features not present in ISO C99, but present in ISO C11.
6631 For instance, warn about use of anonymous structures and unions,
6632 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6633 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6634 and so on. This option is independent of the standards mode. Warnings are
6635 disabled in the expression that follows @code{__extension__}.
6637 @item -Wc++-compat @r{(C and Objective-C only)}
6638 @opindex Wc++-compat
6639 @opindex Wno-c++-compat
6640 Warn about ISO C constructs that are outside of the common subset of
6641 ISO C and ISO C++, e.g.@: request for implicit conversion from
6642 @code{void *} to a pointer to non-@code{void} type.
6644 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6645 @opindex Wc++11-compat
6646 @opindex Wno-c++11-compat
6647 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6648 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6649 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6650 enabled by @option{-Wall}.
6652 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6653 @opindex Wc++14-compat
6654 @opindex Wno-c++14-compat
6655 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6656 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6658 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6659 @opindex Wc++17-compat
6660 @opindex Wno-c++17-compat
6661 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6662 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6666 @opindex Wno-cast-qual
6667 Warn whenever a pointer is cast so as to remove a type qualifier from
6668 the target type. For example, warn if a @code{const char *} is cast
6669 to an ordinary @code{char *}.
6671 Also warn when making a cast that introduces a type qualifier in an
6672 unsafe way. For example, casting @code{char **} to @code{const char **}
6673 is unsafe, as in this example:
6676 /* p is char ** value. */
6677 const char **q = (const char **) p;
6678 /* Assignment of readonly string to const char * is OK. */
6680 /* Now char** pointer points to read-only memory. */
6685 @opindex Wcast-align
6686 @opindex Wno-cast-align
6687 Warn whenever a pointer is cast such that the required alignment of the
6688 target is increased. For example, warn if a @code{char *} is cast to
6689 an @code{int *} on machines where integers can only be accessed at
6690 two- or four-byte boundaries.
6692 @item -Wcast-align=strict
6693 @opindex Wcast-align=strict
6694 Warn whenever a pointer is cast such that the required alignment of the
6695 target is increased. For example, warn if a @code{char *} is cast to
6696 an @code{int *} regardless of the target machine.
6698 @item -Wcast-function-type
6699 @opindex Wcast-function-type
6700 @opindex Wno-cast-function-type
6701 Warn when a function pointer is cast to an incompatible function pointer.
6702 In a cast involving function types with a variable argument list only
6703 the types of initial arguments that are provided are considered.
6704 Any parameter of pointer-type matches any other pointer-type. Any benign
6705 differences in integral types are ignored, like @code{int} vs.@: @code{long}
6706 on ILP32 targets. Likewise type qualifiers are ignored. The function
6707 type @code{void (*) (void)} is special and matches everything, which can
6708 be used to suppress this warning.
6709 In a cast involving pointer to member types this warning warns whenever
6710 the type cast is changing the pointer to member type.
6711 This warning is enabled by @option{-Wextra}.
6713 @item -Wwrite-strings
6714 @opindex Wwrite-strings
6715 @opindex Wno-write-strings
6716 When compiling C, give string constants the type @code{const
6717 char[@var{length}]} so that copying the address of one into a
6718 non-@code{const} @code{char *} pointer produces a warning. These
6719 warnings help you find at compile time code that can try to write
6720 into a string constant, but only if you have been very careful about
6721 using @code{const} in declarations and prototypes. Otherwise, it is
6722 just a nuisance. This is why we did not make @option{-Wall} request
6725 When compiling C++, warn about the deprecated conversion from string
6726 literals to @code{char *}. This warning is enabled by default for C++
6730 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6731 @opindex Wcatch-value
6732 @opindex Wno-catch-value
6733 Warn about catch handlers that do not catch via reference.
6734 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6735 warn about polymorphic class types that are caught by value.
6736 With @option{-Wcatch-value=2} warn about all class types that are caught
6737 by value. With @option{-Wcatch-value=3} warn about all types that are
6738 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6742 @opindex Wno-clobbered
6743 Warn for variables that might be changed by @code{longjmp} or
6744 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6746 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6747 @opindex Wconditionally-supported
6748 @opindex Wno-conditionally-supported
6749 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6752 @opindex Wconversion
6753 @opindex Wno-conversion
6754 Warn for implicit conversions that may alter a value. This includes
6755 conversions between real and integer, like @code{abs (x)} when
6756 @code{x} is @code{double}; conversions between signed and unsigned,
6757 like @code{unsigned ui = -1}; and conversions to smaller types, like
6758 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6759 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6760 changed by the conversion like in @code{abs (2.0)}. Warnings about
6761 conversions between signed and unsigned integers can be disabled by
6762 using @option{-Wno-sign-conversion}.
6764 For C++, also warn for confusing overload resolution for user-defined
6765 conversions; and conversions that never use a type conversion
6766 operator: conversions to @code{void}, the same type, a base class or a
6767 reference to them. Warnings about conversions between signed and
6768 unsigned integers are disabled by default in C++ unless
6769 @option{-Wsign-conversion} is explicitly enabled.
6771 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6772 @opindex Wconversion-null
6773 @opindex Wno-conversion-null
6774 Do not warn for conversions between @code{NULL} and non-pointer
6775 types. @option{-Wconversion-null} is enabled by default.
6777 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6778 @opindex Wzero-as-null-pointer-constant
6779 @opindex Wno-zero-as-null-pointer-constant
6780 Warn when a literal @samp{0} is used as null pointer constant. This can
6781 be useful to facilitate the conversion to @code{nullptr} in C++11.
6783 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6784 @opindex Wsubobject-linkage
6785 @opindex Wno-subobject-linkage
6786 Warn if a class type has a base or a field whose type uses the anonymous
6787 namespace or depends on a type with no linkage. If a type A depends on
6788 a type B with no or internal linkage, defining it in multiple
6789 translation units would be an ODR violation because the meaning of B
6790 is different in each translation unit. If A only appears in a single
6791 translation unit, the best way to silence the warning is to give it
6792 internal linkage by putting it in an anonymous namespace as well. The
6793 compiler doesn't give this warning for types defined in the main .C
6794 file, as those are unlikely to have multiple definitions.
6795 @option{-Wsubobject-linkage} is enabled by default.
6797 @item -Wdangling-else
6798 @opindex Wdangling-else
6799 @opindex Wno-dangling-else
6800 Warn about constructions where there may be confusion to which
6801 @code{if} statement an @code{else} branch belongs. Here is an example of
6816 In C/C++, every @code{else} branch belongs to the innermost possible
6817 @code{if} statement, which in this example is @code{if (b)}. This is
6818 often not what the programmer expected, as illustrated in the above
6819 example by indentation the programmer chose. When there is the
6820 potential for this confusion, GCC issues a warning when this flag
6821 is specified. To eliminate the warning, add explicit braces around
6822 the innermost @code{if} statement so there is no way the @code{else}
6823 can belong to the enclosing @code{if}. The resulting code
6840 This warning is enabled by @option{-Wparentheses}.
6844 @opindex Wno-date-time
6845 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6846 are encountered as they might prevent bit-wise-identical reproducible
6849 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6850 @opindex Wdelete-incomplete
6851 @opindex Wno-delete-incomplete
6852 Warn when deleting a pointer to incomplete type, which may cause
6853 undefined behavior at runtime. This warning is enabled by default.
6855 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6856 @opindex Wuseless-cast
6857 @opindex Wno-useless-cast
6858 Warn when an expression is casted to its own type.
6861 @opindex Wempty-body
6862 @opindex Wno-empty-body
6863 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6864 while} statement. This warning is also enabled by @option{-Wextra}.
6866 @item -Wenum-compare
6867 @opindex Wenum-compare
6868 @opindex Wno-enum-compare
6869 Warn about a comparison between values of different enumerated types.
6870 In C++ enumerated type mismatches in conditional expressions are also
6871 diagnosed and the warning is enabled by default. In C this warning is
6872 enabled by @option{-Wall}.
6874 @item -Wextra-semi @r{(C++, Objective-C++ only)}
6875 @opindex Wextra-semi
6876 @opindex Wno-extra-semi
6877 Warn about redundant semicolon after in-class function definition.
6879 @item -Wjump-misses-init @r{(C, Objective-C only)}
6880 @opindex Wjump-misses-init
6881 @opindex Wno-jump-misses-init
6882 Warn if a @code{goto} statement or a @code{switch} statement jumps
6883 forward across the initialization of a variable, or jumps backward to a
6884 label after the variable has been initialized. This only warns about
6885 variables that are initialized when they are declared. This warning is
6886 only supported for C and Objective-C; in C++ this sort of branch is an
6889 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
6890 can be disabled with the @option{-Wno-jump-misses-init} option.
6892 @item -Wsign-compare
6893 @opindex Wsign-compare
6894 @opindex Wno-sign-compare
6895 @cindex warning for comparison of signed and unsigned values
6896 @cindex comparison of signed and unsigned values, warning
6897 @cindex signed and unsigned values, comparison warning
6898 Warn when a comparison between signed and unsigned values could produce
6899 an incorrect result when the signed value is converted to unsigned.
6900 In C++, this warning is also enabled by @option{-Wall}. In C, it is
6901 also enabled by @option{-Wextra}.
6903 @item -Wsign-conversion
6904 @opindex Wsign-conversion
6905 @opindex Wno-sign-conversion
6906 Warn for implicit conversions that may change the sign of an integer
6907 value, like assigning a signed integer expression to an unsigned
6908 integer variable. An explicit cast silences the warning. In C, this
6909 option is enabled also by @option{-Wconversion}.
6911 @item -Wfloat-conversion
6912 @opindex Wfloat-conversion
6913 @opindex Wno-float-conversion
6914 Warn for implicit conversions that reduce the precision of a real value.
6915 This includes conversions from real to integer, and from higher precision
6916 real to lower precision real values. This option is also enabled by
6917 @option{-Wconversion}.
6919 @item -Wno-scalar-storage-order
6920 @opindex Wno-scalar-storage-order
6921 @opindex Wscalar-storage-order
6922 Do not warn on suspicious constructs involving reverse scalar storage order.
6924 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
6925 @opindex Wsized-deallocation
6926 @opindex Wno-sized-deallocation
6927 Warn about a definition of an unsized deallocation function
6929 void operator delete (void *) noexcept;
6930 void operator delete[] (void *) noexcept;
6932 without a definition of the corresponding sized deallocation function
6934 void operator delete (void *, std::size_t) noexcept;
6935 void operator delete[] (void *, std::size_t) noexcept;
6937 or vice versa. Enabled by @option{-Wextra} along with
6938 @option{-fsized-deallocation}.
6940 @item -Wsizeof-pointer-div
6941 @opindex Wsizeof-pointer-div
6942 @opindex Wno-sizeof-pointer-div
6943 Warn for suspicious divisions of two sizeof expressions that divide
6944 the pointer size by the element size, which is the usual way to compute
6945 the array size but won't work out correctly with pointers. This warning
6946 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
6947 not an array, but a pointer. This warning is enabled by @option{-Wall}.
6949 @item -Wsizeof-pointer-memaccess
6950 @opindex Wsizeof-pointer-memaccess
6951 @opindex Wno-sizeof-pointer-memaccess
6952 Warn for suspicious length parameters to certain string and memory built-in
6953 functions if the argument uses @code{sizeof}. This warning triggers for
6954 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
6955 an array, but a pointer, and suggests a possible fix, or about
6956 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
6957 also warns about calls to bounded string copy functions like @code{strncat}
6958 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
6959 the source array. For example, in the following function the call to
6960 @code{strncat} specifies the size of the source string as the bound. That
6961 is almost certainly a mistake and so the call is diagnosed.
6963 void make_file (const char *name)
6965 char path[PATH_MAX];
6966 strncpy (path, name, sizeof path - 1);
6967 strncat (path, ".text", sizeof ".text");
6972 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
6974 @item -Wsizeof-array-argument
6975 @opindex Wsizeof-array-argument
6976 @opindex Wno-sizeof-array-argument
6977 Warn when the @code{sizeof} operator is applied to a parameter that is
6978 declared as an array in a function definition. This warning is enabled by
6979 default for C and C++ programs.
6981 @item -Wmemset-elt-size
6982 @opindex Wmemset-elt-size
6983 @opindex Wno-memset-elt-size
6984 Warn for suspicious calls to the @code{memset} built-in function, if the
6985 first argument references an array, and the third argument is a number
6986 equal to the number of elements, but not equal to the size of the array
6987 in memory. This indicates that the user has omitted a multiplication by
6988 the element size. This warning is enabled by @option{-Wall}.
6990 @item -Wmemset-transposed-args
6991 @opindex Wmemset-transposed-args
6992 @opindex Wno-memset-transposed-args
6993 Warn for suspicious calls to the @code{memset} built-in function, if the
6994 second argument is not zero and the third argument is zero. This warns e.g.@:
6995 about @code{memset (buf, sizeof buf, 0)} where most probably
6996 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
6997 is only emitted if the third argument is literal zero. If it is some
6998 expression that is folded to zero, a cast of zero to some type, etc.,
6999 it is far less likely that the user has mistakenly exchanged the arguments
7000 and no warning is emitted. This warning is enabled by @option{-Wall}.
7004 @opindex Wno-address
7005 Warn about suspicious uses of memory addresses. These include using
7006 the address of a function in a conditional expression, such as
7007 @code{void func(void); if (func)}, and comparisons against the memory
7008 address of a string literal, such as @code{if (x == "abc")}. Such
7009 uses typically indicate a programmer error: the address of a function
7010 always evaluates to true, so their use in a conditional usually
7011 indicate that the programmer forgot the parentheses in a function
7012 call; and comparisons against string literals result in unspecified
7013 behavior and are not portable in C, so they usually indicate that the
7014 programmer intended to use @code{strcmp}. This warning is enabled by
7018 @opindex Wlogical-op
7019 @opindex Wno-logical-op
7020 Warn about suspicious uses of logical operators in expressions.
7021 This includes using logical operators in contexts where a
7022 bit-wise operator is likely to be expected. Also warns when
7023 the operands of a logical operator are the same:
7026 if (a < 0 && a < 0) @{ @dots{} @}
7029 @item -Wlogical-not-parentheses
7030 @opindex Wlogical-not-parentheses
7031 @opindex Wno-logical-not-parentheses
7032 Warn about logical not used on the left hand side operand of a comparison.
7033 This option does not warn if the right operand is considered to be a boolean
7034 expression. Its purpose is to detect suspicious code like the following:
7038 if (!a > 1) @{ @dots{} @}
7041 It is possible to suppress the warning by wrapping the LHS into
7044 if ((!a) > 1) @{ @dots{} @}
7047 This warning is enabled by @option{-Wall}.
7049 @item -Waggregate-return
7050 @opindex Waggregate-return
7051 @opindex Wno-aggregate-return
7052 Warn if any functions that return structures or unions are defined or
7053 called. (In languages where you can return an array, this also elicits
7056 @item -Wno-aggressive-loop-optimizations
7057 @opindex Wno-aggressive-loop-optimizations
7058 @opindex Waggressive-loop-optimizations
7059 Warn if in a loop with constant number of iterations the compiler detects
7060 undefined behavior in some statement during one or more of the iterations.
7062 @item -Wno-attributes
7063 @opindex Wno-attributes
7064 @opindex Wattributes
7065 Do not warn if an unexpected @code{__attribute__} is used, such as
7066 unrecognized attributes, function attributes applied to variables,
7067 etc. This does not stop errors for incorrect use of supported
7070 @item -Wno-builtin-declaration-mismatch
7071 @opindex Wno-builtin-declaration-mismatch
7072 @opindex Wbuiltin-declaration-mismatch
7073 Warn if a built-in function is declared with an incompatible signature
7074 or as a non-function, or when a built-in function declared with a type
7075 that does not include a prototype is called with arguments whose promoted
7076 types do not match those expected by the function. When @option{-Wextra}
7077 is specified, also warn when a built-in function that takes arguments is
7078 declared without a prototype. The @option{-Wno-builtin-declaration-mismatch}
7079 warning is enabled by default. To avoid the warning include the appropriate
7080 header to bring the prototypes of built-in functions into scope.
7082 For example, the call to @code{memset} below is diagnosed by the warning
7083 because the function expects a value of type @code{size_t} as its argument
7084 but the type of @code{32} is @code{int}. With @option{-Wextra},
7085 the declaration of the function is diagnosed as well.
7087 extern void* memset ();
7090 memset (d, '\0', 32);
7094 @item -Wno-builtin-macro-redefined
7095 @opindex Wno-builtin-macro-redefined
7096 @opindex Wbuiltin-macro-redefined
7097 Do not warn if certain built-in macros are redefined. This suppresses
7098 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7099 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7101 @item -Wstrict-prototypes @r{(C and Objective-C only)}
7102 @opindex Wstrict-prototypes
7103 @opindex Wno-strict-prototypes
7104 Warn if a function is declared or defined without specifying the
7105 argument types. (An old-style function definition is permitted without
7106 a warning if preceded by a declaration that specifies the argument
7109 @item -Wold-style-declaration @r{(C and Objective-C only)}
7110 @opindex Wold-style-declaration
7111 @opindex Wno-old-style-declaration
7112 Warn for obsolescent usages, according to the C Standard, in a
7113 declaration. For example, warn if storage-class specifiers like
7114 @code{static} are not the first things in a declaration. This warning
7115 is also enabled by @option{-Wextra}.
7117 @item -Wold-style-definition @r{(C and Objective-C only)}
7118 @opindex Wold-style-definition
7119 @opindex Wno-old-style-definition
7120 Warn if an old-style function definition is used. A warning is given
7121 even if there is a previous prototype.
7123 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
7124 @opindex Wmissing-parameter-type
7125 @opindex Wno-missing-parameter-type
7126 A function parameter is declared without a type specifier in K&R-style
7133 This warning is also enabled by @option{-Wextra}.
7135 @item -Wmissing-prototypes @r{(C and Objective-C only)}
7136 @opindex Wmissing-prototypes
7137 @opindex Wno-missing-prototypes
7138 Warn if a global function is defined without a previous prototype
7139 declaration. This warning is issued even if the definition itself
7140 provides a prototype. Use this option to detect global functions
7141 that do not have a matching prototype declaration in a header file.
7142 This option is not valid for C++ because all function declarations
7143 provide prototypes and a non-matching declaration declares an
7144 overload rather than conflict with an earlier declaration.
7145 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7147 @item -Wmissing-declarations
7148 @opindex Wmissing-declarations
7149 @opindex Wno-missing-declarations
7150 Warn if a global function is defined without a previous declaration.
7151 Do so even if the definition itself provides a prototype.
7152 Use this option to detect global functions that are not declared in
7153 header files. In C, no warnings are issued for functions with previous
7154 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7155 missing prototypes. In C++, no warnings are issued for function templates,
7156 or for inline functions, or for functions in anonymous namespaces.
7158 @item -Wmissing-field-initializers
7159 @opindex Wmissing-field-initializers
7160 @opindex Wno-missing-field-initializers
7164 Warn if a structure's initializer has some fields missing. For
7165 example, the following code causes such a warning, because
7166 @code{x.h} is implicitly zero:
7169 struct s @{ int f, g, h; @};
7170 struct s x = @{ 3, 4 @};
7173 This option does not warn about designated initializers, so the following
7174 modification does not trigger a warning:
7177 struct s @{ int f, g, h; @};
7178 struct s x = @{ .f = 3, .g = 4 @};
7181 In C this option does not warn about the universal zero initializer
7185 struct s @{ int f, g, h; @};
7186 struct s x = @{ 0 @};
7189 Likewise, in C++ this option does not warn about the empty @{ @}
7190 initializer, for example:
7193 struct s @{ int f, g, h; @};
7197 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
7198 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7200 @item -Wno-multichar
7201 @opindex Wno-multichar
7203 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7204 Usually they indicate a typo in the user's code, as they have
7205 implementation-defined values, and should not be used in portable code.
7207 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7208 @opindex Wnormalized=
7209 @opindex Wnormalized
7210 @opindex Wno-normalized
7213 @cindex character set, input normalization
7214 In ISO C and ISO C++, two identifiers are different if they are
7215 different sequences of characters. However, sometimes when characters
7216 outside the basic ASCII character set are used, you can have two
7217 different character sequences that look the same. To avoid confusion,
7218 the ISO 10646 standard sets out some @dfn{normalization rules} which
7219 when applied ensure that two sequences that look the same are turned into
7220 the same sequence. GCC can warn you if you are using identifiers that
7221 have not been normalized; this option controls that warning.
7223 There are four levels of warning supported by GCC@. The default is
7224 @option{-Wnormalized=nfc}, which warns about any identifier that is
7225 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
7226 recommended form for most uses. It is equivalent to
7227 @option{-Wnormalized}.
7229 Unfortunately, there are some characters allowed in identifiers by
7230 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7231 identifiers. That is, there's no way to use these symbols in portable
7232 ISO C or C++ and have all your identifiers in NFC@.
7233 @option{-Wnormalized=id} suppresses the warning for these characters.
7234 It is hoped that future versions of the standards involved will correct
7235 this, which is why this option is not the default.
7237 You can switch the warning off for all characters by writing
7238 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
7239 only do this if you are using some other normalization scheme (like
7240 ``D''), because otherwise you can easily create bugs that are
7241 literally impossible to see.
7243 Some characters in ISO 10646 have distinct meanings but look identical
7244 in some fonts or display methodologies, especially once formatting has
7245 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7246 LETTER N'', displays just like a regular @code{n} that has been
7247 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
7248 normalization scheme to convert all these into a standard form as
7249 well, and GCC warns if your code is not in NFKC if you use
7250 @option{-Wnormalized=nfkc}. This warning is comparable to warning
7251 about every identifier that contains the letter O because it might be
7252 confused with the digit 0, and so is not the default, but may be
7253 useful as a local coding convention if the programming environment
7254 cannot be fixed to display these characters distinctly.
7256 @item -Wno-attribute-warning
7257 @opindex Wno-attribute-warning
7258 @opindex Wattribute-warning
7259 Do not warn about usage of functions (@pxref{Function Attributes})
7260 declared with @code{warning} attribute. By default, this warning is
7261 enabled. @option{-Wno-attribute-warning} can be used to disable the
7262 warning or @option{-Wno-error=attribute-warning} can be used to
7263 disable the error when compiled with @option{-Werror} flag.
7265 @item -Wno-deprecated
7266 @opindex Wno-deprecated
7267 @opindex Wdeprecated
7268 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
7270 @item -Wno-deprecated-declarations
7271 @opindex Wno-deprecated-declarations
7272 @opindex Wdeprecated-declarations
7273 Do not warn about uses of functions (@pxref{Function Attributes}),
7274 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7275 Attributes}) marked as deprecated by using the @code{deprecated}
7279 @opindex Wno-overflow
7281 Do not warn about compile-time overflow in constant expressions.
7286 Warn about One Definition Rule violations during link-time optimization.
7287 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
7290 @opindex Wopenmp-simd
7291 @opindex Wno-openmp-simd
7292 Warn if the vectorizer cost model overrides the OpenMP
7293 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7294 option can be used to relax the cost model.
7296 @item -Woverride-init @r{(C and Objective-C only)}
7297 @opindex Woverride-init
7298 @opindex Wno-override-init
7302 Warn if an initialized field without side effects is overridden when
7303 using designated initializers (@pxref{Designated Inits, , Designated
7306 This warning is included in @option{-Wextra}. To get other
7307 @option{-Wextra} warnings without this one, use @option{-Wextra
7308 -Wno-override-init}.
7310 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
7311 @opindex Woverride-init-side-effects
7312 @opindex Wno-override-init-side-effects
7313 Warn if an initialized field with side effects is overridden when
7314 using designated initializers (@pxref{Designated Inits, , Designated
7315 Initializers}). This warning is enabled by default.
7320 Warn if a structure is given the packed attribute, but the packed
7321 attribute has no effect on the layout or size of the structure.
7322 Such structures may be mis-aligned for little benefit. For
7323 instance, in this code, the variable @code{f.x} in @code{struct bar}
7324 is misaligned even though @code{struct bar} does not itself
7325 have the packed attribute:
7332 @} __attribute__((packed));
7340 @item -Wpacked-bitfield-compat
7341 @opindex Wpacked-bitfield-compat
7342 @opindex Wno-packed-bitfield-compat
7343 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7344 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
7345 the change can lead to differences in the structure layout. GCC
7346 informs you when the offset of such a field has changed in GCC 4.4.
7347 For example there is no longer a 4-bit padding between field @code{a}
7348 and @code{b} in this structure:
7355 @} __attribute__ ((packed));
7358 This warning is enabled by default. Use
7359 @option{-Wno-packed-bitfield-compat} to disable this warning.
7361 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7362 @opindex Wpacked-not-aligned
7363 @opindex Wno-packed-not-aligned
7364 Warn if a structure field with explicitly specified alignment in a
7365 packed struct or union is misaligned. For example, a warning will
7366 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7367 'struct S' is less than 8}, in this code:
7371 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7372 struct __attribute__ ((packed)) S @{
7378 This warning is enabled by @option{-Wall}.
7383 Warn if padding is included in a structure, either to align an element
7384 of the structure or to align the whole structure. Sometimes when this
7385 happens it is possible to rearrange the fields of the structure to
7386 reduce the padding and so make the structure smaller.
7388 @item -Wredundant-decls
7389 @opindex Wredundant-decls
7390 @opindex Wno-redundant-decls
7391 Warn if anything is declared more than once in the same scope, even in
7392 cases where multiple declaration is valid and changes nothing.
7396 @opindex Wno-restrict
7397 Warn when an object referenced by a @code{restrict}-qualified parameter
7398 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7399 argument, or when copies between such objects overlap. For example,
7400 the call to the @code{strcpy} function below attempts to truncate the string
7401 by replacing its initial characters with the last four. However, because
7402 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7403 the call is diagnosed.
7408 char a[] = "abcd1234";
7413 The @option{-Wrestrict} option detects some instances of simple overlap
7414 even without optimization but works best at @option{-O2} and above. It
7415 is included in @option{-Wall}.
7417 @item -Wnested-externs @r{(C and Objective-C only)}
7418 @opindex Wnested-externs
7419 @opindex Wno-nested-externs
7420 Warn if an @code{extern} declaration is encountered within a function.
7422 @item -Wno-inherited-variadic-ctor
7423 @opindex Winherited-variadic-ctor
7424 @opindex Wno-inherited-variadic-ctor
7425 Suppress warnings about use of C++11 inheriting constructors when the
7426 base class inherited from has a C variadic constructor; the warning is
7427 on by default because the ellipsis is not inherited.
7432 Warn if a function that is declared as inline cannot be inlined.
7433 Even with this option, the compiler does not warn about failures to
7434 inline functions declared in system headers.
7436 The compiler uses a variety of heuristics to determine whether or not
7437 to inline a function. For example, the compiler takes into account
7438 the size of the function being inlined and the amount of inlining
7439 that has already been done in the current function. Therefore,
7440 seemingly insignificant changes in the source program can cause the
7441 warnings produced by @option{-Winline} to appear or disappear.
7443 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7444 @opindex Wno-invalid-offsetof
7445 @opindex Winvalid-offsetof
7446 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7447 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
7448 to a non-standard-layout type is undefined. In existing C++ implementations,
7449 however, @code{offsetof} typically gives meaningful results.
7450 This flag is for users who are aware that they are
7451 writing nonportable code and who have deliberately chosen to ignore the
7454 The restrictions on @code{offsetof} may be relaxed in a future version
7455 of the C++ standard.
7457 @item -Wint-in-bool-context
7458 @opindex Wint-in-bool-context
7459 @opindex Wno-int-in-bool-context
7460 Warn for suspicious use of integer values where boolean values are expected,
7461 such as conditional expressions (?:) using non-boolean integer constants in
7462 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7463 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7464 for all kinds of multiplications regardless of the data type.
7465 This warning is enabled by @option{-Wall}.
7467 @item -Wno-int-to-pointer-cast
7468 @opindex Wno-int-to-pointer-cast
7469 @opindex Wint-to-pointer-cast
7470 Suppress warnings from casts to pointer type of an integer of a
7471 different size. In C++, casting to a pointer type of smaller size is
7472 an error. @option{Wint-to-pointer-cast} is enabled by default.
7475 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7476 @opindex Wno-pointer-to-int-cast
7477 @opindex Wpointer-to-int-cast
7478 Suppress warnings from casts from a pointer to an integer type of a
7482 @opindex Winvalid-pch
7483 @opindex Wno-invalid-pch
7484 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7485 the search path but cannot be used.
7489 @opindex Wno-long-long
7490 Warn if @code{long long} type is used. This is enabled by either
7491 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7492 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7494 @item -Wvariadic-macros
7495 @opindex Wvariadic-macros
7496 @opindex Wno-variadic-macros
7497 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7498 alternate syntax is used in ISO C99 mode. This is enabled by either
7499 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7500 messages, use @option{-Wno-variadic-macros}.
7504 @opindex Wno-varargs
7505 Warn upon questionable usage of the macros used to handle variable
7506 arguments like @code{va_start}. This is default. To inhibit the
7507 warning messages, use @option{-Wno-varargs}.
7509 @item -Wvector-operation-performance
7510 @opindex Wvector-operation-performance
7511 @opindex Wno-vector-operation-performance
7512 Warn if vector operation is not implemented via SIMD capabilities of the
7513 architecture. Mainly useful for the performance tuning.
7514 Vector operation can be implemented @code{piecewise}, which means that the
7515 scalar operation is performed on every vector element;
7516 @code{in parallel}, which means that the vector operation is implemented
7517 using scalars of wider type, which normally is more performance efficient;
7518 and @code{as a single scalar}, which means that vector fits into a
7521 @item -Wno-virtual-move-assign
7522 @opindex Wvirtual-move-assign
7523 @opindex Wno-virtual-move-assign
7524 Suppress warnings about inheriting from a virtual base with a
7525 non-trivial C++11 move assignment operator. This is dangerous because
7526 if the virtual base is reachable along more than one path, it is
7527 moved multiple times, which can mean both objects end up in the
7528 moved-from state. If the move assignment operator is written to avoid
7529 moving from a moved-from object, this warning can be disabled.
7534 Warn if a variable-length array is used in the code.
7535 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7536 the variable-length array.
7538 @item -Wvla-larger-than=@var{byte-size}
7539 @opindex Wvla-larger-than=
7540 @opindex Wno-vla-larger-than
7541 If this option is used, the compiler will warn for declarations of
7542 variable-length arrays whose size is either unbounded, or bounded
7543 by an argument that allows the array size to exceed @var{byte-size}
7544 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7545 works, but with variable-length arrays.
7547 Note that GCC may optimize small variable-length arrays of a known
7548 value into plain arrays, so this warning may not get triggered for
7551 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7552 is typically only effective when @option{-ftree-vrp} is active (default
7553 for @option{-O2} and above).
7555 See also @option{-Walloca-larger-than=@var{byte-size}}.
7557 @item -Wno-vla-larger-than
7558 @opindex Wno-vla-larger-than
7559 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7560 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7562 @item -Wvolatile-register-var
7563 @opindex Wvolatile-register-var
7564 @opindex Wno-volatile-register-var
7565 Warn if a register variable is declared volatile. The volatile
7566 modifier does not inhibit all optimizations that may eliminate reads
7567 and/or writes to register variables. This warning is enabled by
7570 @item -Wdisabled-optimization
7571 @opindex Wdisabled-optimization
7572 @opindex Wno-disabled-optimization
7573 Warn if a requested optimization pass is disabled. This warning does
7574 not generally indicate that there is anything wrong with your code; it
7575 merely indicates that GCC's optimizers are unable to handle the code
7576 effectively. Often, the problem is that your code is too big or too
7577 complex; GCC refuses to optimize programs when the optimization
7578 itself is likely to take inordinate amounts of time.
7580 @item -Wpointer-sign @r{(C and Objective-C only)}
7581 @opindex Wpointer-sign
7582 @opindex Wno-pointer-sign
7583 Warn for pointer argument passing or assignment with different signedness.
7584 This option is only supported for C and Objective-C@. It is implied by
7585 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7586 @option{-Wno-pointer-sign}.
7588 @item -Wstack-protector
7589 @opindex Wstack-protector
7590 @opindex Wno-stack-protector
7591 This option is only active when @option{-fstack-protector} is active. It
7592 warns about functions that are not protected against stack smashing.
7594 @item -Woverlength-strings
7595 @opindex Woverlength-strings
7596 @opindex Wno-overlength-strings
7597 Warn about string constants that are longer than the ``minimum
7598 maximum'' length specified in the C standard. Modern compilers
7599 generally allow string constants that are much longer than the
7600 standard's minimum limit, but very portable programs should avoid
7601 using longer strings.
7603 The limit applies @emph{after} string constant concatenation, and does
7604 not count the trailing NUL@. In C90, the limit was 509 characters; in
7605 C99, it was raised to 4095. C++98 does not specify a normative
7606 minimum maximum, so we do not diagnose overlength strings in C++@.
7608 This option is implied by @option{-Wpedantic}, and can be disabled with
7609 @option{-Wno-overlength-strings}.
7611 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7612 @opindex Wunsuffixed-float-constants
7613 @opindex Wno-unsuffixed-float-constants
7615 Issue a warning for any floating constant that does not have
7616 a suffix. When used together with @option{-Wsystem-headers} it
7617 warns about such constants in system header files. This can be useful
7618 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7619 from the decimal floating-point extension to C99.
7621 @item -Wno-designated-init @r{(C and Objective-C only)}
7622 Suppress warnings when a positional initializer is used to initialize
7623 a structure that has been marked with the @code{designated_init}
7627 Issue a warning when HSAIL cannot be emitted for the compiled function or
7632 @node Debugging Options
7633 @section Options for Debugging Your Program
7634 @cindex options, debugging
7635 @cindex debugging information options
7637 To tell GCC to emit extra information for use by a debugger, in almost
7638 all cases you need only to add @option{-g} to your other options.
7640 GCC allows you to use @option{-g} with
7641 @option{-O}. The shortcuts taken by optimized code may occasionally
7642 be surprising: some variables you declared may not exist
7643 at all; flow of control may briefly move where you did not expect it;
7644 some statements may not be executed because they compute constant
7645 results or their values are already at hand; some statements may
7646 execute in different places because they have been moved out of loops.
7647 Nevertheless it is possible to debug optimized output. This makes
7648 it reasonable to use the optimizer for programs that might have bugs.
7650 If you are not using some other optimization option, consider
7651 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7652 With no @option{-O} option at all, some compiler passes that collect
7653 information useful for debugging do not run at all, so that
7654 @option{-Og} may result in a better debugging experience.
7659 Produce debugging information in the operating system's native format
7660 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7663 On most systems that use stabs format, @option{-g} enables use of extra
7664 debugging information that only GDB can use; this extra information
7665 makes debugging work better in GDB but probably makes other debuggers
7667 refuse to read the program. If you want to control for certain whether
7668 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7669 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7673 Produce debugging information for use by GDB@. This means to use the
7674 most expressive format available (DWARF, stabs, or the native format
7675 if neither of those are supported), including GDB extensions if at all
7679 @itemx -gdwarf-@var{version}
7681 Produce debugging information in DWARF format (if that is supported).
7682 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7683 for most targets is 4. DWARF Version 5 is only experimental.
7685 Note that with DWARF Version 2, some ports require and always
7686 use some non-conflicting DWARF 3 extensions in the unwind tables.
7688 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7689 for maximum benefit.
7691 GCC no longer supports DWARF Version 1, which is substantially
7692 different than Version 2 and later. For historical reasons, some
7693 other DWARF-related options such as
7694 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7695 in their names, but apply to all currently-supported versions of DWARF.
7699 Produce debugging information in stabs format (if that is supported),
7700 without GDB extensions. This is the format used by DBX on most BSD
7701 systems. On MIPS, Alpha and System V Release 4 systems this option
7702 produces stabs debugging output that is not understood by DBX@.
7703 On System V Release 4 systems this option requires the GNU assembler.
7707 Produce debugging information in stabs format (if that is supported),
7708 using GNU extensions understood only by the GNU debugger (GDB)@. The
7709 use of these extensions is likely to make other debuggers crash or
7710 refuse to read the program.
7714 Produce debugging information in XCOFF format (if that is supported).
7715 This is the format used by the DBX debugger on IBM RS/6000 systems.
7719 Produce debugging information in XCOFF format (if that is supported),
7720 using GNU extensions understood only by the GNU debugger (GDB)@. The
7721 use of these extensions is likely to make other debuggers crash or
7722 refuse to read the program, and may cause assemblers other than the GNU
7723 assembler (GAS) to fail with an error.
7727 Produce debugging information in Alpha/VMS debug format (if that is
7728 supported). This is the format used by DEBUG on Alpha/VMS systems.
7731 @itemx -ggdb@var{level}
7732 @itemx -gstabs@var{level}
7733 @itemx -gxcoff@var{level}
7734 @itemx -gvms@var{level}
7735 Request debugging information and also use @var{level} to specify how
7736 much information. The default level is 2.
7738 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7741 Level 1 produces minimal information, enough for making backtraces in
7742 parts of the program that you don't plan to debug. This includes
7743 descriptions of functions and external variables, and line number
7744 tables, but no information about local variables.
7746 Level 3 includes extra information, such as all the macro definitions
7747 present in the program. Some debuggers support macro expansion when
7748 you use @option{-g3}.
7750 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7751 confusion with @option{-gdwarf-@var{level}}.
7752 Instead use an additional @option{-g@var{level}} option to change the
7753 debug level for DWARF.
7755 @item -feliminate-unused-debug-symbols
7756 @opindex feliminate-unused-debug-symbols
7757 Produce debugging information in stabs format (if that is supported),
7758 for only symbols that are actually used.
7760 @item -femit-class-debug-always
7761 @opindex femit-class-debug-always
7762 Instead of emitting debugging information for a C++ class in only one
7763 object file, emit it in all object files using the class. This option
7764 should be used only with debuggers that are unable to handle the way GCC
7765 normally emits debugging information for classes because using this
7766 option increases the size of debugging information by as much as a
7769 @item -fno-merge-debug-strings
7770 @opindex fmerge-debug-strings
7771 @opindex fno-merge-debug-strings
7772 Direct the linker to not merge together strings in the debugging
7773 information that are identical in different object files. Merging is
7774 not supported by all assemblers or linkers. Merging decreases the size
7775 of the debug information in the output file at the cost of increasing
7776 link processing time. Merging is enabled by default.
7778 @item -fdebug-prefix-map=@var{old}=@var{new}
7779 @opindex fdebug-prefix-map
7780 When compiling files residing in directory @file{@var{old}}, record
7781 debugging information describing them as if the files resided in
7782 directory @file{@var{new}} instead. This can be used to replace a
7783 build-time path with an install-time path in the debug info. It can
7784 also be used to change an absolute path to a relative path by using
7785 @file{.} for @var{new}. This can give more reproducible builds, which
7786 are location independent, but may require an extra command to tell GDB
7787 where to find the source files. See also @option{-ffile-prefix-map}.
7789 @item -fvar-tracking
7790 @opindex fvar-tracking
7791 Run variable tracking pass. It computes where variables are stored at each
7792 position in code. Better debugging information is then generated
7793 (if the debugging information format supports this information).
7795 It is enabled by default when compiling with optimization (@option{-Os},
7796 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7797 the debug info format supports it.
7799 @item -fvar-tracking-assignments
7800 @opindex fvar-tracking-assignments
7801 @opindex fno-var-tracking-assignments
7802 Annotate assignments to user variables early in the compilation and
7803 attempt to carry the annotations over throughout the compilation all the
7804 way to the end, in an attempt to improve debug information while
7805 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7807 It can be enabled even if var-tracking is disabled, in which case
7808 annotations are created and maintained, but discarded at the end.
7809 By default, this flag is enabled together with @option{-fvar-tracking},
7810 except when selective scheduling is enabled.
7813 @opindex gsplit-dwarf
7814 Separate as much DWARF debugging information as possible into a
7815 separate output file with the extension @file{.dwo}. This option allows
7816 the build system to avoid linking files with debug information. To
7817 be useful, this option requires a debugger capable of reading @file{.dwo}
7820 @item -gdescribe-dies
7821 @opindex gdescribe-dies
7822 Add description attributes to some DWARF DIEs that have no name attribute,
7823 such as artificial variables, external references and call site
7828 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7830 @item -ggnu-pubnames
7831 @opindex ggnu-pubnames
7832 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7833 suitable for conversion into a GDB@ index. This option is only useful
7834 with a linker that can produce GDB@ index version 7.
7836 @item -fdebug-types-section
7837 @opindex fdebug-types-section
7838 @opindex fno-debug-types-section
7839 When using DWARF Version 4 or higher, type DIEs can be put into
7840 their own @code{.debug_types} section instead of making them part of the
7841 @code{.debug_info} section. It is more efficient to put them in a separate
7842 comdat section since the linker can then remove duplicates.
7843 But not all DWARF consumers support @code{.debug_types} sections yet
7844 and on some objects @code{.debug_types} produces larger instead of smaller
7845 debugging information.
7847 @item -grecord-gcc-switches
7848 @itemx -gno-record-gcc-switches
7849 @opindex grecord-gcc-switches
7850 @opindex gno-record-gcc-switches
7851 This switch causes the command-line options used to invoke the
7852 compiler that may affect code generation to be appended to the
7853 DW_AT_producer attribute in DWARF debugging information. The options
7854 are concatenated with spaces separating them from each other and from
7855 the compiler version.
7856 It is enabled by default.
7857 See also @option{-frecord-gcc-switches} for another
7858 way of storing compiler options into the object file.
7860 @item -gstrict-dwarf
7861 @opindex gstrict-dwarf
7862 Disallow using extensions of later DWARF standard version than selected
7863 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
7864 DWARF extensions from later standard versions is allowed.
7866 @item -gno-strict-dwarf
7867 @opindex gno-strict-dwarf
7868 Allow using extensions of later DWARF standard version than selected with
7869 @option{-gdwarf-@var{version}}.
7871 @item -gas-loc-support
7872 @opindex gas-loc-support
7873 Inform the compiler that the assembler supports @code{.loc} directives.
7874 It may then use them for the assembler to generate DWARF2+ line number
7877 This is generally desirable, because assembler-generated line-number
7878 tables are a lot more compact than those the compiler can generate
7881 This option will be enabled by default if, at GCC configure time, the
7882 assembler was found to support such directives.
7884 @item -gno-as-loc-support
7885 @opindex gno-as-loc-support
7886 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
7887 line number tables are to be generated.
7889 @item gas-locview-support
7890 @opindex gas-locview-support
7891 Inform the compiler that the assembler supports @code{view} assignment
7892 and reset assertion checking in @code{.loc} directives.
7894 This option will be enabled by default if, at GCC configure time, the
7895 assembler was found to support them.
7897 @item gno-as-locview-support
7898 Force GCC to assign view numbers internally, if
7899 @option{-gvariable-location-views} are explicitly requested.
7902 @itemx -gno-column-info
7903 @opindex gcolumn-info
7904 @opindex gno-column-info
7905 Emit location column information into DWARF debugging information, rather
7906 than just file and line.
7907 This option is enabled by default.
7909 @item -gstatement-frontiers
7910 @itemx -gno-statement-frontiers
7911 @opindex gstatement-frontiers
7912 @opindex gno-statement-frontiers
7913 This option causes GCC to create markers in the internal representation
7914 at the beginning of statements, and to keep them roughly in place
7915 throughout compilation, using them to guide the output of @code{is_stmt}
7916 markers in the line number table. This is enabled by default when
7917 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
7918 @dots{}), and outputting DWARF 2 debug information at the normal level.
7920 @item -gvariable-location-views
7921 @itemx -gvariable-location-views=incompat5
7922 @itemx -gno-variable-location-views
7923 @opindex gvariable-location-views
7924 @opindex gvariable-location-views=incompat5
7925 @opindex gno-variable-location-views
7926 Augment variable location lists with progressive view numbers implied
7927 from the line number table. This enables debug information consumers to
7928 inspect state at certain points of the program, even if no instructions
7929 associated with the corresponding source locations are present at that
7930 point. If the assembler lacks support for view numbers in line number
7931 tables, this will cause the compiler to emit the line number table,
7932 which generally makes them somewhat less compact. The augmented line
7933 number tables and location lists are fully backward-compatible, so they
7934 can be consumed by debug information consumers that are not aware of
7935 these augmentations, but they won't derive any benefit from them either.
7937 This is enabled by default when outputting DWARF 2 debug information at
7938 the normal level, as long as there is assembler support,
7939 @option{-fvar-tracking-assignments} is enabled and
7940 @option{-gstrict-dwarf} is not. When assembler support is not
7941 available, this may still be enabled, but it will force GCC to output
7942 internal line number tables, and if
7943 @option{-ginternal-reset-location-views} is not enabled, that will most
7944 certainly lead to silently mismatching location views.
7946 There is a proposed representation for view numbers that is not backward
7947 compatible with the location list format introduced in DWARF 5, that can
7948 be enabled with @option{-gvariable-location-views=incompat5}. This
7949 option may be removed in the future, is only provided as a reference
7950 implementation of the proposed representation. Debug information
7951 consumers are not expected to support this extended format, and they
7952 would be rendered unable to decode location lists using it.
7954 @item -ginternal-reset-location-views
7955 @itemx -gnointernal-reset-location-views
7956 @opindex ginternal-reset-location-views
7957 @opindex gno-internal-reset-location-views
7958 Attempt to determine location views that can be omitted from location
7959 view lists. This requires the compiler to have very accurate insn
7960 length estimates, which isn't always the case, and it may cause
7961 incorrect view lists to be generated silently when using an assembler
7962 that does not support location view lists. The GNU assembler will flag
7963 any such error as a @code{view number mismatch}. This is only enabled
7964 on ports that define a reliable estimation function.
7966 @item -ginline-points
7967 @itemx -gno-inline-points
7968 @opindex ginline-points
7969 @opindex gno-inline-points
7970 Generate extended debug information for inlined functions. Location
7971 view tracking markers are inserted at inlined entry points, so that
7972 address and view numbers can be computed and output in debug
7973 information. This can be enabled independently of location views, in
7974 which case the view numbers won't be output, but it can only be enabled
7975 along with statement frontiers, and it is only enabled by default if
7976 location views are enabled.
7978 @item -gz@r{[}=@var{type}@r{]}
7980 Produce compressed debug sections in DWARF format, if that is supported.
7981 If @var{type} is not given, the default type depends on the capabilities
7982 of the assembler and linker used. @var{type} may be one of
7983 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
7984 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
7985 compression in traditional GNU format). If the linker doesn't support
7986 writing compressed debug sections, the option is rejected. Otherwise,
7987 if the assembler does not support them, @option{-gz} is silently ignored
7988 when producing object files.
7990 @item -femit-struct-debug-baseonly
7991 @opindex femit-struct-debug-baseonly
7992 Emit debug information for struct-like types
7993 only when the base name of the compilation source file
7994 matches the base name of file in which the struct is defined.
7996 This option substantially reduces the size of debugging information,
7997 but at significant potential loss in type information to the debugger.
7998 See @option{-femit-struct-debug-reduced} for a less aggressive option.
7999 See @option{-femit-struct-debug-detailed} for more detailed control.
8001 This option works only with DWARF debug output.
8003 @item -femit-struct-debug-reduced
8004 @opindex femit-struct-debug-reduced
8005 Emit debug information for struct-like types
8006 only when the base name of the compilation source file
8007 matches the base name of file in which the type is defined,
8008 unless the struct is a template or defined in a system header.
8010 This option significantly reduces the size of debugging information,
8011 with some potential loss in type information to the debugger.
8012 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
8013 See @option{-femit-struct-debug-detailed} for more detailed control.
8015 This option works only with DWARF debug output.
8017 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
8018 @opindex femit-struct-debug-detailed
8019 Specify the struct-like types
8020 for which the compiler generates debug information.
8021 The intent is to reduce duplicate struct debug information
8022 between different object files within the same program.
8024 This option is a detailed version of
8025 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
8026 which serves for most needs.
8028 A specification has the syntax@*
8029 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
8031 The optional first word limits the specification to
8032 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
8033 A struct type is used directly when it is the type of a variable, member.
8034 Indirect uses arise through pointers to structs.
8035 That is, when use of an incomplete struct is valid, the use is indirect.
8037 @samp{struct one direct; struct two * indirect;}.
8039 The optional second word limits the specification to
8040 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
8041 Generic structs are a bit complicated to explain.
8042 For C++, these are non-explicit specializations of template classes,
8043 or non-template classes within the above.
8044 Other programming languages have generics,
8045 but @option{-femit-struct-debug-detailed} does not yet implement them.
8047 The third word specifies the source files for those
8048 structs for which the compiler should emit debug information.
8049 The values @samp{none} and @samp{any} have the normal meaning.
8050 The value @samp{base} means that
8051 the base of name of the file in which the type declaration appears
8052 must match the base of the name of the main compilation file.
8053 In practice, this means that when compiling @file{foo.c}, debug information
8054 is generated for types declared in that file and @file{foo.h},
8055 but not other header files.
8056 The value @samp{sys} means those types satisfying @samp{base}
8057 or declared in system or compiler headers.
8059 You may need to experiment to determine the best settings for your application.
8061 The default is @option{-femit-struct-debug-detailed=all}.
8063 This option works only with DWARF debug output.
8065 @item -fno-dwarf2-cfi-asm
8066 @opindex fdwarf2-cfi-asm
8067 @opindex fno-dwarf2-cfi-asm
8068 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
8069 instead of using GAS @code{.cfi_*} directives.
8071 @item -fno-eliminate-unused-debug-types
8072 @opindex feliminate-unused-debug-types
8073 @opindex fno-eliminate-unused-debug-types
8074 Normally, when producing DWARF output, GCC avoids producing debug symbol
8075 output for types that are nowhere used in the source file being compiled.
8076 Sometimes it is useful to have GCC emit debugging
8077 information for all types declared in a compilation
8078 unit, regardless of whether or not they are actually used
8079 in that compilation unit, for example
8080 if, in the debugger, you want to cast a value to a type that is
8081 not actually used in your program (but is declared). More often,
8082 however, this results in a significant amount of wasted space.
8085 @node Optimize Options
8086 @section Options That Control Optimization
8087 @cindex optimize options
8088 @cindex options, optimization
8090 These options control various sorts of optimizations.
8092 Without any optimization option, the compiler's goal is to reduce the
8093 cost of compilation and to make debugging produce the expected
8094 results. Statements are independent: if you stop the program with a
8095 breakpoint between statements, you can then assign a new value to any
8096 variable or change the program counter to any other statement in the
8097 function and get exactly the results you expect from the source
8100 Turning on optimization flags makes the compiler attempt to improve
8101 the performance and/or code size at the expense of compilation time
8102 and possibly the ability to debug the program.
8104 The compiler performs optimization based on the knowledge it has of the
8105 program. Compiling multiple files at once to a single output file mode allows
8106 the compiler to use information gained from all of the files when compiling
8109 Not all optimizations are controlled directly by a flag. Only
8110 optimizations that have a flag are listed in this section.
8112 Most optimizations are completely disabled at @option{-O0} or if an
8113 @option{-O} level is not set on the command line, even if individual
8114 optimization flags are specified. Similarly, @option{-Og} suppresses
8115 many optimization passes.
8117 Depending on the target and how GCC was configured, a slightly different
8118 set of optimizations may be enabled at each @option{-O} level than
8119 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
8120 to find out the exact set of optimizations that are enabled at each level.
8121 @xref{Overall Options}, for examples.
8128 Optimize. Optimizing compilation takes somewhat more time, and a lot
8129 more memory for a large function.
8131 With @option{-O}, the compiler tries to reduce code size and execution
8132 time, without performing any optimizations that take a great deal of
8135 @c Note that in addition to the default_options_table list in opts.c,
8136 @c several optimization flags default to true but control optimization
8137 @c passes that are explicitly disabled at -O0.
8139 @option{-O} turns on the following optimization flags:
8141 @c Please keep the following list alphabetized.
8142 @gccoptlist{-fauto-inc-dec @gol
8143 -fbranch-count-reg @gol
8144 -fcombine-stack-adjustments @gol
8146 -fcprop-registers @gol
8149 -fdelayed-branch @gol
8151 -fforward-propagate @gol
8152 -fguess-branch-probability @gol
8153 -fif-conversion @gol
8154 -fif-conversion2 @gol
8155 -finline-functions-called-once @gol
8157 -fipa-pure-const @gol
8158 -fipa-reference @gol
8159 -fipa-reference-addressable @gol
8160 -fmerge-constants @gol
8161 -fmove-loop-invariants @gol
8162 -fomit-frame-pointer @gol
8163 -freorder-blocks @gol
8165 -fshrink-wrap-separate @gol
8166 -fsplit-wide-types @gol
8172 -ftree-coalesce-vars @gol
8173 -ftree-copy-prop @gol
8175 -ftree-dominator-opts @gol
8177 -ftree-forwprop @gol
8181 -ftree-scev-cprop @gol
8190 Optimize even more. GCC performs nearly all supported optimizations
8191 that do not involve a space-speed tradeoff.
8192 As compared to @option{-O}, this option increases both compilation time
8193 and the performance of the generated code.
8195 @option{-O2} turns on all optimization flags specified by @option{-O}. It
8196 also turns on the following optimization flags:
8198 @c Please keep the following list alphabetized!
8199 @gccoptlist{-falign-functions -falign-jumps @gol
8200 -falign-labels -falign-loops @gol
8202 -fcode-hoisting @gol
8204 -fcse-follow-jumps -fcse-skip-blocks @gol
8205 -fdelete-null-pointer-checks @gol
8206 -fdevirtualize -fdevirtualize-speculatively @gol
8207 -fexpensive-optimizations @gol
8208 -fgcse -fgcse-lm @gol
8209 -fhoist-adjacent-loads @gol
8210 -finline-small-functions @gol
8211 -findirect-inlining @gol
8212 -fipa-bit-cp -fipa-cp -fipa-icf @gol
8213 -fipa-ra -fipa-sra -fipa-vrp @gol
8214 -fisolate-erroneous-paths-dereference @gol
8216 -foptimize-sibling-calls @gol
8217 -foptimize-strlen @gol
8218 -fpartial-inlining @gol
8220 -freorder-blocks-algorithm=stc @gol
8221 -freorder-blocks-and-partition -freorder-functions @gol
8222 -frerun-cse-after-loop @gol
8223 -fschedule-insns -fschedule-insns2 @gol
8224 -fsched-interblock -fsched-spec @gol
8225 -fstore-merging @gol
8226 -fstrict-aliasing @gol
8228 -ftree-builtin-call-dce @gol
8230 -ftree-switch-conversion -ftree-tail-merge @gol
8233 Please note the warning under @option{-fgcse} about
8234 invoking @option{-O2} on programs that use computed gotos.
8238 Optimize yet more. @option{-O3} turns on all optimizations specified
8239 by @option{-O2} and also turns on the following optimization flags:
8241 @c Please keep the following list alphabetized!
8242 @gccoptlist{-fgcse-after-reload @gol
8243 -finline-functions @gol
8245 -floop-interchange @gol
8246 -floop-unroll-and-jam @gol
8248 -fpredictive-commoning @gol
8250 -ftree-loop-distribute-patterns @gol
8251 -ftree-loop-distribution @gol
8252 -ftree-loop-vectorize @gol
8253 -ftree-partial-pre @gol
8254 -ftree-slp-vectorize @gol
8255 -funswitch-loops @gol
8260 Reduce compilation time and make debugging produce the expected
8261 results. This is the default.
8265 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
8266 except those that often increase code size:
8268 @gccoptlist{-falign-functions -falign-jumps @gol
8269 -falign-labels -falign-loops @gol
8270 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
8272 It also enables @option{-finline-functions}, causes the compiler to tune for
8273 code size rather than execution speed, and performs further optimizations
8274 designed to reduce code size.
8278 Disregard strict standards compliance. @option{-Ofast} enables all
8279 @option{-O3} optimizations. It also enables optimizations that are not
8280 valid for all standard-compliant programs.
8281 It turns on @option{-ffast-math} and the Fortran-specific
8282 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
8283 specified, and @option{-fno-protect-parens}.
8287 Optimize debugging experience. @option{-Og} should be the optimization
8288 level of choice for the standard edit-compile-debug cycle, offering
8289 a reasonable level of optimization while maintaining fast compilation
8290 and a good debugging experience. It is a better choice than @option{-O0}
8291 for producing debuggable code because some compiler passes
8292 that collect debug information are disabled at @option{-O0}.
8294 Like @option{-O0}, @option{-Og} completely disables a number of
8295 optimization passes so that individual options controlling them have
8296 no effect. Otherwise @option{-Og} enables all @option{-O1}
8297 optimization flags except for those that may interfere with debugging:
8299 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
8300 -fif-conversion -fif-conversion2 @gol
8301 -finline-functions-called-once @gol
8302 -fmove-loop-invariants -fssa-phiopt @gol
8303 -ftree-bit-ccp -ftree-pta -ftree-sra}
8307 If you use multiple @option{-O} options, with or without level numbers,
8308 the last such option is the one that is effective.
8310 Options of the form @option{-f@var{flag}} specify machine-independent
8311 flags. Most flags have both positive and negative forms; the negative
8312 form of @option{-ffoo} is @option{-fno-foo}. In the table
8313 below, only one of the forms is listed---the one you typically
8314 use. You can figure out the other form by either removing @samp{no-}
8317 The following options control specific optimizations. They are either
8318 activated by @option{-O} options or are related to ones that are. You
8319 can use the following flags in the rare cases when ``fine-tuning'' of
8320 optimizations to be performed is desired.
8323 @item -fno-defer-pop
8324 @opindex fno-defer-pop
8326 For machines that must pop arguments after a function call, always pop
8327 the arguments as soon as each function returns.
8328 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
8329 this allows the compiler to let arguments accumulate on the stack for several
8330 function calls and pop them all at once.
8332 @item -fforward-propagate
8333 @opindex fforward-propagate
8334 Perform a forward propagation pass on RTL@. The pass tries to combine two
8335 instructions and checks if the result can be simplified. If loop unrolling
8336 is active, two passes are performed and the second is scheduled after
8339 This option is enabled by default at optimization levels @option{-O},
8340 @option{-O2}, @option{-O3}, @option{-Os}.
8342 @item -ffp-contract=@var{style}
8343 @opindex ffp-contract
8344 @option{-ffp-contract=off} disables floating-point expression contraction.
8345 @option{-ffp-contract=fast} enables floating-point expression contraction
8346 such as forming of fused multiply-add operations if the target has
8347 native support for them.
8348 @option{-ffp-contract=on} enables floating-point expression contraction
8349 if allowed by the language standard. This is currently not implemented
8350 and treated equal to @option{-ffp-contract=off}.
8352 The default is @option{-ffp-contract=fast}.
8354 @item -fomit-frame-pointer
8355 @opindex fomit-frame-pointer
8356 Omit the frame pointer in functions that don't need one. This avoids the
8357 instructions to save, set up and restore the frame pointer; on many targets
8358 it also makes an extra register available.
8360 On some targets this flag has no effect because the standard calling sequence
8361 always uses a frame pointer, so it cannot be omitted.
8363 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8364 is used in all functions. Several targets always omit the frame pointer in
8367 Enabled by default at @option{-O} and higher.
8369 @item -foptimize-sibling-calls
8370 @opindex foptimize-sibling-calls
8371 Optimize sibling and tail recursive calls.
8373 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8375 @item -foptimize-strlen
8376 @opindex foptimize-strlen
8377 Optimize various standard C string functions (e.g.@: @code{strlen},
8378 @code{strchr} or @code{strcpy}) and
8379 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8381 Enabled at levels @option{-O2}, @option{-O3}.
8386 Do not expand any functions inline apart from those marked with
8387 the @code{always_inline} attribute. This is the default when not
8390 Single functions can be exempted from inlining by marking them
8391 with the @code{noinline} attribute.
8393 @item -finline-small-functions
8394 @opindex finline-small-functions
8395 Integrate functions into their callers when their body is smaller than expected
8396 function call code (so overall size of program gets smaller). The compiler
8397 heuristically decides which functions are simple enough to be worth integrating
8398 in this way. This inlining applies to all functions, even those not declared
8401 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8403 @item -findirect-inlining
8404 @opindex findirect-inlining
8405 Inline also indirect calls that are discovered to be known at compile
8406 time thanks to previous inlining. This option has any effect only
8407 when inlining itself is turned on by the @option{-finline-functions}
8408 or @option{-finline-small-functions} options.
8410 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8412 @item -finline-functions
8413 @opindex finline-functions
8414 Consider all functions for inlining, even if they are not declared inline.
8415 The compiler heuristically decides which functions are worth integrating
8418 If all calls to a given function are integrated, and the function is
8419 declared @code{static}, then the function is normally not output as
8420 assembler code in its own right.
8422 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. Also enabled
8423 by @option{-fprofile-use} and @option{-fauto-profile}.
8425 @item -finline-functions-called-once
8426 @opindex finline-functions-called-once
8427 Consider all @code{static} functions called once for inlining into their
8428 caller even if they are not marked @code{inline}. If a call to a given
8429 function is integrated, then the function is not output as assembler code
8432 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
8433 but not @option{-Og}.
8435 @item -fearly-inlining
8436 @opindex fearly-inlining
8437 Inline functions marked by @code{always_inline} and functions whose body seems
8438 smaller than the function call overhead early before doing
8439 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
8440 makes profiling significantly cheaper and usually inlining faster on programs
8441 having large chains of nested wrapper functions.
8447 Perform interprocedural scalar replacement of aggregates, removal of
8448 unused parameters and replacement of parameters passed by reference
8449 by parameters passed by value.
8451 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8453 @item -finline-limit=@var{n}
8454 @opindex finline-limit
8455 By default, GCC limits the size of functions that can be inlined. This flag
8456 allows coarse control of this limit. @var{n} is the size of functions that
8457 can be inlined in number of pseudo instructions.
8459 Inlining is actually controlled by a number of parameters, which may be
8460 specified individually by using @option{--param @var{name}=@var{value}}.
8461 The @option{-finline-limit=@var{n}} option sets some of these parameters
8465 @item max-inline-insns-single
8466 is set to @var{n}/2.
8467 @item max-inline-insns-auto
8468 is set to @var{n}/2.
8471 See below for a documentation of the individual
8472 parameters controlling inlining and for the defaults of these parameters.
8474 @emph{Note:} there may be no value to @option{-finline-limit} that results
8475 in default behavior.
8477 @emph{Note:} pseudo instruction represents, in this particular context, an
8478 abstract measurement of function's size. In no way does it represent a count
8479 of assembly instructions and as such its exact meaning might change from one
8480 release to an another.
8482 @item -fno-keep-inline-dllexport
8483 @opindex fno-keep-inline-dllexport
8484 @opindex fkeep-inline-dllexport
8485 This is a more fine-grained version of @option{-fkeep-inline-functions},
8486 which applies only to functions that are declared using the @code{dllexport}
8487 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8490 @item -fkeep-inline-functions
8491 @opindex fkeep-inline-functions
8492 In C, emit @code{static} functions that are declared @code{inline}
8493 into the object file, even if the function has been inlined into all
8494 of its callers. This switch does not affect functions using the
8495 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8496 inline functions into the object file.
8498 @item -fkeep-static-functions
8499 @opindex fkeep-static-functions
8500 Emit @code{static} functions into the object file, even if the function
8503 @item -fkeep-static-consts
8504 @opindex fkeep-static-consts
8505 Emit variables declared @code{static const} when optimization isn't turned
8506 on, even if the variables aren't referenced.
8508 GCC enables this option by default. If you want to force the compiler to
8509 check if a variable is referenced, regardless of whether or not
8510 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8512 @item -fmerge-constants
8513 @opindex fmerge-constants
8514 Attempt to merge identical constants (string constants and floating-point
8515 constants) across compilation units.
8517 This option is the default for optimized compilation if the assembler and
8518 linker support it. Use @option{-fno-merge-constants} to inhibit this
8521 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8523 @item -fmerge-all-constants
8524 @opindex fmerge-all-constants
8525 Attempt to merge identical constants and identical variables.
8527 This option implies @option{-fmerge-constants}. In addition to
8528 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8529 arrays or initialized constant variables with integral or floating-point
8530 types. Languages like C or C++ require each variable, including multiple
8531 instances of the same variable in recursive calls, to have distinct locations,
8532 so using this option results in non-conforming
8535 @item -fmodulo-sched
8536 @opindex fmodulo-sched
8537 Perform swing modulo scheduling immediately before the first scheduling
8538 pass. This pass looks at innermost loops and reorders their
8539 instructions by overlapping different iterations.
8541 @item -fmodulo-sched-allow-regmoves
8542 @opindex fmodulo-sched-allow-regmoves
8543 Perform more aggressive SMS-based modulo scheduling with register moves
8544 allowed. By setting this flag certain anti-dependences edges are
8545 deleted, which triggers the generation of reg-moves based on the
8546 life-range analysis. This option is effective only with
8547 @option{-fmodulo-sched} enabled.
8549 @item -fno-branch-count-reg
8550 @opindex fno-branch-count-reg
8551 @opindex fbranch-count-reg
8552 Disable the optimization pass that scans for opportunities to use
8553 ``decrement and branch'' instructions on a count register instead of
8554 instruction sequences that decrement a register, compare it against zero, and
8555 then branch based upon the result. This option is only meaningful on
8556 architectures that support such instructions, which include x86, PowerPC,
8557 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8558 doesn't remove the decrement and branch instructions from the generated
8559 instruction stream introduced by other optimization passes.
8561 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
8562 except for @option{-Og}.
8564 @item -fno-function-cse
8565 @opindex fno-function-cse
8566 @opindex ffunction-cse
8567 Do not put function addresses in registers; make each instruction that
8568 calls a constant function contain the function's address explicitly.
8570 This option results in less efficient code, but some strange hacks
8571 that alter the assembler output may be confused by the optimizations
8572 performed when this option is not used.
8574 The default is @option{-ffunction-cse}
8576 @item -fno-zero-initialized-in-bss
8577 @opindex fno-zero-initialized-in-bss
8578 @opindex fzero-initialized-in-bss
8579 If the target supports a BSS section, GCC by default puts variables that
8580 are initialized to zero into BSS@. This can save space in the resulting
8583 This option turns off this behavior because some programs explicitly
8584 rely on variables going to the data section---e.g., so that the
8585 resulting executable can find the beginning of that section and/or make
8586 assumptions based on that.
8588 The default is @option{-fzero-initialized-in-bss}.
8590 @item -fthread-jumps
8591 @opindex fthread-jumps
8592 Perform optimizations that check to see if a jump branches to a
8593 location where another comparison subsumed by the first is found. If
8594 so, the first branch is redirected to either the destination of the
8595 second branch or a point immediately following it, depending on whether
8596 the condition is known to be true or false.
8598 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8600 @item -fsplit-wide-types
8601 @opindex fsplit-wide-types
8602 When using a type that occupies multiple registers, such as @code{long
8603 long} on a 32-bit system, split the registers apart and allocate them
8604 independently. This normally generates better code for those types,
8605 but may make debugging more difficult.
8607 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8610 @item -fcse-follow-jumps
8611 @opindex fcse-follow-jumps
8612 In common subexpression elimination (CSE), scan through jump instructions
8613 when the target of the jump is not reached by any other path. For
8614 example, when CSE encounters an @code{if} statement with an
8615 @code{else} clause, CSE follows the jump when the condition
8618 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8620 @item -fcse-skip-blocks
8621 @opindex fcse-skip-blocks
8622 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8623 follow jumps that conditionally skip over blocks. When CSE
8624 encounters a simple @code{if} statement with no else clause,
8625 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8626 body of the @code{if}.
8628 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8630 @item -frerun-cse-after-loop
8631 @opindex frerun-cse-after-loop
8632 Re-run common subexpression elimination after loop optimizations are
8635 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8639 Perform a global common subexpression elimination pass.
8640 This pass also performs global constant and copy propagation.
8642 @emph{Note:} When compiling a program using computed gotos, a GCC
8643 extension, you may get better run-time performance if you disable
8644 the global common subexpression elimination pass by adding
8645 @option{-fno-gcse} to the command line.
8647 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8651 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8652 attempts to move loads that are only killed by stores into themselves. This
8653 allows a loop containing a load/store sequence to be changed to a load outside
8654 the loop, and a copy/store within the loop.
8656 Enabled by default when @option{-fgcse} is enabled.
8660 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8661 global common subexpression elimination. This pass attempts to move
8662 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8663 loops containing a load/store sequence can be changed to a load before
8664 the loop and a store after the loop.
8666 Not enabled at any optimization level.
8670 When @option{-fgcse-las} is enabled, the global common subexpression
8671 elimination pass eliminates redundant loads that come after stores to the
8672 same memory location (both partial and full redundancies).
8674 Not enabled at any optimization level.
8676 @item -fgcse-after-reload
8677 @opindex fgcse-after-reload
8678 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8679 pass is performed after reload. The purpose of this pass is to clean up
8682 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
8684 @item -faggressive-loop-optimizations
8685 @opindex faggressive-loop-optimizations
8686 This option tells the loop optimizer to use language constraints to
8687 derive bounds for the number of iterations of a loop. This assumes that
8688 loop code does not invoke undefined behavior by for example causing signed
8689 integer overflows or out-of-bound array accesses. The bounds for the
8690 number of iterations of a loop are used to guide loop unrolling and peeling
8691 and loop exit test optimizations.
8692 This option is enabled by default.
8694 @item -funconstrained-commons
8695 @opindex funconstrained-commons
8696 This option tells the compiler that variables declared in common blocks
8697 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8698 prevents certain optimizations that depend on knowing the array bounds.
8700 @item -fcrossjumping
8701 @opindex fcrossjumping
8702 Perform cross-jumping transformation.
8703 This transformation unifies equivalent code and saves code size. The
8704 resulting code may or may not perform better than without cross-jumping.
8706 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8708 @item -fauto-inc-dec
8709 @opindex fauto-inc-dec
8710 Combine increments or decrements of addresses with memory accesses.
8711 This pass is always skipped on architectures that do not have
8712 instructions to support this. Enabled by default at @option{-O} and
8713 higher on architectures that support this.
8717 Perform dead code elimination (DCE) on RTL@.
8718 Enabled by default at @option{-O} and higher.
8722 Perform dead store elimination (DSE) on RTL@.
8723 Enabled by default at @option{-O} and higher.
8725 @item -fif-conversion
8726 @opindex fif-conversion
8727 Attempt to transform conditional jumps into branch-less equivalents. This
8728 includes use of conditional moves, min, max, set flags and abs instructions, and
8729 some tricks doable by standard arithmetics. The use of conditional execution
8730 on chips where it is available is controlled by @option{-fif-conversion2}.
8732 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8733 not with @option{-Og}.
8735 @item -fif-conversion2
8736 @opindex fif-conversion2
8737 Use conditional execution (where available) to transform conditional jumps into
8738 branch-less equivalents.
8740 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8741 not with @option{-Og}.
8743 @item -fdeclone-ctor-dtor
8744 @opindex fdeclone-ctor-dtor
8745 The C++ ABI requires multiple entry points for constructors and
8746 destructors: one for a base subobject, one for a complete object, and
8747 one for a virtual destructor that calls operator delete afterwards.
8748 For a hierarchy with virtual bases, the base and complete variants are
8749 clones, which means two copies of the function. With this option, the
8750 base and complete variants are changed to be thunks that call a common
8753 Enabled by @option{-Os}.
8755 @item -fdelete-null-pointer-checks
8756 @opindex fdelete-null-pointer-checks
8757 Assume that programs cannot safely dereference null pointers, and that
8758 no code or data element resides at address zero.
8759 This option enables simple constant
8760 folding optimizations at all optimization levels. In addition, other
8761 optimization passes in GCC use this flag to control global dataflow
8762 analyses that eliminate useless checks for null pointers; these assume
8763 that a memory access to address zero always results in a trap, so
8764 that if a pointer is checked after it has already been dereferenced,
8767 Note however that in some environments this assumption is not true.
8768 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8769 for programs that depend on that behavior.
8771 This option is enabled by default on most targets. On Nios II ELF, it
8772 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8774 Passes that use the dataflow information
8775 are enabled independently at different optimization levels.
8777 @item -fdevirtualize
8778 @opindex fdevirtualize
8779 Attempt to convert calls to virtual functions to direct calls. This
8780 is done both within a procedure and interprocedurally as part of
8781 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8782 propagation (@option{-fipa-cp}).
8783 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8785 @item -fdevirtualize-speculatively
8786 @opindex fdevirtualize-speculatively
8787 Attempt to convert calls to virtual functions to speculative direct calls.
8788 Based on the analysis of the type inheritance graph, determine for a given call
8789 the set of likely targets. If the set is small, preferably of size 1, change
8790 the call into a conditional deciding between direct and indirect calls. The
8791 speculative calls enable more optimizations, such as inlining. When they seem
8792 useless after further optimization, they are converted back into original form.
8794 @item -fdevirtualize-at-ltrans
8795 @opindex fdevirtualize-at-ltrans
8796 Stream extra information needed for aggressive devirtualization when running
8797 the link-time optimizer in local transformation mode.
8798 This option enables more devirtualization but
8799 significantly increases the size of streamed data. For this reason it is
8800 disabled by default.
8802 @item -fexpensive-optimizations
8803 @opindex fexpensive-optimizations
8804 Perform a number of minor optimizations that are relatively expensive.
8806 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8810 Attempt to remove redundant extension instructions. This is especially
8811 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8812 registers after writing to their lower 32-bit half.
8814 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8815 @option{-O3}, @option{-Os}.
8817 @item -fno-lifetime-dse
8818 @opindex fno-lifetime-dse
8819 @opindex flifetime-dse
8820 In C++ the value of an object is only affected by changes within its
8821 lifetime: when the constructor begins, the object has an indeterminate
8822 value, and any changes during the lifetime of the object are dead when
8823 the object is destroyed. Normally dead store elimination will take
8824 advantage of this; if your code relies on the value of the object
8825 storage persisting beyond the lifetime of the object, you can use this
8826 flag to disable this optimization. To preserve stores before the
8827 constructor starts (e.g.@: because your operator new clears the object
8828 storage) but still treat the object as dead after the destructor you,
8829 can use @option{-flifetime-dse=1}. The default behavior can be
8830 explicitly selected with @option{-flifetime-dse=2}.
8831 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8833 @item -flive-range-shrinkage
8834 @opindex flive-range-shrinkage
8835 Attempt to decrease register pressure through register live range
8836 shrinkage. This is helpful for fast processors with small or moderate
8839 @item -fira-algorithm=@var{algorithm}
8840 @opindex fira-algorithm
8841 Use the specified coloring algorithm for the integrated register
8842 allocator. The @var{algorithm} argument can be @samp{priority}, which
8843 specifies Chow's priority coloring, or @samp{CB}, which specifies
8844 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8845 for all architectures, but for those targets that do support it, it is
8846 the default because it generates better code.
8848 @item -fira-region=@var{region}
8849 @opindex fira-region
8850 Use specified regions for the integrated register allocator. The
8851 @var{region} argument should be one of the following:
8856 Use all loops as register allocation regions.
8857 This can give the best results for machines with a small and/or
8858 irregular register set.
8861 Use all loops except for loops with small register pressure
8862 as the regions. This value usually gives
8863 the best results in most cases and for most architectures,
8864 and is enabled by default when compiling with optimization for speed
8865 (@option{-O}, @option{-O2}, @dots{}).
8868 Use all functions as a single region.
8869 This typically results in the smallest code size, and is enabled by default for
8870 @option{-Os} or @option{-O0}.
8874 @item -fira-hoist-pressure
8875 @opindex fira-hoist-pressure
8876 Use IRA to evaluate register pressure in the code hoisting pass for
8877 decisions to hoist expressions. This option usually results in smaller
8878 code, but it can slow the compiler down.
8880 This option is enabled at level @option{-Os} for all targets.
8882 @item -fira-loop-pressure
8883 @opindex fira-loop-pressure
8884 Use IRA to evaluate register pressure in loops for decisions to move
8885 loop invariants. This option usually results in generation
8886 of faster and smaller code on machines with large register files (>= 32
8887 registers), but it can slow the compiler down.
8889 This option is enabled at level @option{-O3} for some targets.
8891 @item -fno-ira-share-save-slots
8892 @opindex fno-ira-share-save-slots
8893 @opindex fira-share-save-slots
8894 Disable sharing of stack slots used for saving call-used hard
8895 registers living through a call. Each hard register gets a
8896 separate stack slot, and as a result function stack frames are
8899 @item -fno-ira-share-spill-slots
8900 @opindex fno-ira-share-spill-slots
8901 @opindex fira-share-spill-slots
8902 Disable sharing of stack slots allocated for pseudo-registers. Each
8903 pseudo-register that does not get a hard register gets a separate
8904 stack slot, and as a result function stack frames are larger.
8908 Enable CFG-sensitive rematerialization in LRA. Instead of loading
8909 values of spilled pseudos, LRA tries to rematerialize (recalculate)
8910 values if it is profitable.
8912 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8914 @item -fdelayed-branch
8915 @opindex fdelayed-branch
8916 If supported for the target machine, attempt to reorder instructions
8917 to exploit instruction slots available after delayed branch
8920 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
8921 but not at @option{-Og}.
8923 @item -fschedule-insns
8924 @opindex fschedule-insns
8925 If supported for the target machine, attempt to reorder instructions to
8926 eliminate execution stalls due to required data being unavailable. This
8927 helps machines that have slow floating point or memory load instructions
8928 by allowing other instructions to be issued until the result of the load
8929 or floating-point instruction is required.
8931 Enabled at levels @option{-O2}, @option{-O3}.
8933 @item -fschedule-insns2
8934 @opindex fschedule-insns2
8935 Similar to @option{-fschedule-insns}, but requests an additional pass of
8936 instruction scheduling after register allocation has been done. This is
8937 especially useful on machines with a relatively small number of
8938 registers and where memory load instructions take more than one cycle.
8940 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8942 @item -fno-sched-interblock
8943 @opindex fno-sched-interblock
8944 @opindex fsched-interblock
8945 Disable instruction scheduling across basic blocks, which
8946 is normally enabled when scheduling before register allocation, i.e.@:
8947 with @option{-fschedule-insns} or at @option{-O2} or higher.
8949 @item -fno-sched-spec
8950 @opindex fno-sched-spec
8951 @opindex fsched-spec
8952 Disable speculative motion of non-load instructions, which
8953 is normally enabled when scheduling before register allocation, i.e.@:
8954 with @option{-fschedule-insns} or at @option{-O2} or higher.
8956 @item -fsched-pressure
8957 @opindex fsched-pressure
8958 Enable register pressure sensitive insn scheduling before register
8959 allocation. This only makes sense when scheduling before register
8960 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
8961 @option{-O2} or higher. Usage of this option can improve the
8962 generated code and decrease its size by preventing register pressure
8963 increase above the number of available hard registers and subsequent
8964 spills in register allocation.
8966 @item -fsched-spec-load
8967 @opindex fsched-spec-load
8968 Allow speculative motion of some load instructions. This only makes
8969 sense when scheduling before register allocation, i.e.@: with
8970 @option{-fschedule-insns} or at @option{-O2} or higher.
8972 @item -fsched-spec-load-dangerous
8973 @opindex fsched-spec-load-dangerous
8974 Allow speculative motion of more load instructions. This only makes
8975 sense when scheduling before register allocation, i.e.@: with
8976 @option{-fschedule-insns} or at @option{-O2} or higher.
8978 @item -fsched-stalled-insns
8979 @itemx -fsched-stalled-insns=@var{n}
8980 @opindex fsched-stalled-insns
8981 Define how many insns (if any) can be moved prematurely from the queue
8982 of stalled insns into the ready list during the second scheduling pass.
8983 @option{-fno-sched-stalled-insns} means that no insns are moved
8984 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
8985 on how many queued insns can be moved prematurely.
8986 @option{-fsched-stalled-insns} without a value is equivalent to
8987 @option{-fsched-stalled-insns=1}.
8989 @item -fsched-stalled-insns-dep
8990 @itemx -fsched-stalled-insns-dep=@var{n}
8991 @opindex fsched-stalled-insns-dep
8992 Define how many insn groups (cycles) are examined for a dependency
8993 on a stalled insn that is a candidate for premature removal from the queue
8994 of stalled insns. This has an effect only during the second scheduling pass,
8995 and only if @option{-fsched-stalled-insns} is used.
8996 @option{-fno-sched-stalled-insns-dep} is equivalent to
8997 @option{-fsched-stalled-insns-dep=0}.
8998 @option{-fsched-stalled-insns-dep} without a value is equivalent to
8999 @option{-fsched-stalled-insns-dep=1}.
9001 @item -fsched2-use-superblocks
9002 @opindex fsched2-use-superblocks
9003 When scheduling after register allocation, use superblock scheduling.
9004 This allows motion across basic block boundaries,
9005 resulting in faster schedules. This option is experimental, as not all machine
9006 descriptions used by GCC model the CPU closely enough to avoid unreliable
9007 results from the algorithm.
9009 This only makes sense when scheduling after register allocation, i.e.@: with
9010 @option{-fschedule-insns2} or at @option{-O2} or higher.
9012 @item -fsched-group-heuristic
9013 @opindex fsched-group-heuristic
9014 Enable the group heuristic in the scheduler. This heuristic favors
9015 the instruction that belongs to a schedule group. This is enabled
9016 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9017 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9019 @item -fsched-critical-path-heuristic
9020 @opindex fsched-critical-path-heuristic
9021 Enable the critical-path heuristic in the scheduler. This heuristic favors
9022 instructions on the critical path. This is enabled by default when
9023 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9024 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9026 @item -fsched-spec-insn-heuristic
9027 @opindex fsched-spec-insn-heuristic
9028 Enable the speculative instruction heuristic in the scheduler. This
9029 heuristic favors speculative instructions with greater dependency weakness.
9030 This is enabled by default when scheduling is enabled, i.e.@:
9031 with @option{-fschedule-insns} or @option{-fschedule-insns2}
9032 or at @option{-O2} or higher.
9034 @item -fsched-rank-heuristic
9035 @opindex fsched-rank-heuristic
9036 Enable the rank heuristic in the scheduler. This heuristic favors
9037 the instruction belonging to a basic block with greater size or frequency.
9038 This is enabled by default when scheduling is enabled, i.e.@:
9039 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9040 at @option{-O2} or higher.
9042 @item -fsched-last-insn-heuristic
9043 @opindex fsched-last-insn-heuristic
9044 Enable the last-instruction heuristic in the scheduler. This heuristic
9045 favors the instruction that is less dependent on the last instruction
9046 scheduled. This is enabled by default when scheduling is enabled,
9047 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9048 at @option{-O2} or higher.
9050 @item -fsched-dep-count-heuristic
9051 @opindex fsched-dep-count-heuristic
9052 Enable the dependent-count heuristic in the scheduler. This heuristic
9053 favors the instruction that has more instructions depending on it.
9054 This is enabled by default when scheduling is enabled, i.e.@:
9055 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9056 at @option{-O2} or higher.
9058 @item -freschedule-modulo-scheduled-loops
9059 @opindex freschedule-modulo-scheduled-loops
9060 Modulo scheduling is performed before traditional scheduling. If a loop
9061 is modulo scheduled, later scheduling passes may change its schedule.
9062 Use this option to control that behavior.
9064 @item -fselective-scheduling
9065 @opindex fselective-scheduling
9066 Schedule instructions using selective scheduling algorithm. Selective
9067 scheduling runs instead of the first scheduler pass.
9069 @item -fselective-scheduling2
9070 @opindex fselective-scheduling2
9071 Schedule instructions using selective scheduling algorithm. Selective
9072 scheduling runs instead of the second scheduler pass.
9074 @item -fsel-sched-pipelining
9075 @opindex fsel-sched-pipelining
9076 Enable software pipelining of innermost loops during selective scheduling.
9077 This option has no effect unless one of @option{-fselective-scheduling} or
9078 @option{-fselective-scheduling2} is turned on.
9080 @item -fsel-sched-pipelining-outer-loops
9081 @opindex fsel-sched-pipelining-outer-loops
9082 When pipelining loops during selective scheduling, also pipeline outer loops.
9083 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
9085 @item -fsemantic-interposition
9086 @opindex fsemantic-interposition
9087 Some object formats, like ELF, allow interposing of symbols by the
9089 This means that for symbols exported from the DSO, the compiler cannot perform
9090 interprocedural propagation, inlining and other optimizations in anticipation
9091 that the function or variable in question may change. While this feature is
9092 useful, for example, to rewrite memory allocation functions by a debugging
9093 implementation, it is expensive in the terms of code quality.
9094 With @option{-fno-semantic-interposition} the compiler assumes that
9095 if interposition happens for functions the overwriting function will have
9096 precisely the same semantics (and side effects).
9097 Similarly if interposition happens
9098 for variables, the constructor of the variable will be the same. The flag
9099 has no effect for functions explicitly declared inline
9100 (where it is never allowed for interposition to change semantics)
9101 and for symbols explicitly declared weak.
9104 @opindex fshrink-wrap
9105 Emit function prologues only before parts of the function that need it,
9106 rather than at the top of the function. This flag is enabled by default at
9107 @option{-O} and higher.
9109 @item -fshrink-wrap-separate
9110 @opindex fshrink-wrap-separate
9111 Shrink-wrap separate parts of the prologue and epilogue separately, so that
9112 those parts are only executed when needed.
9113 This option is on by default, but has no effect unless @option{-fshrink-wrap}
9114 is also turned on and the target supports this.
9116 @item -fcaller-saves
9117 @opindex fcaller-saves
9118 Enable allocation of values to registers that are clobbered by
9119 function calls, by emitting extra instructions to save and restore the
9120 registers around such calls. Such allocation is done only when it
9121 seems to result in better code.
9123 This option is always enabled by default on certain machines, usually
9124 those which have no call-preserved registers to use instead.
9126 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9128 @item -fcombine-stack-adjustments
9129 @opindex fcombine-stack-adjustments
9130 Tracks stack adjustments (pushes and pops) and stack memory references
9131 and then tries to find ways to combine them.
9133 Enabled by default at @option{-O1} and higher.
9137 Use caller save registers for allocation if those registers are not used by
9138 any called function. In that case it is not necessary to save and restore
9139 them around calls. This is only possible if called functions are part of
9140 same compilation unit as current function and they are compiled before it.
9142 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
9143 is disabled if generated code will be instrumented for profiling
9144 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
9145 exactly (this happens on targets that do not expose prologues
9146 and epilogues in RTL).
9148 @item -fconserve-stack
9149 @opindex fconserve-stack
9150 Attempt to minimize stack usage. The compiler attempts to use less
9151 stack space, even if that makes the program slower. This option
9152 implies setting the @option{large-stack-frame} parameter to 100
9153 and the @option{large-stack-frame-growth} parameter to 400.
9155 @item -ftree-reassoc
9156 @opindex ftree-reassoc
9157 Perform reassociation on trees. This flag is enabled by default
9158 at @option{-O} and higher.
9160 @item -fcode-hoisting
9161 @opindex fcode-hoisting
9162 Perform code hoisting. Code hoisting tries to move the
9163 evaluation of expressions executed on all paths to the function exit
9164 as early as possible. This is especially useful as a code size
9165 optimization, but it often helps for code speed as well.
9166 This flag is enabled by default at @option{-O2} and higher.
9170 Perform partial redundancy elimination (PRE) on trees. This flag is
9171 enabled by default at @option{-O2} and @option{-O3}.
9173 @item -ftree-partial-pre
9174 @opindex ftree-partial-pre
9175 Make partial redundancy elimination (PRE) more aggressive. This flag is
9176 enabled by default at @option{-O3}.
9178 @item -ftree-forwprop
9179 @opindex ftree-forwprop
9180 Perform forward propagation on trees. This flag is enabled by default
9181 at @option{-O} and higher.
9185 Perform full redundancy elimination (FRE) on trees. The difference
9186 between FRE and PRE is that FRE only considers expressions
9187 that are computed on all paths leading to the redundant computation.
9188 This analysis is faster than PRE, though it exposes fewer redundancies.
9189 This flag is enabled by default at @option{-O} and higher.
9191 @item -ftree-phiprop
9192 @opindex ftree-phiprop
9193 Perform hoisting of loads from conditional pointers on trees. This
9194 pass is enabled by default at @option{-O} and higher.
9196 @item -fhoist-adjacent-loads
9197 @opindex fhoist-adjacent-loads
9198 Speculatively hoist loads from both branches of an if-then-else if the
9199 loads are from adjacent locations in the same structure and the target
9200 architecture has a conditional move instruction. This flag is enabled
9201 by default at @option{-O2} and higher.
9203 @item -ftree-copy-prop
9204 @opindex ftree-copy-prop
9205 Perform copy propagation on trees. This pass eliminates unnecessary
9206 copy operations. This flag is enabled by default at @option{-O} and
9209 @item -fipa-pure-const
9210 @opindex fipa-pure-const
9211 Discover which functions are pure or constant.
9212 Enabled by default at @option{-O} and higher.
9214 @item -fipa-reference
9215 @opindex fipa-reference
9216 Discover which static variables do not escape the
9218 Enabled by default at @option{-O} and higher.
9220 @item -fipa-reference-addressable
9221 @opindex fipa-reference-addressable
9222 Discover read-only, write-only and non-addressable static variables.
9223 Enabled by default at @option{-O} and higher.
9225 @item -fipa-stack-alignment
9226 @opindex fipa-stack-alignment
9227 Reduce stack alignment on call sites if possible.
9232 Perform interprocedural pointer analysis and interprocedural modification
9233 and reference analysis. This option can cause excessive memory and
9234 compile-time usage on large compilation units. It is not enabled by
9235 default at any optimization level.
9238 @opindex fipa-profile
9239 Perform interprocedural profile propagation. The functions called only from
9240 cold functions are marked as cold. Also functions executed once (such as
9241 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
9242 functions and loop less parts of functions executed once are then optimized for
9244 Enabled by default at @option{-O} and higher.
9248 Perform interprocedural constant propagation.
9249 This optimization analyzes the program to determine when values passed
9250 to functions are constants and then optimizes accordingly.
9251 This optimization can substantially increase performance
9252 if the application has constants passed to functions.
9253 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
9254 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9256 @item -fipa-cp-clone
9257 @opindex fipa-cp-clone
9258 Perform function cloning to make interprocedural constant propagation stronger.
9259 When enabled, interprocedural constant propagation performs function cloning
9260 when externally visible function can be called with constant arguments.
9261 Because this optimization can create multiple copies of functions,
9262 it may significantly increase code size
9263 (see @option{--param ipcp-unit-growth=@var{value}}).
9264 This flag is enabled by default at @option{-O3}.
9265 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9268 @opindex fipa-bit-cp
9269 When enabled, perform interprocedural bitwise constant
9270 propagation. This flag is enabled by default at @option{-O2} and
9271 by @option{-fprofile-use} and @option{-fauto-profile}.
9272 It requires that @option{-fipa-cp} is enabled.
9276 When enabled, perform interprocedural propagation of value
9277 ranges. This flag is enabled by default at @option{-O2}. It requires
9278 that @option{-fipa-cp} is enabled.
9282 Perform Identical Code Folding for functions and read-only variables.
9283 The optimization reduces code size and may disturb unwind stacks by replacing
9284 a function by equivalent one with a different name. The optimization works
9285 more effectively with link-time optimization enabled.
9287 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
9288 works on different levels and thus the optimizations are not same - there are
9289 equivalences that are found only by GCC and equivalences found only by Gold.
9291 This flag is enabled by default at @option{-O2} and @option{-Os}.
9293 @item -fisolate-erroneous-paths-dereference
9294 @opindex fisolate-erroneous-paths-dereference
9295 Detect paths that trigger erroneous or undefined behavior due to
9296 dereferencing a null pointer. Isolate those paths from the main control
9297 flow and turn the statement with erroneous or undefined behavior into a trap.
9298 This flag is enabled by default at @option{-O2} and higher and depends on
9299 @option{-fdelete-null-pointer-checks} also being enabled.
9301 @item -fisolate-erroneous-paths-attribute
9302 @opindex fisolate-erroneous-paths-attribute
9303 Detect paths that trigger erroneous or undefined behavior due to a null value
9304 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
9305 attribute. Isolate those paths from the main control flow and turn the
9306 statement with erroneous or undefined behavior into a trap. This is not
9307 currently enabled, but may be enabled by @option{-O2} in the future.
9311 Perform forward store motion on trees. This flag is
9312 enabled by default at @option{-O} and higher.
9314 @item -ftree-bit-ccp
9315 @opindex ftree-bit-ccp
9316 Perform sparse conditional bit constant propagation on trees and propagate
9317 pointer alignment information.
9318 This pass only operates on local scalar variables and is enabled by default
9319 at @option{-O1} and higher, except for @option{-Og}.
9320 It requires that @option{-ftree-ccp} is enabled.
9324 Perform sparse conditional constant propagation (CCP) on trees. This
9325 pass only operates on local scalar variables and is enabled by default
9326 at @option{-O} and higher.
9328 @item -fssa-backprop
9329 @opindex fssa-backprop
9330 Propagate information about uses of a value up the definition chain
9331 in order to simplify the definitions. For example, this pass strips
9332 sign operations if the sign of a value never matters. The flag is
9333 enabled by default at @option{-O} and higher.
9336 @opindex fssa-phiopt
9337 Perform pattern matching on SSA PHI nodes to optimize conditional
9338 code. This pass is enabled by default at @option{-O1} and higher,
9339 except for @option{-Og}.
9341 @item -ftree-switch-conversion
9342 @opindex ftree-switch-conversion
9343 Perform conversion of simple initializations in a switch to
9344 initializations from a scalar array. This flag is enabled by default
9345 at @option{-O2} and higher.
9347 @item -ftree-tail-merge
9348 @opindex ftree-tail-merge
9349 Look for identical code sequences. When found, replace one with a jump to the
9350 other. This optimization is known as tail merging or cross jumping. This flag
9351 is enabled by default at @option{-O2} and higher. The compilation time
9353 be limited using @option{max-tail-merge-comparisons} parameter and
9354 @option{max-tail-merge-iterations} parameter.
9358 Perform dead code elimination (DCE) on trees. This flag is enabled by
9359 default at @option{-O} and higher.
9361 @item -ftree-builtin-call-dce
9362 @opindex ftree-builtin-call-dce
9363 Perform conditional dead code elimination (DCE) for calls to built-in functions
9364 that may set @code{errno} but are otherwise free of side effects. This flag is
9365 enabled by default at @option{-O2} and higher if @option{-Os} is not also
9368 @item -ftree-dominator-opts
9369 @opindex ftree-dominator-opts
9370 Perform a variety of simple scalar cleanups (constant/copy
9371 propagation, redundancy elimination, range propagation and expression
9372 simplification) based on a dominator tree traversal. This also
9373 performs jump threading (to reduce jumps to jumps). This flag is
9374 enabled by default at @option{-O} and higher.
9378 Perform dead store elimination (DSE) on trees. A dead store is a store into
9379 a memory location that is later overwritten by another store without
9380 any intervening loads. In this case the earlier store can be deleted. This
9381 flag is enabled by default at @option{-O} and higher.
9385 Perform loop header copying on trees. This is beneficial since it increases
9386 effectiveness of code motion optimizations. It also saves one jump. This flag
9387 is enabled by default at @option{-O} and higher. It is not enabled
9388 for @option{-Os}, since it usually increases code size.
9390 @item -ftree-loop-optimize
9391 @opindex ftree-loop-optimize
9392 Perform loop optimizations on trees. This flag is enabled by default
9393 at @option{-O} and higher.
9395 @item -ftree-loop-linear
9396 @itemx -floop-strip-mine
9398 @opindex ftree-loop-linear
9399 @opindex floop-strip-mine
9400 @opindex floop-block
9401 Perform loop nest optimizations. Same as
9402 @option{-floop-nest-optimize}. To use this code transformation, GCC has
9403 to be configured with @option{--with-isl} to enable the Graphite loop
9404 transformation infrastructure.
9406 @item -fgraphite-identity
9407 @opindex fgraphite-identity
9408 Enable the identity transformation for graphite. For every SCoP we generate
9409 the polyhedral representation and transform it back to gimple. Using
9410 @option{-fgraphite-identity} we can check the costs or benefits of the
9411 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
9412 are also performed by the code generator isl, like index splitting and
9413 dead code elimination in loops.
9415 @item -floop-nest-optimize
9416 @opindex floop-nest-optimize
9417 Enable the isl based loop nest optimizer. This is a generic loop nest
9418 optimizer based on the Pluto optimization algorithms. It calculates a loop
9419 structure optimized for data-locality and parallelism. This option
9422 @item -floop-parallelize-all
9423 @opindex floop-parallelize-all
9424 Use the Graphite data dependence analysis to identify loops that can
9425 be parallelized. Parallelize all the loops that can be analyzed to
9426 not contain loop carried dependences without checking that it is
9427 profitable to parallelize the loops.
9429 @item -ftree-coalesce-vars
9430 @opindex ftree-coalesce-vars
9431 While transforming the program out of the SSA representation, attempt to
9432 reduce copying by coalescing versions of different user-defined
9433 variables, instead of just compiler temporaries. This may severely
9434 limit the ability to debug an optimized program compiled with
9435 @option{-fno-var-tracking-assignments}. In the negated form, this flag
9436 prevents SSA coalescing of user variables. This option is enabled by
9437 default if optimization is enabled, and it does very little otherwise.
9439 @item -ftree-loop-if-convert
9440 @opindex ftree-loop-if-convert
9441 Attempt to transform conditional jumps in the innermost loops to
9442 branch-less equivalents. The intent is to remove control-flow from
9443 the innermost loops in order to improve the ability of the
9444 vectorization pass to handle these loops. This is enabled by default
9445 if vectorization is enabled.
9447 @item -ftree-loop-distribution
9448 @opindex ftree-loop-distribution
9449 Perform loop distribution. This flag can improve cache performance on
9450 big loop bodies and allow further loop optimizations, like
9451 parallelization or vectorization, to take place. For example, the loop
9468 @item -ftree-loop-distribute-patterns
9469 @opindex ftree-loop-distribute-patterns
9470 Perform loop distribution of patterns that can be code generated with
9471 calls to a library. This flag is enabled by default at @option{-O3}, and
9472 by @option{-fprofile-use} and @option{-fauto-profile}.
9474 This pass distributes the initialization loops and generates a call to
9475 memset zero. For example, the loop
9491 and the initialization loop is transformed into a call to memset zero.
9493 @item -floop-interchange
9494 @opindex floop-interchange
9495 Perform loop interchange outside of graphite. This flag can improve cache
9496 performance on loop nest and allow further loop optimizations, like
9497 vectorization, to take place. For example, the loop
9499 for (int i = 0; i < N; i++)
9500 for (int j = 0; j < N; j++)
9501 for (int k = 0; k < N; k++)
9502 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9506 for (int i = 0; i < N; i++)
9507 for (int k = 0; k < N; k++)
9508 for (int j = 0; j < N; j++)
9509 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9511 This flag is enabled by default at @option{-O3}.
9513 @item -floop-unroll-and-jam
9514 @opindex floop-unroll-and-jam
9515 Apply unroll and jam transformations on feasible loops. In a loop
9516 nest this unrolls the outer loop by some factor and fuses the resulting
9517 multiple inner loops. This flag is enabled by default at @option{-O3}.
9519 @item -ftree-loop-im
9520 @opindex ftree-loop-im
9521 Perform loop invariant motion on trees. This pass moves only invariants that
9522 are hard to handle at RTL level (function calls, operations that expand to
9523 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9524 operands of conditions that are invariant out of the loop, so that we can use
9525 just trivial invariantness analysis in loop unswitching. The pass also includes
9528 @item -ftree-loop-ivcanon
9529 @opindex ftree-loop-ivcanon
9530 Create a canonical counter for number of iterations in loops for which
9531 determining number of iterations requires complicated analysis. Later
9532 optimizations then may determine the number easily. Useful especially
9533 in connection with unrolling.
9535 @item -ftree-scev-cprop
9536 @opindex ftree-scev-cprop
9537 Perform final value replacement. If a variable is modified in a loop
9538 in such a way that its value when exiting the loop can be determined using
9539 only its initial value and the number of loop iterations, replace uses of
9540 the final value by such a computation, provided it is sufficiently cheap.
9541 This reduces data dependencies and may allow further simplifications.
9542 Enabled by default at @option{-O} and higher.
9546 Perform induction variable optimizations (strength reduction, induction
9547 variable merging and induction variable elimination) on trees.
9549 @item -ftree-parallelize-loops=n
9550 @opindex ftree-parallelize-loops
9551 Parallelize loops, i.e., split their iteration space to run in n threads.
9552 This is only possible for loops whose iterations are independent
9553 and can be arbitrarily reordered. The optimization is only
9554 profitable on multiprocessor machines, for loops that are CPU-intensive,
9555 rather than constrained e.g.@: by memory bandwidth. This option
9556 implies @option{-pthread}, and thus is only supported on targets
9557 that have support for @option{-pthread}.
9561 Perform function-local points-to analysis on trees. This flag is
9562 enabled by default at @option{-O1} and higher, except for @option{-Og}.
9566 Perform scalar replacement of aggregates. This pass replaces structure
9567 references with scalars to prevent committing structures to memory too
9568 early. This flag is enabled by default at @option{-O1} and higher,
9569 except for @option{-Og}.
9571 @item -fstore-merging
9572 @opindex fstore-merging
9573 Perform merging of narrow stores to consecutive memory addresses. This pass
9574 merges contiguous stores of immediate values narrower than a word into fewer
9575 wider stores to reduce the number of instructions. This is enabled by default
9576 at @option{-O2} and higher as well as @option{-Os}.
9580 Perform temporary expression replacement during the SSA->normal phase. Single
9581 use/single def temporaries are replaced at their use location with their
9582 defining expression. This results in non-GIMPLE code, but gives the expanders
9583 much more complex trees to work on resulting in better RTL generation. This is
9584 enabled by default at @option{-O} and higher.
9588 Perform straight-line strength reduction on trees. This recognizes related
9589 expressions involving multiplications and replaces them by less expensive
9590 calculations when possible. This is enabled by default at @option{-O} and
9593 @item -ftree-vectorize
9594 @opindex ftree-vectorize
9595 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9596 and @option{-ftree-slp-vectorize} if not explicitly specified.
9598 @item -ftree-loop-vectorize
9599 @opindex ftree-loop-vectorize
9600 Perform loop vectorization on trees. This flag is enabled by default at
9601 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9602 and @option{-fauto-profile}.
9604 @item -ftree-slp-vectorize
9605 @opindex ftree-slp-vectorize
9606 Perform basic block vectorization on trees. This flag is enabled by default at
9607 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9608 and @option{-fauto-profile}.
9610 @item -fvect-cost-model=@var{model}
9611 @opindex fvect-cost-model
9612 Alter the cost model used for vectorization. The @var{model} argument
9613 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9614 With the @samp{unlimited} model the vectorized code-path is assumed
9615 to be profitable while with the @samp{dynamic} model a runtime check
9616 guards the vectorized code-path to enable it only for iteration
9617 counts that will likely execute faster than when executing the original
9618 scalar loop. The @samp{cheap} model disables vectorization of
9619 loops where doing so would be cost prohibitive for example due to
9620 required runtime checks for data dependence or alignment but otherwise
9621 is equal to the @samp{dynamic} model.
9622 The default cost model depends on other optimization flags and is
9623 either @samp{dynamic} or @samp{cheap}.
9625 @item -fsimd-cost-model=@var{model}
9626 @opindex fsimd-cost-model
9627 Alter the cost model used for vectorization of loops marked with the OpenMP
9628 simd directive. The @var{model} argument should be one of
9629 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9630 have the same meaning as described in @option{-fvect-cost-model} and by
9631 default a cost model defined with @option{-fvect-cost-model} is used.
9635 Perform Value Range Propagation on trees. This is similar to the
9636 constant propagation pass, but instead of values, ranges of values are
9637 propagated. This allows the optimizers to remove unnecessary range
9638 checks like array bound checks and null pointer checks. This is
9639 enabled by default at @option{-O2} and higher. Null pointer check
9640 elimination is only done if @option{-fdelete-null-pointer-checks} is
9644 @opindex fsplit-paths
9645 Split paths leading to loop backedges. This can improve dead code
9646 elimination and common subexpression elimination. This is enabled by
9647 default at @option{-O2} and above.
9649 @item -fsplit-ivs-in-unroller
9650 @opindex fsplit-ivs-in-unroller
9651 Enables expression of values of induction variables in later iterations
9652 of the unrolled loop using the value in the first iteration. This breaks
9653 long dependency chains, thus improving efficiency of the scheduling passes.
9655 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9656 same effect. However, that is not reliable in cases where the loop body
9657 is more complicated than a single basic block. It also does not work at all
9658 on some architectures due to restrictions in the CSE pass.
9660 This optimization is enabled by default.
9662 @item -fvariable-expansion-in-unroller
9663 @opindex fvariable-expansion-in-unroller
9664 With this option, the compiler creates multiple copies of some
9665 local variables when unrolling a loop, which can result in superior code.
9667 @item -fpartial-inlining
9668 @opindex fpartial-inlining
9669 Inline parts of functions. This option has any effect only
9670 when inlining itself is turned on by the @option{-finline-functions}
9671 or @option{-finline-small-functions} options.
9673 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9675 @item -fpredictive-commoning
9676 @opindex fpredictive-commoning
9677 Perform predictive commoning optimization, i.e., reusing computations
9678 (especially memory loads and stores) performed in previous
9679 iterations of loops.
9681 This option is enabled at level @option{-O3}.
9682 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9684 @item -fprefetch-loop-arrays
9685 @opindex fprefetch-loop-arrays
9686 If supported by the target machine, generate instructions to prefetch
9687 memory to improve the performance of loops that access large arrays.
9689 This option may generate better or worse code; results are highly
9690 dependent on the structure of loops within the source code.
9692 Disabled at level @option{-Os}.
9694 @item -fno-printf-return-value
9695 @opindex fno-printf-return-value
9696 @opindex fprintf-return-value
9697 Do not substitute constants for known return value of formatted output
9698 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9699 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9700 transformation allows GCC to optimize or even eliminate branches based
9701 on the known return value of these functions called with arguments that
9702 are either constant, or whose values are known to be in a range that
9703 makes determining the exact return value possible. For example, when
9704 @option{-fprintf-return-value} is in effect, both the branch and the
9705 body of the @code{if} statement (but not the call to @code{snprint})
9706 can be optimized away when @code{i} is a 32-bit or smaller integer
9707 because the return value is guaranteed to be at most 8.
9711 if (snprintf (buf, "%08x", i) >= sizeof buf)
9715 The @option{-fprintf-return-value} option relies on other optimizations
9716 and yields best results with @option{-O2} and above. It works in tandem
9717 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9718 options. The @option{-fprintf-return-value} option is enabled by default.
9721 @itemx -fno-peephole2
9722 @opindex fno-peephole
9724 @opindex fno-peephole2
9726 Disable any machine-specific peephole optimizations. The difference
9727 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9728 are implemented in the compiler; some targets use one, some use the
9729 other, a few use both.
9731 @option{-fpeephole} is enabled by default.
9732 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9734 @item -fno-guess-branch-probability
9735 @opindex fno-guess-branch-probability
9736 @opindex fguess-branch-probability
9737 Do not guess branch probabilities using heuristics.
9739 GCC uses heuristics to guess branch probabilities if they are
9740 not provided by profiling feedback (@option{-fprofile-arcs}). These
9741 heuristics are based on the control flow graph. If some branch probabilities
9742 are specified by @code{__builtin_expect}, then the heuristics are
9743 used to guess branch probabilities for the rest of the control flow graph,
9744 taking the @code{__builtin_expect} info into account. The interactions
9745 between the heuristics and @code{__builtin_expect} can be complex, and in
9746 some cases, it may be useful to disable the heuristics so that the effects
9747 of @code{__builtin_expect} are easier to understand.
9749 It is also possible to specify expected probability of the expression
9750 with @code{__builtin_expect_with_probability} built-in function.
9752 The default is @option{-fguess-branch-probability} at levels
9753 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9755 @item -freorder-blocks
9756 @opindex freorder-blocks
9757 Reorder basic blocks in the compiled function in order to reduce number of
9758 taken branches and improve code locality.
9760 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9762 @item -freorder-blocks-algorithm=@var{algorithm}
9763 @opindex freorder-blocks-algorithm
9764 Use the specified algorithm for basic block reordering. The
9765 @var{algorithm} argument can be @samp{simple}, which does not increase
9766 code size (except sometimes due to secondary effects like alignment),
9767 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9768 put all often executed code together, minimizing the number of branches
9769 executed by making extra copies of code.
9771 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9772 @samp{stc} at levels @option{-O2}, @option{-O3}.
9774 @item -freorder-blocks-and-partition
9775 @opindex freorder-blocks-and-partition
9776 In addition to reordering basic blocks in the compiled function, in order
9777 to reduce number of taken branches, partitions hot and cold basic blocks
9778 into separate sections of the assembly and @file{.o} files, to improve
9779 paging and cache locality performance.
9781 This optimization is automatically turned off in the presence of
9782 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
9783 section attribute and on any architecture that does not support named
9784 sections. When @option{-fsplit-stack} is used this option is not
9785 enabled by default (to avoid linker errors), but may be enabled
9786 explicitly (if using a working linker).
9788 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
9790 @item -freorder-functions
9791 @opindex freorder-functions
9792 Reorder functions in the object file in order to
9793 improve code locality. This is implemented by using special
9794 subsections @code{.text.hot} for most frequently executed functions and
9795 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
9796 the linker so object file format must support named sections and linker must
9797 place them in a reasonable way.
9799 Also profile feedback must be available to make this option effective. See
9800 @option{-fprofile-arcs} for details.
9802 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9804 @item -fstrict-aliasing
9805 @opindex fstrict-aliasing
9806 Allow the compiler to assume the strictest aliasing rules applicable to
9807 the language being compiled. For C (and C++), this activates
9808 optimizations based on the type of expressions. In particular, an
9809 object of one type is assumed never to reside at the same address as an
9810 object of a different type, unless the types are almost the same. For
9811 example, an @code{unsigned int} can alias an @code{int}, but not a
9812 @code{void*} or a @code{double}. A character type may alias any other
9815 @anchor{Type-punning}Pay special attention to code like this:
9828 The practice of reading from a different union member than the one most
9829 recently written to (called ``type-punning'') is common. Even with
9830 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
9831 is accessed through the union type. So, the code above works as
9832 expected. @xref{Structures unions enumerations and bit-fields
9833 implementation}. However, this code might not:
9844 Similarly, access by taking the address, casting the resulting pointer
9845 and dereferencing the result has undefined behavior, even if the cast
9846 uses a union type, e.g.:
9850 return ((union a_union *) &d)->i;
9854 The @option{-fstrict-aliasing} option is enabled at levels
9855 @option{-O2}, @option{-O3}, @option{-Os}.
9857 @item -falign-functions
9858 @itemx -falign-functions=@var{n}
9859 @itemx -falign-functions=@var{n}:@var{m}
9860 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
9861 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
9862 @opindex falign-functions
9863 Align the start of functions to the next power-of-two greater than
9864 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
9865 the first @var{m} bytes of the function can be fetched by the CPU
9866 without crossing an @var{n}-byte alignment boundary.
9868 If @var{m} is not specified, it defaults to @var{n}.
9870 Examples: @option{-falign-functions=32} aligns functions to the next
9871 32-byte boundary, @option{-falign-functions=24} aligns to the next
9872 32-byte boundary only if this can be done by skipping 23 bytes or less,
9873 @option{-falign-functions=32:7} aligns to the next
9874 32-byte boundary only if this can be done by skipping 6 bytes or less.
9876 The second pair of @var{n2}:@var{m2} values allows you to specify
9877 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
9878 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
9879 otherwise aligns to the next 32-byte boundary if this can be done
9880 by skipping 2 bytes or less.
9881 If @var{m2} is not specified, it defaults to @var{n2}.
9883 Some assemblers only support this flag when @var{n} is a power of two;
9884 in that case, it is rounded up.
9886 @option{-fno-align-functions} and @option{-falign-functions=1} are
9887 equivalent and mean that functions are not aligned.
9889 If @var{n} is not specified or is zero, use a machine-dependent default.
9890 The maximum allowed @var{n} option value is 65536.
9892 Enabled at levels @option{-O2}, @option{-O3}.
9894 @item -flimit-function-alignment
9895 If this option is enabled, the compiler tries to avoid unnecessarily
9896 overaligning functions. It attempts to instruct the assembler to align
9897 by the amount specified by @option{-falign-functions}, but not to
9898 skip more bytes than the size of the function.
9900 @item -falign-labels
9901 @itemx -falign-labels=@var{n}
9902 @itemx -falign-labels=@var{n}:@var{m}
9903 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
9904 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
9905 @opindex falign-labels
9906 Align all branch targets to a power-of-two boundary.
9908 Parameters of this option are analogous to the @option{-falign-functions} option.
9909 @option{-fno-align-labels} and @option{-falign-labels=1} are
9910 equivalent and mean that labels are not aligned.
9912 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
9913 are greater than this value, then their values are used instead.
9915 If @var{n} is not specified or is zero, use a machine-dependent default
9916 which is very likely to be @samp{1}, meaning no alignment.
9917 The maximum allowed @var{n} option value is 65536.
9919 Enabled at levels @option{-O2}, @option{-O3}.
9922 @itemx -falign-loops=@var{n}
9923 @itemx -falign-loops=@var{n}:@var{m}
9924 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
9925 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
9926 @opindex falign-loops
9927 Align loops to a power-of-two boundary. If the loops are executed
9928 many times, this makes up for any execution of the dummy padding
9931 Parameters of this option are analogous to the @option{-falign-functions} option.
9932 @option{-fno-align-loops} and @option{-falign-loops=1} are
9933 equivalent and mean that loops are not aligned.
9934 The maximum allowed @var{n} option value is 65536.
9936 If @var{n} is not specified or is zero, use a machine-dependent default.
9938 Enabled at levels @option{-O2}, @option{-O3}.
9941 @itemx -falign-jumps=@var{n}
9942 @itemx -falign-jumps=@var{n}:@var{m}
9943 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
9944 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
9945 @opindex falign-jumps
9946 Align branch targets to a power-of-two boundary, for branch targets
9947 where the targets can only be reached by jumping. In this case,
9948 no dummy operations need be executed.
9950 Parameters of this option are analogous to the @option{-falign-functions} option.
9951 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
9952 equivalent and mean that loops are not aligned.
9954 If @var{n} is not specified or is zero, use a machine-dependent default.
9955 The maximum allowed @var{n} option value is 65536.
9957 Enabled at levels @option{-O2}, @option{-O3}.
9959 @item -funit-at-a-time
9960 @opindex funit-at-a-time
9961 This option is left for compatibility reasons. @option{-funit-at-a-time}
9962 has no effect, while @option{-fno-unit-at-a-time} implies
9963 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
9967 @item -fno-toplevel-reorder
9968 @opindex fno-toplevel-reorder
9969 @opindex ftoplevel-reorder
9970 Do not reorder top-level functions, variables, and @code{asm}
9971 statements. Output them in the same order that they appear in the
9972 input file. When this option is used, unreferenced static variables
9973 are not removed. This option is intended to support existing code
9974 that relies on a particular ordering. For new code, it is better to
9975 use attributes when possible.
9977 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
9978 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
9979 Additionally @option{-fno-toplevel-reorder} implies
9980 @option{-fno-section-anchors}.
9984 Constructs webs as commonly used for register allocation purposes and assign
9985 each web individual pseudo register. This allows the register allocation pass
9986 to operate on pseudos directly, but also strengthens several other optimization
9987 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
9988 however, make debugging impossible, since variables no longer stay in a
9991 Enabled by default with @option{-funroll-loops}.
9993 @item -fwhole-program
9994 @opindex fwhole-program
9995 Assume that the current compilation unit represents the whole program being
9996 compiled. All public functions and variables with the exception of @code{main}
9997 and those merged by attribute @code{externally_visible} become static functions
9998 and in effect are optimized more aggressively by interprocedural optimizers.
10000 This option should not be used in combination with @option{-flto}.
10001 Instead relying on a linker plugin should provide safer and more precise
10004 @item -flto[=@var{n}]
10006 This option runs the standard link-time optimizer. When invoked
10007 with source code, it generates GIMPLE (one of GCC's internal
10008 representations) and writes it to special ELF sections in the object
10009 file. When the object files are linked together, all the function
10010 bodies are read from these ELF sections and instantiated as if they
10011 had been part of the same translation unit.
10013 To use the link-time optimizer, @option{-flto} and optimization
10014 options should be specified at compile time and during the final link.
10015 It is recommended that you compile all the files participating in the
10016 same link with the same options and also specify those options at
10021 gcc -c -O2 -flto foo.c
10022 gcc -c -O2 -flto bar.c
10023 gcc -o myprog -flto -O2 foo.o bar.o
10026 The first two invocations to GCC save a bytecode representation
10027 of GIMPLE into special ELF sections inside @file{foo.o} and
10028 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
10029 @file{foo.o} and @file{bar.o}, merges the two files into a single
10030 internal image, and compiles the result as usual. Since both
10031 @file{foo.o} and @file{bar.o} are merged into a single image, this
10032 causes all the interprocedural analyses and optimizations in GCC to
10033 work across the two files as if they were a single one. This means,
10034 for example, that the inliner is able to inline functions in
10035 @file{bar.o} into functions in @file{foo.o} and vice-versa.
10037 Another (simpler) way to enable link-time optimization is:
10040 gcc -o myprog -flto -O2 foo.c bar.c
10043 The above generates bytecode for @file{foo.c} and @file{bar.c},
10044 merges them together into a single GIMPLE representation and optimizes
10045 them as usual to produce @file{myprog}.
10047 The important thing to keep in mind is that to enable link-time
10048 optimizations you need to use the GCC driver to perform the link step.
10049 GCC automatically performs link-time optimization if any of the
10050 objects involved were compiled with the @option{-flto} command-line option.
10051 You can always override
10052 the automatic decision to do link-time optimization
10053 by passing @option{-fno-lto} to the link command.
10055 To make whole program optimization effective, it is necessary to make
10056 certain whole program assumptions. The compiler needs to know
10057 what functions and variables can be accessed by libraries and runtime
10058 outside of the link-time optimized unit. When supported by the linker,
10059 the linker plugin (see @option{-fuse-linker-plugin}) passes information
10060 to the compiler about used and externally visible symbols. When
10061 the linker plugin is not available, @option{-fwhole-program} should be
10062 used to allow the compiler to make these assumptions, which leads
10063 to more aggressive optimization decisions.
10065 When a file is compiled with @option{-flto} without
10066 @option{-fuse-linker-plugin}, the generated object file is larger than
10067 a regular object file because it contains GIMPLE bytecodes and the usual
10068 final code (see @option{-ffat-lto-objects}. This means that
10069 object files with LTO information can be linked as normal object
10070 files; if @option{-fno-lto} is passed to the linker, no
10071 interprocedural optimizations are applied. Note that when
10072 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
10073 but you cannot perform a regular, non-LTO link on them.
10075 When producing the final binary, GCC only
10076 applies link-time optimizations to those files that contain bytecode.
10077 Therefore, you can mix and match object files and libraries with
10078 GIMPLE bytecodes and final object code. GCC automatically selects
10079 which files to optimize in LTO mode and which files to link without
10080 further processing.
10082 Generally, options specified at link time override those
10083 specified at compile time, although in some cases GCC attempts to infer
10084 link-time options from the settings used to compile the input files.
10086 If you do not specify an optimization level option @option{-O} at
10087 link time, then GCC uses the highest optimization level
10088 used when compiling the object files. Note that it is generally
10089 ineffective to specify an optimization level option only at link time and
10090 not at compile time, for two reasons. First, compiling without
10091 optimization suppresses compiler passes that gather information
10092 needed for effective optimization at link time. Second, some early
10093 optimization passes can be performed only at compile time and
10096 There are some code generation flags preserved by GCC when
10097 generating bytecodes, as they need to be used during the final link.
10098 Currently, the following options and their settings are taken from
10099 the first object file that explicitly specifies them:
10100 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
10101 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
10102 and all the @option{-m} target flags.
10104 Certain ABI-changing flags are required to match in all compilation units,
10105 and trying to override this at link time with a conflicting value
10106 is ignored. This includes options such as @option{-freg-struct-return}
10107 and @option{-fpcc-struct-return}.
10109 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
10110 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
10111 are passed through to the link stage and merged conservatively for
10112 conflicting translation units. Specifically
10113 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
10114 precedence; and for example @option{-ffp-contract=off} takes precedence
10115 over @option{-ffp-contract=fast}. You can override them at link time.
10117 If LTO encounters objects with C linkage declared with incompatible
10118 types in separate translation units to be linked together (undefined
10119 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
10120 issued. The behavior is still undefined at run time. Similar
10121 diagnostics may be raised for other languages.
10123 Another feature of LTO is that it is possible to apply interprocedural
10124 optimizations on files written in different languages:
10128 g++ -c -flto bar.cc
10129 gfortran -c -flto baz.f90
10130 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10133 Notice that the final link is done with @command{g++} to get the C++
10134 runtime libraries and @option{-lgfortran} is added to get the Fortran
10135 runtime libraries. In general, when mixing languages in LTO mode, you
10136 should use the same link command options as when mixing languages in a
10137 regular (non-LTO) compilation.
10139 If object files containing GIMPLE bytecode are stored in a library archive, say
10140 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
10141 are using a linker with plugin support. To create static libraries suitable
10142 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
10143 and @command{ranlib};
10144 to show the symbols of object files with GIMPLE bytecode, use
10145 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
10146 and @command{nm} have been compiled with plugin support. At link time, use the
10147 flag @option{-fuse-linker-plugin} to ensure that the library participates in
10148 the LTO optimization process:
10151 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10154 With the linker plugin enabled, the linker extracts the needed
10155 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
10156 to make them part of the aggregated GIMPLE image to be optimized.
10158 If you are not using a linker with plugin support and/or do not
10159 enable the linker plugin, then the objects inside @file{libfoo.a}
10160 are extracted and linked as usual, but they do not participate
10161 in the LTO optimization process. In order to make a static library suitable
10162 for both LTO optimization and usual linkage, compile its object files with
10163 @option{-flto} @option{-ffat-lto-objects}.
10165 Link-time optimizations do not require the presence of the whole program to
10166 operate. If the program does not require any symbols to be exported, it is
10167 possible to combine @option{-flto} and @option{-fwhole-program} to allow
10168 the interprocedural optimizers to use more aggressive assumptions which may
10169 lead to improved optimization opportunities.
10170 Use of @option{-fwhole-program} is not needed when linker plugin is
10171 active (see @option{-fuse-linker-plugin}).
10173 The current implementation of LTO makes no
10174 attempt to generate bytecode that is portable between different
10175 types of hosts. The bytecode files are versioned and there is a
10176 strict version check, so bytecode files generated in one version of
10177 GCC do not work with an older or newer version of GCC.
10179 Link-time optimization does not work well with generation of debugging
10180 information on systems other than those using a combination of ELF and
10183 If you specify the optional @var{n}, the optimization and code
10184 generation done at link time is executed in parallel using @var{n}
10185 parallel jobs by utilizing an installed @command{make} program. The
10186 environment variable @env{MAKE} may be used to override the program
10187 used. The default value for @var{n} is 1.
10189 You can also specify @option{-flto=jobserver} to use GNU make's
10190 job server mode to determine the number of parallel jobs. This
10191 is useful when the Makefile calling GCC is already executing in parallel.
10192 You must prepend a @samp{+} to the command recipe in the parent Makefile
10193 for this to work. This option likely only works if @env{MAKE} is
10196 @item -flto-partition=@var{alg}
10197 @opindex flto-partition
10198 Specify the partitioning algorithm used by the link-time optimizer.
10199 The value is either @samp{1to1} to specify a partitioning mirroring
10200 the original source files or @samp{balanced} to specify partitioning
10201 into equally sized chunks (whenever possible) or @samp{max} to create
10202 new partition for every symbol where possible. Specifying @samp{none}
10203 as an algorithm disables partitioning and streaming completely.
10204 The default value is @samp{balanced}. While @samp{1to1} can be used
10205 as an workaround for various code ordering issues, the @samp{max}
10206 partitioning is intended for internal testing only.
10207 The value @samp{one} specifies that exactly one partition should be
10208 used while the value @samp{none} bypasses partitioning and executes
10209 the link-time optimization step directly from the WPA phase.
10211 @item -flto-odr-type-merging
10212 @opindex flto-odr-type-merging
10213 Enable streaming of mangled types names of C++ types and their unification
10214 at link time. This increases size of LTO object files, but enables
10215 diagnostics about One Definition Rule violations.
10217 @item -flto-compression-level=@var{n}
10218 @opindex flto-compression-level
10219 This option specifies the level of compression used for intermediate
10220 language written to LTO object files, and is only meaningful in
10221 conjunction with LTO mode (@option{-flto}). Valid
10222 values are 0 (no compression) to 9 (maximum compression). Values
10223 outside this range are clamped to either 0 or 9. If the option is not
10224 given, a default balanced compression setting is used.
10226 @item -fuse-linker-plugin
10227 @opindex fuse-linker-plugin
10228 Enables the use of a linker plugin during link-time optimization. This
10229 option relies on plugin support in the linker, which is available in gold
10230 or in GNU ld 2.21 or newer.
10232 This option enables the extraction of object files with GIMPLE bytecode out
10233 of library archives. This improves the quality of optimization by exposing
10234 more code to the link-time optimizer. This information specifies what
10235 symbols can be accessed externally (by non-LTO object or during dynamic
10236 linking). Resulting code quality improvements on binaries (and shared
10237 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
10238 See @option{-flto} for a description of the effect of this flag and how to
10241 This option is enabled by default when LTO support in GCC is enabled
10242 and GCC was configured for use with
10243 a linker supporting plugins (GNU ld 2.21 or newer or gold).
10245 @item -ffat-lto-objects
10246 @opindex ffat-lto-objects
10247 Fat LTO objects are object files that contain both the intermediate language
10248 and the object code. This makes them usable for both LTO linking and normal
10249 linking. This option is effective only when compiling with @option{-flto}
10250 and is ignored at link time.
10252 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
10253 requires the complete toolchain to be aware of LTO. It requires a linker with
10254 linker plugin support for basic functionality. Additionally,
10255 @command{nm}, @command{ar} and @command{ranlib}
10256 need to support linker plugins to allow a full-featured build environment
10257 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
10258 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
10259 to these tools. With non fat LTO makefiles need to be modified to use them.
10261 Note that modern binutils provide plugin auto-load mechanism.
10262 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
10263 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
10264 @command{gcc-ranlib}).
10266 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
10269 @item -fcompare-elim
10270 @opindex fcompare-elim
10271 After register allocation and post-register allocation instruction splitting,
10272 identify arithmetic instructions that compute processor flags similar to a
10273 comparison operation based on that arithmetic. If possible, eliminate the
10274 explicit comparison operation.
10276 This pass only applies to certain targets that cannot explicitly represent
10277 the comparison operation before register allocation is complete.
10279 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10281 @item -fcprop-registers
10282 @opindex fcprop-registers
10283 After register allocation and post-register allocation instruction splitting,
10284 perform a copy-propagation pass to try to reduce scheduling dependencies
10285 and occasionally eliminate the copy.
10287 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10289 @item -fprofile-correction
10290 @opindex fprofile-correction
10291 Profiles collected using an instrumented binary for multi-threaded programs may
10292 be inconsistent due to missed counter updates. When this option is specified,
10293 GCC uses heuristics to correct or smooth out such inconsistencies. By
10294 default, GCC emits an error message when an inconsistent profile is detected.
10296 This option is enabled by @option{-fauto-profile}.
10298 @item -fprofile-use
10299 @itemx -fprofile-use=@var{path}
10300 @opindex fprofile-use
10301 Enable profile feedback-directed optimizations,
10302 and the following optimizations, many of which
10303 are generally profitable only with profile feedback available:
10305 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10306 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10307 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10308 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10309 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10310 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10311 -fprofile-reorder-functions}
10313 Before you can use this option, you must first generate profiling information.
10314 @xref{Instrumentation Options}, for information about the
10315 @option{-fprofile-generate} option.
10317 By default, GCC emits an error message if the feedback profiles do not
10318 match the source code. This error can be turned into a warning by using
10319 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
10320 optimized code. Additionally, by default, GCC also emits a warning message if
10321 the feedback profiles do not exist (see @option{-Wmissing-profile}).
10323 If @var{path} is specified, GCC looks at the @var{path} to find
10324 the profile feedback data files. See @option{-fprofile-dir}.
10326 @item -fauto-profile
10327 @itemx -fauto-profile=@var{path}
10328 @opindex fauto-profile
10329 Enable sampling-based feedback-directed optimizations,
10330 and the following optimizations,
10331 many of which are generally profitable only with profile feedback available:
10333 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10334 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10335 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10336 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10337 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10338 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10339 -fprofile-correction}
10341 @var{path} is the name of a file containing AutoFDO profile information.
10342 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10344 Producing an AutoFDO profile data file requires running your program
10345 with the @command{perf} utility on a supported GNU/Linux target system.
10346 For more information, see @uref{https://perf.wiki.kernel.org/}.
10350 perf record -e br_inst_retired:near_taken -b -o perf.data \
10354 Then use the @command{create_gcov} tool to convert the raw profile data
10355 to a format that can be used by GCC.@ You must also supply the
10356 unstripped binary for your program to this tool.
10357 See @uref{https://github.com/google/autofdo}.
10361 create_gcov --binary=your_program.unstripped --profile=perf.data \
10362 --gcov=profile.afdo
10366 The following options control compiler behavior regarding floating-point
10367 arithmetic. These options trade off between speed and
10368 correctness. All must be specifically enabled.
10371 @item -ffloat-store
10372 @opindex ffloat-store
10373 Do not store floating-point variables in registers, and inhibit other
10374 options that might change whether a floating-point value is taken from a
10375 register or memory.
10377 @cindex floating-point precision
10378 This option prevents undesirable excess precision on machines such as
10379 the 68000 where the floating registers (of the 68881) keep more
10380 precision than a @code{double} is supposed to have. Similarly for the
10381 x86 architecture. For most programs, the excess precision does only
10382 good, but a few programs rely on the precise definition of IEEE floating
10383 point. Use @option{-ffloat-store} for such programs, after modifying
10384 them to store all pertinent intermediate computations into variables.
10386 @item -fexcess-precision=@var{style}
10387 @opindex fexcess-precision
10388 This option allows further control over excess precision on machines
10389 where floating-point operations occur in a format with more precision or
10390 range than the IEEE standard and interchange floating-point types. By
10391 default, @option{-fexcess-precision=fast} is in effect; this means that
10392 operations may be carried out in a wider precision than the types specified
10393 in the source if that would result in faster code, and it is unpredictable
10394 when rounding to the types specified in the source code takes place.
10395 When compiling C, if @option{-fexcess-precision=standard} is specified then
10396 excess precision follows the rules specified in ISO C99; in particular,
10397 both casts and assignments cause values to be rounded to their
10398 semantic types (whereas @option{-ffloat-store} only affects
10399 assignments). This option is enabled by default for C if a strict
10400 conformance option such as @option{-std=c99} is used.
10401 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10402 regardless of whether a strict conformance option is used.
10405 @option{-fexcess-precision=standard} is not implemented for languages
10406 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
10407 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10408 semantics apply without excess precision, and in the latter, rounding
10412 @opindex ffast-math
10413 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10414 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10415 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10416 @option{-fexcess-precision=fast}.
10418 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10420 This option is not turned on by any @option{-O} option besides
10421 @option{-Ofast} since it can result in incorrect output for programs
10422 that depend on an exact implementation of IEEE or ISO rules/specifications
10423 for math functions. It may, however, yield faster code for programs
10424 that do not require the guarantees of these specifications.
10426 @item -fno-math-errno
10427 @opindex fno-math-errno
10428 @opindex fmath-errno
10429 Do not set @code{errno} after calling math functions that are executed
10430 with a single instruction, e.g., @code{sqrt}. A program that relies on
10431 IEEE exceptions for math error handling may want to use this flag
10432 for speed while maintaining IEEE arithmetic compatibility.
10434 This option is not turned on by any @option{-O} option since
10435 it can result in incorrect output for programs that depend on
10436 an exact implementation of IEEE or ISO rules/specifications for
10437 math functions. It may, however, yield faster code for programs
10438 that do not require the guarantees of these specifications.
10440 The default is @option{-fmath-errno}.
10442 On Darwin systems, the math library never sets @code{errno}. There is
10443 therefore no reason for the compiler to consider the possibility that
10444 it might, and @option{-fno-math-errno} is the default.
10446 @item -funsafe-math-optimizations
10447 @opindex funsafe-math-optimizations
10449 Allow optimizations for floating-point arithmetic that (a) assume
10450 that arguments and results are valid and (b) may violate IEEE or
10451 ANSI standards. When used at link time, it may include libraries
10452 or startup files that change the default FPU control word or other
10453 similar optimizations.
10455 This option is not turned on by any @option{-O} option since
10456 it can result in incorrect output for programs that depend on
10457 an exact implementation of IEEE or ISO rules/specifications for
10458 math functions. It may, however, yield faster code for programs
10459 that do not require the guarantees of these specifications.
10460 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10461 @option{-fassociative-math} and @option{-freciprocal-math}.
10463 The default is @option{-fno-unsafe-math-optimizations}.
10465 @item -fassociative-math
10466 @opindex fassociative-math
10468 Allow re-association of operands in series of floating-point operations.
10469 This violates the ISO C and C++ language standard by possibly changing
10470 computation result. NOTE: re-ordering may change the sign of zero as
10471 well as ignore NaNs and inhibit or create underflow or overflow (and
10472 thus cannot be used on code that relies on rounding behavior like
10473 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
10474 and thus may not be used when ordered comparisons are required.
10475 This option requires that both @option{-fno-signed-zeros} and
10476 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
10477 much sense with @option{-frounding-math}. For Fortran the option
10478 is automatically enabled when both @option{-fno-signed-zeros} and
10479 @option{-fno-trapping-math} are in effect.
10481 The default is @option{-fno-associative-math}.
10483 @item -freciprocal-math
10484 @opindex freciprocal-math
10486 Allow the reciprocal of a value to be used instead of dividing by
10487 the value if this enables optimizations. For example @code{x / y}
10488 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10489 is subject to common subexpression elimination. Note that this loses
10490 precision and increases the number of flops operating on the value.
10492 The default is @option{-fno-reciprocal-math}.
10494 @item -ffinite-math-only
10495 @opindex ffinite-math-only
10496 Allow optimizations for floating-point arithmetic that assume
10497 that arguments and results are not NaNs or +-Infs.
10499 This option is not turned on by any @option{-O} option since
10500 it can result in incorrect output for programs that depend on
10501 an exact implementation of IEEE or ISO rules/specifications for
10502 math functions. It may, however, yield faster code for programs
10503 that do not require the guarantees of these specifications.
10505 The default is @option{-fno-finite-math-only}.
10507 @item -fno-signed-zeros
10508 @opindex fno-signed-zeros
10509 @opindex fsigned-zeros
10510 Allow optimizations for floating-point arithmetic that ignore the
10511 signedness of zero. IEEE arithmetic specifies the behavior of
10512 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10513 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10514 This option implies that the sign of a zero result isn't significant.
10516 The default is @option{-fsigned-zeros}.
10518 @item -fno-trapping-math
10519 @opindex fno-trapping-math
10520 @opindex ftrapping-math
10521 Compile code assuming that floating-point operations cannot generate
10522 user-visible traps. These traps include division by zero, overflow,
10523 underflow, inexact result and invalid operation. This option requires
10524 that @option{-fno-signaling-nans} be in effect. Setting this option may
10525 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10527 This option should never be turned on by any @option{-O} option since
10528 it can result in incorrect output for programs that depend on
10529 an exact implementation of IEEE or ISO rules/specifications for
10532 The default is @option{-ftrapping-math}.
10534 @item -frounding-math
10535 @opindex frounding-math
10536 Disable transformations and optimizations that assume default floating-point
10537 rounding behavior. This is round-to-zero for all floating point
10538 to integer conversions, and round-to-nearest for all other arithmetic
10539 truncations. This option should be specified for programs that change
10540 the FP rounding mode dynamically, or that may be executed with a
10541 non-default rounding mode. This option disables constant folding of
10542 floating-point expressions at compile time (which may be affected by
10543 rounding mode) and arithmetic transformations that are unsafe in the
10544 presence of sign-dependent rounding modes.
10546 The default is @option{-fno-rounding-math}.
10548 This option is experimental and does not currently guarantee to
10549 disable all GCC optimizations that are affected by rounding mode.
10550 Future versions of GCC may provide finer control of this setting
10551 using C99's @code{FENV_ACCESS} pragma. This command-line option
10552 will be used to specify the default state for @code{FENV_ACCESS}.
10554 @item -fsignaling-nans
10555 @opindex fsignaling-nans
10556 Compile code assuming that IEEE signaling NaNs may generate user-visible
10557 traps during floating-point operations. Setting this option disables
10558 optimizations that may change the number of exceptions visible with
10559 signaling NaNs. This option implies @option{-ftrapping-math}.
10561 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10564 The default is @option{-fno-signaling-nans}.
10566 This option is experimental and does not currently guarantee to
10567 disable all GCC optimizations that affect signaling NaN behavior.
10569 @item -fno-fp-int-builtin-inexact
10570 @opindex fno-fp-int-builtin-inexact
10571 @opindex ffp-int-builtin-inexact
10572 Do not allow the built-in functions @code{ceil}, @code{floor},
10573 @code{round} and @code{trunc}, and their @code{float} and @code{long
10574 double} variants, to generate code that raises the ``inexact''
10575 floating-point exception for noninteger arguments. ISO C99 and C11
10576 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10577 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
10578 functions to do so.
10580 The default is @option{-ffp-int-builtin-inexact}, allowing the
10581 exception to be raised. This option does nothing unless
10582 @option{-ftrapping-math} is in effect.
10584 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10585 generate a call to a library function then the ``inexact'' exception
10586 may be raised if the library implementation does not follow TS 18661.
10588 @item -fsingle-precision-constant
10589 @opindex fsingle-precision-constant
10590 Treat floating-point constants as single precision instead of
10591 implicitly converting them to double-precision constants.
10593 @item -fcx-limited-range
10594 @opindex fcx-limited-range
10595 When enabled, this option states that a range reduction step is not
10596 needed when performing complex division. Also, there is no checking
10597 whether the result of a complex multiplication or division is @code{NaN
10598 + I*NaN}, with an attempt to rescue the situation in that case. The
10599 default is @option{-fno-cx-limited-range}, but is enabled by
10600 @option{-ffast-math}.
10602 This option controls the default setting of the ISO C99
10603 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10606 @item -fcx-fortran-rules
10607 @opindex fcx-fortran-rules
10608 Complex multiplication and division follow Fortran rules. Range
10609 reduction is done as part of complex division, but there is no checking
10610 whether the result of a complex multiplication or division is @code{NaN
10611 + I*NaN}, with an attempt to rescue the situation in that case.
10613 The default is @option{-fno-cx-fortran-rules}.
10617 The following options control optimizations that may improve
10618 performance, but are not enabled by any @option{-O} options. This
10619 section includes experimental options that may produce broken code.
10622 @item -fbranch-probabilities
10623 @opindex fbranch-probabilities
10624 After running a program compiled with @option{-fprofile-arcs}
10625 (@pxref{Instrumentation Options}),
10626 you can compile it a second time using
10627 @option{-fbranch-probabilities}, to improve optimizations based on
10628 the number of times each branch was taken. When a program
10629 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10630 counts to a file called @file{@var{sourcename}.gcda} for each source
10631 file. The information in this data file is very dependent on the
10632 structure of the generated code, so you must use the same source code
10633 and the same optimization options for both compilations.
10635 With @option{-fbranch-probabilities}, GCC puts a
10636 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10637 These can be used to improve optimization. Currently, they are only
10638 used in one place: in @file{reorg.c}, instead of guessing which path a
10639 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10640 exactly determine which path is taken more often.
10642 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10644 @item -fprofile-values
10645 @opindex fprofile-values
10646 If combined with @option{-fprofile-arcs}, it adds code so that some
10647 data about values of expressions in the program is gathered.
10649 With @option{-fbranch-probabilities}, it reads back the data gathered
10650 from profiling values of expressions for usage in optimizations.
10652 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
10653 @option{-fauto-profile}.
10655 @item -fprofile-reorder-functions
10656 @opindex fprofile-reorder-functions
10657 Function reordering based on profile instrumentation collects
10658 first time of execution of a function and orders these functions
10659 in ascending order.
10661 Enabled with @option{-fprofile-use}.
10665 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10666 to add code to gather information about values of expressions.
10668 With @option{-fbranch-probabilities}, it reads back the data gathered
10669 and actually performs the optimizations based on them.
10670 Currently the optimizations include specialization of division operations
10671 using the knowledge about the value of the denominator.
10673 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
10675 @item -frename-registers
10676 @opindex frename-registers
10677 Attempt to avoid false dependencies in scheduled code by making use
10678 of registers left over after register allocation. This optimization
10679 most benefits processors with lots of registers. Depending on the
10680 debug information format adopted by the target, however, it can
10681 make debugging impossible, since variables no longer stay in
10682 a ``home register''.
10684 Enabled by default with @option{-funroll-loops}.
10686 @item -fschedule-fusion
10687 @opindex fschedule-fusion
10688 Performs a target dependent pass over the instruction stream to schedule
10689 instructions of same type together because target machine can execute them
10690 more efficiently if they are adjacent to each other in the instruction flow.
10692 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10696 Perform tail duplication to enlarge superblock size. This transformation
10697 simplifies the control flow of the function allowing other optimizations to do
10700 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10702 @item -funroll-loops
10703 @opindex funroll-loops
10704 Unroll loops whose number of iterations can be determined at compile time or
10705 upon entry to the loop. @option{-funroll-loops} implies
10706 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10707 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10708 a small constant number of iterations). This option makes code larger, and may
10709 or may not make it run faster.
10711 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10713 @item -funroll-all-loops
10714 @opindex funroll-all-loops
10715 Unroll all loops, even if their number of iterations is uncertain when
10716 the loop is entered. This usually makes programs run more slowly.
10717 @option{-funroll-all-loops} implies the same options as
10718 @option{-funroll-loops}.
10721 @opindex fpeel-loops
10722 Peels loops for which there is enough information that they do not
10723 roll much (from profile feedback or static analysis). It also turns on
10724 complete loop peeling (i.e.@: complete removal of loops with small constant
10725 number of iterations).
10727 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
10729 @item -fmove-loop-invariants
10730 @opindex fmove-loop-invariants
10731 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10732 at level @option{-O1} and higher, except for @option{-Og}.
10734 @item -fsplit-loops
10735 @opindex fsplit-loops
10736 Split a loop into two if it contains a condition that's always true
10737 for one side of the iteration space and false for the other.
10739 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10741 @item -funswitch-loops
10742 @opindex funswitch-loops
10743 Move branches with loop invariant conditions out of the loop, with duplicates
10744 of the loop on both branches (modified according to result of the condition).
10746 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10748 @item -ffunction-sections
10749 @itemx -fdata-sections
10750 @opindex ffunction-sections
10751 @opindex fdata-sections
10752 Place each function or data item into its own section in the output
10753 file if the target supports arbitrary sections. The name of the
10754 function or the name of the data item determines the section's name
10755 in the output file.
10757 Use these options on systems where the linker can perform optimizations to
10758 improve locality of reference in the instruction space. Most systems using the
10759 ELF object format have linkers with such optimizations. On AIX, the linker
10760 rearranges sections (CSECTs) based on the call graph. The performance impact
10763 Together with a linker garbage collection (linker @option{--gc-sections}
10764 option) these options may lead to smaller statically-linked executables (after
10767 On ELF/DWARF systems these options do not degenerate the quality of the debug
10768 information. There could be issues with other object files/debug info formats.
10770 Only use these options when there are significant benefits from doing so. When
10771 you specify these options, the assembler and linker create larger object and
10772 executable files and are also slower. These options affect code generation.
10773 They prevent optimizations by the compiler and assembler using relative
10774 locations inside a translation unit since the locations are unknown until
10775 link time. An example of such an optimization is relaxing calls to short call
10778 @item -fbranch-target-load-optimize
10779 @opindex fbranch-target-load-optimize
10780 Perform branch target register load optimization before prologue / epilogue
10782 The use of target registers can typically be exposed only during reload,
10783 thus hoisting loads out of loops and doing inter-block scheduling needs
10784 a separate optimization pass.
10786 @item -fbranch-target-load-optimize2
10787 @opindex fbranch-target-load-optimize2
10788 Perform branch target register load optimization after prologue / epilogue
10791 @item -fbtr-bb-exclusive
10792 @opindex fbtr-bb-exclusive
10793 When performing branch target register load optimization, don't reuse
10794 branch target registers within any basic block.
10797 @opindex fstdarg-opt
10798 Optimize the prologue of variadic argument functions with respect to usage of
10801 @item -fsection-anchors
10802 @opindex fsection-anchors
10803 Try to reduce the number of symbolic address calculations by using
10804 shared ``anchor'' symbols to address nearby objects. This transformation
10805 can help to reduce the number of GOT entries and GOT accesses on some
10808 For example, the implementation of the following function @code{foo}:
10811 static int a, b, c;
10812 int foo (void) @{ return a + b + c; @}
10816 usually calculates the addresses of all three variables, but if you
10817 compile it with @option{-fsection-anchors}, it accesses the variables
10818 from a common anchor point instead. The effect is similar to the
10819 following pseudocode (which isn't valid C):
10824 register int *xr = &x;
10825 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
10829 Not all targets support this option.
10831 @item --param @var{name}=@var{value}
10833 In some places, GCC uses various constants to control the amount of
10834 optimization that is done. For example, GCC does not inline functions
10835 that contain more than a certain number of instructions. You can
10836 control some of these constants on the command line using the
10837 @option{--param} option.
10839 The names of specific parameters, and the meaning of the values, are
10840 tied to the internals of the compiler, and are subject to change
10841 without notice in future releases.
10843 In order to get minimal, maximal and default value of a parameter,
10844 one can use @option{--help=param -Q} options.
10846 In each case, the @var{value} is an integer. The allowable choices for
10850 @item predictable-branch-outcome
10851 When branch is predicted to be taken with probability lower than this threshold
10852 (in percent), then it is considered well predictable.
10854 @item max-rtl-if-conversion-insns
10855 RTL if-conversion tries to remove conditional branches around a block and
10856 replace them with conditionally executed instructions. This parameter
10857 gives the maximum number of instructions in a block which should be
10858 considered for if-conversion. The compiler will
10859 also use other heuristics to decide whether if-conversion is likely to be
10862 @item max-rtl-if-conversion-predictable-cost
10863 @itemx max-rtl-if-conversion-unpredictable-cost
10864 RTL if-conversion will try to remove conditional branches around a block
10865 and replace them with conditionally executed instructions. These parameters
10866 give the maximum permissible cost for the sequence that would be generated
10867 by if-conversion depending on whether the branch is statically determined
10868 to be predictable or not. The units for this parameter are the same as
10869 those for the GCC internal seq_cost metric. The compiler will try to
10870 provide a reasonable default for this parameter using the BRANCH_COST
10873 @item max-crossjump-edges
10874 The maximum number of incoming edges to consider for cross-jumping.
10875 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
10876 the number of edges incoming to each block. Increasing values mean
10877 more aggressive optimization, making the compilation time increase with
10878 probably small improvement in executable size.
10880 @item min-crossjump-insns
10881 The minimum number of instructions that must be matched at the end
10882 of two blocks before cross-jumping is performed on them. This
10883 value is ignored in the case where all instructions in the block being
10884 cross-jumped from are matched.
10886 @item max-grow-copy-bb-insns
10887 The maximum code size expansion factor when copying basic blocks
10888 instead of jumping. The expansion is relative to a jump instruction.
10890 @item max-goto-duplication-insns
10891 The maximum number of instructions to duplicate to a block that jumps
10892 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
10893 passes, GCC factors computed gotos early in the compilation process,
10894 and unfactors them as late as possible. Only computed jumps at the
10895 end of a basic blocks with no more than max-goto-duplication-insns are
10898 @item max-delay-slot-insn-search
10899 The maximum number of instructions to consider when looking for an
10900 instruction to fill a delay slot. If more than this arbitrary number of
10901 instructions are searched, the time savings from filling the delay slot
10902 are minimal, so stop searching. Increasing values mean more
10903 aggressive optimization, making the compilation time increase with probably
10904 small improvement in execution time.
10906 @item max-delay-slot-live-search
10907 When trying to fill delay slots, the maximum number of instructions to
10908 consider when searching for a block with valid live register
10909 information. Increasing this arbitrarily chosen value means more
10910 aggressive optimization, increasing the compilation time. This parameter
10911 should be removed when the delay slot code is rewritten to maintain the
10912 control-flow graph.
10914 @item max-gcse-memory
10915 The approximate maximum amount of memory that can be allocated in
10916 order to perform the global common subexpression elimination
10917 optimization. If more memory than specified is required, the
10918 optimization is not done.
10920 @item max-gcse-insertion-ratio
10921 If the ratio of expression insertions to deletions is larger than this value
10922 for any expression, then RTL PRE inserts or removes the expression and thus
10923 leaves partially redundant computations in the instruction stream.
10925 @item max-pending-list-length
10926 The maximum number of pending dependencies scheduling allows
10927 before flushing the current state and starting over. Large functions
10928 with few branches or calls can create excessively large lists which
10929 needlessly consume memory and resources.
10931 @item max-modulo-backtrack-attempts
10932 The maximum number of backtrack attempts the scheduler should make
10933 when modulo scheduling a loop. Larger values can exponentially increase
10936 @item max-inline-insns-single
10937 Several parameters control the tree inliner used in GCC@.
10938 This number sets the maximum number of instructions (counted in GCC's
10939 internal representation) in a single function that the tree inliner
10940 considers for inlining. This only affects functions declared
10941 inline and methods implemented in a class declaration (C++).
10943 @item max-inline-insns-auto
10944 When you use @option{-finline-functions} (included in @option{-O3}),
10945 a lot of functions that would otherwise not be considered for inlining
10946 by the compiler are investigated. To those functions, a different
10947 (more restrictive) limit compared to functions declared inline can
10950 @item inline-min-speedup
10951 When estimated performance improvement of caller + callee runtime exceeds this
10952 threshold (in percent), the function can be inlined regardless of the limit on
10953 @option{--param max-inline-insns-single} and @option{--param
10954 max-inline-insns-auto}.
10956 @item large-function-insns
10957 The limit specifying really large functions. For functions larger than this
10958 limit after inlining, inlining is constrained by
10959 @option{--param large-function-growth}. This parameter is useful primarily
10960 to avoid extreme compilation time caused by non-linear algorithms used by the
10963 @item large-function-growth
10964 Specifies maximal growth of large function caused by inlining in percents.
10965 For example, parameter value 100 limits large function growth to 2.0 times
10968 @item large-unit-insns
10969 The limit specifying large translation unit. Growth caused by inlining of
10970 units larger than this limit is limited by @option{--param inline-unit-growth}.
10971 For small units this might be too tight.
10972 For example, consider a unit consisting of function A
10973 that is inline and B that just calls A three times. If B is small relative to
10974 A, the growth of unit is 300\% and yet such inlining is very sane. For very
10975 large units consisting of small inlineable functions, however, the overall unit
10976 growth limit is needed to avoid exponential explosion of code size. Thus for
10977 smaller units, the size is increased to @option{--param large-unit-insns}
10978 before applying @option{--param inline-unit-growth}.
10980 @item inline-unit-growth
10981 Specifies maximal overall growth of the compilation unit caused by inlining.
10982 For example, parameter value 20 limits unit growth to 1.2 times the original
10983 size. Cold functions (either marked cold via an attribute or by profile
10984 feedback) are not accounted into the unit size.
10986 @item ipcp-unit-growth
10987 Specifies maximal overall growth of the compilation unit caused by
10988 interprocedural constant propagation. For example, parameter value 10 limits
10989 unit growth to 1.1 times the original size.
10991 @item large-stack-frame
10992 The limit specifying large stack frames. While inlining the algorithm is trying
10993 to not grow past this limit too much.
10995 @item large-stack-frame-growth
10996 Specifies maximal growth of large stack frames caused by inlining in percents.
10997 For example, parameter value 1000 limits large stack frame growth to 11 times
11000 @item max-inline-insns-recursive
11001 @itemx max-inline-insns-recursive-auto
11002 Specifies the maximum number of instructions an out-of-line copy of a
11003 self-recursive inline
11004 function can grow into by performing recursive inlining.
11006 @option{--param max-inline-insns-recursive} applies to functions
11008 For functions not declared inline, recursive inlining
11009 happens only when @option{-finline-functions} (included in @option{-O3}) is
11010 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
11012 @item max-inline-recursive-depth
11013 @itemx max-inline-recursive-depth-auto
11014 Specifies the maximum recursion depth used for recursive inlining.
11016 @option{--param max-inline-recursive-depth} applies to functions
11017 declared inline. For functions not declared inline, recursive inlining
11018 happens only when @option{-finline-functions} (included in @option{-O3}) is
11019 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
11021 @item min-inline-recursive-probability
11022 Recursive inlining is profitable only for function having deep recursion
11023 in average and can hurt for function having little recursion depth by
11024 increasing the prologue size or complexity of function body to other
11027 When profile feedback is available (see @option{-fprofile-generate}) the actual
11028 recursion depth can be guessed from the probability that function recurses
11029 via a given call expression. This parameter limits inlining only to call
11030 expressions whose probability exceeds the given threshold (in percents).
11032 @item early-inlining-insns
11033 Specify growth that the early inliner can make. In effect it increases
11034 the amount of inlining for code having a large abstraction penalty.
11036 @item max-early-inliner-iterations
11037 Limit of iterations of the early inliner. This basically bounds
11038 the number of nested indirect calls the early inliner can resolve.
11039 Deeper chains are still handled by late inlining.
11041 @item comdat-sharing-probability
11042 Probability (in percent) that C++ inline function with comdat visibility
11043 are shared across multiple compilation units.
11045 @item profile-func-internal-id
11046 A parameter to control whether to use function internal id in profile
11047 database lookup. If the value is 0, the compiler uses an id that
11048 is based on function assembler name and filename, which makes old profile
11049 data more tolerant to source changes such as function reordering etc.
11051 @item min-vect-loop-bound
11052 The minimum number of iterations under which loops are not vectorized
11053 when @option{-ftree-vectorize} is used. The number of iterations after
11054 vectorization needs to be greater than the value specified by this option
11055 to allow vectorization.
11057 @item gcse-cost-distance-ratio
11058 Scaling factor in calculation of maximum distance an expression
11059 can be moved by GCSE optimizations. This is currently supported only in the
11060 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
11061 is with simple expressions, i.e., the expressions that have cost
11062 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
11063 hoisting of simple expressions.
11065 @item gcse-unrestricted-cost
11066 Cost, roughly measured as the cost of a single typical machine
11067 instruction, at which GCSE optimizations do not constrain
11068 the distance an expression can travel. This is currently
11069 supported only in the code hoisting pass. The lesser the cost,
11070 the more aggressive code hoisting is. Specifying 0
11071 allows all expressions to travel unrestricted distances.
11073 @item max-hoist-depth
11074 The depth of search in the dominator tree for expressions to hoist.
11075 This is used to avoid quadratic behavior in hoisting algorithm.
11076 The value of 0 does not limit on the search, but may slow down compilation
11079 @item max-tail-merge-comparisons
11080 The maximum amount of similar bbs to compare a bb with. This is used to
11081 avoid quadratic behavior in tree tail merging.
11083 @item max-tail-merge-iterations
11084 The maximum amount of iterations of the pass over the function. This is used to
11085 limit compilation time in tree tail merging.
11087 @item store-merging-allow-unaligned
11088 Allow the store merging pass to introduce unaligned stores if it is legal to
11091 @item max-stores-to-merge
11092 The maximum number of stores to attempt to merge into wider stores in the store
11095 @item max-unrolled-insns
11096 The maximum number of instructions that a loop may have to be unrolled.
11097 If a loop is unrolled, this parameter also determines how many times
11098 the loop code is unrolled.
11100 @item max-average-unrolled-insns
11101 The maximum number of instructions biased by probabilities of their execution
11102 that a loop may have to be unrolled. If a loop is unrolled,
11103 this parameter also determines how many times the loop code is unrolled.
11105 @item max-unroll-times
11106 The maximum number of unrollings of a single loop.
11108 @item max-peeled-insns
11109 The maximum number of instructions that a loop may have to be peeled.
11110 If a loop is peeled, this parameter also determines how many times
11111 the loop code is peeled.
11113 @item max-peel-times
11114 The maximum number of peelings of a single loop.
11116 @item max-peel-branches
11117 The maximum number of branches on the hot path through the peeled sequence.
11119 @item max-completely-peeled-insns
11120 The maximum number of insns of a completely peeled loop.
11122 @item max-completely-peel-times
11123 The maximum number of iterations of a loop to be suitable for complete peeling.
11125 @item max-completely-peel-loop-nest-depth
11126 The maximum depth of a loop nest suitable for complete peeling.
11128 @item max-unswitch-insns
11129 The maximum number of insns of an unswitched loop.
11131 @item max-unswitch-level
11132 The maximum number of branches unswitched in a single loop.
11134 @item lim-expensive
11135 The minimum cost of an expensive expression in the loop invariant motion.
11137 @item iv-consider-all-candidates-bound
11138 Bound on number of candidates for induction variables, below which
11139 all candidates are considered for each use in induction variable
11140 optimizations. If there are more candidates than this,
11141 only the most relevant ones are considered to avoid quadratic time complexity.
11143 @item iv-max-considered-uses
11144 The induction variable optimizations give up on loops that contain more
11145 induction variable uses.
11147 @item iv-always-prune-cand-set-bound
11148 If the number of candidates in the set is smaller than this value,
11149 always try to remove unnecessary ivs from the set
11150 when adding a new one.
11152 @item avg-loop-niter
11153 Average number of iterations of a loop.
11155 @item dse-max-object-size
11156 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
11157 Larger values may result in larger compilation times.
11159 @item dse-max-alias-queries-per-store
11160 Maximum number of queries into the alias oracle per store.
11161 Larger values result in larger compilation times and may result in more
11162 removed dead stores.
11164 @item scev-max-expr-size
11165 Bound on size of expressions used in the scalar evolutions analyzer.
11166 Large expressions slow the analyzer.
11168 @item scev-max-expr-complexity
11169 Bound on the complexity of the expressions in the scalar evolutions analyzer.
11170 Complex expressions slow the analyzer.
11172 @item max-tree-if-conversion-phi-args
11173 Maximum number of arguments in a PHI supported by TREE if conversion
11174 unless the loop is marked with simd pragma.
11176 @item vect-max-version-for-alignment-checks
11177 The maximum number of run-time checks that can be performed when
11178 doing loop versioning for alignment in the vectorizer.
11180 @item vect-max-version-for-alias-checks
11181 The maximum number of run-time checks that can be performed when
11182 doing loop versioning for alias in the vectorizer.
11184 @item vect-max-peeling-for-alignment
11185 The maximum number of loop peels to enhance access alignment
11186 for vectorizer. Value -1 means no limit.
11188 @item max-iterations-to-track
11189 The maximum number of iterations of a loop the brute-force algorithm
11190 for analysis of the number of iterations of the loop tries to evaluate.
11192 @item hot-bb-count-ws-permille
11193 A basic block profile count is considered hot if it contributes to
11194 the given permillage (i.e.@: 0...1000) of the entire profiled execution.
11196 @item hot-bb-frequency-fraction
11197 Select fraction of the entry block frequency of executions of basic block in
11198 function given basic block needs to have to be considered hot.
11200 @item max-predicted-iterations
11201 The maximum number of loop iterations we predict statically. This is useful
11202 in cases where a function contains a single loop with known bound and
11203 another loop with unknown bound.
11204 The known number of iterations is predicted correctly, while
11205 the unknown number of iterations average to roughly 10. This means that the
11206 loop without bounds appears artificially cold relative to the other one.
11208 @item builtin-expect-probability
11209 Control the probability of the expression having the specified value. This
11210 parameter takes a percentage (i.e.@: 0 ... 100) as input.
11212 @item builtin-string-cmp-inline-length
11213 The maximum length of a constant string for a builtin string cmp call
11214 eligible for inlining.
11216 @item align-threshold
11218 Select fraction of the maximal frequency of executions of a basic block in
11219 a function to align the basic block.
11221 @item align-loop-iterations
11223 A loop expected to iterate at least the selected number of iterations is
11226 @item tracer-dynamic-coverage
11227 @itemx tracer-dynamic-coverage-feedback
11229 This value is used to limit superblock formation once the given percentage of
11230 executed instructions is covered. This limits unnecessary code size
11233 The @option{tracer-dynamic-coverage-feedback} parameter
11234 is used only when profile
11235 feedback is available. The real profiles (as opposed to statically estimated
11236 ones) are much less balanced allowing the threshold to be larger value.
11238 @item tracer-max-code-growth
11239 Stop tail duplication once code growth has reached given percentage. This is
11240 a rather artificial limit, as most of the duplicates are eliminated later in
11241 cross jumping, so it may be set to much higher values than is the desired code
11244 @item tracer-min-branch-ratio
11246 Stop reverse growth when the reverse probability of best edge is less than this
11247 threshold (in percent).
11249 @item tracer-min-branch-probability
11250 @itemx tracer-min-branch-probability-feedback
11252 Stop forward growth if the best edge has probability lower than this
11255 Similarly to @option{tracer-dynamic-coverage} two parameters are
11256 provided. @option{tracer-min-branch-probability-feedback} is used for
11257 compilation with profile feedback and @option{tracer-min-branch-probability}
11258 compilation without. The value for compilation with profile feedback
11259 needs to be more conservative (higher) in order to make tracer
11262 @item stack-clash-protection-guard-size
11263 Specify the size of the operating system provided stack guard as
11264 2 raised to @var{num} bytes. Higher values may reduce the
11265 number of explicit probes, but a value larger than the operating system
11266 provided guard will leave code vulnerable to stack clash style attacks.
11268 @item stack-clash-protection-probe-interval
11269 Stack clash protection involves probing stack space as it is allocated. This
11270 param controls the maximum distance between probes into the stack as 2 raised
11271 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
11272 larger than the operating system provided guard will leave code vulnerable to
11273 stack clash style attacks.
11275 @item max-cse-path-length
11277 The maximum number of basic blocks on path that CSE considers.
11279 @item max-cse-insns
11280 The maximum number of instructions CSE processes before flushing.
11282 @item ggc-min-expand
11284 GCC uses a garbage collector to manage its own memory allocation. This
11285 parameter specifies the minimum percentage by which the garbage
11286 collector's heap should be allowed to expand between collections.
11287 Tuning this may improve compilation speed; it has no effect on code
11290 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
11291 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
11292 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
11293 GCC is not able to calculate RAM on a particular platform, the lower
11294 bound of 30% is used. Setting this parameter and
11295 @option{ggc-min-heapsize} to zero causes a full collection to occur at
11296 every opportunity. This is extremely slow, but can be useful for
11299 @item ggc-min-heapsize
11301 Minimum size of the garbage collector's heap before it begins bothering
11302 to collect garbage. The first collection occurs after the heap expands
11303 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
11304 tuning this may improve compilation speed, and has no effect on code
11307 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
11308 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
11309 with a lower bound of 4096 (four megabytes) and an upper bound of
11310 131072 (128 megabytes). If GCC is not able to calculate RAM on a
11311 particular platform, the lower bound is used. Setting this parameter
11312 very large effectively disables garbage collection. Setting this
11313 parameter and @option{ggc-min-expand} to zero causes a full collection
11314 to occur at every opportunity.
11316 @item max-reload-search-insns
11317 The maximum number of instruction reload should look backward for equivalent
11318 register. Increasing values mean more aggressive optimization, making the
11319 compilation time increase with probably slightly better performance.
11321 @item max-cselib-memory-locations
11322 The maximum number of memory locations cselib should take into account.
11323 Increasing values mean more aggressive optimization, making the compilation time
11324 increase with probably slightly better performance.
11326 @item max-sched-ready-insns
11327 The maximum number of instructions ready to be issued the scheduler should
11328 consider at any given time during the first scheduling pass. Increasing
11329 values mean more thorough searches, making the compilation time increase
11330 with probably little benefit.
11332 @item max-sched-region-blocks
11333 The maximum number of blocks in a region to be considered for
11334 interblock scheduling.
11336 @item max-pipeline-region-blocks
11337 The maximum number of blocks in a region to be considered for
11338 pipelining in the selective scheduler.
11340 @item max-sched-region-insns
11341 The maximum number of insns in a region to be considered for
11342 interblock scheduling.
11344 @item max-pipeline-region-insns
11345 The maximum number of insns in a region to be considered for
11346 pipelining in the selective scheduler.
11348 @item min-spec-prob
11349 The minimum probability (in percents) of reaching a source block
11350 for interblock speculative scheduling.
11352 @item max-sched-extend-regions-iters
11353 The maximum number of iterations through CFG to extend regions.
11354 A value of 0 disables region extensions.
11356 @item max-sched-insn-conflict-delay
11357 The maximum conflict delay for an insn to be considered for speculative motion.
11359 @item sched-spec-prob-cutoff
11360 The minimal probability of speculation success (in percents), so that
11361 speculative insns are scheduled.
11363 @item sched-state-edge-prob-cutoff
11364 The minimum probability an edge must have for the scheduler to save its
11367 @item sched-mem-true-dep-cost
11368 Minimal distance (in CPU cycles) between store and load targeting same
11371 @item selsched-max-lookahead
11372 The maximum size of the lookahead window of selective scheduling. It is a
11373 depth of search for available instructions.
11375 @item selsched-max-sched-times
11376 The maximum number of times that an instruction is scheduled during
11377 selective scheduling. This is the limit on the number of iterations
11378 through which the instruction may be pipelined.
11380 @item selsched-insns-to-rename
11381 The maximum number of best instructions in the ready list that are considered
11382 for renaming in the selective scheduler.
11385 The minimum value of stage count that swing modulo scheduler
11388 @item max-last-value-rtl
11389 The maximum size measured as number of RTLs that can be recorded in an expression
11390 in combiner for a pseudo register as last known value of that register.
11392 @item max-combine-insns
11393 The maximum number of instructions the RTL combiner tries to combine.
11395 @item integer-share-limit
11396 Small integer constants can use a shared data structure, reducing the
11397 compiler's memory usage and increasing its speed. This sets the maximum
11398 value of a shared integer constant.
11400 @item ssp-buffer-size
11401 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11402 protection when @option{-fstack-protection} is used.
11404 @item min-size-for-stack-sharing
11405 The minimum size of variables taking part in stack slot sharing when not
11408 @item max-jump-thread-duplication-stmts
11409 Maximum number of statements allowed in a block that needs to be
11410 duplicated when threading jumps.
11412 @item max-fields-for-field-sensitive
11413 Maximum number of fields in a structure treated in
11414 a field sensitive manner during pointer analysis.
11416 @item prefetch-latency
11417 Estimate on average number of instructions that are executed before
11418 prefetch finishes. The distance prefetched ahead is proportional
11419 to this constant. Increasing this number may also lead to less
11420 streams being prefetched (see @option{simultaneous-prefetches}).
11422 @item simultaneous-prefetches
11423 Maximum number of prefetches that can run at the same time.
11425 @item l1-cache-line-size
11426 The size of cache line in L1 data cache, in bytes.
11428 @item l1-cache-size
11429 The size of L1 data cache, in kilobytes.
11431 @item l2-cache-size
11432 The size of L2 data cache, in kilobytes.
11434 @item prefetch-dynamic-strides
11435 Whether the loop array prefetch pass should issue software prefetch hints
11436 for strides that are non-constant. In some cases this may be
11437 beneficial, though the fact the stride is non-constant may make it
11438 hard to predict when there is clear benefit to issuing these hints.
11440 Set to 1 if the prefetch hints should be issued for non-constant
11441 strides. Set to 0 if prefetch hints should be issued only for strides that
11442 are known to be constant and below @option{prefetch-minimum-stride}.
11444 @item prefetch-minimum-stride
11445 Minimum constant stride, in bytes, to start using prefetch hints for. If
11446 the stride is less than this threshold, prefetch hints will not be issued.
11448 This setting is useful for processors that have hardware prefetchers, in
11449 which case there may be conflicts between the hardware prefetchers and
11450 the software prefetchers. If the hardware prefetchers have a maximum
11451 stride they can handle, it should be used here to improve the use of
11452 software prefetchers.
11454 A value of -1 means we don't have a threshold and therefore
11455 prefetch hints can be issued for any constant stride.
11457 This setting is only useful for strides that are known and constant.
11459 @item loop-interchange-max-num-stmts
11460 The maximum number of stmts in a loop to be interchanged.
11462 @item loop-interchange-stride-ratio
11463 The minimum ratio between stride of two loops for interchange to be profitable.
11465 @item min-insn-to-prefetch-ratio
11466 The minimum ratio between the number of instructions and the
11467 number of prefetches to enable prefetching in a loop.
11469 @item prefetch-min-insn-to-mem-ratio
11470 The minimum ratio between the number of instructions and the
11471 number of memory references to enable prefetching in a loop.
11473 @item use-canonical-types
11474 Whether the compiler should use the ``canonical'' type system.
11475 Should always be 1, which uses a more efficient internal
11476 mechanism for comparing types in C++ and Objective-C++. However, if
11477 bugs in the canonical type system are causing compilation failures,
11478 set this value to 0 to disable canonical types.
11480 @item switch-conversion-max-branch-ratio
11481 Switch initialization conversion refuses to create arrays that are
11482 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11483 branches in the switch.
11485 @item max-partial-antic-length
11486 Maximum length of the partial antic set computed during the tree
11487 partial redundancy elimination optimization (@option{-ftree-pre}) when
11488 optimizing at @option{-O3} and above. For some sorts of source code
11489 the enhanced partial redundancy elimination optimization can run away,
11490 consuming all of the memory available on the host machine. This
11491 parameter sets a limit on the length of the sets that are computed,
11492 which prevents the runaway behavior. Setting a value of 0 for
11493 this parameter allows an unlimited set length.
11495 @item rpo-vn-max-loop-depth
11496 Maximum loop depth that is value-numbered optimistically.
11497 When the limit hits the innermost
11498 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11499 loop nest are value-numbered optimistically and the remaining ones not.
11501 @item sccvn-max-alias-queries-per-access
11502 Maximum number of alias-oracle queries we perform when looking for
11503 redundancies for loads and stores. If this limit is hit the search
11504 is aborted and the load or store is not considered redundant. The
11505 number of queries is algorithmically limited to the number of
11506 stores on all paths from the load to the function entry.
11508 @item ira-max-loops-num
11509 IRA uses regional register allocation by default. If a function
11510 contains more loops than the number given by this parameter, only at most
11511 the given number of the most frequently-executed loops form regions
11512 for regional register allocation.
11514 @item ira-max-conflict-table-size
11515 Although IRA uses a sophisticated algorithm to compress the conflict
11516 table, the table can still require excessive amounts of memory for
11517 huge functions. If the conflict table for a function could be more
11518 than the size in MB given by this parameter, the register allocator
11519 instead uses a faster, simpler, and lower-quality
11520 algorithm that does not require building a pseudo-register conflict table.
11522 @item ira-loop-reserved-regs
11523 IRA can be used to evaluate more accurate register pressure in loops
11524 for decisions to move loop invariants (see @option{-O3}). The number
11525 of available registers reserved for some other purposes is given
11526 by this parameter. Default of the parameter
11527 is the best found from numerous experiments.
11529 @item lra-inheritance-ebb-probability-cutoff
11530 LRA tries to reuse values reloaded in registers in subsequent insns.
11531 This optimization is called inheritance. EBB is used as a region to
11532 do this optimization. The parameter defines a minimal fall-through
11533 edge probability in percentage used to add BB to inheritance EBB in
11534 LRA. The default value was chosen
11535 from numerous runs of SPEC2000 on x86-64.
11537 @item loop-invariant-max-bbs-in-loop
11538 Loop invariant motion can be very expensive, both in compilation time and
11539 in amount of needed compile-time memory, with very large loops. Loops
11540 with more basic blocks than this parameter won't have loop invariant
11541 motion optimization performed on them.
11543 @item loop-max-datarefs-for-datadeps
11544 Building data dependencies is expensive for very large loops. This
11545 parameter limits the number of data references in loops that are
11546 considered for data dependence analysis. These large loops are no
11547 handled by the optimizations using loop data dependencies.
11549 @item max-vartrack-size
11550 Sets a maximum number of hash table slots to use during variable
11551 tracking dataflow analysis of any function. If this limit is exceeded
11552 with variable tracking at assignments enabled, analysis for that
11553 function is retried without it, after removing all debug insns from
11554 the function. If the limit is exceeded even without debug insns, var
11555 tracking analysis is completely disabled for the function. Setting
11556 the parameter to zero makes it unlimited.
11558 @item max-vartrack-expr-depth
11559 Sets a maximum number of recursion levels when attempting to map
11560 variable names or debug temporaries to value expressions. This trades
11561 compilation time for more complete debug information. If this is set too
11562 low, value expressions that are available and could be represented in
11563 debug information may end up not being used; setting this higher may
11564 enable the compiler to find more complex debug expressions, but compile
11565 time and memory use may grow.
11567 @item max-debug-marker-count
11568 Sets a threshold on the number of debug markers (e.g.@: begin stmt
11569 markers) to avoid complexity explosion at inlining or expanding to RTL.
11570 If a function has more such gimple stmts than the set limit, such stmts
11571 will be dropped from the inlined copy of a function, and from its RTL
11574 @item min-nondebug-insn-uid
11575 Use uids starting at this parameter for nondebug insns. The range below
11576 the parameter is reserved exclusively for debug insns created by
11577 @option{-fvar-tracking-assignments}, but debug insns may get
11578 (non-overlapping) uids above it if the reserved range is exhausted.
11580 @item ipa-sra-ptr-growth-factor
11581 IPA-SRA replaces a pointer to an aggregate with one or more new
11582 parameters only when their cumulative size is less or equal to
11583 @option{ipa-sra-ptr-growth-factor} times the size of the original
11586 @item sra-max-scalarization-size-Ospeed
11587 @itemx sra-max-scalarization-size-Osize
11588 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11589 replace scalar parts of aggregates with uses of independent scalar
11590 variables. These parameters control the maximum size, in storage units,
11591 of aggregate which is considered for replacement when compiling for
11593 (@option{sra-max-scalarization-size-Ospeed}) or size
11594 (@option{sra-max-scalarization-size-Osize}) respectively.
11596 @item tm-max-aggregate-size
11597 When making copies of thread-local variables in a transaction, this
11598 parameter specifies the size in bytes after which variables are
11599 saved with the logging functions as opposed to save/restore code
11600 sequence pairs. This option only applies when using
11603 @item graphite-max-nb-scop-params
11604 To avoid exponential effects in the Graphite loop transforms, the
11605 number of parameters in a Static Control Part (SCoP) is bounded.
11606 A value of zero can be used to lift
11607 the bound. A variable whose value is unknown at compilation time and
11608 defined outside a SCoP is a parameter of the SCoP.
11610 @item loop-block-tile-size
11611 Loop blocking or strip mining transforms, enabled with
11612 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11613 loop in the loop nest by a given number of iterations. The strip
11614 length can be changed using the @option{loop-block-tile-size}
11617 @item ipa-cp-value-list-size
11618 IPA-CP attempts to track all possible values and types passed to a function's
11619 parameter in order to propagate them and perform devirtualization.
11620 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11621 stores per one formal parameter of a function.
11623 @item ipa-cp-eval-threshold
11624 IPA-CP calculates its own score of cloning profitability heuristics
11625 and performs those cloning opportunities with scores that exceed
11626 @option{ipa-cp-eval-threshold}.
11628 @item ipa-cp-recursion-penalty
11629 Percentage penalty the recursive functions will receive when they
11630 are evaluated for cloning.
11632 @item ipa-cp-single-call-penalty
11633 Percentage penalty functions containing a single call to another
11634 function will receive when they are evaluated for cloning.
11636 @item ipa-max-agg-items
11637 IPA-CP is also capable to propagate a number of scalar values passed
11638 in an aggregate. @option{ipa-max-agg-items} controls the maximum
11639 number of such values per one parameter.
11641 @item ipa-cp-loop-hint-bonus
11642 When IPA-CP determines that a cloning candidate would make the number
11643 of iterations of a loop known, it adds a bonus of
11644 @option{ipa-cp-loop-hint-bonus} to the profitability score of
11647 @item ipa-cp-array-index-hint-bonus
11648 When IPA-CP determines that a cloning candidate would make the index of
11649 an array access known, it adds a bonus of
11650 @option{ipa-cp-array-index-hint-bonus} to the profitability
11651 score of the candidate.
11653 @item ipa-max-aa-steps
11654 During its analysis of function bodies, IPA-CP employs alias analysis
11655 in order to track values pointed to by function parameters. In order
11656 not spend too much time analyzing huge functions, it gives up and
11657 consider all memory clobbered after examining
11658 @option{ipa-max-aa-steps} statements modifying memory.
11660 @item lto-partitions
11661 Specify desired number of partitions produced during WHOPR compilation.
11662 The number of partitions should exceed the number of CPUs used for compilation.
11664 @item lto-min-partition
11665 Size of minimal partition for WHOPR (in estimated instructions).
11666 This prevents expenses of splitting very small programs into too many
11669 @item lto-max-partition
11670 Size of max partition for WHOPR (in estimated instructions).
11671 to provide an upper bound for individual size of partition.
11672 Meant to be used only with balanced partitioning.
11674 @item cxx-max-namespaces-for-diagnostic-help
11675 The maximum number of namespaces to consult for suggestions when C++
11676 name lookup fails for an identifier.
11678 @item sink-frequency-threshold
11679 The maximum relative execution frequency (in percents) of the target block
11680 relative to a statement's original block to allow statement sinking of a
11681 statement. Larger numbers result in more aggressive statement sinking.
11682 A small positive adjustment is applied for
11683 statements with memory operands as those are even more profitable so sink.
11685 @item max-stores-to-sink
11686 The maximum number of conditional store pairs that can be sunk. Set to 0
11687 if either vectorization (@option{-ftree-vectorize}) or if-conversion
11688 (@option{-ftree-loop-if-convert}) is disabled.
11690 @item allow-store-data-races
11691 Allow optimizers to introduce new data races on stores.
11692 Set to 1 to allow, otherwise to 0.
11694 @item case-values-threshold
11695 The smallest number of different values for which it is best to use a
11696 jump-table instead of a tree of conditional branches. If the value is
11697 0, use the default for the machine.
11699 @item tree-reassoc-width
11700 Set the maximum number of instructions executed in parallel in
11701 reassociated tree. This parameter overrides target dependent
11702 heuristics used by default if has non zero value.
11704 @item sched-pressure-algorithm
11705 Choose between the two available implementations of
11706 @option{-fsched-pressure}. Algorithm 1 is the original implementation
11707 and is the more likely to prevent instructions from being reordered.
11708 Algorithm 2 was designed to be a compromise between the relatively
11709 conservative approach taken by algorithm 1 and the rather aggressive
11710 approach taken by the default scheduler. It relies more heavily on
11711 having a regular register file and accurate register pressure classes.
11712 See @file{haifa-sched.c} in the GCC sources for more details.
11714 The default choice depends on the target.
11716 @item max-slsr-cand-scan
11717 Set the maximum number of existing candidates that are considered when
11718 seeking a basis for a new straight-line strength reduction candidate.
11721 Enable buffer overflow detection for global objects. This kind
11722 of protection is enabled by default if you are using
11723 @option{-fsanitize=address} option.
11724 To disable global objects protection use @option{--param asan-globals=0}.
11727 Enable buffer overflow detection for stack objects. This kind of
11728 protection is enabled by default when using @option{-fsanitize=address}.
11729 To disable stack protection use @option{--param asan-stack=0} option.
11731 @item asan-instrument-reads
11732 Enable buffer overflow detection for memory reads. This kind of
11733 protection is enabled by default when using @option{-fsanitize=address}.
11734 To disable memory reads protection use
11735 @option{--param asan-instrument-reads=0}.
11737 @item asan-instrument-writes
11738 Enable buffer overflow detection for memory writes. This kind of
11739 protection is enabled by default when using @option{-fsanitize=address}.
11740 To disable memory writes protection use
11741 @option{--param asan-instrument-writes=0} option.
11743 @item asan-memintrin
11744 Enable detection for built-in functions. This kind of protection
11745 is enabled by default when using @option{-fsanitize=address}.
11746 To disable built-in functions protection use
11747 @option{--param asan-memintrin=0}.
11749 @item asan-use-after-return
11750 Enable detection of use-after-return. This kind of protection
11751 is enabled by default when using the @option{-fsanitize=address} option.
11752 To disable it use @option{--param asan-use-after-return=0}.
11754 Note: By default the check is disabled at run time. To enable it,
11755 add @code{detect_stack_use_after_return=1} to the environment variable
11756 @env{ASAN_OPTIONS}.
11758 @item asan-instrumentation-with-call-threshold
11759 If number of memory accesses in function being instrumented
11760 is greater or equal to this number, use callbacks instead of inline checks.
11761 E.g. to disable inline code use
11762 @option{--param asan-instrumentation-with-call-threshold=0}.
11764 @item use-after-scope-direct-emission-threshold
11765 If the size of a local variable in bytes is smaller or equal to this
11766 number, directly poison (or unpoison) shadow memory instead of using
11767 run-time callbacks.
11769 @item max-fsm-thread-path-insns
11770 Maximum number of instructions to copy when duplicating blocks on a
11771 finite state automaton jump thread path.
11773 @item max-fsm-thread-length
11774 Maximum number of basic blocks on a finite state automaton jump thread
11777 @item max-fsm-thread-paths
11778 Maximum number of new jump thread paths to create for a finite state
11781 @item parloops-chunk-size
11782 Chunk size of omp schedule for loops parallelized by parloops.
11784 @item parloops-schedule
11785 Schedule type of omp schedule for loops parallelized by parloops (static,
11786 dynamic, guided, auto, runtime).
11788 @item parloops-min-per-thread
11789 The minimum number of iterations per thread of an innermost parallelized
11790 loop for which the parallelized variant is preferred over the single threaded
11791 one. Note that for a parallelized loop nest the
11792 minimum number of iterations of the outermost loop per thread is two.
11794 @item max-ssa-name-query-depth
11795 Maximum depth of recursion when querying properties of SSA names in things
11796 like fold routines. One level of recursion corresponds to following a
11799 @item hsa-gen-debug-stores
11800 Enable emission of special debug stores within HSA kernels which are
11801 then read and reported by libgomp plugin. Generation of these stores
11802 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
11805 @item max-speculative-devirt-maydefs
11806 The maximum number of may-defs we analyze when looking for a must-def
11807 specifying the dynamic type of an object that invokes a virtual call
11808 we may be able to devirtualize speculatively.
11810 @item max-vrp-switch-assertions
11811 The maximum number of assertions to add along the default edge of a switch
11812 statement during VRP.
11814 @item unroll-jam-min-percent
11815 The minimum percentage of memory references that must be optimized
11816 away for the unroll-and-jam transformation to be considered profitable.
11818 @item unroll-jam-max-unroll
11819 The maximum number of times the outer loop should be unrolled by
11820 the unroll-and-jam transformation.
11822 @item max-rtl-if-conversion-unpredictable-cost
11823 Maximum permissible cost for the sequence that would be generated
11824 by the RTL if-conversion pass for a branch that is considered unpredictable.
11826 @item max-variable-expansions-in-unroller
11827 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
11828 of times that an individual variable will be expanded during loop unrolling.
11830 @item tracer-min-branch-probability-feedback
11831 Stop forward growth if the probability of best edge is less than
11832 this threshold (in percent). Used when profile feedback is available.
11834 @item partial-inlining-entry-probability
11835 Maximum probability of the entry BB of split region
11836 (in percent relative to entry BB of the function)
11837 to make partial inlining happen.
11839 @item max-tracked-strlens
11840 Maximum number of strings for which strlen optimization pass will
11841 track string lengths.
11843 @item gcse-after-reload-partial-fraction
11844 The threshold ratio for performing partial redundancy
11845 elimination after reload.
11847 @item gcse-after-reload-critical-fraction
11848 The threshold ratio of critical edges execution count that
11849 permit performing redundancy elimination after reload.
11851 @item max-loop-header-insns
11852 The maximum number of insns in loop header duplicated
11853 by the copy loop headers pass.
11855 @item vect-epilogues-nomask
11856 Enable loop epilogue vectorization using smaller vector size.
11858 @item slp-max-insns-in-bb
11859 Maximum number of instructions in basic block to be
11860 considered for SLP vectorization.
11862 @item avoid-fma-max-bits
11863 Maximum number of bits for which we avoid creating FMAs.
11865 @item sms-loop-average-count-threshold
11866 A threshold on the average loop count considered by the swing modulo scheduler.
11868 @item sms-dfa-history
11869 The number of cycles the swing modulo scheduler considers when checking
11870 conflicts using DFA.
11872 @item hot-bb-count-fraction
11873 Select fraction of the maximal count of repetitions of basic block
11874 in program given basic block needs
11875 to have to be considered hot (used in non-LTO mode)
11877 @item max-inline-insns-recursive-auto
11878 The maximum number of instructions non-inline function
11879 can grow to via recursive inlining.
11881 @item graphite-allow-codegen-errors
11882 Whether codegen errors should be ICEs when @option{-fchecking}.
11884 @item sms-max-ii-factor
11885 A factor for tuning the upper bound that swing modulo scheduler
11886 uses for scheduling a loop.
11888 @item lra-max-considered-reload-pseudos
11889 The max number of reload pseudos which are considered during
11890 spilling a non-reload pseudo.
11892 @item max-pow-sqrt-depth
11893 Maximum depth of sqrt chains to use when synthesizing exponentiation
11894 by a real constant.
11896 @item max-dse-active-local-stores
11897 Maximum number of active local stores in RTL dead store elimination.
11899 @item asan-instrument-allocas
11900 Enable asan allocas/VLAs protection.
11902 @item max-iterations-computation-cost
11903 Bound on the cost of an expression to compute the number of iterations.
11905 @item max-isl-operations
11906 Maximum number of isl operations, 0 means unlimited.
11908 @item graphite-max-arrays-per-scop
11909 Maximum number of arrays per scop.
11911 @item max-vartrack-reverse-op-size
11912 Max. size of loc list for which reverse ops should be added.
11914 @item unlikely-bb-count-fraction
11915 The minimum fraction of profile runs a given basic block execution count
11916 must be not to be considered unlikely.
11918 @item tracer-dynamic-coverage-feedback
11919 The percentage of function, weighted by execution frequency,
11920 that must be covered by trace formation.
11921 Used when profile feedback is available.
11923 @item max-inline-recursive-depth-auto
11924 The maximum depth of recursive inlining for non-inline functions.
11926 @item fsm-scale-path-stmts
11927 Scale factor to apply to the number of statements in a threading path
11928 when comparing to the number of (scaled) blocks.
11930 @item fsm-maximum-phi-arguments
11931 Maximum number of arguments a PHI may have before the FSM threader
11932 will not try to thread through its block.
11934 @item uninit-control-dep-attempts
11935 Maximum number of nested calls to search for control dependencies
11936 during uninitialized variable analysis.
11938 @item indir-call-topn-profile
11939 Track top N target addresses in indirect-call profile.
11941 @item max-once-peeled-insns
11942 The maximum number of insns of a peeled loop that rolls only once.
11944 @item sra-max-scalarization-size-Osize
11945 Maximum size, in storage units, of an aggregate
11946 which should be considered for scalarization when compiling for size.
11948 @item fsm-scale-path-blocks
11949 Scale factor to apply to the number of blocks in a threading path
11950 when comparing to the number of (scaled) statements.
11952 @item sched-autopref-queue-depth
11953 Hardware autoprefetcher scheduler model control flag.
11954 Number of lookahead cycles the model looks into; at '
11955 ' only enable instruction sorting heuristic.
11961 @node Instrumentation Options
11962 @section Program Instrumentation Options
11963 @cindex instrumentation options
11964 @cindex program instrumentation options
11965 @cindex run-time error checking options
11966 @cindex profiling options
11967 @cindex options, program instrumentation
11968 @cindex options, run-time error checking
11969 @cindex options, profiling
11971 GCC supports a number of command-line options that control adding
11972 run-time instrumentation to the code it normally generates.
11973 For example, one purpose of instrumentation is collect profiling
11974 statistics for use in finding program hot spots, code coverage
11975 analysis, or profile-guided optimizations.
11976 Another class of program instrumentation is adding run-time checking
11977 to detect programming errors like invalid pointer
11978 dereferences or out-of-bounds array accesses, as well as deliberately
11979 hostile attacks such as stack smashing or C++ vtable hijacking.
11980 There is also a general hook which can be used to implement other
11981 forms of tracing or function-level instrumentation for debug or
11982 program analysis purposes.
11985 @cindex @command{prof}
11986 @cindex @command{gprof}
11991 Generate extra code to write profile information suitable for the
11992 analysis program @command{prof} (for @option{-p}) or @command{gprof}
11993 (for @option{-pg}). You must use this option when compiling
11994 the source files you want data about, and you must also use it when
11997 You can use the function attribute @code{no_instrument_function} to
11998 suppress profiling of individual functions when compiling with these options.
11999 @xref{Common Function Attributes}.
12001 @item -fprofile-arcs
12002 @opindex fprofile-arcs
12003 Add code so that program flow @dfn{arcs} are instrumented. During
12004 execution the program records how many times each branch and call is
12005 executed and how many times it is taken or returns. On targets that support
12006 constructors with priority support, profiling properly handles constructors,
12007 destructors and C++ constructors (and destructors) of classes which are used
12008 as a type of a global variable.
12011 program exits it saves this data to a file called
12012 @file{@var{auxname}.gcda} for each source file. The data may be used for
12013 profile-directed optimizations (@option{-fbranch-probabilities}), or for
12014 test coverage analysis (@option{-ftest-coverage}). Each object file's
12015 @var{auxname} is generated from the name of the output file, if
12016 explicitly specified and it is not the final executable, otherwise it is
12017 the basename of the source file. In both cases any suffix is removed
12018 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
12019 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
12020 @xref{Cross-profiling}.
12022 @cindex @command{gcov}
12026 This option is used to compile and link code instrumented for coverage
12027 analysis. The option is a synonym for @option{-fprofile-arcs}
12028 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
12029 linking). See the documentation for those options for more details.
12034 Compile the source files with @option{-fprofile-arcs} plus optimization
12035 and code generation options. For test coverage analysis, use the
12036 additional @option{-ftest-coverage} option. You do not need to profile
12037 every source file in a program.
12040 Compile the source files additionally with @option{-fprofile-abs-path}
12041 to create absolute path names in the @file{.gcno} files. This allows
12042 @command{gcov} to find the correct sources in projects where compilations
12043 occur with different working directories.
12046 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
12047 (the latter implies the former).
12050 Run the program on a representative workload to generate the arc profile
12051 information. This may be repeated any number of times. You can run
12052 concurrent instances of your program, and provided that the file system
12053 supports locking, the data files will be correctly updated. Unless
12054 a strict ISO C dialect option is in effect, @code{fork} calls are
12055 detected and correctly handled without double counting.
12058 For profile-directed optimizations, compile the source files again with
12059 the same optimization and code generation options plus
12060 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
12061 Control Optimization}).
12064 For test coverage analysis, use @command{gcov} to produce human readable
12065 information from the @file{.gcno} and @file{.gcda} files. Refer to the
12066 @command{gcov} documentation for further information.
12070 With @option{-fprofile-arcs}, for each function of your program GCC
12071 creates a program flow graph, then finds a spanning tree for the graph.
12072 Only arcs that are not on the spanning tree have to be instrumented: the
12073 compiler adds code to count the number of times that these arcs are
12074 executed. When an arc is the only exit or only entrance to a block, the
12075 instrumentation code can be added to the block; otherwise, a new basic
12076 block must be created to hold the instrumentation code.
12079 @item -ftest-coverage
12080 @opindex ftest-coverage
12081 Produce a notes file that the @command{gcov} code-coverage utility
12082 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
12083 show program coverage. Each source file's note file is called
12084 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
12085 above for a description of @var{auxname} and instructions on how to
12086 generate test coverage data. Coverage data matches the source files
12087 more closely if you do not optimize.
12089 @item -fprofile-abs-path
12090 @opindex fprofile-abs-path
12091 Automatically convert relative source file names to absolute path names
12092 in the @file{.gcno} files. This allows @command{gcov} to find the correct
12093 sources in projects where compilations occur with different working
12096 @item -fprofile-dir=@var{path}
12097 @opindex fprofile-dir
12099 Set the directory to search for the profile data files in to @var{path}.
12100 This option affects only the profile data generated by
12101 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
12102 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
12103 and its related options. Both absolute and relative paths can be used.
12104 By default, GCC uses the current directory as @var{path}, thus the
12105 profile data file appears in the same directory as the object file.
12106 In order to prevent the file name clashing, if the object file name is
12107 not an absolute path, we mangle the absolute path of the
12108 @file{@var{sourcename}.gcda} file and use it as the file name of a
12111 When an executable is run in a massive parallel environment, it is recommended
12112 to save profile to different folders. That can be done with variables
12113 in @var{path} that are exported during run-time:
12121 value of environment variable @var{VAR}
12125 @item -fprofile-generate
12126 @itemx -fprofile-generate=@var{path}
12127 @opindex fprofile-generate
12129 Enable options usually used for instrumenting application to produce
12130 profile useful for later recompilation with profile feedback based
12131 optimization. You must use @option{-fprofile-generate} both when
12132 compiling and when linking your program.
12134 The following options are enabled:
12135 @option{-fprofile-arcs}, @option{-fprofile-values},
12136 @option{-finline-functions}, and @option{-fipa-bit-cp}.
12138 If @var{path} is specified, GCC looks at the @var{path} to find
12139 the profile feedback data files. See @option{-fprofile-dir}.
12141 To optimize the program based on the collected profile information, use
12142 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
12144 @item -fprofile-update=@var{method}
12145 @opindex fprofile-update
12147 Alter the update method for an application instrumented for profile
12148 feedback based optimization. The @var{method} argument should be one of
12149 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
12150 The first one is useful for single-threaded applications,
12151 while the second one prevents profile corruption by emitting thread-safe code.
12153 @strong{Warning:} When an application does not properly join all threads
12154 (or creates an detached thread), a profile file can be still corrupted.
12156 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
12157 when supported by a target, or to @samp{single} otherwise. The GCC driver
12158 automatically selects @samp{prefer-atomic} when @option{-pthread}
12159 is present in the command line.
12161 @item -fprofile-filter-files=@var{regex}
12162 @opindex fprofile-filter-files
12164 Instrument only functions from files where names match
12165 any regular expression (separated by a semi-colon).
12167 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
12168 only @file{main.c} and all C files starting with 'module'.
12170 @item -fprofile-exclude-files=@var{regex}
12171 @opindex fprofile-exclude-files
12173 Instrument only functions from files where names do not match
12174 all the regular expressions (separated by a semi-colon).
12176 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
12177 of all files that are located in @file{/usr/} folder.
12179 @item -fsanitize=address
12180 @opindex fsanitize=address
12181 Enable AddressSanitizer, a fast memory error detector.
12182 Memory access instructions are instrumented to detect
12183 out-of-bounds and use-after-free bugs.
12184 The option enables @option{-fsanitize-address-use-after-scope}.
12185 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
12186 more details. The run-time behavior can be influenced using the
12187 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
12188 the available options are shown at startup of the instrumented program. See
12189 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
12190 for a list of supported options.
12191 The option cannot be combined with @option{-fsanitize=thread}.
12193 @item -fsanitize=kernel-address
12194 @opindex fsanitize=kernel-address
12195 Enable AddressSanitizer for Linux kernel.
12196 See @uref{https://github.com/google/kasan/wiki} for more details.
12198 @item -fsanitize=pointer-compare
12199 @opindex fsanitize=pointer-compare
12200 Instrument comparison operation (<, <=, >, >=) with pointer operands.
12201 The option must be combined with either @option{-fsanitize=kernel-address} or
12202 @option{-fsanitize=address}
12203 The option cannot be combined with @option{-fsanitize=thread}.
12204 Note: By default the check is disabled at run time. To enable it,
12205 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12206 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12207 invalid operation only when both pointers are non-null.
12209 @item -fsanitize=pointer-subtract
12210 @opindex fsanitize=pointer-subtract
12211 Instrument subtraction with pointer operands.
12212 The option must be combined with either @option{-fsanitize=kernel-address} or
12213 @option{-fsanitize=address}
12214 The option cannot be combined with @option{-fsanitize=thread}.
12215 Note: By default the check is disabled at run time. To enable it,
12216 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12217 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12218 invalid operation only when both pointers are non-null.
12220 @item -fsanitize=thread
12221 @opindex fsanitize=thread
12222 Enable ThreadSanitizer, a fast data race detector.
12223 Memory access instructions are instrumented to detect
12224 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
12225 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
12226 environment variable; see
12227 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
12229 The option cannot be combined with @option{-fsanitize=address},
12230 @option{-fsanitize=leak}.
12232 Note that sanitized atomic builtins cannot throw exceptions when
12233 operating on invalid memory addresses with non-call exceptions
12234 (@option{-fnon-call-exceptions}).
12236 @item -fsanitize=leak
12237 @opindex fsanitize=leak
12238 Enable LeakSanitizer, a memory leak detector.
12239 This option only matters for linking of executables and
12240 the executable is linked against a library that overrides @code{malloc}
12241 and other allocator functions. See
12242 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
12243 details. The run-time behavior can be influenced using the
12244 @env{LSAN_OPTIONS} environment variable.
12245 The option cannot be combined with @option{-fsanitize=thread}.
12247 @item -fsanitize=undefined
12248 @opindex fsanitize=undefined
12249 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
12250 Various computations are instrumented to detect undefined behavior
12251 at runtime. Current suboptions are:
12255 @item -fsanitize=shift
12256 @opindex fsanitize=shift
12257 This option enables checking that the result of a shift operation is
12258 not undefined. Note that what exactly is considered undefined differs
12259 slightly between C and C++, as well as between ISO C90 and C99, etc.
12260 This option has two suboptions, @option{-fsanitize=shift-base} and
12261 @option{-fsanitize=shift-exponent}.
12263 @item -fsanitize=shift-exponent
12264 @opindex fsanitize=shift-exponent
12265 This option enables checking that the second argument of a shift operation
12266 is not negative and is smaller than the precision of the promoted first
12269 @item -fsanitize=shift-base
12270 @opindex fsanitize=shift-base
12271 If the second argument of a shift operation is within range, check that the
12272 result of a shift operation is not undefined. Note that what exactly is
12273 considered undefined differs slightly between C and C++, as well as between
12274 ISO C90 and C99, etc.
12276 @item -fsanitize=integer-divide-by-zero
12277 @opindex fsanitize=integer-divide-by-zero
12278 Detect integer division by zero as well as @code{INT_MIN / -1} division.
12280 @item -fsanitize=unreachable
12281 @opindex fsanitize=unreachable
12282 With this option, the compiler turns the @code{__builtin_unreachable}
12283 call into a diagnostics message call instead. When reaching the
12284 @code{__builtin_unreachable} call, the behavior is undefined.
12286 @item -fsanitize=vla-bound
12287 @opindex fsanitize=vla-bound
12288 This option instructs the compiler to check that the size of a variable
12289 length array is positive.
12291 @item -fsanitize=null
12292 @opindex fsanitize=null
12293 This option enables pointer checking. Particularly, the application
12294 built with this option turned on will issue an error message when it
12295 tries to dereference a NULL pointer, or if a reference (possibly an
12296 rvalue reference) is bound to a NULL pointer, or if a method is invoked
12297 on an object pointed by a NULL pointer.
12299 @item -fsanitize=return
12300 @opindex fsanitize=return
12301 This option enables return statement checking. Programs
12302 built with this option turned on will issue an error message
12303 when the end of a non-void function is reached without actually
12304 returning a value. This option works in C++ only.
12306 @item -fsanitize=signed-integer-overflow
12307 @opindex fsanitize=signed-integer-overflow
12308 This option enables signed integer overflow checking. We check that
12309 the result of @code{+}, @code{*}, and both unary and binary @code{-}
12310 does not overflow in the signed arithmetics. Note, integer promotion
12311 rules must be taken into account. That is, the following is not an
12314 signed char a = SCHAR_MAX;
12318 @item -fsanitize=bounds
12319 @opindex fsanitize=bounds
12320 This option enables instrumentation of array bounds. Various out of bounds
12321 accesses are detected. Flexible array members, flexible array member-like
12322 arrays, and initializers of variables with static storage are not instrumented.
12324 @item -fsanitize=bounds-strict
12325 @opindex fsanitize=bounds-strict
12326 This option enables strict instrumentation of array bounds. Most out of bounds
12327 accesses are detected, including flexible array members and flexible array
12328 member-like arrays. Initializers of variables with static storage are not
12331 @item -fsanitize=alignment
12332 @opindex fsanitize=alignment
12334 This option enables checking of alignment of pointers when they are
12335 dereferenced, or when a reference is bound to insufficiently aligned target,
12336 or when a method or constructor is invoked on insufficiently aligned object.
12338 @item -fsanitize=object-size
12339 @opindex fsanitize=object-size
12340 This option enables instrumentation of memory references using the
12341 @code{__builtin_object_size} function. Various out of bounds pointer
12342 accesses are detected.
12344 @item -fsanitize=float-divide-by-zero
12345 @opindex fsanitize=float-divide-by-zero
12346 Detect floating-point division by zero. Unlike other similar options,
12347 @option{-fsanitize=float-divide-by-zero} is not enabled by
12348 @option{-fsanitize=undefined}, since floating-point division by zero can
12349 be a legitimate way of obtaining infinities and NaNs.
12351 @item -fsanitize=float-cast-overflow
12352 @opindex fsanitize=float-cast-overflow
12353 This option enables floating-point type to integer conversion checking.
12354 We check that the result of the conversion does not overflow.
12355 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
12356 not enabled by @option{-fsanitize=undefined}.
12357 This option does not work well with @code{FE_INVALID} exceptions enabled.
12359 @item -fsanitize=nonnull-attribute
12360 @opindex fsanitize=nonnull-attribute
12362 This option enables instrumentation of calls, checking whether null values
12363 are not passed to arguments marked as requiring a non-null value by the
12364 @code{nonnull} function attribute.
12366 @item -fsanitize=returns-nonnull-attribute
12367 @opindex fsanitize=returns-nonnull-attribute
12369 This option enables instrumentation of return statements in functions
12370 marked with @code{returns_nonnull} function attribute, to detect returning
12371 of null values from such functions.
12373 @item -fsanitize=bool
12374 @opindex fsanitize=bool
12376 This option enables instrumentation of loads from bool. If a value other
12377 than 0/1 is loaded, a run-time error is issued.
12379 @item -fsanitize=enum
12380 @opindex fsanitize=enum
12382 This option enables instrumentation of loads from an enum type. If
12383 a value outside the range of values for the enum type is loaded,
12384 a run-time error is issued.
12386 @item -fsanitize=vptr
12387 @opindex fsanitize=vptr
12389 This option enables instrumentation of C++ member function calls, member
12390 accesses and some conversions between pointers to base and derived classes,
12391 to verify the referenced object has the correct dynamic type.
12393 @item -fsanitize=pointer-overflow
12394 @opindex fsanitize=pointer-overflow
12396 This option enables instrumentation of pointer arithmetics. If the pointer
12397 arithmetics overflows, a run-time error is issued.
12399 @item -fsanitize=builtin
12400 @opindex fsanitize=builtin
12402 This option enables instrumentation of arguments to selected builtin
12403 functions. If an invalid value is passed to such arguments, a run-time
12404 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12405 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12410 While @option{-ftrapv} causes traps for signed overflows to be emitted,
12411 @option{-fsanitize=undefined} gives a diagnostic message.
12412 This currently works only for the C family of languages.
12414 @item -fno-sanitize=all
12415 @opindex fno-sanitize=all
12417 This option disables all previously enabled sanitizers.
12418 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12421 @item -fasan-shadow-offset=@var{number}
12422 @opindex fasan-shadow-offset
12423 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12424 It is useful for experimenting with different shadow memory layouts in
12425 Kernel AddressSanitizer.
12427 @item -fsanitize-sections=@var{s1},@var{s2},...
12428 @opindex fsanitize-sections
12429 Sanitize global variables in selected user-defined sections. @var{si} may
12432 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
12433 @opindex fsanitize-recover
12434 @opindex fno-sanitize-recover
12435 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
12436 mentioned in comma-separated list of @var{opts}. Enabling this option
12437 for a sanitizer component causes it to attempt to continue
12438 running the program as if no error happened. This means multiple
12439 runtime errors can be reported in a single program run, and the exit
12440 code of the program may indicate success even when errors
12441 have been reported. The @option{-fno-sanitize-recover=} option
12442 can be used to alter
12443 this behavior: only the first detected error is reported
12444 and program then exits with a non-zero exit code.
12446 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12447 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12448 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12449 @option{-fsanitize=bounds-strict},
12450 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12451 For these sanitizers error recovery is turned on by default,
12452 except @option{-fsanitize=address}, for which this feature is experimental.
12453 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12454 accepted, the former enables recovery for all sanitizers that support it,
12455 the latter disables recovery for all sanitizers that support it.
12457 Even if a recovery mode is turned on the compiler side, it needs to be also
12458 enabled on the runtime library side, otherwise the failures are still fatal.
12459 The runtime library defaults to @code{halt_on_error=0} for
12460 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12461 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12462 setting the @code{halt_on_error} flag in the corresponding environment variable.
12464 Syntax without an explicit @var{opts} parameter is deprecated. It is
12465 equivalent to specifying an @var{opts} list of:
12468 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12471 @item -fsanitize-address-use-after-scope
12472 @opindex fsanitize-address-use-after-scope
12473 Enable sanitization of local variables to detect use-after-scope bugs.
12474 The option sets @option{-fstack-reuse} to @samp{none}.
12476 @item -fsanitize-undefined-trap-on-error
12477 @opindex fsanitize-undefined-trap-on-error
12478 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12479 report undefined behavior using @code{__builtin_trap} rather than
12480 a @code{libubsan} library routine. The advantage of this is that the
12481 @code{libubsan} library is not needed and is not linked in, so this
12482 is usable even in freestanding environments.
12484 @item -fsanitize-coverage=trace-pc
12485 @opindex fsanitize-coverage=trace-pc
12486 Enable coverage-guided fuzzing code instrumentation.
12487 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12489 @item -fsanitize-coverage=trace-cmp
12490 @opindex fsanitize-coverage=trace-cmp
12491 Enable dataflow guided fuzzing code instrumentation.
12492 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12493 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12494 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12495 variable or @code{__sanitizer_cov_trace_const_cmp1},
12496 @code{__sanitizer_cov_trace_const_cmp2},
12497 @code{__sanitizer_cov_trace_const_cmp4} or
12498 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12499 operand constant, @code{__sanitizer_cov_trace_cmpf} or
12500 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12501 @code{__sanitizer_cov_trace_switch} for switch statements.
12503 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12504 @opindex fcf-protection
12505 Enable code instrumentation of control-flow transfers to increase
12506 program security by checking that target addresses of control-flow
12507 transfer instructions (such as indirect function call, function return,
12508 indirect jump) are valid. This prevents diverting the flow of control
12509 to an unexpected target. This is intended to protect against such
12510 threats as Return-oriented Programming (ROP), and similarly
12511 call/jmp-oriented programming (COP/JOP).
12513 The value @code{branch} tells the compiler to implement checking of
12514 validity of control-flow transfer at the point of indirect branch
12515 instructions, i.e.@: call/jmp instructions. The value @code{return}
12516 implements checking of validity at the point of returning from a
12517 function. The value @code{full} is an alias for specifying both
12518 @code{branch} and @code{return}. The value @code{none} turns off
12521 The macro @code{__CET__} is defined when @option{-fcf-protection} is
12522 used. The first bit of @code{__CET__} is set to 1 for the value
12523 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12526 You can also use the @code{nocf_check} attribute to identify
12527 which functions and calls should be skipped from instrumentation
12528 (@pxref{Function Attributes}).
12530 Currently the x86 GNU/Linux target provides an implementation based
12531 on Intel Control-flow Enforcement Technology (CET).
12533 @item -fstack-protector
12534 @opindex fstack-protector
12535 Emit extra code to check for buffer overflows, such as stack smashing
12536 attacks. This is done by adding a guard variable to functions with
12537 vulnerable objects. This includes functions that call @code{alloca}, and
12538 functions with buffers larger than 8 bytes. The guards are initialized
12539 when a function is entered and then checked when the function exits.
12540 If a guard check fails, an error message is printed and the program exits.
12542 @item -fstack-protector-all
12543 @opindex fstack-protector-all
12544 Like @option{-fstack-protector} except that all functions are protected.
12546 @item -fstack-protector-strong
12547 @opindex fstack-protector-strong
12548 Like @option{-fstack-protector} but includes additional functions to
12549 be protected --- those that have local array definitions, or have
12550 references to local frame addresses.
12552 @item -fstack-protector-explicit
12553 @opindex fstack-protector-explicit
12554 Like @option{-fstack-protector} but only protects those functions which
12555 have the @code{stack_protect} attribute.
12557 @item -fstack-check
12558 @opindex fstack-check
12559 Generate code to verify that you do not go beyond the boundary of the
12560 stack. You should specify this flag if you are running in an
12561 environment with multiple threads, but you only rarely need to specify it in
12562 a single-threaded environment since stack overflow is automatically
12563 detected on nearly all systems if there is only one stack.
12565 Note that this switch does not actually cause checking to be done; the
12566 operating system or the language runtime must do that. The switch causes
12567 generation of code to ensure that they see the stack being extended.
12569 You can additionally specify a string parameter: @samp{no} means no
12570 checking, @samp{generic} means force the use of old-style checking,
12571 @samp{specific} means use the best checking method and is equivalent
12572 to bare @option{-fstack-check}.
12574 Old-style checking is a generic mechanism that requires no specific
12575 target support in the compiler but comes with the following drawbacks:
12579 Modified allocation strategy for large objects: they are always
12580 allocated dynamically if their size exceeds a fixed threshold. Note this
12581 may change the semantics of some code.
12584 Fixed limit on the size of the static frame of functions: when it is
12585 topped by a particular function, stack checking is not reliable and
12586 a warning is issued by the compiler.
12589 Inefficiency: because of both the modified allocation strategy and the
12590 generic implementation, code performance is hampered.
12593 Note that old-style stack checking is also the fallback method for
12594 @samp{specific} if no target support has been added in the compiler.
12596 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
12597 and stack overflows. @samp{specific} is an excellent choice when compiling
12598 Ada code. It is not generally sufficient to protect against stack-clash
12599 attacks. To protect against those you want @samp{-fstack-clash-protection}.
12601 @item -fstack-clash-protection
12602 @opindex fstack-clash-protection
12603 Generate code to prevent stack clash style attacks. When this option is
12604 enabled, the compiler will only allocate one page of stack space at a time
12605 and each page is accessed immediately after allocation. Thus, it prevents
12606 allocations from jumping over any stack guard page provided by the
12609 Most targets do not fully support stack clash protection. However, on
12610 those targets @option{-fstack-clash-protection} will protect dynamic stack
12611 allocations. @option{-fstack-clash-protection} may also provide limited
12612 protection for static stack allocations if the target supports
12613 @option{-fstack-check=specific}.
12615 @item -fstack-limit-register=@var{reg}
12616 @itemx -fstack-limit-symbol=@var{sym}
12617 @itemx -fno-stack-limit
12618 @opindex fstack-limit-register
12619 @opindex fstack-limit-symbol
12620 @opindex fno-stack-limit
12621 Generate code to ensure that the stack does not grow beyond a certain value,
12622 either the value of a register or the address of a symbol. If a larger
12623 stack is required, a signal is raised at run time. For most targets,
12624 the signal is raised before the stack overruns the boundary, so
12625 it is possible to catch the signal without taking special precautions.
12627 For instance, if the stack starts at absolute address @samp{0x80000000}
12628 and grows downwards, you can use the flags
12629 @option{-fstack-limit-symbol=__stack_limit} and
12630 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
12631 of 128KB@. Note that this may only work with the GNU linker.
12633 You can locally override stack limit checking by using the
12634 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
12636 @item -fsplit-stack
12637 @opindex fsplit-stack
12638 Generate code to automatically split the stack before it overflows.
12639 The resulting program has a discontiguous stack which can only
12640 overflow if the program is unable to allocate any more memory. This
12641 is most useful when running threaded programs, as it is no longer
12642 necessary to calculate a good stack size to use for each thread. This
12643 is currently only implemented for the x86 targets running
12646 When code compiled with @option{-fsplit-stack} calls code compiled
12647 without @option{-fsplit-stack}, there may not be much stack space
12648 available for the latter code to run. If compiling all code,
12649 including library code, with @option{-fsplit-stack} is not an option,
12650 then the linker can fix up these calls so that the code compiled
12651 without @option{-fsplit-stack} always has a large stack. Support for
12652 this is implemented in the gold linker in GNU binutils release 2.21
12655 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
12656 @opindex fvtable-verify
12657 This option is only available when compiling C++ code.
12658 It turns on (or off, if using @option{-fvtable-verify=none}) the security
12659 feature that verifies at run time, for every virtual call, that
12660 the vtable pointer through which the call is made is valid for the type of
12661 the object, and has not been corrupted or overwritten. If an invalid vtable
12662 pointer is detected at run time, an error is reported and execution of the
12663 program is immediately halted.
12665 This option causes run-time data structures to be built at program startup,
12666 which are used for verifying the vtable pointers.
12667 The options @samp{std} and @samp{preinit}
12668 control the timing of when these data structures are built. In both cases the
12669 data structures are built before execution reaches @code{main}. Using
12670 @option{-fvtable-verify=std} causes the data structures to be built after
12671 shared libraries have been loaded and initialized.
12672 @option{-fvtable-verify=preinit} causes them to be built before shared
12673 libraries have been loaded and initialized.
12675 If this option appears multiple times in the command line with different
12676 values specified, @samp{none} takes highest priority over both @samp{std} and
12677 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
12680 @opindex fvtv-debug
12681 When used in conjunction with @option{-fvtable-verify=std} or
12682 @option{-fvtable-verify=preinit}, causes debug versions of the
12683 runtime functions for the vtable verification feature to be called.
12684 This flag also causes the compiler to log information about which
12685 vtable pointers it finds for each class.
12686 This information is written to a file named @file{vtv_set_ptr_data.log}
12687 in the directory named by the environment variable @env{VTV_LOGS_DIR}
12688 if that is defined or the current working directory otherwise.
12690 Note: This feature @emph{appends} data to the log file. If you want a fresh log
12691 file, be sure to delete any existing one.
12694 @opindex fvtv-counts
12695 This is a debugging flag. When used in conjunction with
12696 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
12697 causes the compiler to keep track of the total number of virtual calls
12698 it encounters and the number of verifications it inserts. It also
12699 counts the number of calls to certain run-time library functions
12700 that it inserts and logs this information for each compilation unit.
12701 The compiler writes this information to a file named
12702 @file{vtv_count_data.log} in the directory named by the environment
12703 variable @env{VTV_LOGS_DIR} if that is defined or the current working
12704 directory otherwise. It also counts the size of the vtable pointer sets
12705 for each class, and writes this information to @file{vtv_class_set_sizes.log}
12706 in the same directory.
12708 Note: This feature @emph{appends} data to the log files. To get fresh log
12709 files, be sure to delete any existing ones.
12711 @item -finstrument-functions
12712 @opindex finstrument-functions
12713 Generate instrumentation calls for entry and exit to functions. Just
12714 after function entry and just before function exit, the following
12715 profiling functions are called with the address of the current
12716 function and its call site. (On some platforms,
12717 @code{__builtin_return_address} does not work beyond the current
12718 function, so the call site information may not be available to the
12719 profiling functions otherwise.)
12722 void __cyg_profile_func_enter (void *this_fn,
12724 void __cyg_profile_func_exit (void *this_fn,
12728 The first argument is the address of the start of the current function,
12729 which may be looked up exactly in the symbol table.
12731 This instrumentation is also done for functions expanded inline in other
12732 functions. The profiling calls indicate where, conceptually, the
12733 inline function is entered and exited. This means that addressable
12734 versions of such functions must be available. If all your uses of a
12735 function are expanded inline, this may mean an additional expansion of
12736 code size. If you use @code{extern inline} in your C code, an
12737 addressable version of such functions must be provided. (This is
12738 normally the case anyway, but if you get lucky and the optimizer always
12739 expands the functions inline, you might have gotten away without
12740 providing static copies.)
12742 A function may be given the attribute @code{no_instrument_function}, in
12743 which case this instrumentation is not done. This can be used, for
12744 example, for the profiling functions listed above, high-priority
12745 interrupt routines, and any functions from which the profiling functions
12746 cannot safely be called (perhaps signal handlers, if the profiling
12747 routines generate output or allocate memory).
12748 @xref{Common Function Attributes}.
12750 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
12751 @opindex finstrument-functions-exclude-file-list
12753 Set the list of functions that are excluded from instrumentation (see
12754 the description of @option{-finstrument-functions}). If the file that
12755 contains a function definition matches with one of @var{file}, then
12756 that function is not instrumented. The match is done on substrings:
12757 if the @var{file} parameter is a substring of the file name, it is
12758 considered to be a match.
12763 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
12767 excludes any inline function defined in files whose pathnames
12768 contain @file{/bits/stl} or @file{include/sys}.
12770 If, for some reason, you want to include letter @samp{,} in one of
12771 @var{sym}, write @samp{\,}. For example,
12772 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
12773 (note the single quote surrounding the option).
12775 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
12776 @opindex finstrument-functions-exclude-function-list
12778 This is similar to @option{-finstrument-functions-exclude-file-list},
12779 but this option sets the list of function names to be excluded from
12780 instrumentation. The function name to be matched is its user-visible
12781 name, such as @code{vector<int> blah(const vector<int> &)}, not the
12782 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
12783 match is done on substrings: if the @var{sym} parameter is a substring
12784 of the function name, it is considered to be a match. For C99 and C++
12785 extended identifiers, the function name must be given in UTF-8, not
12786 using universal character names.
12788 @item -fpatchable-function-entry=@var{N}[,@var{M}]
12789 @opindex fpatchable-function-entry
12790 Generate @var{N} NOPs right at the beginning
12791 of each function, with the function entry point before the @var{M}th NOP.
12792 If @var{M} is omitted, it defaults to @code{0} so the
12793 function entry points to the address just at the first NOP.
12794 The NOP instructions reserve extra space which can be used to patch in
12795 any desired instrumentation at run time, provided that the code segment
12796 is writable. The amount of space is controllable indirectly via
12797 the number of NOPs; the NOP instruction used corresponds to the instruction
12798 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
12799 is target-specific and may also depend on the architecture variant and/or
12800 other compilation options.
12802 For run-time identification, the starting addresses of these areas,
12803 which correspond to their respective function entries minus @var{M},
12804 are additionally collected in the @code{__patchable_function_entries}
12805 section of the resulting binary.
12807 Note that the value of @code{__attribute__ ((patchable_function_entry
12808 (N,M)))} takes precedence over command-line option
12809 @option{-fpatchable-function-entry=N,M}. This can be used to increase
12810 the area size or to remove it completely on a single function.
12811 If @code{N=0}, no pad location is recorded.
12813 The NOP instructions are inserted at---and maybe before, depending on
12814 @var{M}---the function entry address, even before the prologue.
12819 @node Preprocessor Options
12820 @section Options Controlling the Preprocessor
12821 @cindex preprocessor options
12822 @cindex options, preprocessor
12824 These options control the C preprocessor, which is run on each C source
12825 file before actual compilation.
12827 If you use the @option{-E} option, nothing is done except preprocessing.
12828 Some of these options make sense only together with @option{-E} because
12829 they cause the preprocessor output to be unsuitable for actual
12832 In addition to the options listed here, there are a number of options
12833 to control search paths for include files documented in
12834 @ref{Directory Options}.
12835 Options to control preprocessor diagnostics are listed in
12836 @ref{Warning Options}.
12839 @include cppopts.texi
12841 @item -Wp,@var{option}
12843 You can use @option{-Wp,@var{option}} to bypass the compiler driver
12844 and pass @var{option} directly through to the preprocessor. If
12845 @var{option} contains commas, it is split into multiple options at the
12846 commas. However, many options are modified, translated or interpreted
12847 by the compiler driver before being passed to the preprocessor, and
12848 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
12849 interface is undocumented and subject to change, so whenever possible
12850 you should avoid using @option{-Wp} and let the driver handle the
12853 @item -Xpreprocessor @var{option}
12854 @opindex Xpreprocessor
12855 Pass @var{option} as an option to the preprocessor. You can use this to
12856 supply system-specific preprocessor options that GCC does not
12859 If you want to pass an option that takes an argument, you must use
12860 @option{-Xpreprocessor} twice, once for the option and once for the argument.
12862 @item -no-integrated-cpp
12863 @opindex no-integrated-cpp
12864 Perform preprocessing as a separate pass before compilation.
12865 By default, GCC performs preprocessing as an integrated part of
12866 input tokenization and parsing.
12867 If this option is provided, the appropriate language front end
12868 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
12869 and Objective-C, respectively) is instead invoked twice,
12870 once for preprocessing only and once for actual compilation
12871 of the preprocessed input.
12872 This option may be useful in conjunction with the @option{-B} or
12873 @option{-wrapper} options to specify an alternate preprocessor or
12874 perform additional processing of the program source between
12875 normal preprocessing and compilation.
12879 @node Assembler Options
12880 @section Passing Options to the Assembler
12882 @c prevent bad page break with this line
12883 You can pass options to the assembler.
12886 @item -Wa,@var{option}
12888 Pass @var{option} as an option to the assembler. If @var{option}
12889 contains commas, it is split into multiple options at the commas.
12891 @item -Xassembler @var{option}
12892 @opindex Xassembler
12893 Pass @var{option} as an option to the assembler. You can use this to
12894 supply system-specific assembler options that GCC does not
12897 If you want to pass an option that takes an argument, you must use
12898 @option{-Xassembler} twice, once for the option and once for the argument.
12903 @section Options for Linking
12904 @cindex link options
12905 @cindex options, linking
12907 These options come into play when the compiler links object files into
12908 an executable output file. They are meaningless if the compiler is
12909 not doing a link step.
12913 @item @var{object-file-name}
12914 A file name that does not end in a special recognized suffix is
12915 considered to name an object file or library. (Object files are
12916 distinguished from libraries by the linker according to the file
12917 contents.) If linking is done, these object files are used as input
12926 If any of these options is used, then the linker is not run, and
12927 object file names should not be used as arguments. @xref{Overall
12930 @item -flinker-output=@var{type}
12931 @opindex flinker-output
12932 This option controls the code generation of the link time optimizer. By
12933 default the linker output is determined by the linker plugin automatically. For
12934 debugging the compiler and in the case of incremental linking to non-lto object
12935 file is desired, it may be useful to control the type manually.
12937 If @var{type} is @samp{exec} the code generation is configured to produce static
12938 binary. In this case @option{-fpic} and @option{-fpie} are both disabled.
12940 If @var{type} is @samp{dyn} the code generation is configured to produce shared
12941 library. In this case @option{-fpic} or @option{-fPIC} is preserved, but not
12942 enabled automatically. This makes it possible to build shared libraries without
12943 position independent code on architectures this is possible, i.e.@: on x86.
12945 If @var{type} is @samp{pie} the code generation is configured to produce
12946 @option{-fpie} executable. This result in similar optimizations as @samp{exec}
12947 except that @option{-fpie} is not disabled if specified at compilation time.
12949 If @var{type} is @samp{rel} the compiler assumes that incremental linking is
12950 done. The sections containing intermediate code for link-time optimization are
12951 merged, pre-optimized, and output to the resulting object file. In addition, if
12952 @option{-ffat-lto-objects} is specified the binary code is produced for future
12953 non-lto linking. The object file produced by incremental linking will be smaller
12954 than a static library produced from the same object files. At link-time the
12955 result of incremental linking will also load faster to compiler than a static
12956 library assuming that majority of objects in the library are used.
12958 Finally @samp{nolto-rel} configure compiler to for incremental linking where
12959 code generation is forced, final binary is produced and the intermediate code
12960 for later link-time optimization is stripped. When multiple object files are
12961 linked together the resulting code will be optimized better than with link time
12962 optimizations disabled (for example, the cross-module inlining will happen),
12963 most of benefits of whole program optimizations are however lost.
12965 During the incremental link (by @option{-r}) the linker plugin will default to
12966 @option{rel}. With current interfaces to GNU Binutils it is however not
12967 possible to link incrementally LTO objects and non-LTO objects into a single
12968 mixed object file. In the case any of object files in incremental link can not
12969 be used for link-time optimization the linker plugin will output warning and
12970 use @samp{nolto-rel}. To maintain the whole program optimization it is
12971 recommended to link such objects into static library instead. Alternatively it
12972 is possible to use H.J. Lu's binutils with support for mixed objects.
12975 @opindex fuse-ld=bfd
12976 Use the @command{bfd} linker instead of the default linker.
12978 @item -fuse-ld=gold
12979 @opindex fuse-ld=gold
12980 Use the @command{gold} linker instead of the default linker.
12983 @opindex fuse-ld=lld
12984 Use the LLVM @command{lld} linker instead of the default linker.
12987 @item -l@var{library}
12988 @itemx -l @var{library}
12990 Search the library named @var{library} when linking. (The second
12991 alternative with the library as a separate argument is only for
12992 POSIX compliance and is not recommended.)
12994 The @option{-l} option is passed directly to the linker by GCC. Refer
12995 to your linker documentation for exact details. The general
12996 description below applies to the GNU linker.
12998 The linker searches a standard list of directories for the library.
12999 The directories searched include several standard system directories
13000 plus any that you specify with @option{-L}.
13002 Static libraries are archives of object files, and have file names
13003 like @file{lib@var{library}.a}. Some targets also support shared
13004 libraries, which typically have names like @file{lib@var{library}.so}.
13005 If both static and shared libraries are found, the linker gives
13006 preference to linking with the shared library unless the
13007 @option{-static} option is used.
13009 It makes a difference where in the command you write this option; the
13010 linker searches and processes libraries and object files in the order they
13011 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
13012 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
13013 to functions in @samp{z}, those functions may not be loaded.
13017 You need this special case of the @option{-l} option in order to
13018 link an Objective-C or Objective-C++ program.
13020 @item -nostartfiles
13021 @opindex nostartfiles
13022 Do not use the standard system startup files when linking.
13023 The standard system libraries are used normally, unless @option{-nostdlib},
13024 @option{-nolibc}, or @option{-nodefaultlibs} is used.
13026 @item -nodefaultlibs
13027 @opindex nodefaultlibs
13028 Do not use the standard system libraries when linking.
13029 Only the libraries you specify are passed to the linker, and options
13030 specifying linkage of the system libraries, such as @option{-static-libgcc}
13031 or @option{-shared-libgcc}, are ignored.
13032 The standard startup files are used normally, unless @option{-nostartfiles}
13035 The compiler may generate calls to @code{memcmp},
13036 @code{memset}, @code{memcpy} and @code{memmove}.
13037 These entries are usually resolved by entries in
13038 libc. These entry points should be supplied through some other
13039 mechanism when this option is specified.
13043 Do not use the C library or system libraries tightly coupled with it when
13044 linking. Still link with the startup files, @file{libgcc} or toolchain
13045 provided language support libraries such as @file{libgnat}, @file{libgfortran}
13046 or @file{libstdc++} unless options preventing their inclusion are used as
13047 well. This typically removes @option{-lc} from the link command line, as well
13048 as system libraries that normally go with it and become meaningless when
13049 absence of a C library is assumed, for example @option{-lpthread} or
13050 @option{-lm} in some configurations. This is intended for bare-board
13051 targets when there is indeed no C library available.
13055 Do not use the standard system startup files or libraries when linking.
13056 No startup files and only the libraries you specify are passed to
13057 the linker, and options specifying linkage of the system libraries, such as
13058 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
13060 The compiler may generate calls to @code{memcmp}, @code{memset},
13061 @code{memcpy} and @code{memmove}.
13062 These entries are usually resolved by entries in
13063 libc. These entry points should be supplied through some other
13064 mechanism when this option is specified.
13066 @cindex @option{-lgcc}, use with @option{-nostdlib}
13067 @cindex @option{-nostdlib} and unresolved references
13068 @cindex unresolved references and @option{-nostdlib}
13069 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
13070 @cindex @option{-nodefaultlibs} and unresolved references
13071 @cindex unresolved references and @option{-nodefaultlibs}
13072 One of the standard libraries bypassed by @option{-nostdlib} and
13073 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
13074 which GCC uses to overcome shortcomings of particular machines, or special
13075 needs for some languages.
13076 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
13077 Collection (GCC) Internals},
13078 for more discussion of @file{libgcc.a}.)
13079 In most cases, you need @file{libgcc.a} even when you want to avoid
13080 other standard libraries. In other words, when you specify @option{-nostdlib}
13081 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
13082 This ensures that you have no unresolved references to internal GCC
13083 library subroutines.
13084 (An example of such an internal subroutine is @code{__main}, used to ensure C++
13085 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
13086 GNU Compiler Collection (GCC) Internals}.)
13088 @item -e @var{entry}
13089 @itemx --entry=@var{entry}
13093 Specify that the program entry point is @var{entry}. The argument is
13094 interpreted by the linker; the GNU linker accepts either a symbol name
13099 Produce a dynamically linked position independent executable on targets
13100 that support it. For predictable results, you must also specify the same
13101 set of options used for compilation (@option{-fpie}, @option{-fPIE},
13102 or model suboptions) when you specify this linker option.
13106 Don't produce a dynamically linked position independent executable.
13109 @opindex static-pie
13110 Produce a static position independent executable on targets that support
13111 it. A static position independent executable is similar to a static
13112 executable, but can be loaded at any address without a dynamic linker.
13113 For predictable results, you must also specify the same set of options
13114 used for compilation (@option{-fpie}, @option{-fPIE}, or model
13115 suboptions) when you specify this linker option.
13119 Link with the POSIX threads library. This option is supported on
13120 GNU/Linux targets, most other Unix derivatives, and also on
13121 x86 Cygwin and MinGW targets. On some targets this option also sets
13122 flags for the preprocessor, so it should be used consistently for both
13123 compilation and linking.
13127 Produce a relocatable object as output. This is also known as partial
13132 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
13133 that support it. This instructs the linker to add all symbols, not
13134 only used ones, to the dynamic symbol table. This option is needed
13135 for some uses of @code{dlopen} or to allow obtaining backtraces
13136 from within a program.
13140 Remove all symbol table and relocation information from the executable.
13144 On systems that support dynamic linking, this overrides @option{-pie}
13145 and prevents linking with the shared libraries. On other systems, this
13146 option has no effect.
13150 Produce a shared object which can then be linked with other objects to
13151 form an executable. Not all systems support this option. For predictable
13152 results, you must also specify the same set of options used for compilation
13153 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
13154 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
13155 needs to build supplementary stub code for constructors to work. On
13156 multi-libbed systems, @samp{gcc -shared} must select the correct support
13157 libraries to link against. Failing to supply the correct flags may lead
13158 to subtle defects. Supplying them in cases where they are not necessary
13161 @item -shared-libgcc
13162 @itemx -static-libgcc
13163 @opindex shared-libgcc
13164 @opindex static-libgcc
13165 On systems that provide @file{libgcc} as a shared library, these options
13166 force the use of either the shared or static version, respectively.
13167 If no shared version of @file{libgcc} was built when the compiler was
13168 configured, these options have no effect.
13170 There are several situations in which an application should use the
13171 shared @file{libgcc} instead of the static version. The most common
13172 of these is when the application wishes to throw and catch exceptions
13173 across different shared libraries. In that case, each of the libraries
13174 as well as the application itself should use the shared @file{libgcc}.
13176 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
13177 whenever you build a shared library or a main executable, because C++
13178 programs typically use exceptions, so this is the right thing to do.
13180 If, instead, you use the GCC driver to create shared libraries, you may
13181 find that they are not always linked with the shared @file{libgcc}.
13182 If GCC finds, at its configuration time, that you have a non-GNU linker
13183 or a GNU linker that does not support option @option{--eh-frame-hdr},
13184 it links the shared version of @file{libgcc} into shared libraries
13185 by default. Otherwise, it takes advantage of the linker and optimizes
13186 away the linking with the shared version of @file{libgcc}, linking with
13187 the static version of libgcc by default. This allows exceptions to
13188 propagate through such shared libraries, without incurring relocation
13189 costs at library load time.
13191 However, if a library or main executable is supposed to throw or catch
13192 exceptions, you must link it using the G++ driver, or using the option
13193 @option{-shared-libgcc}, such that it is linked with the shared
13196 @item -static-libasan
13197 @opindex static-libasan
13198 When the @option{-fsanitize=address} option is used to link a program,
13199 the GCC driver automatically links against @option{libasan}. If
13200 @file{libasan} is available as a shared library, and the @option{-static}
13201 option is not used, then this links against the shared version of
13202 @file{libasan}. The @option{-static-libasan} option directs the GCC
13203 driver to link @file{libasan} statically, without necessarily linking
13204 other libraries statically.
13206 @item -static-libtsan
13207 @opindex static-libtsan
13208 When the @option{-fsanitize=thread} option is used to link a program,
13209 the GCC driver automatically links against @option{libtsan}. If
13210 @file{libtsan} is available as a shared library, and the @option{-static}
13211 option is not used, then this links against the shared version of
13212 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
13213 driver to link @file{libtsan} statically, without necessarily linking
13214 other libraries statically.
13216 @item -static-liblsan
13217 @opindex static-liblsan
13218 When the @option{-fsanitize=leak} option is used to link a program,
13219 the GCC driver automatically links against @option{liblsan}. If
13220 @file{liblsan} is available as a shared library, and the @option{-static}
13221 option is not used, then this links against the shared version of
13222 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
13223 driver to link @file{liblsan} statically, without necessarily linking
13224 other libraries statically.
13226 @item -static-libubsan
13227 @opindex static-libubsan
13228 When the @option{-fsanitize=undefined} option is used to link a program,
13229 the GCC driver automatically links against @option{libubsan}. If
13230 @file{libubsan} is available as a shared library, and the @option{-static}
13231 option is not used, then this links against the shared version of
13232 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
13233 driver to link @file{libubsan} statically, without necessarily linking
13234 other libraries statically.
13236 @item -static-libstdc++
13237 @opindex static-libstdc++
13238 When the @command{g++} program is used to link a C++ program, it
13239 normally automatically links against @option{libstdc++}. If
13240 @file{libstdc++} is available as a shared library, and the
13241 @option{-static} option is not used, then this links against the
13242 shared version of @file{libstdc++}. That is normally fine. However, it
13243 is sometimes useful to freeze the version of @file{libstdc++} used by
13244 the program without going all the way to a fully static link. The
13245 @option{-static-libstdc++} option directs the @command{g++} driver to
13246 link @file{libstdc++} statically, without necessarily linking other
13247 libraries statically.
13251 Bind references to global symbols when building a shared object. Warn
13252 about any unresolved references (unless overridden by the link editor
13253 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
13256 @item -T @var{script}
13258 @cindex linker script
13259 Use @var{script} as the linker script. This option is supported by most
13260 systems using the GNU linker. On some targets, such as bare-board
13261 targets without an operating system, the @option{-T} option may be required
13262 when linking to avoid references to undefined symbols.
13264 @item -Xlinker @var{option}
13266 Pass @var{option} as an option to the linker. You can use this to
13267 supply system-specific linker options that GCC does not recognize.
13269 If you want to pass an option that takes a separate argument, you must use
13270 @option{-Xlinker} twice, once for the option and once for the argument.
13271 For example, to pass @option{-assert definitions}, you must write
13272 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
13273 @option{-Xlinker "-assert definitions"}, because this passes the entire
13274 string as a single argument, which is not what the linker expects.
13276 When using the GNU linker, it is usually more convenient to pass
13277 arguments to linker options using the @option{@var{option}=@var{value}}
13278 syntax than as separate arguments. For example, you can specify
13279 @option{-Xlinker -Map=output.map} rather than
13280 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
13281 this syntax for command-line options.
13283 @item -Wl,@var{option}
13285 Pass @var{option} as an option to the linker. If @var{option} contains
13286 commas, it is split into multiple options at the commas. You can use this
13287 syntax to pass an argument to the option.
13288 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
13289 linker. When using the GNU linker, you can also get the same effect with
13290 @option{-Wl,-Map=output.map}.
13292 @item -u @var{symbol}
13294 Pretend the symbol @var{symbol} is undefined, to force linking of
13295 library modules to define it. You can use @option{-u} multiple times with
13296 different symbols to force loading of additional library modules.
13298 @item -z @var{keyword}
13300 @option{-z} is passed directly on to the linker along with the keyword
13301 @var{keyword}. See the section in the documentation of your linker for
13302 permitted values and their meanings.
13305 @node Directory Options
13306 @section Options for Directory Search
13307 @cindex directory options
13308 @cindex options, directory search
13309 @cindex search path
13311 These options specify directories to search for header files, for
13312 libraries and for parts of the compiler:
13315 @include cppdiropts.texi
13317 @item -iplugindir=@var{dir}
13318 @opindex iplugindir=
13319 Set the directory to search for plugins that are passed
13320 by @option{-fplugin=@var{name}} instead of
13321 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
13322 to be used by the user, but only passed by the driver.
13326 Add directory @var{dir} to the list of directories to be searched
13329 @item -B@var{prefix}
13331 This option specifies where to find the executables, libraries,
13332 include files, and data files of the compiler itself.
13334 The compiler driver program runs one or more of the subprograms
13335 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
13336 @var{prefix} as a prefix for each program it tries to run, both with and
13337 without @samp{@var{machine}/@var{version}/} for the corresponding target
13338 machine and compiler version.
13340 For each subprogram to be run, the compiler driver first tries the
13341 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
13342 is not specified, the driver tries two standard prefixes,
13343 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
13344 those results in a file name that is found, the unmodified program
13345 name is searched for using the directories specified in your
13346 @env{PATH} environment variable.
13348 The compiler checks to see if the path provided by @option{-B}
13349 refers to a directory, and if necessary it adds a directory
13350 separator character at the end of the path.
13352 @option{-B} prefixes that effectively specify directory names also apply
13353 to libraries in the linker, because the compiler translates these
13354 options into @option{-L} options for the linker. They also apply to
13355 include files in the preprocessor, because the compiler translates these
13356 options into @option{-isystem} options for the preprocessor. In this case,
13357 the compiler appends @samp{include} to the prefix.
13359 The runtime support file @file{libgcc.a} can also be searched for using
13360 the @option{-B} prefix, if needed. If it is not found there, the two
13361 standard prefixes above are tried, and that is all. The file is left
13362 out of the link if it is not found by those means.
13364 Another way to specify a prefix much like the @option{-B} prefix is to use
13365 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
13368 As a special kludge, if the path provided by @option{-B} is
13369 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
13370 9, then it is replaced by @file{[dir/]include}. This is to help
13371 with boot-strapping the compiler.
13373 @item -no-canonical-prefixes
13374 @opindex no-canonical-prefixes
13375 Do not expand any symbolic links, resolve references to @samp{/../}
13376 or @samp{/./}, or make the path absolute when generating a relative
13379 @item --sysroot=@var{dir}
13381 Use @var{dir} as the logical root directory for headers and libraries.
13382 For example, if the compiler normally searches for headers in
13383 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
13384 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13386 If you use both this option and the @option{-isysroot} option, then
13387 the @option{--sysroot} option applies to libraries, but the
13388 @option{-isysroot} option applies to header files.
13390 The GNU linker (beginning with version 2.16) has the necessary support
13391 for this option. If your linker does not support this option, the
13392 header file aspect of @option{--sysroot} still works, but the
13393 library aspect does not.
13395 @item --no-sysroot-suffix
13396 @opindex no-sysroot-suffix
13397 For some targets, a suffix is added to the root directory specified
13398 with @option{--sysroot}, depending on the other options used, so that
13399 headers may for example be found in
13400 @file{@var{dir}/@var{suffix}/usr/include} instead of
13401 @file{@var{dir}/usr/include}. This option disables the addition of
13406 @node Code Gen Options
13407 @section Options for Code Generation Conventions
13408 @cindex code generation conventions
13409 @cindex options, code generation
13410 @cindex run-time options
13412 These machine-independent options control the interface conventions
13413 used in code generation.
13415 Most of them have both positive and negative forms; the negative form
13416 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
13417 one of the forms is listed---the one that is not the default. You
13418 can figure out the other form by either removing @samp{no-} or adding
13422 @item -fstack-reuse=@var{reuse-level}
13423 @opindex fstack_reuse
13424 This option controls stack space reuse for user declared local/auto variables
13425 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
13426 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13427 local variables and temporaries, @samp{named_vars} enables the reuse only for
13428 user defined local variables with names, and @samp{none} disables stack reuse
13429 completely. The default value is @samp{all}. The option is needed when the
13430 program extends the lifetime of a scoped local variable or a compiler generated
13431 temporary beyond the end point defined by the language. When a lifetime of
13432 a variable ends, and if the variable lives in memory, the optimizing compiler
13433 has the freedom to reuse its stack space with other temporaries or scoped
13434 local variables whose live range does not overlap with it. Legacy code extending
13435 local lifetime is likely to break with the stack reuse optimization.
13454 if (*p == 10) // out of scope use of local1
13465 A(int k) : i(k), j(k) @{ @}
13472 void foo(const A& ar)
13479 foo(A(10)); // temp object's lifetime ends when foo returns
13485 ap->i+= 10; // ap references out of scope temp whose space
13486 // is reused with a. What is the value of ap->i?
13491 The lifetime of a compiler generated temporary is well defined by the C++
13492 standard. When a lifetime of a temporary ends, and if the temporary lives
13493 in memory, the optimizing compiler has the freedom to reuse its stack
13494 space with other temporaries or scoped local variables whose live range
13495 does not overlap with it. However some of the legacy code relies on
13496 the behavior of older compilers in which temporaries' stack space is
13497 not reused, the aggressive stack reuse can lead to runtime errors. This
13498 option is used to control the temporary stack reuse optimization.
13502 This option generates traps for signed overflow on addition, subtraction,
13503 multiplication operations.
13504 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13505 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13506 @option{-fwrapv} being effective. Note that only active options override, so
13507 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13508 results in @option{-ftrapv} being effective.
13512 This option instructs the compiler to assume that signed arithmetic
13513 overflow of addition, subtraction and multiplication wraps around
13514 using twos-complement representation. This flag enables some optimizations
13515 and disables others.
13516 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13517 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13518 @option{-fwrapv} being effective. Note that only active options override, so
13519 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13520 results in @option{-ftrapv} being effective.
13522 @item -fwrapv-pointer
13523 @opindex fwrapv-pointer
13524 This option instructs the compiler to assume that pointer arithmetic
13525 overflow on addition and subtraction wraps around using twos-complement
13526 representation. This flag disables some optimizations which assume
13527 pointer overflow is invalid.
13529 @item -fstrict-overflow
13530 @opindex fstrict-overflow
13531 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13532 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13535 @opindex fexceptions
13536 Enable exception handling. Generates extra code needed to propagate
13537 exceptions. For some targets, this implies GCC generates frame
13538 unwind information for all functions, which can produce significant data
13539 size overhead, although it does not affect execution. If you do not
13540 specify this option, GCC enables it by default for languages like
13541 C++ that normally require exception handling, and disables it for
13542 languages like C that do not normally require it. However, you may need
13543 to enable this option when compiling C code that needs to interoperate
13544 properly with exception handlers written in C++. You may also wish to
13545 disable this option if you are compiling older C++ programs that don't
13546 use exception handling.
13548 @item -fnon-call-exceptions
13549 @opindex fnon-call-exceptions
13550 Generate code that allows trapping instructions to throw exceptions.
13551 Note that this requires platform-specific runtime support that does
13552 not exist everywhere. Moreover, it only allows @emph{trapping}
13553 instructions to throw exceptions, i.e.@: memory references or floating-point
13554 instructions. It does not allow exceptions to be thrown from
13555 arbitrary signal handlers such as @code{SIGALRM}.
13557 @item -fdelete-dead-exceptions
13558 @opindex fdelete-dead-exceptions
13559 Consider that instructions that may throw exceptions but don't otherwise
13560 contribute to the execution of the program can be optimized away.
13561 This option is enabled by default for the Ada front end, as permitted by
13562 the Ada language specification.
13563 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
13565 @item -funwind-tables
13566 @opindex funwind-tables
13567 Similar to @option{-fexceptions}, except that it just generates any needed
13568 static data, but does not affect the generated code in any other way.
13569 You normally do not need to enable this option; instead, a language processor
13570 that needs this handling enables it on your behalf.
13572 @item -fasynchronous-unwind-tables
13573 @opindex fasynchronous-unwind-tables
13574 Generate unwind table in DWARF format, if supported by target machine. The
13575 table is exact at each instruction boundary, so it can be used for stack
13576 unwinding from asynchronous events (such as debugger or garbage collector).
13578 @item -fno-gnu-unique
13579 @opindex fno-gnu-unique
13580 @opindex fgnu-unique
13581 On systems with recent GNU assembler and C library, the C++ compiler
13582 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
13583 of template static data members and static local variables in inline
13584 functions are unique even in the presence of @code{RTLD_LOCAL}; this
13585 is necessary to avoid problems with a library used by two different
13586 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
13587 therefore disagreeing with the other one about the binding of the
13588 symbol. But this causes @code{dlclose} to be ignored for affected
13589 DSOs; if your program relies on reinitialization of a DSO via
13590 @code{dlclose} and @code{dlopen}, you can use
13591 @option{-fno-gnu-unique}.
13593 @item -fpcc-struct-return
13594 @opindex fpcc-struct-return
13595 Return ``short'' @code{struct} and @code{union} values in memory like
13596 longer ones, rather than in registers. This convention is less
13597 efficient, but it has the advantage of allowing intercallability between
13598 GCC-compiled files and files compiled with other compilers, particularly
13599 the Portable C Compiler (pcc).
13601 The precise convention for returning structures in memory depends
13602 on the target configuration macros.
13604 Short structures and unions are those whose size and alignment match
13605 that of some integer type.
13607 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13608 switch is not binary compatible with code compiled with the
13609 @option{-freg-struct-return} switch.
13610 Use it to conform to a non-default application binary interface.
13612 @item -freg-struct-return
13613 @opindex freg-struct-return
13614 Return @code{struct} and @code{union} values in registers when possible.
13615 This is more efficient for small structures than
13616 @option{-fpcc-struct-return}.
13618 If you specify neither @option{-fpcc-struct-return} nor
13619 @option{-freg-struct-return}, GCC defaults to whichever convention is
13620 standard for the target. If there is no standard convention, GCC
13621 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13622 the principal compiler. In those cases, we can choose the standard, and
13623 we chose the more efficient register return alternative.
13625 @strong{Warning:} code compiled with the @option{-freg-struct-return}
13626 switch is not binary compatible with code compiled with the
13627 @option{-fpcc-struct-return} switch.
13628 Use it to conform to a non-default application binary interface.
13630 @item -fshort-enums
13631 @opindex fshort-enums
13632 Allocate to an @code{enum} type only as many bytes as it needs for the
13633 declared range of possible values. Specifically, the @code{enum} type
13634 is equivalent to the smallest integer type that has enough room.
13636 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13637 code that is not binary compatible with code generated without that switch.
13638 Use it to conform to a non-default application binary interface.
13640 @item -fshort-wchar
13641 @opindex fshort-wchar
13642 Override the underlying type for @code{wchar_t} to be @code{short
13643 unsigned int} instead of the default for the target. This option is
13644 useful for building programs to run under WINE@.
13646 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13647 code that is not binary compatible with code generated without that switch.
13648 Use it to conform to a non-default application binary interface.
13651 @opindex fno-common
13653 @cindex tentative definitions
13654 In C code, this option controls the placement of global variables
13655 defined without an initializer, known as @dfn{tentative definitions}
13656 in the C standard. Tentative definitions are distinct from declarations
13657 of a variable with the @code{extern} keyword, which do not allocate storage.
13659 Unix C compilers have traditionally allocated storage for
13660 uninitialized global variables in a common block. This allows the
13661 linker to resolve all tentative definitions of the same variable
13662 in different compilation units to the same object, or to a non-tentative
13664 This is the behavior specified by @option{-fcommon}, and is the default for
13665 GCC on most targets.
13666 On the other hand, this behavior is not required by ISO
13667 C, and on some targets may carry a speed or code size penalty on
13668 variable references.
13670 The @option{-fno-common} option specifies that the compiler should instead
13671 place uninitialized global variables in the BSS section of the object file.
13672 This inhibits the merging of tentative definitions by the linker so
13673 you get a multiple-definition error if the same
13674 variable is defined in more than one compilation unit.
13675 Compiling with @option{-fno-common} is useful on targets for which
13676 it provides better performance, or if you wish to verify that the
13677 program will work on other systems that always treat uninitialized
13678 variable definitions this way.
13683 Ignore the @code{#ident} directive.
13685 @item -finhibit-size-directive
13686 @opindex finhibit-size-directive
13687 Don't output a @code{.size} assembler directive, or anything else that
13688 would cause trouble if the function is split in the middle, and the
13689 two halves are placed at locations far apart in memory. This option is
13690 used when compiling @file{crtstuff.c}; you should not need to use it
13693 @item -fverbose-asm
13694 @opindex fverbose-asm
13695 Put extra commentary information in the generated assembly code to
13696 make it more readable. This option is generally only of use to those
13697 who actually need to read the generated assembly code (perhaps while
13698 debugging the compiler itself).
13700 @option{-fno-verbose-asm}, the default, causes the
13701 extra information to be omitted and is useful when comparing two assembler
13704 The added comments include:
13709 information on the compiler version and command-line options,
13712 the source code lines associated with the assembly instructions,
13713 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
13716 hints on which high-level expressions correspond to
13717 the various assembly instruction operands.
13721 For example, given this C source file:
13729 for (i = 0; i < n; i++)
13736 compiling to (x86_64) assembly via @option{-S} and emitting the result
13737 direct to stdout via @option{-o} @option{-}
13740 gcc -S test.c -fverbose-asm -Os -o -
13743 gives output similar to this:
13747 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
13754 .type test, @@function
13758 # test.c:4: int total = 0;
13759 xorl %eax, %eax # <retval>
13760 # test.c:6: for (i = 0; i < n; i++)
13761 xorl %edx, %edx # i
13763 # test.c:6: for (i = 0; i < n; i++)
13764 cmpl %edi, %edx # n, i
13766 # test.c:7: total += i * i;
13767 movl %edx, %ecx # i, tmp92
13768 imull %edx, %ecx # i, tmp92
13769 # test.c:6: for (i = 0; i < n; i++)
13771 # test.c:7: total += i * i;
13772 addl %ecx, %eax # tmp92, <retval>
13780 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
13781 .section .note.GNU-stack,"",@@progbits
13784 The comments are intended for humans rather than machines and hence the
13785 precise format of the comments is subject to change.
13787 @item -frecord-gcc-switches
13788 @opindex frecord-gcc-switches
13789 This switch causes the command line used to invoke the
13790 compiler to be recorded into the object file that is being created.
13791 This switch is only implemented on some targets and the exact format
13792 of the recording is target and binary file format dependent, but it
13793 usually takes the form of a section containing ASCII text. This
13794 switch is related to the @option{-fverbose-asm} switch, but that
13795 switch only records information in the assembler output file as
13796 comments, so it never reaches the object file.
13797 See also @option{-grecord-gcc-switches} for another
13798 way of storing compiler options into the object file.
13802 @cindex global offset table
13804 Generate position-independent code (PIC) suitable for use in a shared
13805 library, if supported for the target machine. Such code accesses all
13806 constant addresses through a global offset table (GOT)@. The dynamic
13807 loader resolves the GOT entries when the program starts (the dynamic
13808 loader is not part of GCC; it is part of the operating system). If
13809 the GOT size for the linked executable exceeds a machine-specific
13810 maximum size, you get an error message from the linker indicating that
13811 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
13812 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
13813 on the m68k and RS/6000. The x86 has no such limit.)
13815 Position-independent code requires special support, and therefore works
13816 only on certain machines. For the x86, GCC supports PIC for System V
13817 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
13818 position-independent.
13820 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13825 If supported for the target machine, emit position-independent code,
13826 suitable for dynamic linking and avoiding any limit on the size of the
13827 global offset table. This option makes a difference on AArch64, m68k,
13828 PowerPC and SPARC@.
13830 Position-independent code requires special support, and therefore works
13831 only on certain machines.
13833 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13840 These options are similar to @option{-fpic} and @option{-fPIC}, but the
13841 generated position-independent code can be only linked into executables.
13842 Usually these options are used to compile code that will be linked using
13843 the @option{-pie} GCC option.
13845 @option{-fpie} and @option{-fPIE} both define the macros
13846 @code{__pie__} and @code{__PIE__}. The macros have the value 1
13847 for @option{-fpie} and 2 for @option{-fPIE}.
13852 Do not use the PLT for external function calls in position-independent code.
13853 Instead, load the callee address at call sites from the GOT and branch to it.
13854 This leads to more efficient code by eliminating PLT stubs and exposing
13855 GOT loads to optimizations. On architectures such as 32-bit x86 where
13856 PLT stubs expect the GOT pointer in a specific register, this gives more
13857 register allocation freedom to the compiler.
13858 Lazy binding requires use of the PLT;
13859 with @option{-fno-plt} all external symbols are resolved at load time.
13861 Alternatively, the function attribute @code{noplt} can be used to avoid calls
13862 through the PLT for specific external functions.
13864 In position-dependent code, a few targets also convert calls to
13865 functions that are marked to not use the PLT to use the GOT instead.
13867 @item -fno-jump-tables
13868 @opindex fno-jump-tables
13869 @opindex fjump-tables
13870 Do not use jump tables for switch statements even where it would be
13871 more efficient than other code generation strategies. This option is
13872 of use in conjunction with @option{-fpic} or @option{-fPIC} for
13873 building code that forms part of a dynamic linker and cannot
13874 reference the address of a jump table. On some targets, jump tables
13875 do not require a GOT and this option is not needed.
13877 @item -ffixed-@var{reg}
13879 Treat the register named @var{reg} as a fixed register; generated code
13880 should never refer to it (except perhaps as a stack pointer, frame
13881 pointer or in some other fixed role).
13883 @var{reg} must be the name of a register. The register names accepted
13884 are machine-specific and are defined in the @code{REGISTER_NAMES}
13885 macro in the machine description macro file.
13887 This flag does not have a negative form, because it specifies a
13890 @item -fcall-used-@var{reg}
13891 @opindex fcall-used
13892 Treat the register named @var{reg} as an allocable register that is
13893 clobbered by function calls. It may be allocated for temporaries or
13894 variables that do not live across a call. Functions compiled this way
13895 do not save and restore the register @var{reg}.
13897 It is an error to use this flag with the frame pointer or stack pointer.
13898 Use of this flag for other registers that have fixed pervasive roles in
13899 the machine's execution model produces disastrous results.
13901 This flag does not have a negative form, because it specifies a
13904 @item -fcall-saved-@var{reg}
13905 @opindex fcall-saved
13906 Treat the register named @var{reg} as an allocable register saved by
13907 functions. It may be allocated even for temporaries or variables that
13908 live across a call. Functions compiled this way save and restore
13909 the register @var{reg} if they use it.
13911 It is an error to use this flag with the frame pointer or stack pointer.
13912 Use of this flag for other registers that have fixed pervasive roles in
13913 the machine's execution model produces disastrous results.
13915 A different sort of disaster results from the use of this flag for
13916 a register in which function values may be returned.
13918 This flag does not have a negative form, because it specifies a
13921 @item -fpack-struct[=@var{n}]
13922 @opindex fpack-struct
13923 Without a value specified, pack all structure members together without
13924 holes. When a value is specified (which must be a small power of two), pack
13925 structure members according to this value, representing the maximum
13926 alignment (that is, objects with default alignment requirements larger than
13927 this are output potentially unaligned at the next fitting location.
13929 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
13930 code that is not binary compatible with code generated without that switch.
13931 Additionally, it makes the code suboptimal.
13932 Use it to conform to a non-default application binary interface.
13934 @item -fleading-underscore
13935 @opindex fleading-underscore
13936 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
13937 change the way C symbols are represented in the object file. One use
13938 is to help link with legacy assembly code.
13940 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
13941 generate code that is not binary compatible with code generated without that
13942 switch. Use it to conform to a non-default application binary interface.
13943 Not all targets provide complete support for this switch.
13945 @item -ftls-model=@var{model}
13946 @opindex ftls-model
13947 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
13948 The @var{model} argument should be one of @samp{global-dynamic},
13949 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
13950 Note that the choice is subject to optimization: the compiler may use
13951 a more efficient model for symbols not visible outside of the translation
13952 unit, or if @option{-fpic} is not given on the command line.
13954 The default without @option{-fpic} is @samp{initial-exec}; with
13955 @option{-fpic} the default is @samp{global-dynamic}.
13957 @item -ftrampolines
13958 @opindex ftrampolines
13959 For targets that normally need trampolines for nested functions, always
13960 generate them instead of using descriptors. Otherwise, for targets that
13961 do not need them, like for example HP-PA or IA-64, do nothing.
13963 A trampoline is a small piece of code that is created at run time on the
13964 stack when the address of a nested function is taken, and is used to call
13965 the nested function indirectly. Therefore, it requires the stack to be
13966 made executable in order for the program to work properly.
13968 @option{-fno-trampolines} is enabled by default on a language by language
13969 basis to let the compiler avoid generating them, if it computes that this
13970 is safe, and replace them with descriptors. Descriptors are made up of data
13971 only, but the generated code must be prepared to deal with them. As of this
13972 writing, @option{-fno-trampolines} is enabled by default only for Ada.
13974 Moreover, code compiled with @option{-ftrampolines} and code compiled with
13975 @option{-fno-trampolines} are not binary compatible if nested functions are
13976 present. This option must therefore be used on a program-wide basis and be
13977 manipulated with extreme care.
13979 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
13980 @opindex fvisibility
13981 Set the default ELF image symbol visibility to the specified option---all
13982 symbols are marked with this unless overridden within the code.
13983 Using this feature can very substantially improve linking and
13984 load times of shared object libraries, produce more optimized
13985 code, provide near-perfect API export and prevent symbol clashes.
13986 It is @strong{strongly} recommended that you use this in any shared objects
13989 Despite the nomenclature, @samp{default} always means public; i.e.,
13990 available to be linked against from outside the shared object.
13991 @samp{protected} and @samp{internal} are pretty useless in real-world
13992 usage so the only other commonly used option is @samp{hidden}.
13993 The default if @option{-fvisibility} isn't specified is
13994 @samp{default}, i.e., make every symbol public.
13996 A good explanation of the benefits offered by ensuring ELF
13997 symbols have the correct visibility is given by ``How To Write
13998 Shared Libraries'' by Ulrich Drepper (which can be found at
13999 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
14000 solution made possible by this option to marking things hidden when
14001 the default is public is to make the default hidden and mark things
14002 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
14003 and @code{__attribute__ ((visibility("default")))} instead of
14004 @code{__declspec(dllexport)} you get almost identical semantics with
14005 identical syntax. This is a great boon to those working with
14006 cross-platform projects.
14008 For those adding visibility support to existing code, you may find
14009 @code{#pragma GCC visibility} of use. This works by you enclosing
14010 the declarations you wish to set visibility for with (for example)
14011 @code{#pragma GCC visibility push(hidden)} and
14012 @code{#pragma GCC visibility pop}.
14013 Bear in mind that symbol visibility should be viewed @strong{as
14014 part of the API interface contract} and thus all new code should
14015 always specify visibility when it is not the default; i.e., declarations
14016 only for use within the local DSO should @strong{always} be marked explicitly
14017 as hidden as so to avoid PLT indirection overheads---making this
14018 abundantly clear also aids readability and self-documentation of the code.
14019 Note that due to ISO C++ specification requirements, @code{operator new} and
14020 @code{operator delete} must always be of default visibility.
14022 Be aware that headers from outside your project, in particular system
14023 headers and headers from any other library you use, may not be
14024 expecting to be compiled with visibility other than the default. You
14025 may need to explicitly say @code{#pragma GCC visibility push(default)}
14026 before including any such headers.
14028 @code{extern} declarations are not affected by @option{-fvisibility}, so
14029 a lot of code can be recompiled with @option{-fvisibility=hidden} with
14030 no modifications. However, this means that calls to @code{extern}
14031 functions with no explicit visibility use the PLT, so it is more
14032 effective to use @code{__attribute ((visibility))} and/or
14033 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
14034 declarations should be treated as hidden.
14036 Note that @option{-fvisibility} does affect C++ vague linkage
14037 entities. This means that, for instance, an exception class that is
14038 be thrown between DSOs must be explicitly marked with default
14039 visibility so that the @samp{type_info} nodes are unified between
14042 An overview of these techniques, their benefits and how to use them
14043 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
14045 @item -fstrict-volatile-bitfields
14046 @opindex fstrict-volatile-bitfields
14047 This option should be used if accesses to volatile bit-fields (or other
14048 structure fields, although the compiler usually honors those types
14049 anyway) should use a single access of the width of the
14050 field's type, aligned to a natural alignment if possible. For
14051 example, targets with memory-mapped peripheral registers might require
14052 all such accesses to be 16 bits wide; with this flag you can
14053 declare all peripheral bit-fields as @code{unsigned short} (assuming short
14054 is 16 bits on these targets) to force GCC to use 16-bit accesses
14055 instead of, perhaps, a more efficient 32-bit access.
14057 If this option is disabled, the compiler uses the most efficient
14058 instruction. In the previous example, that might be a 32-bit load
14059 instruction, even though that accesses bytes that do not contain
14060 any portion of the bit-field, or memory-mapped registers unrelated to
14061 the one being updated.
14063 In some cases, such as when the @code{packed} attribute is applied to a
14064 structure field, it may not be possible to access the field with a single
14065 read or write that is correctly aligned for the target machine. In this
14066 case GCC falls back to generating multiple accesses rather than code that
14067 will fault or truncate the result at run time.
14069 Note: Due to restrictions of the C/C++11 memory model, write accesses are
14070 not allowed to touch non bit-field members. It is therefore recommended
14071 to define all bits of the field's type as bit-field members.
14073 The default value of this option is determined by the application binary
14074 interface for the target processor.
14076 @item -fsync-libcalls
14077 @opindex fsync-libcalls
14078 This option controls whether any out-of-line instance of the @code{__sync}
14079 family of functions may be used to implement the C++11 @code{__atomic}
14080 family of functions.
14082 The default value of this option is enabled, thus the only useful form
14083 of the option is @option{-fno-sync-libcalls}. This option is used in
14084 the implementation of the @file{libatomic} runtime library.
14088 @node Developer Options
14089 @section GCC Developer Options
14090 @cindex developer options
14091 @cindex debugging GCC
14092 @cindex debug dump options
14093 @cindex dump options
14094 @cindex compilation statistics
14096 This section describes command-line options that are primarily of
14097 interest to GCC developers, including options to support compiler
14098 testing and investigation of compiler bugs and compile-time
14099 performance problems. This includes options that produce debug dumps
14100 at various points in the compilation; that print statistics such as
14101 memory use and execution time; and that print information about GCC's
14102 configuration, such as where it searches for libraries. You should
14103 rarely need to use any of these options for ordinary compilation and
14106 Many developer options that cause GCC to dump output to a file take an
14107 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
14108 or @samp{-} to dump to standard output, and @samp{stderr} for standard
14111 If @samp{=@var{filename}} is omitted, a default dump file name is
14112 constructed by concatenating the base dump file name, a pass number,
14113 phase letter, and pass name. The base dump file name is the name of
14114 output file produced by the compiler if explicitly specified and not
14115 an executable; otherwise it is the source file name.
14116 The pass number is determined by the order passes are registered with
14117 the compiler's pass manager.
14118 This is generally the same as the order of execution, but passes
14119 registered by plugins, target-specific passes, or passes that are
14120 otherwise registered late are numbered higher than the pass named
14121 @samp{final}, even if they are executed earlier. The phase letter is
14122 one of @samp{i} (inter-procedural analysis), @samp{l}
14123 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
14124 The files are created in the directory of the output file.
14128 @item -d@var{letters}
14129 @itemx -fdump-rtl-@var{pass}
14130 @itemx -fdump-rtl-@var{pass}=@var{filename}
14132 @opindex fdump-rtl-@var{pass}
14133 Says to make debugging dumps during compilation at times specified by
14134 @var{letters}. This is used for debugging the RTL-based passes of the
14137 Some @option{-d@var{letters}} switches have different meaning when
14138 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
14139 for information about preprocessor-specific dump options.
14141 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
14142 @option{-d} option @var{letters}. Here are the possible
14143 letters for use in @var{pass} and @var{letters}, and their meanings:
14147 @item -fdump-rtl-alignments
14148 @opindex fdump-rtl-alignments
14149 Dump after branch alignments have been computed.
14151 @item -fdump-rtl-asmcons
14152 @opindex fdump-rtl-asmcons
14153 Dump after fixing rtl statements that have unsatisfied in/out constraints.
14155 @item -fdump-rtl-auto_inc_dec
14156 @opindex fdump-rtl-auto_inc_dec
14157 Dump after auto-inc-dec discovery. This pass is only run on
14158 architectures that have auto inc or auto dec instructions.
14160 @item -fdump-rtl-barriers
14161 @opindex fdump-rtl-barriers
14162 Dump after cleaning up the barrier instructions.
14164 @item -fdump-rtl-bbpart
14165 @opindex fdump-rtl-bbpart
14166 Dump after partitioning hot and cold basic blocks.
14168 @item -fdump-rtl-bbro
14169 @opindex fdump-rtl-bbro
14170 Dump after block reordering.
14172 @item -fdump-rtl-btl1
14173 @itemx -fdump-rtl-btl2
14174 @opindex fdump-rtl-btl2
14175 @opindex fdump-rtl-btl2
14176 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
14177 after the two branch
14178 target load optimization passes.
14180 @item -fdump-rtl-bypass
14181 @opindex fdump-rtl-bypass
14182 Dump after jump bypassing and control flow optimizations.
14184 @item -fdump-rtl-combine
14185 @opindex fdump-rtl-combine
14186 Dump after the RTL instruction combination pass.
14188 @item -fdump-rtl-compgotos
14189 @opindex fdump-rtl-compgotos
14190 Dump after duplicating the computed gotos.
14192 @item -fdump-rtl-ce1
14193 @itemx -fdump-rtl-ce2
14194 @itemx -fdump-rtl-ce3
14195 @opindex fdump-rtl-ce1
14196 @opindex fdump-rtl-ce2
14197 @opindex fdump-rtl-ce3
14198 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
14199 @option{-fdump-rtl-ce3} enable dumping after the three
14200 if conversion passes.
14202 @item -fdump-rtl-cprop_hardreg
14203 @opindex fdump-rtl-cprop_hardreg
14204 Dump after hard register copy propagation.
14206 @item -fdump-rtl-csa
14207 @opindex fdump-rtl-csa
14208 Dump after combining stack adjustments.
14210 @item -fdump-rtl-cse1
14211 @itemx -fdump-rtl-cse2
14212 @opindex fdump-rtl-cse1
14213 @opindex fdump-rtl-cse2
14214 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
14215 the two common subexpression elimination passes.
14217 @item -fdump-rtl-dce
14218 @opindex fdump-rtl-dce
14219 Dump after the standalone dead code elimination passes.
14221 @item -fdump-rtl-dbr
14222 @opindex fdump-rtl-dbr
14223 Dump after delayed branch scheduling.
14225 @item -fdump-rtl-dce1
14226 @itemx -fdump-rtl-dce2
14227 @opindex fdump-rtl-dce1
14228 @opindex fdump-rtl-dce2
14229 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
14230 the two dead store elimination passes.
14232 @item -fdump-rtl-eh
14233 @opindex fdump-rtl-eh
14234 Dump after finalization of EH handling code.
14236 @item -fdump-rtl-eh_ranges
14237 @opindex fdump-rtl-eh_ranges
14238 Dump after conversion of EH handling range regions.
14240 @item -fdump-rtl-expand
14241 @opindex fdump-rtl-expand
14242 Dump after RTL generation.
14244 @item -fdump-rtl-fwprop1
14245 @itemx -fdump-rtl-fwprop2
14246 @opindex fdump-rtl-fwprop1
14247 @opindex fdump-rtl-fwprop2
14248 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
14249 dumping after the two forward propagation passes.
14251 @item -fdump-rtl-gcse1
14252 @itemx -fdump-rtl-gcse2
14253 @opindex fdump-rtl-gcse1
14254 @opindex fdump-rtl-gcse2
14255 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
14256 after global common subexpression elimination.
14258 @item -fdump-rtl-init-regs
14259 @opindex fdump-rtl-init-regs
14260 Dump after the initialization of the registers.
14262 @item -fdump-rtl-initvals
14263 @opindex fdump-rtl-initvals
14264 Dump after the computation of the initial value sets.
14266 @item -fdump-rtl-into_cfglayout
14267 @opindex fdump-rtl-into_cfglayout
14268 Dump after converting to cfglayout mode.
14270 @item -fdump-rtl-ira
14271 @opindex fdump-rtl-ira
14272 Dump after iterated register allocation.
14274 @item -fdump-rtl-jump
14275 @opindex fdump-rtl-jump
14276 Dump after the second jump optimization.
14278 @item -fdump-rtl-loop2
14279 @opindex fdump-rtl-loop2
14280 @option{-fdump-rtl-loop2} enables dumping after the rtl
14281 loop optimization passes.
14283 @item -fdump-rtl-mach
14284 @opindex fdump-rtl-mach
14285 Dump after performing the machine dependent reorganization pass, if that
14288 @item -fdump-rtl-mode_sw
14289 @opindex fdump-rtl-mode_sw
14290 Dump after removing redundant mode switches.
14292 @item -fdump-rtl-rnreg
14293 @opindex fdump-rtl-rnreg
14294 Dump after register renumbering.
14296 @item -fdump-rtl-outof_cfglayout
14297 @opindex fdump-rtl-outof_cfglayout
14298 Dump after converting from cfglayout mode.
14300 @item -fdump-rtl-peephole2
14301 @opindex fdump-rtl-peephole2
14302 Dump after the peephole pass.
14304 @item -fdump-rtl-postreload
14305 @opindex fdump-rtl-postreload
14306 Dump after post-reload optimizations.
14308 @item -fdump-rtl-pro_and_epilogue
14309 @opindex fdump-rtl-pro_and_epilogue
14310 Dump after generating the function prologues and epilogues.
14312 @item -fdump-rtl-sched1
14313 @itemx -fdump-rtl-sched2
14314 @opindex fdump-rtl-sched1
14315 @opindex fdump-rtl-sched2
14316 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
14317 after the basic block scheduling passes.
14319 @item -fdump-rtl-ree
14320 @opindex fdump-rtl-ree
14321 Dump after sign/zero extension elimination.
14323 @item -fdump-rtl-seqabstr
14324 @opindex fdump-rtl-seqabstr
14325 Dump after common sequence discovery.
14327 @item -fdump-rtl-shorten
14328 @opindex fdump-rtl-shorten
14329 Dump after shortening branches.
14331 @item -fdump-rtl-sibling
14332 @opindex fdump-rtl-sibling
14333 Dump after sibling call optimizations.
14335 @item -fdump-rtl-split1
14336 @itemx -fdump-rtl-split2
14337 @itemx -fdump-rtl-split3
14338 @itemx -fdump-rtl-split4
14339 @itemx -fdump-rtl-split5
14340 @opindex fdump-rtl-split1
14341 @opindex fdump-rtl-split2
14342 @opindex fdump-rtl-split3
14343 @opindex fdump-rtl-split4
14344 @opindex fdump-rtl-split5
14345 These options enable dumping after five rounds of
14346 instruction splitting.
14348 @item -fdump-rtl-sms
14349 @opindex fdump-rtl-sms
14350 Dump after modulo scheduling. This pass is only run on some
14353 @item -fdump-rtl-stack
14354 @opindex fdump-rtl-stack
14355 Dump after conversion from GCC's ``flat register file'' registers to the
14356 x87's stack-like registers. This pass is only run on x86 variants.
14358 @item -fdump-rtl-subreg1
14359 @itemx -fdump-rtl-subreg2
14360 @opindex fdump-rtl-subreg1
14361 @opindex fdump-rtl-subreg2
14362 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
14363 the two subreg expansion passes.
14365 @item -fdump-rtl-unshare
14366 @opindex fdump-rtl-unshare
14367 Dump after all rtl has been unshared.
14369 @item -fdump-rtl-vartrack
14370 @opindex fdump-rtl-vartrack
14371 Dump after variable tracking.
14373 @item -fdump-rtl-vregs
14374 @opindex fdump-rtl-vregs
14375 Dump after converting virtual registers to hard registers.
14377 @item -fdump-rtl-web
14378 @opindex fdump-rtl-web
14379 Dump after live range splitting.
14381 @item -fdump-rtl-regclass
14382 @itemx -fdump-rtl-subregs_of_mode_init
14383 @itemx -fdump-rtl-subregs_of_mode_finish
14384 @itemx -fdump-rtl-dfinit
14385 @itemx -fdump-rtl-dfinish
14386 @opindex fdump-rtl-regclass
14387 @opindex fdump-rtl-subregs_of_mode_init
14388 @opindex fdump-rtl-subregs_of_mode_finish
14389 @opindex fdump-rtl-dfinit
14390 @opindex fdump-rtl-dfinish
14391 These dumps are defined but always produce empty files.
14394 @itemx -fdump-rtl-all
14396 @opindex fdump-rtl-all
14397 Produce all the dumps listed above.
14401 Annotate the assembler output with miscellaneous debugging information.
14405 Dump all macro definitions, at the end of preprocessing, in addition to
14410 Produce a core dump whenever an error occurs.
14414 Annotate the assembler output with a comment indicating which
14415 pattern and alternative is used. The length and cost of each instruction are
14420 Dump the RTL in the assembler output as a comment before each instruction.
14421 Also turns on @option{-dp} annotation.
14425 Just generate RTL for a function instead of compiling it. Usually used
14426 with @option{-fdump-rtl-expand}.
14430 @opindex fdump-debug
14431 Dump debugging information generated during the debug
14434 @item -fdump-earlydebug
14435 @opindex fdump-earlydebug
14436 Dump debugging information generated during the early debug
14439 @item -fdump-noaddr
14440 @opindex fdump-noaddr
14441 When doing debugging dumps, suppress address output. This makes it more
14442 feasible to use diff on debugging dumps for compiler invocations with
14443 different compiler binaries and/or different
14444 text / bss / data / heap / stack / dso start locations.
14447 @opindex freport-bug
14448 Collect and dump debug information into a temporary file if an
14449 internal compiler error (ICE) occurs.
14451 @item -fdump-unnumbered
14452 @opindex fdump-unnumbered
14453 When doing debugging dumps, suppress instruction numbers and address output.
14454 This makes it more feasible to use diff on debugging dumps for compiler
14455 invocations with different options, in particular with and without
14458 @item -fdump-unnumbered-links
14459 @opindex fdump-unnumbered-links
14460 When doing debugging dumps (see @option{-d} option above), suppress
14461 instruction numbers for the links to the previous and next instructions
14464 @item -fdump-ipa-@var{switch}
14465 @itemx -fdump-ipa-@var{switch}-@var{options}
14467 Control the dumping at various stages of inter-procedural analysis
14468 language tree to a file. The file name is generated by appending a
14469 switch specific suffix to the source file name, and the file is created
14470 in the same directory as the output file. The following dumps are
14475 Enables all inter-procedural analysis dumps.
14478 Dumps information about call-graph optimization, unused function removal,
14479 and inlining decisions.
14482 Dump after function inlining.
14486 Additionally, the options @option{-optimized}, @option{-missed},
14487 @option{-note}, and @option{-all} can be provided, with the same meaning
14488 as for @option{-fopt-info}, defaulting to @option{-optimized}.
14490 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14491 information on callsites that were inlined, along with callsites
14492 that were not inlined.
14494 By default, the dump will contain messages about successful
14495 optimizations (equivalent to @option{-optimized}) together with
14496 low-level details about the analysis.
14498 @item -fdump-lang-all
14499 @itemx -fdump-lang-@var{switch}
14500 @itemx -fdump-lang-@var{switch}-@var{options}
14501 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14502 @opindex fdump-lang-all
14503 @opindex fdump-lang
14504 Control the dumping of language-specific information. The @var{options}
14505 and @var{filename} portions behave as described in the
14506 @option{-fdump-tree} option. The following @var{switch} values are
14512 Enable all language-specific dumps.
14515 Dump class hierarchy information. Virtual table information is emitted
14516 unless '@option{slim}' is specified. This option is applicable to C++ only.
14519 Dump the raw internal tree data. This option is applicable to C++ only.
14523 @item -fdump-passes
14524 @opindex fdump-passes
14525 Print on @file{stderr} the list of optimization passes that are turned
14526 on and off by the current command-line options.
14528 @item -fdump-statistics-@var{option}
14529 @opindex fdump-statistics
14530 Enable and control dumping of pass statistics in a separate file. The
14531 file name is generated by appending a suffix ending in
14532 @samp{.statistics} to the source file name, and the file is created in
14533 the same directory as the output file. If the @samp{-@var{option}}
14534 form is used, @samp{-stats} causes counters to be summed over the
14535 whole compilation unit while @samp{-details} dumps every event as
14536 the passes generate them. The default with no option is to sum
14537 counters for each function compiled.
14539 @item -fdump-tree-all
14540 @itemx -fdump-tree-@var{switch}
14541 @itemx -fdump-tree-@var{switch}-@var{options}
14542 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
14543 @opindex fdump-tree-all
14544 @opindex fdump-tree
14545 Control the dumping at various stages of processing the intermediate
14546 language tree to a file. If the @samp{-@var{options}}
14547 form is used, @var{options} is a list of @samp{-} separated options
14548 which control the details of the dump. Not all options are applicable
14549 to all dumps; those that are not meaningful are ignored. The
14550 following options are available
14554 Print the address of each node. Usually this is not meaningful as it
14555 changes according to the environment and source file. Its primary use
14556 is for tying up a dump file with a debug environment.
14558 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
14559 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
14560 use working backward from mangled names in the assembly file.
14562 When dumping front-end intermediate representations, inhibit dumping
14563 of members of a scope or body of a function merely because that scope
14564 has been reached. Only dump such items when they are directly reachable
14565 by some other path.
14567 When dumping pretty-printed trees, this option inhibits dumping the
14568 bodies of control structures.
14570 When dumping RTL, print the RTL in slim (condensed) form instead of
14571 the default LISP-like representation.
14573 Print a raw representation of the tree. By default, trees are
14574 pretty-printed into a C-like representation.
14576 Enable more detailed dumps (not honored by every dump option). Also
14577 include information from the optimization passes.
14579 Enable dumping various statistics about the pass (not honored by every dump
14582 Enable showing basic block boundaries (disabled in raw dumps).
14584 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
14585 dump a representation of the control flow graph suitable for viewing with
14586 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
14587 the file is pretty-printed as a subgraph, so that GraphViz can render them
14588 all in a single plot.
14590 This option currently only works for RTL dumps, and the RTL is always
14591 dumped in slim form.
14593 Enable showing virtual operands for every statement.
14595 Enable showing line numbers for statements.
14597 Enable showing the unique ID (@code{DECL_UID}) for each variable.
14599 Enable showing the tree dump for each statement.
14601 Enable showing the EH region number holding each statement.
14603 Enable showing scalar evolution analysis details.
14605 Enable showing optimization information (only available in certain
14608 Enable showing missed optimization information (only available in certain
14611 Enable other detailed optimization information (only available in
14614 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
14615 and @option{lineno}.
14617 Turn on all optimization options, i.e., @option{optimized},
14618 @option{missed}, and @option{note}.
14621 To determine what tree dumps are available or find the dump for a pass
14622 of interest follow the steps below.
14626 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
14627 look for a code that corresponds to the pass you are interested in.
14628 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
14629 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
14630 The number at the end distinguishes distinct invocations of the same pass.
14632 To enable the creation of the dump file, append the pass code to
14633 the @option{-fdump-} option prefix and invoke GCC with it. For example,
14634 to enable the dump from the Early Value Range Propagation pass, invoke
14635 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
14636 specify the name of the dump file. If you don't specify one, GCC
14637 creates as described below.
14639 Find the pass dump in a file whose name is composed of three components
14640 separated by a period: the name of the source file GCC was invoked to
14641 compile, a numeric suffix indicating the pass number followed by the
14642 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
14643 and finally the pass code. For example, the Early VRP pass dump might
14644 be in a file named @file{myfile.c.038t.evrp} in the current working
14645 directory. Note that the numeric codes are not stable and may change
14646 from one version of GCC to another.
14650 @itemx -fopt-info-@var{options}
14651 @itemx -fopt-info-@var{options}=@var{filename}
14653 Controls optimization dumps from various optimization passes. If the
14654 @samp{-@var{options}} form is used, @var{options} is a list of
14655 @samp{-} separated option keywords to select the dump details and
14658 The @var{options} can be divided into three groups:
14661 options describing what kinds of messages should be emitted,
14663 options describing the verbosity of the dump, and
14665 options describing which optimizations should be included.
14667 The options from each group can be freely mixed as they are
14668 non-overlapping. However, in case of any conflicts,
14669 the later options override the earlier options on the command
14672 The following options control which kinds of messages should be emitted:
14676 Print information when an optimization is successfully applied. It is
14677 up to a pass to decide which information is relevant. For example, the
14678 vectorizer passes print the source location of loops which are
14679 successfully vectorized.
14681 Print information about missed optimizations. Individual passes
14682 control which information to include in the output.
14684 Print verbose information about optimizations, such as certain
14685 transformations, more detailed messages about decisions etc.
14687 Print detailed optimization information. This includes
14688 @samp{optimized}, @samp{missed}, and @samp{note}.
14691 The following option controls the dump verbosity:
14695 By default, only ``high-level'' messages are emitted. This option enables
14696 additional, more detailed, messages, which are likely to only be of interest
14700 One or more of the following option keywords can be used to describe a
14701 group of optimizations:
14705 Enable dumps from all interprocedural optimizations.
14707 Enable dumps from all loop optimizations.
14709 Enable dumps from all inlining optimizations.
14711 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
14713 Enable dumps from all vectorization optimizations.
14715 Enable dumps from all optimizations. This is a superset of
14716 the optimization groups listed above.
14719 If @var{options} is
14720 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
14721 about successful optimizations from all the passes, omitting messages
14722 that are treated as ``internals''.
14724 If the @var{filename} is provided, then the dumps from all the
14725 applicable optimizations are concatenated into the @var{filename}.
14726 Otherwise the dump is output onto @file{stderr}. Though multiple
14727 @option{-fopt-info} options are accepted, only one of them can include
14728 a @var{filename}. If other filenames are provided then all but the
14729 first such option are ignored.
14731 Note that the output @var{filename} is overwritten
14732 in case of multiple translation units. If a combined output from
14733 multiple translation units is desired, @file{stderr} should be used
14736 In the following example, the optimization info is output to
14745 gcc -O3 -fopt-info-missed=missed.all
14749 outputs missed optimization report from all the passes into
14750 @file{missed.all}, and this one:
14753 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
14757 prints information about missed optimization opportunities from
14758 vectorization passes on @file{stderr}.
14759 Note that @option{-fopt-info-vec-missed} is equivalent to
14760 @option{-fopt-info-missed-vec}. The order of the optimization group
14761 names and message types listed after @option{-fopt-info} does not matter.
14763 As another example,
14765 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
14769 outputs information about missed optimizations as well as
14770 optimized locations from all the inlining passes into
14776 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
14780 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
14781 in conflict since only one output file is allowed. In this case, only
14782 the first option takes effect and the subsequent options are
14783 ignored. Thus only @file{vec.miss} is produced which contains
14784 dumps from the vectorizer about missed opportunities.
14786 @item -fsave-optimization-record
14787 @opindex fsave-optimization-record
14788 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
14789 were performed, for those optimizations that support @option{-fopt-info}.
14791 This option is experimental and the format of the data within the
14792 compressed JSON file is subject to change.
14794 It is roughly equivalent to a machine-readable version of
14795 @option{-fopt-info-all}, as a collection of messages with source file,
14796 line number and column number, with the following additional data for
14802 the execution count of the code being optimized, along with metadata about
14803 whether this was from actual profile data, or just an estimate, allowing
14804 consumers to prioritize messages by code hotness,
14807 the function name of the code being optimized, where applicable,
14810 the ``inlining chain'' for the code being optimized, so that when
14811 a function is inlined into several different places (which might
14812 themselves be inlined), the reader can distinguish between the copies,
14815 objects identifying those parts of the message that refer to expressions,
14816 statements or symbol-table nodes, which of these categories they are, and,
14817 when available, their source code location,
14820 the GCC pass that emitted the message, and
14823 the location in GCC's own code from which the message was emitted
14827 Additionally, some messages are logically nested within other
14828 messages, reflecting implementation details of the optimization
14831 @item -fsched-verbose=@var{n}
14832 @opindex fsched-verbose
14833 On targets that use instruction scheduling, this option controls the
14834 amount of debugging output the scheduler prints to the dump files.
14836 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
14837 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
14838 For @var{n} greater than one, it also output basic block probabilities,
14839 detailed ready list information and unit/insn info. For @var{n} greater
14840 than two, it includes RTL at abort point, control-flow and regions info.
14841 And for @var{n} over four, @option{-fsched-verbose} also includes
14846 @item -fenable-@var{kind}-@var{pass}
14847 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
14851 This is a set of options that are used to explicitly disable/enable
14852 optimization passes. These options are intended for use for debugging GCC.
14853 Compiler users should use regular options for enabling/disabling
14858 @item -fdisable-ipa-@var{pass}
14859 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
14860 statically invoked in the compiler multiple times, the pass name should be
14861 appended with a sequential number starting from 1.
14863 @item -fdisable-rtl-@var{pass}
14864 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
14865 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
14866 statically invoked in the compiler multiple times, the pass name should be
14867 appended with a sequential number starting from 1. @var{range-list} is a
14868 comma-separated list of function ranges or assembler names. Each range is a number
14869 pair separated by a colon. The range is inclusive in both ends. If the range
14870 is trivial, the number pair can be simplified as a single number. If the
14871 function's call graph node's @var{uid} falls within one of the specified ranges,
14872 the @var{pass} is disabled for that function. The @var{uid} is shown in the
14873 function header of a dump file, and the pass names can be dumped by using
14874 option @option{-fdump-passes}.
14876 @item -fdisable-tree-@var{pass}
14877 @itemx -fdisable-tree-@var{pass}=@var{range-list}
14878 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
14881 @item -fenable-ipa-@var{pass}
14882 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
14883 statically invoked in the compiler multiple times, the pass name should be
14884 appended with a sequential number starting from 1.
14886 @item -fenable-rtl-@var{pass}
14887 @itemx -fenable-rtl-@var{pass}=@var{range-list}
14888 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
14889 description and examples.
14891 @item -fenable-tree-@var{pass}
14892 @itemx -fenable-tree-@var{pass}=@var{range-list}
14893 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
14894 of option arguments.
14898 Here are some examples showing uses of these options.
14902 # disable ccp1 for all functions
14903 -fdisable-tree-ccp1
14904 # disable complete unroll for function whose cgraph node uid is 1
14905 -fenable-tree-cunroll=1
14906 # disable gcse2 for functions at the following ranges [1,1],
14907 # [300,400], and [400,1000]
14908 # disable gcse2 for functions foo and foo2
14909 -fdisable-rtl-gcse2=foo,foo2
14910 # disable early inlining
14911 -fdisable-tree-einline
14912 # disable ipa inlining
14913 -fdisable-ipa-inline
14914 # enable tree full unroll
14915 -fenable-tree-unroll
14920 @itemx -fchecking=@var{n}
14922 @opindex fno-checking
14923 Enable internal consistency checking. The default depends on
14924 the compiler configuration. @option{-fchecking=2} enables further
14925 internal consistency checking that might affect code generation.
14927 @item -frandom-seed=@var{string}
14928 @opindex frandom-seed
14929 This option provides a seed that GCC uses in place of
14930 random numbers in generating certain symbol names
14931 that have to be different in every compiled file. It is also used to
14932 place unique stamps in coverage data files and the object files that
14933 produce them. You can use the @option{-frandom-seed} option to produce
14934 reproducibly identical object files.
14936 The @var{string} can either be a number (decimal, octal or hex) or an
14937 arbitrary string (in which case it's converted to a number by
14940 The @var{string} should be different for every file you compile.
14943 @itemx -save-temps=cwd
14944 @opindex save-temps
14945 Store the usual ``temporary'' intermediate files permanently; place them
14946 in the current directory and name them based on the source file. Thus,
14947 compiling @file{foo.c} with @option{-c -save-temps} produces files
14948 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
14949 preprocessed @file{foo.i} output file even though the compiler now
14950 normally uses an integrated preprocessor.
14952 When used in combination with the @option{-x} command-line option,
14953 @option{-save-temps} is sensible enough to avoid over writing an
14954 input source file with the same extension as an intermediate file.
14955 The corresponding intermediate file may be obtained by renaming the
14956 source file before using @option{-save-temps}.
14958 If you invoke GCC in parallel, compiling several different source
14959 files that share a common base name in different subdirectories or the
14960 same source file compiled for multiple output destinations, it is
14961 likely that the different parallel compilers will interfere with each
14962 other, and overwrite the temporary files. For instance:
14965 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
14966 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
14969 may result in @file{foo.i} and @file{foo.o} being written to
14970 simultaneously by both compilers.
14972 @item -save-temps=obj
14973 @opindex save-temps=obj
14974 Store the usual ``temporary'' intermediate files permanently. If the
14975 @option{-o} option is used, the temporary files are based on the
14976 object file. If the @option{-o} option is not used, the
14977 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
14982 gcc -save-temps=obj -c foo.c
14983 gcc -save-temps=obj -c bar.c -o dir/xbar.o
14984 gcc -save-temps=obj foobar.c -o dir2/yfoobar
14988 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
14989 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
14990 @file{dir2/yfoobar.o}.
14992 @item -time@r{[}=@var{file}@r{]}
14994 Report the CPU time taken by each subprocess in the compilation
14995 sequence. For C source files, this is the compiler proper and assembler
14996 (plus the linker if linking is done).
14998 Without the specification of an output file, the output looks like this:
15005 The first number on each line is the ``user time'', that is time spent
15006 executing the program itself. The second number is ``system time'',
15007 time spent executing operating system routines on behalf of the program.
15008 Both numbers are in seconds.
15010 With the specification of an output file, the output is appended to the
15011 named file, and it looks like this:
15014 0.12 0.01 cc1 @var{options}
15015 0.00 0.01 as @var{options}
15018 The ``user time'' and the ``system time'' are moved before the program
15019 name, and the options passed to the program are displayed, so that one
15020 can later tell what file was being compiled, and with which options.
15022 @item -fdump-final-insns@r{[}=@var{file}@r{]}
15023 @opindex fdump-final-insns
15024 Dump the final internal representation (RTL) to @var{file}. If the
15025 optional argument is omitted (or if @var{file} is @code{.}), the name
15026 of the dump file is determined by appending @code{.gkd} to the
15027 compilation output file name.
15029 @item -fcompare-debug@r{[}=@var{opts}@r{]}
15030 @opindex fcompare-debug
15031 @opindex fno-compare-debug
15032 If no error occurs during compilation, run the compiler a second time,
15033 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
15034 passed to the second compilation. Dump the final internal
15035 representation in both compilations, and print an error if they differ.
15037 If the equal sign is omitted, the default @option{-gtoggle} is used.
15039 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
15040 and nonzero, implicitly enables @option{-fcompare-debug}. If
15041 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
15042 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
15045 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
15046 is equivalent to @option{-fno-compare-debug}, which disables the dumping
15047 of the final representation and the second compilation, preventing even
15048 @env{GCC_COMPARE_DEBUG} from taking effect.
15050 To verify full coverage during @option{-fcompare-debug} testing, set
15051 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
15052 which GCC rejects as an invalid option in any actual compilation
15053 (rather than preprocessing, assembly or linking). To get just a
15054 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
15055 not overridden} will do.
15057 @item -fcompare-debug-second
15058 @opindex fcompare-debug-second
15059 This option is implicitly passed to the compiler for the second
15060 compilation requested by @option{-fcompare-debug}, along with options to
15061 silence warnings, and omitting other options that would cause the compiler
15062 to produce output to files or to standard output as a side effect. Dump
15063 files and preserved temporary files are renamed so as to contain the
15064 @code{.gk} additional extension during the second compilation, to avoid
15065 overwriting those generated by the first.
15067 When this option is passed to the compiler driver, it causes the
15068 @emph{first} compilation to be skipped, which makes it useful for little
15069 other than debugging the compiler proper.
15073 Turn off generation of debug info, if leaving out this option
15074 generates it, or turn it on at level 2 otherwise. The position of this
15075 argument in the command line does not matter; it takes effect after all
15076 other options are processed, and it does so only once, no matter how
15077 many times it is given. This is mainly intended to be used with
15078 @option{-fcompare-debug}.
15080 @item -fvar-tracking-assignments-toggle
15081 @opindex fvar-tracking-assignments-toggle
15082 @opindex fno-var-tracking-assignments-toggle
15083 Toggle @option{-fvar-tracking-assignments}, in the same way that
15084 @option{-gtoggle} toggles @option{-g}.
15088 Makes the compiler print out each function name as it is compiled, and
15089 print some statistics about each pass when it finishes.
15091 @item -ftime-report
15092 @opindex ftime-report
15093 Makes the compiler print some statistics about the time consumed by each
15094 pass when it finishes.
15096 @item -ftime-report-details
15097 @opindex ftime-report-details
15098 Record the time consumed by infrastructure parts separately for each pass.
15100 @item -fira-verbose=@var{n}
15101 @opindex fira-verbose
15102 Control the verbosity of the dump file for the integrated register allocator.
15103 The default value is 5. If the value @var{n} is greater or equal to 10,
15104 the dump output is sent to stderr using the same format as @var{n} minus 10.
15107 @opindex flto-report
15108 Prints a report with internal details on the workings of the link-time
15109 optimizer. The contents of this report vary from version to version.
15110 It is meant to be useful to GCC developers when processing object
15111 files in LTO mode (via @option{-flto}).
15113 Disabled by default.
15115 @item -flto-report-wpa
15116 @opindex flto-report-wpa
15117 Like @option{-flto-report}, but only print for the WPA phase of Link
15121 @opindex fmem-report
15122 Makes the compiler print some statistics about permanent memory
15123 allocation when it finishes.
15125 @item -fmem-report-wpa
15126 @opindex fmem-report-wpa
15127 Makes the compiler print some statistics about permanent memory
15128 allocation for the WPA phase only.
15130 @item -fpre-ipa-mem-report
15131 @opindex fpre-ipa-mem-report
15132 @item -fpost-ipa-mem-report
15133 @opindex fpost-ipa-mem-report
15134 Makes the compiler print some statistics about permanent memory
15135 allocation before or after interprocedural optimization.
15137 @item -fprofile-report
15138 @opindex fprofile-report
15139 Makes the compiler print some statistics about consistency of the
15140 (estimated) profile and effect of individual passes.
15142 @item -fstack-usage
15143 @opindex fstack-usage
15144 Makes the compiler output stack usage information for the program, on a
15145 per-function basis. The filename for the dump is made by appending
15146 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
15147 the output file, if explicitly specified and it is not an executable,
15148 otherwise it is the basename of the source file. An entry is made up
15153 The name of the function.
15157 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
15160 The qualifier @code{static} means that the function manipulates the stack
15161 statically: a fixed number of bytes are allocated for the frame on function
15162 entry and released on function exit; no stack adjustments are otherwise made
15163 in the function. The second field is this fixed number of bytes.
15165 The qualifier @code{dynamic} means that the function manipulates the stack
15166 dynamically: in addition to the static allocation described above, stack
15167 adjustments are made in the body of the function, for example to push/pop
15168 arguments around function calls. If the qualifier @code{bounded} is also
15169 present, the amount of these adjustments is bounded at compile time and
15170 the second field is an upper bound of the total amount of stack used by
15171 the function. If it is not present, the amount of these adjustments is
15172 not bounded at compile time and the second field only represents the
15177 Emit statistics about front-end processing at the end of the compilation.
15178 This option is supported only by the C++ front end, and
15179 the information is generally only useful to the G++ development team.
15181 @item -fdbg-cnt-list
15182 @opindex fdbg-cnt-list
15183 Print the name and the counter upper bound for all debug counters.
15186 @item -fdbg-cnt=@var{counter-value-list}
15188 Set the internal debug counter lower and upper bound. @var{counter-value-list}
15189 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
15190 tuples which sets the lower and the upper bound of each debug
15191 counter @var{name}. The @var{lower_bound} is optional and is zero
15192 initialized if not set.
15193 All debug counters have the initial upper bound of @code{UINT_MAX};
15194 thus @code{dbg_cnt} returns true always unless the upper bound
15195 is set by this option.
15196 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
15197 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
15198 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
15200 @item -print-file-name=@var{library}
15201 @opindex print-file-name
15202 Print the full absolute name of the library file @var{library} that
15203 would be used when linking---and don't do anything else. With this
15204 option, GCC does not compile or link anything; it just prints the
15207 @item -print-multi-directory
15208 @opindex print-multi-directory
15209 Print the directory name corresponding to the multilib selected by any
15210 other switches present in the command line. This directory is supposed
15211 to exist in @env{GCC_EXEC_PREFIX}.
15213 @item -print-multi-lib
15214 @opindex print-multi-lib
15215 Print the mapping from multilib directory names to compiler switches
15216 that enable them. The directory name is separated from the switches by
15217 @samp{;}, and each switch starts with an @samp{@@} instead of the
15218 @samp{-}, without spaces between multiple switches. This is supposed to
15219 ease shell processing.
15221 @item -print-multi-os-directory
15222 @opindex print-multi-os-directory
15223 Print the path to OS libraries for the selected
15224 multilib, relative to some @file{lib} subdirectory. If OS libraries are
15225 present in the @file{lib} subdirectory and no multilibs are used, this is
15226 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
15227 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
15228 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
15229 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
15231 @item -print-multiarch
15232 @opindex print-multiarch
15233 Print the path to OS libraries for the selected multiarch,
15234 relative to some @file{lib} subdirectory.
15236 @item -print-prog-name=@var{program}
15237 @opindex print-prog-name
15238 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
15240 @item -print-libgcc-file-name
15241 @opindex print-libgcc-file-name
15242 Same as @option{-print-file-name=libgcc.a}.
15244 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
15245 but you do want to link with @file{libgcc.a}. You can do:
15248 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
15251 @item -print-search-dirs
15252 @opindex print-search-dirs
15253 Print the name of the configured installation directory and a list of
15254 program and library directories @command{gcc} searches---and don't do anything else.
15256 This is useful when @command{gcc} prints the error message
15257 @samp{installation problem, cannot exec cpp0: No such file or directory}.
15258 To resolve this you either need to put @file{cpp0} and the other compiler
15259 components where @command{gcc} expects to find them, or you can set the environment
15260 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
15261 Don't forget the trailing @samp{/}.
15262 @xref{Environment Variables}.
15264 @item -print-sysroot
15265 @opindex print-sysroot
15266 Print the target sysroot directory that is used during
15267 compilation. This is the target sysroot specified either at configure
15268 time or using the @option{--sysroot} option, possibly with an extra
15269 suffix that depends on compilation options. If no target sysroot is
15270 specified, the option prints nothing.
15272 @item -print-sysroot-headers-suffix
15273 @opindex print-sysroot-headers-suffix
15274 Print the suffix added to the target sysroot when searching for
15275 headers, or give an error if the compiler is not configured with such
15276 a suffix---and don't do anything else.
15279 @opindex dumpmachine
15280 Print the compiler's target machine (for example,
15281 @samp{i686-pc-linux-gnu})---and don't do anything else.
15284 @opindex dumpversion
15285 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
15286 anything else. This is the compiler version used in filesystem paths and
15287 specs. Depending on how the compiler has been configured it can be just
15288 a single number (major version), two numbers separated by a dot (major and
15289 minor version) or three numbers separated by dots (major, minor and patchlevel
15292 @item -dumpfullversion
15293 @opindex dumpfullversion
15294 Print the full compiler version---and don't do anything else. The output is
15295 always three numbers separated by dots, major, minor and patchlevel version.
15299 Print the compiler's built-in specs---and don't do anything else. (This
15300 is used when GCC itself is being built.) @xref{Spec Files}.
15303 @node Submodel Options
15304 @section Machine-Dependent Options
15305 @cindex submodel options
15306 @cindex specifying hardware config
15307 @cindex hardware models and configurations, specifying
15308 @cindex target-dependent options
15309 @cindex machine-dependent options
15311 Each target machine supported by GCC can have its own options---for
15312 example, to allow you to compile for a particular processor variant or
15313 ABI, or to control optimizations specific to that machine. By
15314 convention, the names of machine-specific options start with
15317 Some configurations of the compiler also support additional target-specific
15318 options, usually for compatibility with other compilers on the same
15321 @c This list is ordered alphanumerically by subsection name.
15322 @c It should be the same order and spelling as these options are listed
15323 @c in Machine Dependent Options
15326 * AArch64 Options::
15327 * Adapteva Epiphany Options::
15331 * Blackfin Options::
15337 * DEC Alpha Options::
15341 * GNU/Linux Options::
15351 * MicroBlaze Options::
15354 * MN10300 Options::
15358 * Nios II Options::
15359 * Nvidia PTX Options::
15360 * OpenRISC Options::
15362 * picoChip Options::
15363 * PowerPC Options::
15364 * PowerPC SPE Options::
15367 * RS/6000 and PowerPC Options::
15369 * S/390 and zSeries Options::
15372 * Solaris 2 Options::
15375 * System V Options::
15376 * TILE-Gx Options::
15377 * TILEPro Options::
15382 * VxWorks Options::
15384 * x86 Windows Options::
15385 * Xstormy16 Options::
15387 * zSeries Options::
15390 @node AArch64 Options
15391 @subsection AArch64 Options
15392 @cindex AArch64 Options
15394 These options are defined for AArch64 implementations:
15398 @item -mabi=@var{name}
15400 Generate code for the specified data model. Permissible values
15401 are @samp{ilp32} for SysV-like data model where int, long int and pointers
15402 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15403 but long int and pointers are 64 bits.
15405 The default depends on the specific target configuration. Note that
15406 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15407 entire program with the same ABI, and link with a compatible set of libraries.
15410 @opindex mbig-endian
15411 Generate big-endian code. This is the default when GCC is configured for an
15412 @samp{aarch64_be-*-*} target.
15414 @item -mgeneral-regs-only
15415 @opindex mgeneral-regs-only
15416 Generate code which uses only the general-purpose registers. This will prevent
15417 the compiler from using floating-point and Advanced SIMD registers but will not
15418 impose any restrictions on the assembler.
15420 @item -mlittle-endian
15421 @opindex mlittle-endian
15422 Generate little-endian code. This is the default when GCC is configured for an
15423 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15425 @item -mcmodel=tiny
15426 @opindex mcmodel=tiny
15427 Generate code for the tiny code model. The program and its statically defined
15428 symbols must be within 1MB of each other. Programs can be statically or
15429 dynamically linked.
15431 @item -mcmodel=small
15432 @opindex mcmodel=small
15433 Generate code for the small code model. The program and its statically defined
15434 symbols must be within 4GB of each other. Programs can be statically or
15435 dynamically linked. This is the default code model.
15437 @item -mcmodel=large
15438 @opindex mcmodel=large
15439 Generate code for the large code model. This makes no assumptions about
15440 addresses and sizes of sections. Programs can be statically linked only.
15442 @item -mstrict-align
15443 @itemx -mno-strict-align
15444 @opindex mstrict-align
15445 @opindex mno-strict-align
15446 Avoid or allow generating memory accesses that may not be aligned on a natural
15447 object boundary as described in the architecture specification.
15449 @item -momit-leaf-frame-pointer
15450 @itemx -mno-omit-leaf-frame-pointer
15451 @opindex momit-leaf-frame-pointer
15452 @opindex mno-omit-leaf-frame-pointer
15453 Omit or keep the frame pointer in leaf functions. The former behavior is the
15456 @item -mtls-dialect=desc
15457 @opindex mtls-dialect=desc
15458 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15459 of TLS variables. This is the default.
15461 @item -mtls-dialect=traditional
15462 @opindex mtls-dialect=traditional
15463 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15466 @item -mtls-size=@var{size}
15468 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
15469 This option requires binutils 2.26 or newer.
15471 @item -mfix-cortex-a53-835769
15472 @itemx -mno-fix-cortex-a53-835769
15473 @opindex mfix-cortex-a53-835769
15474 @opindex mno-fix-cortex-a53-835769
15475 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15476 This involves inserting a NOP instruction between memory instructions and
15477 64-bit integer multiply-accumulate instructions.
15479 @item -mfix-cortex-a53-843419
15480 @itemx -mno-fix-cortex-a53-843419
15481 @opindex mfix-cortex-a53-843419
15482 @opindex mno-fix-cortex-a53-843419
15483 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15484 This erratum workaround is made at link time and this will only pass the
15485 corresponding flag to the linker.
15487 @item -mlow-precision-recip-sqrt
15488 @itemx -mno-low-precision-recip-sqrt
15489 @opindex mlow-precision-recip-sqrt
15490 @opindex mno-low-precision-recip-sqrt
15491 Enable or disable the reciprocal square root approximation.
15492 This option only has an effect if @option{-ffast-math} or
15493 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15494 precision of reciprocal square root results to about 16 bits for
15495 single precision and to 32 bits for double precision.
15497 @item -mlow-precision-sqrt
15498 @itemx -mno-low-precision-sqrt
15499 @opindex mlow-precision-sqrt
15500 @opindex mno-low-precision-sqrt
15501 Enable or disable the square root approximation.
15502 This option only has an effect if @option{-ffast-math} or
15503 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15504 precision of square root results to about 16 bits for
15505 single precision and to 32 bits for double precision.
15506 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
15508 @item -mlow-precision-div
15509 @itemx -mno-low-precision-div
15510 @opindex mlow-precision-div
15511 @opindex mno-low-precision-div
15512 Enable or disable the division approximation.
15513 This option only has an effect if @option{-ffast-math} or
15514 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15515 precision of division results to about 16 bits for
15516 single precision and to 32 bits for double precision.
15518 @item -mtrack-speculation
15519 @itemx -mno-track-speculation
15520 Enable or disable generation of additional code to track speculative
15521 execution through conditional branches. The tracking state can then
15522 be used by the compiler when expanding calls to
15523 @code{__builtin_speculation_safe_copy} to permit a more efficient code
15524 sequence to be generated.
15526 @item -march=@var{name}
15528 Specify the name of the target architecture and, optionally, one or
15529 more feature modifiers. This option has the form
15530 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
15532 The permissible values for @var{arch} are @samp{armv8-a},
15533 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a} or @samp{armv8.4-a}
15536 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
15537 support for the ARMv8.4-A architecture extensions.
15539 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
15540 support for the ARMv8.3-A architecture extensions.
15542 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
15543 support for the ARMv8.2-A architecture extensions.
15545 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
15546 support for the ARMv8.1-A architecture extension. In particular, it
15547 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
15549 The value @samp{native} is available on native AArch64 GNU/Linux and
15550 causes the compiler to pick the architecture of the host system. This
15551 option has no effect if the compiler is unable to recognize the
15552 architecture of the host system,
15554 The permissible values for @var{feature} are listed in the sub-section
15555 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15556 Feature Modifiers}. Where conflicting feature modifiers are
15557 specified, the right-most feature is used.
15559 GCC uses @var{name} to determine what kind of instructions it can emit
15560 when generating assembly code. If @option{-march} is specified
15561 without either of @option{-mtune} or @option{-mcpu} also being
15562 specified, the code is tuned to perform well across a range of target
15563 processors implementing the target architecture.
15565 @item -mtune=@var{name}
15567 Specify the name of the target processor for which GCC should tune the
15568 performance of the code. Permissible values for this option are:
15569 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
15570 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
15571 @samp{cortex-a76}, @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
15572 @samp{qdf24xx}, @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
15573 @samp{thunderx}, @samp{thunderxt88}, @samp{thunderxt88p1}, @samp{thunderxt81},
15574 @samp{tsv110}, @samp{thunderxt83}, @samp{thunderx2t99},
15575 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15576 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15577 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
15580 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15581 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15582 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
15583 should tune for a big.LITTLE system.
15585 Additionally on native AArch64 GNU/Linux systems the value
15586 @samp{native} tunes performance to the host system. This option has no effect
15587 if the compiler is unable to recognize the processor of the host system.
15589 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
15590 are specified, the code is tuned to perform well across a range
15591 of target processors.
15593 This option cannot be suffixed by feature modifiers.
15595 @item -mcpu=@var{name}
15597 Specify the name of the target processor, optionally suffixed by one
15598 or more feature modifiers. This option has the form
15599 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
15600 the permissible values for @var{cpu} are the same as those available
15601 for @option{-mtune}. The permissible values for @var{feature} are
15602 documented in the sub-section on
15603 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15604 Feature Modifiers}. Where conflicting feature modifiers are
15605 specified, the right-most feature is used.
15607 GCC uses @var{name} to determine what kind of instructions it can emit when
15608 generating assembly code (as if by @option{-march}) and to determine
15609 the target processor for which to tune for performance (as if
15610 by @option{-mtune}). Where this option is used in conjunction
15611 with @option{-march} or @option{-mtune}, those options take precedence
15612 over the appropriate part of this option.
15614 @item -moverride=@var{string}
15616 Override tuning decisions made by the back-end in response to a
15617 @option{-mtune=} switch. The syntax, semantics, and accepted values
15618 for @var{string} in this option are not guaranteed to be consistent
15621 This option is only intended to be useful when developing GCC.
15623 @item -mverbose-cost-dump
15624 @opindex mverbose-cost-dump
15625 Enable verbose cost model dumping in the debug dump files. This option is
15626 provided for use in debugging the compiler.
15628 @item -mpc-relative-literal-loads
15629 @itemx -mno-pc-relative-literal-loads
15630 @opindex mpc-relative-literal-loads
15631 @opindex mno-pc-relative-literal-loads
15632 Enable or disable PC-relative literal loads. With this option literal pools are
15633 accessed using a single instruction and emitted after each function. This
15634 limits the maximum size of functions to 1MB. This is enabled by default for
15635 @option{-mcmodel=tiny}.
15637 @item -msign-return-address=@var{scope}
15638 @opindex msign-return-address
15639 Select the function scope on which return address signing will be applied.
15640 Permissible values are @samp{none}, which disables return address signing,
15641 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
15642 functions, and @samp{all}, which enables pointer signing for all functions. The
15643 default value is @samp{none}.
15645 @item -msve-vector-bits=@var{bits}
15646 @opindex msve-vector-bits
15647 Specify the number of bits in an SVE vector register. This option only has
15648 an effect when SVE is enabled.
15650 GCC supports two forms of SVE code generation: ``vector-length
15651 agnostic'' output that works with any size of vector register and
15652 ``vector-length specific'' output that only works when the vector
15653 registers are a particular size. Replacing @var{bits} with
15654 @samp{scalable} selects vector-length agnostic output while
15655 replacing it with a number selects vector-length specific output.
15656 The possible lengths in the latter case are: 128, 256, 512, 1024
15657 and 2048. @samp{scalable} is the default.
15659 At present, @samp{-msve-vector-bits=128} produces the same output
15660 as @samp{-msve-vector-bits=scalable}.
15664 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
15665 @anchor{aarch64-feature-modifiers}
15666 @cindex @option{-march} feature modifiers
15667 @cindex @option{-mcpu} feature modifiers
15668 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
15669 the following and their inverses @option{no@var{feature}}:
15673 Enable CRC extension. This is on by default for
15674 @option{-march=armv8.1-a}.
15676 Enable Crypto extension. This also enables Advanced SIMD and floating-point
15679 Enable floating-point instructions. This is on by default for all possible
15680 values for options @option{-march} and @option{-mcpu}.
15682 Enable Advanced SIMD instructions. This also enables floating-point
15683 instructions. This is on by default for all possible values for options
15684 @option{-march} and @option{-mcpu}.
15686 Enable Scalable Vector Extension instructions. This also enables Advanced
15687 SIMD and floating-point instructions.
15689 Enable Large System Extension instructions. This is on by default for
15690 @option{-march=armv8.1-a}.
15692 Enable Round Double Multiply Accumulate instructions. This is on by default
15693 for @option{-march=armv8.1-a}.
15695 Enable FP16 extension. This also enables floating-point instructions.
15697 Enable FP16 fmla extension. This also enables FP16 extensions and
15698 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.
15701 Enable the RcPc extension. This does not change code generation from GCC,
15702 but is passed on to the assembler, enabling inline asm statements to use
15703 instructions from the RcPc extension.
15705 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
15707 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
15710 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
15712 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
15713 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
15715 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
15716 Use of this option with architectures prior to Armv8.2-A is not supported.
15718 Enable the Statistical Profiling extension. This option is only to enable the
15719 extension at the assembler level and does not affect code generation.
15723 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
15724 which implies @option{fp}.
15725 Conversely, @option{nofp} implies @option{nosimd}, which implies
15726 @option{nocrypto}, @option{noaes} and @option{nosha2}.
15728 @node Adapteva Epiphany Options
15729 @subsection Adapteva Epiphany Options
15731 These @samp{-m} options are defined for Adapteva Epiphany:
15734 @item -mhalf-reg-file
15735 @opindex mhalf-reg-file
15736 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
15737 That allows code to run on hardware variants that lack these registers.
15739 @item -mprefer-short-insn-regs
15740 @opindex mprefer-short-insn-regs
15741 Preferentially allocate registers that allow short instruction generation.
15742 This can result in increased instruction count, so this may either reduce or
15743 increase overall code size.
15745 @item -mbranch-cost=@var{num}
15746 @opindex mbranch-cost
15747 Set the cost of branches to roughly @var{num} ``simple'' instructions.
15748 This cost is only a heuristic and is not guaranteed to produce
15749 consistent results across releases.
15753 Enable the generation of conditional moves.
15755 @item -mnops=@var{num}
15757 Emit @var{num} NOPs before every other generated instruction.
15759 @item -mno-soft-cmpsf
15760 @opindex mno-soft-cmpsf
15761 @opindex msoft-cmpsf
15762 For single-precision floating-point comparisons, emit an @code{fsub} instruction
15763 and test the flags. This is faster than a software comparison, but can
15764 get incorrect results in the presence of NaNs, or when two different small
15765 numbers are compared such that their difference is calculated as zero.
15766 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
15767 software comparisons.
15769 @item -mstack-offset=@var{num}
15770 @opindex mstack-offset
15771 Set the offset between the top of the stack and the stack pointer.
15772 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
15773 can be used by leaf functions without stack allocation.
15774 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
15775 Note also that this option changes the ABI; compiling a program with a
15776 different stack offset than the libraries have been compiled with
15777 generally does not work.
15778 This option can be useful if you want to evaluate if a different stack
15779 offset would give you better code, but to actually use a different stack
15780 offset to build working programs, it is recommended to configure the
15781 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
15783 @item -mno-round-nearest
15784 @opindex mno-round-nearest
15785 @opindex mround-nearest
15786 Make the scheduler assume that the rounding mode has been set to
15787 truncating. The default is @option{-mround-nearest}.
15790 @opindex mlong-calls
15791 If not otherwise specified by an attribute, assume all calls might be beyond
15792 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
15793 function address into a register before performing a (otherwise direct) call.
15794 This is the default.
15796 @item -mshort-calls
15797 @opindex short-calls
15798 If not otherwise specified by an attribute, assume all direct calls are
15799 in the range of the @code{b} / @code{bl} instructions, so use these instructions
15800 for direct calls. The default is @option{-mlong-calls}.
15804 Assume addresses can be loaded as 16-bit unsigned values. This does not
15805 apply to function addresses for which @option{-mlong-calls} semantics
15808 @item -mfp-mode=@var{mode}
15810 Set the prevailing mode of the floating-point unit.
15811 This determines the floating-point mode that is provided and expected
15812 at function call and return time. Making this mode match the mode you
15813 predominantly need at function start can make your programs smaller and
15814 faster by avoiding unnecessary mode switches.
15816 @var{mode} can be set to one the following values:
15820 Any mode at function entry is valid, and retained or restored when
15821 the function returns, and when it calls other functions.
15822 This mode is useful for compiling libraries or other compilation units
15823 you might want to incorporate into different programs with different
15824 prevailing FPU modes, and the convenience of being able to use a single
15825 object file outweighs the size and speed overhead for any extra
15826 mode switching that might be needed, compared with what would be needed
15827 with a more specific choice of prevailing FPU mode.
15830 This is the mode used for floating-point calculations with
15831 truncating (i.e.@: round towards zero) rounding mode. That includes
15832 conversion from floating point to integer.
15834 @item round-nearest
15835 This is the mode used for floating-point calculations with
15836 round-to-nearest-or-even rounding mode.
15839 This is the mode used to perform integer calculations in the FPU, e.g.@:
15840 integer multiply, or integer multiply-and-accumulate.
15843 The default is @option{-mfp-mode=caller}
15845 @item -mno-split-lohi
15846 @itemx -mno-postinc
15847 @itemx -mno-postmodify
15848 @opindex mno-split-lohi
15849 @opindex msplit-lohi
15850 @opindex mno-postinc
15852 @opindex mno-postmodify
15853 @opindex mpostmodify
15854 Code generation tweaks that disable, respectively, splitting of 32-bit
15855 loads, generation of post-increment addresses, and generation of
15856 post-modify addresses. The defaults are @option{msplit-lohi},
15857 @option{-mpost-inc}, and @option{-mpost-modify}.
15859 @item -mnovect-double
15860 @opindex mno-vect-double
15861 @opindex mvect-double
15862 Change the preferred SIMD mode to SImode. The default is
15863 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
15865 @item -max-vect-align=@var{num}
15866 @opindex max-vect-align
15867 The maximum alignment for SIMD vector mode types.
15868 @var{num} may be 4 or 8. The default is 8.
15869 Note that this is an ABI change, even though many library function
15870 interfaces are unaffected if they don't use SIMD vector modes
15871 in places that affect size and/or alignment of relevant types.
15873 @item -msplit-vecmove-early
15874 @opindex msplit-vecmove-early
15875 Split vector moves into single word moves before reload. In theory this
15876 can give better register allocation, but so far the reverse seems to be
15877 generally the case.
15879 @item -m1reg-@var{reg}
15881 Specify a register to hold the constant @minus{}1, which makes loading small negative
15882 constants and certain bitmasks faster.
15883 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
15884 which specify use of that register as a fixed register,
15885 and @samp{none}, which means that no register is used for this
15886 purpose. The default is @option{-m1reg-none}.
15891 @subsection ARC Options
15892 @cindex ARC options
15894 The following options control the architecture variant for which code
15897 @c architecture variants
15900 @item -mbarrel-shifter
15901 @opindex mbarrel-shifter
15902 Generate instructions supported by barrel shifter. This is the default
15903 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
15906 @opindex mjli-alawys
15907 Force to call a function using jli_s instruction. This option is
15908 valid only for ARCv2 architecture.
15910 @item -mcpu=@var{cpu}
15912 Set architecture type, register usage, and instruction scheduling
15913 parameters for @var{cpu}. There are also shortcut alias options
15914 available for backward compatibility and convenience. Supported
15915 values for @var{cpu} are
15921 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
15925 Compile for ARC601. Alias: @option{-mARC601}.
15930 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
15931 This is the default when configured with @option{--with-cpu=arc700}@.
15934 Compile for ARC EM.
15937 Compile for ARC HS.
15940 Compile for ARC EM CPU with no hardware extensions.
15943 Compile for ARC EM4 CPU.
15946 Compile for ARC EM4 DMIPS CPU.
15949 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
15953 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
15954 double assist instructions.
15957 Compile for ARC HS CPU with no hardware extensions except the atomic
15961 Compile for ARC HS34 CPU.
15964 Compile for ARC HS38 CPU.
15967 Compile for ARC HS38 CPU with all hardware extensions on.
15970 Compile for ARC 600 CPU with @code{norm} instructions enabled.
15972 @item arc600_mul32x16
15973 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
15974 instructions enabled.
15977 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
15978 instructions enabled.
15981 Compile for ARC 601 CPU with @code{norm} instructions enabled.
15983 @item arc601_mul32x16
15984 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
15985 instructions enabled.
15988 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
15989 instructions enabled.
15992 Compile for ARC 700 on NPS400 chip.
15995 Compile for ARC EM minimalist configuration featuring reduced register
16002 @itemx -mdpfp-compact
16003 @opindex mdpfp-compact
16004 Generate double-precision FPX instructions, tuned for the compact
16008 @opindex mdpfp-fast
16009 Generate double-precision FPX instructions, tuned for the fast
16012 @item -mno-dpfp-lrsr
16013 @opindex mno-dpfp-lrsr
16014 Disable @code{lr} and @code{sr} instructions from using FPX extension
16019 Generate extended arithmetic instructions. Currently only
16020 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
16021 supported. This is always enabled for @option{-mcpu=ARC700}.
16026 Do not generate @code{mpy}-family instructions for ARC700. This option is
16031 Generate 32x16-bit multiply and multiply-accumulate instructions.
16035 Generate @code{mul64} and @code{mulu64} instructions.
16036 Only valid for @option{-mcpu=ARC600}.
16040 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
16045 @itemx -mspfp-compact
16046 @opindex mspfp-compact
16047 Generate single-precision FPX instructions, tuned for the compact
16051 @opindex mspfp-fast
16052 Generate single-precision FPX instructions, tuned for the fast
16057 Enable generation of ARC SIMD instructions via target-specific
16058 builtins. Only valid for @option{-mcpu=ARC700}.
16061 @opindex msoft-float
16062 This option ignored; it is provided for compatibility purposes only.
16063 Software floating-point code is emitted by default, and this default
16064 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
16065 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
16066 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
16070 Generate @code{swap} instructions.
16074 This enables use of the locked load/store conditional extension to implement
16075 atomic memory built-in functions. Not available for ARC 6xx or ARC
16080 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
16082 @item -mcode-density
16083 @opindex mcode-density
16084 Enable code density instructions for ARC EM.
16085 This option is on by default for ARC HS.
16089 Enable double load/store operations for ARC HS cores.
16091 @item -mtp-regno=@var{regno}
16093 Specify thread pointer register number.
16095 @item -mmpy-option=@var{multo}
16096 @opindex mmpy-option
16097 Compile ARCv2 code with a multiplier design option. You can specify
16098 the option using either a string or numeric value for @var{multo}.
16099 @samp{wlh1} is the default value. The recognized values are:
16104 No multiplier available.
16108 16x16 multiplier, fully pipelined.
16109 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
16113 32x32 multiplier, fully
16114 pipelined (1 stage). The following instructions are additionally
16115 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16119 32x32 multiplier, fully pipelined
16120 (2 stages). The following instructions are additionally enabled: @code{mpy},
16121 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16125 Two 16x16 multipliers, blocking,
16126 sequential. The following instructions are additionally enabled: @code{mpy},
16127 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16131 One 16x16 multiplier, blocking,
16132 sequential. The following instructions are additionally enabled: @code{mpy},
16133 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16137 One 32x4 multiplier, blocking,
16138 sequential. The following instructions are additionally enabled: @code{mpy},
16139 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16143 ARC HS SIMD support.
16147 ARC HS SIMD support.
16151 ARC HS SIMD support.
16155 This option is only available for ARCv2 cores@.
16157 @item -mfpu=@var{fpu}
16159 Enables support for specific floating-point hardware extensions for ARCv2
16160 cores. Supported values for @var{fpu} are:
16165 Enables support for single-precision floating-point hardware
16169 Enables support for double-precision floating-point hardware
16170 extensions. The single-precision floating-point extension is also
16171 enabled. Not available for ARC EM@.
16174 Enables support for double-precision floating-point hardware
16175 extensions using double-precision assist instructions. The single-precision
16176 floating-point extension is also enabled. This option is
16177 only available for ARC EM@.
16180 Enables support for double-precision floating-point hardware
16181 extensions using double-precision assist instructions.
16182 The single-precision floating-point, square-root, and divide
16183 extensions are also enabled. This option is
16184 only available for ARC EM@.
16187 Enables support for double-precision floating-point hardware
16188 extensions using double-precision assist instructions.
16189 The single-precision floating-point and fused multiply and add
16190 hardware extensions are also enabled. This option is
16191 only available for ARC EM@.
16194 Enables support for double-precision floating-point hardware
16195 extensions using double-precision assist instructions.
16196 All single-precision floating-point hardware extensions are also
16197 enabled. This option is only available for ARC EM@.
16200 Enables support for single-precision floating-point, square-root and divide
16201 hardware extensions@.
16204 Enables support for double-precision floating-point, square-root and divide
16205 hardware extensions. This option
16206 includes option @samp{fpus_div}. Not available for ARC EM@.
16209 Enables support for single-precision floating-point and
16210 fused multiply and add hardware extensions@.
16213 Enables support for double-precision floating-point and
16214 fused multiply and add hardware extensions. This option
16215 includes option @samp{fpus_fma}. Not available for ARC EM@.
16218 Enables support for all single-precision floating-point hardware
16222 Enables support for all single- and double-precision floating-point
16223 hardware extensions. Not available for ARC EM@.
16227 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
16228 @opindex mirq-ctrl-saved
16229 Specifies general-purposes registers that the processor automatically
16230 saves/restores on interrupt entry and exit. @var{register-range} is
16231 specified as two registers separated by a dash. The register range
16232 always starts with @code{r0}, the upper limit is @code{fp} register.
16233 @var{blink} and @var{lp_count} are optional. This option is only
16234 valid for ARC EM and ARC HS cores.
16236 @item -mrgf-banked-regs=@var{number}
16237 @opindex mrgf-banked-regs
16238 Specifies the number of registers replicated in second register bank
16239 on entry to fast interrupt. Fast interrupts are interrupts with the
16240 highest priority level P0. These interrupts save only PC and STATUS32
16241 registers to avoid memory transactions during interrupt entry and exit
16242 sequences. Use this option when you are using fast interrupts in an
16243 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
16245 @item -mlpc-width=@var{width}
16246 @opindex mlpc-width
16247 Specify the width of the @code{lp_count} register. Valid values for
16248 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
16249 fixed to 32 bits. If the width is less than 32, the compiler does not
16250 attempt to transform loops in your program to use the zero-delay loop
16251 mechanism unless it is known that the @code{lp_count} register can
16252 hold the required loop-counter value. Depending on the width
16253 specified, the compiler and run-time library might continue to use the
16254 loop mechanism for various needs. This option defines macro
16255 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
16259 This option instructs the compiler to generate code for a 16-entry
16260 register file. This option defines the @code{__ARC_RF16__}
16261 preprocessor macro.
16263 @item -mbranch-index
16264 @opindex mbranch-index
16265 Enable use of @code{bi} or @code{bih} instructions to implement jump
16270 The following options are passed through to the assembler, and also
16271 define preprocessor macro symbols.
16273 @c Flags used by the assembler, but for which we define preprocessor
16274 @c macro symbols as well.
16277 @opindex mdsp-packa
16278 Passed down to the assembler to enable the DSP Pack A extensions.
16279 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
16284 Passed down to the assembler to enable the dual Viterbi butterfly
16285 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
16286 option is deprecated.
16288 @c ARC700 4.10 extension instruction
16291 Passed down to the assembler to enable the locked load/store
16292 conditional extension. Also sets the preprocessor symbol
16297 Passed down to the assembler. Also sets the preprocessor symbol
16298 @code{__Xxmac_d16}. This option is deprecated.
16302 Passed down to the assembler. Also sets the preprocessor symbol
16303 @code{__Xxmac_24}. This option is deprecated.
16305 @c ARC700 4.10 extension instruction
16308 Passed down to the assembler to enable the 64-bit time-stamp counter
16309 extension instruction. Also sets the preprocessor symbol
16310 @code{__Xrtsc}. This option is deprecated.
16312 @c ARC700 4.10 extension instruction
16315 Passed down to the assembler to enable the swap byte ordering
16316 extension instruction. Also sets the preprocessor symbol
16320 @opindex mtelephony
16321 Passed down to the assembler to enable dual- and single-operand
16322 instructions for telephony. Also sets the preprocessor symbol
16323 @code{__Xtelephony}. This option is deprecated.
16327 Passed down to the assembler to enable the XY memory extension. Also
16328 sets the preprocessor symbol @code{__Xxy}.
16332 The following options control how the assembly code is annotated:
16334 @c Assembly annotation options
16338 Annotate assembler instructions with estimated addresses.
16340 @item -mannotate-align
16341 @opindex mannotate-align
16342 Explain what alignment considerations lead to the decision to make an
16343 instruction short or long.
16347 The following options are passed through to the linker:
16349 @c options passed through to the linker
16353 Passed through to the linker, to specify use of the @code{arclinux} emulation.
16354 This option is enabled by default in tool chains built for
16355 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
16356 when profiling is not requested.
16358 @item -marclinux_prof
16359 @opindex marclinux_prof
16360 Passed through to the linker, to specify use of the
16361 @code{arclinux_prof} emulation. This option is enabled by default in
16362 tool chains built for @w{@code{arc-linux-uclibc}} and
16363 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
16367 The following options control the semantics of generated code:
16369 @c semantically relevant code generation options
16372 @opindex mlong-calls
16373 Generate calls as register indirect calls, thus providing access
16374 to the full 32-bit address range.
16376 @item -mmedium-calls
16377 @opindex mmedium-calls
16378 Don't use less than 25-bit addressing range for calls, which is the
16379 offset available for an unconditional branch-and-link
16380 instruction. Conditional execution of function calls is suppressed, to
16381 allow use of the 25-bit range, rather than the 21-bit range with
16382 conditional branch-and-link. This is the default for tool chains built
16383 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
16387 Put definitions of externally-visible data in a small data section if
16388 that data is no bigger than @var{num} bytes. The default value of
16389 @var{num} is 4 for any ARC configuration, or 8 when we have double
16390 load/store operations.
16395 Do not generate sdata references. This is the default for tool chains
16396 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
16399 @item -mvolatile-cache
16400 @opindex mvolatile-cache
16401 Use ordinarily cached memory accesses for volatile references. This is the
16404 @item -mno-volatile-cache
16405 @opindex mno-volatile-cache
16406 @opindex mvolatile-cache
16407 Enable cache bypass for volatile references.
16411 The following options fine tune code generation:
16412 @c code generation tuning options
16415 @opindex malign-call
16416 Do alignment optimizations for call instructions.
16418 @item -mauto-modify-reg
16419 @opindex mauto-modify-reg
16420 Enable the use of pre/post modify with register displacement.
16422 @item -mbbit-peephole
16423 @opindex mbbit-peephole
16424 Enable bbit peephole2.
16428 This option disables a target-specific pass in @file{arc_reorg} to
16429 generate compare-and-branch (@code{br@var{cc}}) instructions.
16430 It has no effect on
16431 generation of these instructions driven by the combiner pass.
16433 @item -mcase-vector-pcrel
16434 @opindex mcase-vector-pcrel
16435 Use PC-relative switch case tables to enable case table shortening.
16436 This is the default for @option{-Os}.
16438 @item -mcompact-casesi
16439 @opindex mcompact-casesi
16440 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
16441 and only available for ARCv1 cores. This option is deprecated.
16443 @item -mno-cond-exec
16444 @opindex mno-cond-exec
16445 Disable the ARCompact-specific pass to generate conditional
16446 execution instructions.
16448 Due to delay slot scheduling and interactions between operand numbers,
16449 literal sizes, instruction lengths, and the support for conditional execution,
16450 the target-independent pass to generate conditional execution is often lacking,
16451 so the ARC port has kept a special pass around that tries to find more
16452 conditional execution generation opportunities after register allocation,
16453 branch shortening, and delay slot scheduling have been done. This pass
16454 generally, but not always, improves performance and code size, at the cost of
16455 extra compilation time, which is why there is an option to switch it off.
16456 If you have a problem with call instructions exceeding their allowable
16457 offset range because they are conditionalized, you should consider using
16458 @option{-mmedium-calls} instead.
16460 @item -mearly-cbranchsi
16461 @opindex mearly-cbranchsi
16462 Enable pre-reload use of the @code{cbranchsi} pattern.
16464 @item -mexpand-adddi
16465 @opindex mexpand-adddi
16466 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
16467 @code{add.f}, @code{adc} etc. This option is deprecated.
16469 @item -mindexed-loads
16470 @opindex mindexed-loads
16471 Enable the use of indexed loads. This can be problematic because some
16472 optimizers then assume that indexed stores exist, which is not
16477 Enable Local Register Allocation. This is still experimental for ARC,
16478 so by default the compiler uses standard reload
16479 (i.e.@: @option{-mno-lra}).
16481 @item -mlra-priority-none
16482 @opindex mlra-priority-none
16483 Don't indicate any priority for target registers.
16485 @item -mlra-priority-compact
16486 @opindex mlra-priority-compact
16487 Indicate target register priority for r0..r3 / r12..r15.
16489 @item -mlra-priority-noncompact
16490 @opindex mlra-priority-noncompact
16491 Reduce target register priority for r0..r3 / r12..r15.
16494 @opindex mmillicode
16495 When optimizing for size (using @option{-Os}), prologues and epilogues
16496 that have to save or restore a large number of registers are often
16497 shortened by using call to a special function in libgcc; this is
16498 referred to as a @emph{millicode} call. As these calls can pose
16499 performance issues, and/or cause linking issues when linking in a
16500 nonstandard way, this option is provided to turn on or off millicode
16503 @item -mcode-density-frame
16504 @opindex mcode-density-frame
16505 This option enable the compiler to emit @code{enter} and @code{leave}
16506 instructions. These instructions are only valid for CPUs with
16507 code-density feature.
16510 @opindex mmixed-code
16511 Tweak register allocation to help 16-bit instruction generation.
16512 This generally has the effect of decreasing the average instruction size
16513 while increasing the instruction count.
16517 Enable @samp{q} instruction alternatives.
16518 This is the default for @option{-Os}.
16522 Enable @samp{Rcq} constraint handling.
16523 Most short code generation depends on this.
16524 This is the default.
16528 Enable @samp{Rcw} constraint handling.
16529 Most ccfsm condexec mostly depends on this.
16530 This is the default.
16532 @item -msize-level=@var{level}
16533 @opindex msize-level
16534 Fine-tune size optimization with regards to instruction lengths and alignment.
16535 The recognized values for @var{level} are:
16538 No size optimization. This level is deprecated and treated like @samp{1}.
16541 Short instructions are used opportunistically.
16544 In addition, alignment of loops and of code after barriers are dropped.
16547 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
16551 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
16552 the behavior when this is not set is equivalent to level @samp{1}.
16554 @item -mtune=@var{cpu}
16556 Set instruction scheduling parameters for @var{cpu}, overriding any implied
16557 by @option{-mcpu=}.
16559 Supported values for @var{cpu} are
16563 Tune for ARC600 CPU.
16566 Tune for ARC601 CPU.
16569 Tune for ARC700 CPU with standard multiplier block.
16572 Tune for ARC700 CPU with XMAC block.
16575 Tune for ARC725D CPU.
16578 Tune for ARC750D CPU.
16582 @item -mmultcost=@var{num}
16584 Cost to assume for a multiply instruction, with @samp{4} being equal to a
16585 normal instruction.
16587 @item -munalign-prob-threshold=@var{probability}
16588 @opindex munalign-prob-threshold
16589 Set probability threshold for unaligning branches.
16590 When tuning for @samp{ARC700} and optimizing for speed, branches without
16591 filled delay slot are preferably emitted unaligned and long, unless
16592 profiling indicates that the probability for the branch to be taken
16593 is below @var{probability}. @xref{Cross-profiling}.
16594 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
16598 The following options are maintained for backward compatibility, but
16599 are now deprecated and will be removed in a future release:
16601 @c Deprecated options
16609 @opindex mbig-endian
16612 Compile code for big-endian targets. Use of these options is now
16613 deprecated. Big-endian code is supported by configuring GCC to build
16614 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
16615 for which big endian is the default.
16617 @item -mlittle-endian
16618 @opindex mlittle-endian
16621 Compile code for little-endian targets. Use of these options is now
16622 deprecated. Little-endian code is supported by configuring GCC to build
16623 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
16624 for which little endian is the default.
16626 @item -mbarrel_shifter
16627 @opindex mbarrel_shifter
16628 Replaced by @option{-mbarrel-shifter}.
16630 @item -mdpfp_compact
16631 @opindex mdpfp_compact
16632 Replaced by @option{-mdpfp-compact}.
16635 @opindex mdpfp_fast
16636 Replaced by @option{-mdpfp-fast}.
16639 @opindex mdsp_packa
16640 Replaced by @option{-mdsp-packa}.
16644 Replaced by @option{-mea}.
16648 Replaced by @option{-mmac-24}.
16652 Replaced by @option{-mmac-d16}.
16654 @item -mspfp_compact
16655 @opindex mspfp_compact
16656 Replaced by @option{-mspfp-compact}.
16659 @opindex mspfp_fast
16660 Replaced by @option{-mspfp-fast}.
16662 @item -mtune=@var{cpu}
16664 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
16665 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
16666 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
16668 @item -multcost=@var{num}
16670 Replaced by @option{-mmultcost}.
16675 @subsection ARM Options
16676 @cindex ARM options
16678 These @samp{-m} options are defined for the ARM port:
16681 @item -mabi=@var{name}
16683 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
16684 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
16687 @opindex mapcs-frame
16688 Generate a stack frame that is compliant with the ARM Procedure Call
16689 Standard for all functions, even if this is not strictly necessary for
16690 correct execution of the code. Specifying @option{-fomit-frame-pointer}
16691 with this option causes the stack frames not to be generated for
16692 leaf functions. The default is @option{-mno-apcs-frame}.
16693 This option is deprecated.
16697 This is a synonym for @option{-mapcs-frame} and is deprecated.
16700 @c not currently implemented
16701 @item -mapcs-stack-check
16702 @opindex mapcs-stack-check
16703 Generate code to check the amount of stack space available upon entry to
16704 every function (that actually uses some stack space). If there is
16705 insufficient space available then either the function
16706 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
16707 called, depending upon the amount of stack space required. The runtime
16708 system is required to provide these functions. The default is
16709 @option{-mno-apcs-stack-check}, since this produces smaller code.
16711 @c not currently implemented
16712 @item -mapcs-reentrant
16713 @opindex mapcs-reentrant
16714 Generate reentrant, position-independent code. The default is
16715 @option{-mno-apcs-reentrant}.
16718 @item -mthumb-interwork
16719 @opindex mthumb-interwork
16720 Generate code that supports calling between the ARM and Thumb
16721 instruction sets. Without this option, on pre-v5 architectures, the
16722 two instruction sets cannot be reliably used inside one program. The
16723 default is @option{-mno-thumb-interwork}, since slightly larger code
16724 is generated when @option{-mthumb-interwork} is specified. In AAPCS
16725 configurations this option is meaningless.
16727 @item -mno-sched-prolog
16728 @opindex mno-sched-prolog
16729 @opindex msched-prolog
16730 Prevent the reordering of instructions in the function prologue, or the
16731 merging of those instruction with the instructions in the function's
16732 body. This means that all functions start with a recognizable set
16733 of instructions (or in fact one of a choice from a small set of
16734 different function prologues), and this information can be used to
16735 locate the start of functions inside an executable piece of code. The
16736 default is @option{-msched-prolog}.
16738 @item -mfloat-abi=@var{name}
16739 @opindex mfloat-abi
16740 Specifies which floating-point ABI to use. Permissible values
16741 are: @samp{soft}, @samp{softfp} and @samp{hard}.
16743 Specifying @samp{soft} causes GCC to generate output containing
16744 library calls for floating-point operations.
16745 @samp{softfp} allows the generation of code using hardware floating-point
16746 instructions, but still uses the soft-float calling conventions.
16747 @samp{hard} allows generation of floating-point instructions
16748 and uses FPU-specific calling conventions.
16750 The default depends on the specific target configuration. Note that
16751 the hard-float and soft-float ABIs are not link-compatible; you must
16752 compile your entire program with the same ABI, and link with a
16753 compatible set of libraries.
16755 @item -mlittle-endian
16756 @opindex mlittle-endian
16757 Generate code for a processor running in little-endian mode. This is
16758 the default for all standard configurations.
16761 @opindex mbig-endian
16762 Generate code for a processor running in big-endian mode; the default is
16763 to compile code for a little-endian processor.
16768 When linking a big-endian image select between BE8 and BE32 formats.
16769 The option has no effect for little-endian images and is ignored. The
16770 default is dependent on the selected target architecture. For ARMv6
16771 and later architectures the default is BE8, for older architectures
16772 the default is BE32. BE32 format has been deprecated by ARM.
16774 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
16776 This specifies the name of the target ARM architecture. GCC uses this
16777 name to determine what kind of instructions it can emit when generating
16778 assembly code. This option can be used in conjunction with or instead
16779 of the @option{-mcpu=} option.
16781 Permissible names are:
16783 @samp{armv5t}, @samp{armv5te},
16784 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
16785 @samp{armv6z}, @samp{armv6zk},
16786 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
16787 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
16792 @samp{armv6-m}, @samp{armv6s-m},
16793 @samp{armv7-m}, @samp{armv7e-m},
16794 @samp{armv8-m.base}, @samp{armv8-m.main},
16795 @samp{iwmmxt} and @samp{iwmmxt2}.
16797 Additionally, the following architectures, which lack support for the
16798 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
16800 Many of the architectures support extensions. These can be added by
16801 appending @samp{+@var{extension}} to the architecture name. Extension
16802 options are processed in order and capabilities accumulate. An extension
16803 will also enable any necessary base extensions
16804 upon which it depends. For example, the @samp{+crypto} extension
16805 will always enable the @samp{+simd} extension. The exception to the
16806 additive construction is for extensions that are prefixed with
16807 @samp{+no@dots{}}: these extensions disable the specified option and
16808 any other extensions that may depend on the presence of that
16811 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
16812 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
16813 entirely disabled by the @samp{+nofp} option that follows it.
16815 Most extension names are generically named, but have an effect that is
16816 dependent upon the architecture to which it is applied. For example,
16817 the @samp{+simd} option can be applied to both @samp{armv7-a} and
16818 @samp{armv8-a} architectures, but will enable the original ARMv7-A
16819 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
16820 variant for @samp{armv8-a}.
16822 The table below lists the supported extensions for each architecture.
16823 Architectures not mentioned do not support any extensions.
16836 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
16837 used as an alias for this extension.
16840 Disable the floating-point instructions.
16844 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
16847 The VFPv3 floating-point instructions, with 16 double-precision
16848 registers. The extension @samp{+vfpv3-d16} can be used as an alias
16849 for this extension. Note that floating-point is not supported by the
16850 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
16851 ARMv7-R architectures.
16854 Disable the floating-point instructions.
16860 The VFPv3 floating-point instructions, with 16 double-precision
16861 registers. The extension @samp{+vfpv3-d16} can be used as an alias
16862 for this extension.
16865 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
16866 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
16867 for this extension.
16870 The VFPv3 floating-point instructions, with 32 double-precision
16873 @item +vfpv3-d16-fp16
16874 The VFPv3 floating-point instructions, with 16 double-precision
16875 registers and the half-precision floating-point conversion operations.
16878 The VFPv3 floating-point instructions, with 32 double-precision
16879 registers and the half-precision floating-point conversion operations.
16882 The VFPv4 floating-point instructions, with 16 double-precision
16886 The VFPv4 floating-point instructions, with 32 double-precision
16890 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
16891 the half-precision floating-point conversion operations.
16894 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
16897 Disable the Advanced SIMD instructions (does not disable floating point).
16900 Disable the floating-point and Advanced SIMD instructions.
16904 The extended version of the ARMv7-A architecture with support for
16908 The VFPv4 floating-point instructions, with 16 double-precision registers.
16909 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
16912 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
16913 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
16916 The VFPv3 floating-point instructions, with 16 double-precision
16920 The VFPv3 floating-point instructions, with 32 double-precision
16923 @item +vfpv3-d16-fp16
16924 The VFPv3 floating-point instructions, with 16 double-precision
16925 registers and the half-precision floating-point conversion operations.
16928 The VFPv3 floating-point instructions, with 32 double-precision
16929 registers and the half-precision floating-point conversion operations.
16932 The VFPv4 floating-point instructions, with 16 double-precision
16936 The VFPv4 floating-point instructions, with 32 double-precision
16940 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
16941 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
16944 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
16945 the half-precision floating-point conversion operations.
16948 Disable the Advanced SIMD instructions (does not disable floating point).
16951 Disable the floating-point and Advanced SIMD instructions.
16957 The Cyclic Redundancy Check (CRC) instructions.
16959 The ARMv8-A Advanced SIMD and floating-point instructions.
16961 The cryptographic instructions.
16963 Disable the cryptographic instructions.
16965 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16967 Speculation Barrier Instruction.
16969 Execution and Data Prediction Restriction Instructions.
16975 The ARMv8.1-A Advanced SIMD and floating-point instructions.
16978 The cryptographic instructions. This also enables the Advanced SIMD and
16979 floating-point instructions.
16982 Disable the cryptographic instructions.
16985 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16988 Speculation Barrier Instruction.
16991 Execution and Data Prediction Restriction Instructions.
16998 The half-precision floating-point data processing instructions.
16999 This also enables the Advanced SIMD and floating-point instructions.
17002 The half-precision floating-point fmla extension. This also enables
17003 the half-precision floating-point extension and Advanced SIMD and
17004 floating-point instructions.
17007 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17010 The cryptographic instructions. This also enables the Advanced SIMD and
17011 floating-point instructions.
17014 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
17017 Disable the cryptographic extension.
17020 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17023 Speculation Barrier Instruction.
17026 Execution and Data Prediction Restriction Instructions.
17032 The half-precision floating-point data processing instructions.
17033 This also enables the Advanced SIMD and floating-point instructions as well
17034 as the Dot Product extension and the half-precision floating-point fmla
17038 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17039 Dot Product extension.
17042 The cryptographic instructions. This also enables the Advanced SIMD and
17043 floating-point instructions as well as the Dot Product extension.
17046 Disable the cryptographic extension.
17049 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17052 Speculation Barrier Instruction.
17055 Execution and Data Prediction Restriction Instructions.
17061 The half-precision floating-point data processing instructions.
17062 This also enables the Advanced SIMD and floating-point instructions as well
17063 as the Dot Product extension and the half-precision floating-point fmla
17067 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17068 Dot Product extension.
17071 The cryptographic instructions. This also enables the Advanced SIMD and
17072 floating-point instructions as well as the Dot Product extension.
17075 Disable the cryptographic extension.
17078 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17084 The single-precision VFPv3 floating-point instructions. The extension
17085 @samp{+vfpv3xd} can be used as an alias for this extension.
17088 The VFPv3 floating-point instructions with 16 double-precision registers.
17089 The extension +vfpv3-d16 can be used as an alias for this extension.
17092 Disable the floating-point extension.
17095 The ARM-state integer division instructions.
17098 Disable the ARM-state integer division extension.
17104 The single-precision VFPv4 floating-point instructions.
17107 The single-precision FPv5 floating-point instructions.
17110 The single- and double-precision FPv5 floating-point instructions.
17113 Disable the floating-point extensions.
17119 The DSP instructions.
17122 Disable the DSP extension.
17125 The single-precision floating-point instructions.
17128 The single- and double-precision floating-point instructions.
17131 Disable the floating-point extension.
17137 The Cyclic Redundancy Check (CRC) instructions.
17139 The single-precision FPv5 floating-point instructions.
17141 The ARMv8-A Advanced SIMD and floating-point instructions.
17143 The cryptographic instructions.
17145 Disable the cryptographic instructions.
17147 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17152 @option{-march=native} causes the compiler to auto-detect the architecture
17153 of the build computer. At present, this feature is only supported on
17154 GNU/Linux, and not all architectures are recognized. If the auto-detect
17155 is unsuccessful the option has no effect.
17157 @item -mtune=@var{name}
17159 This option specifies the name of the target ARM processor for
17160 which GCC should tune the performance of the code.
17161 For some ARM implementations better performance can be obtained by using
17163 Permissible names are: @samp{arm2}, @samp{arm250},
17164 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
17165 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
17166 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
17167 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
17169 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
17170 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
17171 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
17172 @samp{strongarm1110},
17173 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
17174 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
17175 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
17176 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
17177 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
17178 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
17179 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
17180 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
17181 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
17182 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
17183 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17184 @samp{cortex-a76}, @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
17185 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
17193 @samp{cortex-m0plus},
17194 @samp{cortex-m1.small-multiply},
17195 @samp{cortex-m0.small-multiply},
17196 @samp{cortex-m0plus.small-multiply},
17198 @samp{marvell-pj4},
17199 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
17200 @samp{fa526}, @samp{fa626},
17201 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
17204 Additionally, this option can specify that GCC should tune the performance
17205 of the code for a big.LITTLE system. Permissible names are:
17206 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
17207 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17208 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
17209 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
17211 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
17212 performance for a blend of processors within architecture @var{arch}.
17213 The aim is to generate code that run well on the current most popular
17214 processors, balancing between optimizations that benefit some CPUs in the
17215 range, and avoiding performance pitfalls of other CPUs. The effects of
17216 this option may change in future GCC versions as CPU models come and go.
17218 @option{-mtune} permits the same extension options as @option{-mcpu}, but
17219 the extension options do not affect the tuning of the generated code.
17221 @option{-mtune=native} causes the compiler to auto-detect the CPU
17222 of the build computer. At present, this feature is only supported on
17223 GNU/Linux, and not all architectures are recognized. If the auto-detect is
17224 unsuccessful the option has no effect.
17226 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
17228 This specifies the name of the target ARM processor. GCC uses this name
17229 to derive the name of the target ARM architecture (as if specified
17230 by @option{-march}) and the ARM processor type for which to tune for
17231 performance (as if specified by @option{-mtune}). Where this option
17232 is used in conjunction with @option{-march} or @option{-mtune},
17233 those options take precedence over the appropriate part of this option.
17235 Many of the supported CPUs implement optional architectural
17236 extensions. Where this is so the architectural extensions are
17237 normally enabled by default. If implementations that lack the
17238 extension exist, then the extension syntax can be used to disable
17239 those extensions that have been omitted. For floating-point and
17240 Advanced SIMD (Neon) instructions, the settings of the options
17241 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
17242 floating-point and Advanced SIMD instructions will only be used if
17243 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
17244 @option{-mfpu} other than @samp{auto} will override the available
17245 floating-point and SIMD extension instructions.
17247 For example, @samp{cortex-a9} can be found in three major
17248 configurations: integer only, with just a floating-point unit or with
17249 floating-point and Advanced SIMD. The default is to enable all the
17250 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
17251 be used to disable just the SIMD or both the SIMD and floating-point
17252 instructions respectively.
17254 Permissible names for this option are the same as those for
17257 The following extension options are common to the listed CPUs:
17261 Disable the DSP instructions on @samp{cortex-m33}.
17264 Disables the floating-point instructions on @samp{arm9e},
17265 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
17266 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
17267 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
17268 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
17269 Disables the floating-point and SIMD instructions on
17270 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
17271 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
17272 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
17273 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
17274 @samp{cortex-a53} and @samp{cortex-a55}.
17277 Disables the double-precision component of the floating-point instructions
17278 on @samp{cortex-r5}, @samp{cortex-r52} and @samp{cortex-m7}.
17281 Disables the SIMD (but not floating-point) instructions on
17282 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
17283 and @samp{cortex-a9}.
17286 Enables the cryptographic instructions on @samp{cortex-a32},
17287 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
17288 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
17289 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17290 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
17291 @samp{cortex-a75.cortex-a55}.
17294 Additionally the @samp{generic-armv7-a} pseudo target defaults to
17295 VFPv3 with 16 double-precision registers. It supports the following
17296 extension options: @samp{vfpv3-d16}, @samp{vfpv3},
17297 @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16}, @samp{vfpv4-d16},
17298 @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3}, @samp{neon-fp16},
17299 @samp{neon-vfpv4}. The meanings are the same as for the extensions to
17300 @option{-march=armv7-a}.
17302 @option{-mcpu=generic-@var{arch}} is also permissible, and is
17303 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
17304 See @option{-mtune} for more information.
17306 @option{-mcpu=native} causes the compiler to auto-detect the CPU
17307 of the build computer. At present, this feature is only supported on
17308 GNU/Linux, and not all architectures are recognized. If the auto-detect
17309 is unsuccessful the option has no effect.
17311 @item -mfpu=@var{name}
17313 This specifies what floating-point hardware (or hardware emulation) is
17314 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
17316 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
17317 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
17318 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
17319 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
17320 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
17321 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
17322 is an alias for @samp{vfpv2}.
17324 The setting @samp{auto} is the default and is special. It causes the
17325 compiler to select the floating-point and Advanced SIMD instructions
17326 based on the settings of @option{-mcpu} and @option{-march}.
17328 If the selected floating-point hardware includes the NEON extension
17329 (e.g.@: @option{-mfpu=neon}), note that floating-point
17330 operations are not generated by GCC's auto-vectorization pass unless
17331 @option{-funsafe-math-optimizations} is also specified. This is
17332 because NEON hardware does not fully implement the IEEE 754 standard for
17333 floating-point arithmetic (in particular denormal values are treated as
17334 zero), so the use of NEON instructions may lead to a loss of precision.
17336 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}).
17338 @item -mfp16-format=@var{name}
17339 @opindex mfp16-format
17340 Specify the format of the @code{__fp16} half-precision floating-point type.
17341 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
17342 the default is @samp{none}, in which case the @code{__fp16} type is not
17343 defined. @xref{Half-Precision}, for more information.
17345 @item -mstructure-size-boundary=@var{n}
17346 @opindex mstructure-size-boundary
17347 The sizes of all structures and unions are rounded up to a multiple
17348 of the number of bits set by this option. Permissible values are 8, 32
17349 and 64. The default value varies for different toolchains. For the COFF
17350 targeted toolchain the default value is 8. A value of 64 is only allowed
17351 if the underlying ABI supports it.
17353 Specifying a larger number can produce faster, more efficient code, but
17354 can also increase the size of the program. Different values are potentially
17355 incompatible. Code compiled with one value cannot necessarily expect to
17356 work with code or libraries compiled with another value, if they exchange
17357 information using structures or unions.
17359 This option is deprecated.
17361 @item -mabort-on-noreturn
17362 @opindex mabort-on-noreturn
17363 Generate a call to the function @code{abort} at the end of a
17364 @code{noreturn} function. It is executed if the function tries to
17368 @itemx -mno-long-calls
17369 @opindex mlong-calls
17370 @opindex mno-long-calls
17371 Tells the compiler to perform function calls by first loading the
17372 address of the function into a register and then performing a subroutine
17373 call on this register. This switch is needed if the target function
17374 lies outside of the 64-megabyte addressing range of the offset-based
17375 version of subroutine call instruction.
17377 Even if this switch is enabled, not all function calls are turned
17378 into long calls. The heuristic is that static functions, functions
17379 that have the @code{short_call} attribute, functions that are inside
17380 the scope of a @code{#pragma no_long_calls} directive, and functions whose
17381 definitions have already been compiled within the current compilation
17382 unit are not turned into long calls. The exceptions to this rule are
17383 that weak function definitions, functions with the @code{long_call}
17384 attribute or the @code{section} attribute, and functions that are within
17385 the scope of a @code{#pragma long_calls} directive are always
17386 turned into long calls.
17388 This feature is not enabled by default. Specifying
17389 @option{-mno-long-calls} restores the default behavior, as does
17390 placing the function calls within the scope of a @code{#pragma
17391 long_calls_off} directive. Note these switches have no effect on how
17392 the compiler generates code to handle function calls via function
17395 @item -msingle-pic-base
17396 @opindex msingle-pic-base
17397 Treat the register used for PIC addressing as read-only, rather than
17398 loading it in the prologue for each function. The runtime system is
17399 responsible for initializing this register with an appropriate value
17400 before execution begins.
17402 @item -mpic-register=@var{reg}
17403 @opindex mpic-register
17404 Specify the register to be used for PIC addressing.
17405 For standard PIC base case, the default is any suitable register
17406 determined by compiler. For single PIC base case, the default is
17407 @samp{R9} if target is EABI based or stack-checking is enabled,
17408 otherwise the default is @samp{R10}.
17410 @item -mpic-data-is-text-relative
17411 @opindex mpic-data-is-text-relative
17412 Assume that the displacement between the text and data segments is fixed
17413 at static link time. This permits using PC-relative addressing
17414 operations to access data known to be in the data segment. For
17415 non-VxWorks RTP targets, this option is enabled by default. When
17416 disabled on such targets, it will enable @option{-msingle-pic-base} by
17419 @item -mpoke-function-name
17420 @opindex mpoke-function-name
17421 Write the name of each function into the text section, directly
17422 preceding the function prologue. The generated code is similar to this:
17426 .ascii "arm_poke_function_name", 0
17429 .word 0xff000000 + (t1 - t0)
17430 arm_poke_function_name
17432 stmfd sp!, @{fp, ip, lr, pc@}
17436 When performing a stack backtrace, code can inspect the value of
17437 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
17438 location @code{pc - 12} and the top 8 bits are set, then we know that
17439 there is a function name embedded immediately preceding this location
17440 and has length @code{((pc[-3]) & 0xff000000)}.
17447 Select between generating code that executes in ARM and Thumb
17448 states. The default for most configurations is to generate code
17449 that executes in ARM state, but the default can be changed by
17450 configuring GCC with the @option{--with-mode=}@var{state}
17453 You can also override the ARM and Thumb mode for each function
17454 by using the @code{target("thumb")} and @code{target("arm")} function attributes
17455 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
17458 @opindex mflip-thumb
17459 Switch ARM/Thumb modes on alternating functions.
17460 This option is provided for regression testing of mixed Thumb/ARM code
17461 generation, and is not intended for ordinary use in compiling code.
17464 @opindex mtpcs-frame
17465 Generate a stack frame that is compliant with the Thumb Procedure Call
17466 Standard for all non-leaf functions. (A leaf function is one that does
17467 not call any other functions.) The default is @option{-mno-tpcs-frame}.
17469 @item -mtpcs-leaf-frame
17470 @opindex mtpcs-leaf-frame
17471 Generate a stack frame that is compliant with the Thumb Procedure Call
17472 Standard for all leaf functions. (A leaf function is one that does
17473 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
17475 @item -mcallee-super-interworking
17476 @opindex mcallee-super-interworking
17477 Gives all externally visible functions in the file being compiled an ARM
17478 instruction set header which switches to Thumb mode before executing the
17479 rest of the function. This allows these functions to be called from
17480 non-interworking code. This option is not valid in AAPCS configurations
17481 because interworking is enabled by default.
17483 @item -mcaller-super-interworking
17484 @opindex mcaller-super-interworking
17485 Allows calls via function pointers (including virtual functions) to
17486 execute correctly regardless of whether the target code has been
17487 compiled for interworking or not. There is a small overhead in the cost
17488 of executing a function pointer if this option is enabled. This option
17489 is not valid in AAPCS configurations because interworking is enabled
17492 @item -mtp=@var{name}
17494 Specify the access model for the thread local storage pointer. The valid
17495 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
17496 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
17497 (supported in the arm6k architecture), and @samp{auto}, which uses the
17498 best available method for the selected processor. The default setting is
17501 @item -mtls-dialect=@var{dialect}
17502 @opindex mtls-dialect
17503 Specify the dialect to use for accessing thread local storage. Two
17504 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
17505 @samp{gnu} dialect selects the original GNU scheme for supporting
17506 local and global dynamic TLS models. The @samp{gnu2} dialect
17507 selects the GNU descriptor scheme, which provides better performance
17508 for shared libraries. The GNU descriptor scheme is compatible with
17509 the original scheme, but does require new assembler, linker and
17510 library support. Initial and local exec TLS models are unaffected by
17511 this option and always use the original scheme.
17513 @item -mword-relocations
17514 @opindex mword-relocations
17515 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
17516 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
17517 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
17518 is specified. This option conflicts with @option{-mslow-flash-data}.
17520 @item -mfix-cortex-m3-ldrd
17521 @opindex mfix-cortex-m3-ldrd
17522 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
17523 with overlapping destination and base registers are used. This option avoids
17524 generating these instructions. This option is enabled by default when
17525 @option{-mcpu=cortex-m3} is specified.
17527 @item -munaligned-access
17528 @itemx -mno-unaligned-access
17529 @opindex munaligned-access
17530 @opindex mno-unaligned-access
17531 Enables (or disables) reading and writing of 16- and 32- bit values
17532 from addresses that are not 16- or 32- bit aligned. By default
17533 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
17534 ARMv8-M Baseline architectures, and enabled for all other
17535 architectures. If unaligned access is not enabled then words in packed
17536 data structures are accessed a byte at a time.
17538 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
17539 generated object file to either true or false, depending upon the
17540 setting of this option. If unaligned access is enabled then the
17541 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
17544 @item -mneon-for-64bits
17545 @opindex mneon-for-64bits
17546 Enables using Neon to handle scalar 64-bits operations. This is
17547 disabled by default since the cost of moving data from core registers
17550 @item -mslow-flash-data
17551 @opindex mslow-flash-data
17552 Assume loading data from flash is slower than fetching instruction.
17553 Therefore literal load is minimized for better performance.
17554 This option is only supported when compiling for ARMv7 M-profile and
17555 off by default. It conflicts with @option{-mword-relocations}.
17557 @item -masm-syntax-unified
17558 @opindex masm-syntax-unified
17559 Assume inline assembler is using unified asm syntax. The default is
17560 currently off which implies divided syntax. This option has no impact
17561 on Thumb2. However, this may change in future releases of GCC.
17562 Divided syntax should be considered deprecated.
17564 @item -mrestrict-it
17565 @opindex mrestrict-it
17566 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
17567 IT blocks can only contain a single 16-bit instruction from a select
17568 set of instructions. This option is on by default for ARMv8-A Thumb mode.
17570 @item -mprint-tune-info
17571 @opindex mprint-tune-info
17572 Print CPU tuning information as comment in assembler file. This is
17573 an option used only for regression testing of the compiler and not
17574 intended for ordinary use in compiling code. This option is disabled
17577 @item -mverbose-cost-dump
17578 @opindex mverbose-cost-dump
17579 Enable verbose cost model dumping in the debug dump files. This option is
17580 provided for use in debugging the compiler.
17583 @opindex mpure-code
17584 Do not allow constant data to be placed in code sections.
17585 Additionally, when compiling for ELF object format give all text sections the
17586 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
17587 is only available when generating non-pic code for M-profile targets with the
17592 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
17593 Development Tools Engineering Specification", which can be found on
17594 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
17598 @subsection AVR Options
17599 @cindex AVR Options
17601 These options are defined for AVR implementations:
17604 @item -mmcu=@var{mcu}
17606 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
17608 The default for this option is@tie{}@samp{avr2}.
17610 GCC supports the following AVR devices and ISAs:
17612 @include avr-mmcu.texi
17617 Assume that all data in static storage can be accessed by LDS / STS
17618 instructions. This option has only an effect on reduced Tiny devices like
17619 ATtiny40. See also the @code{absdata}
17620 @ref{AVR Variable Attributes,variable attribute}.
17622 @item -maccumulate-args
17623 @opindex maccumulate-args
17624 Accumulate outgoing function arguments and acquire/release the needed
17625 stack space for outgoing function arguments once in function
17626 prologue/epilogue. Without this option, outgoing arguments are pushed
17627 before calling a function and popped afterwards.
17629 Popping the arguments after the function call can be expensive on
17630 AVR so that accumulating the stack space might lead to smaller
17631 executables because arguments need not be removed from the
17632 stack after such a function call.
17634 This option can lead to reduced code size for functions that perform
17635 several calls to functions that get their arguments on the stack like
17636 calls to printf-like functions.
17638 @item -mbranch-cost=@var{cost}
17639 @opindex mbranch-cost
17640 Set the branch costs for conditional branch instructions to
17641 @var{cost}. Reasonable values for @var{cost} are small, non-negative
17642 integers. The default branch cost is 0.
17644 @item -mcall-prologues
17645 @opindex mcall-prologues
17646 Functions prologues/epilogues are expanded as calls to appropriate
17647 subroutines. Code size is smaller.
17649 @item -mgas-isr-prologues
17650 @opindex mgas-isr-prologues
17651 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
17652 instruction supported by GNU Binutils.
17653 If this option is on, the feature can still be disabled for individual
17654 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
17655 function attribute. This feature is activated per default
17656 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
17657 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
17661 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
17662 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
17663 and @code{long long} is 4 bytes. Please note that this option does not
17664 conform to the C standards, but it results in smaller code
17667 @item -mmain-is-OS_task
17668 @opindex mmain-is-OS_task
17669 Do not save registers in @code{main}. The effect is the same like
17670 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
17671 to @code{main}. It is activated per default if optimization is on.
17673 @item -mn-flash=@var{num}
17675 Assume that the flash memory has a size of
17676 @var{num} times 64@tie{}KiB.
17678 @item -mno-interrupts
17679 @opindex mno-interrupts
17680 Generated code is not compatible with hardware interrupts.
17681 Code size is smaller.
17685 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
17686 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
17687 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
17688 the assembler's command line and the @option{--relax} option to the
17689 linker's command line.
17691 Jump relaxing is performed by the linker because jump offsets are not
17692 known before code is located. Therefore, the assembler code generated by the
17693 compiler is the same, but the instructions in the executable may
17694 differ from instructions in the assembler code.
17696 Relaxing must be turned on if linker stubs are needed, see the
17697 section on @code{EIND} and linker stubs below.
17701 Assume that the device supports the Read-Modify-Write
17702 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
17704 @item -mshort-calls
17705 @opindex mshort-calls
17707 Assume that @code{RJMP} and @code{RCALL} can target the whole
17710 This option is used internally for multilib selection. It is
17711 not an optimization option, and you don't need to set it by hand.
17715 Treat the stack pointer register as an 8-bit register,
17716 i.e.@: assume the high byte of the stack pointer is zero.
17717 In general, you don't need to set this option by hand.
17719 This option is used internally by the compiler to select and
17720 build multilibs for architectures @code{avr2} and @code{avr25}.
17721 These architectures mix devices with and without @code{SPH}.
17722 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
17723 the compiler driver adds or removes this option from the compiler
17724 proper's command line, because the compiler then knows if the device
17725 or architecture has an 8-bit stack pointer and thus no @code{SPH}
17730 Use address register @code{X} in a way proposed by the hardware. This means
17731 that @code{X} is only used in indirect, post-increment or
17732 pre-decrement addressing.
17734 Without this option, the @code{X} register may be used in the same way
17735 as @code{Y} or @code{Z} which then is emulated by additional
17737 For example, loading a value with @code{X+const} addressing with a
17738 small non-negative @code{const < 64} to a register @var{Rn} is
17742 adiw r26, const ; X += const
17743 ld @var{Rn}, X ; @var{Rn} = *X
17744 sbiw r26, const ; X -= const
17748 @opindex mtiny-stack
17749 Only change the lower 8@tie{}bits of the stack pointer.
17751 @item -mfract-convert-truncate
17752 @opindex mfract-convert-truncate
17753 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
17756 @opindex nodevicelib
17757 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
17759 @item -Waddr-space-convert
17760 @opindex Waddr-space-convert
17761 @opindex Wno-addr-space-convert
17762 Warn about conversions between address spaces in the case where the
17763 resulting address space is not contained in the incoming address space.
17765 @item -Wmisspelled-isr
17766 @opindex Wmisspelled-isr
17767 @opindex Wno-misspelled-isr
17768 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
17769 Enabled by default.
17772 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
17773 @cindex @code{EIND}
17774 Pointers in the implementation are 16@tie{}bits wide.
17775 The address of a function or label is represented as word address so
17776 that indirect jumps and calls can target any code address in the
17777 range of 64@tie{}Ki words.
17779 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
17780 bytes of program memory space, there is a special function register called
17781 @code{EIND} that serves as most significant part of the target address
17782 when @code{EICALL} or @code{EIJMP} instructions are used.
17784 Indirect jumps and calls on these devices are handled as follows by
17785 the compiler and are subject to some limitations:
17790 The compiler never sets @code{EIND}.
17793 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
17794 instructions or might read @code{EIND} directly in order to emulate an
17795 indirect call/jump by means of a @code{RET} instruction.
17798 The compiler assumes that @code{EIND} never changes during the startup
17799 code or during the application. In particular, @code{EIND} is not
17800 saved/restored in function or interrupt service routine
17804 For indirect calls to functions and computed goto, the linker
17805 generates @emph{stubs}. Stubs are jump pads sometimes also called
17806 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
17807 The stub contains a direct jump to the desired address.
17810 Linker relaxation must be turned on so that the linker generates
17811 the stubs correctly in all situations. See the compiler option
17812 @option{-mrelax} and the linker option @option{--relax}.
17813 There are corner cases where the linker is supposed to generate stubs
17814 but aborts without relaxation and without a helpful error message.
17817 The default linker script is arranged for code with @code{EIND = 0}.
17818 If code is supposed to work for a setup with @code{EIND != 0}, a custom
17819 linker script has to be used in order to place the sections whose
17820 name start with @code{.trampolines} into the segment where @code{EIND}
17824 The startup code from libgcc never sets @code{EIND}.
17825 Notice that startup code is a blend of code from libgcc and AVR-LibC.
17826 For the impact of AVR-LibC on @code{EIND}, see the
17827 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
17830 It is legitimate for user-specific startup code to set up @code{EIND}
17831 early, for example by means of initialization code located in
17832 section @code{.init3}. Such code runs prior to general startup code
17833 that initializes RAM and calls constructors, but after the bit
17834 of startup code from AVR-LibC that sets @code{EIND} to the segment
17835 where the vector table is located.
17837 #include <avr/io.h>
17840 __attribute__((section(".init3"),naked,used,no_instrument_function))
17841 init3_set_eind (void)
17843 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
17844 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
17849 The @code{__trampolines_start} symbol is defined in the linker script.
17852 Stubs are generated automatically by the linker if
17853 the following two conditions are met:
17856 @item The address of a label is taken by means of the @code{gs} modifier
17857 (short for @emph{generate stubs}) like so:
17859 LDI r24, lo8(gs(@var{func}))
17860 LDI r25, hi8(gs(@var{func}))
17862 @item The final location of that label is in a code segment
17863 @emph{outside} the segment where the stubs are located.
17867 The compiler emits such @code{gs} modifiers for code labels in the
17868 following situations:
17870 @item Taking address of a function or code label.
17871 @item Computed goto.
17872 @item If prologue-save function is used, see @option{-mcall-prologues}
17873 command-line option.
17874 @item Switch/case dispatch tables. If you do not want such dispatch
17875 tables you can specify the @option{-fno-jump-tables} command-line option.
17876 @item C and C++ constructors/destructors called during startup/shutdown.
17877 @item If the tools hit a @code{gs()} modifier explained above.
17881 Jumping to non-symbolic addresses like so is @emph{not} supported:
17886 /* Call function at word address 0x2 */
17887 return ((int(*)(void)) 0x2)();
17891 Instead, a stub has to be set up, i.e.@: the function has to be called
17892 through a symbol (@code{func_4} in the example):
17897 extern int func_4 (void);
17899 /* Call function at byte address 0x4 */
17904 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
17905 Alternatively, @code{func_4} can be defined in the linker script.
17908 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
17909 @cindex @code{RAMPD}
17910 @cindex @code{RAMPX}
17911 @cindex @code{RAMPY}
17912 @cindex @code{RAMPZ}
17913 Some AVR devices support memories larger than the 64@tie{}KiB range
17914 that can be accessed with 16-bit pointers. To access memory locations
17915 outside this 64@tie{}KiB range, the content of a @code{RAMP}
17916 register is used as high part of the address:
17917 The @code{X}, @code{Y}, @code{Z} address register is concatenated
17918 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
17919 register, respectively, to get a wide address. Similarly,
17920 @code{RAMPD} is used together with direct addressing.
17924 The startup code initializes the @code{RAMP} special function
17925 registers with zero.
17928 If a @ref{AVR Named Address Spaces,named address space} other than
17929 generic or @code{__flash} is used, then @code{RAMPZ} is set
17930 as needed before the operation.
17933 If the device supports RAM larger than 64@tie{}KiB and the compiler
17934 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
17935 is reset to zero after the operation.
17938 If the device comes with a specific @code{RAMP} register, the ISR
17939 prologue/epilogue saves/restores that SFR and initializes it with
17940 zero in case the ISR code might (implicitly) use it.
17943 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
17944 If you use inline assembler to read from locations outside the
17945 16-bit address range and change one of the @code{RAMP} registers,
17946 you must reset it to zero after the access.
17950 @subsubsection AVR Built-in Macros
17952 GCC defines several built-in macros so that the user code can test
17953 for the presence or absence of features. Almost any of the following
17954 built-in macros are deduced from device capabilities and thus
17955 triggered by the @option{-mmcu=} command-line option.
17957 For even more AVR-specific built-in macros see
17958 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
17963 Build-in macro that resolves to a decimal number that identifies the
17964 architecture and depends on the @option{-mmcu=@var{mcu}} option.
17965 Possible values are:
17967 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
17968 @code{4}, @code{5}, @code{51}, @code{6}
17970 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
17971 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
17976 @code{102}, @code{103}, @code{104},
17977 @code{105}, @code{106}, @code{107}
17979 for @var{mcu}=@code{avrtiny},
17980 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
17981 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
17982 If @var{mcu} specifies a device, this built-in macro is set
17983 accordingly. For example, with @option{-mmcu=atmega8} the macro is
17984 defined to @code{4}.
17986 @item __AVR_@var{Device}__
17987 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
17988 the device's name. For example, @option{-mmcu=atmega8} defines the
17989 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
17990 @code{__AVR_ATtiny261A__}, etc.
17992 The built-in macros' names follow
17993 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
17994 the device name as from the AVR user manual. The difference between
17995 @var{Device} in the built-in macro and @var{device} in
17996 @option{-mmcu=@var{device}} is that the latter is always lowercase.
17998 If @var{device} is not a device but only a core architecture like
17999 @samp{avr51}, this macro is not defined.
18001 @item __AVR_DEVICE_NAME__
18002 Setting @option{-mmcu=@var{device}} defines this built-in macro to
18003 the device's name. For example, with @option{-mmcu=atmega8} the macro
18004 is defined to @code{atmega8}.
18006 If @var{device} is not a device but only a core architecture like
18007 @samp{avr51}, this macro is not defined.
18009 @item __AVR_XMEGA__
18010 The device / architecture belongs to the XMEGA family of devices.
18012 @item __AVR_HAVE_ELPM__
18013 The device has the @code{ELPM} instruction.
18015 @item __AVR_HAVE_ELPMX__
18016 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
18017 R@var{n},Z+} instructions.
18019 @item __AVR_HAVE_MOVW__
18020 The device has the @code{MOVW} instruction to perform 16-bit
18021 register-register moves.
18023 @item __AVR_HAVE_LPMX__
18024 The device has the @code{LPM R@var{n},Z} and
18025 @code{LPM R@var{n},Z+} instructions.
18027 @item __AVR_HAVE_MUL__
18028 The device has a hardware multiplier.
18030 @item __AVR_HAVE_JMP_CALL__
18031 The device has the @code{JMP} and @code{CALL} instructions.
18032 This is the case for devices with more than 8@tie{}KiB of program
18035 @item __AVR_HAVE_EIJMP_EICALL__
18036 @itemx __AVR_3_BYTE_PC__
18037 The device has the @code{EIJMP} and @code{EICALL} instructions.
18038 This is the case for devices with more than 128@tie{}KiB of program memory.
18039 This also means that the program counter
18040 (PC) is 3@tie{}bytes wide.
18042 @item __AVR_2_BYTE_PC__
18043 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
18044 with up to 128@tie{}KiB of program memory.
18046 @item __AVR_HAVE_8BIT_SP__
18047 @itemx __AVR_HAVE_16BIT_SP__
18048 The stack pointer (SP) register is treated as 8-bit respectively
18049 16-bit register by the compiler.
18050 The definition of these macros is affected by @option{-mtiny-stack}.
18052 @item __AVR_HAVE_SPH__
18054 The device has the SPH (high part of stack pointer) special function
18055 register or has an 8-bit stack pointer, respectively.
18056 The definition of these macros is affected by @option{-mmcu=} and
18057 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
18060 @item __AVR_HAVE_RAMPD__
18061 @itemx __AVR_HAVE_RAMPX__
18062 @itemx __AVR_HAVE_RAMPY__
18063 @itemx __AVR_HAVE_RAMPZ__
18064 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
18065 @code{RAMPZ} special function register, respectively.
18067 @item __NO_INTERRUPTS__
18068 This macro reflects the @option{-mno-interrupts} command-line option.
18070 @item __AVR_ERRATA_SKIP__
18071 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
18072 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18073 instructions because of a hardware erratum. Skip instructions are
18074 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
18075 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
18078 @item __AVR_ISA_RMW__
18079 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
18081 @item __AVR_SFR_OFFSET__=@var{offset}
18082 Instructions that can address I/O special function registers directly
18083 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
18084 address as if addressed by an instruction to access RAM like @code{LD}
18085 or @code{STS}. This offset depends on the device architecture and has
18086 to be subtracted from the RAM address in order to get the
18087 respective I/O@tie{}address.
18089 @item __AVR_SHORT_CALLS__
18090 The @option{-mshort-calls} command line option is set.
18092 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
18093 Some devices support reading from flash memory by means of @code{LD*}
18094 instructions. The flash memory is seen in the data address space
18095 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
18096 is not defined, this feature is not available. If defined,
18097 the address space is linear and there is no need to put
18098 @code{.rodata} into RAM. This is handled by the default linker
18099 description file, and is currently available for
18100 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
18101 there is no need to use address spaces like @code{__flash} or
18102 features like attribute @code{progmem} and @code{pgm_read_*}.
18104 @item __WITH_AVRLIBC__
18105 The compiler is configured to be used together with AVR-Libc.
18106 See the @option{--with-avrlibc} configure option.
18110 @node Blackfin Options
18111 @subsection Blackfin Options
18112 @cindex Blackfin Options
18115 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
18117 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
18118 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
18119 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
18120 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
18121 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
18122 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
18123 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
18124 @samp{bf561}, @samp{bf592}.
18126 The optional @var{sirevision} specifies the silicon revision of the target
18127 Blackfin processor. Any workarounds available for the targeted silicon revision
18128 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
18129 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
18130 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
18131 hexadecimal digits representing the major and minor numbers in the silicon
18132 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
18133 is not defined. If @var{sirevision} is @samp{any}, the
18134 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
18135 If this optional @var{sirevision} is not used, GCC assumes the latest known
18136 silicon revision of the targeted Blackfin processor.
18138 GCC defines a preprocessor macro for the specified @var{cpu}.
18139 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
18140 provided by libgloss to be linked in if @option{-msim} is not given.
18142 Without this option, @samp{bf532} is used as the processor by default.
18144 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
18145 only the preprocessor macro is defined.
18149 Specifies that the program will be run on the simulator. This causes
18150 the simulator BSP provided by libgloss to be linked in. This option
18151 has effect only for @samp{bfin-elf} toolchain.
18152 Certain other options, such as @option{-mid-shared-library} and
18153 @option{-mfdpic}, imply @option{-msim}.
18155 @item -momit-leaf-frame-pointer
18156 @opindex momit-leaf-frame-pointer
18157 Don't keep the frame pointer in a register for leaf functions. This
18158 avoids the instructions to save, set up and restore frame pointers and
18159 makes an extra register available in leaf functions.
18161 @item -mspecld-anomaly
18162 @opindex mspecld-anomaly
18163 When enabled, the compiler ensures that the generated code does not
18164 contain speculative loads after jump instructions. If this option is used,
18165 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
18167 @item -mno-specld-anomaly
18168 @opindex mno-specld-anomaly
18169 @opindex mspecld-anomaly
18170 Don't generate extra code to prevent speculative loads from occurring.
18172 @item -mcsync-anomaly
18173 @opindex mcsync-anomaly
18174 When enabled, the compiler ensures that the generated code does not
18175 contain CSYNC or SSYNC instructions too soon after conditional branches.
18176 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
18178 @item -mno-csync-anomaly
18179 @opindex mno-csync-anomaly
18180 @opindex mcsync-anomaly
18181 Don't generate extra code to prevent CSYNC or SSYNC instructions from
18182 occurring too soon after a conditional branch.
18186 When enabled, the compiler is free to take advantage of the knowledge that
18187 the entire program fits into the low 64k of memory.
18190 @opindex mno-low64k
18191 Assume that the program is arbitrarily large. This is the default.
18193 @item -mstack-check-l1
18194 @opindex mstack-check-l1
18195 Do stack checking using information placed into L1 scratchpad memory by the
18198 @item -mid-shared-library
18199 @opindex mid-shared-library
18200 Generate code that supports shared libraries via the library ID method.
18201 This allows for execute in place and shared libraries in an environment
18202 without virtual memory management. This option implies @option{-fPIC}.
18203 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18205 @item -mno-id-shared-library
18206 @opindex mno-id-shared-library
18207 @opindex mid-shared-library
18208 Generate code that doesn't assume ID-based shared libraries are being used.
18209 This is the default.
18211 @item -mleaf-id-shared-library
18212 @opindex mleaf-id-shared-library
18213 Generate code that supports shared libraries via the library ID method,
18214 but assumes that this library or executable won't link against any other
18215 ID shared libraries. That allows the compiler to use faster code for jumps
18218 @item -mno-leaf-id-shared-library
18219 @opindex mno-leaf-id-shared-library
18220 @opindex mleaf-id-shared-library
18221 Do not assume that the code being compiled won't link against any ID shared
18222 libraries. Slower code is generated for jump and call insns.
18224 @item -mshared-library-id=n
18225 @opindex mshared-library-id
18226 Specifies the identification number of the ID-based shared library being
18227 compiled. Specifying a value of 0 generates more compact code; specifying
18228 other values forces the allocation of that number to the current
18229 library but is no more space- or time-efficient than omitting this option.
18233 Generate code that allows the data segment to be located in a different
18234 area of memory from the text segment. This allows for execute in place in
18235 an environment without virtual memory management by eliminating relocations
18236 against the text section.
18238 @item -mno-sep-data
18239 @opindex mno-sep-data
18241 Generate code that assumes that the data segment follows the text segment.
18242 This is the default.
18245 @itemx -mno-long-calls
18246 @opindex mlong-calls
18247 @opindex mno-long-calls
18248 Tells the compiler to perform function calls by first loading the
18249 address of the function into a register and then performing a subroutine
18250 call on this register. This switch is needed if the target function
18251 lies outside of the 24-bit addressing range of the offset-based
18252 version of subroutine call instruction.
18254 This feature is not enabled by default. Specifying
18255 @option{-mno-long-calls} restores the default behavior. Note these
18256 switches have no effect on how the compiler generates code to handle
18257 function calls via function pointers.
18261 Link with the fast floating-point library. This library relaxes some of
18262 the IEEE floating-point standard's rules for checking inputs against
18263 Not-a-Number (NAN), in the interest of performance.
18266 @opindex minline-plt
18267 Enable inlining of PLT entries in function calls to functions that are
18268 not known to bind locally. It has no effect without @option{-mfdpic}.
18271 @opindex mmulticore
18272 Build a standalone application for multicore Blackfin processors.
18273 This option causes proper start files and link scripts supporting
18274 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
18275 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
18277 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
18278 selects the one-application-per-core programming model. Without
18279 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
18280 programming model is used. In this model, the main function of Core B
18281 should be named as @code{coreb_main}.
18283 If this option is not used, the single-core application programming
18288 Build a standalone application for Core A of BF561 when using
18289 the one-application-per-core programming model. Proper start files
18290 and link scripts are used to support Core A, and the macro
18291 @code{__BFIN_COREA} is defined.
18292 This option can only be used in conjunction with @option{-mmulticore}.
18296 Build a standalone application for Core B of BF561 when using
18297 the one-application-per-core programming model. Proper start files
18298 and link scripts are used to support Core B, and the macro
18299 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
18300 should be used instead of @code{main}.
18301 This option can only be used in conjunction with @option{-mmulticore}.
18305 Build a standalone application for SDRAM. Proper start files and
18306 link scripts are used to put the application into SDRAM, and the macro
18307 @code{__BFIN_SDRAM} is defined.
18308 The loader should initialize SDRAM before loading the application.
18312 Assume that ICPLBs are enabled at run time. This has an effect on certain
18313 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
18314 are enabled; for standalone applications the default is off.
18318 @subsection C6X Options
18319 @cindex C6X Options
18322 @item -march=@var{name}
18324 This specifies the name of the target architecture. GCC uses this
18325 name to determine what kind of instructions it can emit when generating
18326 assembly code. Permissible names are: @samp{c62x},
18327 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
18330 @opindex mbig-endian
18331 Generate code for a big-endian target.
18333 @item -mlittle-endian
18334 @opindex mlittle-endian
18335 Generate code for a little-endian target. This is the default.
18339 Choose startup files and linker script suitable for the simulator.
18341 @item -msdata=default
18342 @opindex msdata=default
18343 Put small global and static data in the @code{.neardata} section,
18344 which is pointed to by register @code{B14}. Put small uninitialized
18345 global and static data in the @code{.bss} section, which is adjacent
18346 to the @code{.neardata} section. Put small read-only data into the
18347 @code{.rodata} section. The corresponding sections used for large
18348 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
18351 @opindex msdata=all
18352 Put all data, not just small objects, into the sections reserved for
18353 small data, and use addressing relative to the @code{B14} register to
18357 @opindex msdata=none
18358 Make no use of the sections reserved for small data, and use absolute
18359 addresses to access all data. Put all initialized global and static
18360 data in the @code{.fardata} section, and all uninitialized data in the
18361 @code{.far} section. Put all constant data into the @code{.const}
18366 @subsection CRIS Options
18367 @cindex CRIS Options
18369 These options are defined specifically for the CRIS ports.
18372 @item -march=@var{architecture-type}
18373 @itemx -mcpu=@var{architecture-type}
18376 Generate code for the specified architecture. The choices for
18377 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
18378 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
18379 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
18382 @item -mtune=@var{architecture-type}
18384 Tune to @var{architecture-type} everything applicable about the generated
18385 code, except for the ABI and the set of available instructions. The
18386 choices for @var{architecture-type} are the same as for
18387 @option{-march=@var{architecture-type}}.
18389 @item -mmax-stack-frame=@var{n}
18390 @opindex mmax-stack-frame
18391 Warn when the stack frame of a function exceeds @var{n} bytes.
18397 The options @option{-metrax4} and @option{-metrax100} are synonyms for
18398 @option{-march=v3} and @option{-march=v8} respectively.
18400 @item -mmul-bug-workaround
18401 @itemx -mno-mul-bug-workaround
18402 @opindex mmul-bug-workaround
18403 @opindex mno-mul-bug-workaround
18404 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
18405 models where it applies. This option is active by default.
18409 Enable CRIS-specific verbose debug-related information in the assembly
18410 code. This option also has the effect of turning off the @samp{#NO_APP}
18411 formatted-code indicator to the assembler at the beginning of the
18416 Do not use condition-code results from previous instruction; always emit
18417 compare and test instructions before use of condition codes.
18419 @item -mno-side-effects
18420 @opindex mno-side-effects
18421 @opindex mside-effects
18422 Do not emit instructions with side effects in addressing modes other than
18425 @item -mstack-align
18426 @itemx -mno-stack-align
18427 @itemx -mdata-align
18428 @itemx -mno-data-align
18429 @itemx -mconst-align
18430 @itemx -mno-const-align
18431 @opindex mstack-align
18432 @opindex mno-stack-align
18433 @opindex mdata-align
18434 @opindex mno-data-align
18435 @opindex mconst-align
18436 @opindex mno-const-align
18437 These options (@samp{no-} options) arrange (eliminate arrangements) for the
18438 stack frame, individual data and constants to be aligned for the maximum
18439 single data access size for the chosen CPU model. The default is to
18440 arrange for 32-bit alignment. ABI details such as structure layout are
18441 not affected by these options.
18449 Similar to the stack- data- and const-align options above, these options
18450 arrange for stack frame, writable data and constants to all be 32-bit,
18451 16-bit or 8-bit aligned. The default is 32-bit alignment.
18453 @item -mno-prologue-epilogue
18454 @itemx -mprologue-epilogue
18455 @opindex mno-prologue-epilogue
18456 @opindex mprologue-epilogue
18457 With @option{-mno-prologue-epilogue}, the normal function prologue and
18458 epilogue which set up the stack frame are omitted and no return
18459 instructions or return sequences are generated in the code. Use this
18460 option only together with visual inspection of the compiled code: no
18461 warnings or errors are generated when call-saved registers must be saved,
18462 or storage for local variables needs to be allocated.
18466 @opindex mno-gotplt
18468 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
18469 instruction sequences that load addresses for functions from the PLT part
18470 of the GOT rather than (traditional on other architectures) calls to the
18471 PLT@. The default is @option{-mgotplt}.
18475 Legacy no-op option only recognized with the cris-axis-elf and
18476 cris-axis-linux-gnu targets.
18480 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
18484 This option, recognized for the cris-axis-elf, arranges
18485 to link with input-output functions from a simulator library. Code,
18486 initialized data and zero-initialized data are allocated consecutively.
18490 Like @option{-sim}, but pass linker options to locate initialized data at
18491 0x40000000 and zero-initialized data at 0x80000000.
18495 @subsection CR16 Options
18496 @cindex CR16 Options
18498 These options are defined specifically for the CR16 ports.
18504 Enable the use of multiply-accumulate instructions. Disabled by default.
18508 @opindex mcr16cplus
18510 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
18515 Links the library libsim.a which is in compatible with simulator. Applicable
18516 to ELF compiler only.
18520 Choose integer type as 32-bit wide.
18524 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
18526 @item -mdata-model=@var{model}
18527 @opindex mdata-model
18528 Choose a data model. The choices for @var{model} are @samp{near},
18529 @samp{far} or @samp{medium}. @samp{medium} is default.
18530 However, @samp{far} is not valid with @option{-mcr16c}, as the
18531 CR16C architecture does not support the far data model.
18534 @node C-SKY Options
18535 @subsection C-SKY Options
18536 @cindex C-SKY Options
18538 GCC supports these options when compiling for C-SKY V2 processors.
18542 @item -march=@var{arch}
18544 Specify the C-SKY target architecture. Valid values for @var{arch} are:
18545 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
18546 The default is @samp{ck810}.
18548 @item -mcpu=@var{cpu}
18550 Specify the C-SKY target processor. Valid values for @var{cpu} are:
18551 @samp{ck801}, @samp{ck801t},
18552 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
18553 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
18554 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
18555 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
18556 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
18557 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
18558 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
18559 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
18560 @samp{ck803eftr1}, @samp{ck803efhtr1},
18561 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
18562 @samp{ck803sef}, @samp{ck803seft},
18563 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
18564 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
18565 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
18566 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
18569 @opindex mbig-endian
18572 @itemx -mlittle-endian
18573 @opindex mlittle-endian
18577 Select big- or little-endian code. The default is little-endian.
18580 @opindex mhard-float
18581 @itemx -msoft-float
18582 @opindex msoft-float
18584 Select hardware or software floating-point implementations.
18585 The default is soft float.
18587 @item -mdouble-float
18588 @itemx -mno-double-float
18589 @opindex mdouble-float
18590 When @option{-mhard-float} is in effect, enable generation of
18591 double-precision float instructions. This is the default except
18592 when compiling for CK803.
18597 When @option{-mhard-float} is in effect, enable generation of
18598 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
18599 This is the default except when compiling for CK803.
18601 @item -mfpu=@var{fpu}
18603 Select the floating-point processor. This option can only be used with
18604 @option{-mhard-float}.
18605 Values for @var{fpu} are
18606 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
18607 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
18608 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
18613 Enable the extended @code{lrw} instruction. This option defaults to on
18614 for CK801 and off otherwise.
18619 Enable interrupt stack instructions; the default is off.
18621 The @option{-mistack} option is required to handle the
18622 @code{interrupt} and @code{isr} function attributes
18623 (@pxref{C-SKY Function Attributes}).
18627 Enable multiprocessor instructions; the default is off.
18631 Enable coprocessor instructions; the default is off.
18635 Enable coprocessor instructions; the default is off.
18639 Enable C-SKY security instructions; the default is off.
18643 Enable C-SKY trust instructions; the default is off.
18651 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
18652 All of these options default to off.
18657 Generate divide instructions. Default is off.
18662 Generate code for Smart Mode, using only registers numbered 0-7 to allow
18663 use of 16-bit instructions. This option is ignored for CK801 where this
18664 is the required behavior, and it defaults to on for CK802.
18665 For other targets, the default is off.
18667 @item -mhigh-registers
18668 @itemx -mno-high-registers
18669 @opindex mhigh-registers
18670 Generate code using the high registers numbered 16-31. This option
18671 is not supported on CK801, CK802, or CK803, and is enabled by default
18672 for other processors.
18677 Generate code using global anchor symbol addresses.
18680 @itemx -mno-pushpop
18682 Generate code using @code{push} and @code{pop} instructions. This option
18685 @item -mmultiple-stld
18687 @itemx -mno-multiple-stld
18689 @opindex mmultiple-stld
18690 Generate code using @code{stm} and @code{ldm} instructions. This option
18691 isn't supported on CK801 but is enabled by default on other processors.
18694 @itemx -mno-constpool
18695 @opindex mconstpool
18696 Create constant pools in the compiler instead of deferring it to the
18697 assembler. This option is the default and required for correct code
18698 generation on CK801 and CK802, and is optional on other processors.
18701 @item -mno-stack-size
18702 @opindex mstack-size
18703 Emit @code{.stack_size} directives for each function in the assembly
18704 output. This option defaults to off.
18709 Generate code for the C-SKY compiler runtime instead of libgcc. This
18710 option defaults to off.
18712 @item -mbranch-cost=@var{n}
18713 @opindex mbranch-cost=
18714 Set the branch costs to roughly @code{n} instructions. The default is 1.
18716 @item -msched-prolog
18717 @itemx -mno-sched-prolog
18718 @opindex msched-prolog
18719 Permit scheduling of function prologue and epilogue sequences. Using
18720 this option can result in code that is not compliant with the C-SKY V2 ABI
18721 prologue requirements and that cannot be debugged or backtraced.
18722 It is disabled by default.
18726 @node Darwin Options
18727 @subsection Darwin Options
18728 @cindex Darwin options
18730 These options are defined for all architectures running the Darwin operating
18733 FSF GCC on Darwin does not create ``fat'' object files; it creates
18734 an object file for the single architecture that GCC was built to
18735 target. Apple's GCC on Darwin does create ``fat'' files if multiple
18736 @option{-arch} options are used; it does so by running the compiler or
18737 linker multiple times and joining the results together with
18740 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
18741 @samp{i686}) is determined by the flags that specify the ISA
18742 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
18743 @option{-force_cpusubtype_ALL} option can be used to override this.
18745 The Darwin tools vary in their behavior when presented with an ISA
18746 mismatch. The assembler, @file{as}, only permits instructions to
18747 be used that are valid for the subtype of the file it is generating,
18748 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
18749 The linker for shared libraries, @file{/usr/bin/libtool}, fails
18750 and prints an error if asked to create a shared library with a less
18751 restrictive subtype than its input files (for instance, trying to put
18752 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
18753 for executables, @command{ld}, quietly gives the executable the most
18754 restrictive subtype of any of its input files.
18759 Add the framework directory @var{dir} to the head of the list of
18760 directories to be searched for header files. These directories are
18761 interleaved with those specified by @option{-I} options and are
18762 scanned in a left-to-right order.
18764 A framework directory is a directory with frameworks in it. A
18765 framework is a directory with a @file{Headers} and/or
18766 @file{PrivateHeaders} directory contained directly in it that ends
18767 in @file{.framework}. The name of a framework is the name of this
18768 directory excluding the @file{.framework}. Headers associated with
18769 the framework are found in one of those two directories, with
18770 @file{Headers} being searched first. A subframework is a framework
18771 directory that is in a framework's @file{Frameworks} directory.
18772 Includes of subframework headers can only appear in a header of a
18773 framework that contains the subframework, or in a sibling subframework
18774 header. Two subframeworks are siblings if they occur in the same
18775 framework. A subframework should not have the same name as a
18776 framework; a warning is issued if this is violated. Currently a
18777 subframework cannot have subframeworks; in the future, the mechanism
18778 may be extended to support this. The standard frameworks can be found
18779 in @file{/System/Library/Frameworks} and
18780 @file{/Library/Frameworks}. An example include looks like
18781 @code{#include <Framework/header.h>}, where @file{Framework} denotes
18782 the name of the framework and @file{header.h} is found in the
18783 @file{PrivateHeaders} or @file{Headers} directory.
18785 @item -iframework@var{dir}
18786 @opindex iframework
18787 Like @option{-F} except the directory is a treated as a system
18788 directory. The main difference between this @option{-iframework} and
18789 @option{-F} is that with @option{-iframework} the compiler does not
18790 warn about constructs contained within header files found via
18791 @var{dir}. This option is valid only for the C family of languages.
18795 Emit debugging information for symbols that are used. For stabs
18796 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
18797 This is by default ON@.
18801 Emit debugging information for all symbols and types.
18803 @item -mmacosx-version-min=@var{version}
18804 The earliest version of MacOS X that this executable will run on
18805 is @var{version}. Typical values of @var{version} include @code{10.1},
18806 @code{10.2}, and @code{10.3.9}.
18808 If the compiler was built to use the system's headers by default,
18809 then the default for this option is the system version on which the
18810 compiler is running, otherwise the default is to make choices that
18811 are compatible with as many systems and code bases as possible.
18815 Enable kernel development mode. The @option{-mkernel} option sets
18816 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
18817 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
18818 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
18819 applicable. This mode also sets @option{-mno-altivec},
18820 @option{-msoft-float}, @option{-fno-builtin} and
18821 @option{-mlong-branch} for PowerPC targets.
18823 @item -mone-byte-bool
18824 @opindex mone-byte-bool
18825 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
18826 By default @code{sizeof(bool)} is @code{4} when compiling for
18827 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
18828 option has no effect on x86.
18830 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
18831 to generate code that is not binary compatible with code generated
18832 without that switch. Using this switch may require recompiling all
18833 other modules in a program, including system libraries. Use this
18834 switch to conform to a non-default data model.
18836 @item -mfix-and-continue
18837 @itemx -ffix-and-continue
18838 @itemx -findirect-data
18839 @opindex mfix-and-continue
18840 @opindex ffix-and-continue
18841 @opindex findirect-data
18842 Generate code suitable for fast turnaround development, such as to
18843 allow GDB to dynamically load @file{.o} files into already-running
18844 programs. @option{-findirect-data} and @option{-ffix-and-continue}
18845 are provided for backwards compatibility.
18849 Loads all members of static archive libraries.
18850 See man ld(1) for more information.
18852 @item -arch_errors_fatal
18853 @opindex arch_errors_fatal
18854 Cause the errors having to do with files that have the wrong architecture
18857 @item -bind_at_load
18858 @opindex bind_at_load
18859 Causes the output file to be marked such that the dynamic linker will
18860 bind all undefined references when the file is loaded or launched.
18864 Produce a Mach-o bundle format file.
18865 See man ld(1) for more information.
18867 @item -bundle_loader @var{executable}
18868 @opindex bundle_loader
18869 This option specifies the @var{executable} that will load the build
18870 output file being linked. See man ld(1) for more information.
18873 @opindex dynamiclib
18874 When passed this option, GCC produces a dynamic library instead of
18875 an executable when linking, using the Darwin @file{libtool} command.
18877 @item -force_cpusubtype_ALL
18878 @opindex force_cpusubtype_ALL
18879 This causes GCC's output file to have the @samp{ALL} subtype, instead of
18880 one controlled by the @option{-mcpu} or @option{-march} option.
18882 @item -allowable_client @var{client_name}
18883 @itemx -client_name
18884 @itemx -compatibility_version
18885 @itemx -current_version
18887 @itemx -dependency-file
18889 @itemx -dylinker_install_name
18891 @itemx -exported_symbols_list
18894 @itemx -flat_namespace
18895 @itemx -force_flat_namespace
18896 @itemx -headerpad_max_install_names
18899 @itemx -install_name
18900 @itemx -keep_private_externs
18901 @itemx -multi_module
18902 @itemx -multiply_defined
18903 @itemx -multiply_defined_unused
18906 @itemx -no_dead_strip_inits_and_terms
18907 @itemx -nofixprebinding
18908 @itemx -nomultidefs
18910 @itemx -noseglinkedit
18911 @itemx -pagezero_size
18913 @itemx -prebind_all_twolevel_modules
18914 @itemx -private_bundle
18916 @itemx -read_only_relocs
18918 @itemx -sectobjectsymbols
18922 @itemx -sectobjectsymbols
18925 @itemx -segs_read_only_addr
18927 @itemx -segs_read_write_addr
18928 @itemx -seg_addr_table
18929 @itemx -seg_addr_table_filename
18930 @itemx -seglinkedit
18932 @itemx -segs_read_only_addr
18933 @itemx -segs_read_write_addr
18934 @itemx -single_module
18936 @itemx -sub_library
18938 @itemx -sub_umbrella
18939 @itemx -twolevel_namespace
18942 @itemx -unexported_symbols_list
18943 @itemx -weak_reference_mismatches
18944 @itemx -whatsloaded
18945 @opindex allowable_client
18946 @opindex client_name
18947 @opindex compatibility_version
18948 @opindex current_version
18949 @opindex dead_strip
18950 @opindex dependency-file
18951 @opindex dylib_file
18952 @opindex dylinker_install_name
18954 @opindex exported_symbols_list
18956 @opindex flat_namespace
18957 @opindex force_flat_namespace
18958 @opindex headerpad_max_install_names
18959 @opindex image_base
18961 @opindex install_name
18962 @opindex keep_private_externs
18963 @opindex multi_module
18964 @opindex multiply_defined
18965 @opindex multiply_defined_unused
18966 @opindex noall_load
18967 @opindex no_dead_strip_inits_and_terms
18968 @opindex nofixprebinding
18969 @opindex nomultidefs
18971 @opindex noseglinkedit
18972 @opindex pagezero_size
18974 @opindex prebind_all_twolevel_modules
18975 @opindex private_bundle
18976 @opindex read_only_relocs
18978 @opindex sectobjectsymbols
18981 @opindex sectcreate
18982 @opindex sectobjectsymbols
18985 @opindex segs_read_only_addr
18986 @opindex segs_read_write_addr
18987 @opindex seg_addr_table
18988 @opindex seg_addr_table_filename
18989 @opindex seglinkedit
18991 @opindex segs_read_only_addr
18992 @opindex segs_read_write_addr
18993 @opindex single_module
18995 @opindex sub_library
18996 @opindex sub_umbrella
18997 @opindex twolevel_namespace
19000 @opindex unexported_symbols_list
19001 @opindex weak_reference_mismatches
19002 @opindex whatsloaded
19003 These options are passed to the Darwin linker. The Darwin linker man page
19004 describes them in detail.
19007 @node DEC Alpha Options
19008 @subsection DEC Alpha Options
19010 These @samp{-m} options are defined for the DEC Alpha implementations:
19013 @item -mno-soft-float
19014 @itemx -msoft-float
19015 @opindex mno-soft-float
19016 @opindex msoft-float
19017 Use (do not use) the hardware floating-point instructions for
19018 floating-point operations. When @option{-msoft-float} is specified,
19019 functions in @file{libgcc.a} are used to perform floating-point
19020 operations. Unless they are replaced by routines that emulate the
19021 floating-point operations, or compiled in such a way as to call such
19022 emulations routines, these routines issue floating-point
19023 operations. If you are compiling for an Alpha without floating-point
19024 operations, you must ensure that the library is built so as not to call
19027 Note that Alpha implementations without floating-point operations are
19028 required to have floating-point registers.
19031 @itemx -mno-fp-regs
19033 @opindex mno-fp-regs
19034 Generate code that uses (does not use) the floating-point register set.
19035 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
19036 register set is not used, floating-point operands are passed in integer
19037 registers as if they were integers and floating-point results are passed
19038 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
19039 so any function with a floating-point argument or return value called by code
19040 compiled with @option{-mno-fp-regs} must also be compiled with that
19043 A typical use of this option is building a kernel that does not use,
19044 and hence need not save and restore, any floating-point registers.
19048 The Alpha architecture implements floating-point hardware optimized for
19049 maximum performance. It is mostly compliant with the IEEE floating-point
19050 standard. However, for full compliance, software assistance is
19051 required. This option generates code fully IEEE-compliant code
19052 @emph{except} that the @var{inexact-flag} is not maintained (see below).
19053 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
19054 defined during compilation. The resulting code is less efficient but is
19055 able to correctly support denormalized numbers and exceptional IEEE
19056 values such as not-a-number and plus/minus infinity. Other Alpha
19057 compilers call this option @option{-ieee_with_no_inexact}.
19059 @item -mieee-with-inexact
19060 @opindex mieee-with-inexact
19061 This is like @option{-mieee} except the generated code also maintains
19062 the IEEE @var{inexact-flag}. Turning on this option causes the
19063 generated code to implement fully-compliant IEEE math. In addition to
19064 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
19065 macro. On some Alpha implementations the resulting code may execute
19066 significantly slower than the code generated by default. Since there is
19067 very little code that depends on the @var{inexact-flag}, you should
19068 normally not specify this option. Other Alpha compilers call this
19069 option @option{-ieee_with_inexact}.
19071 @item -mfp-trap-mode=@var{trap-mode}
19072 @opindex mfp-trap-mode
19073 This option controls what floating-point related traps are enabled.
19074 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
19075 The trap mode can be set to one of four values:
19079 This is the default (normal) setting. The only traps that are enabled
19080 are the ones that cannot be disabled in software (e.g., division by zero
19084 In addition to the traps enabled by @samp{n}, underflow traps are enabled
19088 Like @samp{u}, but the instructions are marked to be safe for software
19089 completion (see Alpha architecture manual for details).
19092 Like @samp{su}, but inexact traps are enabled as well.
19095 @item -mfp-rounding-mode=@var{rounding-mode}
19096 @opindex mfp-rounding-mode
19097 Selects the IEEE rounding mode. Other Alpha compilers call this option
19098 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
19103 Normal IEEE rounding mode. Floating-point numbers are rounded towards
19104 the nearest machine number or towards the even machine number in case
19108 Round towards minus infinity.
19111 Chopped rounding mode. Floating-point numbers are rounded towards zero.
19114 Dynamic rounding mode. A field in the floating-point control register
19115 (@var{fpcr}, see Alpha architecture reference manual) controls the
19116 rounding mode in effect. The C library initializes this register for
19117 rounding towards plus infinity. Thus, unless your program modifies the
19118 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
19121 @item -mtrap-precision=@var{trap-precision}
19122 @opindex mtrap-precision
19123 In the Alpha architecture, floating-point traps are imprecise. This
19124 means without software assistance it is impossible to recover from a
19125 floating trap and program execution normally needs to be terminated.
19126 GCC can generate code that can assist operating system trap handlers
19127 in determining the exact location that caused a floating-point trap.
19128 Depending on the requirements of an application, different levels of
19129 precisions can be selected:
19133 Program precision. This option is the default and means a trap handler
19134 can only identify which program caused a floating-point exception.
19137 Function precision. The trap handler can determine the function that
19138 caused a floating-point exception.
19141 Instruction precision. The trap handler can determine the exact
19142 instruction that caused a floating-point exception.
19145 Other Alpha compilers provide the equivalent options called
19146 @option{-scope_safe} and @option{-resumption_safe}.
19148 @item -mieee-conformant
19149 @opindex mieee-conformant
19150 This option marks the generated code as IEEE conformant. You must not
19151 use this option unless you also specify @option{-mtrap-precision=i} and either
19152 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
19153 is to emit the line @samp{.eflag 48} in the function prologue of the
19154 generated assembly file.
19156 @item -mbuild-constants
19157 @opindex mbuild-constants
19158 Normally GCC examines a 32- or 64-bit integer constant to
19159 see if it can construct it from smaller constants in two or three
19160 instructions. If it cannot, it outputs the constant as a literal and
19161 generates code to load it from the data segment at run time.
19163 Use this option to require GCC to construct @emph{all} integer constants
19164 using code, even if it takes more instructions (the maximum is six).
19166 You typically use this option to build a shared library dynamic
19167 loader. Itself a shared library, it must relocate itself in memory
19168 before it can find the variables and constants in its own data segment.
19186 Indicate whether GCC should generate code to use the optional BWX,
19187 CIX, FIX and MAX instruction sets. The default is to use the instruction
19188 sets supported by the CPU type specified via @option{-mcpu=} option or that
19189 of the CPU on which GCC was built if none is specified.
19192 @itemx -mfloat-ieee
19193 @opindex mfloat-vax
19194 @opindex mfloat-ieee
19195 Generate code that uses (does not use) VAX F and G floating-point
19196 arithmetic instead of IEEE single and double precision.
19198 @item -mexplicit-relocs
19199 @itemx -mno-explicit-relocs
19200 @opindex mexplicit-relocs
19201 @opindex mno-explicit-relocs
19202 Older Alpha assemblers provided no way to generate symbol relocations
19203 except via assembler macros. Use of these macros does not allow
19204 optimal instruction scheduling. GNU binutils as of version 2.12
19205 supports a new syntax that allows the compiler to explicitly mark
19206 which relocations should apply to which instructions. This option
19207 is mostly useful for debugging, as GCC detects the capabilities of
19208 the assembler when it is built and sets the default accordingly.
19211 @itemx -mlarge-data
19212 @opindex msmall-data
19213 @opindex mlarge-data
19214 When @option{-mexplicit-relocs} is in effect, static data is
19215 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
19216 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
19217 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
19218 16-bit relocations off of the @code{$gp} register. This limits the
19219 size of the small data area to 64KB, but allows the variables to be
19220 directly accessed via a single instruction.
19222 The default is @option{-mlarge-data}. With this option the data area
19223 is limited to just below 2GB@. Programs that require more than 2GB of
19224 data must use @code{malloc} or @code{mmap} to allocate the data in the
19225 heap instead of in the program's data segment.
19227 When generating code for shared libraries, @option{-fpic} implies
19228 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
19231 @itemx -mlarge-text
19232 @opindex msmall-text
19233 @opindex mlarge-text
19234 When @option{-msmall-text} is used, the compiler assumes that the
19235 code of the entire program (or shared library) fits in 4MB, and is
19236 thus reachable with a branch instruction. When @option{-msmall-data}
19237 is used, the compiler can assume that all local symbols share the
19238 same @code{$gp} value, and thus reduce the number of instructions
19239 required for a function call from 4 to 1.
19241 The default is @option{-mlarge-text}.
19243 @item -mcpu=@var{cpu_type}
19245 Set the instruction set and instruction scheduling parameters for
19246 machine type @var{cpu_type}. You can specify either the @samp{EV}
19247 style name or the corresponding chip number. GCC supports scheduling
19248 parameters for the EV4, EV5 and EV6 family of processors and
19249 chooses the default values for the instruction set from the processor
19250 you specify. If you do not specify a processor type, GCC defaults
19251 to the processor on which the compiler was built.
19253 Supported values for @var{cpu_type} are
19259 Schedules as an EV4 and has no instruction set extensions.
19263 Schedules as an EV5 and has no instruction set extensions.
19267 Schedules as an EV5 and supports the BWX extension.
19272 Schedules as an EV5 and supports the BWX and MAX extensions.
19276 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
19280 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
19283 Native toolchains also support the value @samp{native},
19284 which selects the best architecture option for the host processor.
19285 @option{-mcpu=native} has no effect if GCC does not recognize
19288 @item -mtune=@var{cpu_type}
19290 Set only the instruction scheduling parameters for machine type
19291 @var{cpu_type}. The instruction set is not changed.
19293 Native toolchains also support the value @samp{native},
19294 which selects the best architecture option for the host processor.
19295 @option{-mtune=native} has no effect if GCC does not recognize
19298 @item -mmemory-latency=@var{time}
19299 @opindex mmemory-latency
19300 Sets the latency the scheduler should assume for typical memory
19301 references as seen by the application. This number is highly
19302 dependent on the memory access patterns used by the application
19303 and the size of the external cache on the machine.
19305 Valid options for @var{time} are
19309 A decimal number representing clock cycles.
19315 The compiler contains estimates of the number of clock cycles for
19316 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19317 (also called Dcache, Scache, and Bcache), as well as to main memory.
19318 Note that L3 is only valid for EV5.
19324 @subsection FR30 Options
19325 @cindex FR30 Options
19327 These options are defined specifically for the FR30 port.
19331 @item -msmall-model
19332 @opindex msmall-model
19333 Use the small address space model. This can produce smaller code, but
19334 it does assume that all symbolic values and addresses fit into a
19339 Assume that runtime support has been provided and so there is no need
19340 to include the simulator library (@file{libsim.a}) on the linker
19346 @subsection FT32 Options
19347 @cindex FT32 Options
19349 These options are defined specifically for the FT32 port.
19355 Specifies that the program will be run on the simulator. This causes
19356 an alternate runtime startup and library to be linked.
19357 You must not use this option when generating programs that will run on
19358 real hardware; you must provide your own runtime library for whatever
19359 I/O functions are needed.
19363 Enable Local Register Allocation. This is still experimental for FT32,
19364 so by default the compiler uses standard reload.
19368 Do not use div and mod instructions.
19372 Enable use of the extended instructions of the FT32B processor.
19376 Compress all code using the Ft32B code compression scheme.
19380 Do not generate code that reads program memory.
19385 @subsection FRV Options
19386 @cindex FRV Options
19392 Only use the first 32 general-purpose registers.
19397 Use all 64 general-purpose registers.
19402 Use only the first 32 floating-point registers.
19407 Use all 64 floating-point registers.
19410 @opindex mhard-float
19412 Use hardware instructions for floating-point operations.
19415 @opindex msoft-float
19417 Use library routines for floating-point operations.
19422 Dynamically allocate condition code registers.
19427 Do not try to dynamically allocate condition code registers, only
19428 use @code{icc0} and @code{fcc0}.
19433 Change ABI to use double word insns.
19439 Do not use double word instructions.
19444 Use floating-point double instructions.
19447 @opindex mno-double
19449 Do not use floating-point double instructions.
19454 Use media instructions.
19459 Do not use media instructions.
19464 Use multiply and add/subtract instructions.
19467 @opindex mno-muladd
19469 Do not use multiply and add/subtract instructions.
19474 Select the FDPIC ABI, which uses function descriptors to represent
19475 pointers to functions. Without any PIC/PIE-related options, it
19476 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
19477 assumes GOT entries and small data are within a 12-bit range from the
19478 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
19479 are computed with 32 bits.
19480 With a @samp{bfin-elf} target, this option implies @option{-msim}.
19483 @opindex minline-plt
19485 Enable inlining of PLT entries in function calls to functions that are
19486 not known to bind locally. It has no effect without @option{-mfdpic}.
19487 It's enabled by default if optimizing for speed and compiling for
19488 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
19489 optimization option such as @option{-O3} or above is present in the
19495 Assume a large TLS segment when generating thread-local code.
19500 Do not assume a large TLS segment when generating thread-local code.
19505 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
19506 that is known to be in read-only sections. It's enabled by default,
19507 except for @option{-fpic} or @option{-fpie}: even though it may help
19508 make the global offset table smaller, it trades 1 instruction for 4.
19509 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
19510 one of which may be shared by multiple symbols, and it avoids the need
19511 for a GOT entry for the referenced symbol, so it's more likely to be a
19512 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
19514 @item -multilib-library-pic
19515 @opindex multilib-library-pic
19517 Link with the (library, not FD) pic libraries. It's implied by
19518 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
19519 @option{-fpic} without @option{-mfdpic}. You should never have to use
19523 @opindex mlinked-fp
19525 Follow the EABI requirement of always creating a frame pointer whenever
19526 a stack frame is allocated. This option is enabled by default and can
19527 be disabled with @option{-mno-linked-fp}.
19530 @opindex mlong-calls
19532 Use indirect addressing to call functions outside the current
19533 compilation unit. This allows the functions to be placed anywhere
19534 within the 32-bit address space.
19536 @item -malign-labels
19537 @opindex malign-labels
19539 Try to align labels to an 8-byte boundary by inserting NOPs into the
19540 previous packet. This option only has an effect when VLIW packing
19541 is enabled. It doesn't create new packets; it merely adds NOPs to
19544 @item -mlibrary-pic
19545 @opindex mlibrary-pic
19547 Generate position-independent EABI code.
19552 Use only the first four media accumulator registers.
19557 Use all eight media accumulator registers.
19562 Pack VLIW instructions.
19567 Do not pack VLIW instructions.
19570 @opindex mno-eflags
19572 Do not mark ABI switches in e_flags.
19575 @opindex mcond-move
19577 Enable the use of conditional-move instructions (default).
19579 This switch is mainly for debugging the compiler and will likely be removed
19580 in a future version.
19582 @item -mno-cond-move
19583 @opindex mno-cond-move
19585 Disable the use of conditional-move instructions.
19587 This switch is mainly for debugging the compiler and will likely be removed
19588 in a future version.
19593 Enable the use of conditional set instructions (default).
19595 This switch is mainly for debugging the compiler and will likely be removed
19596 in a future version.
19601 Disable the use of conditional set instructions.
19603 This switch is mainly for debugging the compiler and will likely be removed
19604 in a future version.
19607 @opindex mcond-exec
19609 Enable the use of conditional execution (default).
19611 This switch is mainly for debugging the compiler and will likely be removed
19612 in a future version.
19614 @item -mno-cond-exec
19615 @opindex mno-cond-exec
19617 Disable the use of conditional execution.
19619 This switch is mainly for debugging the compiler and will likely be removed
19620 in a future version.
19622 @item -mvliw-branch
19623 @opindex mvliw-branch
19625 Run a pass to pack branches into VLIW instructions (default).
19627 This switch is mainly for debugging the compiler and will likely be removed
19628 in a future version.
19630 @item -mno-vliw-branch
19631 @opindex mno-vliw-branch
19633 Do not run a pass to pack branches into VLIW instructions.
19635 This switch is mainly for debugging the compiler and will likely be removed
19636 in a future version.
19638 @item -mmulti-cond-exec
19639 @opindex mmulti-cond-exec
19641 Enable optimization of @code{&&} and @code{||} in conditional execution
19644 This switch is mainly for debugging the compiler and will likely be removed
19645 in a future version.
19647 @item -mno-multi-cond-exec
19648 @opindex mno-multi-cond-exec
19650 Disable optimization of @code{&&} and @code{||} in conditional execution.
19652 This switch is mainly for debugging the compiler and will likely be removed
19653 in a future version.
19655 @item -mnested-cond-exec
19656 @opindex mnested-cond-exec
19658 Enable nested conditional execution optimizations (default).
19660 This switch is mainly for debugging the compiler and will likely be removed
19661 in a future version.
19663 @item -mno-nested-cond-exec
19664 @opindex mno-nested-cond-exec
19666 Disable nested conditional execution optimizations.
19668 This switch is mainly for debugging the compiler and will likely be removed
19669 in a future version.
19671 @item -moptimize-membar
19672 @opindex moptimize-membar
19674 This switch removes redundant @code{membar} instructions from the
19675 compiler-generated code. It is enabled by default.
19677 @item -mno-optimize-membar
19678 @opindex mno-optimize-membar
19679 @opindex moptimize-membar
19681 This switch disables the automatic removal of redundant @code{membar}
19682 instructions from the generated code.
19684 @item -mtomcat-stats
19685 @opindex mtomcat-stats
19687 Cause gas to print out tomcat statistics.
19689 @item -mcpu=@var{cpu}
19692 Select the processor type for which to generate code. Possible values are
19693 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
19694 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
19698 @node GNU/Linux Options
19699 @subsection GNU/Linux Options
19701 These @samp{-m} options are defined for GNU/Linux targets:
19706 Use the GNU C library. This is the default except
19707 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
19708 @samp{*-*-linux-*android*} targets.
19712 Use uClibc C library. This is the default on
19713 @samp{*-*-linux-*uclibc*} targets.
19717 Use the musl C library. This is the default on
19718 @samp{*-*-linux-*musl*} targets.
19722 Use Bionic C library. This is the default on
19723 @samp{*-*-linux-*android*} targets.
19727 Compile code compatible with Android platform. This is the default on
19728 @samp{*-*-linux-*android*} targets.
19730 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
19731 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
19732 this option makes the GCC driver pass Android-specific options to the linker.
19733 Finally, this option causes the preprocessor macro @code{__ANDROID__}
19736 @item -tno-android-cc
19737 @opindex tno-android-cc
19738 Disable compilation effects of @option{-mandroid}, i.e., do not enable
19739 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
19740 @option{-fno-rtti} by default.
19742 @item -tno-android-ld
19743 @opindex tno-android-ld
19744 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
19745 linking options to the linker.
19749 @node H8/300 Options
19750 @subsection H8/300 Options
19752 These @samp{-m} options are defined for the H8/300 implementations:
19757 Shorten some address references at link time, when possible; uses the
19758 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
19759 ld, Using ld}, for a fuller description.
19763 Generate code for the H8/300H@.
19767 Generate code for the H8S@.
19771 Generate code for the H8S and H8/300H in the normal mode. This switch
19772 must be used either with @option{-mh} or @option{-ms}.
19776 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
19780 Extended registers are stored on stack before execution of function
19781 with monitor attribute. Default option is @option{-mexr}.
19782 This option is valid only for H8S targets.
19787 Extended registers are not stored on stack before execution of function
19788 with monitor attribute. Default option is @option{-mno-exr}.
19789 This option is valid only for H8S targets.
19793 Make @code{int} data 32 bits by default.
19796 @opindex malign-300
19797 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
19798 The default for the H8/300H and H8S is to align longs and floats on
19800 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
19801 This option has no effect on the H8/300.
19805 @subsection HPPA Options
19806 @cindex HPPA Options
19808 These @samp{-m} options are defined for the HPPA family of computers:
19811 @item -march=@var{architecture-type}
19813 Generate code for the specified architecture. The choices for
19814 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
19815 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
19816 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
19817 architecture option for your machine. Code compiled for lower numbered
19818 architectures runs on higher numbered architectures, but not the
19821 @item -mpa-risc-1-0
19822 @itemx -mpa-risc-1-1
19823 @itemx -mpa-risc-2-0
19824 @opindex mpa-risc-1-0
19825 @opindex mpa-risc-1-1
19826 @opindex mpa-risc-2-0
19827 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
19829 @item -mcaller-copies
19830 @opindex mcaller-copies
19831 The caller copies function arguments passed by hidden reference. This
19832 option should be used with care as it is not compatible with the default
19833 32-bit runtime. However, only aggregates larger than eight bytes are
19834 passed by hidden reference and the option provides better compatibility
19837 @item -mjump-in-delay
19838 @opindex mjump-in-delay
19839 This option is ignored and provided for compatibility purposes only.
19841 @item -mdisable-fpregs
19842 @opindex mdisable-fpregs
19843 Prevent floating-point registers from being used in any manner. This is
19844 necessary for compiling kernels that perform lazy context switching of
19845 floating-point registers. If you use this option and attempt to perform
19846 floating-point operations, the compiler aborts.
19848 @item -mdisable-indexing
19849 @opindex mdisable-indexing
19850 Prevent the compiler from using indexing address modes. This avoids some
19851 rather obscure problems when compiling MIG generated code under MACH@.
19853 @item -mno-space-regs
19854 @opindex mno-space-regs
19855 @opindex mspace-regs
19856 Generate code that assumes the target has no space registers. This allows
19857 GCC to generate faster indirect calls and use unscaled index address modes.
19859 Such code is suitable for level 0 PA systems and kernels.
19861 @item -mfast-indirect-calls
19862 @opindex mfast-indirect-calls
19863 Generate code that assumes calls never cross space boundaries. This
19864 allows GCC to emit code that performs faster indirect calls.
19866 This option does not work in the presence of shared libraries or nested
19869 @item -mfixed-range=@var{register-range}
19870 @opindex mfixed-range
19871 Generate code treating the given register range as fixed registers.
19872 A fixed register is one that the register allocator cannot use. This is
19873 useful when compiling kernel code. A register range is specified as
19874 two registers separated by a dash. Multiple register ranges can be
19875 specified separated by a comma.
19877 @item -mlong-load-store
19878 @opindex mlong-load-store
19879 Generate 3-instruction load and store sequences as sometimes required by
19880 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
19883 @item -mportable-runtime
19884 @opindex mportable-runtime
19885 Use the portable calling conventions proposed by HP for ELF systems.
19889 Enable the use of assembler directives only GAS understands.
19891 @item -mschedule=@var{cpu-type}
19893 Schedule code according to the constraints for the machine type
19894 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
19895 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
19896 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
19897 proper scheduling option for your machine. The default scheduling is
19901 @opindex mlinker-opt
19902 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
19903 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
19904 linkers in which they give bogus error messages when linking some programs.
19907 @opindex msoft-float
19908 Generate output containing library calls for floating point.
19909 @strong{Warning:} the requisite libraries are not available for all HPPA
19910 targets. Normally the facilities of the machine's usual C compiler are
19911 used, but this cannot be done directly in cross-compilation. You must make
19912 your own arrangements to provide suitable library functions for
19915 @option{-msoft-float} changes the calling convention in the output file;
19916 therefore, it is only useful if you compile @emph{all} of a program with
19917 this option. In particular, you need to compile @file{libgcc.a}, the
19918 library that comes with GCC, with @option{-msoft-float} in order for
19923 Generate the predefine, @code{_SIO}, for server IO@. The default is
19924 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
19925 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
19926 options are available under HP-UX and HI-UX@.
19930 Use options specific to GNU @command{ld}.
19931 This passes @option{-shared} to @command{ld} when
19932 building a shared library. It is the default when GCC is configured,
19933 explicitly or implicitly, with the GNU linker. This option does not
19934 affect which @command{ld} is called; it only changes what parameters
19935 are passed to that @command{ld}.
19936 The @command{ld} that is called is determined by the
19937 @option{--with-ld} configure option, GCC's program search path, and
19938 finally by the user's @env{PATH}. The linker used by GCC can be printed
19939 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
19940 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
19944 Use options specific to HP @command{ld}.
19945 This passes @option{-b} to @command{ld} when building
19946 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
19947 links. It is the default when GCC is configured, explicitly or
19948 implicitly, with the HP linker. This option does not affect
19949 which @command{ld} is called; it only changes what parameters are passed to that
19951 The @command{ld} that is called is determined by the @option{--with-ld}
19952 configure option, GCC's program search path, and finally by the user's
19953 @env{PATH}. The linker used by GCC can be printed using @samp{which
19954 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
19955 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
19958 @opindex mno-long-calls
19959 @opindex mlong-calls
19960 Generate code that uses long call sequences. This ensures that a call
19961 is always able to reach linker generated stubs. The default is to generate
19962 long calls only when the distance from the call site to the beginning
19963 of the function or translation unit, as the case may be, exceeds a
19964 predefined limit set by the branch type being used. The limits for
19965 normal calls are 7,600,000 and 240,000 bytes, respectively for the
19966 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
19969 Distances are measured from the beginning of functions when using the
19970 @option{-ffunction-sections} option, or when using the @option{-mgas}
19971 and @option{-mno-portable-runtime} options together under HP-UX with
19974 It is normally not desirable to use this option as it degrades
19975 performance. However, it may be useful in large applications,
19976 particularly when partial linking is used to build the application.
19978 The types of long calls used depends on the capabilities of the
19979 assembler and linker, and the type of code being generated. The
19980 impact on systems that support long absolute calls, and long pic
19981 symbol-difference or pc-relative calls should be relatively small.
19982 However, an indirect call is used on 32-bit ELF systems in pic code
19983 and it is quite long.
19985 @item -munix=@var{unix-std}
19987 Generate compiler predefines and select a startfile for the specified
19988 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
19989 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
19990 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
19991 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
19992 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
19995 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
19996 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
19997 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
19998 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
19999 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
20000 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
20002 It is @emph{important} to note that this option changes the interfaces
20003 for various library routines. It also affects the operational behavior
20004 of the C library. Thus, @emph{extreme} care is needed in using this
20007 Library code that is intended to operate with more than one UNIX
20008 standard must test, set and restore the variable @code{__xpg4_extended_mask}
20009 as appropriate. Most GNU software doesn't provide this capability.
20013 Suppress the generation of link options to search libdld.sl when the
20014 @option{-static} option is specified on HP-UX 10 and later.
20018 The HP-UX implementation of setlocale in libc has a dependency on
20019 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20020 when the @option{-static} option is specified, special link options
20021 are needed to resolve this dependency.
20023 On HP-UX 10 and later, the GCC driver adds the necessary options to
20024 link with libdld.sl when the @option{-static} option is specified.
20025 This causes the resulting binary to be dynamic. On the 64-bit port,
20026 the linkers generate dynamic binaries by default in any case. The
20027 @option{-nolibdld} option can be used to prevent the GCC driver from
20028 adding these link options.
20032 Add support for multithreading with the @dfn{dce thread} library
20033 under HP-UX@. This option sets flags for both the preprocessor and
20037 @node IA-64 Options
20038 @subsection IA-64 Options
20039 @cindex IA-64 Options
20041 These are the @samp{-m} options defined for the Intel IA-64 architecture.
20045 @opindex mbig-endian
20046 Generate code for a big-endian target. This is the default for HP-UX@.
20048 @item -mlittle-endian
20049 @opindex mlittle-endian
20050 Generate code for a little-endian target. This is the default for AIX5
20056 @opindex mno-gnu-as
20057 Generate (or don't) code for the GNU assembler. This is the default.
20058 @c Also, this is the default if the configure option @option{--with-gnu-as}
20064 @opindex mno-gnu-ld
20065 Generate (or don't) code for the GNU linker. This is the default.
20066 @c Also, this is the default if the configure option @option{--with-gnu-ld}
20071 Generate code that does not use a global pointer register. The result
20072 is not position independent code, and violates the IA-64 ABI@.
20074 @item -mvolatile-asm-stop
20075 @itemx -mno-volatile-asm-stop
20076 @opindex mvolatile-asm-stop
20077 @opindex mno-volatile-asm-stop
20078 Generate (or don't) a stop bit immediately before and after volatile asm
20081 @item -mregister-names
20082 @itemx -mno-register-names
20083 @opindex mregister-names
20084 @opindex mno-register-names
20085 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
20086 the stacked registers. This may make assembler output more readable.
20092 Disable (or enable) optimizations that use the small data section. This may
20093 be useful for working around optimizer bugs.
20095 @item -mconstant-gp
20096 @opindex mconstant-gp
20097 Generate code that uses a single constant global pointer value. This is
20098 useful when compiling kernel code.
20102 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
20103 This is useful when compiling firmware code.
20105 @item -minline-float-divide-min-latency
20106 @opindex minline-float-divide-min-latency
20107 Generate code for inline divides of floating-point values
20108 using the minimum latency algorithm.
20110 @item -minline-float-divide-max-throughput
20111 @opindex minline-float-divide-max-throughput
20112 Generate code for inline divides of floating-point values
20113 using the maximum throughput algorithm.
20115 @item -mno-inline-float-divide
20116 @opindex mno-inline-float-divide
20117 Do not generate inline code for divides of floating-point values.
20119 @item -minline-int-divide-min-latency
20120 @opindex minline-int-divide-min-latency
20121 Generate code for inline divides of integer values
20122 using the minimum latency algorithm.
20124 @item -minline-int-divide-max-throughput
20125 @opindex minline-int-divide-max-throughput
20126 Generate code for inline divides of integer values
20127 using the maximum throughput algorithm.
20129 @item -mno-inline-int-divide
20130 @opindex mno-inline-int-divide
20131 @opindex minline-int-divide
20132 Do not generate inline code for divides of integer values.
20134 @item -minline-sqrt-min-latency
20135 @opindex minline-sqrt-min-latency
20136 Generate code for inline square roots
20137 using the minimum latency algorithm.
20139 @item -minline-sqrt-max-throughput
20140 @opindex minline-sqrt-max-throughput
20141 Generate code for inline square roots
20142 using the maximum throughput algorithm.
20144 @item -mno-inline-sqrt
20145 @opindex mno-inline-sqrt
20146 Do not generate inline code for @code{sqrt}.
20149 @itemx -mno-fused-madd
20150 @opindex mfused-madd
20151 @opindex mno-fused-madd
20152 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
20153 instructions. The default is to use these instructions.
20155 @item -mno-dwarf2-asm
20156 @itemx -mdwarf2-asm
20157 @opindex mno-dwarf2-asm
20158 @opindex mdwarf2-asm
20159 Don't (or do) generate assembler code for the DWARF line number debugging
20160 info. This may be useful when not using the GNU assembler.
20162 @item -mearly-stop-bits
20163 @itemx -mno-early-stop-bits
20164 @opindex mearly-stop-bits
20165 @opindex mno-early-stop-bits
20166 Allow stop bits to be placed earlier than immediately preceding the
20167 instruction that triggered the stop bit. This can improve instruction
20168 scheduling, but does not always do so.
20170 @item -mfixed-range=@var{register-range}
20171 @opindex mfixed-range
20172 Generate code treating the given register range as fixed registers.
20173 A fixed register is one that the register allocator cannot use. This is
20174 useful when compiling kernel code. A register range is specified as
20175 two registers separated by a dash. Multiple register ranges can be
20176 specified separated by a comma.
20178 @item -mtls-size=@var{tls-size}
20180 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
20183 @item -mtune=@var{cpu-type}
20185 Tune the instruction scheduling for a particular CPU, Valid values are
20186 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
20187 and @samp{mckinley}.
20193 Generate code for a 32-bit or 64-bit environment.
20194 The 32-bit environment sets int, long and pointer to 32 bits.
20195 The 64-bit environment sets int to 32 bits and long and pointer
20196 to 64 bits. These are HP-UX specific flags.
20198 @item -mno-sched-br-data-spec
20199 @itemx -msched-br-data-spec
20200 @opindex mno-sched-br-data-spec
20201 @opindex msched-br-data-spec
20202 (Dis/En)able data speculative scheduling before reload.
20203 This results in generation of @code{ld.a} instructions and
20204 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20205 The default setting is disabled.
20207 @item -msched-ar-data-spec
20208 @itemx -mno-sched-ar-data-spec
20209 @opindex msched-ar-data-spec
20210 @opindex mno-sched-ar-data-spec
20211 (En/Dis)able data speculative scheduling after reload.
20212 This results in generation of @code{ld.a} instructions and
20213 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20214 The default setting is enabled.
20216 @item -mno-sched-control-spec
20217 @itemx -msched-control-spec
20218 @opindex mno-sched-control-spec
20219 @opindex msched-control-spec
20220 (Dis/En)able control speculative scheduling. This feature is
20221 available only during region scheduling (i.e.@: before reload).
20222 This results in generation of the @code{ld.s} instructions and
20223 the corresponding check instructions @code{chk.s}.
20224 The default setting is disabled.
20226 @item -msched-br-in-data-spec
20227 @itemx -mno-sched-br-in-data-spec
20228 @opindex msched-br-in-data-spec
20229 @opindex mno-sched-br-in-data-spec
20230 (En/Dis)able speculative scheduling of the instructions that
20231 are dependent on the data speculative loads before reload.
20232 This is effective only with @option{-msched-br-data-spec} enabled.
20233 The default setting is enabled.
20235 @item -msched-ar-in-data-spec
20236 @itemx -mno-sched-ar-in-data-spec
20237 @opindex msched-ar-in-data-spec
20238 @opindex mno-sched-ar-in-data-spec
20239 (En/Dis)able speculative scheduling of the instructions that
20240 are dependent on the data speculative loads after reload.
20241 This is effective only with @option{-msched-ar-data-spec} enabled.
20242 The default setting is enabled.
20244 @item -msched-in-control-spec
20245 @itemx -mno-sched-in-control-spec
20246 @opindex msched-in-control-spec
20247 @opindex mno-sched-in-control-spec
20248 (En/Dis)able speculative scheduling of the instructions that
20249 are dependent on the control speculative loads.
20250 This is effective only with @option{-msched-control-spec} enabled.
20251 The default setting is enabled.
20253 @item -mno-sched-prefer-non-data-spec-insns
20254 @itemx -msched-prefer-non-data-spec-insns
20255 @opindex mno-sched-prefer-non-data-spec-insns
20256 @opindex msched-prefer-non-data-spec-insns
20257 If enabled, data-speculative instructions are chosen for schedule
20258 only if there are no other choices at the moment. This makes
20259 the use of the data speculation much more conservative.
20260 The default setting is disabled.
20262 @item -mno-sched-prefer-non-control-spec-insns
20263 @itemx -msched-prefer-non-control-spec-insns
20264 @opindex mno-sched-prefer-non-control-spec-insns
20265 @opindex msched-prefer-non-control-spec-insns
20266 If enabled, control-speculative instructions are chosen for schedule
20267 only if there are no other choices at the moment. This makes
20268 the use of the control speculation much more conservative.
20269 The default setting is disabled.
20271 @item -mno-sched-count-spec-in-critical-path
20272 @itemx -msched-count-spec-in-critical-path
20273 @opindex mno-sched-count-spec-in-critical-path
20274 @opindex msched-count-spec-in-critical-path
20275 If enabled, speculative dependencies are considered during
20276 computation of the instructions priorities. This makes the use of the
20277 speculation a bit more conservative.
20278 The default setting is disabled.
20280 @item -msched-spec-ldc
20281 @opindex msched-spec-ldc
20282 Use a simple data speculation check. This option is on by default.
20284 @item -msched-control-spec-ldc
20285 @opindex msched-spec-ldc
20286 Use a simple check for control speculation. This option is on by default.
20288 @item -msched-stop-bits-after-every-cycle
20289 @opindex msched-stop-bits-after-every-cycle
20290 Place a stop bit after every cycle when scheduling. This option is on
20293 @item -msched-fp-mem-deps-zero-cost
20294 @opindex msched-fp-mem-deps-zero-cost
20295 Assume that floating-point stores and loads are not likely to cause a conflict
20296 when placed into the same instruction group. This option is disabled by
20299 @item -msel-sched-dont-check-control-spec
20300 @opindex msel-sched-dont-check-control-spec
20301 Generate checks for control speculation in selective scheduling.
20302 This flag is disabled by default.
20304 @item -msched-max-memory-insns=@var{max-insns}
20305 @opindex msched-max-memory-insns
20306 Limit on the number of memory insns per instruction group, giving lower
20307 priority to subsequent memory insns attempting to schedule in the same
20308 instruction group. Frequently useful to prevent cache bank conflicts.
20309 The default value is 1.
20311 @item -msched-max-memory-insns-hard-limit
20312 @opindex msched-max-memory-insns-hard-limit
20313 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
20314 disallowing more than that number in an instruction group.
20315 Otherwise, the limit is ``soft'', meaning that non-memory operations
20316 are preferred when the limit is reached, but memory operations may still
20322 @subsection LM32 Options
20323 @cindex LM32 options
20325 These @option{-m} options are defined for the LatticeMico32 architecture:
20328 @item -mbarrel-shift-enabled
20329 @opindex mbarrel-shift-enabled
20330 Enable barrel-shift instructions.
20332 @item -mdivide-enabled
20333 @opindex mdivide-enabled
20334 Enable divide and modulus instructions.
20336 @item -mmultiply-enabled
20337 @opindex multiply-enabled
20338 Enable multiply instructions.
20340 @item -msign-extend-enabled
20341 @opindex msign-extend-enabled
20342 Enable sign extend instructions.
20344 @item -muser-enabled
20345 @opindex muser-enabled
20346 Enable user-defined instructions.
20351 @subsection M32C Options
20352 @cindex M32C options
20355 @item -mcpu=@var{name}
20357 Select the CPU for which code is generated. @var{name} may be one of
20358 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
20359 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
20360 the M32C/80 series.
20364 Specifies that the program will be run on the simulator. This causes
20365 an alternate runtime library to be linked in which supports, for
20366 example, file I/O@. You must not use this option when generating
20367 programs that will run on real hardware; you must provide your own
20368 runtime library for whatever I/O functions are needed.
20370 @item -memregs=@var{number}
20372 Specifies the number of memory-based pseudo-registers GCC uses
20373 during code generation. These pseudo-registers are used like real
20374 registers, so there is a tradeoff between GCC's ability to fit the
20375 code into available registers, and the performance penalty of using
20376 memory instead of registers. Note that all modules in a program must
20377 be compiled with the same value for this option. Because of that, you
20378 must not use this option with GCC's default runtime libraries.
20382 @node M32R/D Options
20383 @subsection M32R/D Options
20384 @cindex M32R/D options
20386 These @option{-m} options are defined for Renesas M32R/D architectures:
20391 Generate code for the M32R/2@.
20395 Generate code for the M32R/X@.
20399 Generate code for the M32R@. This is the default.
20401 @item -mmodel=small
20402 @opindex mmodel=small
20403 Assume all objects live in the lower 16MB of memory (so that their addresses
20404 can be loaded with the @code{ld24} instruction), and assume all subroutines
20405 are reachable with the @code{bl} instruction.
20406 This is the default.
20408 The addressability of a particular object can be set with the
20409 @code{model} attribute.
20411 @item -mmodel=medium
20412 @opindex mmodel=medium
20413 Assume objects may be anywhere in the 32-bit address space (the compiler
20414 generates @code{seth/add3} instructions to load their addresses), and
20415 assume all subroutines are reachable with the @code{bl} instruction.
20417 @item -mmodel=large
20418 @opindex mmodel=large
20419 Assume objects may be anywhere in the 32-bit address space (the compiler
20420 generates @code{seth/add3} instructions to load their addresses), and
20421 assume subroutines may not be reachable with the @code{bl} instruction
20422 (the compiler generates the much slower @code{seth/add3/jl}
20423 instruction sequence).
20426 @opindex msdata=none
20427 Disable use of the small data area. Variables are put into
20428 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
20429 @code{section} attribute has been specified).
20430 This is the default.
20432 The small data area consists of sections @code{.sdata} and @code{.sbss}.
20433 Objects may be explicitly put in the small data area with the
20434 @code{section} attribute using one of these sections.
20436 @item -msdata=sdata
20437 @opindex msdata=sdata
20438 Put small global and static data in the small data area, but do not
20439 generate special code to reference them.
20442 @opindex msdata=use
20443 Put small global and static data in the small data area, and generate
20444 special instructions to reference them.
20448 @cindex smaller data references
20449 Put global and static objects less than or equal to @var{num} bytes
20450 into the small data or BSS sections instead of the normal data or BSS
20451 sections. The default value of @var{num} is 8.
20452 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
20453 for this option to have any effect.
20455 All modules should be compiled with the same @option{-G @var{num}} value.
20456 Compiling with different values of @var{num} may or may not work; if it
20457 doesn't the linker gives an error message---incorrect code is not
20462 Makes the M32R-specific code in the compiler display some statistics
20463 that might help in debugging programs.
20465 @item -malign-loops
20466 @opindex malign-loops
20467 Align all loops to a 32-byte boundary.
20469 @item -mno-align-loops
20470 @opindex mno-align-loops
20471 Do not enforce a 32-byte alignment for loops. This is the default.
20473 @item -missue-rate=@var{number}
20474 @opindex missue-rate=@var{number}
20475 Issue @var{number} instructions per cycle. @var{number} can only be 1
20478 @item -mbranch-cost=@var{number}
20479 @opindex mbranch-cost=@var{number}
20480 @var{number} can only be 1 or 2. If it is 1 then branches are
20481 preferred over conditional code, if it is 2, then the opposite applies.
20483 @item -mflush-trap=@var{number}
20484 @opindex mflush-trap=@var{number}
20485 Specifies the trap number to use to flush the cache. The default is
20486 12. Valid numbers are between 0 and 15 inclusive.
20488 @item -mno-flush-trap
20489 @opindex mno-flush-trap
20490 Specifies that the cache cannot be flushed by using a trap.
20492 @item -mflush-func=@var{name}
20493 @opindex mflush-func=@var{name}
20494 Specifies the name of the operating system function to call to flush
20495 the cache. The default is @samp{_flush_cache}, but a function call
20496 is only used if a trap is not available.
20498 @item -mno-flush-func
20499 @opindex mno-flush-func
20500 Indicates that there is no OS function for flushing the cache.
20504 @node M680x0 Options
20505 @subsection M680x0 Options
20506 @cindex M680x0 options
20508 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
20509 The default settings depend on which architecture was selected when
20510 the compiler was configured; the defaults for the most common choices
20514 @item -march=@var{arch}
20516 Generate code for a specific M680x0 or ColdFire instruction set
20517 architecture. Permissible values of @var{arch} for M680x0
20518 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
20519 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
20520 architectures are selected according to Freescale's ISA classification
20521 and the permissible values are: @samp{isaa}, @samp{isaaplus},
20522 @samp{isab} and @samp{isac}.
20524 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
20525 code for a ColdFire target. The @var{arch} in this macro is one of the
20526 @option{-march} arguments given above.
20528 When used together, @option{-march} and @option{-mtune} select code
20529 that runs on a family of similar processors but that is optimized
20530 for a particular microarchitecture.
20532 @item -mcpu=@var{cpu}
20534 Generate code for a specific M680x0 or ColdFire processor.
20535 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
20536 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
20537 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
20538 below, which also classifies the CPUs into families:
20540 @multitable @columnfractions 0.20 0.80
20541 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
20542 @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}
20543 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
20544 @item @samp{5206e} @tab @samp{5206e}
20545 @item @samp{5208} @tab @samp{5207} @samp{5208}
20546 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
20547 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
20548 @item @samp{5216} @tab @samp{5214} @samp{5216}
20549 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
20550 @item @samp{5225} @tab @samp{5224} @samp{5225}
20551 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
20552 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
20553 @item @samp{5249} @tab @samp{5249}
20554 @item @samp{5250} @tab @samp{5250}
20555 @item @samp{5271} @tab @samp{5270} @samp{5271}
20556 @item @samp{5272} @tab @samp{5272}
20557 @item @samp{5275} @tab @samp{5274} @samp{5275}
20558 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
20559 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
20560 @item @samp{5307} @tab @samp{5307}
20561 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
20562 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
20563 @item @samp{5407} @tab @samp{5407}
20564 @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}
20567 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
20568 @var{arch} is compatible with @var{cpu}. Other combinations of
20569 @option{-mcpu} and @option{-march} are rejected.
20571 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
20572 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
20573 where the value of @var{family} is given by the table above.
20575 @item -mtune=@var{tune}
20577 Tune the code for a particular microarchitecture within the
20578 constraints set by @option{-march} and @option{-mcpu}.
20579 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
20580 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
20581 and @samp{cpu32}. The ColdFire microarchitectures
20582 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
20584 You can also use @option{-mtune=68020-40} for code that needs
20585 to run relatively well on 68020, 68030 and 68040 targets.
20586 @option{-mtune=68020-60} is similar but includes 68060 targets
20587 as well. These two options select the same tuning decisions as
20588 @option{-m68020-40} and @option{-m68020-60} respectively.
20590 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
20591 when tuning for 680x0 architecture @var{arch}. It also defines
20592 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
20593 option is used. If GCC is tuning for a range of architectures,
20594 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
20595 it defines the macros for every architecture in the range.
20597 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
20598 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
20599 of the arguments given above.
20605 Generate output for a 68000. This is the default
20606 when the compiler is configured for 68000-based systems.
20607 It is equivalent to @option{-march=68000}.
20609 Use this option for microcontrollers with a 68000 or EC000 core,
20610 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
20614 Generate output for a 68010. This is the default
20615 when the compiler is configured for 68010-based systems.
20616 It is equivalent to @option{-march=68010}.
20622 Generate output for a 68020. This is the default
20623 when the compiler is configured for 68020-based systems.
20624 It is equivalent to @option{-march=68020}.
20628 Generate output for a 68030. This is the default when the compiler is
20629 configured for 68030-based systems. It is equivalent to
20630 @option{-march=68030}.
20634 Generate output for a 68040. This is the default when the compiler is
20635 configured for 68040-based systems. It is equivalent to
20636 @option{-march=68040}.
20638 This option inhibits the use of 68881/68882 instructions that have to be
20639 emulated by software on the 68040. Use this option if your 68040 does not
20640 have code to emulate those instructions.
20644 Generate output for a 68060. This is the default when the compiler is
20645 configured for 68060-based systems. It is equivalent to
20646 @option{-march=68060}.
20648 This option inhibits the use of 68020 and 68881/68882 instructions that
20649 have to be emulated by software on the 68060. Use this option if your 68060
20650 does not have code to emulate those instructions.
20654 Generate output for a CPU32. This is the default
20655 when the compiler is configured for CPU32-based systems.
20656 It is equivalent to @option{-march=cpu32}.
20658 Use this option for microcontrollers with a
20659 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
20660 68336, 68340, 68341, 68349 and 68360.
20664 Generate output for a 520X ColdFire CPU@. This is the default
20665 when the compiler is configured for 520X-based systems.
20666 It is equivalent to @option{-mcpu=5206}, and is now deprecated
20667 in favor of that option.
20669 Use this option for microcontroller with a 5200 core, including
20670 the MCF5202, MCF5203, MCF5204 and MCF5206.
20674 Generate output for a 5206e ColdFire CPU@. The option is now
20675 deprecated in favor of the equivalent @option{-mcpu=5206e}.
20679 Generate output for a member of the ColdFire 528X family.
20680 The option is now deprecated in favor of the equivalent
20681 @option{-mcpu=528x}.
20685 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
20686 in favor of the equivalent @option{-mcpu=5307}.
20690 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
20691 in favor of the equivalent @option{-mcpu=5407}.
20695 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
20696 This includes use of hardware floating-point instructions.
20697 The option is equivalent to @option{-mcpu=547x}, and is now
20698 deprecated in favor of that option.
20702 Generate output for a 68040, without using any of the new instructions.
20703 This results in code that can run relatively efficiently on either a
20704 68020/68881 or a 68030 or a 68040. The generated code does use the
20705 68881 instructions that are emulated on the 68040.
20707 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
20711 Generate output for a 68060, without using any of the new instructions.
20712 This results in code that can run relatively efficiently on either a
20713 68020/68881 or a 68030 or a 68040. The generated code does use the
20714 68881 instructions that are emulated on the 68060.
20716 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
20720 @opindex mhard-float
20722 Generate floating-point instructions. This is the default for 68020
20723 and above, and for ColdFire devices that have an FPU@. It defines the
20724 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
20725 on ColdFire targets.
20728 @opindex msoft-float
20729 Do not generate floating-point instructions; use library calls instead.
20730 This is the default for 68000, 68010, and 68832 targets. It is also
20731 the default for ColdFire devices that have no FPU.
20737 Generate (do not generate) ColdFire hardware divide and remainder
20738 instructions. If @option{-march} is used without @option{-mcpu},
20739 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
20740 architectures. Otherwise, the default is taken from the target CPU
20741 (either the default CPU, or the one specified by @option{-mcpu}). For
20742 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
20743 @option{-mcpu=5206e}.
20745 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
20749 Consider type @code{int} to be 16 bits wide, like @code{short int}.
20750 Additionally, parameters passed on the stack are also aligned to a
20751 16-bit boundary even on targets whose API mandates promotion to 32-bit.
20755 Do not consider type @code{int} to be 16 bits wide. This is the default.
20758 @itemx -mno-bitfield
20759 @opindex mnobitfield
20760 @opindex mno-bitfield
20761 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
20762 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
20766 Do use the bit-field instructions. The @option{-m68020} option implies
20767 @option{-mbitfield}. This is the default if you use a configuration
20768 designed for a 68020.
20772 Use a different function-calling convention, in which functions
20773 that take a fixed number of arguments return with the @code{rtd}
20774 instruction, which pops their arguments while returning. This
20775 saves one instruction in the caller since there is no need to pop
20776 the arguments there.
20778 This calling convention is incompatible with the one normally
20779 used on Unix, so you cannot use it if you need to call libraries
20780 compiled with the Unix compiler.
20782 Also, you must provide function prototypes for all functions that
20783 take variable numbers of arguments (including @code{printf});
20784 otherwise incorrect code is generated for calls to those
20787 In addition, seriously incorrect code results if you call a
20788 function with too many arguments. (Normally, extra arguments are
20789 harmlessly ignored.)
20791 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
20792 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
20794 The default is @option{-mno-rtd}.
20797 @itemx -mno-align-int
20798 @opindex malign-int
20799 @opindex mno-align-int
20800 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
20801 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
20802 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
20803 Aligning variables on 32-bit boundaries produces code that runs somewhat
20804 faster on processors with 32-bit busses at the expense of more memory.
20806 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
20807 aligns structures containing the above types differently than
20808 most published application binary interface specifications for the m68k.
20812 Use the pc-relative addressing mode of the 68000 directly, instead of
20813 using a global offset table. At present, this option implies @option{-fpic},
20814 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
20815 not presently supported with @option{-mpcrel}, though this could be supported for
20816 68020 and higher processors.
20818 @item -mno-strict-align
20819 @itemx -mstrict-align
20820 @opindex mno-strict-align
20821 @opindex mstrict-align
20822 Do not (do) assume that unaligned memory references are handled by
20826 Generate code that allows the data segment to be located in a different
20827 area of memory from the text segment. This allows for execute-in-place in
20828 an environment without virtual memory management. This option implies
20831 @item -mno-sep-data
20832 Generate code that assumes that the data segment follows the text segment.
20833 This is the default.
20835 @item -mid-shared-library
20836 Generate code that supports shared libraries via the library ID method.
20837 This allows for execute-in-place and shared libraries in an environment
20838 without virtual memory management. This option implies @option{-fPIC}.
20840 @item -mno-id-shared-library
20841 Generate code that doesn't assume ID-based shared libraries are being used.
20842 This is the default.
20844 @item -mshared-library-id=n
20845 Specifies the identification number of the ID-based shared library being
20846 compiled. Specifying a value of 0 generates more compact code; specifying
20847 other values forces the allocation of that number to the current
20848 library, but is no more space- or time-efficient than omitting this option.
20854 When generating position-independent code for ColdFire, generate code
20855 that works if the GOT has more than 8192 entries. This code is
20856 larger and slower than code generated without this option. On M680x0
20857 processors, this option is not needed; @option{-fPIC} suffices.
20859 GCC normally uses a single instruction to load values from the GOT@.
20860 While this is relatively efficient, it only works if the GOT
20861 is smaller than about 64k. Anything larger causes the linker
20862 to report an error such as:
20864 @cindex relocation truncated to fit (ColdFire)
20866 relocation truncated to fit: R_68K_GOT16O foobar
20869 If this happens, you should recompile your code with @option{-mxgot}.
20870 It should then work with very large GOTs. However, code generated with
20871 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
20872 the value of a global symbol.
20874 Note that some linkers, including newer versions of the GNU linker,
20875 can create multiple GOTs and sort GOT entries. If you have such a linker,
20876 you should only need to use @option{-mxgot} when compiling a single
20877 object file that accesses more than 8192 GOT entries. Very few do.
20879 These options have no effect unless GCC is generating
20880 position-independent code.
20882 @item -mlong-jump-table-offsets
20883 @opindex mlong-jump-table-offsets
20884 Use 32-bit offsets in @code{switch} tables. The default is to use
20889 @node MCore Options
20890 @subsection MCore Options
20891 @cindex MCore options
20893 These are the @samp{-m} options defined for the Motorola M*Core
20899 @itemx -mno-hardlit
20901 @opindex mno-hardlit
20902 Inline constants into the code stream if it can be done in two
20903 instructions or less.
20909 Use the divide instruction. (Enabled by default).
20911 @item -mrelax-immediate
20912 @itemx -mno-relax-immediate
20913 @opindex mrelax-immediate
20914 @opindex mno-relax-immediate
20915 Allow arbitrary-sized immediates in bit operations.
20917 @item -mwide-bitfields
20918 @itemx -mno-wide-bitfields
20919 @opindex mwide-bitfields
20920 @opindex mno-wide-bitfields
20921 Always treat bit-fields as @code{int}-sized.
20923 @item -m4byte-functions
20924 @itemx -mno-4byte-functions
20925 @opindex m4byte-functions
20926 @opindex mno-4byte-functions
20927 Force all functions to be aligned to a 4-byte boundary.
20929 @item -mcallgraph-data
20930 @itemx -mno-callgraph-data
20931 @opindex mcallgraph-data
20932 @opindex mno-callgraph-data
20933 Emit callgraph information.
20936 @itemx -mno-slow-bytes
20937 @opindex mslow-bytes
20938 @opindex mno-slow-bytes
20939 Prefer word access when reading byte quantities.
20941 @item -mlittle-endian
20942 @itemx -mbig-endian
20943 @opindex mlittle-endian
20944 @opindex mbig-endian
20945 Generate code for a little-endian target.
20951 Generate code for the 210 processor.
20955 Assume that runtime support has been provided and so omit the
20956 simulator library (@file{libsim.a)} from the linker command line.
20958 @item -mstack-increment=@var{size}
20959 @opindex mstack-increment
20960 Set the maximum amount for a single stack increment operation. Large
20961 values can increase the speed of programs that contain functions
20962 that need a large amount of stack space, but they can also trigger a
20963 segmentation fault if the stack is extended too much. The default
20969 @subsection MeP Options
20970 @cindex MeP options
20976 Enables the @code{abs} instruction, which is the absolute difference
20977 between two registers.
20981 Enables all the optional instructions---average, multiply, divide, bit
20982 operations, leading zero, absolute difference, min/max, clip, and
20988 Enables the @code{ave} instruction, which computes the average of two
20991 @item -mbased=@var{n}
20993 Variables of size @var{n} bytes or smaller are placed in the
20994 @code{.based} section by default. Based variables use the @code{$tp}
20995 register as a base register, and there is a 128-byte limit to the
20996 @code{.based} section.
21000 Enables the bit operation instructions---bit test (@code{btstm}), set
21001 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
21002 test-and-set (@code{tas}).
21004 @item -mc=@var{name}
21006 Selects which section constant data is placed in. @var{name} may
21007 be @samp{tiny}, @samp{near}, or @samp{far}.
21011 Enables the @code{clip} instruction. Note that @option{-mclip} is not
21012 useful unless you also provide @option{-mminmax}.
21014 @item -mconfig=@var{name}
21016 Selects one of the built-in core configurations. Each MeP chip has
21017 one or more modules in it; each module has a core CPU and a variety of
21018 coprocessors, optional instructions, and peripherals. The
21019 @code{MeP-Integrator} tool, not part of GCC, provides these
21020 configurations through this option; using this option is the same as
21021 using all the corresponding command-line options. The default
21022 configuration is @samp{default}.
21026 Enables the coprocessor instructions. By default, this is a 32-bit
21027 coprocessor. Note that the coprocessor is normally enabled via the
21028 @option{-mconfig=} option.
21032 Enables the 32-bit coprocessor's instructions.
21036 Enables the 64-bit coprocessor's instructions.
21040 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21044 Causes constant variables to be placed in the @code{.near} section.
21048 Enables the @code{div} and @code{divu} instructions.
21052 Generate big-endian code.
21056 Generate little-endian code.
21058 @item -mio-volatile
21059 @opindex mio-volatile
21060 Tells the compiler that any variable marked with the @code{io}
21061 attribute is to be considered volatile.
21065 Causes variables to be assigned to the @code{.far} section by default.
21069 Enables the @code{leadz} (leading zero) instruction.
21073 Causes variables to be assigned to the @code{.near} section by default.
21077 Enables the @code{min} and @code{max} instructions.
21081 Enables the multiplication and multiply-accumulate instructions.
21085 Disables all the optional instructions enabled by @option{-mall-opts}.
21089 Enables the @code{repeat} and @code{erepeat} instructions, used for
21090 low-overhead looping.
21094 Causes all variables to default to the @code{.tiny} section. Note
21095 that there is a 65536-byte limit to this section. Accesses to these
21096 variables use the @code{%gp} base register.
21100 Enables the saturation instructions. Note that the compiler does not
21101 currently generate these itself, but this option is included for
21102 compatibility with other tools, like @code{as}.
21106 Link the SDRAM-based runtime instead of the default ROM-based runtime.
21110 Link the simulator run-time libraries.
21114 Link the simulator runtime libraries, excluding built-in support
21115 for reset and exception vectors and tables.
21119 Causes all functions to default to the @code{.far} section. Without
21120 this option, functions default to the @code{.near} section.
21122 @item -mtiny=@var{n}
21124 Variables that are @var{n} bytes or smaller are allocated to the
21125 @code{.tiny} section. These variables use the @code{$gp} base
21126 register. The default for this option is 4, but note that there's a
21127 65536-byte limit to the @code{.tiny} section.
21131 @node MicroBlaze Options
21132 @subsection MicroBlaze Options
21133 @cindex MicroBlaze Options
21138 @opindex msoft-float
21139 Use software emulation for floating point (default).
21142 @opindex mhard-float
21143 Use hardware floating-point instructions.
21147 Do not optimize block moves, use @code{memcpy}.
21149 @item -mno-clearbss
21150 @opindex mno-clearbss
21151 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
21153 @item -mcpu=@var{cpu-type}
21155 Use features of, and schedule code for, the given CPU.
21156 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
21157 where @var{X} is a major version, @var{YY} is the minor version, and
21158 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
21159 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
21161 @item -mxl-soft-mul
21162 @opindex mxl-soft-mul
21163 Use software multiply emulation (default).
21165 @item -mxl-soft-div
21166 @opindex mxl-soft-div
21167 Use software emulation for divides (default).
21169 @item -mxl-barrel-shift
21170 @opindex mxl-barrel-shift
21171 Use the hardware barrel shifter.
21173 @item -mxl-pattern-compare
21174 @opindex mxl-pattern-compare
21175 Use pattern compare instructions.
21177 @item -msmall-divides
21178 @opindex msmall-divides
21179 Use table lookup optimization for small signed integer divisions.
21181 @item -mxl-stack-check
21182 @opindex mxl-stack-check
21183 This option is deprecated. Use @option{-fstack-check} instead.
21186 @opindex mxl-gp-opt
21187 Use GP-relative @code{.sdata}/@code{.sbss} sections.
21189 @item -mxl-multiply-high
21190 @opindex mxl-multiply-high
21191 Use multiply high instructions for high part of 32x32 multiply.
21193 @item -mxl-float-convert
21194 @opindex mxl-float-convert
21195 Use hardware floating-point conversion instructions.
21197 @item -mxl-float-sqrt
21198 @opindex mxl-float-sqrt
21199 Use hardware floating-point square root instruction.
21202 @opindex mbig-endian
21203 Generate code for a big-endian target.
21205 @item -mlittle-endian
21206 @opindex mlittle-endian
21207 Generate code for a little-endian target.
21210 @opindex mxl-reorder
21211 Use reorder instructions (swap and byte reversed load/store).
21213 @item -mxl-mode-@var{app-model}
21214 Select application model @var{app-model}. Valid models are
21217 normal executable (default), uses startup code @file{crt0.o}.
21219 @item -mpic-data-is-text-relative
21220 @opindex mpic-data-is-text-relative
21221 Assume that the displacement between the text and data segments is fixed
21222 at static link time. This allows data to be referenced by offset from start of
21223 text address instead of GOT since PC-relative addressing is not supported.
21226 for use with Xilinx Microprocessor Debugger (XMD) based
21227 software intrusive debug agent called xmdstub. This uses startup file
21228 @file{crt1.o} and sets the start address of the program to 0x800.
21231 for applications that are loaded using a bootloader.
21232 This model uses startup file @file{crt2.o} which does not contain a processor
21233 reset vector handler. This is suitable for transferring control on a
21234 processor reset to the bootloader rather than the application.
21237 for applications that do not require any of the
21238 MicroBlaze vectors. This option may be useful for applications running
21239 within a monitoring application. This model uses @file{crt3.o} as a startup file.
21242 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
21243 @option{-mxl-mode-@var{app-model}}.
21248 @subsection MIPS Options
21249 @cindex MIPS options
21255 Generate big-endian code.
21259 Generate little-endian code. This is the default for @samp{mips*el-*-*}
21262 @item -march=@var{arch}
21264 Generate code that runs on @var{arch}, which can be the name of a
21265 generic MIPS ISA, or the name of a particular processor.
21267 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
21268 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
21269 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
21270 @samp{mips64r5} and @samp{mips64r6}.
21271 The processor names are:
21272 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
21273 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
21274 @samp{5kc}, @samp{5kf},
21276 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
21277 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
21278 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
21279 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
21280 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
21281 @samp{i6400}, @samp{i6500},
21283 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
21284 @samp{gs464e}, @samp{gs264e},
21286 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
21287 @samp{m5100}, @samp{m5101},
21288 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
21290 @samp{p5600}, @samp{p6600},
21291 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
21292 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
21293 @samp{rm7000}, @samp{rm9000},
21294 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
21297 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
21298 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
21299 @samp{xlr} and @samp{xlp}.
21300 The special value @samp{from-abi} selects the
21301 most compatible architecture for the selected ABI (that is,
21302 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
21304 The native Linux/GNU toolchain also supports the value @samp{native},
21305 which selects the best architecture option for the host processor.
21306 @option{-march=native} has no effect if GCC does not recognize
21309 In processor names, a final @samp{000} can be abbreviated as @samp{k}
21310 (for example, @option{-march=r2k}). Prefixes are optional, and
21311 @samp{vr} may be written @samp{r}.
21313 Names of the form @samp{@var{n}f2_1} refer to processors with
21314 FPUs clocked at half the rate of the core, names of the form
21315 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
21316 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
21317 processors with FPUs clocked a ratio of 3:2 with respect to the core.
21318 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
21319 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
21320 accepted as synonyms for @samp{@var{n}f1_1}.
21322 GCC defines two macros based on the value of this option. The first
21323 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
21324 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
21325 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
21326 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
21327 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
21329 Note that the @code{_MIPS_ARCH} macro uses the processor names given
21330 above. In other words, it has the full prefix and does not
21331 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
21332 the macro names the resolved architecture (either @code{"mips1"} or
21333 @code{"mips3"}). It names the default architecture when no
21334 @option{-march} option is given.
21336 @item -mtune=@var{arch}
21338 Optimize for @var{arch}. Among other things, this option controls
21339 the way instructions are scheduled, and the perceived cost of arithmetic
21340 operations. The list of @var{arch} values is the same as for
21343 When this option is not used, GCC optimizes for the processor
21344 specified by @option{-march}. By using @option{-march} and
21345 @option{-mtune} together, it is possible to generate code that
21346 runs on a family of processors, but optimize the code for one
21347 particular member of that family.
21349 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
21350 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
21351 @option{-march} ones described above.
21355 Equivalent to @option{-march=mips1}.
21359 Equivalent to @option{-march=mips2}.
21363 Equivalent to @option{-march=mips3}.
21367 Equivalent to @option{-march=mips4}.
21371 Equivalent to @option{-march=mips32}.
21375 Equivalent to @option{-march=mips32r3}.
21379 Equivalent to @option{-march=mips32r5}.
21383 Equivalent to @option{-march=mips32r6}.
21387 Equivalent to @option{-march=mips64}.
21391 Equivalent to @option{-march=mips64r2}.
21395 Equivalent to @option{-march=mips64r3}.
21399 Equivalent to @option{-march=mips64r5}.
21403 Equivalent to @option{-march=mips64r6}.
21408 @opindex mno-mips16
21409 Generate (do not generate) MIPS16 code. If GCC is targeting a
21410 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
21412 MIPS16 code generation can also be controlled on a per-function basis
21413 by means of @code{mips16} and @code{nomips16} attributes.
21414 @xref{Function Attributes}, for more information.
21416 @item -mflip-mips16
21417 @opindex mflip-mips16
21418 Generate MIPS16 code on alternating functions. This option is provided
21419 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
21420 not intended for ordinary use in compiling user code.
21422 @item -minterlink-compressed
21423 @itemx -mno-interlink-compressed
21424 @opindex minterlink-compressed
21425 @opindex mno-interlink-compressed
21426 Require (do not require) that code using the standard (uncompressed) MIPS ISA
21427 be link-compatible with MIPS16 and microMIPS code, and vice versa.
21429 For example, code using the standard ISA encoding cannot jump directly
21430 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
21431 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
21432 knows that the target of the jump is not compressed.
21434 @item -minterlink-mips16
21435 @itemx -mno-interlink-mips16
21436 @opindex minterlink-mips16
21437 @opindex mno-interlink-mips16
21438 Aliases of @option{-minterlink-compressed} and
21439 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
21440 and are retained for backwards compatibility.
21452 Generate code for the given ABI@.
21454 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
21455 generates 64-bit code when you select a 64-bit architecture, but you
21456 can use @option{-mgp32} to get 32-bit code instead.
21458 For information about the O64 ABI, see
21459 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
21461 GCC supports a variant of the o32 ABI in which floating-point registers
21462 are 64 rather than 32 bits wide. You can select this combination with
21463 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
21464 and @code{mfhc1} instructions and is therefore only supported for
21465 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
21467 The register assignments for arguments and return values remain the
21468 same, but each scalar value is passed in a single 64-bit register
21469 rather than a pair of 32-bit registers. For example, scalar
21470 floating-point values are returned in @samp{$f0} only, not a
21471 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
21472 remains the same in that the even-numbered double-precision registers
21475 Two additional variants of the o32 ABI are supported to enable
21476 a transition from 32-bit to 64-bit registers. These are FPXX
21477 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
21478 The FPXX extension mandates that all code must execute correctly
21479 when run using 32-bit or 64-bit registers. The code can be interlinked
21480 with either FP32 or FP64, but not both.
21481 The FP64A extension is similar to the FP64 extension but forbids the
21482 use of odd-numbered single-precision registers. This can be used
21483 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
21484 processors and allows both FP32 and FP64A code to interlink and
21485 run in the same process without changing FPU modes.
21488 @itemx -mno-abicalls
21490 @opindex mno-abicalls
21491 Generate (do not generate) code that is suitable for SVR4-style
21492 dynamic objects. @option{-mabicalls} is the default for SVR4-based
21497 Generate (do not generate) code that is fully position-independent,
21498 and that can therefore be linked into shared libraries. This option
21499 only affects @option{-mabicalls}.
21501 All @option{-mabicalls} code has traditionally been position-independent,
21502 regardless of options like @option{-fPIC} and @option{-fpic}. However,
21503 as an extension, the GNU toolchain allows executables to use absolute
21504 accesses for locally-binding symbols. It can also use shorter GP
21505 initialization sequences and generate direct calls to locally-defined
21506 functions. This mode is selected by @option{-mno-shared}.
21508 @option{-mno-shared} depends on binutils 2.16 or higher and generates
21509 objects that can only be linked by the GNU linker. However, the option
21510 does not affect the ABI of the final executable; it only affects the ABI
21511 of relocatable objects. Using @option{-mno-shared} generally makes
21512 executables both smaller and quicker.
21514 @option{-mshared} is the default.
21520 Assume (do not assume) that the static and dynamic linkers
21521 support PLTs and copy relocations. This option only affects
21522 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
21523 has no effect without @option{-msym32}.
21525 You can make @option{-mplt} the default by configuring
21526 GCC with @option{--with-mips-plt}. The default is
21527 @option{-mno-plt} otherwise.
21533 Lift (do not lift) the usual restrictions on the size of the global
21536 GCC normally uses a single instruction to load values from the GOT@.
21537 While this is relatively efficient, it only works if the GOT
21538 is smaller than about 64k. Anything larger causes the linker
21539 to report an error such as:
21541 @cindex relocation truncated to fit (MIPS)
21543 relocation truncated to fit: R_MIPS_GOT16 foobar
21546 If this happens, you should recompile your code with @option{-mxgot}.
21547 This works with very large GOTs, although the code is also
21548 less efficient, since it takes three instructions to fetch the
21549 value of a global symbol.
21551 Note that some linkers can create multiple GOTs. If you have such a
21552 linker, you should only need to use @option{-mxgot} when a single object
21553 file accesses more than 64k's worth of GOT entries. Very few do.
21555 These options have no effect unless GCC is generating position
21560 Assume that general-purpose registers are 32 bits wide.
21564 Assume that general-purpose registers are 64 bits wide.
21568 Assume that floating-point registers are 32 bits wide.
21572 Assume that floating-point registers are 64 bits wide.
21576 Do not assume the width of floating-point registers.
21579 @opindex mhard-float
21580 Use floating-point coprocessor instructions.
21583 @opindex msoft-float
21584 Do not use floating-point coprocessor instructions. Implement
21585 floating-point calculations using library calls instead.
21589 Equivalent to @option{-msoft-float}, but additionally asserts that the
21590 program being compiled does not perform any floating-point operations.
21591 This option is presently supported only by some bare-metal MIPS
21592 configurations, where it may select a special set of libraries
21593 that lack all floating-point support (including, for example, the
21594 floating-point @code{printf} formats).
21595 If code compiled with @option{-mno-float} accidentally contains
21596 floating-point operations, it is likely to suffer a link-time
21597 or run-time failure.
21599 @item -msingle-float
21600 @opindex msingle-float
21601 Assume that the floating-point coprocessor only supports single-precision
21604 @item -mdouble-float
21605 @opindex mdouble-float
21606 Assume that the floating-point coprocessor supports double-precision
21607 operations. This is the default.
21610 @itemx -mno-odd-spreg
21611 @opindex modd-spreg
21612 @opindex mno-odd-spreg
21613 Enable the use of odd-numbered single-precision floating-point registers
21614 for the o32 ABI. This is the default for processors that are known to
21615 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
21619 @itemx -mabs=legacy
21621 @opindex mabs=legacy
21622 These options control the treatment of the special not-a-number (NaN)
21623 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
21624 @code{neg.@i{fmt}} machine instructions.
21626 By default or when @option{-mabs=legacy} is used the legacy
21627 treatment is selected. In this case these instructions are considered
21628 arithmetic and avoided where correct operation is required and the
21629 input operand might be a NaN. A longer sequence of instructions that
21630 manipulate the sign bit of floating-point datum manually is used
21631 instead unless the @option{-ffinite-math-only} option has also been
21634 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
21635 this case these instructions are considered non-arithmetic and therefore
21636 operating correctly in all cases, including in particular where the
21637 input operand is a NaN. These instructions are therefore always used
21638 for the respective operations.
21641 @itemx -mnan=legacy
21643 @opindex mnan=legacy
21644 These options control the encoding of the special not-a-number (NaN)
21645 IEEE 754 floating-point data.
21647 The @option{-mnan=legacy} option selects the legacy encoding. In this
21648 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
21649 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
21650 by the first bit of their trailing significand field being 1.
21652 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
21653 this case qNaNs are denoted by the first bit of their trailing
21654 significand field being 1, whereas sNaNs are denoted by the first bit of
21655 their trailing significand field being 0.
21657 The default is @option{-mnan=legacy} unless GCC has been configured with
21658 @option{--with-nan=2008}.
21664 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
21665 implement atomic memory built-in functions. When neither option is
21666 specified, GCC uses the instructions if the target architecture
21669 @option{-mllsc} is useful if the runtime environment can emulate the
21670 instructions and @option{-mno-llsc} can be useful when compiling for
21671 nonstandard ISAs. You can make either option the default by
21672 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
21673 respectively. @option{--with-llsc} is the default for some
21674 configurations; see the installation documentation for details.
21680 Use (do not use) revision 1 of the MIPS DSP ASE@.
21681 @xref{MIPS DSP Built-in Functions}. This option defines the
21682 preprocessor macro @code{__mips_dsp}. It also defines
21683 @code{__mips_dsp_rev} to 1.
21689 Use (do not use) revision 2 of the MIPS DSP ASE@.
21690 @xref{MIPS DSP Built-in Functions}. This option defines the
21691 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
21692 It also defines @code{__mips_dsp_rev} to 2.
21695 @itemx -mno-smartmips
21696 @opindex msmartmips
21697 @opindex mno-smartmips
21698 Use (do not use) the MIPS SmartMIPS ASE.
21700 @item -mpaired-single
21701 @itemx -mno-paired-single
21702 @opindex mpaired-single
21703 @opindex mno-paired-single
21704 Use (do not use) paired-single floating-point instructions.
21705 @xref{MIPS Paired-Single Support}. This option requires
21706 hardware floating-point support to be enabled.
21712 Use (do not use) MIPS Digital Media Extension instructions.
21713 This option can only be used when generating 64-bit code and requires
21714 hardware floating-point support to be enabled.
21719 @opindex mno-mips3d
21720 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
21721 The option @option{-mips3d} implies @option{-mpaired-single}.
21724 @itemx -mno-micromips
21725 @opindex mmicromips
21726 @opindex mno-mmicromips
21727 Generate (do not generate) microMIPS code.
21729 MicroMIPS code generation can also be controlled on a per-function basis
21730 by means of @code{micromips} and @code{nomicromips} attributes.
21731 @xref{Function Attributes}, for more information.
21737 Use (do not use) MT Multithreading instructions.
21743 Use (do not use) the MIPS MCU ASE instructions.
21749 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
21755 Use (do not use) the MIPS Virtualization (VZ) instructions.
21761 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
21767 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
21773 Use (do not use) the MIPS Global INValidate (GINV) instructions.
21775 @item -mloongson-mmi
21776 @itemx -mno-loongson-mmi
21777 @opindex mloongson-mmi
21778 @opindex mno-loongson-mmi
21779 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
21781 @item -mloongson-ext
21782 @itemx -mno-loongson-ext
21783 @opindex mloongson-ext
21784 @opindex mno-loongson-ext
21785 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
21787 @item -mloongson-ext2
21788 @itemx -mno-loongson-ext2
21789 @opindex mloongson-ext2
21790 @opindex mno-loongson-ext2
21791 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
21795 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
21796 an explanation of the default and the way that the pointer size is
21801 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
21803 The default size of @code{int}s, @code{long}s and pointers depends on
21804 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
21805 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
21806 32-bit @code{long}s. Pointers are the same size as @code{long}s,
21807 or the same size as integer registers, whichever is smaller.
21813 Assume (do not assume) that all symbols have 32-bit values, regardless
21814 of the selected ABI@. This option is useful in combination with
21815 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
21816 to generate shorter and faster references to symbolic addresses.
21820 Put definitions of externally-visible data in a small data section
21821 if that data is no bigger than @var{num} bytes. GCC can then generate
21822 more efficient accesses to the data; see @option{-mgpopt} for details.
21824 The default @option{-G} option depends on the configuration.
21826 @item -mlocal-sdata
21827 @itemx -mno-local-sdata
21828 @opindex mlocal-sdata
21829 @opindex mno-local-sdata
21830 Extend (do not extend) the @option{-G} behavior to local data too,
21831 such as to static variables in C@. @option{-mlocal-sdata} is the
21832 default for all configurations.
21834 If the linker complains that an application is using too much small data,
21835 you might want to try rebuilding the less performance-critical parts with
21836 @option{-mno-local-sdata}. You might also want to build large
21837 libraries with @option{-mno-local-sdata}, so that the libraries leave
21838 more room for the main program.
21840 @item -mextern-sdata
21841 @itemx -mno-extern-sdata
21842 @opindex mextern-sdata
21843 @opindex mno-extern-sdata
21844 Assume (do not assume) that externally-defined data is in
21845 a small data section if the size of that data is within the @option{-G} limit.
21846 @option{-mextern-sdata} is the default for all configurations.
21848 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
21849 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
21850 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
21851 is placed in a small data section. If @var{Var} is defined by another
21852 module, you must either compile that module with a high-enough
21853 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
21854 definition. If @var{Var} is common, you must link the application
21855 with a high-enough @option{-G} setting.
21857 The easiest way of satisfying these restrictions is to compile
21858 and link every module with the same @option{-G} option. However,
21859 you may wish to build a library that supports several different
21860 small data limits. You can do this by compiling the library with
21861 the highest supported @option{-G} setting and additionally using
21862 @option{-mno-extern-sdata} to stop the library from making assumptions
21863 about externally-defined data.
21869 Use (do not use) GP-relative accesses for symbols that are known to be
21870 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
21871 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
21874 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
21875 might not hold the value of @code{_gp}. For example, if the code is
21876 part of a library that might be used in a boot monitor, programs that
21877 call boot monitor routines pass an unknown value in @code{$gp}.
21878 (In such situations, the boot monitor itself is usually compiled
21879 with @option{-G0}.)
21881 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
21882 @option{-mno-extern-sdata}.
21884 @item -membedded-data
21885 @itemx -mno-embedded-data
21886 @opindex membedded-data
21887 @opindex mno-embedded-data
21888 Allocate variables to the read-only data section first if possible, then
21889 next in the small data section if possible, otherwise in data. This gives
21890 slightly slower code than the default, but reduces the amount of RAM required
21891 when executing, and thus may be preferred for some embedded systems.
21893 @item -muninit-const-in-rodata
21894 @itemx -mno-uninit-const-in-rodata
21895 @opindex muninit-const-in-rodata
21896 @opindex mno-uninit-const-in-rodata
21897 Put uninitialized @code{const} variables in the read-only data section.
21898 This option is only meaningful in conjunction with @option{-membedded-data}.
21900 @item -mcode-readable=@var{setting}
21901 @opindex mcode-readable
21902 Specify whether GCC may generate code that reads from executable sections.
21903 There are three possible settings:
21906 @item -mcode-readable=yes
21907 Instructions may freely access executable sections. This is the
21910 @item -mcode-readable=pcrel
21911 MIPS16 PC-relative load instructions can access executable sections,
21912 but other instructions must not do so. This option is useful on 4KSc
21913 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
21914 It is also useful on processors that can be configured to have a dual
21915 instruction/data SRAM interface and that, like the M4K, automatically
21916 redirect PC-relative loads to the instruction RAM.
21918 @item -mcode-readable=no
21919 Instructions must not access executable sections. This option can be
21920 useful on targets that are configured to have a dual instruction/data
21921 SRAM interface but that (unlike the M4K) do not automatically redirect
21922 PC-relative loads to the instruction RAM.
21925 @item -msplit-addresses
21926 @itemx -mno-split-addresses
21927 @opindex msplit-addresses
21928 @opindex mno-split-addresses
21929 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
21930 relocation operators. This option has been superseded by
21931 @option{-mexplicit-relocs} but is retained for backwards compatibility.
21933 @item -mexplicit-relocs
21934 @itemx -mno-explicit-relocs
21935 @opindex mexplicit-relocs
21936 @opindex mno-explicit-relocs
21937 Use (do not use) assembler relocation operators when dealing with symbolic
21938 addresses. The alternative, selected by @option{-mno-explicit-relocs},
21939 is to use assembler macros instead.
21941 @option{-mexplicit-relocs} is the default if GCC was configured
21942 to use an assembler that supports relocation operators.
21944 @item -mcheck-zero-division
21945 @itemx -mno-check-zero-division
21946 @opindex mcheck-zero-division
21947 @opindex mno-check-zero-division
21948 Trap (do not trap) on integer division by zero.
21950 The default is @option{-mcheck-zero-division}.
21952 @item -mdivide-traps
21953 @itemx -mdivide-breaks
21954 @opindex mdivide-traps
21955 @opindex mdivide-breaks
21956 MIPS systems check for division by zero by generating either a
21957 conditional trap or a break instruction. Using traps results in
21958 smaller code, but is only supported on MIPS II and later. Also, some
21959 versions of the Linux kernel have a bug that prevents trap from
21960 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
21961 allow conditional traps on architectures that support them and
21962 @option{-mdivide-breaks} to force the use of breaks.
21964 The default is usually @option{-mdivide-traps}, but this can be
21965 overridden at configure time using @option{--with-divide=breaks}.
21966 Divide-by-zero checks can be completely disabled using
21967 @option{-mno-check-zero-division}.
21969 @item -mload-store-pairs
21970 @itemx -mno-load-store-pairs
21971 @opindex mload-store-pairs
21972 @opindex mno-load-store-pairs
21973 Enable (disable) an optimization that pairs consecutive load or store
21974 instructions to enable load/store bonding. This option is enabled by
21975 default but only takes effect when the selected architecture is known
21976 to support bonding.
21981 @opindex mno-memcpy
21982 Force (do not force) the use of @code{memcpy} for non-trivial block
21983 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
21984 most constant-sized copies.
21987 @itemx -mno-long-calls
21988 @opindex mlong-calls
21989 @opindex mno-long-calls
21990 Disable (do not disable) use of the @code{jal} instruction. Calling
21991 functions using @code{jal} is more efficient but requires the caller
21992 and callee to be in the same 256 megabyte segment.
21994 This option has no effect on abicalls code. The default is
21995 @option{-mno-long-calls}.
22001 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
22002 instructions, as provided by the R4650 ISA@.
22008 Enable (disable) use of the @code{madd} and @code{msub} integer
22009 instructions. The default is @option{-mimadd} on architectures
22010 that support @code{madd} and @code{msub} except for the 74k
22011 architecture where it was found to generate slower code.
22014 @itemx -mno-fused-madd
22015 @opindex mfused-madd
22016 @opindex mno-fused-madd
22017 Enable (disable) use of the floating-point multiply-accumulate
22018 instructions, when they are available. The default is
22019 @option{-mfused-madd}.
22021 On the R8000 CPU when multiply-accumulate instructions are used,
22022 the intermediate product is calculated to infinite precision
22023 and is not subject to the FCSR Flush to Zero bit. This may be
22024 undesirable in some circumstances. On other processors the result
22025 is numerically identical to the equivalent computation using
22026 separate multiply, add, subtract and negate instructions.
22030 Tell the MIPS assembler to not run its preprocessor over user
22031 assembler files (with a @samp{.s} suffix) when assembling them.
22034 @itemx -mno-fix-24k
22036 @opindex mno-fix-24k
22037 Work around the 24K E48 (lost data on stores during refill) errata.
22038 The workarounds are implemented by the assembler rather than by GCC@.
22041 @itemx -mno-fix-r4000
22042 @opindex mfix-r4000
22043 @opindex mno-fix-r4000
22044 Work around certain R4000 CPU errata:
22047 A double-word or a variable shift may give an incorrect result if executed
22048 immediately after starting an integer division.
22050 A double-word or a variable shift may give an incorrect result if executed
22051 while an integer multiplication is in progress.
22053 An integer division may give an incorrect result if started in a delay slot
22054 of a taken branch or a jump.
22058 @itemx -mno-fix-r4400
22059 @opindex mfix-r4400
22060 @opindex mno-fix-r4400
22061 Work around certain R4400 CPU errata:
22064 A double-word or a variable shift may give an incorrect result if executed
22065 immediately after starting an integer division.
22069 @itemx -mno-fix-r10000
22070 @opindex mfix-r10000
22071 @opindex mno-fix-r10000
22072 Work around certain R10000 errata:
22075 @code{ll}/@code{sc} sequences may not behave atomically on revisions
22076 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22079 This option can only be used if the target architecture supports
22080 branch-likely instructions. @option{-mfix-r10000} is the default when
22081 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
22085 @itemx -mno-fix-rm7000
22086 @opindex mfix-rm7000
22087 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
22088 workarounds are implemented by the assembler rather than by GCC@.
22091 @itemx -mno-fix-vr4120
22092 @opindex mfix-vr4120
22093 Work around certain VR4120 errata:
22096 @code{dmultu} does not always produce the correct result.
22098 @code{div} and @code{ddiv} do not always produce the correct result if one
22099 of the operands is negative.
22101 The workarounds for the division errata rely on special functions in
22102 @file{libgcc.a}. At present, these functions are only provided by
22103 the @code{mips64vr*-elf} configurations.
22105 Other VR4120 errata require a NOP to be inserted between certain pairs of
22106 instructions. These errata are handled by the assembler, not by GCC itself.
22109 @opindex mfix-vr4130
22110 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
22111 workarounds are implemented by the assembler rather than by GCC,
22112 although GCC avoids using @code{mflo} and @code{mfhi} if the
22113 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
22114 instructions are available instead.
22117 @itemx -mno-fix-sb1
22119 Work around certain SB-1 CPU core errata.
22120 (This flag currently works around the SB-1 revision 2
22121 ``F1'' and ``F2'' floating-point errata.)
22123 @item -mr10k-cache-barrier=@var{setting}
22124 @opindex mr10k-cache-barrier
22125 Specify whether GCC should insert cache barriers to avoid the
22126 side effects of speculation on R10K processors.
22128 In common with many processors, the R10K tries to predict the outcome
22129 of a conditional branch and speculatively executes instructions from
22130 the ``taken'' branch. It later aborts these instructions if the
22131 predicted outcome is wrong. However, on the R10K, even aborted
22132 instructions can have side effects.
22134 This problem only affects kernel stores and, depending on the system,
22135 kernel loads. As an example, a speculatively-executed store may load
22136 the target memory into cache and mark the cache line as dirty, even if
22137 the store itself is later aborted. If a DMA operation writes to the
22138 same area of memory before the ``dirty'' line is flushed, the cached
22139 data overwrites the DMA-ed data. See the R10K processor manual
22140 for a full description, including other potential problems.
22142 One workaround is to insert cache barrier instructions before every memory
22143 access that might be speculatively executed and that might have side
22144 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
22145 controls GCC's implementation of this workaround. It assumes that
22146 aborted accesses to any byte in the following regions does not have
22151 the memory occupied by the current function's stack frame;
22154 the memory occupied by an incoming stack argument;
22157 the memory occupied by an object with a link-time-constant address.
22160 It is the kernel's responsibility to ensure that speculative
22161 accesses to these regions are indeed safe.
22163 If the input program contains a function declaration such as:
22169 then the implementation of @code{foo} must allow @code{j foo} and
22170 @code{jal foo} to be executed speculatively. GCC honors this
22171 restriction for functions it compiles itself. It expects non-GCC
22172 functions (such as hand-written assembly code) to do the same.
22174 The option has three forms:
22177 @item -mr10k-cache-barrier=load-store
22178 Insert a cache barrier before a load or store that might be
22179 speculatively executed and that might have side effects even
22182 @item -mr10k-cache-barrier=store
22183 Insert a cache barrier before a store that might be speculatively
22184 executed and that might have side effects even if aborted.
22186 @item -mr10k-cache-barrier=none
22187 Disable the insertion of cache barriers. This is the default setting.
22190 @item -mflush-func=@var{func}
22191 @itemx -mno-flush-func
22192 @opindex mflush-func
22193 Specifies the function to call to flush the I and D caches, or to not
22194 call any such function. If called, the function must take the same
22195 arguments as the common @code{_flush_func}, that is, the address of the
22196 memory range for which the cache is being flushed, the size of the
22197 memory range, and the number 3 (to flush both caches). The default
22198 depends on the target GCC was configured for, but commonly is either
22199 @code{_flush_func} or @code{__cpu_flush}.
22201 @item mbranch-cost=@var{num}
22202 @opindex mbranch-cost
22203 Set the cost of branches to roughly @var{num} ``simple'' instructions.
22204 This cost is only a heuristic and is not guaranteed to produce
22205 consistent results across releases. A zero cost redundantly selects
22206 the default, which is based on the @option{-mtune} setting.
22208 @item -mbranch-likely
22209 @itemx -mno-branch-likely
22210 @opindex mbranch-likely
22211 @opindex mno-branch-likely
22212 Enable or disable use of Branch Likely instructions, regardless of the
22213 default for the selected architecture. By default, Branch Likely
22214 instructions may be generated if they are supported by the selected
22215 architecture. An exception is for the MIPS32 and MIPS64 architectures
22216 and processors that implement those architectures; for those, Branch
22217 Likely instructions are not be generated by default because the MIPS32
22218 and MIPS64 architectures specifically deprecate their use.
22220 @item -mcompact-branches=never
22221 @itemx -mcompact-branches=optimal
22222 @itemx -mcompact-branches=always
22223 @opindex mcompact-branches=never
22224 @opindex mcompact-branches=optimal
22225 @opindex mcompact-branches=always
22226 These options control which form of branches will be generated. The
22227 default is @option{-mcompact-branches=optimal}.
22229 The @option{-mcompact-branches=never} option ensures that compact branch
22230 instructions will never be generated.
22232 The @option{-mcompact-branches=always} option ensures that a compact
22233 branch instruction will be generated if available. If a compact branch
22234 instruction is not available, a delay slot form of the branch will be
22237 This option is supported from MIPS Release 6 onwards.
22239 The @option{-mcompact-branches=optimal} option will cause a delay slot
22240 branch to be used if one is available in the current ISA and the delay
22241 slot is successfully filled. If the delay slot is not filled, a compact
22242 branch will be chosen if one is available.
22244 @item -mfp-exceptions
22245 @itemx -mno-fp-exceptions
22246 @opindex mfp-exceptions
22247 Specifies whether FP exceptions are enabled. This affects how
22248 FP instructions are scheduled for some processors.
22249 The default is that FP exceptions are
22252 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
22253 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
22256 @item -mvr4130-align
22257 @itemx -mno-vr4130-align
22258 @opindex mvr4130-align
22259 The VR4130 pipeline is two-way superscalar, but can only issue two
22260 instructions together if the first one is 8-byte aligned. When this
22261 option is enabled, GCC aligns pairs of instructions that it
22262 thinks should execute in parallel.
22264 This option only has an effect when optimizing for the VR4130.
22265 It normally makes code faster, but at the expense of making it bigger.
22266 It is enabled by default at optimization level @option{-O3}.
22271 Enable (disable) generation of @code{synci} instructions on
22272 architectures that support it. The @code{synci} instructions (if
22273 enabled) are generated when @code{__builtin___clear_cache} is
22276 This option defaults to @option{-mno-synci}, but the default can be
22277 overridden by configuring GCC with @option{--with-synci}.
22279 When compiling code for single processor systems, it is generally safe
22280 to use @code{synci}. However, on many multi-core (SMP) systems, it
22281 does not invalidate the instruction caches on all cores and may lead
22282 to undefined behavior.
22284 @item -mrelax-pic-calls
22285 @itemx -mno-relax-pic-calls
22286 @opindex mrelax-pic-calls
22287 Try to turn PIC calls that are normally dispatched via register
22288 @code{$25} into direct calls. This is only possible if the linker can
22289 resolve the destination at link time and if the destination is within
22290 range for a direct call.
22292 @option{-mrelax-pic-calls} is the default if GCC was configured to use
22293 an assembler and a linker that support the @code{.reloc} assembly
22294 directive and @option{-mexplicit-relocs} is in effect. With
22295 @option{-mno-explicit-relocs}, this optimization can be performed by the
22296 assembler and the linker alone without help from the compiler.
22298 @item -mmcount-ra-address
22299 @itemx -mno-mcount-ra-address
22300 @opindex mmcount-ra-address
22301 @opindex mno-mcount-ra-address
22302 Emit (do not emit) code that allows @code{_mcount} to modify the
22303 calling function's return address. When enabled, this option extends
22304 the usual @code{_mcount} interface with a new @var{ra-address}
22305 parameter, which has type @code{intptr_t *} and is passed in register
22306 @code{$12}. @code{_mcount} can then modify the return address by
22307 doing both of the following:
22310 Returning the new address in register @code{$31}.
22312 Storing the new address in @code{*@var{ra-address}},
22313 if @var{ra-address} is nonnull.
22316 The default is @option{-mno-mcount-ra-address}.
22318 @item -mframe-header-opt
22319 @itemx -mno-frame-header-opt
22320 @opindex mframe-header-opt
22321 Enable (disable) frame header optimization in the o32 ABI. When using the
22322 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
22323 function to write out register arguments. When enabled, this optimization
22324 will suppress the allocation of the frame header if it can be determined that
22327 This optimization is off by default at all optimization levels.
22330 @itemx -mno-lxc1-sxc1
22331 @opindex mlxc1-sxc1
22332 When applicable, enable (disable) the generation of @code{lwxc1},
22333 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
22338 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
22339 @code{madd.d} and related instructions. Enabled by default.
22344 @subsection MMIX Options
22345 @cindex MMIX Options
22347 These options are defined for the MMIX:
22351 @itemx -mno-libfuncs
22353 @opindex mno-libfuncs
22354 Specify that intrinsic library functions are being compiled, passing all
22355 values in registers, no matter the size.
22358 @itemx -mno-epsilon
22360 @opindex mno-epsilon
22361 Generate floating-point comparison instructions that compare with respect
22362 to the @code{rE} epsilon register.
22364 @item -mabi=mmixware
22366 @opindex mabi=mmixware
22368 Generate code that passes function parameters and return values that (in
22369 the called function) are seen as registers @code{$0} and up, as opposed to
22370 the GNU ABI which uses global registers @code{$231} and up.
22372 @item -mzero-extend
22373 @itemx -mno-zero-extend
22374 @opindex mzero-extend
22375 @opindex mno-zero-extend
22376 When reading data from memory in sizes shorter than 64 bits, use (do not
22377 use) zero-extending load instructions by default, rather than
22378 sign-extending ones.
22381 @itemx -mno-knuthdiv
22383 @opindex mno-knuthdiv
22384 Make the result of a division yielding a remainder have the same sign as
22385 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
22386 remainder follows the sign of the dividend. Both methods are
22387 arithmetically valid, the latter being almost exclusively used.
22389 @item -mtoplevel-symbols
22390 @itemx -mno-toplevel-symbols
22391 @opindex mtoplevel-symbols
22392 @opindex mno-toplevel-symbols
22393 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
22394 code can be used with the @code{PREFIX} assembly directive.
22398 Generate an executable in the ELF format, rather than the default
22399 @samp{mmo} format used by the @command{mmix} simulator.
22401 @item -mbranch-predict
22402 @itemx -mno-branch-predict
22403 @opindex mbranch-predict
22404 @opindex mno-branch-predict
22405 Use (do not use) the probable-branch instructions, when static branch
22406 prediction indicates a probable branch.
22408 @item -mbase-addresses
22409 @itemx -mno-base-addresses
22410 @opindex mbase-addresses
22411 @opindex mno-base-addresses
22412 Generate (do not generate) code that uses @emph{base addresses}. Using a
22413 base address automatically generates a request (handled by the assembler
22414 and the linker) for a constant to be set up in a global register. The
22415 register is used for one or more base address requests within the range 0
22416 to 255 from the value held in the register. The generally leads to short
22417 and fast code, but the number of different data items that can be
22418 addressed is limited. This means that a program that uses lots of static
22419 data may require @option{-mno-base-addresses}.
22421 @item -msingle-exit
22422 @itemx -mno-single-exit
22423 @opindex msingle-exit
22424 @opindex mno-single-exit
22425 Force (do not force) generated code to have a single exit point in each
22429 @node MN10300 Options
22430 @subsection MN10300 Options
22431 @cindex MN10300 options
22433 These @option{-m} options are defined for Matsushita MN10300 architectures:
22438 Generate code to avoid bugs in the multiply instructions for the MN10300
22439 processors. This is the default.
22441 @item -mno-mult-bug
22442 @opindex mno-mult-bug
22443 Do not generate code to avoid bugs in the multiply instructions for the
22444 MN10300 processors.
22448 Generate code using features specific to the AM33 processor.
22452 Do not generate code using features specific to the AM33 processor. This
22457 Generate code using features specific to the AM33/2.0 processor.
22461 Generate code using features specific to the AM34 processor.
22463 @item -mtune=@var{cpu-type}
22465 Use the timing characteristics of the indicated CPU type when
22466 scheduling instructions. This does not change the targeted processor
22467 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
22468 @samp{am33-2} or @samp{am34}.
22470 @item -mreturn-pointer-on-d0
22471 @opindex mreturn-pointer-on-d0
22472 When generating a function that returns a pointer, return the pointer
22473 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
22474 only in @code{a0}, and attempts to call such functions without a prototype
22475 result in errors. Note that this option is on by default; use
22476 @option{-mno-return-pointer-on-d0} to disable it.
22480 Do not link in the C run-time initialization object file.
22484 Indicate to the linker that it should perform a relaxation optimization pass
22485 to shorten branches, calls and absolute memory addresses. This option only
22486 has an effect when used on the command line for the final link step.
22488 This option makes symbolic debugging impossible.
22492 Allow the compiler to generate @emph{Long Instruction Word}
22493 instructions if the target is the @samp{AM33} or later. This is the
22494 default. This option defines the preprocessor macro @code{__LIW__}.
22498 Do not allow the compiler to generate @emph{Long Instruction Word}
22499 instructions. This option defines the preprocessor macro
22504 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
22505 instructions if the target is the @samp{AM33} or later. This is the
22506 default. This option defines the preprocessor macro @code{__SETLB__}.
22510 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
22511 instructions. This option defines the preprocessor macro
22512 @code{__NO_SETLB__}.
22516 @node Moxie Options
22517 @subsection Moxie Options
22518 @cindex Moxie Options
22524 Generate big-endian code. This is the default for @samp{moxie-*-*}
22529 Generate little-endian code.
22533 Generate mul.x and umul.x instructions. This is the default for
22534 @samp{moxiebox-*-*} configurations.
22538 Do not link in the C run-time initialization object file.
22542 @node MSP430 Options
22543 @subsection MSP430 Options
22544 @cindex MSP430 Options
22546 These options are defined for the MSP430:
22552 Force assembly output to always use hex constants. Normally such
22553 constants are signed decimals, but this option is available for
22554 testsuite and/or aesthetic purposes.
22558 Select the MCU to target. This is used to create a C preprocessor
22559 symbol based upon the MCU name, converted to upper case and pre- and
22560 post-fixed with @samp{__}. This in turn is used by the
22561 @file{msp430.h} header file to select an MCU-specific supplementary
22564 The option also sets the ISA to use. If the MCU name is one that is
22565 known to only support the 430 ISA then that is selected, otherwise the
22566 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
22567 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
22568 name selects the 430X ISA.
22570 In addition an MCU-specific linker script is added to the linker
22571 command line. The script's name is the name of the MCU with
22572 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
22573 command line defines the C preprocessor symbol @code{__XXX__} and
22574 cause the linker to search for a script called @file{xxx.ld}.
22576 This option is also passed on to the assembler.
22579 @itemx -mno-warn-mcu
22581 @opindex mno-warn-mcu
22582 This option enables or disables warnings about conflicts between the
22583 MCU name specified by the @option{-mmcu} option and the ISA set by the
22584 @option{-mcpu} option and/or the hardware multiply support set by the
22585 @option{-mhwmult} option. It also toggles warnings about unrecognized
22586 MCU names. This option is on by default.
22590 Specifies the ISA to use. Accepted values are @samp{msp430},
22591 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
22592 @option{-mmcu=} option should be used to select the ISA.
22596 Link to the simulator runtime libraries and linker script. Overrides
22597 any scripts that would be selected by the @option{-mmcu=} option.
22601 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
22605 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
22609 This option is passed to the assembler and linker, and allows the
22610 linker to perform certain optimizations that cannot be done until
22615 Describes the type of hardware multiply supported by the target.
22616 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
22617 for the original 16-bit-only multiply supported by early MCUs.
22618 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
22619 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
22620 A value of @samp{auto} can also be given. This tells GCC to deduce
22621 the hardware multiply support based upon the MCU name provided by the
22622 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
22623 the MCU name is not recognized then no hardware multiply support is
22624 assumed. @code{auto} is the default setting.
22626 Hardware multiplies are normally performed by calling a library
22627 routine. This saves space in the generated code. When compiling at
22628 @option{-O3} or higher however the hardware multiplier is invoked
22629 inline. This makes for bigger, but faster code.
22631 The hardware multiply routines disable interrupts whilst running and
22632 restore the previous interrupt state when they finish. This makes
22633 them safe to use inside interrupt handlers as well as in normal code.
22637 Enable the use of a minimum runtime environment - no static
22638 initializers or constructors. This is intended for memory-constrained
22639 devices. The compiler includes special symbols in some objects
22640 that tell the linker and runtime which code fragments are required.
22642 @item -mcode-region=
22643 @itemx -mdata-region=
22644 @opindex mcode-region
22645 @opindex mdata-region
22646 These options tell the compiler where to place functions and data that
22647 do not have one of the @code{lower}, @code{upper}, @code{either} or
22648 @code{section} attributes. Possible values are @code{lower},
22649 @code{upper}, @code{either} or @code{any}. The first three behave
22650 like the corresponding attribute. The fourth possible value -
22651 @code{any} - is the default. It leaves placement entirely up to the
22652 linker script and how it assigns the standard sections
22653 (@code{.text}, @code{.data}, etc) to the memory regions.
22655 @item -msilicon-errata=
22656 @opindex msilicon-errata
22657 This option passes on a request to assembler to enable the fixes for
22658 the named silicon errata.
22660 @item -msilicon-errata-warn=
22661 @opindex msilicon-errata-warn
22662 This option passes on a request to the assembler to enable warning
22663 messages when a silicon errata might need to be applied.
22667 @node NDS32 Options
22668 @subsection NDS32 Options
22669 @cindex NDS32 Options
22671 These options are defined for NDS32 implementations:
22676 @opindex mbig-endian
22677 Generate code in big-endian mode.
22679 @item -mlittle-endian
22680 @opindex mlittle-endian
22681 Generate code in little-endian mode.
22683 @item -mreduced-regs
22684 @opindex mreduced-regs
22685 Use reduced-set registers for register allocation.
22688 @opindex mfull-regs
22689 Use full-set registers for register allocation.
22693 Generate conditional move instructions.
22697 Do not generate conditional move instructions.
22701 Generate performance extension instructions.
22703 @item -mno-ext-perf
22704 @opindex mno-ext-perf
22705 Do not generate performance extension instructions.
22708 @opindex mext-perf2
22709 Generate performance extension 2 instructions.
22711 @item -mno-ext-perf2
22712 @opindex mno-ext-perf2
22713 Do not generate performance extension 2 instructions.
22716 @opindex mext-string
22717 Generate string extension instructions.
22719 @item -mno-ext-string
22720 @opindex mno-ext-string
22721 Do not generate string extension instructions.
22725 Generate v3 push25/pop25 instructions.
22728 @opindex mno-v3push
22729 Do not generate v3 push25/pop25 instructions.
22733 Generate 16-bit instructions.
22736 @opindex mno-16-bit
22737 Do not generate 16-bit instructions.
22739 @item -misr-vector-size=@var{num}
22740 @opindex misr-vector-size
22741 Specify the size of each interrupt vector, which must be 4 or 16.
22743 @item -mcache-block-size=@var{num}
22744 @opindex mcache-block-size
22745 Specify the size of each cache block,
22746 which must be a power of 2 between 4 and 512.
22748 @item -march=@var{arch}
22750 Specify the name of the target architecture.
22752 @item -mcmodel=@var{code-model}
22754 Set the code model to one of
22757 All the data and read-only data segments must be within 512KB addressing space.
22758 The text segment must be within 16MB addressing space.
22759 @item @samp{medium}
22760 The data segment must be within 512KB while the read-only data segment can be
22761 within 4GB addressing space. The text segment should be still within 16MB
22764 All the text and data segments can be within 4GB addressing space.
22768 @opindex mctor-dtor
22769 Enable constructor/destructor feature.
22773 Guide linker to relax instructions.
22777 @node Nios II Options
22778 @subsection Nios II Options
22779 @cindex Nios II options
22780 @cindex Altera Nios II options
22782 These are the options defined for the Altera Nios II processor.
22788 @cindex smaller data references
22789 Put global and static objects less than or equal to @var{num} bytes
22790 into the small data or BSS sections instead of the normal data or BSS
22791 sections. The default value of @var{num} is 8.
22793 @item -mgpopt=@var{option}
22798 Generate (do not generate) GP-relative accesses. The following
22799 @var{option} names are recognized:
22804 Do not generate GP-relative accesses.
22807 Generate GP-relative accesses for small data objects that are not
22808 external, weak, or uninitialized common symbols.
22809 Also use GP-relative addressing for objects that
22810 have been explicitly placed in a small data section via a @code{section}
22814 As for @samp{local}, but also generate GP-relative accesses for
22815 small data objects that are external, weak, or common. If you use this option,
22816 you must ensure that all parts of your program (including libraries) are
22817 compiled with the same @option{-G} setting.
22820 Generate GP-relative accesses for all data objects in the program. If you
22821 use this option, the entire data and BSS segments
22822 of your program must fit in 64K of memory and you must use an appropriate
22823 linker script to allocate them within the addressable range of the
22827 Generate GP-relative addresses for function pointers as well as data
22828 pointers. If you use this option, the entire text, data, and BSS segments
22829 of your program must fit in 64K of memory and you must use an appropriate
22830 linker script to allocate them within the addressable range of the
22835 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
22836 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
22838 The default is @option{-mgpopt} except when @option{-fpic} or
22839 @option{-fPIC} is specified to generate position-independent code.
22840 Note that the Nios II ABI does not permit GP-relative accesses from
22843 You may need to specify @option{-mno-gpopt} explicitly when building
22844 programs that include large amounts of small data, including large
22845 GOT data sections. In this case, the 16-bit offset for GP-relative
22846 addressing may not be large enough to allow access to the entire
22847 small data section.
22849 @item -mgprel-sec=@var{regexp}
22850 @opindex mgprel-sec
22851 This option specifies additional section names that can be accessed via
22852 GP-relative addressing. It is most useful in conjunction with
22853 @code{section} attributes on variable declarations
22854 (@pxref{Common Variable Attributes}) and a custom linker script.
22855 The @var{regexp} is a POSIX Extended Regular Expression.
22857 This option does not affect the behavior of the @option{-G} option, and
22858 the specified sections are in addition to the standard @code{.sdata}
22859 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
22861 @item -mr0rel-sec=@var{regexp}
22862 @opindex mr0rel-sec
22863 This option specifies names of sections that can be accessed via a
22864 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
22865 of the 32-bit address space. It is most useful in conjunction with
22866 @code{section} attributes on variable declarations
22867 (@pxref{Common Variable Attributes}) and a custom linker script.
22868 The @var{regexp} is a POSIX Extended Regular Expression.
22870 In contrast to the use of GP-relative addressing for small data,
22871 zero-based addressing is never generated by default and there are no
22872 conventional section names used in standard linker scripts for sections
22873 in the low or high areas of memory.
22879 Generate little-endian (default) or big-endian (experimental) code,
22882 @item -march=@var{arch}
22884 This specifies the name of the target Nios II architecture. GCC uses this
22885 name to determine what kind of instructions it can emit when generating
22886 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
22888 The preprocessor macro @code{__nios2_arch__} is available to programs,
22889 with value 1 or 2, indicating the targeted ISA level.
22891 @item -mbypass-cache
22892 @itemx -mno-bypass-cache
22893 @opindex mno-bypass-cache
22894 @opindex mbypass-cache
22895 Force all load and store instructions to always bypass cache by
22896 using I/O variants of the instructions. The default is not to
22899 @item -mno-cache-volatile
22900 @itemx -mcache-volatile
22901 @opindex mcache-volatile
22902 @opindex mno-cache-volatile
22903 Volatile memory access bypass the cache using the I/O variants of
22904 the load and store instructions. The default is not to bypass the cache.
22906 @item -mno-fast-sw-div
22907 @itemx -mfast-sw-div
22908 @opindex mno-fast-sw-div
22909 @opindex mfast-sw-div
22910 Do not use table-based fast divide for small numbers. The default
22911 is to use the fast divide at @option{-O3} and above.
22915 @itemx -mno-hw-mulx
22919 @opindex mno-hw-mul
22921 @opindex mno-hw-mulx
22923 @opindex mno-hw-div
22925 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
22926 instructions by the compiler. The default is to emit @code{mul}
22927 and not emit @code{div} and @code{mulx}.
22933 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
22934 CDX (code density) instructions. Enabling these instructions also
22935 requires @option{-march=r2}. Since these instructions are optional
22936 extensions to the R2 architecture, the default is not to emit them.
22938 @item -mcustom-@var{insn}=@var{N}
22939 @itemx -mno-custom-@var{insn}
22940 @opindex mcustom-@var{insn}
22941 @opindex mno-custom-@var{insn}
22942 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
22943 custom instruction with encoding @var{N} when generating code that uses
22944 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
22945 instruction 253 for single-precision floating-point add operations instead
22946 of the default behavior of using a library call.
22948 The following values of @var{insn} are supported. Except as otherwise
22949 noted, floating-point operations are expected to be implemented with
22950 normal IEEE 754 semantics and correspond directly to the C operators or the
22951 equivalent GCC built-in functions (@pxref{Other Builtins}).
22953 Single-precision floating point:
22956 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
22957 Binary arithmetic operations.
22963 Unary absolute value.
22965 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
22966 Comparison operations.
22968 @item @samp{fmins}, @samp{fmaxs}
22969 Floating-point minimum and maximum. These instructions are only
22970 generated if @option{-ffinite-math-only} is specified.
22972 @item @samp{fsqrts}
22973 Unary square root operation.
22975 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
22976 Floating-point trigonometric and exponential functions. These instructions
22977 are only generated if @option{-funsafe-math-optimizations} is also specified.
22981 Double-precision floating point:
22984 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
22985 Binary arithmetic operations.
22991 Unary absolute value.
22993 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
22994 Comparison operations.
22996 @item @samp{fmind}, @samp{fmaxd}
22997 Double-precision minimum and maximum. These instructions are only
22998 generated if @option{-ffinite-math-only} is specified.
23000 @item @samp{fsqrtd}
23001 Unary square root operation.
23003 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
23004 Double-precision trigonometric and exponential functions. These instructions
23005 are only generated if @option{-funsafe-math-optimizations} is also specified.
23011 @item @samp{fextsd}
23012 Conversion from single precision to double precision.
23014 @item @samp{ftruncds}
23015 Conversion from double precision to single precision.
23017 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
23018 Conversion from floating point to signed or unsigned integer types, with
23019 truncation towards zero.
23022 Conversion from single-precision floating point to signed integer,
23023 rounding to the nearest integer and ties away from zero.
23024 This corresponds to the @code{__builtin_lroundf} function when
23025 @option{-fno-math-errno} is used.
23027 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
23028 Conversion from signed or unsigned integer types to floating-point types.
23032 In addition, all of the following transfer instructions for internal
23033 registers X and Y must be provided to use any of the double-precision
23034 floating-point instructions. Custom instructions taking two
23035 double-precision source operands expect the first operand in the
23036 64-bit register X. The other operand (or only operand of a unary
23037 operation) is given to the custom arithmetic instruction with the
23038 least significant half in source register @var{src1} and the most
23039 significant half in @var{src2}. A custom instruction that returns a
23040 double-precision result returns the most significant 32 bits in the
23041 destination register and the other half in 32-bit register Y.
23042 GCC automatically generates the necessary code sequences to write
23043 register X and/or read register Y when double-precision floating-point
23044 instructions are used.
23049 Write @var{src1} into the least significant half of X and @var{src2} into
23050 the most significant half of X.
23053 Write @var{src1} into Y.
23055 @item @samp{frdxhi}, @samp{frdxlo}
23056 Read the most or least (respectively) significant half of X and store it in
23060 Read the value of Y and store it into @var{dest}.
23063 Note that you can gain more local control over generation of Nios II custom
23064 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
23065 and @code{target("no-custom-@var{insn}")} function attributes
23066 (@pxref{Function Attributes})
23067 or pragmas (@pxref{Function Specific Option Pragmas}).
23069 @item -mcustom-fpu-cfg=@var{name}
23070 @opindex mcustom-fpu-cfg
23072 This option enables a predefined, named set of custom instruction encodings
23073 (see @option{-mcustom-@var{insn}} above).
23074 Currently, the following sets are defined:
23076 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
23077 @gccoptlist{-mcustom-fmuls=252 @gol
23078 -mcustom-fadds=253 @gol
23079 -mcustom-fsubs=254 @gol
23080 -fsingle-precision-constant}
23082 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
23083 @gccoptlist{-mcustom-fmuls=252 @gol
23084 -mcustom-fadds=253 @gol
23085 -mcustom-fsubs=254 @gol
23086 -mcustom-fdivs=255 @gol
23087 -fsingle-precision-constant}
23089 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
23090 @gccoptlist{-mcustom-floatus=243 @gol
23091 -mcustom-fixsi=244 @gol
23092 -mcustom-floatis=245 @gol
23093 -mcustom-fcmpgts=246 @gol
23094 -mcustom-fcmples=249 @gol
23095 -mcustom-fcmpeqs=250 @gol
23096 -mcustom-fcmpnes=251 @gol
23097 -mcustom-fmuls=252 @gol
23098 -mcustom-fadds=253 @gol
23099 -mcustom-fsubs=254 @gol
23100 -mcustom-fdivs=255 @gol
23101 -fsingle-precision-constant}
23103 Custom instruction assignments given by individual
23104 @option{-mcustom-@var{insn}=} options override those given by
23105 @option{-mcustom-fpu-cfg=}, regardless of the
23106 order of the options on the command line.
23108 Note that you can gain more local control over selection of a FPU
23109 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
23110 function attribute (@pxref{Function Attributes})
23111 or pragma (@pxref{Function Specific Option Pragmas}).
23115 These additional @samp{-m} options are available for the Altera Nios II
23116 ELF (bare-metal) target:
23122 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
23123 startup and termination code, and is typically used in conjunction with
23124 @option{-msys-crt0=} to specify the location of the alternate startup code
23125 provided by the HAL BSP.
23129 Link with a limited version of the C library, @option{-lsmallc}, rather than
23132 @item -msys-crt0=@var{startfile}
23134 @var{startfile} is the file name of the startfile (crt0) to use
23135 when linking. This option is only useful in conjunction with @option{-mhal}.
23137 @item -msys-lib=@var{systemlib}
23139 @var{systemlib} is the library name of the library that provides
23140 low-level system calls required by the C library,
23141 e.g.@: @code{read} and @code{write}.
23142 This option is typically used to link with a library provided by a HAL BSP.
23146 @node Nvidia PTX Options
23147 @subsection Nvidia PTX Options
23148 @cindex Nvidia PTX options
23149 @cindex nvptx options
23151 These options are defined for Nvidia PTX:
23159 Generate code for 32-bit or 64-bit ABI.
23161 @item -misa=@var{ISA-string}
23163 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
23164 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
23165 @samp{sm_35}. The default ISA is sm_30.
23168 @opindex mmainkernel
23169 Link in code for a __main kernel. This is for stand-alone instead of
23170 offloading execution.
23174 Apply partitioned execution optimizations. This is the default when any
23175 level of optimization is selected.
23178 @opindex msoft-stack
23179 Generate code that does not use @code{.local} memory
23180 directly for stack storage. Instead, a per-warp stack pointer is
23181 maintained explicitly. This enables variable-length stack allocation (with
23182 variable-length arrays or @code{alloca}), and when global memory is used for
23183 underlying storage, makes it possible to access automatic variables from other
23184 threads, or with atomic instructions. This code generation variant is used
23185 for OpenMP offloading, but the option is exposed on its own for the purpose
23186 of testing the compiler; to generate code suitable for linking into programs
23187 using OpenMP offloading, use option @option{-mgomp}.
23189 @item -muniform-simt
23190 @opindex muniform-simt
23191 Switch to code generation variant that allows to execute all threads in each
23192 warp, while maintaining memory state and side effects as if only one thread
23193 in each warp was active outside of OpenMP SIMD regions. All atomic operations
23194 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
23195 current lane index equals the master lane index), and the register being
23196 assigned is copied via a shuffle instruction from the master lane. Outside of
23197 SIMD regions lane 0 is the master; inside, each thread sees itself as the
23198 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
23199 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
23200 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
23201 with current lane index to compute the master lane index.
23205 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
23206 @option{-muniform-simt} options, and selects corresponding multilib variant.
23210 @node OpenRISC Options
23211 @subsection OpenRISC Options
23212 @cindex OpenRISC Options
23214 These options are defined for OpenRISC:
23218 @item -mboard=@var{name}
23220 Configure a board specific runtime. This will be passed to the linker for
23221 newlib board library linking. The default is @code{or1ksim}.
23225 For compatibility, it's always newlib for elf now.
23229 Generate code for hardware which supports divide instructions. This is the
23234 Generate code for hardware which supports multiply instructions. This is the
23239 Generate code for hardware which supports the conditional move (@code{l.cmov})
23244 Generate code for hardware which supports rotate right instructions.
23248 Generate code for hardware which supports sign-extension instructions.
23252 Generate code for hardware which supports set flag immediate (@code{l.sf*i})
23257 Generate code for hardware which supports shift immediate related instructions
23258 (i.e. @code{l.srai}, @code{l.srli}, @code{l.slli}, @code{1.rori}). Note, to
23259 enable generation of the @code{l.rori} instruction the @option{-mror} flag must
23264 Generate code for hardware which requires divide instruction emulation.
23268 Generate code for hardware which requires multiply instruction emulation.
23272 @node PDP-11 Options
23273 @subsection PDP-11 Options
23274 @cindex PDP-11 Options
23276 These options are defined for the PDP-11:
23281 Use hardware FPP floating point. This is the default. (FIS floating
23282 point on the PDP-11/40 is not supported.) Implies -m45.
23285 @opindex msoft-float
23286 Do not use hardware floating point.
23290 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
23294 Return floating-point results in memory. This is the default.
23298 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
23302 Generate code for a PDP-11/45. This is the default.
23306 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
23312 Use 16-bit @code{int}. This is the default.
23318 Use 32-bit @code{int}.
23322 Target has split instruction and data space. Implies -m45.
23326 Use Unix assembler syntax.
23330 Use DEC assembler syntax.
23334 Use GNU assembler syntax. This is the default.
23338 Use the new LRA register allocator. By default, the old ``reload''
23342 @node picoChip Options
23343 @subsection picoChip Options
23344 @cindex picoChip options
23346 These @samp{-m} options are defined for picoChip implementations:
23350 @item -mae=@var{ae_type}
23352 Set the instruction set, register set, and instruction scheduling
23353 parameters for array element type @var{ae_type}. Supported values
23354 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
23356 @option{-mae=ANY} selects a completely generic AE type. Code
23357 generated with this option runs on any of the other AE types. The
23358 code is not as efficient as it would be if compiled for a specific
23359 AE type, and some types of operation (e.g., multiplication) do not
23360 work properly on all types of AE.
23362 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
23363 for compiled code, and is the default.
23365 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
23366 option may suffer from poor performance of byte (char) manipulation,
23367 since the DSP AE does not provide hardware support for byte load/stores.
23369 @item -msymbol-as-address
23370 Enable the compiler to directly use a symbol name as an address in a
23371 load/store instruction, without first loading it into a
23372 register. Typically, the use of this option generates larger
23373 programs, which run faster than when the option isn't used. However, the
23374 results vary from program to program, so it is left as a user option,
23375 rather than being permanently enabled.
23377 @item -mno-inefficient-warnings
23378 Disables warnings about the generation of inefficient code. These
23379 warnings can be generated, for example, when compiling code that
23380 performs byte-level memory operations on the MAC AE type. The MAC AE has
23381 no hardware support for byte-level memory operations, so all byte
23382 load/stores must be synthesized from word load/store operations. This is
23383 inefficient and a warning is generated to indicate
23384 that you should rewrite the code to avoid byte operations, or to target
23385 an AE type that has the necessary hardware support. This option disables
23390 @node PowerPC Options
23391 @subsection PowerPC Options
23392 @cindex PowerPC options
23394 These are listed under @xref{RS/6000 and PowerPC Options}.
23396 @node PowerPC SPE Options
23397 @subsection PowerPC SPE Options
23398 @cindex PowerPC SPE options
23400 These @samp{-m} options are defined for PowerPC SPE:
23405 @itemx -mno-popcntb
23409 @opindex mno-popcntb
23410 You use these options to specify which instructions are available on the
23411 processor you are using. The default value of these options is
23412 determined when configuring GCC@. Specifying the
23413 @option{-mcpu=@var{cpu_type}} overrides the specification of these
23414 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
23415 rather than the options listed above.
23417 The @option{-mmfcrf} option allows GCC to generate the move from
23418 condition register field instruction implemented on the POWER4
23419 processor and other processors that support the PowerPC V2.01
23421 The @option{-mpopcntb} option allows GCC to generate the popcount and
23422 double-precision FP reciprocal estimate instruction implemented on the
23423 POWER5 processor and other processors that support the PowerPC V2.02
23426 @item -mcpu=@var{cpu_type}
23428 Set architecture type, register usage, and
23429 instruction scheduling parameters for machine type @var{cpu_type}.
23430 Supported values for @var{cpu_type} are @samp{8540}, @samp{8548},
23433 @option{-mcpu=powerpc} specifies pure 32-bit PowerPC (either
23434 endian), with an appropriate, generic processor model assumed for
23435 scheduling purposes.
23437 Specifying @samp{native} as cpu type detects and selects the
23438 architecture option that corresponds to the host processor of the
23439 system performing the compilation.
23440 @option{-mcpu=native} has no effect if GCC does not recognize the
23443 The other options specify a specific processor. Code generated under
23444 those options runs best on that processor, and may not run at all on
23447 The @option{-mcpu} options automatically enable or disable the
23450 @gccoptlist{-mhard-float -mmfcrf -mmultiple @gol
23451 -mpopcntb -mpopcntd @gol
23452 -msingle-float -mdouble-float @gol
23455 The particular options set for any particular CPU varies between
23456 compiler versions, depending on what setting seems to produce optimal
23457 code for that CPU; it doesn't necessarily reflect the actual hardware's
23458 capabilities. If you wish to set an individual option to a particular
23459 value, you may specify it after the @option{-mcpu} option, like
23460 @option{-mcpu=8548}.
23462 @item -mtune=@var{cpu_type}
23464 Set the instruction scheduling parameters for machine type
23465 @var{cpu_type}, but do not set the architecture type or register usage,
23466 as @option{-mcpu=@var{cpu_type}} does. The same
23467 values for @var{cpu_type} are used for @option{-mtune} as for
23468 @option{-mcpu}. If both are specified, the code generated uses the
23469 architecture and registers set by @option{-mcpu}, but the
23470 scheduling parameters set by @option{-mtune}.
23473 @opindex msecure-plt
23474 Generate code that allows @command{ld} and @command{ld.so}
23475 to build executables and shared
23476 libraries with non-executable @code{.plt} and @code{.got} sections.
23478 32-bit SYSV ABI option.
23482 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
23484 requires @code{.plt} and @code{.got}
23485 sections that are both writable and executable.
23486 This is a PowerPC 32-bit SYSV ABI option.
23492 This switch enables or disables the generation of ISEL instructions.
23494 @item -misel=@var{yes/no}
23495 This switch has been deprecated. Use @option{-misel} and
23496 @option{-mno-isel} instead.
23502 This switch enables or disables the generation of SPE simd
23505 @item -mspe=@var{yes/no}
23506 This option has been deprecated. Use @option{-mspe} and
23507 @option{-mno-spe} instead.
23510 @itemx -mno-float128
23512 @opindex mno-float128
23513 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
23514 and use either software emulation for IEEE 128-bit floating point or
23515 hardware instructions.
23517 @item -mfloat-gprs=@var{yes/single/double/no}
23518 @itemx -mfloat-gprs
23519 @opindex mfloat-gprs
23520 This switch enables or disables the generation of floating-point
23521 operations on the general-purpose registers for architectures that
23524 The argument @samp{yes} or @samp{single} enables the use of
23525 single-precision floating-point operations.
23527 The argument @samp{double} enables the use of single and
23528 double-precision floating-point operations.
23530 The argument @samp{no} disables floating-point operations on the
23531 general-purpose registers.
23533 This option is currently only available on the MPC854x.
23536 @itemx -mno-fp-in-toc
23537 @itemx -mno-sum-in-toc
23538 @itemx -mminimal-toc
23540 @opindex mno-fp-in-toc
23541 @opindex mno-sum-in-toc
23542 @opindex mminimal-toc
23543 Modify generation of the TOC (Table Of Contents), which is created for
23544 every executable file. The @option{-mfull-toc} option is selected by
23545 default. In that case, GCC allocates at least one TOC entry for
23546 each unique non-automatic variable reference in your program. GCC
23547 also places floating-point constants in the TOC@. However, only
23548 16,384 entries are available in the TOC@.
23550 If you receive a linker error message that saying you have overflowed
23551 the available TOC space, you can reduce the amount of TOC space used
23552 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
23553 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
23554 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
23555 generate code to calculate the sum of an address and a constant at
23556 run time instead of putting that sum into the TOC@. You may specify one
23557 or both of these options. Each causes GCC to produce very slightly
23558 slower and larger code at the expense of conserving TOC space.
23560 If you still run out of space in the TOC even when you specify both of
23561 these options, specify @option{-mminimal-toc} instead. This option causes
23562 GCC to make only one TOC entry for every file. When you specify this
23563 option, GCC produces code that is slower and larger but which
23564 uses extremely little TOC space. You may wish to use this option
23565 only on files that contain less frequently-executed code.
23569 Disables the 64-bit ABI. GCC defaults to @option{-maix32}.
23572 @itemx -mno-xl-compat
23573 @opindex mxl-compat
23574 @opindex mno-xl-compat
23575 Produce code that conforms more closely to IBM XL compiler semantics
23576 when using AIX-compatible ABI@. Pass floating-point arguments to
23577 prototyped functions beyond the register save area (RSA) on the stack
23578 in addition to argument FPRs. Do not assume that most significant
23579 double in 128-bit long double value is properly rounded when comparing
23580 values and converting to double. Use XL symbol names for long double
23583 The AIX calling convention was extended but not initially documented to
23584 handle an obscure K&R C case of calling a function that takes the
23585 address of its arguments with fewer arguments than declared. IBM XL
23586 compilers access floating-point arguments that do not fit in the
23587 RSA from the stack when a subroutine is compiled without
23588 optimization. Because always storing floating-point arguments on the
23589 stack is inefficient and rarely needed, this option is not enabled by
23590 default and only is necessary when calling subroutines compiled by IBM
23591 XL compilers without optimization.
23593 @item -malign-natural
23594 @itemx -malign-power
23595 @opindex malign-natural
23596 @opindex malign-power
23597 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
23598 @option{-malign-natural} overrides the ABI-defined alignment of larger
23599 types, such as floating-point doubles, on their natural size-based boundary.
23600 The option @option{-malign-power} instructs GCC to follow the ABI-specified
23601 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
23603 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
23607 @itemx -mhard-float
23608 @opindex msoft-float
23609 @opindex mhard-float
23610 Generate code that does not use (uses) the floating-point register set.
23611 Software floating-point emulation is provided if you use the
23612 @option{-msoft-float} option, and pass the option to GCC when linking.
23614 @item -msingle-float
23615 @itemx -mdouble-float
23616 @opindex msingle-float
23617 @opindex mdouble-float
23618 Generate code for single- or double-precision floating-point operations.
23619 @option{-mdouble-float} implies @option{-msingle-float}.
23622 @itemx -mno-multiple
23624 @opindex mno-multiple
23625 Generate code that uses (does not use) the load multiple word
23626 instructions and the store multiple word instructions. These
23627 instructions are generated by default on POWER systems, and not
23628 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
23629 PowerPC systems, since those instructions do not work when the
23630 processor is in little-endian mode. The exceptions are PPC740 and
23631 PPC750 which permit these instructions in little-endian mode.
23636 @opindex mno-update
23637 Generate code that uses (does not use) the load or store instructions
23638 that update the base register to the address of the calculated memory
23639 location. These instructions are generated by default. If you use
23640 @option{-mno-update}, there is a small window between the time that the
23641 stack pointer is updated and the address of the previous frame is
23642 stored, which means code that walks the stack frame across interrupts or
23643 signals may get corrupted data.
23645 @item -mavoid-indexed-addresses
23646 @itemx -mno-avoid-indexed-addresses
23647 @opindex mavoid-indexed-addresses
23648 @opindex mno-avoid-indexed-addresses
23649 Generate code that tries to avoid (not avoid) the use of indexed load
23650 or store instructions. These instructions can incur a performance
23651 penalty on Power6 processors in certain situations, such as when
23652 stepping through large arrays that cross a 16M boundary. This option
23653 is enabled by default when targeting Power6 and disabled otherwise.
23656 @itemx -mno-fused-madd
23657 @opindex mfused-madd
23658 @opindex mno-fused-madd
23659 Generate code that uses (does not use) the floating-point multiply and
23660 accumulate instructions. These instructions are generated by default
23661 if hardware floating point is used. The machine-dependent
23662 @option{-mfused-madd} option is now mapped to the machine-independent
23663 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
23664 mapped to @option{-ffp-contract=off}.
23666 @item -mno-strict-align
23667 @itemx -mstrict-align
23668 @opindex mno-strict-align
23669 @opindex mstrict-align
23670 On System V.4 and embedded PowerPC systems do not (do) assume that
23671 unaligned memory references are handled by the system.
23673 @item -mrelocatable
23674 @itemx -mno-relocatable
23675 @opindex mrelocatable
23676 @opindex mno-relocatable
23677 Generate code that allows (does not allow) a static executable to be
23678 relocated to a different address at run time. A simple embedded
23679 PowerPC system loader should relocate the entire contents of
23680 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
23681 a table of 32-bit addresses generated by this option. For this to
23682 work, all objects linked together must be compiled with
23683 @option{-mrelocatable} or @option{-mrelocatable-lib}.
23684 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
23686 @item -mrelocatable-lib
23687 @itemx -mno-relocatable-lib
23688 @opindex mrelocatable-lib
23689 @opindex mno-relocatable-lib
23690 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
23691 @code{.fixup} section to allow static executables to be relocated at
23692 run time, but @option{-mrelocatable-lib} does not use the smaller stack
23693 alignment of @option{-mrelocatable}. Objects compiled with
23694 @option{-mrelocatable-lib} may be linked with objects compiled with
23695 any combination of the @option{-mrelocatable} options.
23701 On System V.4 and embedded PowerPC systems do not (do) assume that
23702 register 2 contains a pointer to a global area pointing to the addresses
23703 used in the program.
23706 @itemx -mlittle-endian
23708 @opindex mlittle-endian
23709 On System V.4 and embedded PowerPC systems compile code for the
23710 processor in little-endian mode. The @option{-mlittle-endian} option is
23711 the same as @option{-mlittle}.
23714 @itemx -mbig-endian
23716 @opindex mbig-endian
23717 On System V.4 and embedded PowerPC systems compile code for the
23718 processor in big-endian mode. The @option{-mbig-endian} option is
23719 the same as @option{-mbig}.
23721 @item -mdynamic-no-pic
23722 @opindex mdynamic-no-pic
23723 On Darwin and Mac OS X systems, compile code so that it is not
23724 relocatable, but that its external references are relocatable. The
23725 resulting code is suitable for applications, but not shared
23728 @item -msingle-pic-base
23729 @opindex msingle-pic-base
23730 Treat the register used for PIC addressing as read-only, rather than
23731 loading it in the prologue for each function. The runtime system is
23732 responsible for initializing this register with an appropriate value
23733 before execution begins.
23735 @item -mprioritize-restricted-insns=@var{priority}
23736 @opindex mprioritize-restricted-insns
23737 This option controls the priority that is assigned to
23738 dispatch-slot restricted instructions during the second scheduling
23739 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
23740 or @samp{2} to assign no, highest, or second-highest (respectively)
23741 priority to dispatch-slot restricted
23744 @item -msched-costly-dep=@var{dependence_type}
23745 @opindex msched-costly-dep
23746 This option controls which dependences are considered costly
23747 by the target during instruction scheduling. The argument
23748 @var{dependence_type} takes one of the following values:
23752 No dependence is costly.
23755 All dependences are costly.
23757 @item @samp{true_store_to_load}
23758 A true dependence from store to load is costly.
23760 @item @samp{store_to_load}
23761 Any dependence from store to load is costly.
23764 Any dependence for which the latency is greater than or equal to
23765 @var{number} is costly.
23768 @item -minsert-sched-nops=@var{scheme}
23769 @opindex minsert-sched-nops
23770 This option controls which NOP insertion scheme is used during
23771 the second scheduling pass. The argument @var{scheme} takes one of the
23779 Pad with NOPs any dispatch group that has vacant issue slots,
23780 according to the scheduler's grouping.
23782 @item @samp{regroup_exact}
23783 Insert NOPs to force costly dependent insns into
23784 separate groups. Insert exactly as many NOPs as needed to force an insn
23785 to a new group, according to the estimated processor grouping.
23788 Insert NOPs to force costly dependent insns into
23789 separate groups. Insert @var{number} NOPs to force an insn to a new group.
23793 @opindex mcall-sysv
23794 On System V.4 and embedded PowerPC systems compile code using calling
23795 conventions that adhere to the March 1995 draft of the System V
23796 Application Binary Interface, PowerPC processor supplement. This is the
23797 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
23799 @item -mcall-sysv-eabi
23801 @opindex mcall-sysv-eabi
23802 @opindex mcall-eabi
23803 Specify both @option{-mcall-sysv} and @option{-meabi} options.
23805 @item -mcall-sysv-noeabi
23806 @opindex mcall-sysv-noeabi
23807 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
23809 @item -mcall-aixdesc
23811 On System V.4 and embedded PowerPC systems compile code for the AIX
23815 @opindex mcall-linux
23816 On System V.4 and embedded PowerPC systems compile code for the
23817 Linux-based GNU system.
23819 @item -mcall-freebsd
23820 @opindex mcall-freebsd
23821 On System V.4 and embedded PowerPC systems compile code for the
23822 FreeBSD operating system.
23824 @item -mcall-netbsd
23825 @opindex mcall-netbsd
23826 On System V.4 and embedded PowerPC systems compile code for the
23827 NetBSD operating system.
23829 @item -mcall-openbsd
23830 @opindex mcall-netbsd
23831 On System V.4 and embedded PowerPC systems compile code for the
23832 OpenBSD operating system.
23834 @item -maix-struct-return
23835 @opindex maix-struct-return
23836 Return all structures in memory (as specified by the AIX ABI)@.
23838 @item -msvr4-struct-return
23839 @opindex msvr4-struct-return
23840 Return structures smaller than 8 bytes in registers (as specified by the
23843 @item -mabi=@var{abi-type}
23845 Extend the current ABI with a particular extension, or remove such extension.
23846 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
23847 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
23848 @samp{elfv1}, @samp{elfv2}@.
23852 Extend the current ABI with SPE ABI extensions. This does not change
23853 the default ABI, instead it adds the SPE ABI extensions to the current
23857 @opindex mabi=no-spe
23858 Disable Book-E SPE ABI extensions for the current ABI@.
23860 @item -mabi=ibmlongdouble
23861 @opindex mabi=ibmlongdouble
23862 Change the current ABI to use IBM extended-precision long double.
23863 This is not likely to work if your system defaults to using IEEE
23864 extended-precision long double. If you change the long double type
23865 from IEEE extended-precision, the compiler will issue a warning unless
23866 you use the @option{-Wno-psabi} option.
23868 @item -mabi=ieeelongdouble
23869 @opindex mabi=ieeelongdouble
23870 Change the current ABI to use IEEE extended-precision long double.
23871 This is not likely to work if your system defaults to using IBM
23872 extended-precision long double. If you change the long double type
23873 from IBM extended-precision, the compiler will issue a warning unless
23874 you use the @option{-Wno-psabi} option.
23877 @opindex mabi=elfv1
23878 Change the current ABI to use the ELFv1 ABI.
23879 This is the default ABI for big-endian PowerPC 64-bit Linux.
23880 Overriding the default ABI requires special system support and is
23881 likely to fail in spectacular ways.
23884 @opindex mabi=elfv2
23885 Change the current ABI to use the ELFv2 ABI.
23886 This is the default ABI for little-endian PowerPC 64-bit Linux.
23887 Overriding the default ABI requires special system support and is
23888 likely to fail in spectacular ways.
23890 @item -mgnu-attribute
23891 @itemx -mno-gnu-attribute
23892 @opindex mgnu-attribute
23893 @opindex mno-gnu-attribute
23894 Emit .gnu_attribute assembly directives to set tag/value pairs in a
23895 .gnu.attributes section that specify ABI variations in function
23896 parameters or return values.
23899 @itemx -mno-prototype
23900 @opindex mprototype
23901 @opindex mno-prototype
23902 On System V.4 and embedded PowerPC systems assume that all calls to
23903 variable argument functions are properly prototyped. Otherwise, the
23904 compiler must insert an instruction before every non-prototyped call to
23905 set or clear bit 6 of the condition code register (@code{CR}) to
23906 indicate whether floating-point values are passed in the floating-point
23907 registers in case the function takes variable arguments. With
23908 @option{-mprototype}, only calls to prototyped variable argument functions
23909 set or clear the bit.
23913 On embedded PowerPC systems, assume that the startup module is called
23914 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
23915 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
23920 On embedded PowerPC systems, assume that the startup module is called
23921 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
23926 On embedded PowerPC systems, assume that the startup module is called
23927 @file{crt0.o} and the standard C libraries are @file{libads.a} and
23930 @item -myellowknife
23931 @opindex myellowknife
23932 On embedded PowerPC systems, assume that the startup module is called
23933 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
23938 On System V.4 and embedded PowerPC systems, specify that you are
23939 compiling for a VxWorks system.
23943 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
23944 header to indicate that @samp{eabi} extended relocations are used.
23950 On System V.4 and embedded PowerPC systems do (do not) adhere to the
23951 Embedded Applications Binary Interface (EABI), which is a set of
23952 modifications to the System V.4 specifications. Selecting @option{-meabi}
23953 means that the stack is aligned to an 8-byte boundary, a function
23954 @code{__eabi} is called from @code{main} to set up the EABI
23955 environment, and the @option{-msdata} option can use both @code{r2} and
23956 @code{r13} to point to two separate small data areas. Selecting
23957 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
23958 no EABI initialization function is called from @code{main}, and the
23959 @option{-msdata} option only uses @code{r13} to point to a single
23960 small data area. The @option{-meabi} option is on by default if you
23961 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
23964 @opindex msdata=eabi
23965 On System V.4 and embedded PowerPC systems, put small initialized
23966 @code{const} global and static data in the @code{.sdata2} section, which
23967 is pointed to by register @code{r2}. Put small initialized
23968 non-@code{const} global and static data in the @code{.sdata} section,
23969 which is pointed to by register @code{r13}. Put small uninitialized
23970 global and static data in the @code{.sbss} section, which is adjacent to
23971 the @code{.sdata} section. The @option{-msdata=eabi} option is
23972 incompatible with the @option{-mrelocatable} option. The
23973 @option{-msdata=eabi} option also sets the @option{-memb} option.
23976 @opindex msdata=sysv
23977 On System V.4 and embedded PowerPC systems, put small global and static
23978 data in the @code{.sdata} section, which is pointed to by register
23979 @code{r13}. Put small uninitialized global and static data in the
23980 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
23981 The @option{-msdata=sysv} option is incompatible with the
23982 @option{-mrelocatable} option.
23984 @item -msdata=default
23986 @opindex msdata=default
23988 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
23989 compile code the same as @option{-msdata=eabi}, otherwise compile code the
23990 same as @option{-msdata=sysv}.
23993 @opindex msdata=data
23994 On System V.4 and embedded PowerPC systems, put small global
23995 data in the @code{.sdata} section. Put small uninitialized global
23996 data in the @code{.sbss} section. Do not use register @code{r13}
23997 to address small data however. This is the default behavior unless
23998 other @option{-msdata} options are used.
24002 @opindex msdata=none
24004 On embedded PowerPC systems, put all initialized global and static data
24005 in the @code{.data} section, and all uninitialized data in the
24006 @code{.bss} section.
24008 @item -mblock-move-inline-limit=@var{num}
24009 @opindex mblock-move-inline-limit
24010 Inline all block moves (such as calls to @code{memcpy} or structure
24011 copies) less than or equal to @var{num} bytes. The minimum value for
24012 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
24013 targets. The default value is target-specific.
24017 @cindex smaller data references (PowerPC)
24018 @cindex .sdata/.sdata2 references (PowerPC)
24019 On embedded PowerPC systems, put global and static items less than or
24020 equal to @var{num} bytes into the small data or BSS sections instead of
24021 the normal data or BSS section. By default, @var{num} is 8. The
24022 @option{-G @var{num}} switch is also passed to the linker.
24023 All modules should be compiled with the same @option{-G @var{num}} value.
24026 @itemx -mno-regnames
24028 @opindex mno-regnames
24029 On System V.4 and embedded PowerPC systems do (do not) emit register
24030 names in the assembly language output using symbolic forms.
24033 @itemx -mno-longcall
24035 @opindex mno-longcall
24036 By default assume that all calls are far away so that a longer and more
24037 expensive calling sequence is required. This is required for calls
24038 farther than 32 megabytes (33,554,432 bytes) from the current location.
24039 A short call is generated if the compiler knows
24040 the call cannot be that far away. This setting can be overridden by
24041 the @code{shortcall} function attribute, or by @code{#pragma
24044 Some linkers are capable of detecting out-of-range calls and generating
24045 glue code on the fly. On these systems, long calls are unnecessary and
24046 generate slower code. As of this writing, the AIX linker can do this,
24047 as can the GNU linker for PowerPC/64. It is planned to add this feature
24048 to the GNU linker for 32-bit PowerPC systems as well.
24050 In the future, GCC may ignore all longcall specifications
24051 when the linker is known to generate glue.
24053 @item -mtls-markers
24054 @itemx -mno-tls-markers
24055 @opindex mtls-markers
24056 @opindex mno-tls-markers
24057 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
24058 specifying the function argument. The relocation allows the linker to
24059 reliably associate function call with argument setup instructions for
24060 TLS optimization, which in turn allows GCC to better schedule the
24066 This option enables use of the reciprocal estimate and
24067 reciprocal square root estimate instructions with additional
24068 Newton-Raphson steps to increase precision instead of doing a divide or
24069 square root and divide for floating-point arguments. You should use
24070 the @option{-ffast-math} option when using @option{-mrecip} (or at
24071 least @option{-funsafe-math-optimizations},
24072 @option{-ffinite-math-only}, @option{-freciprocal-math} and
24073 @option{-fno-trapping-math}). Note that while the throughput of the
24074 sequence is generally higher than the throughput of the non-reciprocal
24075 instruction, the precision of the sequence can be decreased by up to 2
24076 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
24079 @item -mrecip=@var{opt}
24080 @opindex mrecip=opt
24081 This option controls which reciprocal estimate instructions
24082 may be used. @var{opt} is a comma-separated list of options, which may
24083 be preceded by a @code{!} to invert the option:
24088 Enable all estimate instructions.
24091 Enable the default instructions, equivalent to @option{-mrecip}.
24094 Disable all estimate instructions, equivalent to @option{-mno-recip}.
24097 Enable the reciprocal approximation instructions for both
24098 single and double precision.
24101 Enable the single-precision reciprocal approximation instructions.
24104 Enable the double-precision reciprocal approximation instructions.
24107 Enable the reciprocal square root approximation instructions for both
24108 single and double precision.
24111 Enable the single-precision reciprocal square root approximation instructions.
24114 Enable the double-precision reciprocal square root approximation instructions.
24118 So, for example, @option{-mrecip=all,!rsqrtd} enables
24119 all of the reciprocal estimate instructions, except for the
24120 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
24121 which handle the double-precision reciprocal square root calculations.
24123 @item -mrecip-precision
24124 @itemx -mno-recip-precision
24125 @opindex mrecip-precision
24126 Assume (do not assume) that the reciprocal estimate instructions
24127 provide higher-precision estimates than is mandated by the PowerPC
24128 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
24129 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
24130 The double-precision square root estimate instructions are not generated by
24131 default on low-precision machines, since they do not provide an
24132 estimate that converges after three steps.
24134 @item -mpointers-to-nested-functions
24135 @itemx -mno-pointers-to-nested-functions
24136 @opindex mpointers-to-nested-functions
24137 Generate (do not generate) code to load up the static chain register
24138 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
24139 systems where a function pointer points to a 3-word descriptor giving
24140 the function address, TOC value to be loaded in register @code{r2}, and
24141 static chain value to be loaded in register @code{r11}. The
24142 @option{-mpointers-to-nested-functions} is on by default. You cannot
24143 call through pointers to nested functions or pointers
24144 to functions compiled in other languages that use the static chain if
24145 you use @option{-mno-pointers-to-nested-functions}.
24147 @item -msave-toc-indirect
24148 @itemx -mno-save-toc-indirect
24149 @opindex msave-toc-indirect
24150 Generate (do not generate) code to save the TOC value in the reserved
24151 stack location in the function prologue if the function calls through
24152 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
24153 saved in the prologue, it is saved just before the call through the
24154 pointer. The @option{-mno-save-toc-indirect} option is the default.
24156 @item -mcompat-align-parm
24157 @itemx -mno-compat-align-parm
24158 @opindex mcompat-align-parm
24159 Generate (do not generate) code to pass structure parameters with a
24160 maximum alignment of 64 bits, for compatibility with older versions
24163 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
24164 structure parameter on a 128-bit boundary when that structure contained
24165 a member requiring 128-bit alignment. This is corrected in more
24166 recent versions of GCC. This option may be used to generate code
24167 that is compatible with functions compiled with older versions of
24170 The @option{-mno-compat-align-parm} option is the default.
24172 @item -mstack-protector-guard=@var{guard}
24173 @itemx -mstack-protector-guard-reg=@var{reg}
24174 @itemx -mstack-protector-guard-offset=@var{offset}
24175 @itemx -mstack-protector-guard-symbol=@var{symbol}
24176 @opindex mstack-protector-guard
24177 @opindex mstack-protector-guard-reg
24178 @opindex mstack-protector-guard-offset
24179 @opindex mstack-protector-guard-symbol
24180 Generate stack protection code using canary at @var{guard}. Supported
24181 locations are @samp{global} for global canary or @samp{tls} for per-thread
24182 canary in the TLS block (the default with GNU libc version 2.4 or later).
24184 With the latter choice the options
24185 @option{-mstack-protector-guard-reg=@var{reg}} and
24186 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
24187 which register to use as base register for reading the canary, and from what
24188 offset from that base register. The default for those is as specified in the
24189 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
24190 the offset with a symbol reference to a canary in the TLS block.
24194 @node RISC-V Options
24195 @subsection RISC-V Options
24196 @cindex RISC-V Options
24198 These command-line options are defined for RISC-V targets:
24201 @item -mbranch-cost=@var{n}
24202 @opindex mbranch-cost
24203 Set the cost of branches to roughly @var{n} instructions.
24208 When generating PIC code, do or don't allow the use of PLTs. Ignored for
24209 non-PIC. The default is @option{-mplt}.
24211 @item -mabi=@var{ABI-string}
24213 Specify integer and floating-point calling convention. @var{ABI-string}
24214 contains two parts: the size of integer types and the registers used for
24215 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
24216 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
24217 32-bit), and that floating-point values up to 64 bits wide are passed in F
24218 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
24219 allows the compiler to generate code that uses the F and D extensions but only
24220 allows floating-point values up to 32 bits long to be passed in registers; or
24221 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
24222 passed in registers.
24224 The default for this argument is system dependent, users who want a specific
24225 calling convention should specify one explicitly. The valid calling
24226 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
24227 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
24228 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
24229 invalid because the ABI requires 64-bit values be passed in F registers, but F
24230 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
24231 only be used with the @samp{rv32e} architecture. This ABI is not well
24232 specified at present, and is subject to change.
24237 Do or don't use hardware floating-point divide and square root instructions.
24238 This requires the F or D extensions for floating-point registers. The default
24239 is to use them if the specified architecture has these instructions.
24244 Do or don't use hardware instructions for integer division. This requires the
24245 M extension. The default is to use them if the specified architecture has
24246 these instructions.
24248 @item -march=@var{ISA-string}
24250 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
24251 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
24254 @item -mtune=@var{processor-string}
24256 Optimize the output for the given processor, specified by microarchitecture
24259 @item -mpreferred-stack-boundary=@var{num}
24260 @opindex mpreferred-stack-boundary
24261 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
24262 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
24263 the default is 4 (16 bytes or 128-bits).
24265 @strong{Warning:} If you use this switch, then you must build all modules with
24266 the same value, including any libraries. This includes the system libraries
24267 and startup modules.
24269 @item -msmall-data-limit=@var{n}
24270 @opindex msmall-data-limit
24271 Put global and static data smaller than @var{n} bytes into a special section
24274 @item -msave-restore
24275 @itemx -mno-save-restore
24276 @opindex msave-restore
24277 Do or don't use smaller but slower prologue and epilogue code that uses
24278 library function calls. The default is to use fast inline prologues and
24281 @item -mstrict-align
24282 @itemx -mno-strict-align
24283 @opindex mstrict-align
24284 Do not or do generate unaligned memory accesses. The default is set depending
24285 on whether the processor we are optimizing for supports fast unaligned access
24288 @item -mcmodel=medlow
24289 @opindex mcmodel=medlow
24290 Generate code for the medium-low code model. The program and its statically
24291 defined symbols must lie within a single 2 GiB address range and must lie
24292 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
24293 statically or dynamically linked. This is the default code model.
24295 @item -mcmodel=medany
24296 @opindex mcmodel=medany
24297 Generate code for the medium-any code model. The program and its statically
24298 defined symbols must be within any single 2 GiB address range. Programs can be
24299 statically or dynamically linked.
24301 @item -mexplicit-relocs
24302 @itemx -mno-exlicit-relocs
24303 Use or do not use assembler relocation operators when dealing with symbolic
24304 addresses. The alternative is to use assembler macros instead, which may
24305 limit optimization.
24309 Take advantage of linker relaxations to reduce the number of instructions
24310 required to materialize symbol addresses. The default is to take advantage of
24311 linker relaxations.
24316 @subsection RL78 Options
24317 @cindex RL78 Options
24323 Links in additional target libraries to support operation within a
24332 Specifies the type of hardware multiplication and division support to
24333 be used. The simplest is @code{none}, which uses software for both
24334 multiplication and division. This is the default. The @code{g13}
24335 value is for the hardware multiply/divide peripheral found on the
24336 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
24337 the multiplication and division instructions supported by the RL78/G14
24338 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
24339 the value @code{mg10} is an alias for @code{none}.
24341 In addition a C preprocessor macro is defined, based upon the setting
24342 of this option. Possible values are: @code{__RL78_MUL_NONE__},
24343 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
24350 Specifies the RL78 core to target. The default is the G14 core, also
24351 known as an S3 core or just RL78. The G13 or S2 core does not have
24352 multiply or divide instructions, instead it uses a hardware peripheral
24353 for these operations. The G10 or S1 core does not have register
24354 banks, so it uses a different calling convention.
24356 If this option is set it also selects the type of hardware multiply
24357 support to use, unless this is overridden by an explicit
24358 @option{-mmul=none} option on the command line. Thus specifying
24359 @option{-mcpu=g13} enables the use of the G13 hardware multiply
24360 peripheral and specifying @option{-mcpu=g10} disables the use of
24361 hardware multiplications altogether.
24363 Note, although the RL78/G14 core is the default target, specifying
24364 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
24365 change the behavior of the toolchain since it also enables G14
24366 hardware multiply support. If these options are not specified on the
24367 command line then software multiplication routines will be used even
24368 though the code targets the RL78 core. This is for backwards
24369 compatibility with older toolchains which did not have hardware
24370 multiply and divide support.
24372 In addition a C preprocessor macro is defined, based upon the setting
24373 of this option. Possible values are: @code{__RL78_G10__},
24374 @code{__RL78_G13__} or @code{__RL78_G14__}.
24384 These are aliases for the corresponding @option{-mcpu=} option. They
24385 are provided for backwards compatibility.
24389 Allow the compiler to use all of the available registers. By default
24390 registers @code{r24..r31} are reserved for use in interrupt handlers.
24391 With this option enabled these registers can be used in ordinary
24394 @item -m64bit-doubles
24395 @itemx -m32bit-doubles
24396 @opindex m64bit-doubles
24397 @opindex m32bit-doubles
24398 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24399 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24400 @option{-m32bit-doubles}.
24402 @item -msave-mduc-in-interrupts
24403 @itemx -mno-save-mduc-in-interrupts
24404 @opindex msave-mduc-in-interrupts
24405 @opindex mno-save-mduc-in-interrupts
24406 Specifies that interrupt handler functions should preserve the
24407 MDUC registers. This is only necessary if normal code might use
24408 the MDUC registers, for example because it performs multiplication
24409 and division operations. The default is to ignore the MDUC registers
24410 as this makes the interrupt handlers faster. The target option -mg13
24411 needs to be passed for this to work as this feature is only available
24412 on the G13 target (S2 core). The MDUC registers will only be saved
24413 if the interrupt handler performs a multiplication or division
24414 operation or it calls another function.
24418 @node RS/6000 and PowerPC Options
24419 @subsection IBM RS/6000 and PowerPC Options
24420 @cindex RS/6000 and PowerPC Options
24421 @cindex IBM RS/6000 and PowerPC Options
24423 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
24425 @item -mpowerpc-gpopt
24426 @itemx -mno-powerpc-gpopt
24427 @itemx -mpowerpc-gfxopt
24428 @itemx -mno-powerpc-gfxopt
24431 @itemx -mno-powerpc64
24435 @itemx -mno-popcntb
24437 @itemx -mno-popcntd
24446 @itemx -mno-hard-dfp
24447 @opindex mpowerpc-gpopt
24448 @opindex mno-powerpc-gpopt
24449 @opindex mpowerpc-gfxopt
24450 @opindex mno-powerpc-gfxopt
24451 @opindex mpowerpc64
24452 @opindex mno-powerpc64
24456 @opindex mno-popcntb
24458 @opindex mno-popcntd
24464 @opindex mno-mfpgpr
24466 @opindex mno-hard-dfp
24467 You use these options to specify which instructions are available on the
24468 processor you are using. The default value of these options is
24469 determined when configuring GCC@. Specifying the
24470 @option{-mcpu=@var{cpu_type}} overrides the specification of these
24471 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
24472 rather than the options listed above.
24474 Specifying @option{-mpowerpc-gpopt} allows
24475 GCC to use the optional PowerPC architecture instructions in the
24476 General Purpose group, including floating-point square root. Specifying
24477 @option{-mpowerpc-gfxopt} allows GCC to
24478 use the optional PowerPC architecture instructions in the Graphics
24479 group, including floating-point select.
24481 The @option{-mmfcrf} option allows GCC to generate the move from
24482 condition register field instruction implemented on the POWER4
24483 processor and other processors that support the PowerPC V2.01
24485 The @option{-mpopcntb} option allows GCC to generate the popcount and
24486 double-precision FP reciprocal estimate instruction implemented on the
24487 POWER5 processor and other processors that support the PowerPC V2.02
24489 The @option{-mpopcntd} option allows GCC to generate the popcount
24490 instruction implemented on the POWER7 processor and other processors
24491 that support the PowerPC V2.06 architecture.
24492 The @option{-mfprnd} option allows GCC to generate the FP round to
24493 integer instructions implemented on the POWER5+ processor and other
24494 processors that support the PowerPC V2.03 architecture.
24495 The @option{-mcmpb} option allows GCC to generate the compare bytes
24496 instruction implemented on the POWER6 processor and other processors
24497 that support the PowerPC V2.05 architecture.
24498 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
24499 general-purpose register instructions implemented on the POWER6X
24500 processor and other processors that support the extended PowerPC V2.05
24502 The @option{-mhard-dfp} option allows GCC to generate the decimal
24503 floating-point instructions implemented on some POWER processors.
24505 The @option{-mpowerpc64} option allows GCC to generate the additional
24506 64-bit instructions that are found in the full PowerPC64 architecture
24507 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24508 @option{-mno-powerpc64}.
24510 @item -mcpu=@var{cpu_type}
24512 Set architecture type, register usage, and
24513 instruction scheduling parameters for machine type @var{cpu_type}.
24514 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
24515 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
24516 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
24517 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
24518 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
24519 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
24520 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
24521 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
24522 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
24523 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
24524 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
24525 @samp{rs64}, and @samp{native}.
24527 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
24528 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
24529 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
24530 architecture machine types, with an appropriate, generic processor
24531 model assumed for scheduling purposes.
24533 Specifying @samp{native} as cpu type detects and selects the
24534 architecture option that corresponds to the host processor of the
24535 system performing the compilation.
24536 @option{-mcpu=native} has no effect if GCC does not recognize the
24539 The other options specify a specific processor. Code generated under
24540 those options runs best on that processor, and may not run at all on
24543 The @option{-mcpu} options automatically enable or disable the
24546 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
24547 -mpopcntb -mpopcntd -mpowerpc64 @gol
24548 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
24549 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
24550 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
24551 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
24553 The particular options set for any particular CPU varies between
24554 compiler versions, depending on what setting seems to produce optimal
24555 code for that CPU; it doesn't necessarily reflect the actual hardware's
24556 capabilities. If you wish to set an individual option to a particular
24557 value, you may specify it after the @option{-mcpu} option, like
24558 @option{-mcpu=970 -mno-altivec}.
24560 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
24561 not enabled or disabled by the @option{-mcpu} option at present because
24562 AIX does not have full support for these options. You may still
24563 enable or disable them individually if you're sure it'll work in your
24566 @item -mtune=@var{cpu_type}
24568 Set the instruction scheduling parameters for machine type
24569 @var{cpu_type}, but do not set the architecture type or register usage,
24570 as @option{-mcpu=@var{cpu_type}} does. The same
24571 values for @var{cpu_type} are used for @option{-mtune} as for
24572 @option{-mcpu}. If both are specified, the code generated uses the
24573 architecture and registers set by @option{-mcpu}, but the
24574 scheduling parameters set by @option{-mtune}.
24576 @item -mcmodel=small
24577 @opindex mcmodel=small
24578 Generate PowerPC64 code for the small model: The TOC is limited to
24581 @item -mcmodel=medium
24582 @opindex mcmodel=medium
24583 Generate PowerPC64 code for the medium model: The TOC and other static
24584 data may be up to a total of 4G in size. This is the default for 64-bit
24587 @item -mcmodel=large
24588 @opindex mcmodel=large
24589 Generate PowerPC64 code for the large model: The TOC may be up to 4G
24590 in size. Other data and code is only limited by the 64-bit address
24594 @itemx -mno-altivec
24596 @opindex mno-altivec
24597 Generate code that uses (does not use) AltiVec instructions, and also
24598 enable the use of built-in functions that allow more direct access to
24599 the AltiVec instruction set. You may also need to set
24600 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
24603 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
24604 @option{-maltivec=be}, the element order for AltiVec intrinsics such
24605 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
24606 match array element order corresponding to the endianness of the
24607 target. That is, element zero identifies the leftmost element in a
24608 vector register when targeting a big-endian platform, and identifies
24609 the rightmost element in a vector register when targeting a
24610 little-endian platform.
24613 @opindex maltivec=be
24614 Generate AltiVec instructions using big-endian element order,
24615 regardless of whether the target is big- or little-endian. This is
24616 the default when targeting a big-endian platform. Using this option
24617 is currently deprecated. Support for this feature will be removed in
24620 The element order is used to interpret element numbers in AltiVec
24621 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
24622 @code{vec_insert}. By default, these match array element order
24623 corresponding to the endianness for the target.
24626 @opindex maltivec=le
24627 Generate AltiVec instructions using little-endian element order,
24628 regardless of whether the target is big- or little-endian. This is
24629 the default when targeting a little-endian platform. This option is
24630 currently ignored when targeting a big-endian platform.
24632 The element order is used to interpret element numbers in AltiVec
24633 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
24634 @code{vec_insert}. By default, these match array element order
24635 corresponding to the endianness for the target.
24640 @opindex mno-vrsave
24641 Generate VRSAVE instructions when generating AltiVec code.
24644 @opindex msecure-plt
24645 Generate code that allows @command{ld} and @command{ld.so}
24646 to build executables and shared
24647 libraries with non-executable @code{.plt} and @code{.got} sections.
24649 32-bit SYSV ABI option.
24653 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
24655 requires @code{.plt} and @code{.got}
24656 sections that are both writable and executable.
24657 This is a PowerPC 32-bit SYSV ABI option.
24663 This switch enables or disables the generation of ISEL instructions.
24669 Generate code that uses (does not use) vector/scalar (VSX)
24670 instructions, and also enable the use of built-in functions that allow
24671 more direct access to the VSX instruction set.
24676 @opindex mno-crypto
24677 Enable the use (disable) of the built-in functions that allow direct
24678 access to the cryptographic instructions that were added in version
24679 2.07 of the PowerPC ISA.
24685 Enable (disable) the use of the built-in functions that allow direct
24686 access to the Hardware Transactional Memory (HTM) instructions that
24687 were added in version 2.07 of the PowerPC ISA.
24689 @item -mpower8-fusion
24690 @itemx -mno-power8-fusion
24691 @opindex mpower8-fusion
24692 @opindex mno-power8-fusion
24693 Generate code that keeps (does not keeps) some integer operations
24694 adjacent so that the instructions can be fused together on power8 and
24697 @item -mpower8-vector
24698 @itemx -mno-power8-vector
24699 @opindex mpower8-vector
24700 @opindex mno-power8-vector
24701 Generate code that uses (does not use) the vector and scalar
24702 instructions that were added in version 2.07 of the PowerPC ISA. Also
24703 enable the use of built-in functions that allow more direct access to
24704 the vector instructions.
24706 @item -mquad-memory
24707 @itemx -mno-quad-memory
24708 @opindex mquad-memory
24709 @opindex mno-quad-memory
24710 Generate code that uses (does not use) the non-atomic quad word memory
24711 instructions. The @option{-mquad-memory} option requires use of
24714 @item -mquad-memory-atomic
24715 @itemx -mno-quad-memory-atomic
24716 @opindex mquad-memory-atomic
24717 @opindex mno-quad-memory-atomic
24718 Generate code that uses (does not use) the atomic quad word memory
24719 instructions. The @option{-mquad-memory-atomic} option requires use of
24723 @itemx -mno-float128
24725 @opindex mno-float128
24726 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24727 and use either software emulation for IEEE 128-bit floating point or
24728 hardware instructions.
24730 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24731 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24732 use the IEEE 128-bit floating point support. The IEEE 128-bit
24733 floating point support only works on PowerPC Linux systems.
24735 The default for @option{-mfloat128} is enabled on PowerPC Linux
24736 systems using the VSX instruction set, and disabled on other systems.
24738 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24739 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24740 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24741 floating point instructions. Otherwise, if you do not specify to
24742 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24743 system, IEEE 128-bit floating point will be done with software
24746 @item -mfloat128-hardware
24747 @itemx -mno-float128-hardware
24748 @opindex mfloat128-hardware
24749 @opindex mno-float128-hardware
24750 Enable/disable using ISA 3.0 hardware instructions to support the
24751 @var{__float128} data type.
24753 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24754 Linux systems using the ISA 3.0 instruction set, and disabled on other
24761 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24762 targets (including GNU/Linux). The 32-bit environment sets int, long
24763 and pointer to 32 bits and generates code that runs on any PowerPC
24764 variant. The 64-bit environment sets int to 32 bits and long and
24765 pointer to 64 bits, and generates code for PowerPC64, as for
24766 @option{-mpowerpc64}.
24769 @itemx -mno-fp-in-toc
24770 @itemx -mno-sum-in-toc
24771 @itemx -mminimal-toc
24773 @opindex mno-fp-in-toc
24774 @opindex mno-sum-in-toc
24775 @opindex mminimal-toc
24776 Modify generation of the TOC (Table Of Contents), which is created for
24777 every executable file. The @option{-mfull-toc} option is selected by
24778 default. In that case, GCC allocates at least one TOC entry for
24779 each unique non-automatic variable reference in your program. GCC
24780 also places floating-point constants in the TOC@. However, only
24781 16,384 entries are available in the TOC@.
24783 If you receive a linker error message that saying you have overflowed
24784 the available TOC space, you can reduce the amount of TOC space used
24785 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24786 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24787 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24788 generate code to calculate the sum of an address and a constant at
24789 run time instead of putting that sum into the TOC@. You may specify one
24790 or both of these options. Each causes GCC to produce very slightly
24791 slower and larger code at the expense of conserving TOC space.
24793 If you still run out of space in the TOC even when you specify both of
24794 these options, specify @option{-mminimal-toc} instead. This option causes
24795 GCC to make only one TOC entry for every file. When you specify this
24796 option, GCC produces code that is slower and larger but which
24797 uses extremely little TOC space. You may wish to use this option
24798 only on files that contain less frequently-executed code.
24804 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24805 @code{long} type, and the infrastructure needed to support them.
24806 Specifying @option{-maix64} implies @option{-mpowerpc64},
24807 while @option{-maix32} disables the 64-bit ABI and
24808 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
24811 @itemx -mno-xl-compat
24812 @opindex mxl-compat
24813 @opindex mno-xl-compat
24814 Produce code that conforms more closely to IBM XL compiler semantics
24815 when using AIX-compatible ABI@. Pass floating-point arguments to
24816 prototyped functions beyond the register save area (RSA) on the stack
24817 in addition to argument FPRs. Do not assume that most significant
24818 double in 128-bit long double value is properly rounded when comparing
24819 values and converting to double. Use XL symbol names for long double
24822 The AIX calling convention was extended but not initially documented to
24823 handle an obscure K&R C case of calling a function that takes the
24824 address of its arguments with fewer arguments than declared. IBM XL
24825 compilers access floating-point arguments that do not fit in the
24826 RSA from the stack when a subroutine is compiled without
24827 optimization. Because always storing floating-point arguments on the
24828 stack is inefficient and rarely needed, this option is not enabled by
24829 default and only is necessary when calling subroutines compiled by IBM
24830 XL compilers without optimization.
24834 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
24835 application written to use message passing with special startup code to
24836 enable the application to run. The system must have PE installed in the
24837 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24838 must be overridden with the @option{-specs=} option to specify the
24839 appropriate directory location. The Parallel Environment does not
24840 support threads, so the @option{-mpe} option and the @option{-pthread}
24841 option are incompatible.
24843 @item -malign-natural
24844 @itemx -malign-power
24845 @opindex malign-natural
24846 @opindex malign-power
24847 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24848 @option{-malign-natural} overrides the ABI-defined alignment of larger
24849 types, such as floating-point doubles, on their natural size-based boundary.
24850 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24851 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
24853 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24857 @itemx -mhard-float
24858 @opindex msoft-float
24859 @opindex mhard-float
24860 Generate code that does not use (uses) the floating-point register set.
24861 Software floating-point emulation is provided if you use the
24862 @option{-msoft-float} option, and pass the option to GCC when linking.
24865 @itemx -mno-multiple
24867 @opindex mno-multiple
24868 Generate code that uses (does not use) the load multiple word
24869 instructions and the store multiple word instructions. These
24870 instructions are generated by default on POWER systems, and not
24871 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
24872 PowerPC systems, since those instructions do not work when the
24873 processor is in little-endian mode. The exceptions are PPC740 and
24874 PPC750 which permit these instructions in little-endian mode.
24879 @opindex mno-update
24880 Generate code that uses (does not use) the load or store instructions
24881 that update the base register to the address of the calculated memory
24882 location. These instructions are generated by default. If you use
24883 @option{-mno-update}, there is a small window between the time that the
24884 stack pointer is updated and the address of the previous frame is
24885 stored, which means code that walks the stack frame across interrupts or
24886 signals may get corrupted data.
24888 @item -mavoid-indexed-addresses
24889 @itemx -mno-avoid-indexed-addresses
24890 @opindex mavoid-indexed-addresses
24891 @opindex mno-avoid-indexed-addresses
24892 Generate code that tries to avoid (not avoid) the use of indexed load
24893 or store instructions. These instructions can incur a performance
24894 penalty on Power6 processors in certain situations, such as when
24895 stepping through large arrays that cross a 16M boundary. This option
24896 is enabled by default when targeting Power6 and disabled otherwise.
24899 @itemx -mno-fused-madd
24900 @opindex mfused-madd
24901 @opindex mno-fused-madd
24902 Generate code that uses (does not use) the floating-point multiply and
24903 accumulate instructions. These instructions are generated by default
24904 if hardware floating point is used. The machine-dependent
24905 @option{-mfused-madd} option is now mapped to the machine-independent
24906 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24907 mapped to @option{-ffp-contract=off}.
24913 Generate code that uses (does not use) the half-word multiply and
24914 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24915 These instructions are generated by default when targeting those
24922 Generate code that uses (does not use) the string-search @samp{dlmzb}
24923 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
24924 generated by default when targeting those processors.
24926 @item -mno-bit-align
24928 @opindex mno-bit-align
24929 @opindex mbit-align
24930 On System V.4 and embedded PowerPC systems do not (do) force structures
24931 and unions that contain bit-fields to be aligned to the base type of the
24934 For example, by default a structure containing nothing but 8
24935 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24936 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
24937 the structure is aligned to a 1-byte boundary and is 1 byte in
24940 @item -mno-strict-align
24941 @itemx -mstrict-align
24942 @opindex mno-strict-align
24943 @opindex mstrict-align
24944 On System V.4 and embedded PowerPC systems do not (do) assume that
24945 unaligned memory references are handled by the system.
24947 @item -mrelocatable
24948 @itemx -mno-relocatable
24949 @opindex mrelocatable
24950 @opindex mno-relocatable
24951 Generate code that allows (does not allow) a static executable to be
24952 relocated to a different address at run time. A simple embedded
24953 PowerPC system loader should relocate the entire contents of
24954 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24955 a table of 32-bit addresses generated by this option. For this to
24956 work, all objects linked together must be compiled with
24957 @option{-mrelocatable} or @option{-mrelocatable-lib}.
24958 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24960 @item -mrelocatable-lib
24961 @itemx -mno-relocatable-lib
24962 @opindex mrelocatable-lib
24963 @opindex mno-relocatable-lib
24964 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24965 @code{.fixup} section to allow static executables to be relocated at
24966 run time, but @option{-mrelocatable-lib} does not use the smaller stack
24967 alignment of @option{-mrelocatable}. Objects compiled with
24968 @option{-mrelocatable-lib} may be linked with objects compiled with
24969 any combination of the @option{-mrelocatable} options.
24975 On System V.4 and embedded PowerPC systems do not (do) assume that
24976 register 2 contains a pointer to a global area pointing to the addresses
24977 used in the program.
24980 @itemx -mlittle-endian
24982 @opindex mlittle-endian
24983 On System V.4 and embedded PowerPC systems compile code for the
24984 processor in little-endian mode. The @option{-mlittle-endian} option is
24985 the same as @option{-mlittle}.
24988 @itemx -mbig-endian
24990 @opindex mbig-endian
24991 On System V.4 and embedded PowerPC systems compile code for the
24992 processor in big-endian mode. The @option{-mbig-endian} option is
24993 the same as @option{-mbig}.
24995 @item -mdynamic-no-pic
24996 @opindex mdynamic-no-pic
24997 On Darwin and Mac OS X systems, compile code so that it is not
24998 relocatable, but that its external references are relocatable. The
24999 resulting code is suitable for applications, but not shared
25002 @item -msingle-pic-base
25003 @opindex msingle-pic-base
25004 Treat the register used for PIC addressing as read-only, rather than
25005 loading it in the prologue for each function. The runtime system is
25006 responsible for initializing this register with an appropriate value
25007 before execution begins.
25009 @item -mprioritize-restricted-insns=@var{priority}
25010 @opindex mprioritize-restricted-insns
25011 This option controls the priority that is assigned to
25012 dispatch-slot restricted instructions during the second scheduling
25013 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
25014 or @samp{2} to assign no, highest, or second-highest (respectively)
25015 priority to dispatch-slot restricted
25018 @item -msched-costly-dep=@var{dependence_type}
25019 @opindex msched-costly-dep
25020 This option controls which dependences are considered costly
25021 by the target during instruction scheduling. The argument
25022 @var{dependence_type} takes one of the following values:
25026 No dependence is costly.
25029 All dependences are costly.
25031 @item @samp{true_store_to_load}
25032 A true dependence from store to load is costly.
25034 @item @samp{store_to_load}
25035 Any dependence from store to load is costly.
25038 Any dependence for which the latency is greater than or equal to
25039 @var{number} is costly.
25042 @item -minsert-sched-nops=@var{scheme}
25043 @opindex minsert-sched-nops
25044 This option controls which NOP insertion scheme is used during
25045 the second scheduling pass. The argument @var{scheme} takes one of the
25053 Pad with NOPs any dispatch group that has vacant issue slots,
25054 according to the scheduler's grouping.
25056 @item @samp{regroup_exact}
25057 Insert NOPs to force costly dependent insns into
25058 separate groups. Insert exactly as many NOPs as needed to force an insn
25059 to a new group, according to the estimated processor grouping.
25062 Insert NOPs to force costly dependent insns into
25063 separate groups. Insert @var{number} NOPs to force an insn to a new group.
25067 @opindex mcall-sysv
25068 On System V.4 and embedded PowerPC systems compile code using calling
25069 conventions that adhere to the March 1995 draft of the System V
25070 Application Binary Interface, PowerPC processor supplement. This is the
25071 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
25073 @item -mcall-sysv-eabi
25075 @opindex mcall-sysv-eabi
25076 @opindex mcall-eabi
25077 Specify both @option{-mcall-sysv} and @option{-meabi} options.
25079 @item -mcall-sysv-noeabi
25080 @opindex mcall-sysv-noeabi
25081 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
25083 @item -mcall-aixdesc
25085 On System V.4 and embedded PowerPC systems compile code for the AIX
25089 @opindex mcall-linux
25090 On System V.4 and embedded PowerPC systems compile code for the
25091 Linux-based GNU system.
25093 @item -mcall-freebsd
25094 @opindex mcall-freebsd
25095 On System V.4 and embedded PowerPC systems compile code for the
25096 FreeBSD operating system.
25098 @item -mcall-netbsd
25099 @opindex mcall-netbsd
25100 On System V.4 and embedded PowerPC systems compile code for the
25101 NetBSD operating system.
25103 @item -mcall-openbsd
25104 @opindex mcall-netbsd
25105 On System V.4 and embedded PowerPC systems compile code for the
25106 OpenBSD operating system.
25108 @item -mtraceback=@var{traceback_type}
25109 @opindex mtraceback
25110 Select the type of traceback table. Valid values for @var{traceback_type}
25111 are @samp{full}, @samp{part}, and @samp{no}.
25113 @item -maix-struct-return
25114 @opindex maix-struct-return
25115 Return all structures in memory (as specified by the AIX ABI)@.
25117 @item -msvr4-struct-return
25118 @opindex msvr4-struct-return
25119 Return structures smaller than 8 bytes in registers (as specified by the
25122 @item -mabi=@var{abi-type}
25124 Extend the current ABI with a particular extension, or remove such extension.
25125 Valid values are @samp{altivec}, @samp{no-altivec},
25126 @samp{ibmlongdouble}, @samp{ieeelongdouble},
25127 @samp{elfv1}, @samp{elfv2}@.
25129 @item -mabi=ibmlongdouble
25130 @opindex mabi=ibmlongdouble
25131 Change the current ABI to use IBM extended-precision long double.
25132 This is not likely to work if your system defaults to using IEEE
25133 extended-precision long double. If you change the long double type
25134 from IEEE extended-precision, the compiler will issue a warning unless
25135 you use the @option{-Wno-psabi} option.
25137 @item -mabi=ieeelongdouble
25138 @opindex mabi=ieeelongdouble
25139 Change the current ABI to use IEEE extended-precision long double.
25140 This is not likely to work if your system defaults to using IBM
25141 extended-precision long double. If you change the long double type
25142 from IBM extended-precision, the compiler will issue a warning unless
25143 you use the @option{-Wno-psabi} option.
25146 @opindex mabi=elfv1
25147 Change the current ABI to use the ELFv1 ABI.
25148 This is the default ABI for big-endian PowerPC 64-bit Linux.
25149 Overriding the default ABI requires special system support and is
25150 likely to fail in spectacular ways.
25153 @opindex mabi=elfv2
25154 Change the current ABI to use the ELFv2 ABI.
25155 This is the default ABI for little-endian PowerPC 64-bit Linux.
25156 Overriding the default ABI requires special system support and is
25157 likely to fail in spectacular ways.
25159 @item -mgnu-attribute
25160 @itemx -mno-gnu-attribute
25161 @opindex mgnu-attribute
25162 @opindex mno-gnu-attribute
25163 Emit .gnu_attribute assembly directives to set tag/value pairs in a
25164 .gnu.attributes section that specify ABI variations in function
25165 parameters or return values.
25168 @itemx -mno-prototype
25169 @opindex mprototype
25170 @opindex mno-prototype
25171 On System V.4 and embedded PowerPC systems assume that all calls to
25172 variable argument functions are properly prototyped. Otherwise, the
25173 compiler must insert an instruction before every non-prototyped call to
25174 set or clear bit 6 of the condition code register (@code{CR}) to
25175 indicate whether floating-point values are passed in the floating-point
25176 registers in case the function takes variable arguments. With
25177 @option{-mprototype}, only calls to prototyped variable argument functions
25178 set or clear the bit.
25182 On embedded PowerPC systems, assume that the startup module is called
25183 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
25184 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
25189 On embedded PowerPC systems, assume that the startup module is called
25190 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
25195 On embedded PowerPC systems, assume that the startup module is called
25196 @file{crt0.o} and the standard C libraries are @file{libads.a} and
25199 @item -myellowknife
25200 @opindex myellowknife
25201 On embedded PowerPC systems, assume that the startup module is called
25202 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
25207 On System V.4 and embedded PowerPC systems, specify that you are
25208 compiling for a VxWorks system.
25212 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
25213 header to indicate that @samp{eabi} extended relocations are used.
25219 On System V.4 and embedded PowerPC systems do (do not) adhere to the
25220 Embedded Applications Binary Interface (EABI), which is a set of
25221 modifications to the System V.4 specifications. Selecting @option{-meabi}
25222 means that the stack is aligned to an 8-byte boundary, a function
25223 @code{__eabi} is called from @code{main} to set up the EABI
25224 environment, and the @option{-msdata} option can use both @code{r2} and
25225 @code{r13} to point to two separate small data areas. Selecting
25226 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
25227 no EABI initialization function is called from @code{main}, and the
25228 @option{-msdata} option only uses @code{r13} to point to a single
25229 small data area. The @option{-meabi} option is on by default if you
25230 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
25233 @opindex msdata=eabi
25234 On System V.4 and embedded PowerPC systems, put small initialized
25235 @code{const} global and static data in the @code{.sdata2} section, which
25236 is pointed to by register @code{r2}. Put small initialized
25237 non-@code{const} global and static data in the @code{.sdata} section,
25238 which is pointed to by register @code{r13}. Put small uninitialized
25239 global and static data in the @code{.sbss} section, which is adjacent to
25240 the @code{.sdata} section. The @option{-msdata=eabi} option is
25241 incompatible with the @option{-mrelocatable} option. The
25242 @option{-msdata=eabi} option also sets the @option{-memb} option.
25245 @opindex msdata=sysv
25246 On System V.4 and embedded PowerPC systems, put small global and static
25247 data in the @code{.sdata} section, which is pointed to by register
25248 @code{r13}. Put small uninitialized global and static data in the
25249 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
25250 The @option{-msdata=sysv} option is incompatible with the
25251 @option{-mrelocatable} option.
25253 @item -msdata=default
25255 @opindex msdata=default
25257 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
25258 compile code the same as @option{-msdata=eabi}, otherwise compile code the
25259 same as @option{-msdata=sysv}.
25262 @opindex msdata=data
25263 On System V.4 and embedded PowerPC systems, put small global
25264 data in the @code{.sdata} section. Put small uninitialized global
25265 data in the @code{.sbss} section. Do not use register @code{r13}
25266 to address small data however. This is the default behavior unless
25267 other @option{-msdata} options are used.
25271 @opindex msdata=none
25273 On embedded PowerPC systems, put all initialized global and static data
25274 in the @code{.data} section, and all uninitialized data in the
25275 @code{.bss} section.
25277 @item -mreadonly-in-sdata
25278 @opindex mreadonly-in-sdata
25279 @opindex mno-readonly-in-sdata
25280 Put read-only objects in the @code{.sdata} section as well. This is the
25283 @item -mblock-move-inline-limit=@var{num}
25284 @opindex mblock-move-inline-limit
25285 Inline all block moves (such as calls to @code{memcpy} or structure
25286 copies) less than or equal to @var{num} bytes. The minimum value for
25287 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
25288 targets. The default value is target-specific.
25290 @item -mblock-compare-inline-limit=@var{num}
25291 @opindex mblock-compare-inline-limit
25292 Generate non-looping inline code for all block compares (such as calls
25293 to @code{memcmp} or structure compares) less than or equal to @var{num}
25294 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
25295 block compare is disabled. The default value is target-specific.
25297 @item -mblock-compare-inline-loop-limit=@var{num}
25298 @opindex mblock-compare-inline-loop-limit
25299 Generate an inline expansion using loop code for all block compares that
25300 are less than or equal to @var{num} bytes, but greater than the limit
25301 for non-loop inline block compare expansion. If the block length is not
25302 constant, at most @var{num} bytes will be compared before @code{memcmp}
25303 is called to compare the remainder of the block. The default value is
25306 @item -mstring-compare-inline-limit=@var{num}
25307 @opindex mstring-compare-inline-limit
25308 Compare at most @var{num} string bytes with inline code.
25309 If the difference or end of string is not found at the
25310 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
25311 take care of the rest of the comparison. The default is 64 bytes.
25315 @cindex smaller data references (PowerPC)
25316 @cindex .sdata/.sdata2 references (PowerPC)
25317 On embedded PowerPC systems, put global and static items less than or
25318 equal to @var{num} bytes into the small data or BSS sections instead of
25319 the normal data or BSS section. By default, @var{num} is 8. The
25320 @option{-G @var{num}} switch is also passed to the linker.
25321 All modules should be compiled with the same @option{-G @var{num}} value.
25324 @itemx -mno-regnames
25326 @opindex mno-regnames
25327 On System V.4 and embedded PowerPC systems do (do not) emit register
25328 names in the assembly language output using symbolic forms.
25331 @itemx -mno-longcall
25333 @opindex mno-longcall
25334 By default assume that all calls are far away so that a longer and more
25335 expensive calling sequence is required. This is required for calls
25336 farther than 32 megabytes (33,554,432 bytes) from the current location.
25337 A short call is generated if the compiler knows
25338 the call cannot be that far away. This setting can be overridden by
25339 the @code{shortcall} function attribute, or by @code{#pragma
25342 Some linkers are capable of detecting out-of-range calls and generating
25343 glue code on the fly. On these systems, long calls are unnecessary and
25344 generate slower code. As of this writing, the AIX linker can do this,
25345 as can the GNU linker for PowerPC/64. It is planned to add this feature
25346 to the GNU linker for 32-bit PowerPC systems as well.
25348 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
25349 callee, L42}, plus a @dfn{branch island} (glue code). The two target
25350 addresses represent the callee and the branch island. The
25351 Darwin/PPC linker prefers the first address and generates a @code{bl
25352 callee} if the PPC @code{bl} instruction reaches the callee directly;
25353 otherwise, the linker generates @code{bl L42} to call the branch
25354 island. The branch island is appended to the body of the
25355 calling function; it computes the full 32-bit address of the callee
25358 On Mach-O (Darwin) systems, this option directs the compiler emit to
25359 the glue for every direct call, and the Darwin linker decides whether
25360 to use or discard it.
25362 In the future, GCC may ignore all longcall specifications
25363 when the linker is known to generate glue.
25365 @item -mtls-markers
25366 @itemx -mno-tls-markers
25367 @opindex mtls-markers
25368 @opindex mno-tls-markers
25369 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
25370 specifying the function argument. The relocation allows the linker to
25371 reliably associate function call with argument setup instructions for
25372 TLS optimization, which in turn allows GCC to better schedule the
25378 This option enables use of the reciprocal estimate and
25379 reciprocal square root estimate instructions with additional
25380 Newton-Raphson steps to increase precision instead of doing a divide or
25381 square root and divide for floating-point arguments. You should use
25382 the @option{-ffast-math} option when using @option{-mrecip} (or at
25383 least @option{-funsafe-math-optimizations},
25384 @option{-ffinite-math-only}, @option{-freciprocal-math} and
25385 @option{-fno-trapping-math}). Note that while the throughput of the
25386 sequence is generally higher than the throughput of the non-reciprocal
25387 instruction, the precision of the sequence can be decreased by up to 2
25388 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
25391 @item -mrecip=@var{opt}
25392 @opindex mrecip=opt
25393 This option controls which reciprocal estimate instructions
25394 may be used. @var{opt} is a comma-separated list of options, which may
25395 be preceded by a @code{!} to invert the option:
25400 Enable all estimate instructions.
25403 Enable the default instructions, equivalent to @option{-mrecip}.
25406 Disable all estimate instructions, equivalent to @option{-mno-recip}.
25409 Enable the reciprocal approximation instructions for both
25410 single and double precision.
25413 Enable the single-precision reciprocal approximation instructions.
25416 Enable the double-precision reciprocal approximation instructions.
25419 Enable the reciprocal square root approximation instructions for both
25420 single and double precision.
25423 Enable the single-precision reciprocal square root approximation instructions.
25426 Enable the double-precision reciprocal square root approximation instructions.
25430 So, for example, @option{-mrecip=all,!rsqrtd} enables
25431 all of the reciprocal estimate instructions, except for the
25432 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
25433 which handle the double-precision reciprocal square root calculations.
25435 @item -mrecip-precision
25436 @itemx -mno-recip-precision
25437 @opindex mrecip-precision
25438 Assume (do not assume) that the reciprocal estimate instructions
25439 provide higher-precision estimates than is mandated by the PowerPC
25440 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
25441 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
25442 The double-precision square root estimate instructions are not generated by
25443 default on low-precision machines, since they do not provide an
25444 estimate that converges after three steps.
25446 @item -mveclibabi=@var{type}
25447 @opindex mveclibabi
25448 Specifies the ABI type to use for vectorizing intrinsics using an
25449 external library. The only type supported at present is @samp{mass},
25450 which specifies to use IBM's Mathematical Acceleration Subsystem
25451 (MASS) libraries for vectorizing intrinsics using external libraries.
25452 GCC currently emits calls to @code{acosd2}, @code{acosf4},
25453 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
25454 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
25455 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
25456 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
25457 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
25458 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
25459 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
25460 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
25461 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
25462 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
25463 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
25464 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
25465 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
25466 for power7. Both @option{-ftree-vectorize} and
25467 @option{-funsafe-math-optimizations} must also be enabled. The MASS
25468 libraries must be specified at link time.
25473 Generate (do not generate) the @code{friz} instruction when the
25474 @option{-funsafe-math-optimizations} option is used to optimize
25475 rounding of floating-point values to 64-bit integer and back to floating
25476 point. The @code{friz} instruction does not return the same value if
25477 the floating-point number is too large to fit in an integer.
25479 @item -mpointers-to-nested-functions
25480 @itemx -mno-pointers-to-nested-functions
25481 @opindex mpointers-to-nested-functions
25482 Generate (do not generate) code to load up the static chain register
25483 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
25484 systems where a function pointer points to a 3-word descriptor giving
25485 the function address, TOC value to be loaded in register @code{r2}, and
25486 static chain value to be loaded in register @code{r11}. The
25487 @option{-mpointers-to-nested-functions} is on by default. You cannot
25488 call through pointers to nested functions or pointers
25489 to functions compiled in other languages that use the static chain if
25490 you use @option{-mno-pointers-to-nested-functions}.
25492 @item -msave-toc-indirect
25493 @itemx -mno-save-toc-indirect
25494 @opindex msave-toc-indirect
25495 Generate (do not generate) code to save the TOC value in the reserved
25496 stack location in the function prologue if the function calls through
25497 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
25498 saved in the prologue, it is saved just before the call through the
25499 pointer. The @option{-mno-save-toc-indirect} option is the default.
25501 @item -mcompat-align-parm
25502 @itemx -mno-compat-align-parm
25503 @opindex mcompat-align-parm
25504 Generate (do not generate) code to pass structure parameters with a
25505 maximum alignment of 64 bits, for compatibility with older versions
25508 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25509 structure parameter on a 128-bit boundary when that structure contained
25510 a member requiring 128-bit alignment. This is corrected in more
25511 recent versions of GCC. This option may be used to generate code
25512 that is compatible with functions compiled with older versions of
25515 The @option{-mno-compat-align-parm} option is the default.
25517 @item -mstack-protector-guard=@var{guard}
25518 @itemx -mstack-protector-guard-reg=@var{reg}
25519 @itemx -mstack-protector-guard-offset=@var{offset}
25520 @itemx -mstack-protector-guard-symbol=@var{symbol}
25521 @opindex mstack-protector-guard
25522 @opindex mstack-protector-guard-reg
25523 @opindex mstack-protector-guard-offset
25524 @opindex mstack-protector-guard-symbol
25525 Generate stack protection code using canary at @var{guard}. Supported
25526 locations are @samp{global} for global canary or @samp{tls} for per-thread
25527 canary in the TLS block (the default with GNU libc version 2.4 or later).
25529 With the latter choice the options
25530 @option{-mstack-protector-guard-reg=@var{reg}} and
25531 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25532 which register to use as base register for reading the canary, and from what
25533 offset from that base register. The default for those is as specified in the
25534 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
25535 the offset with a symbol reference to a canary in the TLS block.
25539 @subsection RX Options
25542 These command-line options are defined for RX targets:
25545 @item -m64bit-doubles
25546 @itemx -m32bit-doubles
25547 @opindex m64bit-doubles
25548 @opindex m32bit-doubles
25549 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25550 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25551 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
25552 works on 32-bit values, which is why the default is
25553 @option{-m32bit-doubles}.
25559 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
25560 floating-point hardware. The default is enabled for the RX600
25561 series and disabled for the RX200 series.
25563 Floating-point instructions are only generated for 32-bit floating-point
25564 values, however, so the FPU hardware is not used for doubles if the
25565 @option{-m64bit-doubles} option is used.
25567 @emph{Note} If the @option{-fpu} option is enabled then
25568 @option{-funsafe-math-optimizations} is also enabled automatically.
25569 This is because the RX FPU instructions are themselves unsafe.
25571 @item -mcpu=@var{name}
25573 Selects the type of RX CPU to be targeted. Currently three types are
25574 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
25575 the specific @samp{RX610} CPU. The default is @samp{RX600}.
25577 The only difference between @samp{RX600} and @samp{RX610} is that the
25578 @samp{RX610} does not support the @code{MVTIPL} instruction.
25580 The @samp{RX200} series does not have a hardware floating-point unit
25581 and so @option{-nofpu} is enabled by default when this type is
25584 @item -mbig-endian-data
25585 @itemx -mlittle-endian-data
25586 @opindex mbig-endian-data
25587 @opindex mlittle-endian-data
25588 Store data (but not code) in the big-endian format. The default is
25589 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
25592 @item -msmall-data-limit=@var{N}
25593 @opindex msmall-data-limit
25594 Specifies the maximum size in bytes of global and static variables
25595 which can be placed into the small data area. Using the small data
25596 area can lead to smaller and faster code, but the size of area is
25597 limited and it is up to the programmer to ensure that the area does
25598 not overflow. Also when the small data area is used one of the RX's
25599 registers (usually @code{r13}) is reserved for use pointing to this
25600 area, so it is no longer available for use by the compiler. This
25601 could result in slower and/or larger code if variables are pushed onto
25602 the stack instead of being held in this register.
25604 Note, common variables (variables that have not been initialized) and
25605 constants are not placed into the small data area as they are assigned
25606 to other sections in the output executable.
25608 The default value is zero, which disables this feature. Note, this
25609 feature is not enabled by default with higher optimization levels
25610 (@option{-O2} etc) because of the potentially detrimental effects of
25611 reserving a register. It is up to the programmer to experiment and
25612 discover whether this feature is of benefit to their program. See the
25613 description of the @option{-mpid} option for a description of how the
25614 actual register to hold the small data area pointer is chosen.
25620 Use the simulator runtime. The default is to use the libgloss
25621 board-specific runtime.
25623 @item -mas100-syntax
25624 @itemx -mno-as100-syntax
25625 @opindex mas100-syntax
25626 @opindex mno-as100-syntax
25627 When generating assembler output use a syntax that is compatible with
25628 Renesas's AS100 assembler. This syntax can also be handled by the GAS
25629 assembler, but it has some restrictions so it is not generated by default.
25631 @item -mmax-constant-size=@var{N}
25632 @opindex mmax-constant-size
25633 Specifies the maximum size, in bytes, of a constant that can be used as
25634 an operand in a RX instruction. Although the RX instruction set does
25635 allow constants of up to 4 bytes in length to be used in instructions,
25636 a longer value equates to a longer instruction. Thus in some
25637 circumstances it can be beneficial to restrict the size of constants
25638 that are used in instructions. Constants that are too big are instead
25639 placed into a constant pool and referenced via register indirection.
25641 The value @var{N} can be between 0 and 4. A value of 0 (the default)
25642 or 4 means that constants of any size are allowed.
25646 Enable linker relaxation. Linker relaxation is a process whereby the
25647 linker attempts to reduce the size of a program by finding shorter
25648 versions of various instructions. Disabled by default.
25650 @item -mint-register=@var{N}
25651 @opindex mint-register
25652 Specify the number of registers to reserve for fast interrupt handler
25653 functions. The value @var{N} can be between 0 and 4. A value of 1
25654 means that register @code{r13} is reserved for the exclusive use
25655 of fast interrupt handlers. A value of 2 reserves @code{r13} and
25656 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
25657 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
25658 A value of 0, the default, does not reserve any registers.
25660 @item -msave-acc-in-interrupts
25661 @opindex msave-acc-in-interrupts
25662 Specifies that interrupt handler functions should preserve the
25663 accumulator register. This is only necessary if normal code might use
25664 the accumulator register, for example because it performs 64-bit
25665 multiplications. The default is to ignore the accumulator as this
25666 makes the interrupt handlers faster.
25672 Enables the generation of position independent data. When enabled any
25673 access to constant data is done via an offset from a base address
25674 held in a register. This allows the location of constant data to be
25675 determined at run time without requiring the executable to be
25676 relocated, which is a benefit to embedded applications with tight
25677 memory constraints. Data that can be modified is not affected by this
25680 Note, using this feature reserves a register, usually @code{r13}, for
25681 the constant data base address. This can result in slower and/or
25682 larger code, especially in complicated functions.
25684 The actual register chosen to hold the constant data base address
25685 depends upon whether the @option{-msmall-data-limit} and/or the
25686 @option{-mint-register} command-line options are enabled. Starting
25687 with register @code{r13} and proceeding downwards, registers are
25688 allocated first to satisfy the requirements of @option{-mint-register},
25689 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
25690 is possible for the small data area register to be @code{r8} if both
25691 @option{-mint-register=4} and @option{-mpid} are specified on the
25694 By default this feature is not enabled. The default can be restored
25695 via the @option{-mno-pid} command-line option.
25697 @item -mno-warn-multiple-fast-interrupts
25698 @itemx -mwarn-multiple-fast-interrupts
25699 @opindex mno-warn-multiple-fast-interrupts
25700 @opindex mwarn-multiple-fast-interrupts
25701 Prevents GCC from issuing a warning message if it finds more than one
25702 fast interrupt handler when it is compiling a file. The default is to
25703 issue a warning for each extra fast interrupt handler found, as the RX
25704 only supports one such interrupt.
25706 @item -mallow-string-insns
25707 @itemx -mno-allow-string-insns
25708 @opindex mallow-string-insns
25709 @opindex mno-allow-string-insns
25710 Enables or disables the use of the string manipulation instructions
25711 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
25712 @code{SWHILE} and also the @code{RMPA} instruction. These
25713 instructions may prefetch data, which is not safe to do if accessing
25714 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
25715 for more information).
25717 The default is to allow these instructions, but it is not possible for
25718 GCC to reliably detect all circumstances where a string instruction
25719 might be used to access an I/O register, so their use cannot be
25720 disabled automatically. Instead it is reliant upon the programmer to
25721 use the @option{-mno-allow-string-insns} option if their program
25722 accesses I/O space.
25724 When the instructions are enabled GCC defines the C preprocessor
25725 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25726 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25732 Use only (or not only) @code{JSR} instructions to access functions.
25733 This option can be used when code size exceeds the range of @code{BSR}
25734 instructions. Note that @option{-mno-jsr} does not mean to not use
25735 @code{JSR} but instead means that any type of branch may be used.
25738 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25739 has special significance to the RX port when used with the
25740 @code{interrupt} function attribute. This attribute indicates a
25741 function intended to process fast interrupts. GCC ensures
25742 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25743 and/or @code{r13} and only provided that the normal use of the
25744 corresponding registers have been restricted via the
25745 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25748 @node S/390 and zSeries Options
25749 @subsection S/390 and zSeries Options
25750 @cindex S/390 and zSeries Options
25752 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25756 @itemx -msoft-float
25757 @opindex mhard-float
25758 @opindex msoft-float
25759 Use (do not use) the hardware floating-point instructions and registers
25760 for floating-point operations. When @option{-msoft-float} is specified,
25761 functions in @file{libgcc.a} are used to perform floating-point
25762 operations. When @option{-mhard-float} is specified, the compiler
25763 generates IEEE floating-point instructions. This is the default.
25766 @itemx -mno-hard-dfp
25768 @opindex mno-hard-dfp
25769 Use (do not use) the hardware decimal-floating-point instructions for
25770 decimal-floating-point operations. When @option{-mno-hard-dfp} is
25771 specified, functions in @file{libgcc.a} are used to perform
25772 decimal-floating-point operations. When @option{-mhard-dfp} is
25773 specified, the compiler generates decimal-floating-point hardware
25774 instructions. This is the default for @option{-march=z9-ec} or higher.
25776 @item -mlong-double-64
25777 @itemx -mlong-double-128
25778 @opindex mlong-double-64
25779 @opindex mlong-double-128
25780 These switches control the size of @code{long double} type. A size
25781 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25782 type. This is the default.
25785 @itemx -mno-backchain
25786 @opindex mbackchain
25787 @opindex mno-backchain
25788 Store (do not store) the address of the caller's frame as backchain pointer
25789 into the callee's stack frame.
25790 A backchain may be needed to allow debugging using tools that do not understand
25791 DWARF call frame information.
25792 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25793 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25794 the backchain is placed into the topmost word of the 96/160 byte register
25797 In general, code compiled with @option{-mbackchain} is call-compatible with
25798 code compiled with @option{-mmo-backchain}; however, use of the backchain
25799 for debugging purposes usually requires that the whole binary is built with
25800 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
25801 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25802 to build a linux kernel use @option{-msoft-float}.
25804 The default is to not maintain the backchain.
25806 @item -mpacked-stack
25807 @itemx -mno-packed-stack
25808 @opindex mpacked-stack
25809 @opindex mno-packed-stack
25810 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
25811 specified, the compiler uses the all fields of the 96/160 byte register save
25812 area only for their default purpose; unused fields still take up stack space.
25813 When @option{-mpacked-stack} is specified, register save slots are densely
25814 packed at the top of the register save area; unused space is reused for other
25815 purposes, allowing for more efficient use of the available stack space.
25816 However, when @option{-mbackchain} is also in effect, the topmost word of
25817 the save area is always used to store the backchain, and the return address
25818 register is always saved two words below the backchain.
25820 As long as the stack frame backchain is not used, code generated with
25821 @option{-mpacked-stack} is call-compatible with code generated with
25822 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
25823 S/390 or zSeries generated code that uses the stack frame backchain at run
25824 time, not just for debugging purposes. Such code is not call-compatible
25825 with code compiled with @option{-mpacked-stack}. Also, note that the
25826 combination of @option{-mbackchain},
25827 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25828 to build a linux kernel use @option{-msoft-float}.
25830 The default is to not use the packed stack layout.
25833 @itemx -mno-small-exec
25834 @opindex msmall-exec
25835 @opindex mno-small-exec
25836 Generate (or do not generate) code using the @code{bras} instruction
25837 to do subroutine calls.
25838 This only works reliably if the total executable size does not
25839 exceed 64k. The default is to use the @code{basr} instruction instead,
25840 which does not have this limitation.
25846 When @option{-m31} is specified, generate code compliant to the
25847 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
25848 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
25849 particular to generate 64-bit instructions. For the @samp{s390}
25850 targets, the default is @option{-m31}, while the @samp{s390x}
25851 targets default to @option{-m64}.
25857 When @option{-mzarch} is specified, generate code using the
25858 instructions available on z/Architecture.
25859 When @option{-mesa} is specified, generate code using the
25860 instructions available on ESA/390. Note that @option{-mesa} is
25861 not possible with @option{-m64}.
25862 When generating code compliant to the GNU/Linux for S/390 ABI,
25863 the default is @option{-mesa}. When generating code compliant
25864 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25870 The @option{-mhtm} option enables a set of builtins making use of
25871 instructions available with the transactional execution facility
25872 introduced with the IBM zEnterprise EC12 machine generation
25873 @ref{S/390 System z Built-in Functions}.
25874 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25880 When @option{-mvx} is specified, generate code using the instructions
25881 available with the vector extension facility introduced with the IBM
25882 z13 machine generation.
25883 This option changes the ABI for some vector type values with regard to
25884 alignment and calling conventions. In case vector type values are
25885 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25886 command will be added to mark the resulting binary with the ABI used.
25887 @option{-mvx} is enabled by default when using @option{-march=z13}.
25890 @itemx -mno-zvector
25892 @opindex mno-zvector
25893 The @option{-mzvector} option enables vector language extensions and
25894 builtins using instructions available with the vector extension
25895 facility introduced with the IBM z13 machine generation.
25896 This option adds support for @samp{vector} to be used as a keyword to
25897 define vector type variables and arguments. @samp{vector} is only
25898 available when GNU extensions are enabled. It will not be expanded
25899 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25900 In addition to the GCC low-level builtins @option{-mzvector} enables
25901 a set of builtins added for compatibility with AltiVec-style
25902 implementations like Power and Cell. In order to make use of these
25903 builtins the header file @file{vecintrin.h} needs to be included.
25904 @option{-mzvector} is disabled by default.
25910 Generate (or do not generate) code using the @code{mvcle} instruction
25911 to perform block moves. When @option{-mno-mvcle} is specified,
25912 use a @code{mvc} loop instead. This is the default unless optimizing for
25919 Print (or do not print) additional debug information when compiling.
25920 The default is to not print debug information.
25922 @item -march=@var{cpu-type}
25924 Generate code that runs on @var{cpu-type}, which is the name of a
25925 system representing a certain processor type. Possible values for
25926 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25927 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25928 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11}, and
25931 The default is @option{-march=z900}.
25933 Specifying @samp{native} as cpu type can be used to select the best
25934 architecture option for the host processor.
25935 @option{-march=native} has no effect if GCC does not recognize the
25938 @item -mtune=@var{cpu-type}
25940 Tune to @var{cpu-type} everything applicable about the generated code,
25941 except for the ABI and the set of available instructions.
25942 The list of @var{cpu-type} values is the same as for @option{-march}.
25943 The default is the value used for @option{-march}.
25946 @itemx -mno-tpf-trace
25947 @opindex mtpf-trace
25948 @opindex mno-tpf-trace
25949 Generate code that adds (does not add) in TPF OS specific branches to trace
25950 routines in the operating system. This option is off by default, even
25951 when compiling for the TPF OS@.
25954 @itemx -mno-fused-madd
25955 @opindex mfused-madd
25956 @opindex mno-fused-madd
25957 Generate code that uses (does not use) the floating-point multiply and
25958 accumulate instructions. These instructions are generated by default if
25959 hardware floating point is used.
25961 @item -mwarn-framesize=@var{framesize}
25962 @opindex mwarn-framesize
25963 Emit a warning if the current function exceeds the given frame size. Because
25964 this is a compile-time check it doesn't need to be a real problem when the program
25965 runs. It is intended to identify functions that most probably cause
25966 a stack overflow. It is useful to be used in an environment with limited stack
25967 size e.g.@: the linux kernel.
25969 @item -mwarn-dynamicstack
25970 @opindex mwarn-dynamicstack
25971 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
25972 arrays. This is generally a bad idea with a limited stack size.
25974 @item -mstack-guard=@var{stack-guard}
25975 @itemx -mstack-size=@var{stack-size}
25976 @opindex mstack-guard
25977 @opindex mstack-size
25978 If these options are provided the S/390 back end emits additional instructions in
25979 the function prologue that trigger a trap if the stack size is @var{stack-guard}
25980 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
25981 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
25982 the frame size of the compiled function is chosen.
25983 These options are intended to be used to help debugging stack overflow problems.
25984 The additionally emitted code causes only little overhead and hence can also be
25985 used in production-like systems without greater performance degradation. The given
25986 values have to be exact powers of 2 and @var{stack-size} has to be greater than
25987 @var{stack-guard} without exceeding 64k.
25988 In order to be efficient the extra code makes the assumption that the stack starts
25989 at an address aligned to the value given by @var{stack-size}.
25990 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
25992 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
25994 If the hotpatch option is enabled, a ``hot-patching'' function
25995 prologue is generated for all functions in the compilation unit.
25996 The funtion label is prepended with the given number of two-byte
25997 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
25998 the label, 2 * @var{post-halfwords} bytes are appended, using the
25999 largest NOP like instructions the architecture allows (maximum
26002 If both arguments are zero, hotpatching is disabled.
26004 This option can be overridden for individual functions with the
26005 @code{hotpatch} attribute.
26008 @node Score Options
26009 @subsection Score Options
26010 @cindex Score Options
26012 These options are defined for Score implementations:
26017 Compile code for big-endian mode. This is the default.
26021 Compile code for little-endian mode.
26025 Disable generation of @code{bcnz} instructions.
26029 Enable generation of unaligned load and store instructions.
26033 Enable the use of multiply-accumulate instructions. Disabled by default.
26037 Specify the SCORE5 as the target architecture.
26041 Specify the SCORE5U of the target architecture.
26045 Specify the SCORE7 as the target architecture. This is the default.
26049 Specify the SCORE7D as the target architecture.
26053 @subsection SH Options
26055 These @samp{-m} options are defined for the SH implementations:
26060 Generate code for the SH1.
26064 Generate code for the SH2.
26067 Generate code for the SH2e.
26071 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
26072 that the floating-point unit is not used.
26074 @item -m2a-single-only
26075 @opindex m2a-single-only
26076 Generate code for the SH2a-FPU, in such a way that no double-precision
26077 floating-point operations are used.
26080 @opindex m2a-single
26081 Generate code for the SH2a-FPU assuming the floating-point unit is in
26082 single-precision mode by default.
26086 Generate code for the SH2a-FPU assuming the floating-point unit is in
26087 double-precision mode by default.
26091 Generate code for the SH3.
26095 Generate code for the SH3e.
26099 Generate code for the SH4 without a floating-point unit.
26101 @item -m4-single-only
26102 @opindex m4-single-only
26103 Generate code for the SH4 with a floating-point unit that only
26104 supports single-precision arithmetic.
26108 Generate code for the SH4 assuming the floating-point unit is in
26109 single-precision mode by default.
26113 Generate code for the SH4.
26117 Generate code for SH4-100.
26119 @item -m4-100-nofpu
26120 @opindex m4-100-nofpu
26121 Generate code for SH4-100 in such a way that the
26122 floating-point unit is not used.
26124 @item -m4-100-single
26125 @opindex m4-100-single
26126 Generate code for SH4-100 assuming the floating-point unit is in
26127 single-precision mode by default.
26129 @item -m4-100-single-only
26130 @opindex m4-100-single-only
26131 Generate code for SH4-100 in such a way that no double-precision
26132 floating-point operations are used.
26136 Generate code for SH4-200.
26138 @item -m4-200-nofpu
26139 @opindex m4-200-nofpu
26140 Generate code for SH4-200 without in such a way that the
26141 floating-point unit is not used.
26143 @item -m4-200-single
26144 @opindex m4-200-single
26145 Generate code for SH4-200 assuming the floating-point unit is in
26146 single-precision mode by default.
26148 @item -m4-200-single-only
26149 @opindex m4-200-single-only
26150 Generate code for SH4-200 in such a way that no double-precision
26151 floating-point operations are used.
26155 Generate code for SH4-300.
26157 @item -m4-300-nofpu
26158 @opindex m4-300-nofpu
26159 Generate code for SH4-300 without in such a way that the
26160 floating-point unit is not used.
26162 @item -m4-300-single
26163 @opindex m4-300-single
26164 Generate code for SH4-300 in such a way that no double-precision
26165 floating-point operations are used.
26167 @item -m4-300-single-only
26168 @opindex m4-300-single-only
26169 Generate code for SH4-300 in such a way that no double-precision
26170 floating-point operations are used.
26174 Generate code for SH4-340 (no MMU, no FPU).
26178 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
26183 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
26184 floating-point unit is not used.
26186 @item -m4a-single-only
26187 @opindex m4a-single-only
26188 Generate code for the SH4a, in such a way that no double-precision
26189 floating-point operations are used.
26192 @opindex m4a-single
26193 Generate code for the SH4a assuming the floating-point unit is in
26194 single-precision mode by default.
26198 Generate code for the SH4a.
26202 Same as @option{-m4a-nofpu}, except that it implicitly passes
26203 @option{-dsp} to the assembler. GCC doesn't generate any DSP
26204 instructions at the moment.
26208 Compile code for the processor in big-endian mode.
26212 Compile code for the processor in little-endian mode.
26216 Align doubles at 64-bit boundaries. Note that this changes the calling
26217 conventions, and thus some functions from the standard C library do
26218 not work unless you recompile it first with @option{-mdalign}.
26222 Shorten some address references at link time, when possible; uses the
26223 linker option @option{-relax}.
26227 Use 32-bit offsets in @code{switch} tables. The default is to use
26232 Enable the use of bit manipulation instructions on SH2A.
26236 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
26237 alignment constraints.
26241 Comply with the calling conventions defined by Renesas.
26244 @opindex mno-renesas
26245 Comply with the calling conventions defined for GCC before the Renesas
26246 conventions were available. This option is the default for all
26247 targets of the SH toolchain.
26250 @opindex mnomacsave
26251 Mark the @code{MAC} register as call-clobbered, even if
26252 @option{-mrenesas} is given.
26258 Control the IEEE compliance of floating-point comparisons, which affects the
26259 handling of cases where the result of a comparison is unordered. By default
26260 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
26261 enabled @option{-mno-ieee} is implicitly set, which results in faster
26262 floating-point greater-equal and less-equal comparisons. The implicit settings
26263 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
26265 @item -minline-ic_invalidate
26266 @opindex minline-ic_invalidate
26267 Inline code to invalidate instruction cache entries after setting up
26268 nested function trampolines.
26269 This option has no effect if @option{-musermode} is in effect and the selected
26270 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
26272 If the selected code generation option does not allow the use of the @code{icbi}
26273 instruction, and @option{-musermode} is not in effect, the inlined code
26274 manipulates the instruction cache address array directly with an associative
26275 write. This not only requires privileged mode at run time, but it also
26276 fails if the cache line had been mapped via the TLB and has become unmapped.
26280 Dump instruction size and location in the assembly code.
26283 @opindex mpadstruct
26284 This option is deprecated. It pads structures to multiple of 4 bytes,
26285 which is incompatible with the SH ABI@.
26287 @item -matomic-model=@var{model}
26288 @opindex matomic-model=@var{model}
26289 Sets the model of atomic operations and additional parameters as a comma
26290 separated list. For details on the atomic built-in functions see
26291 @ref{__atomic Builtins}. The following models and parameters are supported:
26296 Disable compiler generated atomic sequences and emit library calls for atomic
26297 operations. This is the default if the target is not @code{sh*-*-linux*}.
26300 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
26301 built-in functions. The generated atomic sequences require additional support
26302 from the interrupt/exception handling code of the system and are only suitable
26303 for SH3* and SH4* single-core systems. This option is enabled by default when
26304 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
26305 this option also partially utilizes the hardware atomic instructions
26306 @code{movli.l} and @code{movco.l} to create more efficient code, unless
26307 @samp{strict} is specified.
26310 Generate software atomic sequences that use a variable in the thread control
26311 block. This is a variation of the gUSA sequences which can also be used on
26312 SH1* and SH2* targets. The generated atomic sequences require additional
26313 support from the interrupt/exception handling code of the system and are only
26314 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
26315 parameter has to be specified as well.
26318 Generate software atomic sequences that temporarily disable interrupts by
26319 setting @code{SR.IMASK = 1111}. This model works only when the program runs
26320 in privileged mode and is only suitable for single-core systems. Additional
26321 support from the interrupt/exception handling code of the system is not
26322 required. This model is enabled by default when the target is
26323 @code{sh*-*-linux*} and SH1* or SH2*.
26326 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
26327 instructions only. This is only available on SH4A and is suitable for
26328 multi-core systems. Since the hardware instructions support only 32 bit atomic
26329 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
26330 Code compiled with this option is also compatible with other software
26331 atomic model interrupt/exception handling systems if executed on an SH4A
26332 system. Additional support from the interrupt/exception handling code of the
26333 system is not required for this model.
26336 This parameter specifies the offset in bytes of the variable in the thread
26337 control block structure that should be used by the generated atomic sequences
26338 when the @samp{soft-tcb} model has been selected. For other models this
26339 parameter is ignored. The specified value must be an integer multiple of four
26340 and in the range 0-1020.
26343 This parameter prevents mixed usage of multiple atomic models, even if they
26344 are compatible, and makes the compiler generate atomic sequences of the
26345 specified model only.
26351 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
26352 Notice that depending on the particular hardware and software configuration
26353 this can degrade overall performance due to the operand cache line flushes
26354 that are implied by the @code{tas.b} instruction. On multi-core SH4A
26355 processors the @code{tas.b} instruction must be used with caution since it
26356 can result in data corruption for certain cache configurations.
26359 @opindex mprefergot
26360 When generating position-independent code, emit function calls using
26361 the Global Offset Table instead of the Procedure Linkage Table.
26364 @itemx -mno-usermode
26366 @opindex mno-usermode
26367 Don't allow (allow) the compiler generating privileged mode code. Specifying
26368 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
26369 inlined code would not work in user mode. @option{-musermode} is the default
26370 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
26371 @option{-musermode} has no effect, since there is no user mode.
26373 @item -multcost=@var{number}
26374 @opindex multcost=@var{number}
26375 Set the cost to assume for a multiply insn.
26377 @item -mdiv=@var{strategy}
26378 @opindex mdiv=@var{strategy}
26379 Set the division strategy to be used for integer division operations.
26380 @var{strategy} can be one of:
26385 Calls a library function that uses the single-step division instruction
26386 @code{div1} to perform the operation. Division by zero calculates an
26387 unspecified result and does not trap. This is the default except for SH4,
26388 SH2A and SHcompact.
26391 Calls a library function that performs the operation in double precision
26392 floating point. Division by zero causes a floating-point exception. This is
26393 the default for SHcompact with FPU. Specifying this for targets that do not
26394 have a double precision FPU defaults to @code{call-div1}.
26397 Calls a library function that uses a lookup table for small divisors and
26398 the @code{div1} instruction with case distinction for larger divisors. Division
26399 by zero calculates an unspecified result and does not trap. This is the default
26400 for SH4. Specifying this for targets that do not have dynamic shift
26401 instructions defaults to @code{call-div1}.
26405 When a division strategy has not been specified the default strategy is
26406 selected based on the current target. For SH2A the default strategy is to
26407 use the @code{divs} and @code{divu} instructions instead of library function
26410 @item -maccumulate-outgoing-args
26411 @opindex maccumulate-outgoing-args
26412 Reserve space once for outgoing arguments in the function prologue rather
26413 than around each call. Generally beneficial for performance and size. Also
26414 needed for unwinding to avoid changing the stack frame around conditional code.
26416 @item -mdivsi3_libfunc=@var{name}
26417 @opindex mdivsi3_libfunc=@var{name}
26418 Set the name of the library function used for 32-bit signed division to
26420 This only affects the name used in the @samp{call} division strategies, and
26421 the compiler still expects the same sets of input/output/clobbered registers as
26422 if this option were not present.
26424 @item -mfixed-range=@var{register-range}
26425 @opindex mfixed-range
26426 Generate code treating the given register range as fixed registers.
26427 A fixed register is one that the register allocator can not use. This is
26428 useful when compiling kernel code. A register range is specified as
26429 two registers separated by a dash. Multiple register ranges can be
26430 specified separated by a comma.
26432 @item -mbranch-cost=@var{num}
26433 @opindex mbranch-cost=@var{num}
26434 Assume @var{num} to be the cost for a branch instruction. Higher numbers
26435 make the compiler try to generate more branch-free code if possible.
26436 If not specified the value is selected depending on the processor type that
26437 is being compiled for.
26440 @itemx -mno-zdcbranch
26441 @opindex mzdcbranch
26442 @opindex mno-zdcbranch
26443 Assume (do not assume) that zero displacement conditional branch instructions
26444 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
26445 compiler prefers zero displacement branch code sequences. This is
26446 enabled by default when generating code for SH4 and SH4A. It can be explicitly
26447 disabled by specifying @option{-mno-zdcbranch}.
26449 @item -mcbranch-force-delay-slot
26450 @opindex mcbranch-force-delay-slot
26451 Force the usage of delay slots for conditional branches, which stuffs the delay
26452 slot with a @code{nop} if a suitable instruction cannot be found. By default
26453 this option is disabled. It can be enabled to work around hardware bugs as
26454 found in the original SH7055.
26457 @itemx -mno-fused-madd
26458 @opindex mfused-madd
26459 @opindex mno-fused-madd
26460 Generate code that uses (does not use) the floating-point multiply and
26461 accumulate instructions. These instructions are generated by default
26462 if hardware floating point is used. The machine-dependent
26463 @option{-mfused-madd} option is now mapped to the machine-independent
26464 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26465 mapped to @option{-ffp-contract=off}.
26471 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
26472 and cosine approximations. The option @option{-mfsca} must be used in
26473 combination with @option{-funsafe-math-optimizations}. It is enabled by default
26474 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
26475 approximations even if @option{-funsafe-math-optimizations} is in effect.
26481 Allow or disallow the compiler to emit the @code{fsrra} instruction for
26482 reciprocal square root approximations. The option @option{-mfsrra} must be used
26483 in combination with @option{-funsafe-math-optimizations} and
26484 @option{-ffinite-math-only}. It is enabled by default when generating code for
26485 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
26486 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
26489 @item -mpretend-cmove
26490 @opindex mpretend-cmove
26491 Prefer zero-displacement conditional branches for conditional move instruction
26492 patterns. This can result in faster code on the SH4 processor.
26496 Generate code using the FDPIC ABI.
26500 @node Solaris 2 Options
26501 @subsection Solaris 2 Options
26502 @cindex Solaris 2 options
26504 These @samp{-m} options are supported on Solaris 2:
26507 @item -mclear-hwcap
26508 @opindex mclear-hwcap
26509 @option{-mclear-hwcap} tells the compiler to remove the hardware
26510 capabilities generated by the Solaris assembler. This is only necessary
26511 when object files use ISA extensions not supported by the current
26512 machine, but check at runtime whether or not to use them.
26514 @item -mimpure-text
26515 @opindex mimpure-text
26516 @option{-mimpure-text}, used in addition to @option{-shared}, tells
26517 the compiler to not pass @option{-z text} to the linker when linking a
26518 shared object. Using this option, you can link position-dependent
26519 code into a shared object.
26521 @option{-mimpure-text} suppresses the ``relocations remain against
26522 allocatable but non-writable sections'' linker error message.
26523 However, the necessary relocations trigger copy-on-write, and the
26524 shared object is not actually shared across processes. Instead of
26525 using @option{-mimpure-text}, you should compile all source code with
26526 @option{-fpic} or @option{-fPIC}.
26530 These switches are supported in addition to the above on Solaris 2:
26535 This is a synonym for @option{-pthread}.
26538 @node SPARC Options
26539 @subsection SPARC Options
26540 @cindex SPARC options
26542 These @samp{-m} options are supported on the SPARC:
26545 @item -mno-app-regs
26547 @opindex mno-app-regs
26549 Specify @option{-mapp-regs} to generate output using the global registers
26550 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
26551 global register 1, each global register 2 through 4 is then treated as an
26552 allocable register that is clobbered by function calls. This is the default.
26554 To be fully SVR4 ABI-compliant at the cost of some performance loss,
26555 specify @option{-mno-app-regs}. You should compile libraries and system
26556 software with this option.
26562 With @option{-mflat}, the compiler does not generate save/restore instructions
26563 and uses a ``flat'' or single register window model. This model is compatible
26564 with the regular register window model. The local registers and the input
26565 registers (0--5) are still treated as ``call-saved'' registers and are
26566 saved on the stack as needed.
26568 With @option{-mno-flat} (the default), the compiler generates save/restore
26569 instructions (except for leaf functions). This is the normal operating mode.
26572 @itemx -mhard-float
26574 @opindex mhard-float
26575 Generate output containing floating-point instructions. This is the
26579 @itemx -msoft-float
26581 @opindex msoft-float
26582 Generate output containing library calls for floating point.
26583 @strong{Warning:} the requisite libraries are not available for all SPARC
26584 targets. Normally the facilities of the machine's usual C compiler are
26585 used, but this cannot be done directly in cross-compilation. You must make
26586 your own arrangements to provide suitable library functions for
26587 cross-compilation. The embedded targets @samp{sparc-*-aout} and
26588 @samp{sparclite-*-*} do provide software floating-point support.
26590 @option{-msoft-float} changes the calling convention in the output file;
26591 therefore, it is only useful if you compile @emph{all} of a program with
26592 this option. In particular, you need to compile @file{libgcc.a}, the
26593 library that comes with GCC, with @option{-msoft-float} in order for
26596 @item -mhard-quad-float
26597 @opindex mhard-quad-float
26598 Generate output containing quad-word (long double) floating-point
26601 @item -msoft-quad-float
26602 @opindex msoft-quad-float
26603 Generate output containing library calls for quad-word (long double)
26604 floating-point instructions. The functions called are those specified
26605 in the SPARC ABI@. This is the default.
26607 As of this writing, there are no SPARC implementations that have hardware
26608 support for the quad-word floating-point instructions. They all invoke
26609 a trap handler for one of these instructions, and then the trap handler
26610 emulates the effect of the instruction. Because of the trap handler overhead,
26611 this is much slower than calling the ABI library routines. Thus the
26612 @option{-msoft-quad-float} option is the default.
26614 @item -mno-unaligned-doubles
26615 @itemx -munaligned-doubles
26616 @opindex mno-unaligned-doubles
26617 @opindex munaligned-doubles
26618 Assume that doubles have 8-byte alignment. This is the default.
26620 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
26621 alignment only if they are contained in another type, or if they have an
26622 absolute address. Otherwise, it assumes they have 4-byte alignment.
26623 Specifying this option avoids some rare compatibility problems with code
26624 generated by other compilers. It is not the default because it results
26625 in a performance loss, especially for floating-point code.
26628 @itemx -mno-user-mode
26629 @opindex muser-mode
26630 @opindex mno-user-mode
26631 Do not generate code that can only run in supervisor mode. This is relevant
26632 only for the @code{casa} instruction emitted for the LEON3 processor. This
26635 @item -mfaster-structs
26636 @itemx -mno-faster-structs
26637 @opindex mfaster-structs
26638 @opindex mno-faster-structs
26639 With @option{-mfaster-structs}, the compiler assumes that structures
26640 should have 8-byte alignment. This enables the use of pairs of
26641 @code{ldd} and @code{std} instructions for copies in structure
26642 assignment, in place of twice as many @code{ld} and @code{st} pairs.
26643 However, the use of this changed alignment directly violates the SPARC
26644 ABI@. Thus, it's intended only for use on targets where the developer
26645 acknowledges that their resulting code is not directly in line with
26646 the rules of the ABI@.
26648 @item -mstd-struct-return
26649 @itemx -mno-std-struct-return
26650 @opindex mstd-struct-return
26651 @opindex mno-std-struct-return
26652 With @option{-mstd-struct-return}, the compiler generates checking code
26653 in functions returning structures or unions to detect size mismatches
26654 between the two sides of function calls, as per the 32-bit ABI@.
26656 The default is @option{-mno-std-struct-return}. This option has no effect
26663 Enable Local Register Allocation. This is the default for SPARC since GCC 7
26664 so @option{-mno-lra} needs to be passed to get old Reload.
26666 @item -mcpu=@var{cpu_type}
26668 Set the instruction set, register set, and instruction scheduling parameters
26669 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26670 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
26671 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
26672 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
26673 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
26674 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
26676 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
26677 which selects the best architecture option for the host processor.
26678 @option{-mcpu=native} has no effect if GCC does not recognize
26681 Default instruction scheduling parameters are used for values that select
26682 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
26683 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
26685 Here is a list of each supported architecture and their supported
26693 supersparc, hypersparc, leon, leon3
26696 f930, f934, sparclite86x
26702 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26706 By default (unless configured otherwise), GCC generates code for the V7
26707 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
26708 additionally optimizes it for the Cypress CY7C602 chip, as used in the
26709 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
26710 SPARCStation 1, 2, IPX etc.
26712 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
26713 architecture. The only difference from V7 code is that the compiler emits
26714 the integer multiply and integer divide instructions which exist in SPARC-V8
26715 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
26716 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
26719 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
26720 the SPARC architecture. This adds the integer multiply, integer divide step
26721 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26722 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26723 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
26724 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26725 MB86934 chip, which is the more recent SPARClite with FPU@.
26727 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26728 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
26729 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26730 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
26731 optimizes it for the TEMIC SPARClet chip.
26733 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26734 architecture. This adds 64-bit integer and floating-point move instructions,
26735 3 additional floating-point condition code registers and conditional move
26736 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
26737 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
26738 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26739 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26740 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26741 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
26742 additionally optimizes it for Sun UltraSPARC T2 chips. With
26743 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26744 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
26745 additionally optimizes it for Sun UltraSPARC T4 chips. With
26746 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26747 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
26748 additionally optimizes it for Oracle M8 chips.
26750 @item -mtune=@var{cpu_type}
26752 Set the instruction scheduling parameters for machine type
26753 @var{cpu_type}, but do not set the instruction set or register set that the
26754 option @option{-mcpu=@var{cpu_type}} does.
26756 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26757 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26758 that select a particular CPU implementation. Those are
26759 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26760 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26761 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26762 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26763 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
26764 and GNU/Linux toolchains, @samp{native} can also be used.
26769 @opindex mno-v8plus
26770 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
26771 difference from the V8 ABI is that the global and out registers are
26772 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
26773 mode for all SPARC-V9 processors.
26779 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26780 Visual Instruction Set extensions. The default is @option{-mno-vis}.
26786 With @option{-mvis2}, GCC generates code that takes advantage of
26787 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
26788 default is @option{-mvis2} when targeting a cpu that supports such
26789 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
26790 also sets @option{-mvis}.
26796 With @option{-mvis3}, GCC generates code that takes advantage of
26797 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
26798 default is @option{-mvis3} when targeting a cpu that supports such
26799 instructions, such as niagara-3 and later. Setting @option{-mvis3}
26800 also sets @option{-mvis2} and @option{-mvis}.
26806 With @option{-mvis4}, GCC generates code that takes advantage of
26807 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
26808 default is @option{-mvis4} when targeting a cpu that supports such
26809 instructions, such as niagara-7 and later. Setting @option{-mvis4}
26810 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26816 With @option{-mvis4b}, GCC generates code that takes advantage of
26817 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26818 the additional VIS instructions introduced in the Oracle SPARC
26819 Architecture 2017. The default is @option{-mvis4b} when targeting a
26820 cpu that supports such instructions, such as m8 and later. Setting
26821 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26822 @option{-mvis2} and @option{-mvis}.
26827 @opindex mno-cbcond
26828 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26829 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
26830 when targeting a CPU that supports such instructions, such as Niagara-4 and
26837 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26838 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
26839 when targeting a CPU that supports such instructions, such as Niagara-3 and
26845 @opindex mno-fsmuld
26846 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26847 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
26848 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26849 or V9 with FPU except @option{-mcpu=leon}.
26855 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26856 Population Count instruction. The default is @option{-mpopc}
26857 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26864 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26865 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
26866 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26870 @opindex mfix-at697f
26871 Enable the documented workaround for the single erratum of the Atmel AT697F
26872 processor (which corresponds to erratum #13 of the AT697E processor).
26875 @opindex mfix-ut699
26876 Enable the documented workarounds for the floating-point errata and the data
26877 cache nullify errata of the UT699 processor.
26880 @opindex mfix-ut700
26881 Enable the documented workaround for the back-to-back store errata of
26882 the UT699E/UT700 processor.
26884 @item -mfix-gr712rc
26885 @opindex mfix-gr712rc
26886 Enable the documented workaround for the back-to-back store errata of
26887 the GR712RC processor.
26890 These @samp{-m} options are supported in addition to the above
26891 on SPARC-V9 processors in 64-bit environments:
26898 Generate code for a 32-bit or 64-bit environment.
26899 The 32-bit environment sets int, long and pointer to 32 bits.
26900 The 64-bit environment sets int to 32 bits and long and pointer
26903 @item -mcmodel=@var{which}
26905 Set the code model to one of
26909 The Medium/Low code model: 64-bit addresses, programs
26910 must be linked in the low 32 bits of memory. Programs can be statically
26911 or dynamically linked.
26914 The Medium/Middle code model: 64-bit addresses, programs
26915 must be linked in the low 44 bits of memory, the text and data segments must
26916 be less than 2GB in size and the data segment must be located within 2GB of
26920 The Medium/Anywhere code model: 64-bit addresses, programs
26921 may be linked anywhere in memory, the text and data segments must be less
26922 than 2GB in size and the data segment must be located within 2GB of the
26926 The Medium/Anywhere code model for embedded systems:
26927 64-bit addresses, the text and data segments must be less than 2GB in
26928 size, both starting anywhere in memory (determined at link time). The
26929 global register %g4 points to the base of the data segment. Programs
26930 are statically linked and PIC is not supported.
26933 @item -mmemory-model=@var{mem-model}
26934 @opindex mmemory-model
26935 Set the memory model in force on the processor to one of
26939 The default memory model for the processor and operating system.
26942 Relaxed Memory Order
26945 Partial Store Order
26951 Sequential Consistency
26954 These memory models are formally defined in Appendix D of the SPARC-V9
26955 architecture manual, as set in the processor's @code{PSTATE.MM} field.
26958 @itemx -mno-stack-bias
26959 @opindex mstack-bias
26960 @opindex mno-stack-bias
26961 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
26962 frame pointer if present, are offset by @minus{}2047 which must be added back
26963 when making stack frame references. This is the default in 64-bit mode.
26964 Otherwise, assume no such offset is present.
26968 @subsection SPU Options
26969 @cindex SPU options
26971 These @samp{-m} options are supported on the SPU:
26975 @itemx -merror-reloc
26976 @opindex mwarn-reloc
26977 @opindex merror-reloc
26979 The loader for SPU does not handle dynamic relocations. By default, GCC
26980 gives an error when it generates code that requires a dynamic
26981 relocation. @option{-mno-error-reloc} disables the error,
26982 @option{-mwarn-reloc} generates a warning instead.
26985 @itemx -munsafe-dma
26987 @opindex munsafe-dma
26989 Instructions that initiate or test completion of DMA must not be
26990 reordered with respect to loads and stores of the memory that is being
26992 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
26993 memory accesses, but that can lead to inefficient code in places where the
26994 memory is known to not change. Rather than mark the memory as volatile,
26995 you can use @option{-msafe-dma} to tell the compiler to treat
26996 the DMA instructions as potentially affecting all memory.
26998 @item -mbranch-hints
26999 @opindex mbranch-hints
27001 By default, GCC generates a branch hint instruction to avoid
27002 pipeline stalls for always-taken or probably-taken branches. A hint
27003 is not generated closer than 8 instructions away from its branch.
27004 There is little reason to disable them, except for debugging purposes,
27005 or to make an object a little bit smaller.
27009 @opindex msmall-mem
27010 @opindex mlarge-mem
27012 By default, GCC generates code assuming that addresses are never larger
27013 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
27014 a full 32-bit address.
27019 By default, GCC links against startup code that assumes the SPU-style
27020 main function interface (which has an unconventional parameter list).
27021 With @option{-mstdmain}, GCC links your program against startup
27022 code that assumes a C99-style interface to @code{main}, including a
27023 local copy of @code{argv} strings.
27025 @item -mfixed-range=@var{register-range}
27026 @opindex mfixed-range
27027 Generate code treating the given register range as fixed registers.
27028 A fixed register is one that the register allocator cannot use. This is
27029 useful when compiling kernel code. A register range is specified as
27030 two registers separated by a dash. Multiple register ranges can be
27031 specified separated by a comma.
27037 Compile code assuming that pointers to the PPU address space accessed
27038 via the @code{__ea} named address space qualifier are either 32 or 64
27039 bits wide. The default is 32 bits. As this is an ABI-changing option,
27040 all object code in an executable must be compiled with the same setting.
27042 @item -maddress-space-conversion
27043 @itemx -mno-address-space-conversion
27044 @opindex maddress-space-conversion
27045 @opindex mno-address-space-conversion
27046 Allow/disallow treating the @code{__ea} address space as superset
27047 of the generic address space. This enables explicit type casts
27048 between @code{__ea} and generic pointer as well as implicit
27049 conversions of generic pointers to @code{__ea} pointers. The
27050 default is to allow address space pointer conversions.
27052 @item -mcache-size=@var{cache-size}
27053 @opindex mcache-size
27054 This option controls the version of libgcc that the compiler links to an
27055 executable and selects a software-managed cache for accessing variables
27056 in the @code{__ea} address space with a particular cache size. Possible
27057 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
27058 and @samp{128}. The default cache size is 64KB.
27060 @item -matomic-updates
27061 @itemx -mno-atomic-updates
27062 @opindex matomic-updates
27063 @opindex mno-atomic-updates
27064 This option controls the version of libgcc that the compiler links to an
27065 executable and selects whether atomic updates to the software-managed
27066 cache of PPU-side variables are used. If you use atomic updates, changes
27067 to a PPU variable from SPU code using the @code{__ea} named address space
27068 qualifier do not interfere with changes to other PPU variables residing
27069 in the same cache line from PPU code. If you do not use atomic updates,
27070 such interference may occur; however, writing back cache lines is
27071 more efficient. The default behavior is to use atomic updates.
27074 @itemx -mdual-nops=@var{n}
27075 @opindex mdual-nops
27076 By default, GCC inserts NOPs to increase dual issue when it expects
27077 it to increase performance. @var{n} can be a value from 0 to 10. A
27078 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
27079 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
27081 @item -mhint-max-nops=@var{n}
27082 @opindex mhint-max-nops
27083 Maximum number of NOPs to insert for a branch hint. A branch hint must
27084 be at least 8 instructions away from the branch it is affecting. GCC
27085 inserts up to @var{n} NOPs to enforce this, otherwise it does not
27086 generate the branch hint.
27088 @item -mhint-max-distance=@var{n}
27089 @opindex mhint-max-distance
27090 The encoding of the branch hint instruction limits the hint to be within
27091 256 instructions of the branch it is affecting. By default, GCC makes
27092 sure it is within 125.
27095 @opindex msafe-hints
27096 Work around a hardware bug that causes the SPU to stall indefinitely.
27097 By default, GCC inserts the @code{hbrp} instruction to make sure
27098 this stall won't happen.
27102 @node System V Options
27103 @subsection Options for System V
27105 These additional options are available on System V Release 4 for
27106 compatibility with other compilers on those systems:
27111 Create a shared object.
27112 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
27116 Identify the versions of each tool used by the compiler, in a
27117 @code{.ident} assembler directive in the output.
27121 Refrain from adding @code{.ident} directives to the output file (this is
27124 @item -YP,@var{dirs}
27126 Search the directories @var{dirs}, and no others, for libraries
27127 specified with @option{-l}.
27129 @item -Ym,@var{dir}
27131 Look in the directory @var{dir} to find the M4 preprocessor.
27132 The assembler uses this option.
27133 @c This is supposed to go with a -Yd for predefined M4 macro files, but
27134 @c the generic assembler that comes with Solaris takes just -Ym.
27137 @node TILE-Gx Options
27138 @subsection TILE-Gx Options
27139 @cindex TILE-Gx options
27141 These @samp{-m} options are supported on the TILE-Gx:
27144 @item -mcmodel=small
27145 @opindex mcmodel=small
27146 Generate code for the small model. The distance for direct calls is
27147 limited to 500M in either direction. PC-relative addresses are 32
27148 bits. Absolute addresses support the full address range.
27150 @item -mcmodel=large
27151 @opindex mcmodel=large
27152 Generate code for the large model. There is no limitation on call
27153 distance, pc-relative addresses, or absolute addresses.
27155 @item -mcpu=@var{name}
27157 Selects the type of CPU to be targeted. Currently the only supported
27158 type is @samp{tilegx}.
27164 Generate code for a 32-bit or 64-bit environment. The 32-bit
27165 environment sets int, long, and pointer to 32 bits. The 64-bit
27166 environment sets int to 32 bits and long and pointer to 64 bits.
27169 @itemx -mlittle-endian
27170 @opindex mbig-endian
27171 @opindex mlittle-endian
27172 Generate code in big/little endian mode, respectively.
27175 @node TILEPro Options
27176 @subsection TILEPro Options
27177 @cindex TILEPro options
27179 These @samp{-m} options are supported on the TILEPro:
27182 @item -mcpu=@var{name}
27184 Selects the type of CPU to be targeted. Currently the only supported
27185 type is @samp{tilepro}.
27189 Generate code for a 32-bit environment, which sets int, long, and
27190 pointer to 32 bits. This is the only supported behavior so the flag
27191 is essentially ignored.
27195 @subsection V850 Options
27196 @cindex V850 Options
27198 These @samp{-m} options are defined for V850 implementations:
27202 @itemx -mno-long-calls
27203 @opindex mlong-calls
27204 @opindex mno-long-calls
27205 Treat all calls as being far away (near). If calls are assumed to be
27206 far away, the compiler always loads the function's address into a
27207 register, and calls indirect through the pointer.
27213 Do not optimize (do optimize) basic blocks that use the same index
27214 pointer 4 or more times to copy pointer into the @code{ep} register, and
27215 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
27216 option is on by default if you optimize.
27218 @item -mno-prolog-function
27219 @itemx -mprolog-function
27220 @opindex mno-prolog-function
27221 @opindex mprolog-function
27222 Do not use (do use) external functions to save and restore registers
27223 at the prologue and epilogue of a function. The external functions
27224 are slower, but use less code space if more than one function saves
27225 the same number of registers. The @option{-mprolog-function} option
27226 is on by default if you optimize.
27230 Try to make the code as small as possible. At present, this just turns
27231 on the @option{-mep} and @option{-mprolog-function} options.
27233 @item -mtda=@var{n}
27235 Put static or global variables whose size is @var{n} bytes or less into
27236 the tiny data area that register @code{ep} points to. The tiny data
27237 area can hold up to 256 bytes in total (128 bytes for byte references).
27239 @item -msda=@var{n}
27241 Put static or global variables whose size is @var{n} bytes or less into
27242 the small data area that register @code{gp} points to. The small data
27243 area can hold up to 64 kilobytes.
27245 @item -mzda=@var{n}
27247 Put static or global variables whose size is @var{n} bytes or less into
27248 the first 32 kilobytes of memory.
27252 Specify that the target processor is the V850.
27256 Specify that the target processor is the V850E3V5. The preprocessor
27257 constant @code{__v850e3v5__} is defined if this option is used.
27261 Specify that the target processor is the V850E3V5. This is an alias for
27262 the @option{-mv850e3v5} option.
27266 Specify that the target processor is the V850E2V3. The preprocessor
27267 constant @code{__v850e2v3__} is defined if this option is used.
27271 Specify that the target processor is the V850E2. The preprocessor
27272 constant @code{__v850e2__} is defined if this option is used.
27276 Specify that the target processor is the V850E1. The preprocessor
27277 constants @code{__v850e1__} and @code{__v850e__} are defined if
27278 this option is used.
27282 Specify that the target processor is the V850ES. This is an alias for
27283 the @option{-mv850e1} option.
27287 Specify that the target processor is the V850E@. The preprocessor
27288 constant @code{__v850e__} is defined if this option is used.
27290 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
27291 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
27292 are defined then a default target processor is chosen and the
27293 relevant @samp{__v850*__} preprocessor constant is defined.
27295 The preprocessor constants @code{__v850} and @code{__v851__} are always
27296 defined, regardless of which processor variant is the target.
27298 @item -mdisable-callt
27299 @itemx -mno-disable-callt
27300 @opindex mdisable-callt
27301 @opindex mno-disable-callt
27302 This option suppresses generation of the @code{CALLT} instruction for the
27303 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
27306 This option is enabled by default when the RH850 ABI is
27307 in use (see @option{-mrh850-abi}), and disabled by default when the
27308 GCC ABI is in use. If @code{CALLT} instructions are being generated
27309 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
27315 Pass on (or do not pass on) the @option{-mrelax} command-line option
27319 @itemx -mno-long-jumps
27320 @opindex mlong-jumps
27321 @opindex mno-long-jumps
27322 Disable (or re-enable) the generation of PC-relative jump instructions.
27325 @itemx -mhard-float
27326 @opindex msoft-float
27327 @opindex mhard-float
27328 Disable (or re-enable) the generation of hardware floating point
27329 instructions. This option is only significant when the target
27330 architecture is @samp{V850E2V3} or higher. If hardware floating point
27331 instructions are being generated then the C preprocessor symbol
27332 @code{__FPU_OK__} is defined, otherwise the symbol
27333 @code{__NO_FPU__} is defined.
27337 Enables the use of the e3v5 LOOP instruction. The use of this
27338 instruction is not enabled by default when the e3v5 architecture is
27339 selected because its use is still experimental.
27343 @opindex mrh850-abi
27345 Enables support for the RH850 version of the V850 ABI. This is the
27346 default. With this version of the ABI the following rules apply:
27350 Integer sized structures and unions are returned via a memory pointer
27351 rather than a register.
27354 Large structures and unions (more than 8 bytes in size) are passed by
27358 Functions are aligned to 16-bit boundaries.
27361 The @option{-m8byte-align} command-line option is supported.
27364 The @option{-mdisable-callt} command-line option is enabled by
27365 default. The @option{-mno-disable-callt} command-line option is not
27369 When this version of the ABI is enabled the C preprocessor symbol
27370 @code{__V850_RH850_ABI__} is defined.
27374 Enables support for the old GCC version of the V850 ABI. With this
27375 version of the ABI the following rules apply:
27379 Integer sized structures and unions are returned in register @code{r10}.
27382 Large structures and unions (more than 8 bytes in size) are passed by
27386 Functions are aligned to 32-bit boundaries, unless optimizing for
27390 The @option{-m8byte-align} command-line option is not supported.
27393 The @option{-mdisable-callt} command-line option is supported but not
27394 enabled by default.
27397 When this version of the ABI is enabled the C preprocessor symbol
27398 @code{__V850_GCC_ABI__} is defined.
27400 @item -m8byte-align
27401 @itemx -mno-8byte-align
27402 @opindex m8byte-align
27403 @opindex mno-8byte-align
27404 Enables support for @code{double} and @code{long long} types to be
27405 aligned on 8-byte boundaries. The default is to restrict the
27406 alignment of all objects to at most 4-bytes. When
27407 @option{-m8byte-align} is in effect the C preprocessor symbol
27408 @code{__V850_8BYTE_ALIGN__} is defined.
27411 @opindex mbig-switch
27412 Generate code suitable for big switch tables. Use this option only if
27413 the assembler/linker complain about out of range branches within a switch
27418 This option causes r2 and r5 to be used in the code generated by
27419 the compiler. This setting is the default.
27421 @item -mno-app-regs
27422 @opindex mno-app-regs
27423 This option causes r2 and r5 to be treated as fixed registers.
27428 @subsection VAX Options
27429 @cindex VAX options
27431 These @samp{-m} options are defined for the VAX:
27436 Do not output certain jump instructions (@code{aobleq} and so on)
27437 that the Unix assembler for the VAX cannot handle across long
27442 Do output those jump instructions, on the assumption that the
27443 GNU assembler is being used.
27447 Output code for G-format floating-point numbers instead of D-format.
27450 @node Visium Options
27451 @subsection Visium Options
27452 @cindex Visium options
27458 A program which performs file I/O and is destined to run on an MCM target
27459 should be linked with this option. It causes the libraries libc.a and
27460 libdebug.a to be linked. The program should be run on the target under
27461 the control of the GDB remote debugging stub.
27465 A program which performs file I/O and is destined to run on the simulator
27466 should be linked with option. This causes libraries libc.a and libsim.a to
27470 @itemx -mhard-float
27472 @opindex mhard-float
27473 Generate code containing floating-point instructions. This is the
27477 @itemx -msoft-float
27479 @opindex msoft-float
27480 Generate code containing library calls for floating-point.
27482 @option{-msoft-float} changes the calling convention in the output file;
27483 therefore, it is only useful if you compile @emph{all} of a program with
27484 this option. In particular, you need to compile @file{libgcc.a}, the
27485 library that comes with GCC, with @option{-msoft-float} in order for
27488 @item -mcpu=@var{cpu_type}
27490 Set the instruction set, register set, and instruction scheduling parameters
27491 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
27492 @samp{mcm}, @samp{gr5} and @samp{gr6}.
27494 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
27496 By default (unless configured otherwise), GCC generates code for the GR5
27497 variant of the Visium architecture.
27499 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
27500 architecture. The only difference from GR5 code is that the compiler will
27501 generate block move instructions.
27503 @item -mtune=@var{cpu_type}
27505 Set the instruction scheduling parameters for machine type @var{cpu_type},
27506 but do not set the instruction set or register set that the option
27507 @option{-mcpu=@var{cpu_type}} would.
27511 Generate code for the supervisor mode, where there are no restrictions on
27512 the access to general registers. This is the default.
27515 @opindex muser-mode
27516 Generate code for the user mode, where the access to some general registers
27517 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
27518 mode; on the GR6, only registers r29 to r31 are affected.
27522 @subsection VMS Options
27524 These @samp{-m} options are defined for the VMS implementations:
27527 @item -mvms-return-codes
27528 @opindex mvms-return-codes
27529 Return VMS condition codes from @code{main}. The default is to return POSIX-style
27530 condition (e.g.@: error) codes.
27532 @item -mdebug-main=@var{prefix}
27533 @opindex mdebug-main=@var{prefix}
27534 Flag the first routine whose name starts with @var{prefix} as the main
27535 routine for the debugger.
27539 Default to 64-bit memory allocation routines.
27541 @item -mpointer-size=@var{size}
27542 @opindex mpointer-size=@var{size}
27543 Set the default size of pointers. Possible options for @var{size} are
27544 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
27545 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
27546 The later option disables @code{pragma pointer_size}.
27549 @node VxWorks Options
27550 @subsection VxWorks Options
27551 @cindex VxWorks Options
27553 The options in this section are defined for all VxWorks targets.
27554 Options specific to the target hardware are listed with the other
27555 options for that target.
27560 GCC can generate code for both VxWorks kernels and real time processes
27561 (RTPs). This option switches from the former to the latter. It also
27562 defines the preprocessor macro @code{__RTP__}.
27565 @opindex non-static
27566 Link an RTP executable against shared libraries rather than static
27567 libraries. The options @option{-static} and @option{-shared} can
27568 also be used for RTPs (@pxref{Link Options}); @option{-static}
27575 These options are passed down to the linker. They are defined for
27576 compatibility with Diab.
27579 @opindex Xbind-lazy
27580 Enable lazy binding of function calls. This option is equivalent to
27581 @option{-Wl,-z,now} and is defined for compatibility with Diab.
27585 Disable lazy binding of function calls. This option is the default and
27586 is defined for compatibility with Diab.
27590 @subsection x86 Options
27591 @cindex x86 Options
27593 These @samp{-m} options are defined for the x86 family of computers.
27597 @item -march=@var{cpu-type}
27599 Generate instructions for the machine type @var{cpu-type}. In contrast to
27600 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
27601 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
27602 to generate code that may not run at all on processors other than the one
27603 indicated. Specifying @option{-march=@var{cpu-type}} implies
27604 @option{-mtune=@var{cpu-type}}.
27606 The choices for @var{cpu-type} are:
27610 This selects the CPU to generate code for at compilation time by determining
27611 the processor type of the compiling machine. Using @option{-march=native}
27612 enables all instruction subsets supported by the local machine (hence
27613 the result might not run on different machines). Using @option{-mtune=native}
27614 produces code optimized for the local machine under the constraints
27615 of the selected instruction set.
27618 A generic CPU with 64-bit extensions.
27621 Original Intel i386 CPU@.
27624 Intel i486 CPU@. (No scheduling is implemented for this chip.)
27628 Intel Pentium CPU with no MMX support.
27631 Intel Lakemont MCU, based on Intel Pentium CPU.
27634 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
27637 Intel Pentium Pro CPU@.
27640 When used with @option{-march}, the Pentium Pro
27641 instruction set is used, so the code runs on all i686 family chips.
27642 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
27645 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
27650 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
27654 Intel Pentium M; low-power version of Intel Pentium III CPU
27655 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
27659 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
27662 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
27666 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
27667 SSE2 and SSE3 instruction set support.
27670 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
27671 instruction set support.
27674 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27675 SSE4.1, SSE4.2 and POPCNT instruction set support.
27678 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27679 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
27682 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27683 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
27686 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27687 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
27688 instruction set support.
27691 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27692 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27693 BMI, BMI2 and F16C instruction set support.
27696 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27697 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27698 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
27701 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27702 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27703 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
27704 XSAVES instruction set support.
27707 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
27708 instruction set support.
27711 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27712 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
27715 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27716 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
27717 instruction set support.
27719 @item goldmont-plus
27720 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27721 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27722 PTWRITE, RDPID, SGX and UMIP instruction set support.
27725 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27726 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27727 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27730 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27731 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27732 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27733 AVX512CD instruction set support.
27736 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27737 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27738 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27739 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27741 @item skylake-avx512
27742 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27743 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27744 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27745 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27748 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27749 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27750 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27751 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27752 AVX512IFMA, SHA and UMIP instruction set support.
27754 @item icelake-client
27755 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27756 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27757 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27758 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27759 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27760 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27762 @item icelake-server
27763 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27764 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27765 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27766 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27767 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27768 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27772 AMD K6 CPU with MMX instruction set support.
27776 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27779 @itemx athlon-tbird
27780 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27786 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27787 instruction set support.
27793 Processors based on the AMD K8 core with x86-64 instruction set support,
27794 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27795 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27796 instruction set extensions.)
27799 @itemx opteron-sse3
27800 @itemx athlon64-sse3
27801 Improved versions of AMD K8 cores with SSE3 instruction set support.
27805 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
27806 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27807 instruction set extensions.)
27810 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
27811 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27812 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27814 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27815 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
27816 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27819 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27820 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27821 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27822 64-bit instruction set extensions.
27824 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27825 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27826 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27827 SSE4.2, ABM and 64-bit instruction set extensions.
27830 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27831 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27832 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27833 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27834 instruction set extensions.
27836 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27837 supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27838 MWAITX, SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27839 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27840 instruction set extensions.)
27844 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
27845 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27846 instruction set extensions.)
27849 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27850 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27851 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27854 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27858 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27859 instruction set support.
27862 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27863 (No scheduling is implemented for this chip.)
27866 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27867 (No scheduling is implemented for this chip.)
27870 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27871 (No scheduling is implemented for this chip.)
27874 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27875 (No scheduling is implemented for this chip.)
27878 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27879 (No scheduling is implemented for this chip.)
27882 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27883 (No scheduling is implemented for this chip.)
27886 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27887 (No scheduling is implemented for this chip.)
27890 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27891 AVX and AVX2 instruction set support.
27892 (No scheduling is implemented for this chip.)
27895 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27896 instruction set support.
27897 (No scheduling is implemented for this chip.)
27900 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27901 instruction set support.
27902 (No scheduling is implemented for this chip.)
27905 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27906 instruction set support.
27907 (No scheduling is implemented for this chip.)
27910 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27911 instruction set support.
27912 (No scheduling is implemented for this chip.)
27915 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27916 instruction set support.
27917 (No scheduling is implemented for this chip.)
27920 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27921 instruction set support.
27922 (No scheduling is implemented for this chip.)
27925 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27928 @item -mtune=@var{cpu-type}
27930 Tune to @var{cpu-type} everything applicable about the generated code, except
27931 for the ABI and the set of available instructions.
27932 While picking a specific @var{cpu-type} schedules things appropriately
27933 for that particular chip, the compiler does not generate any code that
27934 cannot run on the default machine type unless you use a
27935 @option{-march=@var{cpu-type}} option.
27936 For example, if GCC is configured for i686-pc-linux-gnu
27937 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27938 but still runs on i686 machines.
27940 The choices for @var{cpu-type} are the same as for @option{-march}.
27941 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27945 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27946 If you know the CPU on which your code will run, then you should use
27947 the corresponding @option{-mtune} or @option{-march} option instead of
27948 @option{-mtune=generic}. But, if you do not know exactly what CPU users
27949 of your application will have, then you should use this option.
27951 As new processors are deployed in the marketplace, the behavior of this
27952 option will change. Therefore, if you upgrade to a newer version of
27953 GCC, code generation controlled by this option will change to reflect
27955 that are most common at the time that version of GCC is released.
27957 There is no @option{-march=generic} option because @option{-march}
27958 indicates the instruction set the compiler can use, and there is no
27959 generic instruction set applicable to all processors. In contrast,
27960 @option{-mtune} indicates the processor (or, in this case, collection of
27961 processors) for which the code is optimized.
27964 Produce code optimized for the most current Intel processors, which are
27965 Haswell and Silvermont for this version of GCC. If you know the CPU
27966 on which your code will run, then you should use the corresponding
27967 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27968 But, if you want your application performs better on both Haswell and
27969 Silvermont, then you should use this option.
27971 As new Intel processors are deployed in the marketplace, the behavior of
27972 this option will change. Therefore, if you upgrade to a newer version of
27973 GCC, code generation controlled by this option will change to reflect
27974 the most current Intel processors at the time that version of GCC is
27977 There is no @option{-march=intel} option because @option{-march} indicates
27978 the instruction set the compiler can use, and there is no common
27979 instruction set applicable to all processors. In contrast,
27980 @option{-mtune} indicates the processor (or, in this case, collection of
27981 processors) for which the code is optimized.
27984 @item -mcpu=@var{cpu-type}
27986 A deprecated synonym for @option{-mtune}.
27988 @item -mfpmath=@var{unit}
27990 Generate floating-point arithmetic for selected unit @var{unit}. The choices
27991 for @var{unit} are:
27995 Use the standard 387 floating-point coprocessor present on the majority of chips and
27996 emulated otherwise. Code compiled with this option runs almost everywhere.
27997 The temporary results are computed in 80-bit precision instead of the precision
27998 specified by the type, resulting in slightly different results compared to most
27999 of other chips. See @option{-ffloat-store} for more detailed description.
28001 This is the default choice for non-Darwin x86-32 targets.
28004 Use scalar floating-point instructions present in the SSE instruction set.
28005 This instruction set is supported by Pentium III and newer chips,
28006 and in the AMD line
28007 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
28008 instruction set supports only single-precision arithmetic, thus the double and
28009 extended-precision arithmetic are still done using 387. A later version, present
28010 only in Pentium 4 and AMD x86-64 chips, supports double-precision
28013 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
28014 or @option{-msse2} switches to enable SSE extensions and make this option
28015 effective. For the x86-64 compiler, these extensions are enabled by default.
28017 The resulting code should be considerably faster in the majority of cases and avoid
28018 the numerical instability problems of 387 code, but may break some existing
28019 code that expects temporaries to be 80 bits.
28021 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
28022 and the default choice for x86-32 targets with the SSE2 instruction set
28023 when @option{-ffast-math} is enabled.
28028 Attempt to utilize both instruction sets at once. This effectively doubles the
28029 amount of available registers, and on chips with separate execution units for
28030 387 and SSE the execution resources too. Use this option with care, as it is
28031 still experimental, because the GCC register allocator does not model separate
28032 functional units well, resulting in unstable performance.
28035 @item -masm=@var{dialect}
28036 @opindex masm=@var{dialect}
28037 Output assembly instructions using selected @var{dialect}. Also affects
28038 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
28039 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
28040 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
28041 not support @samp{intel}.
28044 @itemx -mno-ieee-fp
28046 @opindex mno-ieee-fp
28047 Control whether or not the compiler uses IEEE floating-point
28048 comparisons. These correctly handle the case where the result of a
28049 comparison is unordered.
28052 @itemx -mhard-float
28054 @opindex mhard-float
28055 Generate output containing 80387 instructions for floating point.
28058 @itemx -msoft-float
28060 @opindex msoft-float
28061 Generate output containing library calls for floating point.
28063 @strong{Warning:} the requisite libraries are not part of GCC@.
28064 Normally the facilities of the machine's usual C compiler are used, but
28065 this cannot be done directly in cross-compilation. You must make your
28066 own arrangements to provide suitable library functions for
28069 On machines where a function returns floating-point results in the 80387
28070 register stack, some floating-point opcodes may be emitted even if
28071 @option{-msoft-float} is used.
28073 @item -mno-fp-ret-in-387
28074 @opindex mno-fp-ret-in-387
28075 @opindex mfp-ret-in-387
28076 Do not use the FPU registers for return values of functions.
28078 The usual calling convention has functions return values of types
28079 @code{float} and @code{double} in an FPU register, even if there
28080 is no FPU@. The idea is that the operating system should emulate
28083 The option @option{-mno-fp-ret-in-387} causes such values to be returned
28084 in ordinary CPU registers instead.
28086 @item -mno-fancy-math-387
28087 @opindex mno-fancy-math-387
28088 @opindex mfancy-math-387
28089 Some 387 emulators do not support the @code{sin}, @code{cos} and
28090 @code{sqrt} instructions for the 387. Specify this option to avoid
28091 generating those instructions.
28092 This option is overridden when @option{-march}
28093 indicates that the target CPU always has an FPU and so the
28094 instruction does not need emulation. These
28095 instructions are not generated unless you also use the
28096 @option{-funsafe-math-optimizations} switch.
28098 @item -malign-double
28099 @itemx -mno-align-double
28100 @opindex malign-double
28101 @opindex mno-align-double
28102 Control whether GCC aligns @code{double}, @code{long double}, and
28103 @code{long long} variables on a two-word boundary or a one-word
28104 boundary. Aligning @code{double} variables on a two-word boundary
28105 produces code that runs somewhat faster on a Pentium at the
28106 expense of more memory.
28108 On x86-64, @option{-malign-double} is enabled by default.
28110 @strong{Warning:} if you use the @option{-malign-double} switch,
28111 structures containing the above types are aligned differently than
28112 the published application binary interface specifications for the x86-32
28113 and are not binary compatible with structures in code compiled
28114 without that switch.
28116 @item -m96bit-long-double
28117 @itemx -m128bit-long-double
28118 @opindex m96bit-long-double
28119 @opindex m128bit-long-double
28120 These switches control the size of @code{long double} type. The x86-32
28121 application binary interface specifies the size to be 96 bits,
28122 so @option{-m96bit-long-double} is the default in 32-bit mode.
28124 Modern architectures (Pentium and newer) prefer @code{long double}
28125 to be aligned to an 8- or 16-byte boundary. In arrays or structures
28126 conforming to the ABI, this is not possible. So specifying
28127 @option{-m128bit-long-double} aligns @code{long double}
28128 to a 16-byte boundary by padding the @code{long double} with an additional
28131 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
28132 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
28134 Notice that neither of these options enable any extra precision over the x87
28135 standard of 80 bits for a @code{long double}.
28137 @strong{Warning:} if you override the default value for your target ABI, this
28138 changes the size of
28139 structures and arrays containing @code{long double} variables,
28140 as well as modifying the function calling convention for functions taking
28141 @code{long double}. Hence they are not binary-compatible
28142 with code compiled without that switch.
28144 @item -mlong-double-64
28145 @itemx -mlong-double-80
28146 @itemx -mlong-double-128
28147 @opindex mlong-double-64
28148 @opindex mlong-double-80
28149 @opindex mlong-double-128
28150 These switches control the size of @code{long double} type. A size
28151 of 64 bits makes the @code{long double} type equivalent to the @code{double}
28152 type. This is the default for 32-bit Bionic C library. A size
28153 of 128 bits makes the @code{long double} type equivalent to the
28154 @code{__float128} type. This is the default for 64-bit Bionic C library.
28156 @strong{Warning:} if you override the default value for your target ABI, this
28157 changes the size of
28158 structures and arrays containing @code{long double} variables,
28159 as well as modifying the function calling convention for functions taking
28160 @code{long double}. Hence they are not binary-compatible
28161 with code compiled without that switch.
28163 @item -malign-data=@var{type}
28164 @opindex malign-data
28165 Control how GCC aligns variables. Supported values for @var{type} are
28166 @samp{compat} uses increased alignment value compatible uses GCC 4.8
28167 and earlier, @samp{abi} uses alignment value as specified by the
28168 psABI, and @samp{cacheline} uses increased alignment value to match
28169 the cache line size. @samp{compat} is the default.
28171 @item -mlarge-data-threshold=@var{threshold}
28172 @opindex mlarge-data-threshold
28173 When @option{-mcmodel=medium} is specified, data objects larger than
28174 @var{threshold} are placed in the large data section. This value must be the
28175 same across all objects linked into the binary, and defaults to 65535.
28179 Use a different function-calling convention, in which functions that
28180 take a fixed number of arguments return with the @code{ret @var{num}}
28181 instruction, which pops their arguments while returning. This saves one
28182 instruction in the caller since there is no need to pop the arguments
28185 You can specify that an individual function is called with this calling
28186 sequence with the function attribute @code{stdcall}. You can also
28187 override the @option{-mrtd} option by using the function attribute
28188 @code{cdecl}. @xref{Function Attributes}.
28190 @strong{Warning:} this calling convention is incompatible with the one
28191 normally used on Unix, so you cannot use it if you need to call
28192 libraries compiled with the Unix compiler.
28194 Also, you must provide function prototypes for all functions that
28195 take variable numbers of arguments (including @code{printf});
28196 otherwise incorrect code is generated for calls to those
28199 In addition, seriously incorrect code results if you call a
28200 function with too many arguments. (Normally, extra arguments are
28201 harmlessly ignored.)
28203 @item -mregparm=@var{num}
28205 Control how many registers are used to pass integer arguments. By
28206 default, no registers are used to pass arguments, and at most 3
28207 registers can be used. You can control this behavior for a specific
28208 function by using the function attribute @code{regparm}.
28209 @xref{Function Attributes}.
28211 @strong{Warning:} if you use this switch, and
28212 @var{num} is nonzero, then you must build all modules with the same
28213 value, including any libraries. This includes the system libraries and
28217 @opindex msseregparm
28218 Use SSE register passing conventions for float and double arguments
28219 and return values. You can control this behavior for a specific
28220 function by using the function attribute @code{sseregparm}.
28221 @xref{Function Attributes}.
28223 @strong{Warning:} if you use this switch then you must build all
28224 modules with the same value, including any libraries. This includes
28225 the system libraries and startup modules.
28227 @item -mvect8-ret-in-mem
28228 @opindex mvect8-ret-in-mem
28229 Return 8-byte vectors in memory instead of MMX registers. This is the
28230 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
28231 Studio compilers until version 12. Later compiler versions (starting
28232 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
28233 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
28234 you need to remain compatible with existing code produced by those
28235 previous compiler versions or older versions of GCC@.
28244 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
28245 is specified, the significands of results of floating-point operations are
28246 rounded to 24 bits (single precision); @option{-mpc64} rounds the
28247 significands of results of floating-point operations to 53 bits (double
28248 precision) and @option{-mpc80} rounds the significands of results of
28249 floating-point operations to 64 bits (extended double precision), which is
28250 the default. When this option is used, floating-point operations in higher
28251 precisions are not available to the programmer without setting the FPU
28252 control word explicitly.
28254 Setting the rounding of floating-point operations to less than the default
28255 80 bits can speed some programs by 2% or more. Note that some mathematical
28256 libraries assume that extended-precision (80-bit) floating-point operations
28257 are enabled by default; routines in such libraries could suffer significant
28258 loss of accuracy, typically through so-called ``catastrophic cancellation'',
28259 when this option is used to set the precision to less than extended precision.
28261 @item -mstackrealign
28262 @opindex mstackrealign
28263 Realign the stack at entry. On the x86, the @option{-mstackrealign}
28264 option generates an alternate prologue and epilogue that realigns the
28265 run-time stack if necessary. This supports mixing legacy codes that keep
28266 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
28267 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
28268 applicable to individual functions.
28270 @item -mpreferred-stack-boundary=@var{num}
28271 @opindex mpreferred-stack-boundary
28272 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
28273 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
28274 the default is 4 (16 bytes or 128 bits).
28276 @strong{Warning:} When generating code for the x86-64 architecture with
28277 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
28278 used to keep the stack boundary aligned to 8 byte boundary. Since
28279 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
28280 intended to be used in controlled environment where stack space is
28281 important limitation. This option leads to wrong code when functions
28282 compiled with 16 byte stack alignment (such as functions from a standard
28283 library) are called with misaligned stack. In this case, SSE
28284 instructions may lead to misaligned memory access traps. In addition,
28285 variable arguments are handled incorrectly for 16 byte aligned
28286 objects (including x87 long double and __int128), leading to wrong
28287 results. You must build all modules with
28288 @option{-mpreferred-stack-boundary=3}, including any libraries. This
28289 includes the system libraries and startup modules.
28291 @item -mincoming-stack-boundary=@var{num}
28292 @opindex mincoming-stack-boundary
28293 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
28294 boundary. If @option{-mincoming-stack-boundary} is not specified,
28295 the one specified by @option{-mpreferred-stack-boundary} is used.
28297 On Pentium and Pentium Pro, @code{double} and @code{long double} values
28298 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
28299 suffer significant run time performance penalties. On Pentium III, the
28300 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
28301 properly if it is not 16-byte aligned.
28303 To ensure proper alignment of this values on the stack, the stack boundary
28304 must be as aligned as that required by any value stored on the stack.
28305 Further, every function must be generated such that it keeps the stack
28306 aligned. Thus calling a function compiled with a higher preferred
28307 stack boundary from a function compiled with a lower preferred stack
28308 boundary most likely misaligns the stack. It is recommended that
28309 libraries that use callbacks always use the default setting.
28311 This extra alignment does consume extra stack space, and generally
28312 increases code size. Code that is sensitive to stack space usage, such
28313 as embedded systems and operating system kernels, may want to reduce the
28314 preferred alignment to @option{-mpreferred-stack-boundary=2}.
28371 @itemx -mavx512ifma
28372 @opindex mavx512ifma
28374 @itemx -mavx512vbmi
28375 @opindex mavx512vbmi
28386 @itemx -mclflushopt
28387 @opindex mclflushopt
28413 @itemx -mprefetchwt1
28414 @opindex mprefetchwt1
28472 @itemx -mavx512vbmi2
28473 @opindex mavx512vbmi2
28484 @itemx -mvpclmulqdq
28485 @opindex mvpclmulqdq
28487 @itemx -mavx512bitalg
28488 @opindex mavx512bitalg
28494 @opindex mmovdir64b
28496 @itemx -mavx512vpopcntdq
28497 @opindex mavx512vpopcntdq
28501 These switches enable the use of instructions in the MMX, SSE,
28502 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
28503 SHA, AES, PCLMUL, FSGSBASE, PTWRITE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
28504 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, BMI, BMI2, VAES, WAITPKG,
28505 FXSR, XSAVE, XSAVEOPT, LZCNT, RTM, MWAITX, PKU, IBT, SHSTK, AVX512VBMI2,
28506 GFNI, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B,
28507 AVX512VPOPCNTDQ, CLDEMOTE, 3DNow!@: or enhanced 3DNow!@: extended instruction
28508 sets. Each has a corresponding @option{-mno-} option to disable use of these
28511 These extensions are also available as built-in functions: see
28512 @ref{x86 Built-in Functions}, for details of the functions enabled and
28513 disabled by these switches.
28515 To generate SSE/SSE2 instructions automatically from floating-point
28516 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
28518 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
28519 generates new AVX instructions or AVX equivalence for all SSEx instructions
28522 These options enable GCC to use these extended instructions in
28523 generated code, even without @option{-mfpmath=sse}. Applications that
28524 perform run-time CPU detection must compile separate files for each
28525 supported architecture, using the appropriate flags. In particular,
28526 the file containing the CPU detection code should be compiled without
28529 @item -mdump-tune-features
28530 @opindex mdump-tune-features
28531 This option instructs GCC to dump the names of the x86 performance
28532 tuning features and default settings. The names can be used in
28533 @option{-mtune-ctrl=@var{feature-list}}.
28535 @item -mtune-ctrl=@var{feature-list}
28536 @opindex mtune-ctrl=@var{feature-list}
28537 This option is used to do fine grain control of x86 code generation features.
28538 @var{feature-list} is a comma separated list of @var{feature} names. See also
28539 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
28540 on if it is not preceded with @samp{^}, otherwise, it is turned off.
28541 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
28542 developers. Using it may lead to code paths not covered by testing and can
28543 potentially result in compiler ICEs or runtime errors.
28546 @opindex mno-default
28547 This option instructs GCC to turn off all tunable features. See also
28548 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
28552 This option instructs GCC to emit a @code{cld} instruction in the prologue
28553 of functions that use string instructions. String instructions depend on
28554 the DF flag to select between autoincrement or autodecrement mode. While the
28555 ABI specifies the DF flag to be cleared on function entry, some operating
28556 systems violate this specification by not clearing the DF flag in their
28557 exception dispatchers. The exception handler can be invoked with the DF flag
28558 set, which leads to wrong direction mode when string instructions are used.
28559 This option can be enabled by default on 32-bit x86 targets by configuring
28560 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
28561 instructions can be suppressed with the @option{-mno-cld} compiler option
28565 @opindex mvzeroupper
28566 This option instructs GCC to emit a @code{vzeroupper} instruction
28567 before a transfer of control flow out of the function to minimize
28568 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
28571 @item -mprefer-avx128
28572 @opindex mprefer-avx128
28573 This option instructs GCC to use 128-bit AVX instructions instead of
28574 256-bit AVX instructions in the auto-vectorizer.
28576 @item -mprefer-vector-width=@var{opt}
28577 @opindex mprefer-vector-width
28578 This option instructs GCC to use @var{opt}-bit vector width in instructions
28579 instead of default on the selected platform.
28583 No extra limitations applied to GCC other than defined by the selected platform.
28586 Prefer 128-bit vector width for instructions.
28589 Prefer 256-bit vector width for instructions.
28592 Prefer 512-bit vector width for instructions.
28597 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
28598 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
28599 objects. This is useful for atomic updates of data structures exceeding one
28600 machine word in size. The compiler uses this instruction to implement
28601 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
28602 128-bit integers, a library call is always used.
28606 This option enables generation of @code{SAHF} instructions in 64-bit code.
28607 Early Intel Pentium 4 CPUs with Intel 64 support,
28608 prior to the introduction of Pentium 4 G1 step in December 2005,
28609 lacked the @code{LAHF} and @code{SAHF} instructions
28610 which are supported by AMD64.
28611 These are load and store instructions, respectively, for certain status flags.
28612 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
28613 @code{drem}, and @code{remainder} built-in functions;
28614 see @ref{Other Builtins} for details.
28618 This option enables use of the @code{movbe} instruction to implement
28619 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
28623 The @option{-mshstk} option enables shadow stack built-in functions
28624 from x86 Control-flow Enforcement Technology (CET).
28628 This option enables built-in functions @code{__builtin_ia32_crc32qi},
28629 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
28630 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
28634 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
28635 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
28636 with an additional Newton-Raphson step
28637 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
28638 (and their vectorized
28639 variants) for single-precision floating-point arguments. These instructions
28640 are generated only when @option{-funsafe-math-optimizations} is enabled
28641 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
28642 Note that while the throughput of the sequence is higher than the throughput
28643 of the non-reciprocal instruction, the precision of the sequence can be
28644 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
28646 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
28647 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
28648 combination), and doesn't need @option{-mrecip}.
28650 Also note that GCC emits the above sequence with additional Newton-Raphson step
28651 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
28652 already with @option{-ffast-math} (or the above option combination), and
28653 doesn't need @option{-mrecip}.
28655 @item -mrecip=@var{opt}
28656 @opindex mrecip=opt
28657 This option controls which reciprocal estimate instructions
28658 may be used. @var{opt} is a comma-separated list of options, which may
28659 be preceded by a @samp{!} to invert the option:
28663 Enable all estimate instructions.
28666 Enable the default instructions, equivalent to @option{-mrecip}.
28669 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28672 Enable the approximation for scalar division.
28675 Enable the approximation for vectorized division.
28678 Enable the approximation for scalar square root.
28681 Enable the approximation for vectorized square root.
28684 So, for example, @option{-mrecip=all,!sqrt} enables
28685 all of the reciprocal approximations, except for square root.
28687 @item -mveclibabi=@var{type}
28688 @opindex mveclibabi
28689 Specifies the ABI type to use for vectorizing intrinsics using an
28690 external library. Supported values for @var{type} are @samp{svml}
28691 for the Intel short
28692 vector math library and @samp{acml} for the AMD math core library.
28693 To use this option, both @option{-ftree-vectorize} and
28694 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
28695 ABI-compatible library must be specified at link time.
28697 GCC currently emits calls to @code{vmldExp2},
28698 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
28699 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
28700 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
28701 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
28702 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
28703 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
28704 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
28705 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
28706 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
28707 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
28708 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
28709 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
28710 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
28711 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
28712 when @option{-mveclibabi=acml} is used.
28714 @item -mabi=@var{name}
28716 Generate code for the specified calling convention. Permissible values
28717 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28718 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
28719 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28720 You can control this behavior for specific functions by
28721 using the function attributes @code{ms_abi} and @code{sysv_abi}.
28722 @xref{Function Attributes}.
28724 @item -mforce-indirect-call
28725 @opindex mforce-indirect-call
28726 Force all calls to functions to be indirect. This is useful
28727 when using Intel Processor Trace where it generates more precise timing
28728 information for function calls.
28730 @item -mcall-ms2sysv-xlogues
28731 @opindex mcall-ms2sysv-xlogues
28732 @opindex mno-call-ms2sysv-xlogues
28733 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28734 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
28735 default, the code for saving and restoring these registers is emitted inline,
28736 resulting in fairly lengthy prologues and epilogues. Using
28737 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28738 use stubs in the static portion of libgcc to perform these saves and restores,
28739 thus reducing function size at the cost of a few extra instructions.
28741 @item -mtls-dialect=@var{type}
28742 @opindex mtls-dialect
28743 Generate code to access thread-local storage using the @samp{gnu} or
28744 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
28745 @samp{gnu2} is more efficient, but it may add compile- and run-time
28746 requirements that cannot be satisfied on all systems.
28749 @itemx -mno-push-args
28750 @opindex mpush-args
28751 @opindex mno-push-args
28752 Use PUSH operations to store outgoing parameters. This method is shorter
28753 and usually equally fast as method using SUB/MOV operations and is enabled
28754 by default. In some cases disabling it may improve performance because of
28755 improved scheduling and reduced dependencies.
28757 @item -maccumulate-outgoing-args
28758 @opindex maccumulate-outgoing-args
28759 If enabled, the maximum amount of space required for outgoing arguments is
28760 computed in the function prologue. This is faster on most modern CPUs
28761 because of reduced dependencies, improved scheduling and reduced stack usage
28762 when the preferred stack boundary is not equal to 2. The drawback is a notable
28763 increase in code size. This switch implies @option{-mno-push-args}.
28767 Support thread-safe exception handling on MinGW. Programs that rely
28768 on thread-safe exception handling must compile and link all code with the
28769 @option{-mthreads} option. When compiling, @option{-mthreads} defines
28770 @option{-D_MT}; when linking, it links in a special thread helper library
28771 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28773 @item -mms-bitfields
28774 @itemx -mno-ms-bitfields
28775 @opindex mms-bitfields
28776 @opindex mno-ms-bitfields
28778 Enable/disable bit-field layout compatible with the native Microsoft
28781 If @code{packed} is used on a structure, or if bit-fields are used,
28782 it may be that the Microsoft ABI lays out the structure differently
28783 than the way GCC normally does. Particularly when moving packed
28784 data between functions compiled with GCC and the native Microsoft compiler
28785 (either via function call or as data in a file), it may be necessary to access
28788 This option is enabled by default for Microsoft Windows
28789 targets. This behavior can also be controlled locally by use of variable
28790 or type attributes. For more information, see @ref{x86 Variable Attributes}
28791 and @ref{x86 Type Attributes}.
28793 The Microsoft structure layout algorithm is fairly simple with the exception
28794 of the bit-field packing.
28795 The padding and alignment of members of structures and whether a bit-field
28796 can straddle a storage-unit boundary are determine by these rules:
28799 @item Structure members are stored sequentially in the order in which they are
28800 declared: the first member has the lowest memory address and the last member
28803 @item Every data object has an alignment requirement. The alignment requirement
28804 for all data except structures, unions, and arrays is either the size of the
28805 object or the current packing size (specified with either the
28806 @code{aligned} attribute or the @code{pack} pragma),
28807 whichever is less. For structures, unions, and arrays,
28808 the alignment requirement is the largest alignment requirement of its members.
28809 Every object is allocated an offset so that:
28812 offset % alignment_requirement == 0
28815 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28816 unit if the integral types are the same size and if the next bit-field fits
28817 into the current allocation unit without crossing the boundary imposed by the
28818 common alignment requirements of the bit-fields.
28821 MSVC interprets zero-length bit-fields in the following ways:
28824 @item If a zero-length bit-field is inserted between two bit-fields that
28825 are normally coalesced, the bit-fields are not coalesced.
28832 unsigned long bf_1 : 12;
28834 unsigned long bf_2 : 12;
28839 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
28840 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28842 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28843 alignment of the zero-length bit-field is greater than the member that follows it,
28844 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28865 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28866 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
28867 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28870 Taking this into account, it is important to note the following:
28873 @item If a zero-length bit-field follows a normal bit-field, the type of the
28874 zero-length bit-field may affect the alignment of the structure as whole. For
28875 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28876 normal bit-field, and is of type short.
28878 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28879 still affect the alignment of the structure:
28890 Here, @code{t4} takes up 4 bytes.
28893 @item Zero-length bit-fields following non-bit-field members are ignored:
28905 Here, @code{t5} takes up 2 bytes.
28909 @item -mno-align-stringops
28910 @opindex mno-align-stringops
28911 @opindex malign-stringops
28912 Do not align the destination of inlined string operations. This switch reduces
28913 code size and improves performance in case the destination is already aligned,
28914 but GCC doesn't know about it.
28916 @item -minline-all-stringops
28917 @opindex minline-all-stringops
28918 By default GCC inlines string operations only when the destination is
28919 known to be aligned to least a 4-byte boundary.
28920 This enables more inlining and increases code
28921 size, but may improve performance of code that depends on fast
28922 @code{memcpy}, @code{strlen},
28923 and @code{memset} for short lengths.
28925 @item -minline-stringops-dynamically
28926 @opindex minline-stringops-dynamically
28927 For string operations of unknown size, use run-time checks with
28928 inline code for small blocks and a library call for large blocks.
28930 @item -mstringop-strategy=@var{alg}
28931 @opindex mstringop-strategy=@var{alg}
28932 Override the internal decision heuristic for the particular algorithm to use
28933 for inlining string operations. The allowed values for @var{alg} are:
28939 Expand using i386 @code{rep} prefix of the specified size.
28943 @itemx unrolled_loop
28944 Expand into an inline loop.
28947 Always use a library call.
28950 @item -mmemcpy-strategy=@var{strategy}
28951 @opindex mmemcpy-strategy=@var{strategy}
28952 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28953 should be inlined and what inline algorithm to use when the expected size
28954 of the copy operation is known. @var{strategy}
28955 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
28956 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28957 the max byte size with which inline algorithm @var{alg} is allowed. For the last
28958 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28959 in the list must be specified in increasing order. The minimal byte size for
28960 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
28963 @item -mmemset-strategy=@var{strategy}
28964 @opindex mmemset-strategy=@var{strategy}
28965 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28966 @code{__builtin_memset} expansion.
28968 @item -momit-leaf-frame-pointer
28969 @opindex momit-leaf-frame-pointer
28970 Don't keep the frame pointer in a register for leaf functions. This
28971 avoids the instructions to save, set up, and restore frame pointers and
28972 makes an extra register available in leaf functions. The option
28973 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28974 which might make debugging harder.
28976 @item -mtls-direct-seg-refs
28977 @itemx -mno-tls-direct-seg-refs
28978 @opindex mtls-direct-seg-refs
28979 Controls whether TLS variables may be accessed with offsets from the
28980 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28981 or whether the thread base pointer must be added. Whether or not this
28982 is valid depends on the operating system, and whether it maps the
28983 segment to cover the entire TLS area.
28985 For systems that use the GNU C Library, the default is on.
28988 @itemx -mno-sse2avx
28990 Specify that the assembler should encode SSE instructions with VEX
28991 prefix. The option @option{-mavx} turns this on by default.
28996 If profiling is active (@option{-pg}), put the profiling
28997 counter call before the prologue.
28998 Note: On x86 architectures the attribute @code{ms_hook_prologue}
28999 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
29001 @item -mrecord-mcount
29002 @itemx -mno-record-mcount
29003 @opindex mrecord-mcount
29004 If profiling is active (@option{-pg}), generate a __mcount_loc section
29005 that contains pointers to each profiling call. This is useful for
29006 automatically patching and out calls.
29009 @itemx -mno-nop-mcount
29010 @opindex mnop-mcount
29011 If profiling is active (@option{-pg}), generate the calls to
29012 the profiling functions as NOPs. This is useful when they
29013 should be patched in later dynamically. This is likely only
29014 useful together with @option{-mrecord-mcount}.
29016 @item -mskip-rax-setup
29017 @itemx -mno-skip-rax-setup
29018 @opindex mskip-rax-setup
29019 When generating code for the x86-64 architecture with SSE extensions
29020 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
29021 register when there are no variable arguments passed in vector registers.
29023 @strong{Warning:} Since RAX register is used to avoid unnecessarily
29024 saving vector registers on stack when passing variable arguments, the
29025 impacts of this option are callees may waste some stack space,
29026 misbehave or jump to a random location. GCC 4.4 or newer don't have
29027 those issues, regardless the RAX register value.
29030 @itemx -mno-8bit-idiv
29031 @opindex m8bit-idiv
29032 On some processors, like Intel Atom, 8-bit unsigned integer divide is
29033 much faster than 32-bit/64-bit integer divide. This option generates a
29034 run-time check. If both dividend and divisor are within range of 0
29035 to 255, 8-bit unsigned integer divide is used instead of
29036 32-bit/64-bit integer divide.
29038 @item -mavx256-split-unaligned-load
29039 @itemx -mavx256-split-unaligned-store
29040 @opindex mavx256-split-unaligned-load
29041 @opindex mavx256-split-unaligned-store
29042 Split 32-byte AVX unaligned load and store.
29044 @item -mstack-protector-guard=@var{guard}
29045 @itemx -mstack-protector-guard-reg=@var{reg}
29046 @itemx -mstack-protector-guard-offset=@var{offset}
29047 @opindex mstack-protector-guard
29048 @opindex mstack-protector-guard-reg
29049 @opindex mstack-protector-guard-offset
29050 Generate stack protection code using canary at @var{guard}. Supported
29051 locations are @samp{global} for global canary or @samp{tls} for per-thread
29052 canary in the TLS block (the default). This option has effect only when
29053 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
29055 With the latter choice the options
29056 @option{-mstack-protector-guard-reg=@var{reg}} and
29057 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
29058 which segment register (@code{%fs} or @code{%gs}) to use as base register
29059 for reading the canary, and from what offset from that base register.
29060 The default for those is as specified in the relevant ABI.
29062 @item -mgeneral-regs-only
29063 @opindex mgeneral-regs-only
29064 Generate code that uses only the general-purpose registers. This
29065 prevents the compiler from using floating-point, vector, mask and bound
29068 @item -mindirect-branch=@var{choice}
29069 @opindex mindirect-branch
29070 Convert indirect call and jump with @var{choice}. The default is
29071 @samp{keep}, which keeps indirect call and jump unmodified.
29072 @samp{thunk} converts indirect call and jump to call and return thunk.
29073 @samp{thunk-inline} converts indirect call and jump to inlined call
29074 and return thunk. @samp{thunk-extern} converts indirect call and jump
29075 to external call and return thunk provided in a separate object file.
29076 You can control this behavior for a specific function by using the
29077 function attribute @code{indirect_branch}. @xref{Function Attributes}.
29079 Note that @option{-mcmodel=large} is incompatible with
29080 @option{-mindirect-branch=thunk} and
29081 @option{-mindirect-branch=thunk-extern} since the thunk function may
29082 not be reachable in the large code model.
29084 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
29085 @option{-fcf-protection=branch} since the external thunk can not be modified
29086 to disable control-flow check.
29088 @item -mfunction-return=@var{choice}
29089 @opindex mfunction-return
29090 Convert function return with @var{choice}. The default is @samp{keep},
29091 which keeps function return unmodified. @samp{thunk} converts function
29092 return to call and return thunk. @samp{thunk-inline} converts function
29093 return to inlined call and return thunk. @samp{thunk-extern} converts
29094 function return to external call and return thunk provided in a separate
29095 object file. You can control this behavior for a specific function by
29096 using the function attribute @code{function_return}.
29097 @xref{Function Attributes}.
29099 Note that @option{-mcmodel=large} is incompatible with
29100 @option{-mfunction-return=thunk} and
29101 @option{-mfunction-return=thunk-extern} since the thunk function may
29102 not be reachable in the large code model.
29105 @item -mindirect-branch-register
29106 @opindex mindirect-branch-register
29107 Force indirect call and jump via register.
29111 These @samp{-m} switches are supported in addition to the above
29112 on x86-64 processors in 64-bit environments.
29125 Generate code for a 16-bit, 32-bit or 64-bit environment.
29126 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
29128 generates code that runs on any i386 system.
29130 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
29131 types to 64 bits, and generates code for the x86-64 architecture.
29132 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
29133 and @option{-mdynamic-no-pic} options.
29135 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
29137 generates code for the x86-64 architecture.
29139 The @option{-m16} option is the same as @option{-m32}, except for that
29140 it outputs the @code{.code16gcc} assembly directive at the beginning of
29141 the assembly output so that the binary can run in 16-bit mode.
29143 The @option{-miamcu} option generates code which conforms to Intel MCU
29144 psABI. It requires the @option{-m32} option to be turned on.
29146 @item -mno-red-zone
29147 @opindex mno-red-zone
29149 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
29150 by the x86-64 ABI; it is a 128-byte area beyond the location of the
29151 stack pointer that is not modified by signal or interrupt handlers
29152 and therefore can be used for temporary data without adjusting the stack
29153 pointer. The flag @option{-mno-red-zone} disables this red zone.
29155 @item -mcmodel=small
29156 @opindex mcmodel=small
29157 Generate code for the small code model: the program and its symbols must
29158 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
29159 Programs can be statically or dynamically linked. This is the default
29162 @item -mcmodel=kernel
29163 @opindex mcmodel=kernel
29164 Generate code for the kernel code model. The kernel runs in the
29165 negative 2 GB of the address space.
29166 This model has to be used for Linux kernel code.
29168 @item -mcmodel=medium
29169 @opindex mcmodel=medium
29170 Generate code for the medium model: the program is linked in the lower 2
29171 GB of the address space. Small symbols are also placed there. Symbols
29172 with sizes larger than @option{-mlarge-data-threshold} are put into
29173 large data or BSS sections and can be located above 2GB. Programs can
29174 be statically or dynamically linked.
29176 @item -mcmodel=large
29177 @opindex mcmodel=large
29178 Generate code for the large model. This model makes no assumptions
29179 about addresses and sizes of sections.
29181 @item -maddress-mode=long
29182 @opindex maddress-mode=long
29183 Generate code for long address mode. This is only supported for 64-bit
29184 and x32 environments. It is the default address mode for 64-bit
29187 @item -maddress-mode=short
29188 @opindex maddress-mode=short
29189 Generate code for short address mode. This is only supported for 32-bit
29190 and x32 environments. It is the default address mode for 32-bit and
29194 @node x86 Windows Options
29195 @subsection x86 Windows Options
29196 @cindex x86 Windows Options
29197 @cindex Windows Options for x86
29199 These additional options are available for Microsoft Windows targets:
29205 specifies that a console application is to be generated, by
29206 instructing the linker to set the PE header subsystem type
29207 required for console applications.
29208 This option is available for Cygwin and MinGW targets and is
29209 enabled by default on those targets.
29213 This option is available for Cygwin and MinGW targets. It
29214 specifies that a DLL---a dynamic link library---is to be
29215 generated, enabling the selection of the required runtime
29216 startup object and entry point.
29218 @item -mnop-fun-dllimport
29219 @opindex mnop-fun-dllimport
29220 This option is available for Cygwin and MinGW targets. It
29221 specifies that the @code{dllimport} attribute should be ignored.
29225 This option is available for MinGW targets. It specifies
29226 that MinGW-specific thread support is to be used.
29230 This option is available for MinGW-w64 targets. It causes
29231 the @code{UNICODE} preprocessor macro to be predefined, and
29232 chooses Unicode-capable runtime startup code.
29236 This option is available for Cygwin and MinGW targets. It
29237 specifies that the typical Microsoft Windows predefined macros are to
29238 be set in the pre-processor, but does not influence the choice
29239 of runtime library/startup code.
29243 This option is available for Cygwin and MinGW targets. It
29244 specifies that a GUI application is to be generated by
29245 instructing the linker to set the PE header subsystem type
29248 @item -fno-set-stack-executable
29249 @opindex fno-set-stack-executable
29250 @opindex fset-stack-executable
29251 This option is available for MinGW targets. It specifies that
29252 the executable flag for the stack used by nested functions isn't
29253 set. This is necessary for binaries running in kernel mode of
29254 Microsoft Windows, as there the User32 API, which is used to set executable
29255 privileges, isn't available.
29257 @item -fwritable-relocated-rdata
29258 @opindex fno-writable-relocated-rdata
29259 @opindex fwritable-relocated-rdata
29260 This option is available for MinGW and Cygwin targets. It specifies
29261 that relocated-data in read-only section is put into the @code{.data}
29262 section. This is a necessary for older runtimes not supporting
29263 modification of @code{.rdata} sections for pseudo-relocation.
29265 @item -mpe-aligned-commons
29266 @opindex mpe-aligned-commons
29267 This option is available for Cygwin and MinGW targets. It
29268 specifies that the GNU extension to the PE file format that
29269 permits the correct alignment of COMMON variables should be
29270 used when generating code. It is enabled by default if
29271 GCC detects that the target assembler found during configuration
29272 supports the feature.
29275 See also under @ref{x86 Options} for standard options.
29277 @node Xstormy16 Options
29278 @subsection Xstormy16 Options
29279 @cindex Xstormy16 Options
29281 These options are defined for Xstormy16:
29286 Choose startup files and linker script suitable for the simulator.
29289 @node Xtensa Options
29290 @subsection Xtensa Options
29291 @cindex Xtensa Options
29293 These options are supported for Xtensa targets:
29297 @itemx -mno-const16
29299 @opindex mno-const16
29300 Enable or disable use of @code{CONST16} instructions for loading
29301 constant values. The @code{CONST16} instruction is currently not a
29302 standard option from Tensilica. When enabled, @code{CONST16}
29303 instructions are always used in place of the standard @code{L32R}
29304 instructions. The use of @code{CONST16} is enabled by default only if
29305 the @code{L32R} instruction is not available.
29308 @itemx -mno-fused-madd
29309 @opindex mfused-madd
29310 @opindex mno-fused-madd
29311 Enable or disable use of fused multiply/add and multiply/subtract
29312 instructions in the floating-point option. This has no effect if the
29313 floating-point option is not also enabled. Disabling fused multiply/add
29314 and multiply/subtract instructions forces the compiler to use separate
29315 instructions for the multiply and add/subtract operations. This may be
29316 desirable in some cases where strict IEEE 754-compliant results are
29317 required: the fused multiply add/subtract instructions do not round the
29318 intermediate result, thereby producing results with @emph{more} bits of
29319 precision than specified by the IEEE standard. Disabling fused multiply
29320 add/subtract instructions also ensures that the program output is not
29321 sensitive to the compiler's ability to combine multiply and add/subtract
29324 @item -mserialize-volatile
29325 @itemx -mno-serialize-volatile
29326 @opindex mserialize-volatile
29327 @opindex mno-serialize-volatile
29328 When this option is enabled, GCC inserts @code{MEMW} instructions before
29329 @code{volatile} memory references to guarantee sequential consistency.
29330 The default is @option{-mserialize-volatile}. Use
29331 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
29333 @item -mforce-no-pic
29334 @opindex mforce-no-pic
29335 For targets, like GNU/Linux, where all user-mode Xtensa code must be
29336 position-independent code (PIC), this option disables PIC for compiling
29339 @item -mtext-section-literals
29340 @itemx -mno-text-section-literals
29341 @opindex mtext-section-literals
29342 @opindex mno-text-section-literals
29343 These options control the treatment of literal pools. The default is
29344 @option{-mno-text-section-literals}, which places literals in a separate
29345 section in the output file. This allows the literal pool to be placed
29346 in a data RAM/ROM, and it also allows the linker to combine literal
29347 pools from separate object files to remove redundant literals and
29348 improve code size. With @option{-mtext-section-literals}, the literals
29349 are interspersed in the text section in order to keep them as close as
29350 possible to their references. This may be necessary for large assembly
29351 files. Literals for each function are placed right before that function.
29353 @item -mauto-litpools
29354 @itemx -mno-auto-litpools
29355 @opindex mauto-litpools
29356 @opindex mno-auto-litpools
29357 These options control the treatment of literal pools. The default is
29358 @option{-mno-auto-litpools}, which places literals in a separate
29359 section in the output file unless @option{-mtext-section-literals} is
29360 used. With @option{-mauto-litpools} the literals are interspersed in
29361 the text section by the assembler. Compiler does not produce explicit
29362 @code{.literal} directives and loads literals into registers with
29363 @code{MOVI} instructions instead of @code{L32R} to let the assembler
29364 do relaxation and place literals as necessary. This option allows
29365 assembler to create several literal pools per function and assemble
29366 very big functions, which may not be possible with
29367 @option{-mtext-section-literals}.
29369 @item -mtarget-align
29370 @itemx -mno-target-align
29371 @opindex mtarget-align
29372 @opindex mno-target-align
29373 When this option is enabled, GCC instructs the assembler to
29374 automatically align instructions to reduce branch penalties at the
29375 expense of some code density. The assembler attempts to widen density
29376 instructions to align branch targets and the instructions following call
29377 instructions. If there are not enough preceding safe density
29378 instructions to align a target, no widening is performed. The
29379 default is @option{-mtarget-align}. These options do not affect the
29380 treatment of auto-aligned instructions like @code{LOOP}, which the
29381 assembler always aligns, either by widening density instructions or
29382 by inserting NOP instructions.
29385 @itemx -mno-longcalls
29386 @opindex mlongcalls
29387 @opindex mno-longcalls
29388 When this option is enabled, GCC instructs the assembler to translate
29389 direct calls to indirect calls unless it can determine that the target
29390 of a direct call is in the range allowed by the call instruction. This
29391 translation typically occurs for calls to functions in other source
29392 files. Specifically, the assembler translates a direct @code{CALL}
29393 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
29394 The default is @option{-mno-longcalls}. This option should be used in
29395 programs where the call target can potentially be out of range. This
29396 option is implemented in the assembler, not the compiler, so the
29397 assembly code generated by GCC still shows direct call
29398 instructions---look at the disassembled object code to see the actual
29399 instructions. Note that the assembler uses an indirect call for
29400 every cross-file call, not just those that really are out of range.
29403 @node zSeries Options
29404 @subsection zSeries Options
29405 @cindex zSeries options
29407 These are listed under @xref{S/390 and zSeries Options}.
29413 @section Specifying Subprocesses and the Switches to Pass to Them
29416 @command{gcc} is a driver program. It performs its job by invoking a
29417 sequence of other programs to do the work of compiling, assembling and
29418 linking. GCC interprets its command-line parameters and uses these to
29419 deduce which programs it should invoke, and which command-line options
29420 it ought to place on their command lines. This behavior is controlled
29421 by @dfn{spec strings}. In most cases there is one spec string for each
29422 program that GCC can invoke, but a few programs have multiple spec
29423 strings to control their behavior. The spec strings built into GCC can
29424 be overridden by using the @option{-specs=} command-line switch to specify
29427 @dfn{Spec files} are plain-text files that are used to construct spec
29428 strings. They consist of a sequence of directives separated by blank
29429 lines. The type of directive is determined by the first non-whitespace
29430 character on the line, which can be one of the following:
29433 @item %@var{command}
29434 Issues a @var{command} to the spec file processor. The commands that can
29438 @item %include <@var{file}>
29439 @cindex @code{%include}
29440 Search for @var{file} and insert its text at the current point in the
29443 @item %include_noerr <@var{file}>
29444 @cindex @code{%include_noerr}
29445 Just like @samp{%include}, but do not generate an error message if the include
29446 file cannot be found.
29448 @item %rename @var{old_name} @var{new_name}
29449 @cindex @code{%rename}
29450 Rename the spec string @var{old_name} to @var{new_name}.
29454 @item *[@var{spec_name}]:
29455 This tells the compiler to create, override or delete the named spec
29456 string. All lines after this directive up to the next directive or
29457 blank line are considered to be the text for the spec string. If this
29458 results in an empty string then the spec is deleted. (Or, if the
29459 spec did not exist, then nothing happens.) Otherwise, if the spec
29460 does not currently exist a new spec is created. If the spec does
29461 exist then its contents are overridden by the text of this
29462 directive, unless the first character of that text is the @samp{+}
29463 character, in which case the text is appended to the spec.
29465 @item [@var{suffix}]:
29466 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
29467 and up to the next directive or blank line are considered to make up the
29468 spec string for the indicated suffix. When the compiler encounters an
29469 input file with the named suffix, it processes the spec string in
29470 order to work out how to compile that file. For example:
29474 z-compile -input %i
29477 This says that any input file whose name ends in @samp{.ZZ} should be
29478 passed to the program @samp{z-compile}, which should be invoked with the
29479 command-line switch @option{-input} and with the result of performing the
29480 @samp{%i} substitution. (See below.)
29482 As an alternative to providing a spec string, the text following a
29483 suffix directive can be one of the following:
29486 @item @@@var{language}
29487 This says that the suffix is an alias for a known @var{language}. This is
29488 similar to using the @option{-x} command-line switch to GCC to specify a
29489 language explicitly. For example:
29496 Says that .ZZ files are, in fact, C++ source files.
29499 This causes an error messages saying:
29502 @var{name} compiler not installed on this system.
29506 GCC already has an extensive list of suffixes built into it.
29507 This directive adds an entry to the end of the list of suffixes, but
29508 since the list is searched from the end backwards, it is effectively
29509 possible to override earlier entries using this technique.
29513 GCC has the following spec strings built into it. Spec files can
29514 override these strings or create their own. Note that individual
29515 targets can also add their own spec strings to this list.
29518 asm Options to pass to the assembler
29519 asm_final Options to pass to the assembler post-processor
29520 cpp Options to pass to the C preprocessor
29521 cc1 Options to pass to the C compiler
29522 cc1plus Options to pass to the C++ compiler
29523 endfile Object files to include at the end of the link
29524 link Options to pass to the linker
29525 lib Libraries to include on the command line to the linker
29526 libgcc Decides which GCC support library to pass to the linker
29527 linker Sets the name of the linker
29528 predefines Defines to be passed to the C preprocessor
29529 signed_char Defines to pass to CPP to say whether @code{char} is signed
29531 startfile Object files to include at the start of the link
29534 Here is a small example of a spec file:
29537 %rename lib old_lib
29540 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
29543 This example renames the spec called @samp{lib} to @samp{old_lib} and
29544 then overrides the previous definition of @samp{lib} with a new one.
29545 The new definition adds in some extra command-line options before
29546 including the text of the old definition.
29548 @dfn{Spec strings} are a list of command-line options to be passed to their
29549 corresponding program. In addition, the spec strings can contain
29550 @samp{%}-prefixed sequences to substitute variable text or to
29551 conditionally insert text into the command line. Using these constructs
29552 it is possible to generate quite complex command lines.
29554 Here is a table of all defined @samp{%}-sequences for spec
29555 strings. Note that spaces are not generated automatically around the
29556 results of expanding these sequences. Therefore you can concatenate them
29557 together or combine them with constant text in a single argument.
29561 Substitute one @samp{%} into the program name or argument.
29564 Substitute the name of the input file being processed.
29567 Substitute the basename of the input file being processed.
29568 This is the substring up to (and not including) the last period
29569 and not including the directory.
29572 This is the same as @samp{%b}, but include the file suffix (text after
29576 Marks the argument containing or following the @samp{%d} as a
29577 temporary file name, so that that file is deleted if GCC exits
29578 successfully. Unlike @samp{%g}, this contributes no text to the
29581 @item %g@var{suffix}
29582 Substitute a file name that has suffix @var{suffix} and is chosen
29583 once per compilation, and mark the argument in the same way as
29584 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
29585 name is now chosen in a way that is hard to predict even when previously
29586 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
29587 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
29588 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
29589 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
29590 was simply substituted with a file name chosen once per compilation,
29591 without regard to any appended suffix (which was therefore treated
29592 just like ordinary text), making such attacks more likely to succeed.
29594 @item %u@var{suffix}
29595 Like @samp{%g}, but generates a new temporary file name
29596 each time it appears instead of once per compilation.
29598 @item %U@var{suffix}
29599 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
29600 new one if there is no such last file name. In the absence of any
29601 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
29602 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
29603 involves the generation of two distinct file names, one
29604 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
29605 simply substituted with a file name chosen for the previous @samp{%u},
29606 without regard to any appended suffix.
29608 @item %j@var{suffix}
29609 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
29610 writable, and if @option{-save-temps} is not used;
29611 otherwise, substitute the name
29612 of a temporary file, just like @samp{%u}. This temporary file is not
29613 meant for communication between processes, but rather as a junk
29614 disposal mechanism.
29616 @item %|@var{suffix}
29617 @itemx %m@var{suffix}
29618 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
29619 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
29620 all. These are the two most common ways to instruct a program that it
29621 should read from standard input or write to standard output. If you
29622 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
29623 construct: see for example @file{f/lang-specs.h}.
29625 @item %.@var{SUFFIX}
29626 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
29627 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
29628 terminated by the next space or %.
29631 Marks the argument containing or following the @samp{%w} as the
29632 designated output file of this compilation. This puts the argument
29633 into the sequence of arguments that @samp{%o} substitutes.
29636 Substitutes the names of all the output files, with spaces
29637 automatically placed around them. You should write spaces
29638 around the @samp{%o} as well or the results are undefined.
29639 @samp{%o} is for use in the specs for running the linker.
29640 Input files whose names have no recognized suffix are not compiled
29641 at all, but they are included among the output files, so they are
29645 Substitutes the suffix for object files. Note that this is
29646 handled specially when it immediately follows @samp{%g, %u, or %U},
29647 because of the need for those to form complete file names. The
29648 handling is such that @samp{%O} is treated exactly as if it had already
29649 been substituted, except that @samp{%g, %u, and %U} do not currently
29650 support additional @var{suffix} characters following @samp{%O} as they do
29651 following, for example, @samp{.o}.
29654 Substitutes the standard macro predefinitions for the
29655 current target machine. Use this when running @command{cpp}.
29658 Like @samp{%p}, but puts @samp{__} before and after the name of each
29659 predefined macro, except for macros that start with @samp{__} or with
29660 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
29664 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
29665 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
29666 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
29667 and @option{-imultilib} as necessary.
29670 Current argument is the name of a library or startup file of some sort.
29671 Search for that file in a standard list of directories and substitute
29672 the full name found. The current working directory is included in the
29673 list of directories scanned.
29676 Current argument is the name of a linker script. Search for that file
29677 in the current list of directories to scan for libraries. If the file
29678 is located insert a @option{--script} option into the command line
29679 followed by the full path name found. If the file is not found then
29680 generate an error message. Note: the current working directory is not
29684 Print @var{str} as an error message. @var{str} is terminated by a newline.
29685 Use this when inconsistent options are detected.
29687 @item %(@var{name})
29688 Substitute the contents of spec string @var{name} at this point.
29690 @item %x@{@var{option}@}
29691 Accumulate an option for @samp{%X}.
29694 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29698 Output the accumulated assembler options specified by @option{-Wa}.
29701 Output the accumulated preprocessor options specified by @option{-Wp}.
29704 Process the @code{asm} spec. This is used to compute the
29705 switches to be passed to the assembler.
29708 Process the @code{asm_final} spec. This is a spec string for
29709 passing switches to an assembler post-processor, if such a program is
29713 Process the @code{link} spec. This is the spec for computing the
29714 command line passed to the linker. Typically it makes use of the
29715 @samp{%L %G %S %D and %E} sequences.
29718 Dump out a @option{-L} option for each directory that GCC believes might
29719 contain startup files. If the target supports multilibs then the
29720 current multilib directory is prepended to each of these paths.
29723 Process the @code{lib} spec. This is a spec string for deciding which
29724 libraries are included on the command line to the linker.
29727 Process the @code{libgcc} spec. This is a spec string for deciding
29728 which GCC support library is included on the command line to the linker.
29731 Process the @code{startfile} spec. This is a spec for deciding which
29732 object files are the first ones passed to the linker. Typically
29733 this might be a file named @file{crt0.o}.
29736 Process the @code{endfile} spec. This is a spec string that specifies
29737 the last object files that are passed to the linker.
29740 Process the @code{cpp} spec. This is used to construct the arguments
29741 to be passed to the C preprocessor.
29744 Process the @code{cc1} spec. This is used to construct the options to be
29745 passed to the actual C compiler (@command{cc1}).
29748 Process the @code{cc1plus} spec. This is used to construct the options to be
29749 passed to the actual C++ compiler (@command{cc1plus}).
29752 Substitute the variable part of a matched option. See below.
29753 Note that each comma in the substituted string is replaced by
29757 Remove all occurrences of @code{-S} from the command line. Note---this
29758 command is position dependent. @samp{%} commands in the spec string
29759 before this one see @code{-S}, @samp{%} commands in the spec string
29760 after this one do not.
29762 @item %:@var{function}(@var{args})
29763 Call the named function @var{function}, passing it @var{args}.
29764 @var{args} is first processed as a nested spec string, then split
29765 into an argument vector in the usual fashion. The function returns
29766 a string which is processed as if it had appeared literally as part
29767 of the current spec.
29769 The following built-in spec functions are provided:
29772 @item @code{getenv}
29773 The @code{getenv} spec function takes two arguments: an environment
29774 variable name and a string. If the environment variable is not
29775 defined, a fatal error is issued. Otherwise, the return value is the
29776 value of the environment variable concatenated with the string. For
29777 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29780 %:getenv(TOPDIR /include)
29783 expands to @file{/path/to/top/include}.
29785 @item @code{if-exists}
29786 The @code{if-exists} spec function takes one argument, an absolute
29787 pathname to a file. If the file exists, @code{if-exists} returns the
29788 pathname. Here is a small example of its usage:
29792 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29795 @item @code{if-exists-else}
29796 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29797 spec function, except that it takes two arguments. The first argument is
29798 an absolute pathname to a file. If the file exists, @code{if-exists-else}
29799 returns the pathname. If it does not exist, it returns the second argument.
29800 This way, @code{if-exists-else} can be used to select one file or another,
29801 based on the existence of the first. Here is a small example of its usage:
29805 crt0%O%s %:if-exists(crti%O%s) \
29806 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29809 @item @code{replace-outfile}
29810 The @code{replace-outfile} spec function takes two arguments. It looks for the
29811 first argument in the outfiles array and replaces it with the second argument. Here
29812 is a small example of its usage:
29815 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29818 @item @code{remove-outfile}
29819 The @code{remove-outfile} spec function takes one argument. It looks for the
29820 first argument in the outfiles array and removes it. Here is a small example
29824 %:remove-outfile(-lm)
29827 @item @code{pass-through-libs}
29828 The @code{pass-through-libs} spec function takes any number of arguments. It
29829 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29830 assumes are the names of linker input library archive files) and returns a
29831 result containing all the found arguments each prepended by
29832 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
29833 intended to be passed to the LTO linker plugin.
29836 %:pass-through-libs(%G %L %G)
29839 @item @code{print-asm-header}
29840 The @code{print-asm-header} function takes no arguments and simply
29841 prints a banner like:
29847 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29850 It is used to separate compiler options from assembler options
29851 in the @option{--target-help} output.
29855 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29856 If that switch is not specified, this substitutes nothing. Note that
29857 the leading dash is omitted when specifying this option, and it is
29858 automatically inserted if the substitution is performed. Thus the spec
29859 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29860 and outputs the command-line option @option{-foo}.
29863 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29864 deleted on failure.
29867 Substitutes all the switches specified to GCC whose names start
29868 with @code{-S}, but which also take an argument. This is used for
29869 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29870 GCC considers @option{-o foo} as being
29871 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
29872 text, including the space. Thus two arguments are generated.
29875 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29876 (the order of @code{S} and @code{T} in the spec is not significant).
29877 There can be any number of ampersand-separated variables; for each the
29878 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
29881 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29884 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29887 Substitutes @code{X} if one or more switches whose names start with
29888 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
29889 once, no matter how many such switches appeared. However, if @code{%*}
29890 appears somewhere in @code{X}, then @code{X} is substituted once
29891 for each matching switch, with the @code{%*} replaced by the part of
29892 that switch matching the @code{*}.
29894 If @code{%*} appears as the last part of a spec sequence then a space
29895 is added after the end of the last substitution. If there is more
29896 text in the sequence, however, then a space is not generated. This
29897 allows the @code{%*} substitution to be used as part of a larger
29898 string. For example, a spec string like this:
29901 %@{mcu=*:--script=%*/memory.ld@}
29905 when matching an option like @option{-mcu=newchip} produces:
29908 --script=newchip/memory.ld
29912 Substitutes @code{X}, if processing a file with suffix @code{S}.
29915 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29918 Substitutes @code{X}, if processing a file for language @code{S}.
29921 Substitutes @code{X}, if not processing a file for language @code{S}.
29924 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29925 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29926 @code{*} sequences as well, although they have a stronger binding than
29927 the @samp{|}. If @code{%*} appears in @code{X}, all of the
29928 alternatives must be starred, and only the first matching alternative
29931 For example, a spec string like this:
29934 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29938 outputs the following command-line options from the following input
29939 command-line options:
29944 -d fred.c -foo -baz -boggle
29945 -d jim.d -bar -baz -boggle
29948 @item %@{S:X; T:Y; :D@}
29950 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29951 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
29952 be as many clauses as you need. This may be combined with @code{.},
29953 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
29958 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29959 or similar construct can use a backslash to ignore the special meaning
29960 of the character following it, thus allowing literal matching of a
29961 character that is otherwise specially treated. For example,
29962 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29963 @option{-std=iso9899:1999} option is given.
29965 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29966 construct may contain other nested @samp{%} constructs or spaces, or
29967 even newlines. They are processed as usual, as described above.
29968 Trailing white space in @code{X} is ignored. White space may also
29969 appear anywhere on the left side of the colon in these constructs,
29970 except between @code{.} or @code{*} and the corresponding word.
29972 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29973 handled specifically in these constructs. If another value of
29974 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
29975 @option{-W} switch is found later in the command line, the earlier
29976 switch value is ignored, except with @{@code{S}*@} where @code{S} is
29977 just one letter, which passes all matching options.
29979 The character @samp{|} at the beginning of the predicate text is used to
29980 indicate that a command should be piped to the following command, but
29981 only if @option{-pipe} is specified.
29983 It is built into GCC which switches take arguments and which do not.
29984 (You might think it would be useful to generalize this to allow each
29985 compiler's spec to say which switches take arguments. But this cannot
29986 be done in a consistent fashion. GCC cannot even decide which input
29987 files have been specified without knowing which switches take arguments,
29988 and it must know which input files to compile in order to tell which
29991 GCC also knows implicitly that arguments starting in @option{-l} are to be
29992 treated as compiler output files, and passed to the linker in their
29993 proper position among the other output files.
29995 @node Environment Variables
29996 @section Environment Variables Affecting GCC
29997 @cindex environment variables
29999 @c man begin ENVIRONMENT
30000 This section describes several environment variables that affect how GCC
30001 operates. Some of them work by specifying directories or prefixes to use
30002 when searching for various kinds of files. Some are used to specify other
30003 aspects of the compilation environment.
30005 Note that you can also specify places to search using options such as
30006 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
30007 take precedence over places specified using environment variables, which
30008 in turn take precedence over those specified by the configuration of GCC@.
30009 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
30010 GNU Compiler Collection (GCC) Internals}.
30015 @c @itemx LC_COLLATE
30017 @c @itemx LC_MONETARY
30018 @c @itemx LC_NUMERIC
30023 @c @findex LC_COLLATE
30024 @findex LC_MESSAGES
30025 @c @findex LC_MONETARY
30026 @c @findex LC_NUMERIC
30030 These environment variables control the way that GCC uses
30031 localization information which allows GCC to work with different
30032 national conventions. GCC inspects the locale categories
30033 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
30034 so. These locale categories can be set to any value supported by your
30035 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
30036 Kingdom encoded in UTF-8.
30038 The @env{LC_CTYPE} environment variable specifies character
30039 classification. GCC uses it to determine the character boundaries in
30040 a string; this is needed for some multibyte encodings that contain quote
30041 and escape characters that are otherwise interpreted as a string
30044 The @env{LC_MESSAGES} environment variable specifies the language to
30045 use in diagnostic messages.
30047 If the @env{LC_ALL} environment variable is set, it overrides the value
30048 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
30049 and @env{LC_MESSAGES} default to the value of the @env{LANG}
30050 environment variable. If none of these variables are set, GCC
30051 defaults to traditional C English behavior.
30055 If @env{TMPDIR} is set, it specifies the directory to use for temporary
30056 files. GCC uses temporary files to hold the output of one stage of
30057 compilation which is to be used as input to the next stage: for example,
30058 the output of the preprocessor, which is the input to the compiler
30061 @item GCC_COMPARE_DEBUG
30062 @findex GCC_COMPARE_DEBUG
30063 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
30064 @option{-fcompare-debug} to the compiler driver. See the documentation
30065 of this option for more details.
30067 @item GCC_EXEC_PREFIX
30068 @findex GCC_EXEC_PREFIX
30069 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
30070 names of the subprograms executed by the compiler. No slash is added
30071 when this prefix is combined with the name of a subprogram, but you can
30072 specify a prefix that ends with a slash if you wish.
30074 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
30075 an appropriate prefix to use based on the pathname it is invoked with.
30077 If GCC cannot find the subprogram using the specified prefix, it
30078 tries looking in the usual places for the subprogram.
30080 The default value of @env{GCC_EXEC_PREFIX} is
30081 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
30082 the installed compiler. In many cases @var{prefix} is the value
30083 of @code{prefix} when you ran the @file{configure} script.
30085 Other prefixes specified with @option{-B} take precedence over this prefix.
30087 This prefix is also used for finding files such as @file{crt0.o} that are
30090 In addition, the prefix is used in an unusual way in finding the
30091 directories to search for header files. For each of the standard
30092 directories whose name normally begins with @samp{/usr/local/lib/gcc}
30093 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
30094 replacing that beginning with the specified prefix to produce an
30095 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
30096 @file{foo/bar} just before it searches the standard directory
30097 @file{/usr/local/lib/bar}.
30098 If a standard directory begins with the configured
30099 @var{prefix} then the value of @var{prefix} is replaced by
30100 @env{GCC_EXEC_PREFIX} when looking for header files.
30102 @item COMPILER_PATH
30103 @findex COMPILER_PATH
30104 The value of @env{COMPILER_PATH} is a colon-separated list of
30105 directories, much like @env{PATH}. GCC tries the directories thus
30106 specified when searching for subprograms, if it cannot find the
30107 subprograms using @env{GCC_EXEC_PREFIX}.
30110 @findex LIBRARY_PATH
30111 The value of @env{LIBRARY_PATH} is a colon-separated list of
30112 directories, much like @env{PATH}. When configured as a native compiler,
30113 GCC tries the directories thus specified when searching for special
30114 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
30115 using GCC also uses these directories when searching for ordinary
30116 libraries for the @option{-l} option (but directories specified with
30117 @option{-L} come first).
30121 @cindex locale definition
30122 This variable is used to pass locale information to the compiler. One way in
30123 which this information is used is to determine the character set to be used
30124 when character literals, string literals and comments are parsed in C and C++.
30125 When the compiler is configured to allow multibyte characters,
30126 the following values for @env{LANG} are recognized:
30130 Recognize JIS characters.
30132 Recognize SJIS characters.
30134 Recognize EUCJP characters.
30137 If @env{LANG} is not defined, or if it has some other value, then the
30138 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
30139 recognize and translate multibyte characters.
30143 Some additional environment variables affect the behavior of the
30146 @include cppenv.texi
30150 @node Precompiled Headers
30151 @section Using Precompiled Headers
30152 @cindex precompiled headers
30153 @cindex speed of compilation
30155 Often large projects have many header files that are included in every
30156 source file. The time the compiler takes to process these header files
30157 over and over again can account for nearly all of the time required to
30158 build the project. To make builds faster, GCC allows you to
30159 @dfn{precompile} a header file.
30161 To create a precompiled header file, simply compile it as you would any
30162 other file, if necessary using the @option{-x} option to make the driver
30163 treat it as a C or C++ header file. You may want to use a
30164 tool like @command{make} to keep the precompiled header up-to-date when
30165 the headers it contains change.
30167 A precompiled header file is searched for when @code{#include} is
30168 seen in the compilation. As it searches for the included file
30169 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
30170 compiler looks for a precompiled header in each directory just before it
30171 looks for the include file in that directory. The name searched for is
30172 the name specified in the @code{#include} with @samp{.gch} appended. If
30173 the precompiled header file cannot be used, it is ignored.
30175 For instance, if you have @code{#include "all.h"}, and you have
30176 @file{all.h.gch} in the same directory as @file{all.h}, then the
30177 precompiled header file is used if possible, and the original
30178 header is used otherwise.
30180 Alternatively, you might decide to put the precompiled header file in a
30181 directory and use @option{-I} to ensure that directory is searched
30182 before (or instead of) the directory containing the original header.
30183 Then, if you want to check that the precompiled header file is always
30184 used, you can put a file of the same name as the original header in this
30185 directory containing an @code{#error} command.
30187 This also works with @option{-include}. So yet another way to use
30188 precompiled headers, good for projects not designed with precompiled
30189 header files in mind, is to simply take most of the header files used by
30190 a project, include them from another header file, precompile that header
30191 file, and @option{-include} the precompiled header. If the header files
30192 have guards against multiple inclusion, they are skipped because
30193 they've already been included (in the precompiled header).
30195 If you need to precompile the same header file for different
30196 languages, targets, or compiler options, you can instead make a
30197 @emph{directory} named like @file{all.h.gch}, and put each precompiled
30198 header in the directory, perhaps using @option{-o}. It doesn't matter
30199 what you call the files in the directory; every precompiled header in
30200 the directory is considered. The first precompiled header
30201 encountered in the directory that is valid for this compilation is
30202 used; they're searched in no particular order.
30204 There are many other possibilities, limited only by your imagination,
30205 good sense, and the constraints of your build system.
30207 A precompiled header file can be used only when these conditions apply:
30211 Only one precompiled header can be used in a particular compilation.
30214 A precompiled header cannot be used once the first C token is seen. You
30215 can have preprocessor directives before a precompiled header; you cannot
30216 include a precompiled header from inside another header.
30219 The precompiled header file must be produced for the same language as
30220 the current compilation. You cannot use a C precompiled header for a C++
30224 The precompiled header file must have been produced by the same compiler
30225 binary as the current compilation is using.
30228 Any macros defined before the precompiled header is included must
30229 either be defined in the same way as when the precompiled header was
30230 generated, or must not affect the precompiled header, which usually
30231 means that they don't appear in the precompiled header at all.
30233 The @option{-D} option is one way to define a macro before a
30234 precompiled header is included; using a @code{#define} can also do it.
30235 There are also some options that define macros implicitly, like
30236 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
30239 @item If debugging information is output when using the precompiled
30240 header, using @option{-g} or similar, the same kind of debugging information
30241 must have been output when building the precompiled header. However,
30242 a precompiled header built using @option{-g} can be used in a compilation
30243 when no debugging information is being output.
30245 @item The same @option{-m} options must generally be used when building
30246 and using the precompiled header. @xref{Submodel Options},
30247 for any cases where this rule is relaxed.
30249 @item Each of the following options must be the same when building and using
30250 the precompiled header:
30252 @gccoptlist{-fexceptions}
30255 Some other command-line options starting with @option{-f},
30256 @option{-p}, or @option{-O} must be defined in the same way as when
30257 the precompiled header was generated. At present, it's not clear
30258 which options are safe to change and which are not; the safest choice
30259 is to use exactly the same options when generating and using the
30260 precompiled header. The following are known to be safe:
30262 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
30263 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
30264 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
30269 For all of these except the last, the compiler automatically
30270 ignores the precompiled header if the conditions aren't met. If you
30271 find an option combination that doesn't work and doesn't cause the
30272 precompiled header to be ignored, please consider filing a bug report,
30275 If you do use differing options when generating and using the
30276 precompiled header, the actual behavior is a mixture of the
30277 behavior for the options. For instance, if you use @option{-g} to
30278 generate the precompiled header but not when using it, you may or may
30279 not get debugging information for routines in the precompiled header.