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}
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-include-dirs -Wmissing-profile @gol
323 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
324 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
325 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
326 -Woverride-init-side-effects -Woverlength-strings @gol
327 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
328 -Wparentheses -Wno-pedantic-ms-format @gol
329 -Wplacement-new -Wplacement-new=@var{n} @gol
330 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
331 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
332 -Wrestrict -Wno-return-local-addr @gol
333 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
334 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
335 -Wshift-overflow -Wshift-overflow=@var{n} @gol
336 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
337 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
338 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
339 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
340 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
341 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
342 -Wstringop-overflow=@var{n} -Wstringop-truncation @gol
343 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
344 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
345 -Wmissing-format-attribute -Wsubobject-linkage @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 @gol
418 -fipa-pta -fipa-profile -fipa-pure-const -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} -fprofile-exclude-files=@var{regex} @gol
489 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
490 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
491 -fsanitize-undefined-trap-on-error -fbounds-check @gol
492 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
493 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
494 -fstack-protector-explicit -fstack-check @gol
495 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
496 -fno-stack-limit -fsplit-stack @gol
497 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
498 -fvtv-counts -fvtv-debug @gol
499 -finstrument-functions @gol
500 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
501 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
503 @item Preprocessor Options
504 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
505 @gccoptlist{-A@var{question}=@var{answer} @gol
506 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
507 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
508 -dD -dI -dM -dN -dU @gol
509 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
510 -fexec-charset=@var{charset} -fextended-identifiers @gol
511 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
512 -fno-canonical-system-headers @gol -fpch-deps -fpch-preprocess @gol
513 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
514 -fwide-exec-charset=@var{charset} -fworking-directory @gol
515 -H -imacros @var{file} -include @var{file} @gol
516 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
517 -no-integrated-cpp -P -pthread -remap @gol
518 -traditional -traditional-cpp -trigraphs @gol
519 -U@var{macro} -undef @gol
520 -Wp,@var{option} -Xpreprocessor @var{option}}
522 @item Assembler Options
523 @xref{Assembler Options,,Passing Options to the Assembler}.
524 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
527 @xref{Link Options,,Options for Linking}.
528 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
529 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
530 -e @var{entry} --entry=@var{entry} @gol
531 -pie -pthread -r -rdynamic @gol
532 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
533 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
534 -shared -shared-libgcc -symbolic @gol
535 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
536 -u @var{symbol} -z @var{keyword}}
538 @item Directory Options
539 @xref{Directory Options,,Options for Directory Search}.
540 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
541 -idirafter @var{dir} @gol
542 -imacros @var{file} -imultilib @var{dir} @gol
543 -iplugindir=@var{dir} -iprefix @var{file} @gol
544 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
545 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
546 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
547 -nostdinc -nostdinc++ --sysroot=@var{dir}}
549 @item Code Generation Options
550 @xref{Code Gen Options,,Options for Code Generation Conventions}.
551 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
552 -ffixed-@var{reg} -fexceptions @gol
553 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
554 -fasynchronous-unwind-tables @gol
556 -finhibit-size-directive -fno-common -fno-ident @gol
557 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
558 -fno-jump-tables @gol
559 -frecord-gcc-switches @gol
560 -freg-struct-return -fshort-enums -fshort-wchar @gol
561 -fverbose-asm -fpack-struct[=@var{n}] @gol
562 -fleading-underscore -ftls-model=@var{model} @gol
563 -fstack-reuse=@var{reuse_level} @gol
564 -ftrampolines -ftrapv -fwrapv @gol
565 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
566 -fstrict-volatile-bitfields -fsync-libcalls}
568 @item Developer Options
569 @xref{Developer Options,,GCC Developer Options}.
570 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
571 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
572 -fdbg-cnt=@var{counter-value-list} @gol
573 -fdisable-ipa-@var{pass_name} @gol
574 -fdisable-rtl-@var{pass_name} @gol
575 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
576 -fdisable-tree-@var{pass_name} @gol
577 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
578 -fdump-debug -fdump-earlydebug @gol
579 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
580 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
581 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
582 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
584 -fdump-lang-@var{switch} @gol
585 -fdump-lang-@var{switch}-@var{options} @gol
586 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
588 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
589 -fdump-statistics @gol
591 -fdump-tree-@var{switch} @gol
592 -fdump-tree-@var{switch}-@var{options} @gol
593 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
594 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
595 -fenable-@var{kind}-@var{pass} @gol
596 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
597 -fira-verbose=@var{n} @gol
598 -flto-report -flto-report-wpa -fmem-report-wpa @gol
599 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
600 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
601 -fprofile-report @gol
602 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
603 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
604 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
605 -fvar-tracking-assignments-toggle -gtoggle @gol
606 -print-file-name=@var{library} -print-libgcc-file-name @gol
607 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
608 -print-prog-name=@var{program} -print-search-dirs -Q @gol
609 -print-sysroot -print-sysroot-headers-suffix @gol
610 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
612 @item Machine-Dependent Options
613 @xref{Submodel Options,,Machine-Dependent Options}.
614 @c This list is ordered alphanumerically by subsection name.
615 @c Try and put the significant identifier (CPU or system) first,
616 @c so users have a clue at guessing where the ones they want will be.
618 @emph{AArch64 Options}
619 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
620 -mgeneral-regs-only @gol
621 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
622 -mstrict-align -mno-strict-align @gol
623 -momit-leaf-frame-pointer @gol
624 -mtls-dialect=desc -mtls-dialect=traditional @gol
625 -mtls-size=@var{size} @gol
626 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
627 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
628 -mpc-relative-literal-loads @gol
629 -msign-return-address=@var{scope} @gol
630 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
631 -moverride=@var{string} -mverbose-cost-dump -mtrack-speculation}
633 @emph{Adapteva Epiphany Options}
634 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
635 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
636 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
637 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
638 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
639 -msplit-vecmove-early -m1reg-@var{reg}}
642 @gccoptlist{-mbarrel-shifter -mjli-always @gol
643 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
644 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
645 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
646 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
647 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
648 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
649 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
650 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
651 -mvolatile-cache -mtp-regno=@var{regno} @gol
652 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
653 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
654 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
655 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
656 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
657 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
658 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
659 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
662 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
663 -mabi=@var{name} @gol
664 -mapcs-stack-check -mno-apcs-stack-check @gol
665 -mapcs-reentrant -mno-apcs-reentrant @gol
666 -msched-prolog -mno-sched-prolog @gol
667 -mlittle-endian -mbig-endian @gol
669 -mfloat-abi=@var{name} @gol
670 -mfp16-format=@var{name}
671 -mthumb-interwork -mno-thumb-interwork @gol
672 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
673 -mtune=@var{name} -mprint-tune-info @gol
674 -mstructure-size-boundary=@var{n} @gol
675 -mabort-on-noreturn @gol
676 -mlong-calls -mno-long-calls @gol
677 -msingle-pic-base -mno-single-pic-base @gol
678 -mpic-register=@var{reg} @gol
679 -mnop-fun-dllimport @gol
680 -mpoke-function-name @gol
681 -mthumb -marm -mflip-thumb @gol
682 -mtpcs-frame -mtpcs-leaf-frame @gol
683 -mcaller-super-interworking -mcallee-super-interworking @gol
684 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
685 -mword-relocations @gol
686 -mfix-cortex-m3-ldrd @gol
687 -munaligned-access @gol
688 -mneon-for-64bits @gol
689 -mslow-flash-data @gol
690 -masm-syntax-unified @gol
692 -mverbose-cost-dump @gol
697 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
698 -mbranch-cost=@var{cost} @gol
699 -mcall-prologues -mgas-isr-prologues -mint8 @gol
700 -mn_flash=@var{size} -mno-interrupts @gol
701 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
702 -mfract-convert-truncate @gol
703 -mshort-calls -nodevicelib @gol
704 -Waddr-space-convert -Wmisspelled-isr}
706 @emph{Blackfin Options}
707 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
708 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
709 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
710 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
711 -mno-id-shared-library -mshared-library-id=@var{n} @gol
712 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
713 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
714 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
718 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
719 -msim -msdata=@var{sdata-type}}
722 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
723 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
724 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
725 -mstack-align -mdata-align -mconst-align @gol
726 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
727 -melf -maout -melinux -mlinux -sim -sim2 @gol
728 -mmul-bug-workaround -mno-mul-bug-workaround}
731 @gccoptlist{-mmac @gol
732 -mcr16cplus -mcr16c @gol
733 -msim -mint32 -mbit-ops
734 -mdata-model=@var{model}}
737 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
738 -mbig-endian -EB -mlittle-endian -EL @gol
739 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
740 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
741 -mdsp -medsp -mvdsp @gol
742 -mdiv -msmart -mhigh-registers -manchor @gol
743 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
744 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
746 @emph{Darwin Options}
747 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
748 -arch_only -bind_at_load -bundle -bundle_loader @gol
749 -client_name -compatibility_version -current_version @gol
751 -dependency-file -dylib_file -dylinker_install_name @gol
752 -dynamic -dynamiclib -exported_symbols_list @gol
753 -filelist -flat_namespace -force_cpusubtype_ALL @gol
754 -force_flat_namespace -headerpad_max_install_names @gol
756 -image_base -init -install_name -keep_private_externs @gol
757 -multi_module -multiply_defined -multiply_defined_unused @gol
758 -noall_load -no_dead_strip_inits_and_terms @gol
759 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
760 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
761 -private_bundle -read_only_relocs -sectalign @gol
762 -sectobjectsymbols -whyload -seg1addr @gol
763 -sectcreate -sectobjectsymbols -sectorder @gol
764 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
765 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
766 -segprot -segs_read_only_addr -segs_read_write_addr @gol
767 -single_module -static -sub_library -sub_umbrella @gol
768 -twolevel_namespace -umbrella -undefined @gol
769 -unexported_symbols_list -weak_reference_mismatches @gol
770 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
771 -mkernel -mone-byte-bool}
773 @emph{DEC Alpha Options}
774 @gccoptlist{-mno-fp-regs -msoft-float @gol
775 -mieee -mieee-with-inexact -mieee-conformant @gol
776 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
777 -mtrap-precision=@var{mode} -mbuild-constants @gol
778 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
779 -mbwx -mmax -mfix -mcix @gol
780 -mfloat-vax -mfloat-ieee @gol
781 -mexplicit-relocs -msmall-data -mlarge-data @gol
782 -msmall-text -mlarge-text @gol
783 -mmemory-latency=@var{time}}
786 @gccoptlist{-msmall-model -mno-lsim}
789 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
792 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
793 -mhard-float -msoft-float @gol
794 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
795 -mdouble -mno-double @gol
796 -mmedia -mno-media -mmuladd -mno-muladd @gol
797 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
798 -mlinked-fp -mlong-calls -malign-labels @gol
799 -mlibrary-pic -macc-4 -macc-8 @gol
800 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
801 -moptimize-membar -mno-optimize-membar @gol
802 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
803 -mvliw-branch -mno-vliw-branch @gol
804 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
805 -mno-nested-cond-exec -mtomcat-stats @gol
809 @emph{GNU/Linux Options}
810 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
811 -tno-android-cc -tno-android-ld}
813 @emph{H8/300 Options}
814 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
817 @gccoptlist{-march=@var{architecture-type} @gol
818 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
819 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
820 -mfixed-range=@var{register-range} @gol
821 -mjump-in-delay -mlinker-opt -mlong-calls @gol
822 -mlong-load-store -mno-disable-fpregs @gol
823 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
824 -mno-jump-in-delay -mno-long-load-store @gol
825 -mno-portable-runtime -mno-soft-float @gol
826 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
827 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
828 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
829 -munix=@var{unix-std} -nolibdld -static -threads}
832 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
833 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
834 -mconstant-gp -mauto-pic -mfused-madd @gol
835 -minline-float-divide-min-latency @gol
836 -minline-float-divide-max-throughput @gol
837 -mno-inline-float-divide @gol
838 -minline-int-divide-min-latency @gol
839 -minline-int-divide-max-throughput @gol
840 -mno-inline-int-divide @gol
841 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
842 -mno-inline-sqrt @gol
843 -mdwarf2-asm -mearly-stop-bits @gol
844 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
845 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
846 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
847 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
848 -msched-spec-ldc -msched-spec-control-ldc @gol
849 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
850 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
851 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
852 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
855 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
856 -msign-extend-enabled -muser-enabled}
858 @emph{M32R/D Options}
859 @gccoptlist{-m32r2 -m32rx -m32r @gol
861 -malign-loops -mno-align-loops @gol
862 -missue-rate=@var{number} @gol
863 -mbranch-cost=@var{number} @gol
864 -mmodel=@var{code-size-model-type} @gol
865 -msdata=@var{sdata-type} @gol
866 -mno-flush-func -mflush-func=@var{name} @gol
867 -mno-flush-trap -mflush-trap=@var{number} @gol
871 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
873 @emph{M680x0 Options}
874 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
875 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
876 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
877 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
878 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
879 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
880 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
881 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
882 -mxgot -mno-xgot -mlong-jump-table-offsets}
885 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
886 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
887 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
888 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
889 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
892 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
893 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
894 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
895 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
898 @emph{MicroBlaze Options}
899 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
900 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
901 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
902 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
903 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}
904 -mpic-data-is-text-relative}
907 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
908 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
909 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
910 -mips16 -mno-mips16 -mflip-mips16 @gol
911 -minterlink-compressed -mno-interlink-compressed @gol
912 -minterlink-mips16 -mno-interlink-mips16 @gol
913 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
914 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
915 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
916 -mno-float -msingle-float -mdouble-float @gol
917 -modd-spreg -mno-odd-spreg @gol
918 -mabs=@var{mode} -mnan=@var{encoding} @gol
919 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
922 -mvirt -mno-virt @gol
925 -mginv -mno-ginv @gol
926 -mmicromips -mno-micromips @gol
928 -mloongson-mmi -mno-loongson-mmi @gol
929 -mloongson-ext -mno-loongson-ext @gol
930 -mloongson-ext2 -mno-loongson-ext2 @gol
931 -mfpu=@var{fpu-type} @gol
932 -msmartmips -mno-smartmips @gol
933 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
934 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
935 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
936 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
937 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
938 -membedded-data -mno-embedded-data @gol
939 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
940 -mcode-readable=@var{setting} @gol
941 -msplit-addresses -mno-split-addresses @gol
942 -mexplicit-relocs -mno-explicit-relocs @gol
943 -mcheck-zero-division -mno-check-zero-division @gol
944 -mdivide-traps -mdivide-breaks @gol
945 -mload-store-pairs -mno-load-store-pairs @gol
946 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
947 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
948 -mfix-24k -mno-fix-24k @gol
949 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
950 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
951 -mfix-vr4120 -mno-fix-vr4120 @gol
952 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
953 -mflush-func=@var{func} -mno-flush-func @gol
954 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
955 -mcompact-branches=@var{policy} @gol
956 -mfp-exceptions -mno-fp-exceptions @gol
957 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
958 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
959 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
960 -mframe-header-opt -mno-frame-header-opt}
963 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
964 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
965 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
966 -mno-base-addresses -msingle-exit -mno-single-exit}
968 @emph{MN10300 Options}
969 @gccoptlist{-mmult-bug -mno-mult-bug @gol
970 -mno-am33 -mam33 -mam33-2 -mam34 @gol
971 -mtune=@var{cpu-type} @gol
972 -mreturn-pointer-on-d0 @gol
973 -mno-crt0 -mrelax -mliw -msetlb}
976 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
978 @emph{MSP430 Options}
979 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
981 -mcode-region= -mdata-region= @gol
982 -msilicon-errata= -msilicon-errata-warn= @gol
986 @gccoptlist{-mbig-endian -mlittle-endian @gol
987 -mreduced-regs -mfull-regs @gol
988 -mcmov -mno-cmov @gol
989 -mext-perf -mno-ext-perf @gol
990 -mext-perf2 -mno-ext-perf2 @gol
991 -mext-string -mno-ext-string @gol
992 -mv3push -mno-v3push @gol
993 -m16bit -mno-16bit @gol
994 -misr-vector-size=@var{num} @gol
995 -mcache-block-size=@var{num} @gol
996 -march=@var{arch} @gol
997 -mcmodel=@var{code-model} @gol
1000 @emph{Nios II Options}
1001 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1002 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1004 -mno-bypass-cache -mbypass-cache @gol
1005 -mno-cache-volatile -mcache-volatile @gol
1006 -mno-fast-sw-div -mfast-sw-div @gol
1007 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1008 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1009 -mcustom-fpu-cfg=@var{name} @gol
1010 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1011 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1013 @emph{Nvidia PTX Options}
1014 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1016 @emph{OpenRISC Options}
1017 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1018 -msoft-mul -msoft-div @gol
1019 -mcmov -mror -msext -msfimm -mshftimm}
1021 @emph{PDP-11 Options}
1022 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1023 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1024 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1026 @emph{picoChip Options}
1027 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1028 -msymbol-as-address -mno-inefficient-warnings}
1030 @emph{PowerPC Options}
1031 See RS/6000 and PowerPC Options.
1033 @emph{PowerPC SPE Options}
1034 @gccoptlist{-mcpu=@var{cpu-type} @gol
1035 -mtune=@var{cpu-type} @gol
1036 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb @gol
1037 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1038 -m32 -mxl-compat -mno-xl-compat @gol
1039 -malign-power -malign-natural @gol
1040 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1041 -msingle-float -mdouble-float @gol
1042 -mupdate -mno-update @gol
1043 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1044 -mstrict-align -mno-strict-align -mrelocatable @gol
1045 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1046 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1047 -msingle-pic-base @gol
1048 -mprioritize-restricted-insns=@var{priority} @gol
1049 -msched-costly-dep=@var{dependence_type} @gol
1050 -minsert-sched-nops=@var{scheme} @gol
1051 -mcall-sysv -mcall-netbsd @gol
1052 -maix-struct-return -msvr4-struct-return @gol
1053 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1054 -mblock-move-inline-limit=@var{num} @gol
1055 -misel -mno-isel @gol
1056 -misel=yes -misel=no @gol
1058 -mspe=yes -mspe=no @gol
1059 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
1060 -mprototype -mno-prototype @gol
1061 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1062 -msdata=@var{opt} -mvxworks -G @var{num} @gol
1063 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1064 -mno-recip-precision @gol
1065 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1066 -msave-toc-indirect -mno-save-toc-indirect @gol
1067 -mcompat-align-parm -mno-compat-align-parm @gol
1068 -mfloat128 -mno-float128 @gol
1069 -mgnu-attribute -mno-gnu-attribute @gol
1070 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1071 -mstack-protector-guard-offset=@var{offset}}
1073 @emph{RISC-V Options}
1074 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1076 -mabi=@var{ABI-string} @gol
1077 -mfdiv -mno-fdiv @gol
1079 -march=@var{ISA-string} @gol
1080 -mtune=@var{processor-string} @gol
1081 -mpreferred-stack-boundary=@var{num} @gol
1082 -msmall-data-limit=@var{N-bytes} @gol
1083 -msave-restore -mno-save-restore @gol
1084 -mstrict-align -mno-strict-align @gol
1085 -mcmodel=medlow -mcmodel=medany @gol
1086 -mexplicit-relocs -mno-explicit-relocs @gol
1087 -mrelax -mno-relax @gol}
1090 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1091 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1092 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1094 @emph{RS/6000 and PowerPC Options}
1095 @gccoptlist{-mcpu=@var{cpu-type} @gol
1096 -mtune=@var{cpu-type} @gol
1097 -mcmodel=@var{code-model} @gol
1099 -maltivec -mno-altivec @gol
1100 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1101 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1102 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1103 -mfprnd -mno-fprnd @gol
1104 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
1105 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1106 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1107 -malign-power -malign-natural @gol
1108 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1109 -mupdate -mno-update @gol
1110 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1111 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1112 -mstrict-align -mno-strict-align -mrelocatable @gol
1113 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1114 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1115 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
1116 -mprioritize-restricted-insns=@var{priority} @gol
1117 -msched-costly-dep=@var{dependence_type} @gol
1118 -minsert-sched-nops=@var{scheme} @gol
1119 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1120 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1121 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1122 -mtraceback=@var{traceback_type} @gol
1123 -maix-struct-return -msvr4-struct-return @gol
1124 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1125 -mblock-move-inline-limit=@var{num} @gol
1126 -mblock-compare-inline-limit=@var{num} @gol
1127 -mblock-compare-inline-loop-limit=@var{num} @gol
1128 -mstring-compare-inline-limit=@var{num} @gol
1129 -misel -mno-isel @gol
1130 -mvrsave -mno-vrsave @gol
1131 -mmulhw -mno-mulhw @gol
1132 -mdlmzb -mno-dlmzb @gol
1133 -mprototype -mno-prototype @gol
1134 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1135 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1136 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1137 -mno-recip-precision @gol
1138 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1139 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1140 -msave-toc-indirect -mno-save-toc-indirect @gol
1141 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1142 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1143 -mquad-memory -mno-quad-memory @gol
1144 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1145 -mcompat-align-parm -mno-compat-align-parm @gol
1146 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1147 -mgnu-attribute -mno-gnu-attribute @gol
1148 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1149 -mstack-protector-guard-offset=@var{offset}}
1152 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1154 -mbig-endian-data -mlittle-endian-data @gol
1157 -mas100-syntax -mno-as100-syntax@gol
1159 -mmax-constant-size=@gol
1162 -mallow-string-insns -mno-allow-string-insns@gol
1164 -mno-warn-multiple-fast-interrupts@gol
1165 -msave-acc-in-interrupts}
1167 @emph{S/390 and zSeries Options}
1168 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1169 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1170 -mlong-double-64 -mlong-double-128 @gol
1171 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1172 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1173 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1174 -mhtm -mvx -mzvector @gol
1175 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1176 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1177 -mhotpatch=@var{halfwords},@var{halfwords}}
1179 @emph{Score Options}
1180 @gccoptlist{-meb -mel @gol
1184 -mscore5 -mscore5u -mscore7 -mscore7d}
1187 @gccoptlist{-m1 -m2 -m2e @gol
1188 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1190 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1191 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1192 -mb -ml -mdalign -mrelax @gol
1193 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1194 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1195 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1196 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1197 -maccumulate-outgoing-args @gol
1198 -matomic-model=@var{atomic-model} @gol
1199 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1200 -mcbranch-force-delay-slot @gol
1201 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1202 -mpretend-cmove -mtas}
1204 @emph{Solaris 2 Options}
1205 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1208 @emph{SPARC Options}
1209 @gccoptlist{-mcpu=@var{cpu-type} @gol
1210 -mtune=@var{cpu-type} @gol
1211 -mcmodel=@var{code-model} @gol
1212 -mmemory-model=@var{mem-model} @gol
1213 -m32 -m64 -mapp-regs -mno-app-regs @gol
1214 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1215 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1216 -mhard-quad-float -msoft-quad-float @gol
1217 -mstack-bias -mno-stack-bias @gol
1218 -mstd-struct-return -mno-std-struct-return @gol
1219 -munaligned-doubles -mno-unaligned-doubles @gol
1220 -muser-mode -mno-user-mode @gol
1221 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1222 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1223 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1224 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1225 -mpopc -mno-popc -msubxc -mno-subxc @gol
1226 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1230 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1231 -msafe-dma -munsafe-dma @gol
1233 -msmall-mem -mlarge-mem -mstdmain @gol
1234 -mfixed-range=@var{register-range} @gol
1236 -maddress-space-conversion -mno-address-space-conversion @gol
1237 -mcache-size=@var{cache-size} @gol
1238 -matomic-updates -mno-atomic-updates}
1240 @emph{System V Options}
1241 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1243 @emph{TILE-Gx Options}
1244 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1245 -mcmodel=@var{code-model}}
1247 @emph{TILEPro Options}
1248 @gccoptlist{-mcpu=@var{cpu} -m32}
1251 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1252 -mprolog-function -mno-prolog-function -mspace @gol
1253 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1254 -mapp-regs -mno-app-regs @gol
1255 -mdisable-callt -mno-disable-callt @gol
1256 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1257 -mv850e -mv850 -mv850e3v5 @gol
1268 @gccoptlist{-mg -mgnu -munix}
1270 @emph{Visium Options}
1271 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1272 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1275 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1276 -mpointer-size=@var{size}}
1278 @emph{VxWorks Options}
1279 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1280 -Xbind-lazy -Xbind-now}
1283 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1284 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1285 -mfpmath=@var{unit} @gol
1286 -masm=@var{dialect} -mno-fancy-math-387 @gol
1287 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1288 -mno-wide-multiply -mrtd -malign-double @gol
1289 -mpreferred-stack-boundary=@var{num} @gol
1290 -mincoming-stack-boundary=@var{num} @gol
1291 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1292 -mrecip -mrecip=@var{opt} @gol
1293 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1294 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1295 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1296 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1297 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd -mptwrite @gol
1298 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1299 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1300 -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp @gol
1301 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1302 -mshstk -mforce-indirect-call -mavx512vbmi2 @gol
1303 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq
1305 -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.
1681 If the @option{-Q} option appears on the command line before the
1682 @option{--help=} option, then the descriptive text displayed by
1683 @option{--help=} is changed. Instead of describing the displayed
1684 options, an indication is given as to whether the option is enabled,
1685 disabled or set to a specific value (assuming that the compiler
1686 knows this at the point where the @option{--help=} option is used).
1688 Here is a truncated example from the ARM port of @command{gcc}:
1691 % gcc -Q -mabi=2 --help=target -c
1692 The following options are target specific:
1694 -mabort-on-noreturn [disabled]
1698 The output is sensitive to the effects of previous command-line
1699 options, so for example it is possible to find out which optimizations
1700 are enabled at @option{-O2} by using:
1703 -Q -O2 --help=optimizers
1706 Alternatively you can discover which binary optimizations are enabled
1707 by @option{-O3} by using:
1710 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1711 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1712 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1717 Display the version number and copyrights of the invoked GCC@.
1719 @item -pass-exit-codes
1720 @opindex pass-exit-codes
1721 Normally the @command{gcc} program exits with the code of 1 if any
1722 phase of the compiler returns a non-success return code. If you specify
1723 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1724 the numerically highest error produced by any phase returning an error
1725 indication. The C, C++, and Fortran front ends return 4 if an internal
1726 compiler error is encountered.
1730 Use pipes rather than temporary files for communication between the
1731 various stages of compilation. This fails to work on some systems where
1732 the assembler is unable to read from a pipe; but the GNU assembler has
1735 @item -specs=@var{file}
1737 Process @var{file} after the compiler reads in the standard @file{specs}
1738 file, in order to override the defaults which the @command{gcc} driver
1739 program uses when determining what switches to pass to @command{cc1},
1740 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1741 @option{-specs=@var{file}} can be specified on the command line, and they
1742 are processed in order, from left to right. @xref{Spec Files}, for
1743 information about the format of the @var{file}.
1747 Invoke all subcommands under a wrapper program. The name of the
1748 wrapper program and its parameters are passed as a comma separated
1752 gcc -c t.c -wrapper gdb,--args
1756 This invokes all subprograms of @command{gcc} under
1757 @samp{gdb --args}, thus the invocation of @command{cc1} is
1758 @samp{gdb --args cc1 @dots{}}.
1760 @item -ffile-prefix-map=@var{old}=@var{new}
1761 @opindex ffile-prefix-map
1762 When compiling files residing in directory @file{@var{old}}, record
1763 any references to them in the result of the compilation as if the
1764 files resided in directory @file{@var{new}} instead. Specifying this
1765 option is equivalent to specifying all the individual
1766 @option{-f*-prefix-map} options. This can be used to make reproducible
1767 builds that are location independent. See also
1768 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1770 @item -fplugin=@var{name}.so
1772 Load the plugin code in file @var{name}.so, assumed to be a
1773 shared object to be dlopen'd by the compiler. The base name of
1774 the shared object file is used to identify the plugin for the
1775 purposes of argument parsing (See
1776 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1777 Each plugin should define the callback functions specified in the
1780 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1781 @opindex fplugin-arg
1782 Define an argument called @var{key} with a value of @var{value}
1783 for the plugin called @var{name}.
1785 @item -fdump-ada-spec@r{[}-slim@r{]}
1786 @opindex fdump-ada-spec
1787 For C and C++ source and include files, generate corresponding Ada specs.
1788 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1789 GNAT User's Guide}, which provides detailed documentation on this feature.
1791 @item -fada-spec-parent=@var{unit}
1792 @opindex fada-spec-parent
1793 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1794 Ada specs as child units of parent @var{unit}.
1796 @item -fdump-go-spec=@var{file}
1797 @opindex fdump-go-spec
1798 For input files in any language, generate corresponding Go
1799 declarations in @var{file}. This generates Go @code{const},
1800 @code{type}, @code{var}, and @code{func} declarations which may be a
1801 useful way to start writing a Go interface to code written in some
1804 @include @value{srcdir}/../libiberty/at-file.texi
1808 @section Compiling C++ Programs
1810 @cindex suffixes for C++ source
1811 @cindex C++ source file suffixes
1812 C++ source files conventionally use one of the suffixes @samp{.C},
1813 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1814 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1815 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1816 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1817 files with these names and compiles them as C++ programs even if you
1818 call the compiler the same way as for compiling C programs (usually
1819 with the name @command{gcc}).
1823 However, the use of @command{gcc} does not add the C++ library.
1824 @command{g++} is a program that calls GCC and automatically specifies linking
1825 against the C++ library. It treats @samp{.c},
1826 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1827 files unless @option{-x} is used. This program is also useful when
1828 precompiling a C header file with a @samp{.h} extension for use in C++
1829 compilations. On many systems, @command{g++} is also installed with
1830 the name @command{c++}.
1832 @cindex invoking @command{g++}
1833 When you compile C++ programs, you may specify many of the same
1834 command-line options that you use for compiling programs in any
1835 language; or command-line options meaningful for C and related
1836 languages; or options that are meaningful only for C++ programs.
1837 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1838 explanations of options for languages related to C@.
1839 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1840 explanations of options that are meaningful only for C++ programs.
1842 @node C Dialect Options
1843 @section Options Controlling C Dialect
1844 @cindex dialect options
1845 @cindex language dialect options
1846 @cindex options, dialect
1848 The following options control the dialect of C (or languages derived
1849 from C, such as C++, Objective-C and Objective-C++) that the compiler
1853 @cindex ANSI support
1857 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1858 equivalent to @option{-std=c++98}.
1860 This turns off certain features of GCC that are incompatible with ISO
1861 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1862 such as the @code{asm} and @code{typeof} keywords, and
1863 predefined macros such as @code{unix} and @code{vax} that identify the
1864 type of system you are using. It also enables the undesirable and
1865 rarely used ISO trigraph feature. For the C compiler,
1866 it disables recognition of C++ style @samp{//} comments as well as
1867 the @code{inline} keyword.
1869 The alternate keywords @code{__asm__}, @code{__extension__},
1870 @code{__inline__} and @code{__typeof__} continue to work despite
1871 @option{-ansi}. You would not want to use them in an ISO C program, of
1872 course, but it is useful to put them in header files that might be included
1873 in compilations done with @option{-ansi}. Alternate predefined macros
1874 such as @code{__unix__} and @code{__vax__} are also available, with or
1875 without @option{-ansi}.
1877 The @option{-ansi} option does not cause non-ISO programs to be
1878 rejected gratuitously. For that, @option{-Wpedantic} is required in
1879 addition to @option{-ansi}. @xref{Warning Options}.
1881 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1882 option is used. Some header files may notice this macro and refrain
1883 from declaring certain functions or defining certain macros that the
1884 ISO standard doesn't call for; this is to avoid interfering with any
1885 programs that might use these names for other things.
1887 Functions that are normally built in but do not have semantics
1888 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1889 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1890 built-in functions provided by GCC}, for details of the functions
1895 Determine the language standard. @xref{Standards,,Language Standards
1896 Supported by GCC}, for details of these standard versions. This option
1897 is currently only supported when compiling C or C++.
1899 The compiler can accept several base standards, such as @samp{c90} or
1900 @samp{c++98}, and GNU dialects of those standards, such as
1901 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1902 compiler accepts all programs following that standard plus those
1903 using GNU extensions that do not contradict it. For example,
1904 @option{-std=c90} turns off certain features of GCC that are
1905 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1906 keywords, but not other GNU extensions that do not have a meaning in
1907 ISO C90, such as omitting the middle term of a @code{?:}
1908 expression. On the other hand, when a GNU dialect of a standard is
1909 specified, all features supported by the compiler are enabled, even when
1910 those features change the meaning of the base standard. As a result, some
1911 strict-conforming programs may be rejected. The particular standard
1912 is used by @option{-Wpedantic} to identify which features are GNU
1913 extensions given that version of the standard. For example
1914 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1915 comments, while @option{-std=gnu99 -Wpedantic} does not.
1917 A value for this option must be provided; possible values are
1923 Support all ISO C90 programs (certain GNU extensions that conflict
1924 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1926 @item iso9899:199409
1927 ISO C90 as modified in amendment 1.
1933 ISO C99. This standard is substantially completely supported, modulo
1934 bugs and floating-point issues
1935 (mainly but not entirely relating to optional C99 features from
1936 Annexes F and G). See
1937 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1938 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1943 ISO C11, the 2011 revision of the ISO C standard. This standard is
1944 substantially completely supported, modulo bugs, floating-point issues
1945 (mainly but not entirely relating to optional C11 features from
1946 Annexes F and G) and the optional Annexes K (Bounds-checking
1947 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1953 ISO C17, the 2017 revision of the ISO C standard
1954 (published in 2018). This standard is
1955 same as C11 except for corrections of defects (all of which are also
1956 applied with @option{-std=c11}) and a new value of
1957 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1960 The next version of the ISO C standard, still under development. The
1961 support for this version is experimental and incomplete.
1965 GNU dialect of ISO C90 (including some C99 features).
1969 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1973 GNU dialect of ISO C11.
1974 The name @samp{gnu1x} is deprecated.
1978 GNU dialect of ISO C17. This is the default for C code.
1981 The next version of the ISO C standard, still under development, plus
1982 GNU extensions. The support for this version is experimental and
1987 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1988 additional defect reports. Same as @option{-ansi} for C++ code.
1992 GNU dialect of @option{-std=c++98}.
1996 The 2011 ISO C++ standard plus amendments.
1997 The name @samp{c++0x} is deprecated.
2001 GNU dialect of @option{-std=c++11}.
2002 The name @samp{gnu++0x} is deprecated.
2006 The 2014 ISO C++ standard plus amendments.
2007 The name @samp{c++1y} is deprecated.
2011 GNU dialect of @option{-std=c++14}.
2012 This is the default for C++ code.
2013 The name @samp{gnu++1y} is deprecated.
2017 The 2017 ISO C++ standard plus amendments.
2018 The name @samp{c++1z} is deprecated.
2022 GNU dialect of @option{-std=c++17}.
2023 The name @samp{gnu++1z} is deprecated.
2026 The next revision of the ISO C++ standard, tentatively planned for
2027 2020. Support is highly experimental, and will almost certainly
2028 change in incompatible ways in future releases.
2031 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
2032 and will almost certainly change in incompatible ways in future
2036 @item -fgnu89-inline
2037 @opindex fgnu89-inline
2038 The option @option{-fgnu89-inline} tells GCC to use the traditional
2039 GNU semantics for @code{inline} functions when in C99 mode.
2040 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2041 Using this option is roughly equivalent to adding the
2042 @code{gnu_inline} function attribute to all inline functions
2043 (@pxref{Function Attributes}).
2045 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2046 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2047 specifies the default behavior).
2048 This option is not supported in @option{-std=c90} or
2049 @option{-std=gnu90} mode.
2051 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2052 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2053 in effect for @code{inline} functions. @xref{Common Predefined
2054 Macros,,,cpp,The C Preprocessor}.
2056 @item -fpermitted-flt-eval-methods=@var{style}
2057 @opindex fpermitted-flt-eval-methods
2058 @opindex fpermitted-flt-eval-methods=c11
2059 @opindex fpermitted-flt-eval-methods=ts-18661-3
2060 ISO/IEC TS 18661-3 defines new permissible values for
2061 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2062 a semantic type that is an interchange or extended format should be
2063 evaluated to the precision and range of that type. These new values are
2064 a superset of those permitted under C99/C11, which does not specify the
2065 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2066 conforming to C11 may not have been written expecting the possibility of
2069 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2070 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2071 or the extended set of values specified in ISO/IEC TS 18661-3.
2073 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2075 The default when in a standards compliant mode (@option{-std=c11} or similar)
2076 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2077 dialect (@option{-std=gnu11} or similar) is
2078 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2080 @item -aux-info @var{filename}
2082 Output to the given filename prototyped declarations for all functions
2083 declared and/or defined in a translation unit, including those in header
2084 files. This option is silently ignored in any language other than C@.
2086 Besides declarations, the file indicates, in comments, the origin of
2087 each declaration (source file and line), whether the declaration was
2088 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2089 @samp{O} for old, respectively, in the first character after the line
2090 number and the colon), and whether it came from a declaration or a
2091 definition (@samp{C} or @samp{F}, respectively, in the following
2092 character). In the case of function definitions, a K&R-style list of
2093 arguments followed by their declarations is also provided, inside
2094 comments, after the declaration.
2096 @item -fallow-parameterless-variadic-functions
2097 @opindex fallow-parameterless-variadic-functions
2098 Accept variadic functions without named parameters.
2100 Although it is possible to define such a function, this is not very
2101 useful as it is not possible to read the arguments. This is only
2102 supported for C as this construct is allowed by C++.
2107 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2108 keyword, so that code can use these words as identifiers. You can use
2109 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2110 instead. @option{-ansi} implies @option{-fno-asm}.
2112 In C++, this switch only affects the @code{typeof} keyword, since
2113 @code{asm} and @code{inline} are standard keywords. You may want to
2114 use the @option{-fno-gnu-keywords} flag instead, which has the same
2115 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2116 switch only affects the @code{asm} and @code{typeof} keywords, since
2117 @code{inline} is a standard keyword in ISO C99.
2120 @itemx -fno-builtin-@var{function}
2121 @opindex fno-builtin
2123 @cindex built-in functions
2124 Don't recognize built-in functions that do not begin with
2125 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2126 functions provided by GCC}, for details of the functions affected,
2127 including those which are not built-in functions when @option{-ansi} or
2128 @option{-std} options for strict ISO C conformance are used because they
2129 do not have an ISO standard meaning.
2131 GCC normally generates special code to handle certain built-in functions
2132 more efficiently; for instance, calls to @code{alloca} may become single
2133 instructions which adjust the stack directly, and calls to @code{memcpy}
2134 may become inline copy loops. The resulting code is often both smaller
2135 and faster, but since the function calls no longer appear as such, you
2136 cannot set a breakpoint on those calls, nor can you change the behavior
2137 of the functions by linking with a different library. In addition,
2138 when a function is recognized as a built-in function, GCC may use
2139 information about that function to warn about problems with calls to
2140 that function, or to generate more efficient code, even if the
2141 resulting code still contains calls to that function. For example,
2142 warnings are given with @option{-Wformat} for bad calls to
2143 @code{printf} when @code{printf} is built in and @code{strlen} is
2144 known not to modify global memory.
2146 With the @option{-fno-builtin-@var{function}} option
2147 only the built-in function @var{function} is
2148 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2149 function is named that is not built-in in this version of GCC, this
2150 option is ignored. There is no corresponding
2151 @option{-fbuiltin-@var{function}} option; if you wish to enable
2152 built-in functions selectively when using @option{-fno-builtin} or
2153 @option{-ffreestanding}, you may define macros such as:
2156 #define abs(n) __builtin_abs ((n))
2157 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2163 Enable parsing of function definitions marked with @code{__GIMPLE}.
2164 This is an experimental feature that allows unit testing of GIMPLE
2169 @cindex hosted environment
2171 Assert that compilation targets a hosted environment. This implies
2172 @option{-fbuiltin}. A hosted environment is one in which the
2173 entire standard library is available, and in which @code{main} has a return
2174 type of @code{int}. Examples are nearly everything except a kernel.
2175 This is equivalent to @option{-fno-freestanding}.
2177 @item -ffreestanding
2178 @opindex ffreestanding
2179 @cindex hosted environment
2181 Assert that compilation targets a freestanding environment. This
2182 implies @option{-fno-builtin}. A freestanding environment
2183 is one in which the standard library may not exist, and program startup may
2184 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2185 This is equivalent to @option{-fno-hosted}.
2187 @xref{Standards,,Language Standards Supported by GCC}, for details of
2188 freestanding and hosted environments.
2192 @cindex OpenACC accelerator programming
2193 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2194 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2195 compiler generates accelerated code according to the OpenACC Application
2196 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2197 implies @option{-pthread}, and thus is only supported on targets that
2198 have support for @option{-pthread}.
2200 @item -fopenacc-dim=@var{geom}
2201 @opindex fopenacc-dim
2202 @cindex OpenACC accelerator programming
2203 Specify default compute dimensions for parallel offload regions that do
2204 not explicitly specify. The @var{geom} value is a triple of
2205 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2206 can be omitted, to use a target-specific default value.
2210 @cindex OpenMP parallel
2211 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2212 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2213 compiler generates parallel code according to the OpenMP Application
2214 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2215 implies @option{-pthread}, and thus is only supported on targets that
2216 have support for @option{-pthread}. @option{-fopenmp} implies
2217 @option{-fopenmp-simd}.
2220 @opindex fopenmp-simd
2223 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2224 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2229 When the option @option{-fgnu-tm} is specified, the compiler
2230 generates code for the Linux variant of Intel's current Transactional
2231 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2232 an experimental feature whose interface may change in future versions
2233 of GCC, as the official specification changes. Please note that not
2234 all architectures are supported for this feature.
2236 For more information on GCC's support for transactional memory,
2237 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2238 Transactional Memory Library}.
2240 Note that the transactional memory feature is not supported with
2241 non-call exceptions (@option{-fnon-call-exceptions}).
2243 @item -fms-extensions
2244 @opindex fms-extensions
2245 Accept some non-standard constructs used in Microsoft header files.
2247 In C++ code, this allows member names in structures to be similar
2248 to previous types declarations.
2257 Some cases of unnamed fields in structures and unions are only
2258 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2259 fields within structs/unions}, for details.
2261 Note that this option is off for all targets but x86
2262 targets using ms-abi.
2264 @item -fplan9-extensions
2265 @opindex fplan9-extensions
2266 Accept some non-standard constructs used in Plan 9 code.
2268 This enables @option{-fms-extensions}, permits passing pointers to
2269 structures with anonymous fields to functions that expect pointers to
2270 elements of the type of the field, and permits referring to anonymous
2271 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2272 struct/union fields within structs/unions}, for details. This is only
2273 supported for C, not C++.
2275 @item -fcond-mismatch
2276 @opindex fcond-mismatch
2277 Allow conditional expressions with mismatched types in the second and
2278 third arguments. The value of such an expression is void. This option
2279 is not supported for C++.
2281 @item -flax-vector-conversions
2282 @opindex flax-vector-conversions
2283 Allow implicit conversions between vectors with differing numbers of
2284 elements and/or incompatible element types. This option should not be
2287 @item -funsigned-char
2288 @opindex funsigned-char
2289 Let the type @code{char} be unsigned, like @code{unsigned char}.
2291 Each kind of machine has a default for what @code{char} should
2292 be. It is either like @code{unsigned char} by default or like
2293 @code{signed char} by default.
2295 Ideally, a portable program should always use @code{signed char} or
2296 @code{unsigned char} when it depends on the signedness of an object.
2297 But many programs have been written to use plain @code{char} and
2298 expect it to be signed, or expect it to be unsigned, depending on the
2299 machines they were written for. This option, and its inverse, let you
2300 make such a program work with the opposite default.
2302 The type @code{char} is always a distinct type from each of
2303 @code{signed char} or @code{unsigned char}, even though its behavior
2304 is always just like one of those two.
2307 @opindex fsigned-char
2308 Let the type @code{char} be signed, like @code{signed char}.
2310 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2311 the negative form of @option{-funsigned-char}. Likewise, the option
2312 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2314 @item -fsigned-bitfields
2315 @itemx -funsigned-bitfields
2316 @itemx -fno-signed-bitfields
2317 @itemx -fno-unsigned-bitfields
2318 @opindex fsigned-bitfields
2319 @opindex funsigned-bitfields
2320 @opindex fno-signed-bitfields
2321 @opindex fno-unsigned-bitfields
2322 These options control whether a bit-field is signed or unsigned, when the
2323 declaration does not use either @code{signed} or @code{unsigned}. By
2324 default, such a bit-field is signed, because this is consistent: the
2325 basic integer types such as @code{int} are signed types.
2327 @item -fsso-struct=@var{endianness}
2328 @opindex fsso-struct
2329 Set the default scalar storage order of structures and unions to the
2330 specified endianness. The accepted values are @samp{big-endian},
2331 @samp{little-endian} and @samp{native} for the native endianness of
2332 the target (the default). This option is not supported for C++.
2334 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2335 code that is not binary compatible with code generated without it if the
2336 specified endianness is not the native endianness of the target.
2339 @node C++ Dialect Options
2340 @section Options Controlling C++ Dialect
2342 @cindex compiler options, C++
2343 @cindex C++ options, command-line
2344 @cindex options, C++
2345 This section describes the command-line options that are only meaningful
2346 for C++ programs. You can also use most of the GNU compiler options
2347 regardless of what language your program is in. For example, you
2348 might compile a file @file{firstClass.C} like this:
2351 g++ -g -fstrict-enums -O -c firstClass.C
2355 In this example, only @option{-fstrict-enums} is an option meant
2356 only for C++ programs; you can use the other options with any
2357 language supported by GCC@.
2359 Some options for compiling C programs, such as @option{-std}, are also
2360 relevant for C++ programs.
2361 @xref{C Dialect Options,,Options Controlling C Dialect}.
2363 Here is a list of options that are @emph{only} for compiling C++ programs:
2367 @item -fabi-version=@var{n}
2368 @opindex fabi-version
2369 Use version @var{n} of the C++ ABI@. The default is version 0.
2371 Version 0 refers to the version conforming most closely to
2372 the C++ ABI specification. Therefore, the ABI obtained using version 0
2373 will change in different versions of G++ as ABI bugs are fixed.
2375 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2377 Version 2 is the version of the C++ ABI that first appeared in G++
2378 3.4, and was the default through G++ 4.9.
2380 Version 3 corrects an error in mangling a constant address as a
2383 Version 4, which first appeared in G++ 4.5, implements a standard
2384 mangling for vector types.
2386 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2387 attribute const/volatile on function pointer types, decltype of a
2388 plain decl, and use of a function parameter in the declaration of
2391 Version 6, which first appeared in G++ 4.7, corrects the promotion
2392 behavior of C++11 scoped enums and the mangling of template argument
2393 packs, const/static_cast, prefix ++ and --, and a class scope function
2394 used as a template argument.
2396 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2397 builtin type and corrects the mangling of lambdas in default argument
2400 Version 8, which first appeared in G++ 4.9, corrects the substitution
2401 behavior of function types with function-cv-qualifiers.
2403 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2406 Version 10, which first appeared in G++ 6.1, adds mangling of
2407 attributes that affect type identity, such as ia32 calling convention
2408 attributes (e.g.@: @samp{stdcall}).
2410 Version 11, which first appeared in G++ 7, corrects the mangling of
2411 sizeof... expressions and operator names. For multiple entities with
2412 the same name within a function, that are declared in different scopes,
2413 the mangling now changes starting with the twelfth occurrence. It also
2414 implies @option{-fnew-inheriting-ctors}.
2416 Version 12, which first appeared in G++ 8, corrects the calling
2417 conventions for empty classes on the x86_64 target and for classes
2418 with only deleted copy/move constructors. It accidentally changes the
2419 calling convention for classes with a deleted copy constructor and a
2420 trivial move constructor.
2422 Version 13, which first appeared in G++ 8.2, fixes the accidental
2423 change in version 12.
2425 See also @option{-Wabi}.
2427 @item -fabi-compat-version=@var{n}
2428 @opindex fabi-compat-version
2429 On targets that support strong aliases, G++
2430 works around mangling changes by creating an alias with the correct
2431 mangled name when defining a symbol with an incorrect mangled name.
2432 This switch specifies which ABI version to use for the alias.
2434 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2435 compatibility). If another ABI version is explicitly selected, this
2436 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2437 use @option{-fabi-compat-version=2}.
2439 If this option is not provided but @option{-Wabi=@var{n}} is, that
2440 version is used for compatibility aliases. If this option is provided
2441 along with @option{-Wabi} (without the version), the version from this
2442 option is used for the warning.
2444 @item -fno-access-control
2445 @opindex fno-access-control
2446 @opindex faccess-control
2447 Turn off all access checking. This switch is mainly useful for working
2448 around bugs in the access control code.
2451 @opindex faligned-new
2452 Enable support for C++17 @code{new} of types that require more
2453 alignment than @code{void* ::operator new(std::size_t)} provides. A
2454 numeric argument such as @code{-faligned-new=32} can be used to
2455 specify how much alignment (in bytes) is provided by that function,
2456 but few users will need to override the default of
2457 @code{alignof(std::max_align_t)}.
2459 This flag is enabled by default for @option{-std=c++17}.
2463 Check that the pointer returned by @code{operator new} is non-null
2464 before attempting to modify the storage allocated. This check is
2465 normally unnecessary because the C++ standard specifies that
2466 @code{operator new} only returns @code{0} if it is declared
2467 @code{throw()}, in which case the compiler always checks the
2468 return value even without this option. In all other cases, when
2469 @code{operator new} has a non-empty exception specification, memory
2470 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2471 @samp{new (nothrow)}.
2475 Enable support for the C++ Extensions for Concepts Technical
2476 Specification, ISO 19217 (2015), which allows code like
2479 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2480 template <Addable T> T add (T a, T b) @{ return a + b; @}
2483 @item -fconstexpr-depth=@var{n}
2484 @opindex fconstexpr-depth
2485 Set the maximum nested evaluation depth for C++11 constexpr functions
2486 to @var{n}. A limit is needed to detect endless recursion during
2487 constant expression evaluation. The minimum specified by the standard
2490 @item -fconstexpr-loop-limit=@var{n}
2491 @opindex fconstexpr-loop-limit
2492 Set the maximum number of iterations for a loop in C++14 constexpr functions
2493 to @var{n}. A limit is needed to detect infinite loops during
2494 constant expression evaluation. The default is 262144 (1<<18).
2496 @item -fdeduce-init-list
2497 @opindex fdeduce-init-list
2498 Enable deduction of a template type parameter as
2499 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2502 template <class T> auto forward(T t) -> decltype (realfn (t))
2509 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2513 This deduction was implemented as a possible extension to the
2514 originally proposed semantics for the C++11 standard, but was not part
2515 of the final standard, so it is disabled by default. This option is
2516 deprecated, and may be removed in a future version of G++.
2518 @item -fno-elide-constructors
2519 @opindex fno-elide-constructors
2520 @opindex felide-constructors
2521 The C++ standard allows an implementation to omit creating a temporary
2522 that is only used to initialize another object of the same type.
2523 Specifying this option disables that optimization, and forces G++ to
2524 call the copy constructor in all cases. This option also causes G++
2525 to call trivial member functions which otherwise would be expanded inline.
2527 In C++17, the compiler is required to omit these temporaries, but this
2528 option still affects trivial member functions.
2530 @item -fno-enforce-eh-specs
2531 @opindex fno-enforce-eh-specs
2532 @opindex fenforce-eh-specs
2533 Don't generate code to check for violation of exception specifications
2534 at run time. This option violates the C++ standard, but may be useful
2535 for reducing code size in production builds, much like defining
2536 @code{NDEBUG}. This does not give user code permission to throw
2537 exceptions in violation of the exception specifications; the compiler
2538 still optimizes based on the specifications, so throwing an
2539 unexpected exception results in undefined behavior at run time.
2541 @item -fextern-tls-init
2542 @itemx -fno-extern-tls-init
2543 @opindex fextern-tls-init
2544 @opindex fno-extern-tls-init
2545 The C++11 and OpenMP standards allow @code{thread_local} and
2546 @code{threadprivate} variables to have dynamic (runtime)
2547 initialization. To support this, any use of such a variable goes
2548 through a wrapper function that performs any necessary initialization.
2549 When the use and definition of the variable are in the same
2550 translation unit, this overhead can be optimized away, but when the
2551 use is in a different translation unit there is significant overhead
2552 even if the variable doesn't actually need dynamic initialization. If
2553 the programmer can be sure that no use of the variable in a
2554 non-defining TU needs to trigger dynamic initialization (either
2555 because the variable is statically initialized, or a use of the
2556 variable in the defining TU will be executed before any uses in
2557 another TU), they can avoid this overhead with the
2558 @option{-fno-extern-tls-init} option.
2560 On targets that support symbol aliases, the default is
2561 @option{-fextern-tls-init}. On targets that do not support symbol
2562 aliases, the default is @option{-fno-extern-tls-init}.
2564 @item -fno-gnu-keywords
2565 @opindex fno-gnu-keywords
2566 @opindex fgnu-keywords
2567 Do not recognize @code{typeof} as a keyword, so that code can use this
2568 word as an identifier. You can use the keyword @code{__typeof__} instead.
2569 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2570 @option{-std=c++98}, @option{-std=c++11}, etc.
2572 @item -fno-implicit-templates
2573 @opindex fno-implicit-templates
2574 @opindex fimplicit-templates
2575 Never emit code for non-inline templates that are instantiated
2576 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2577 @xref{Template Instantiation}, for more information.
2579 @item -fno-implicit-inline-templates
2580 @opindex fno-implicit-inline-templates
2581 @opindex fimplicit-inline-templates
2582 Don't emit code for implicit instantiations of inline templates, either.
2583 The default is to handle inlines differently so that compiles with and
2584 without optimization need the same set of explicit instantiations.
2586 @item -fno-implement-inlines
2587 @opindex fno-implement-inlines
2588 @opindex fimplement-inlines
2589 To save space, do not emit out-of-line copies of inline functions
2590 controlled by @code{#pragma implementation}. This causes linker
2591 errors if these functions are not inlined everywhere they are called.
2593 @item -fms-extensions
2594 @opindex fms-extensions
2595 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2596 int and getting a pointer to member function via non-standard syntax.
2598 @item -fnew-inheriting-ctors
2599 @opindex fnew-inheriting-ctors
2600 Enable the P0136 adjustment to the semantics of C++11 constructor
2601 inheritance. This is part of C++17 but also considered to be a Defect
2602 Report against C++11 and C++14. This flag is enabled by default
2603 unless @option{-fabi-version=10} or lower is specified.
2605 @item -fnew-ttp-matching
2606 @opindex fnew-ttp-matching
2607 Enable the P0522 resolution to Core issue 150, template template
2608 parameters and default arguments: this allows a template with default
2609 template arguments as an argument for a template template parameter
2610 with fewer template parameters. This flag is enabled by default for
2611 @option{-std=c++17}.
2613 @item -fno-nonansi-builtins
2614 @opindex fno-nonansi-builtins
2615 @opindex fnonansi-builtins
2616 Disable built-in declarations of functions that are not mandated by
2617 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2618 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2621 @opindex fnothrow-opt
2622 Treat a @code{throw()} exception specification as if it were a
2623 @code{noexcept} specification to reduce or eliminate the text size
2624 overhead relative to a function with no exception specification. If
2625 the function has local variables of types with non-trivial
2626 destructors, the exception specification actually makes the
2627 function smaller because the EH cleanups for those variables can be
2628 optimized away. The semantic effect is that an exception thrown out of
2629 a function with such an exception specification results in a call
2630 to @code{terminate} rather than @code{unexpected}.
2632 @item -fno-operator-names
2633 @opindex fno-operator-names
2634 @opindex foperator-names
2635 Do not treat the operator name keywords @code{and}, @code{bitand},
2636 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2637 synonyms as keywords.
2639 @item -fno-optional-diags
2640 @opindex fno-optional-diags
2641 @opindex foptional-diags
2642 Disable diagnostics that the standard says a compiler does not need to
2643 issue. Currently, the only such diagnostic issued by G++ is the one for
2644 a name having multiple meanings within a class.
2647 @opindex fpermissive
2648 Downgrade some diagnostics about nonconformant code from errors to
2649 warnings. Thus, using @option{-fpermissive} allows some
2650 nonconforming code to compile.
2652 @item -fno-pretty-templates
2653 @opindex fno-pretty-templates
2654 @opindex fpretty-templates
2655 When an error message refers to a specialization of a function
2656 template, the compiler normally prints the signature of the
2657 template followed by the template arguments and any typedefs or
2658 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2659 rather than @code{void f(int)}) so that it's clear which template is
2660 involved. When an error message refers to a specialization of a class
2661 template, the compiler omits any template arguments that match
2662 the default template arguments for that template. If either of these
2663 behaviors make it harder to understand the error message rather than
2664 easier, you can use @option{-fno-pretty-templates} to disable them.
2668 Enable automatic template instantiation at link time. This option also
2669 implies @option{-fno-implicit-templates}. @xref{Template
2670 Instantiation}, for more information.
2675 Disable generation of information about every class with virtual
2676 functions for use by the C++ run-time type identification features
2677 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2678 of the language, you can save some space by using this flag. Note that
2679 exception handling uses the same information, but G++ generates it as
2680 needed. The @code{dynamic_cast} operator can still be used for casts that
2681 do not require run-time type information, i.e.@: casts to @code{void *} or to
2682 unambiguous base classes.
2684 Mixing code compiled with @option{-frtti} with that compiled with
2685 @option{-fno-rtti} may not work. For example, programs may
2686 fail to link if a class compiled with @option{-fno-rtti} is used as a base
2687 for a class compiled with @option{-frtti}.
2689 @item -fsized-deallocation
2690 @opindex fsized-deallocation
2691 Enable the built-in global declarations
2693 void operator delete (void *, std::size_t) noexcept;
2694 void operator delete[] (void *, std::size_t) noexcept;
2696 as introduced in C++14. This is useful for user-defined replacement
2697 deallocation functions that, for example, use the size of the object
2698 to make deallocation faster. Enabled by default under
2699 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2700 warns about places that might want to add a definition.
2702 @item -fstrict-enums
2703 @opindex fstrict-enums
2704 Allow the compiler to optimize using the assumption that a value of
2705 enumerated type can only be one of the values of the enumeration (as
2706 defined in the C++ standard; basically, a value that can be
2707 represented in the minimum number of bits needed to represent all the
2708 enumerators). This assumption may not be valid if the program uses a
2709 cast to convert an arbitrary integer value to the enumerated type.
2711 @item -fstrong-eval-order
2712 @opindex fstrong-eval-order
2713 Evaluate member access, array subscripting, and shift expressions in
2714 left-to-right order, and evaluate assignment in right-to-left order,
2715 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2716 @option{-fstrong-eval-order=some} enables just the ordering of member
2717 access and shift expressions, and is the default without
2718 @option{-std=c++17}.
2720 @item -ftemplate-backtrace-limit=@var{n}
2721 @opindex ftemplate-backtrace-limit
2722 Set the maximum number of template instantiation notes for a single
2723 warning or error to @var{n}. The default value is 10.
2725 @item -ftemplate-depth=@var{n}
2726 @opindex ftemplate-depth
2727 Set the maximum instantiation depth for template classes to @var{n}.
2728 A limit on the template instantiation depth is needed to detect
2729 endless recursions during template class instantiation. ANSI/ISO C++
2730 conforming programs must not rely on a maximum depth greater than 17
2731 (changed to 1024 in C++11). The default value is 900, as the compiler
2732 can run out of stack space before hitting 1024 in some situations.
2734 @item -fno-threadsafe-statics
2735 @opindex fno-threadsafe-statics
2736 @opindex fthreadsafe-statics
2737 Do not emit the extra code to use the routines specified in the C++
2738 ABI for thread-safe initialization of local statics. You can use this
2739 option to reduce code size slightly in code that doesn't need to be
2742 @item -fuse-cxa-atexit
2743 @opindex fuse-cxa-atexit
2744 Register destructors for objects with static storage duration with the
2745 @code{__cxa_atexit} function rather than the @code{atexit} function.
2746 This option is required for fully standards-compliant handling of static
2747 destructors, but only works if your C library supports
2748 @code{__cxa_atexit}.
2750 @item -fno-use-cxa-get-exception-ptr
2751 @opindex fno-use-cxa-get-exception-ptr
2752 @opindex fuse-cxa-get-exception-ptr
2753 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2754 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2755 if the runtime routine is not available.
2757 @item -fvisibility-inlines-hidden
2758 @opindex fvisibility-inlines-hidden
2759 This switch declares that the user does not attempt to compare
2760 pointers to inline functions or methods where the addresses of the two functions
2761 are taken in different shared objects.
2763 The effect of this is that GCC may, effectively, mark inline methods with
2764 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2765 appear in the export table of a DSO and do not require a PLT indirection
2766 when used within the DSO@. Enabling this option can have a dramatic effect
2767 on load and link times of a DSO as it massively reduces the size of the
2768 dynamic export table when the library makes heavy use of templates.
2770 The behavior of this switch is not quite the same as marking the
2771 methods as hidden directly, because it does not affect static variables
2772 local to the function or cause the compiler to deduce that
2773 the function is defined in only one shared object.
2775 You may mark a method as having a visibility explicitly to negate the
2776 effect of the switch for that method. For example, if you do want to
2777 compare pointers to a particular inline method, you might mark it as
2778 having default visibility. Marking the enclosing class with explicit
2779 visibility has no effect.
2781 Explicitly instantiated inline methods are unaffected by this option
2782 as their linkage might otherwise cross a shared library boundary.
2783 @xref{Template Instantiation}.
2785 @item -fvisibility-ms-compat
2786 @opindex fvisibility-ms-compat
2787 This flag attempts to use visibility settings to make GCC's C++
2788 linkage model compatible with that of Microsoft Visual Studio.
2790 The flag makes these changes to GCC's linkage model:
2794 It sets the default visibility to @code{hidden}, like
2795 @option{-fvisibility=hidden}.
2798 Types, but not their members, are not hidden by default.
2801 The One Definition Rule is relaxed for types without explicit
2802 visibility specifications that are defined in more than one
2803 shared object: those declarations are permitted if they are
2804 permitted when this option is not used.
2807 In new code it is better to use @option{-fvisibility=hidden} and
2808 export those classes that are intended to be externally visible.
2809 Unfortunately it is possible for code to rely, perhaps accidentally,
2810 on the Visual Studio behavior.
2812 Among the consequences of these changes are that static data members
2813 of the same type with the same name but defined in different shared
2814 objects are different, so changing one does not change the other;
2815 and that pointers to function members defined in different shared
2816 objects may not compare equal. When this flag is given, it is a
2817 violation of the ODR to define types with the same name differently.
2822 Do not use weak symbol support, even if it is provided by the linker.
2823 By default, G++ uses weak symbols if they are available. This
2824 option exists only for testing, and should not be used by end-users;
2825 it results in inferior code and has no benefits. This option may
2826 be removed in a future release of G++.
2830 Do not search for header files in the standard directories specific to
2831 C++, but do still search the other standard directories. (This option
2832 is used when building the C++ library.)
2835 In addition, these optimization, warning, and code generation options
2836 have meanings only for C++ programs:
2839 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2842 Warn when G++ it generates code that is probably not compatible with
2843 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2844 ABI with each major release, normally @option{-Wabi} will warn only if
2845 there is a check added later in a release series for an ABI issue
2846 discovered since the initial release. @option{-Wabi} will warn about
2847 more things if an older ABI version is selected (with
2848 @option{-fabi-version=@var{n}}).
2850 @option{-Wabi} can also be used with an explicit version number to
2851 warn about compatibility with a particular @option{-fabi-version}
2852 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2853 @option{-fabi-version=2}.
2855 If an explicit version number is provided and
2856 @option{-fabi-compat-version} is not specified, the version number
2857 from this option is used for compatibility aliases. If no explicit
2858 version number is provided with this option, but
2859 @option{-fabi-compat-version} is specified, that version number is
2860 used for ABI warnings.
2862 Although an effort has been made to warn about
2863 all such cases, there are probably some cases that are not warned about,
2864 even though G++ is generating incompatible code. There may also be
2865 cases where warnings are emitted even though the code that is generated
2868 You should rewrite your code to avoid these warnings if you are
2869 concerned about the fact that code generated by G++ may not be binary
2870 compatible with code generated by other compilers.
2872 Known incompatibilities in @option{-fabi-version=2} (which was the
2873 default from GCC 3.4 to 4.9) include:
2878 A template with a non-type template parameter of reference type was
2879 mangled incorrectly:
2882 template <int &> struct S @{@};
2886 This was fixed in @option{-fabi-version=3}.
2889 SIMD vector types declared using @code{__attribute ((vector_size))} were
2890 mangled in a non-standard way that does not allow for overloading of
2891 functions taking vectors of different sizes.
2893 The mangling was changed in @option{-fabi-version=4}.
2896 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2897 qualifiers, and @code{decltype} of a plain declaration was folded away.
2899 These mangling issues were fixed in @option{-fabi-version=5}.
2902 Scoped enumerators passed as arguments to a variadic function are
2903 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2904 On most targets this does not actually affect the parameter passing
2905 ABI, as there is no way to pass an argument smaller than @code{int}.
2907 Also, the ABI changed the mangling of template argument packs,
2908 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2909 a class scope function used as a template argument.
2911 These issues were corrected in @option{-fabi-version=6}.
2914 Lambdas in default argument scope were mangled incorrectly, and the
2915 ABI changed the mangling of @code{nullptr_t}.
2917 These issues were corrected in @option{-fabi-version=7}.
2920 When mangling a function type with function-cv-qualifiers, the
2921 un-qualified function type was incorrectly treated as a substitution
2924 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2927 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2928 unaligned accesses. Note that this did not affect the ABI of a
2929 function with a @code{nullptr_t} parameter, as parameters have a
2932 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2935 Target-specific attributes that affect the identity of a type, such as
2936 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2937 did not affect the mangled name, leading to name collisions when
2938 function pointers were used as template arguments.
2940 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2944 It also warns about psABI-related changes. The known psABI changes at this
2950 For SysV/x86-64, unions with @code{long double} members are
2951 passed in memory as specified in psABI. For example:
2961 @code{union U} is always passed in memory.
2965 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2968 Warn when a type with an ABI tag is used in a context that does not
2969 have that ABI tag. See @ref{C++ Attributes} for more information
2972 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2973 @opindex Wctor-dtor-privacy
2974 @opindex Wno-ctor-dtor-privacy
2975 Warn when a class seems unusable because all the constructors or
2976 destructors in that class are private, and it has neither friends nor
2977 public static member functions. Also warn if there are no non-private
2978 methods, and there's at least one private member function that isn't
2979 a constructor or destructor.
2981 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2982 @opindex Wdelete-non-virtual-dtor
2983 @opindex Wno-delete-non-virtual-dtor
2984 Warn when @code{delete} is used to destroy an instance of a class that
2985 has virtual functions and non-virtual destructor. It is unsafe to delete
2986 an instance of a derived class through a pointer to a base class if the
2987 base class does not have a virtual destructor. This warning is enabled
2990 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
2991 @opindex Wdeprecated-copy
2992 @opindex Wno-deprecated-copy
2993 Warn that the implicit declaration of a copy constructor or copy
2994 assignment operator is deprecated if the class has a user-provided
2995 copy constructor, copy assignment operator, or destructor, in C++11
2996 and up. This warning is enabled by @option{-Wall}.
2998 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
2999 @opindex Winit-list-lifetime
3000 @opindex Wno-init-list-lifetime
3001 Do not warn about uses of @code{std::initializer_list} that are likely
3002 to result in dangling pointers. Since the underlying array for an
3003 @code{initializer_list} is handled like a normal C++ temporary object,
3004 it is easy to inadvertently keep a pointer to the array past the end
3005 of the array's lifetime. For example:
3009 If a function returns a temporary @code{initializer_list}, or a local
3010 @code{initializer_list} variable, the array's lifetime ends at the end
3011 of the return statement, so the value returned has a dangling pointer.
3014 If a new-expression creates an @code{initializer_list}, the array only
3015 lives until the end of the enclosing full-expression, so the
3016 @code{initializer_list} in the heap has a dangling pointer.
3019 When an @code{initializer_list} variable is assigned from a
3020 brace-enclosed initializer list, the temporary array created for the
3021 right side of the assignment only lives until the end of the
3022 full-expression, so at the next statement the @code{initializer_list}
3023 variable has a dangling pointer.
3026 // li's initial underlying array lives as long as li
3027 std::initializer_list<int> li = @{ 1,2,3 @};
3028 // assignment changes li to point to a temporary array
3030 // now the temporary is gone and li has a dangling pointer
3031 int i = li.begin()[0] // undefined behavior
3035 When a list constructor stores the @code{begin} pointer from the
3036 @code{initializer_list} argument, this doesn't extend the lifetime of
3037 the array, so if a class variable is constructed from a temporary
3038 @code{initializer_list}, the pointer is left dangling by the end of
3039 the variable declaration statement.
3043 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3044 @opindex Wliteral-suffix
3045 @opindex Wno-literal-suffix
3046 Warn when a string or character literal is followed by a ud-suffix which does
3047 not begin with an underscore. As a conforming extension, GCC treats such
3048 suffixes as separate preprocessing tokens in order to maintain backwards
3049 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3053 #define __STDC_FORMAT_MACROS
3054 #include <inttypes.h>
3059 printf("My int64: %" PRId64"\n", i64);
3063 In this case, @code{PRId64} is treated as a separate preprocessing token.
3065 Additionally, warn when a user-defined literal operator is declared with
3066 a literal suffix identifier that doesn't begin with an underscore. Literal
3067 suffix identifiers that don't begin with an underscore are reserved for
3068 future standardization.
3070 This warning is enabled by default.
3072 @item -Wlto-type-mismatch
3073 @opindex Wlto-type-mismatch
3074 @opindex Wno-lto-type-mismatch
3076 During the link-time optimization warn about type mismatches in
3077 global declarations from different compilation units.
3078 Requires @option{-flto} to be enabled. Enabled by default.
3080 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3082 @opindex Wno-narrowing
3083 For C++11 and later standards, narrowing conversions are diagnosed by default,
3084 as required by the standard. A narrowing conversion from a constant produces
3085 an error, and a narrowing conversion from a non-constant produces a warning,
3086 but @option{-Wno-narrowing} suppresses the diagnostic.
3087 Note that this does not affect the meaning of well-formed code;
3088 narrowing conversions are still considered ill-formed in SFINAE contexts.
3090 With @option{-Wnarrowing} in C++98, warn when a narrowing
3091 conversion prohibited by C++11 occurs within
3095 int i = @{ 2.2 @}; // error: narrowing from double to int
3098 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3100 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3102 @opindex Wno-noexcept
3103 Warn when a noexcept-expression evaluates to false because of a call
3104 to a function that does not have a non-throwing exception
3105 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3106 the compiler to never throw an exception.
3108 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3109 @opindex Wnoexcept-type
3110 @opindex Wno-noexcept-type
3111 Warn if the C++17 feature making @code{noexcept} part of a function
3112 type changes the mangled name of a symbol relative to C++14. Enabled
3113 by @option{-Wabi} and @option{-Wc++17-compat}.
3118 template <class T> void f(T t) @{ t(); @};
3120 void h() @{ f(g); @}
3124 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3125 C++17 it calls @code{f<void(*)()noexcept>}.
3127 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3128 @opindex Wclass-memaccess
3129 @opindex Wno-class-memaccess
3130 Warn when the destination of a call to a raw memory function such as
3131 @code{memset} or @code{memcpy} is an object of class type, and when writing
3132 into such an object might bypass the class non-trivial or deleted constructor
3133 or copy assignment, violate const-correctness or encapsulation, or corrupt
3134 virtual table pointers. Modifying the representation of such objects may
3135 violate invariants maintained by member functions of the class. For example,
3136 the call to @code{memset} below is undefined because it modifies a non-trivial
3137 class object and is, therefore, diagnosed. The safe way to either initialize
3138 or clear the storage of objects of such types is by using the appropriate
3139 constructor or assignment operator, if one is available.
3141 std::string str = "abc";
3142 memset (&str, 0, sizeof str);
3144 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3145 Explicitly casting the pointer to the class object to @code{void *} or
3146 to a type that can be safely accessed by the raw memory function suppresses
3149 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3150 @opindex Wnon-virtual-dtor
3151 @opindex Wno-non-virtual-dtor
3152 Warn when a class has virtual functions and an accessible non-virtual
3153 destructor itself or in an accessible polymorphic base class, in which
3154 case it is possible but unsafe to delete an instance of a derived
3155 class through a pointer to the class itself or base class. This
3156 warning is automatically enabled if @option{-Weffc++} is specified.
3158 @item -Wregister @r{(C++ and Objective-C++ only)}
3160 @opindex Wno-register
3161 Warn on uses of the @code{register} storage class specifier, except
3162 when it is part of the GNU @ref{Explicit Register Variables} extension.
3163 The use of the @code{register} keyword as storage class specifier has
3164 been deprecated in C++11 and removed in C++17.
3165 Enabled by default with @option{-std=c++17}.
3167 @item -Wreorder @r{(C++ and Objective-C++ only)}
3169 @opindex Wno-reorder
3170 @cindex reordering, warning
3171 @cindex warning for reordering of member initializers
3172 Warn when the order of member initializers given in the code does not
3173 match the order in which they must be executed. For instance:
3179 A(): j (0), i (1) @{ @}
3184 The compiler rearranges the member initializers for @code{i}
3185 and @code{j} to match the declaration order of the members, emitting
3186 a warning to that effect. This warning is enabled by @option{-Wall}.
3188 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3189 @opindex Wpessimizing-move
3190 @opindex Wno-pessimizing-move
3191 This warning warns when a call to @code{std::move} prevents copy
3192 elision. A typical scenario when copy elision can occur is when returning in
3193 a function with a class return type, when the expression being returned is the
3194 name of a non-volatile automatic object, and is not a function parameter, and
3195 has the same type as the function return type.
3205 return std::move (t);
3209 But in this example, the @code{std::move} call prevents copy elision.
3211 This warning is enabled by @option{-Wall}.
3213 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3214 @opindex Wredundant-move
3215 @opindex Wno-redundant-move
3216 This warning warns about redundant calls to @code{std::move}; that is, when
3217 a move operation would have been performed even without the @code{std::move}
3218 call. This happens because the compiler is forced to treat the object as if
3219 it were an rvalue in certain situations such as returning a local variable,
3220 where copy elision isn't applicable. Consider:
3229 return std::move (t);
3233 Here, the @code{std::move} call is redundant. Because G++ implements Core
3234 Issue 1579, another example is:
3237 struct T @{ // convertible to U
3247 return std::move (t);
3250 In this example, copy elision isn't applicable because the type of the
3251 expression being returned and the function return type differ, yet G++
3252 treats the return value as if it were designated by an rvalue.
3254 This warning is enabled by @option{-Wextra}.
3256 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3257 @opindex fext-numeric-literals
3258 @opindex fno-ext-numeric-literals
3259 Accept imaginary, fixed-point, or machine-defined
3260 literal number suffixes as GNU extensions.
3261 When this option is turned off these suffixes are treated
3262 as C++11 user-defined literal numeric suffixes.
3263 This is on by default for all pre-C++11 dialects and all GNU dialects:
3264 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3265 @option{-std=gnu++14}.
3266 This option is off by default
3267 for ISO C++11 onwards (@option{-std=c++11}, ...).
3270 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3273 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3276 Warn about violations of the following style guidelines from Scott Meyers'
3277 @cite{Effective C++} series of books:
3281 Define a copy constructor and an assignment operator for classes
3282 with dynamically-allocated memory.
3285 Prefer initialization to assignment in constructors.
3288 Have @code{operator=} return a reference to @code{*this}.
3291 Don't try to return a reference when you must return an object.
3294 Distinguish between prefix and postfix forms of increment and
3295 decrement operators.
3298 Never overload @code{&&}, @code{||}, or @code{,}.
3302 This option also enables @option{-Wnon-virtual-dtor}, which is also
3303 one of the effective C++ recommendations. However, the check is
3304 extended to warn about the lack of virtual destructor in accessible
3305 non-polymorphic bases classes too.
3307 When selecting this option, be aware that the standard library
3308 headers do not obey all of these guidelines; use @samp{grep -v}
3309 to filter out those warnings.
3311 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3312 @opindex Wstrict-null-sentinel
3313 @opindex Wno-strict-null-sentinel
3314 Warn about the use of an uncasted @code{NULL} as sentinel. When
3315 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3316 to @code{__null}. Although it is a null pointer constant rather than a
3317 null pointer, it is guaranteed to be of the same size as a pointer.
3318 But this use is not portable across different compilers.
3320 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3321 @opindex Wno-non-template-friend
3322 @opindex Wnon-template-friend
3323 Disable warnings when non-template friend functions are declared
3324 within a template. In very old versions of GCC that predate implementation
3325 of the ISO standard, declarations such as
3326 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3327 could be interpreted as a particular specialization of a template
3328 function; the warning exists to diagnose compatibility problems,
3329 and is enabled by default.
3331 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3332 @opindex Wold-style-cast
3333 @opindex Wno-old-style-cast
3334 Warn if an old-style (C-style) cast to a non-void type is used within
3335 a C++ program. The new-style casts (@code{dynamic_cast},
3336 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3337 less vulnerable to unintended effects and much easier to search for.
3339 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3340 @opindex Woverloaded-virtual
3341 @opindex Wno-overloaded-virtual
3342 @cindex overloaded virtual function, warning
3343 @cindex warning for overloaded virtual function
3344 Warn when a function declaration hides virtual functions from a
3345 base class. For example, in:
3352 struct B: public A @{
3357 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3368 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3369 @opindex Wno-pmf-conversions
3370 @opindex Wpmf-conversions
3371 Disable the diagnostic for converting a bound pointer to member function
3374 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3375 @opindex Wsign-promo
3376 @opindex Wno-sign-promo
3377 Warn when overload resolution chooses a promotion from unsigned or
3378 enumerated type to a signed type, over a conversion to an unsigned type of
3379 the same size. Previous versions of G++ tried to preserve
3380 unsignedness, but the standard mandates the current behavior.
3382 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3384 @opindex Wno-templates
3385 Warn when a primary template declaration is encountered. Some coding
3386 rules disallow templates, and this may be used to enforce that rule.
3387 The warning is inactive inside a system header file, such as the STL, so
3388 one can still use the STL. One may also instantiate or specialize
3391 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3392 @opindex Wmultiple-inheritance
3393 @opindex Wno-multiple-inheritance
3394 Warn when a class is defined with multiple direct base classes. Some
3395 coding rules disallow multiple inheritance, and this may be used to
3396 enforce that rule. The warning is inactive inside a system header file,
3397 such as the STL, so one can still use the STL. One may also define
3398 classes that indirectly use multiple inheritance.
3400 @item -Wvirtual-inheritance
3401 @opindex Wvirtual-inheritance
3402 @opindex Wno-virtual-inheritance
3403 Warn when a class is defined with a virtual direct base class. Some
3404 coding rules disallow multiple inheritance, and this may be used to
3405 enforce that rule. The warning is inactive inside a system header file,
3406 such as the STL, so one can still use the STL. One may also define
3407 classes that indirectly use virtual inheritance.
3410 @opindex Wnamespaces
3411 @opindex Wno-namespaces
3412 Warn when a namespace definition is opened. Some coding rules disallow
3413 namespaces, and this may be used to enforce that rule. The warning is
3414 inactive inside a system header file, such as the STL, so one can still
3415 use the STL. One may also use using directives and qualified names.
3417 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3419 @opindex Wno-terminate
3420 Disable the warning about a throw-expression that will immediately
3421 result in a call to @code{terminate}.
3423 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3424 @opindex Wno-class-conversion
3425 @opindex Wclass-conversion
3426 Disable the warning about the case when a conversion function converts an
3427 object to the same type, to a base class of that type, or to void; such
3428 a conversion function will never be called.
3431 @node Objective-C and Objective-C++ Dialect Options
3432 @section Options Controlling Objective-C and Objective-C++ Dialects
3434 @cindex compiler options, Objective-C and Objective-C++
3435 @cindex Objective-C and Objective-C++ options, command-line
3436 @cindex options, Objective-C and Objective-C++
3437 (NOTE: This manual does not describe the Objective-C and Objective-C++
3438 languages themselves. @xref{Standards,,Language Standards
3439 Supported by GCC}, for references.)
3441 This section describes the command-line options that are only meaningful
3442 for Objective-C and Objective-C++ programs. You can also use most of
3443 the language-independent GNU compiler options.
3444 For example, you might compile a file @file{some_class.m} like this:
3447 gcc -g -fgnu-runtime -O -c some_class.m
3451 In this example, @option{-fgnu-runtime} is an option meant only for
3452 Objective-C and Objective-C++ programs; you can use the other options with
3453 any language supported by GCC@.
3455 Note that since Objective-C is an extension of the C language, Objective-C
3456 compilations may also use options specific to the C front-end (e.g.,
3457 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3458 C++-specific options (e.g., @option{-Wabi}).
3460 Here is a list of options that are @emph{only} for compiling Objective-C
3461 and Objective-C++ programs:
3464 @item -fconstant-string-class=@var{class-name}
3465 @opindex fconstant-string-class
3466 Use @var{class-name} as the name of the class to instantiate for each
3467 literal string specified with the syntax @code{@@"@dots{}"}. The default
3468 class name is @code{NXConstantString} if the GNU runtime is being used, and
3469 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3470 @option{-fconstant-cfstrings} option, if also present, overrides the
3471 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3472 to be laid out as constant CoreFoundation strings.
3475 @opindex fgnu-runtime
3476 Generate object code compatible with the standard GNU Objective-C
3477 runtime. This is the default for most types of systems.
3479 @item -fnext-runtime
3480 @opindex fnext-runtime
3481 Generate output compatible with the NeXT runtime. This is the default
3482 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3483 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3486 @item -fno-nil-receivers
3487 @opindex fno-nil-receivers
3488 @opindex fnil-receivers
3489 Assume that all Objective-C message dispatches (@code{[receiver
3490 message:arg]}) in this translation unit ensure that the receiver is
3491 not @code{nil}. This allows for more efficient entry points in the
3492 runtime to be used. This option is only available in conjunction with
3493 the NeXT runtime and ABI version 0 or 1.
3495 @item -fobjc-abi-version=@var{n}
3496 @opindex fobjc-abi-version
3497 Use version @var{n} of the Objective-C ABI for the selected runtime.
3498 This option is currently supported only for the NeXT runtime. In that
3499 case, Version 0 is the traditional (32-bit) ABI without support for
3500 properties and other Objective-C 2.0 additions. Version 1 is the
3501 traditional (32-bit) ABI with support for properties and other
3502 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3503 nothing is specified, the default is Version 0 on 32-bit target
3504 machines, and Version 2 on 64-bit target machines.
3506 @item -fobjc-call-cxx-cdtors
3507 @opindex fobjc-call-cxx-cdtors
3508 For each Objective-C class, check if any of its instance variables is a
3509 C++ object with a non-trivial default constructor. If so, synthesize a
3510 special @code{- (id) .cxx_construct} instance method which runs
3511 non-trivial default constructors on any such instance variables, in order,
3512 and then return @code{self}. Similarly, check if any instance variable
3513 is a C++ object with a non-trivial destructor, and if so, synthesize a
3514 special @code{- (void) .cxx_destruct} method which runs
3515 all such default destructors, in reverse order.
3517 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3518 methods thusly generated only operate on instance variables
3519 declared in the current Objective-C class, and not those inherited
3520 from superclasses. It is the responsibility of the Objective-C
3521 runtime to invoke all such methods in an object's inheritance
3522 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3523 by the runtime immediately after a new object instance is allocated;
3524 the @code{- (void) .cxx_destruct} methods are invoked immediately
3525 before the runtime deallocates an object instance.
3527 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3528 support for invoking the @code{- (id) .cxx_construct} and
3529 @code{- (void) .cxx_destruct} methods.
3531 @item -fobjc-direct-dispatch
3532 @opindex fobjc-direct-dispatch
3533 Allow fast jumps to the message dispatcher. On Darwin this is
3534 accomplished via the comm page.
3536 @item -fobjc-exceptions
3537 @opindex fobjc-exceptions
3538 Enable syntactic support for structured exception handling in
3539 Objective-C, similar to what is offered by C++. This option
3540 is required to use the Objective-C keywords @code{@@try},
3541 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3542 @code{@@synchronized}. This option is available with both the GNU
3543 runtime and the NeXT runtime (but not available in conjunction with
3544 the NeXT runtime on Mac OS X 10.2 and earlier).
3548 Enable garbage collection (GC) in Objective-C and Objective-C++
3549 programs. This option is only available with the NeXT runtime; the
3550 GNU runtime has a different garbage collection implementation that
3551 does not require special compiler flags.
3553 @item -fobjc-nilcheck
3554 @opindex fobjc-nilcheck
3555 For the NeXT runtime with version 2 of the ABI, check for a nil
3556 receiver in method invocations before doing the actual method call.
3557 This is the default and can be disabled using
3558 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3559 checked for nil in this way no matter what this flag is set to.
3560 Currently this flag does nothing when the GNU runtime, or an older
3561 version of the NeXT runtime ABI, is used.
3563 @item -fobjc-std=objc1
3565 Conform to the language syntax of Objective-C 1.0, the language
3566 recognized by GCC 4.0. This only affects the Objective-C additions to
3567 the C/C++ language; it does not affect conformance to C/C++ standards,
3568 which is controlled by the separate C/C++ dialect option flags. When
3569 this option is used with the Objective-C or Objective-C++ compiler,
3570 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3571 This is useful if you need to make sure that your Objective-C code can
3572 be compiled with older versions of GCC@.
3574 @item -freplace-objc-classes
3575 @opindex freplace-objc-classes
3576 Emit a special marker instructing @command{ld(1)} not to statically link in
3577 the resulting object file, and allow @command{dyld(1)} to load it in at
3578 run time instead. This is used in conjunction with the Fix-and-Continue
3579 debugging mode, where the object file in question may be recompiled and
3580 dynamically reloaded in the course of program execution, without the need
3581 to restart the program itself. Currently, Fix-and-Continue functionality
3582 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3587 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3588 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3589 compile time) with static class references that get initialized at load time,
3590 which improves run-time performance. Specifying the @option{-fzero-link} flag
3591 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3592 to be retained. This is useful in Zero-Link debugging mode, since it allows
3593 for individual class implementations to be modified during program execution.
3594 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3595 regardless of command-line options.
3597 @item -fno-local-ivars
3598 @opindex fno-local-ivars
3599 @opindex flocal-ivars
3600 By default instance variables in Objective-C can be accessed as if
3601 they were local variables from within the methods of the class they're
3602 declared in. This can lead to shadowing between instance variables
3603 and other variables declared either locally inside a class method or
3604 globally with the same name. Specifying the @option{-fno-local-ivars}
3605 flag disables this behavior thus avoiding variable shadowing issues.
3607 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3608 @opindex fivar-visibility
3609 Set the default instance variable visibility to the specified option
3610 so that instance variables declared outside the scope of any access
3611 modifier directives default to the specified visibility.
3615 Dump interface declarations for all classes seen in the source file to a
3616 file named @file{@var{sourcename}.decl}.
3618 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3619 @opindex Wassign-intercept
3620 @opindex Wno-assign-intercept
3621 Warn whenever an Objective-C assignment is being intercepted by the
3624 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3625 @opindex Wno-protocol
3627 If a class is declared to implement a protocol, a warning is issued for
3628 every method in the protocol that is not implemented by the class. The
3629 default behavior is to issue a warning for every method not explicitly
3630 implemented in the class, even if a method implementation is inherited
3631 from the superclass. If you use the @option{-Wno-protocol} option, then
3632 methods inherited from the superclass are considered to be implemented,
3633 and no warning is issued for them.
3635 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3637 @opindex Wno-selector
3638 Warn if multiple methods of different types for the same selector are
3639 found during compilation. The check is performed on the list of methods
3640 in the final stage of compilation. Additionally, a check is performed
3641 for each selector appearing in a @code{@@selector(@dots{})}
3642 expression, and a corresponding method for that selector has been found
3643 during compilation. Because these checks scan the method table only at
3644 the end of compilation, these warnings are not produced if the final
3645 stage of compilation is not reached, for example because an error is
3646 found during compilation, or because the @option{-fsyntax-only} option is
3649 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3650 @opindex Wstrict-selector-match
3651 @opindex Wno-strict-selector-match
3652 Warn if multiple methods with differing argument and/or return types are
3653 found for a given selector when attempting to send a message using this
3654 selector to a receiver of type @code{id} or @code{Class}. When this flag
3655 is off (which is the default behavior), the compiler omits such warnings
3656 if any differences found are confined to types that share the same size
3659 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3660 @opindex Wundeclared-selector
3661 @opindex Wno-undeclared-selector
3662 Warn if a @code{@@selector(@dots{})} expression referring to an
3663 undeclared selector is found. A selector is considered undeclared if no
3664 method with that name has been declared before the
3665 @code{@@selector(@dots{})} expression, either explicitly in an
3666 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3667 an @code{@@implementation} section. This option always performs its
3668 checks as soon as a @code{@@selector(@dots{})} expression is found,
3669 while @option{-Wselector} only performs its checks in the final stage of
3670 compilation. This also enforces the coding style convention
3671 that methods and selectors must be declared before being used.
3673 @item -print-objc-runtime-info
3674 @opindex print-objc-runtime-info
3675 Generate C header describing the largest structure that is passed by
3680 @node Diagnostic Message Formatting Options
3681 @section Options to Control Diagnostic Messages Formatting
3682 @cindex options to control diagnostics formatting
3683 @cindex diagnostic messages
3684 @cindex message formatting
3686 Traditionally, diagnostic messages have been formatted irrespective of
3687 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3688 options described below
3689 to control the formatting algorithm for diagnostic messages,
3690 e.g.@: how many characters per line, how often source location
3691 information should be reported. Note that some language front ends may not
3692 honor these options.
3695 @item -fmessage-length=@var{n}
3696 @opindex fmessage-length
3697 Try to format error messages so that they fit on lines of about
3698 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3699 done; each error message appears on a single line. This is the
3700 default for all front ends.
3702 Note - this option also affects the display of the @samp{#error} and
3703 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3704 function/type/variable attribute. It does not however affect the
3705 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3707 @item -fdiagnostics-show-location=once
3708 @opindex fdiagnostics-show-location
3709 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3710 reporter to emit source location information @emph{once}; that is, in
3711 case the message is too long to fit on a single physical line and has to
3712 be wrapped, the source location won't be emitted (as prefix) again,
3713 over and over, in subsequent continuation lines. This is the default
3716 @item -fdiagnostics-show-location=every-line
3717 Only meaningful in line-wrapping mode. Instructs the diagnostic
3718 messages reporter to emit the same source location information (as
3719 prefix) for physical lines that result from the process of breaking
3720 a message which is too long to fit on a single line.
3722 @item -fdiagnostics-color[=@var{WHEN}]
3723 @itemx -fno-diagnostics-color
3724 @opindex fdiagnostics-color
3725 @cindex highlight, color
3726 @vindex GCC_COLORS @r{environment variable}
3727 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3728 or @samp{auto}. The default depends on how the compiler has been configured,
3729 it can be any of the above @var{WHEN} options or also @samp{never}
3730 if @env{GCC_COLORS} environment variable isn't present in the environment,
3731 and @samp{auto} otherwise.
3732 @samp{auto} means to use color only when the standard error is a terminal.
3733 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3734 aliases for @option{-fdiagnostics-color=always} and
3735 @option{-fdiagnostics-color=never}, respectively.
3737 The colors are defined by the environment variable @env{GCC_COLORS}.
3738 Its value is a colon-separated list of capabilities and Select Graphic
3739 Rendition (SGR) substrings. SGR commands are interpreted by the
3740 terminal or terminal emulator. (See the section in the documentation
3741 of your text terminal for permitted values and their meanings as
3742 character attributes.) These substring values are integers in decimal
3743 representation and can be concatenated with semicolons.
3744 Common values to concatenate include
3746 @samp{4} for underline,
3748 @samp{7} for inverse,
3749 @samp{39} for default foreground color,
3750 @samp{30} to @samp{37} for foreground colors,
3751 @samp{90} to @samp{97} for 16-color mode foreground colors,
3752 @samp{38;5;0} to @samp{38;5;255}
3753 for 88-color and 256-color modes foreground colors,
3754 @samp{49} for default background color,
3755 @samp{40} to @samp{47} for background colors,
3756 @samp{100} to @samp{107} for 16-color mode background colors,
3757 and @samp{48;5;0} to @samp{48;5;255}
3758 for 88-color and 256-color modes background colors.
3760 The default @env{GCC_COLORS} is
3762 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3763 quote=01:fixit-insert=32:fixit-delete=31:\
3764 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3768 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3769 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3770 @samp{01} is bold, and @samp{31} is red.
3771 Setting @env{GCC_COLORS} to the empty string disables colors.
3772 Supported capabilities are as follows.
3776 @vindex error GCC_COLORS @r{capability}
3777 SGR substring for error: markers.
3780 @vindex warning GCC_COLORS @r{capability}
3781 SGR substring for warning: markers.
3784 @vindex note GCC_COLORS @r{capability}
3785 SGR substring for note: markers.
3788 @vindex range1 GCC_COLORS @r{capability}
3789 SGR substring for first additional range.
3792 @vindex range2 GCC_COLORS @r{capability}
3793 SGR substring for second additional range.
3796 @vindex locus GCC_COLORS @r{capability}
3797 SGR substring for location information, @samp{file:line} or
3798 @samp{file:line:column} etc.
3801 @vindex quote GCC_COLORS @r{capability}
3802 SGR substring for information printed within quotes.
3805 @vindex fixit-insert GCC_COLORS @r{capability}
3806 SGR substring for fix-it hints suggesting text to
3807 be inserted or replaced.
3810 @vindex fixit-delete GCC_COLORS @r{capability}
3811 SGR substring for fix-it hints suggesting text to
3814 @item diff-filename=
3815 @vindex diff-filename GCC_COLORS @r{capability}
3816 SGR substring for filename headers within generated patches.
3819 @vindex diff-hunk GCC_COLORS @r{capability}
3820 SGR substring for the starts of hunks within generated patches.
3823 @vindex diff-delete GCC_COLORS @r{capability}
3824 SGR substring for deleted lines within generated patches.
3827 @vindex diff-insert GCC_COLORS @r{capability}
3828 SGR substring for inserted lines within generated patches.
3831 @vindex type-diff GCC_COLORS @r{capability}
3832 SGR substring for highlighting mismatching types within template
3833 arguments in the C++ frontend.
3836 @item -fno-diagnostics-show-option
3837 @opindex fno-diagnostics-show-option
3838 @opindex fdiagnostics-show-option
3839 By default, each diagnostic emitted includes text indicating the
3840 command-line option that directly controls the diagnostic (if such an
3841 option is known to the diagnostic machinery). Specifying the
3842 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3844 @item -fno-diagnostics-show-caret
3845 @opindex fno-diagnostics-show-caret
3846 @opindex fdiagnostics-show-caret
3847 By default, each diagnostic emitted includes the original source line
3848 and a caret @samp{^} indicating the column. This option suppresses this
3849 information. The source line is truncated to @var{n} characters, if
3850 the @option{-fmessage-length=n} option is given. When the output is done
3851 to the terminal, the width is limited to the width given by the
3852 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3854 @item -fno-diagnostics-show-labels
3855 @opindex fno-diagnostics-show-labels
3856 @opindex fdiagnostics-show-labels
3857 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3858 diagnostics can label ranges of source code with pertinent information, such
3859 as the types of expressions:
3862 printf ("foo %s bar", long_i + long_j);
3868 This option suppresses the printing of these labels (in the example above,
3869 the vertical bars and the ``char *'' and ``long int'' text).
3871 @item -fno-diagnostics-show-line-numbers
3872 @opindex fno-diagnostics-show-line-numbers
3873 @opindex fdiagnostics-show-line-numbers
3874 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3875 a left margin is printed, showing line numbers. This option suppresses this
3878 @item -fdiagnostics-minimum-margin-width=@var{width}
3879 @opindex fdiagnostics-minimum-margin-width
3880 This option controls the minimum width of the left margin printed by
3881 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
3883 @item -fdiagnostics-parseable-fixits
3884 @opindex fdiagnostics-parseable-fixits
3885 Emit fix-it hints in a machine-parseable format, suitable for consumption
3886 by IDEs. For each fix-it, a line will be printed after the relevant
3887 diagnostic, starting with the string ``fix-it:''. For example:
3890 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3893 The location is expressed as a half-open range, expressed as a count of
3894 bytes, starting at byte 1 for the initial column. In the above example,
3895 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3899 00000000011111111112222222222
3900 12345678901234567890123456789
3901 gtk_widget_showall (dlg);
3906 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3907 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3908 (e.g. vertical tab as ``\013'').
3910 An empty replacement string indicates that the given range is to be removed.
3911 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3912 be inserted at the given position.
3914 @item -fdiagnostics-generate-patch
3915 @opindex fdiagnostics-generate-patch
3916 Print fix-it hints to stderr in unified diff format, after any diagnostics
3917 are printed. For example:
3924 void show_cb(GtkDialog *dlg)
3926 - gtk_widget_showall(dlg);
3927 + gtk_widget_show_all(dlg);
3932 The diff may or may not be colorized, following the same rules
3933 as for diagnostics (see @option{-fdiagnostics-color}).
3935 @item -fdiagnostics-show-template-tree
3936 @opindex fdiagnostics-show-template-tree
3938 In the C++ frontend, when printing diagnostics showing mismatching
3939 template types, such as:
3942 could not convert 'std::map<int, std::vector<double> >()'
3943 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3946 the @option{-fdiagnostics-show-template-tree} flag enables printing a
3947 tree-like structure showing the common and differing parts of the types,
3957 The parts that differ are highlighted with color (``double'' and
3958 ``float'' in this case).
3960 @item -fno-elide-type
3961 @opindex fno-elide-type
3962 @opindex felide-type
3963 By default when the C++ frontend prints diagnostics showing mismatching
3964 template types, common parts of the types are printed as ``[...]'' to
3965 simplify the error message. For example:
3968 could not convert 'std::map<int, std::vector<double> >()'
3969 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3972 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
3973 This flag also affects the output of the
3974 @option{-fdiagnostics-show-template-tree} flag.
3976 @item -fno-show-column
3977 @opindex fno-show-column
3978 @opindex fshow-column
3979 Do not print column numbers in diagnostics. This may be necessary if
3980 diagnostics are being scanned by a program that does not understand the
3981 column numbers, such as @command{dejagnu}.
3983 @item -fdiagnostics-format=@var{FORMAT}
3984 @opindex fdiagnostics-format
3985 Select a different format for printing diagnostics.
3986 @var{FORMAT} is @samp{text} or @samp{json}.
3987 The default is @samp{text}.
3989 The @samp{json} format consists of a top-level JSON array containing JSON
3990 objects representing the diagnostics.
3992 The JSON is emitted as one line, without formatting; the examples below
3993 have been formatted for clarity.
3995 Diagnostics can have child diagnostics. For example, this error and note:
3998 misleading-indentation.c:15:3: warning: this 'if' clause does not
3999 guard... [-Wmisleading-indentation]
4002 misleading-indentation.c:17:5: note: ...this statement, but the latter
4003 is misleadingly indented as if it were guarded by the 'if'
4009 might be printed in JSON form (after formatting) like this:
4019 "file": "misleading-indentation.c",
4024 "file": "misleading-indentation.c",
4029 "message": "this \u2018if\u2019 clause does not guard...",
4030 "option": "-Wmisleading-indentation",
4038 "file": "misleading-indentation.c",
4043 "message": "...this statement, but the latter is @dots{}"
4052 where the @code{note} is a child of the @code{warning}.
4054 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
4055 an @code{option} key describing the command-line option controlling the
4058 A diagnostic can contain zero or more locations. Each location has up
4059 to three positions within it: a @code{caret} position and optional
4060 @code{start} and @code{finish} positions. A location can also have
4061 an optional @code{label} string. For example, this error:
4064 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4065 'struct s'@} and 'T' @{aka 'struct t'@})
4066 64 | return callee_4a () + callee_4b ();
4067 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4069 | | T @{aka struct t@}
4070 | S @{aka struct s@}
4074 has three locations. Its primary location is at the ``+'' token at column
4075 23. It has two secondary locations, describing the left and right-hand sides
4076 of the expression, which have labels. It might be printed in JSON form as:
4085 "column": 23, "file": "bad-binary-ops.c", "line": 64
4090 "column": 10, "file": "bad-binary-ops.c", "line": 64
4093 "column": 21, "file": "bad-binary-ops.c", "line": 64
4095 "label": "S @{aka struct s@}"
4099 "column": 25, "file": "bad-binary-ops.c", "line": 64
4102 "column": 36, "file": "bad-binary-ops.c", "line": 64
4104 "label": "T @{aka struct t@}"
4107 "message": "invalid operands to binary + @dots{}"
4111 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4112 consisting of half-open intervals, similar to the output of
4113 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
4114 with a replacement fix-it hint:
4117 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4119 8 | return ptr->colour;
4125 might be printed in JSON form as:
4160 "message": "\u2018struct s\u2019 has no member named @dots{}"
4165 where the fix-it hint suggests replacing the text from @code{start} up
4166 to but not including @code{next} with @code{string}'s value. Deletions
4167 are expressed via an empty value for @code{string}, insertions by
4168 having @code{start} equal @code{next}.
4172 @node Warning Options
4173 @section Options to Request or Suppress Warnings
4174 @cindex options to control warnings
4175 @cindex warning messages
4176 @cindex messages, warning
4177 @cindex suppressing warnings
4179 Warnings are diagnostic messages that report constructions that
4180 are not inherently erroneous but that are risky or suggest there
4181 may have been an error.
4183 The following language-independent options do not enable specific
4184 warnings but control the kinds of diagnostics produced by GCC@.
4187 @cindex syntax checking
4189 @opindex fsyntax-only
4190 Check the code for syntax errors, but don't do anything beyond that.
4192 @item -fmax-errors=@var{n}
4193 @opindex fmax-errors
4194 Limits the maximum number of error messages to @var{n}, at which point
4195 GCC bails out rather than attempting to continue processing the source
4196 code. If @var{n} is 0 (the default), there is no limit on the number
4197 of error messages produced. If @option{-Wfatal-errors} is also
4198 specified, then @option{-Wfatal-errors} takes precedence over this
4203 Inhibit all warning messages.
4208 Make all warnings into errors.
4213 Make the specified warning into an error. The specifier for a warning
4214 is appended; for example @option{-Werror=switch} turns the warnings
4215 controlled by @option{-Wswitch} into errors. This switch takes a
4216 negative form, to be used to negate @option{-Werror} for specific
4217 warnings; for example @option{-Wno-error=switch} makes
4218 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4221 The warning message for each controllable warning includes the
4222 option that controls the warning. That option can then be used with
4223 @option{-Werror=} and @option{-Wno-error=} as described above.
4224 (Printing of the option in the warning message can be disabled using the
4225 @option{-fno-diagnostics-show-option} flag.)
4227 Note that specifying @option{-Werror=}@var{foo} automatically implies
4228 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4231 @item -Wfatal-errors
4232 @opindex Wfatal-errors
4233 @opindex Wno-fatal-errors
4234 This option causes the compiler to abort compilation on the first error
4235 occurred rather than trying to keep going and printing further error
4240 You can request many specific warnings with options beginning with
4241 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4242 implicit declarations. Each of these specific warning options also
4243 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4244 example, @option{-Wno-implicit}. This manual lists only one of the
4245 two forms, whichever is not the default. For further
4246 language-specific options also refer to @ref{C++ Dialect Options} and
4247 @ref{Objective-C and Objective-C++ Dialect Options}.
4249 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4250 options, such as @option{-Wunused}, which may turn on further options,
4251 such as @option{-Wunused-value}. The combined effect of positive and
4252 negative forms is that more specific options have priority over less
4253 specific ones, independently of their position in the command-line. For
4254 options of the same specificity, the last one takes effect. Options
4255 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4256 as if they appeared at the end of the command-line.
4258 When an unrecognized warning option is requested (e.g.,
4259 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4260 that the option is not recognized. However, if the @option{-Wno-} form
4261 is used, the behavior is slightly different: no diagnostic is
4262 produced for @option{-Wno-unknown-warning} unless other diagnostics
4263 are being produced. This allows the use of new @option{-Wno-} options
4264 with old compilers, but if something goes wrong, the compiler
4265 warns that an unrecognized option is present.
4272 @opindex Wno-pedantic
4273 Issue all the warnings demanded by strict ISO C and ISO C++;
4274 reject all programs that use forbidden extensions, and some other
4275 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4276 version of the ISO C standard specified by any @option{-std} option used.
4278 Valid ISO C and ISO C++ programs should compile properly with or without
4279 this option (though a rare few require @option{-ansi} or a
4280 @option{-std} option specifying the required version of ISO C)@. However,
4281 without this option, certain GNU extensions and traditional C and C++
4282 features are supported as well. With this option, they are rejected.
4284 @option{-Wpedantic} does not cause warning messages for use of the
4285 alternate keywords whose names begin and end with @samp{__}. Pedantic
4286 warnings are also disabled in the expression that follows
4287 @code{__extension__}. However, only system header files should use
4288 these escape routes; application programs should avoid them.
4289 @xref{Alternate Keywords}.
4291 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4292 C conformance. They soon find that it does not do quite what they want:
4293 it finds some non-ISO practices, but not all---only those for which
4294 ISO C @emph{requires} a diagnostic, and some others for which
4295 diagnostics have been added.
4297 A feature to report any failure to conform to ISO C might be useful in
4298 some instances, but would require considerable additional work and would
4299 be quite different from @option{-Wpedantic}. We don't have plans to
4300 support such a feature in the near future.
4302 Where the standard specified with @option{-std} represents a GNU
4303 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4304 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4305 extended dialect is based. Warnings from @option{-Wpedantic} are given
4306 where they are required by the base standard. (It does not make sense
4307 for such warnings to be given only for features not in the specified GNU
4308 C dialect, since by definition the GNU dialects of C include all
4309 features the compiler supports with the given option, and there would be
4310 nothing to warn about.)
4312 @item -pedantic-errors
4313 @opindex pedantic-errors
4314 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4315 requires a diagnostic, in some cases where there is undefined behavior
4316 at compile-time and in some other cases that do not prevent compilation
4317 of programs that are valid according to the standard. This is not
4318 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4319 by this option and not enabled by the latter and vice versa.
4324 This enables all the warnings about constructions that some users
4325 consider questionable, and that are easy to avoid (or modify to
4326 prevent the warning), even in conjunction with macros. This also
4327 enables some language-specific warnings described in @ref{C++ Dialect
4328 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4330 @option{-Wall} turns on the following warning flags:
4332 @gccoptlist{-Waddress @gol
4333 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4335 -Wbool-operation @gol
4336 -Wc++11-compat -Wc++14-compat @gol
4337 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4338 -Wchar-subscripts @gol
4340 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4341 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4343 -Wint-in-bool-context @gol
4344 -Wimplicit @r{(C and Objective-C only)} @gol
4345 -Wimplicit-int @r{(C and Objective-C only)} @gol
4346 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4347 -Winit-self @r{(only for C++)} @gol
4348 -Wlogical-not-parentheses @gol
4349 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4350 -Wmaybe-uninitialized @gol
4351 -Wmemset-elt-size @gol
4352 -Wmemset-transposed-args @gol
4353 -Wmisleading-indentation @r{(only for C/C++)} @gol
4354 -Wmissing-attributes @gol
4355 -Wmissing-braces @r{(only for C/ObjC)} @gol
4356 -Wmultistatement-macros @gol
4357 -Wnarrowing @r{(only for C++)} @gol
4359 -Wnonnull-compare @gol
4362 -Wpessimizing-move @r{(only for C++)} @gol
4367 -Wsequence-point @gol
4368 -Wsign-compare @r{(only in C++)} @gol
4369 -Wsizeof-pointer-div @gol
4370 -Wsizeof-pointer-memaccess @gol
4371 -Wstrict-aliasing @gol
4372 -Wstrict-overflow=1 @gol
4374 -Wtautological-compare @gol
4376 -Wuninitialized @gol
4377 -Wunknown-pragmas @gol
4378 -Wunused-function @gol
4381 -Wunused-variable @gol
4382 -Wvolatile-register-var @gol
4385 Note that some warning flags are not implied by @option{-Wall}. Some of
4386 them warn about constructions that users generally do not consider
4387 questionable, but which occasionally you might wish to check for;
4388 others warn about constructions that are necessary or hard to avoid in
4389 some cases, and there is no simple way to modify the code to suppress
4390 the warning. Some of them are enabled by @option{-Wextra} but many of
4391 them must be enabled individually.
4397 This enables some extra warning flags that are not enabled by
4398 @option{-Wall}. (This option used to be called @option{-W}. The older
4399 name is still supported, but the newer name is more descriptive.)
4401 @gccoptlist{-Wclobbered @gol
4402 -Wcast-function-type @gol
4404 -Wignored-qualifiers @gol
4405 -Wimplicit-fallthrough=3 @gol
4406 -Wmissing-field-initializers @gol
4407 -Wmissing-parameter-type @r{(C only)} @gol
4408 -Wold-style-declaration @r{(C only)} @gol
4409 -Woverride-init @gol
4410 -Wsign-compare @r{(C only)} @gol
4411 -Wredundant-move @r{(only for C++)} @gol
4413 -Wuninitialized @gol
4414 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4415 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4416 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4419 The option @option{-Wextra} also prints warning messages for the
4425 A pointer is compared against integer zero with @code{<}, @code{<=},
4426 @code{>}, or @code{>=}.
4429 (C++ only) An enumerator and a non-enumerator both appear in a
4430 conditional expression.
4433 (C++ only) Ambiguous virtual bases.
4436 (C++ only) Subscripting an array that has been declared @code{register}.
4439 (C++ only) Taking the address of a variable that has been declared
4443 (C++ only) A base class is not initialized in the copy constructor
4448 @item -Wchar-subscripts
4449 @opindex Wchar-subscripts
4450 @opindex Wno-char-subscripts
4451 Warn if an array subscript has type @code{char}. This is a common cause
4452 of error, as programmers often forget that this type is signed on some
4454 This warning is enabled by @option{-Wall}.
4459 Warn about an invalid memory access that is found by Pointer Bounds Checker
4460 (@option{-fcheck-pointer-bounds}).
4462 @item -Wno-coverage-mismatch
4463 @opindex Wno-coverage-mismatch
4464 @opindex Wcoverage-mismatch
4465 Warn if feedback profiles do not match when using the
4466 @option{-fprofile-use} option.
4467 If a source file is changed between compiling with @option{-fprofile-generate}
4468 and with @option{-fprofile-use}, the files with the profile feedback can fail
4469 to match the source file and GCC cannot use the profile feedback
4470 information. By default, this warning is enabled and is treated as an
4471 error. @option{-Wno-coverage-mismatch} can be used to disable the
4472 warning or @option{-Wno-error=coverage-mismatch} can be used to
4473 disable the error. Disabling the error for this warning can result in
4474 poorly optimized code and is useful only in the
4475 case of very minor changes such as bug fixes to an existing code-base.
4476 Completely disabling the warning is not recommended.
4479 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4481 Suppress warning messages emitted by @code{#warning} directives.
4483 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4484 @opindex Wdouble-promotion
4485 @opindex Wno-double-promotion
4486 Give a warning when a value of type @code{float} is implicitly
4487 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4488 floating-point unit implement @code{float} in hardware, but emulate
4489 @code{double} in software. On such a machine, doing computations
4490 using @code{double} values is much more expensive because of the
4491 overhead required for software emulation.
4493 It is easy to accidentally do computations with @code{double} because
4494 floating-point literals are implicitly of type @code{double}. For
4498 float area(float radius)
4500 return 3.14159 * radius * radius;
4504 the compiler performs the entire computation with @code{double}
4505 because the floating-point literal is a @code{double}.
4507 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4508 @opindex Wduplicate-decl-specifier
4509 @opindex Wno-duplicate-decl-specifier
4510 Warn if a declaration has duplicate @code{const}, @code{volatile},
4511 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4515 @itemx -Wformat=@var{n}
4518 @opindex ffreestanding
4519 @opindex fno-builtin
4521 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4522 the arguments supplied have types appropriate to the format string
4523 specified, and that the conversions specified in the format string make
4524 sense. This includes standard functions, and others specified by format
4525 attributes (@pxref{Function Attributes}), in the @code{printf},
4526 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4527 not in the C standard) families (or other target-specific families).
4528 Which functions are checked without format attributes having been
4529 specified depends on the standard version selected, and such checks of
4530 functions without the attribute specified are disabled by
4531 @option{-ffreestanding} or @option{-fno-builtin}.
4533 The formats are checked against the format features supported by GNU
4534 libc version 2.2. These include all ISO C90 and C99 features, as well
4535 as features from the Single Unix Specification and some BSD and GNU
4536 extensions. Other library implementations may not support all these
4537 features; GCC does not support warning about features that go beyond a
4538 particular library's limitations. However, if @option{-Wpedantic} is used
4539 with @option{-Wformat}, warnings are given about format features not
4540 in the selected standard version (but not for @code{strfmon} formats,
4541 since those are not in any version of the C standard). @xref{C Dialect
4542 Options,,Options Controlling C Dialect}.
4549 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4550 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4551 @option{-Wformat} also checks for null format arguments for several
4552 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4553 aspects of this level of format checking can be disabled by the
4554 options: @option{-Wno-format-contains-nul},
4555 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4556 @option{-Wformat} is enabled by @option{-Wall}.
4558 @item -Wno-format-contains-nul
4559 @opindex Wno-format-contains-nul
4560 @opindex Wformat-contains-nul
4561 If @option{-Wformat} is specified, do not warn about format strings that
4564 @item -Wno-format-extra-args
4565 @opindex Wno-format-extra-args
4566 @opindex Wformat-extra-args
4567 If @option{-Wformat} is specified, do not warn about excess arguments to a
4568 @code{printf} or @code{scanf} format function. The C standard specifies
4569 that such arguments are ignored.
4571 Where the unused arguments lie between used arguments that are
4572 specified with @samp{$} operand number specifications, normally
4573 warnings are still given, since the implementation could not know what
4574 type to pass to @code{va_arg} to skip the unused arguments. However,
4575 in the case of @code{scanf} formats, this option suppresses the
4576 warning if the unused arguments are all pointers, since the Single
4577 Unix Specification says that such unused arguments are allowed.
4579 @item -Wformat-overflow
4580 @itemx -Wformat-overflow=@var{level}
4581 @opindex Wformat-overflow
4582 @opindex Wno-format-overflow
4583 Warn about calls to formatted input/output functions such as @code{sprintf}
4584 and @code{vsprintf} that might overflow the destination buffer. When the
4585 exact number of bytes written by a format directive cannot be determined
4586 at compile-time it is estimated based on heuristics that depend on the
4587 @var{level} argument and on optimization. While enabling optimization
4588 will in most cases improve the accuracy of the warning, it may also
4589 result in false positives.
4592 @item -Wformat-overflow
4593 @itemx -Wformat-overflow=1
4594 @opindex Wformat-overflow
4595 @opindex Wno-format-overflow
4596 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4597 employs a conservative approach that warns only about calls that most
4598 likely overflow the buffer. At this level, numeric arguments to format
4599 directives with unknown values are assumed to have the value of one, and
4600 strings of unknown length to be empty. Numeric arguments that are known
4601 to be bounded to a subrange of their type, or string arguments whose output
4602 is bounded either by their directive's precision or by a finite set of
4603 string literals, are assumed to take on the value within the range that
4604 results in the most bytes on output. For example, the call to @code{sprintf}
4605 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4606 the terminating NUL character (@code{'\0'}) appended by the function
4607 to the destination buffer will be written past its end. Increasing
4608 the size of the buffer by a single byte is sufficient to avoid the
4609 warning, though it may not be sufficient to avoid the overflow.
4612 void f (int a, int b)
4615 sprintf (buf, "a = %i, b = %i\n", a, b);
4619 @item -Wformat-overflow=2
4620 Level @var{2} warns also about calls that might overflow the destination
4621 buffer given an argument of sufficient length or magnitude. At level
4622 @var{2}, unknown numeric arguments are assumed to have the minimum
4623 representable value for signed types with a precision greater than 1, and
4624 the maximum representable value otherwise. Unknown string arguments whose
4625 length cannot be assumed to be bounded either by the directive's precision,
4626 or by a finite set of string literals they may evaluate to, or the character
4627 array they may point to, are assumed to be 1 character long.
4629 At level @var{2}, the call in the example above is again diagnosed, but
4630 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4631 @code{%i} directive will write some of its digits beyond the end of
4632 the destination buffer. To make the call safe regardless of the values
4633 of the two variables, the size of the destination buffer must be increased
4634 to at least 34 bytes. GCC includes the minimum size of the buffer in
4635 an informational note following the warning.
4637 An alternative to increasing the size of the destination buffer is to
4638 constrain the range of formatted values. The maximum length of string
4639 arguments can be bounded by specifying the precision in the format
4640 directive. When numeric arguments of format directives can be assumed
4641 to be bounded by less than the precision of their type, choosing
4642 an appropriate length modifier to the format specifier will reduce
4643 the required buffer size. For example, if @var{a} and @var{b} in the
4644 example above can be assumed to be within the precision of
4645 the @code{short int} type then using either the @code{%hi} format
4646 directive or casting the argument to @code{short} reduces the maximum
4647 required size of the buffer to 24 bytes.
4650 void f (int a, int b)
4653 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4658 @item -Wno-format-zero-length
4659 @opindex Wno-format-zero-length
4660 @opindex Wformat-zero-length
4661 If @option{-Wformat} is specified, do not warn about zero-length formats.
4662 The C standard specifies that zero-length formats are allowed.
4667 Enable @option{-Wformat} plus additional format checks. Currently
4668 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4671 @item -Wformat-nonliteral
4672 @opindex Wformat-nonliteral
4673 @opindex Wno-format-nonliteral
4674 If @option{-Wformat} is specified, also warn if the format string is not a
4675 string literal and so cannot be checked, unless the format function
4676 takes its format arguments as a @code{va_list}.
4678 @item -Wformat-security
4679 @opindex Wformat-security
4680 @opindex Wno-format-security
4681 If @option{-Wformat} is specified, also warn about uses of format
4682 functions that represent possible security problems. At present, this
4683 warns about calls to @code{printf} and @code{scanf} functions where the
4684 format string is not a string literal and there are no format arguments,
4685 as in @code{printf (foo);}. This may be a security hole if the format
4686 string came from untrusted input and contains @samp{%n}. (This is
4687 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4688 in future warnings may be added to @option{-Wformat-security} that are not
4689 included in @option{-Wformat-nonliteral}.)
4691 @item -Wformat-signedness
4692 @opindex Wformat-signedness
4693 @opindex Wno-format-signedness
4694 If @option{-Wformat} is specified, also warn if the format string
4695 requires an unsigned argument and the argument is signed and vice versa.
4697 @item -Wformat-truncation
4698 @itemx -Wformat-truncation=@var{level}
4699 @opindex Wformat-truncation
4700 @opindex Wno-format-truncation
4701 Warn about calls to formatted input/output functions such as @code{snprintf}
4702 and @code{vsnprintf} that might result in output truncation. When the exact
4703 number of bytes written by a format directive cannot be determined at
4704 compile-time it is estimated based on heuristics that depend on
4705 the @var{level} argument and on optimization. While enabling optimization
4706 will in most cases improve the accuracy of the warning, it may also result
4707 in false positives. Except as noted otherwise, the option uses the same
4708 logic @option{-Wformat-overflow}.
4711 @item -Wformat-truncation
4712 @itemx -Wformat-truncation=1
4713 @opindex Wformat-truncation
4714 @opindex Wno-format-truncation
4715 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4716 employs a conservative approach that warns only about calls to bounded
4717 functions whose return value is unused and that will most likely result
4718 in output truncation.
4720 @item -Wformat-truncation=2
4721 Level @var{2} warns also about calls to bounded functions whose return
4722 value is used and that might result in truncation given an argument of
4723 sufficient length or magnitude.
4727 @opindex Wformat-y2k
4728 @opindex Wno-format-y2k
4729 If @option{-Wformat} is specified, also warn about @code{strftime}
4730 formats that may yield only a two-digit year.
4735 @opindex Wno-nonnull
4736 Warn about passing a null pointer for arguments marked as
4737 requiring a non-null value by the @code{nonnull} function attribute.
4739 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4740 can be disabled with the @option{-Wno-nonnull} option.
4742 @item -Wnonnull-compare
4743 @opindex Wnonnull-compare
4744 @opindex Wno-nonnull-compare
4745 Warn when comparing an argument marked with the @code{nonnull}
4746 function attribute against null inside the function.
4748 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4749 can be disabled with the @option{-Wno-nonnull-compare} option.
4751 @item -Wnull-dereference
4752 @opindex Wnull-dereference
4753 @opindex Wno-null-dereference
4754 Warn if the compiler detects paths that trigger erroneous or
4755 undefined behavior due to dereferencing a null pointer. This option
4756 is only active when @option{-fdelete-null-pointer-checks} is active,
4757 which is enabled by optimizations in most targets. The precision of
4758 the warnings depends on the optimization options used.
4760 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4762 @opindex Wno-init-self
4763 Warn about uninitialized variables that are initialized with themselves.
4764 Note this option can only be used with the @option{-Wuninitialized} option.
4766 For example, GCC warns about @code{i} being uninitialized in the
4767 following snippet only when @option{-Winit-self} has been specified:
4778 This warning is enabled by @option{-Wall} in C++.
4780 @item -Wimplicit-int @r{(C and Objective-C only)}
4781 @opindex Wimplicit-int
4782 @opindex Wno-implicit-int
4783 Warn when a declaration does not specify a type.
4784 This warning is enabled by @option{-Wall}.
4786 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4787 @opindex Wimplicit-function-declaration
4788 @opindex Wno-implicit-function-declaration
4789 Give a warning whenever a function is used before being declared. In
4790 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4791 enabled by default and it is made into an error by
4792 @option{-pedantic-errors}. This warning is also enabled by
4795 @item -Wimplicit @r{(C and Objective-C only)}
4797 @opindex Wno-implicit
4798 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4799 This warning is enabled by @option{-Wall}.
4801 @item -Wimplicit-fallthrough
4802 @opindex Wimplicit-fallthrough
4803 @opindex Wno-implicit-fallthrough
4804 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4805 and @option{-Wno-implicit-fallthrough} is the same as
4806 @option{-Wimplicit-fallthrough=0}.
4808 @item -Wimplicit-fallthrough=@var{n}
4809 @opindex Wimplicit-fallthrough=
4810 Warn when a switch case falls through. For example:
4828 This warning does not warn when the last statement of a case cannot
4829 fall through, e.g. when there is a return statement or a call to function
4830 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4831 also takes into account control flow statements, such as ifs, and only
4832 warns when appropriate. E.g.@:
4842 @} else if (i < 1) @{
4852 Since there are occasions where a switch case fall through is desirable,
4853 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4854 to be used along with a null statement to suppress this warning that
4855 would normally occur:
4863 __attribute__ ((fallthrough));
4870 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4871 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4872 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4873 Instead of these attributes, it is also possible to add a fallthrough comment
4874 to silence the warning. The whole body of the C or C++ style comment should
4875 match the given regular expressions listed below. The option argument @var{n}
4876 specifies what kind of comments are accepted:
4880 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4882 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4883 expression, any comment is used as fallthrough comment.
4885 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4886 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4888 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4889 following regular expressions:
4893 @item @code{-fallthrough}
4895 @item @code{@@fallthrough@@}
4897 @item @code{lint -fallthrough[ \t]*}
4899 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4901 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4903 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4907 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4908 following regular expressions:
4912 @item @code{-fallthrough}
4914 @item @code{@@fallthrough@@}
4916 @item @code{lint -fallthrough[ \t]*}
4918 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4922 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
4923 fallthrough comments, only attributes disable the warning.
4927 The comment needs to be followed after optional whitespace and other comments
4928 by @code{case} or @code{default} keywords or by a user label that precedes some
4929 @code{case} or @code{default} label.
4944 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
4946 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
4947 @opindex Wif-not-aligned
4948 @opindex Wno-if-not-aligned
4949 Control if warning triggered by the @code{warn_if_not_aligned} attribute
4950 should be issued. This is enabled by default.
4951 Use @option{-Wno-if-not-aligned} to disable it.
4953 @item -Wignored-qualifiers @r{(C and C++ only)}
4954 @opindex Wignored-qualifiers
4955 @opindex Wno-ignored-qualifiers
4956 Warn if the return type of a function has a type qualifier
4957 such as @code{const}. For ISO C such a type qualifier has no effect,
4958 since the value returned by a function is not an lvalue.
4959 For C++, the warning is only emitted for scalar types or @code{void}.
4960 ISO C prohibits qualified @code{void} return types on function
4961 definitions, so such return types always receive a warning
4962 even without this option.
4964 This warning is also enabled by @option{-Wextra}.
4966 @item -Wignored-attributes @r{(C and C++ only)}
4967 @opindex Wignored-attributes
4968 @opindex Wno-ignored-attributes
4969 Warn when an attribute is ignored. This is different from the
4970 @option{-Wattributes} option in that it warns whenever the compiler decides
4971 to drop an attribute, not that the attribute is either unknown, used in a
4972 wrong place, etc. This warning is enabled by default.
4977 Warn if the type of @code{main} is suspicious. @code{main} should be
4978 a function with external linkage, returning int, taking either zero
4979 arguments, two, or three arguments of appropriate types. This warning
4980 is enabled by default in C++ and is enabled by either @option{-Wall}
4981 or @option{-Wpedantic}.
4983 @item -Wmisleading-indentation @r{(C and C++ only)}
4984 @opindex Wmisleading-indentation
4985 @opindex Wno-misleading-indentation
4986 Warn when the indentation of the code does not reflect the block structure.
4987 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
4988 @code{for} clauses with a guarded statement that does not use braces,
4989 followed by an unguarded statement with the same indentation.
4991 In the following example, the call to ``bar'' is misleadingly indented as
4992 if it were guarded by the ``if'' conditional.
4995 if (some_condition ())
4997 bar (); /* Gotcha: this is not guarded by the "if". */
5000 In the case of mixed tabs and spaces, the warning uses the
5001 @option{-ftabstop=} option to determine if the statements line up
5004 The warning is not issued for code involving multiline preprocessor logic
5005 such as the following example.
5010 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5016 The warning is not issued after a @code{#line} directive, since this
5017 typically indicates autogenerated code, and no assumptions can be made
5018 about the layout of the file that the directive references.
5020 This warning is enabled by @option{-Wall} in C and C++.
5022 @item -Wno-missing-attributes
5023 @opindex Wmissing-attributes
5024 @opindex Wno-missing-attributes
5025 Warn when a declaration of a function is missing one or more attributes
5026 that a related function is declared with and whose absence may adversely
5027 affect the correctness or efficiency of generated code. For example,
5028 the warning is issued for declarations of aliases that use attributes
5029 to specify less restrictive requirements than those of their targets.
5030 This typically represents a potential optimization oportunity rather
5031 than a hidden bug. The @option{-Wattribute-alias} option controls warnings
5032 issued for mismatches between declarations of aliases and their targets
5033 that might be indicative of code generation bugs.
5034 Attributes considered include @code{alloc_align}, @code{alloc_size},
5035 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5036 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5037 @code{returns_nonnull}, and @code{returns_twice}.
5039 In C++, the warning is issued when an explicit specialization of a primary
5040 template declared with attribute @code{alloc_align}, @code{alloc_size},
5041 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5042 or @code{nonnull} is declared without it. Attributes @code{deprecated},
5043 @code{error}, and @code{warning} suppress the warning.
5044 (@pxref{Function Attributes}).
5046 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5048 For example, since the declaration of the primary function template
5049 below makes use of both attribute @code{malloc} and @code{alloc_size}
5050 the declaration of the explicit specialization of the template is
5051 diagnosed because it is missing one of the attributes.
5055 T* __attribute__ ((malloc, alloc_size (1)))
5059 void* __attribute__ ((malloc)) // missing alloc_size
5060 allocate<void> (size_t);
5063 @item -Wmissing-braces
5064 @opindex Wmissing-braces
5065 @opindex Wno-missing-braces
5066 Warn if an aggregate or union initializer is not fully bracketed. In
5067 the following example, the initializer for @code{a} is not fully
5068 bracketed, but that for @code{b} is fully bracketed. This warning is
5069 enabled by @option{-Wall} in C.
5072 int a[2][2] = @{ 0, 1, 2, 3 @};
5073 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5076 This warning is enabled by @option{-Wall}.
5078 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5079 @opindex Wmissing-include-dirs
5080 @opindex Wno-missing-include-dirs
5081 Warn if a user-supplied include directory does not exist.
5083 @item -Wmissing-profile
5084 @opindex Wmissing-profile
5085 @opindex Wno-missing-profile
5086 Warn if feedback profiles are missing when using the
5087 @option{-fprofile-use} option.
5088 This option diagnoses those cases where a new function or a new file is added
5089 to the user code between compiling with @option{-fprofile-generate} and with
5090 @option{-fprofile-use}, without regenerating the profiles. In these cases, the
5091 profile feedback data files do not contain any profile feedback information for
5092 the newly added function or file respectively. Also, in the case when profile
5093 count data (.gcda) files are removed, GCC cannot use any profile feedback
5094 information. In all these cases, warnings are issued to inform the user that a
5095 profile generation step is due. @option{-Wno-missing-profile} can be used to
5096 disable the warning. Ignoring the warning can result in poorly optimized code.
5097 Completely disabling the warning is not recommended and should be done only
5098 when non-existent profile data is justified.
5100 @item -Wmultistatement-macros
5101 @opindex Wmultistatement-macros
5102 @opindex Wno-multistatement-macros
5103 Warn about unsafe multiple statement macros that appear to be guarded
5104 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5105 @code{while}, in which only the first statement is actually guarded after
5106 the macro is expanded.
5111 #define DOIT x++; y++
5116 will increment @code{y} unconditionally, not just when @code{c} holds.
5117 The can usually be fixed by wrapping the macro in a do-while loop:
5119 #define DOIT do @{ x++; y++; @} while (0)
5124 This warning is enabled by @option{-Wall} in C and C++.
5127 @opindex Wparentheses
5128 @opindex Wno-parentheses
5129 Warn if parentheses are omitted in certain contexts, such
5130 as when there is an assignment in a context where a truth value
5131 is expected, or when operators are nested whose precedence people
5132 often get confused about.
5134 Also warn if a comparison like @code{x<=y<=z} appears; this is
5135 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5136 interpretation from that of ordinary mathematical notation.
5138 Also warn for dangerous uses of the GNU extension to
5139 @code{?:} with omitted middle operand. When the condition
5140 in the @code{?}: operator is a boolean expression, the omitted value is
5141 always 1. Often programmers expect it to be a value computed
5142 inside the conditional expression instead.
5144 For C++ this also warns for some cases of unnecessary parentheses in
5145 declarations, which can indicate an attempt at a function call instead
5149 // Declares a local variable called mymutex.
5150 std::unique_lock<std::mutex> (mymutex);
5151 // User meant std::unique_lock<std::mutex> lock (mymutex);
5155 This warning is enabled by @option{-Wall}.
5157 @item -Wsequence-point
5158 @opindex Wsequence-point
5159 @opindex Wno-sequence-point
5160 Warn about code that may have undefined semantics because of violations
5161 of sequence point rules in the C and C++ standards.
5163 The C and C++ standards define the order in which expressions in a C/C++
5164 program are evaluated in terms of @dfn{sequence points}, which represent
5165 a partial ordering between the execution of parts of the program: those
5166 executed before the sequence point, and those executed after it. These
5167 occur after the evaluation of a full expression (one which is not part
5168 of a larger expression), after the evaluation of the first operand of a
5169 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5170 function is called (but after the evaluation of its arguments and the
5171 expression denoting the called function), and in certain other places.
5172 Other than as expressed by the sequence point rules, the order of
5173 evaluation of subexpressions of an expression is not specified. All
5174 these rules describe only a partial order rather than a total order,
5175 since, for example, if two functions are called within one expression
5176 with no sequence point between them, the order in which the functions
5177 are called is not specified. However, the standards committee have
5178 ruled that function calls do not overlap.
5180 It is not specified when between sequence points modifications to the
5181 values of objects take effect. Programs whose behavior depends on this
5182 have undefined behavior; the C and C++ standards specify that ``Between
5183 the previous and next sequence point an object shall have its stored
5184 value modified at most once by the evaluation of an expression.
5185 Furthermore, the prior value shall be read only to determine the value
5186 to be stored.''. If a program breaks these rules, the results on any
5187 particular implementation are entirely unpredictable.
5189 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5190 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
5191 diagnosed by this option, and it may give an occasional false positive
5192 result, but in general it has been found fairly effective at detecting
5193 this sort of problem in programs.
5195 The C++17 standard will define the order of evaluation of operands in
5196 more cases: in particular it requires that the right-hand side of an
5197 assignment be evaluated before the left-hand side, so the above
5198 examples are no longer undefined. But this warning will still warn
5199 about them, to help people avoid writing code that is undefined in C
5200 and earlier revisions of C++.
5202 The standard is worded confusingly, therefore there is some debate
5203 over the precise meaning of the sequence point rules in subtle cases.
5204 Links to discussions of the problem, including proposed formal
5205 definitions, may be found on the GCC readings page, at
5206 @uref{http://gcc.gnu.org/@/readings.html}.
5208 This warning is enabled by @option{-Wall} for C and C++.
5210 @item -Wno-return-local-addr
5211 @opindex Wno-return-local-addr
5212 @opindex Wreturn-local-addr
5213 Do not warn about returning a pointer (or in C++, a reference) to a
5214 variable that goes out of scope after the function returns.
5217 @opindex Wreturn-type
5218 @opindex Wno-return-type
5219 Warn whenever a function is defined with a return type that defaults
5220 to @code{int}. Also warn about any @code{return} statement with no
5221 return value in a function whose return type is not @code{void}
5222 (falling off the end of the function body is considered returning
5225 For C only, warn about a @code{return} statement with an expression in a
5226 function whose return type is @code{void}, unless the expression type is
5227 also @code{void}. As a GNU extension, the latter case is accepted
5228 without a warning unless @option{-Wpedantic} is used.
5230 For C++, a function without return type always produces a diagnostic
5231 message, even when @option{-Wno-return-type} is specified. The only
5232 exceptions are @code{main} and functions defined in system headers.
5234 This warning is enabled by default for C++ and is enabled by @option{-Wall}.
5236 @item -Wshift-count-negative
5237 @opindex Wshift-count-negative
5238 @opindex Wno-shift-count-negative
5239 Warn if shift count is negative. This warning is enabled by default.
5241 @item -Wshift-count-overflow
5242 @opindex Wshift-count-overflow
5243 @opindex Wno-shift-count-overflow
5244 Warn if shift count >= width of type. This warning is enabled by default.
5246 @item -Wshift-negative-value
5247 @opindex Wshift-negative-value
5248 @opindex Wno-shift-negative-value
5249 Warn if left shifting a negative value. This warning is enabled by
5250 @option{-Wextra} in C99 and C++11 modes (and newer).
5252 @item -Wshift-overflow
5253 @itemx -Wshift-overflow=@var{n}
5254 @opindex Wshift-overflow
5255 @opindex Wno-shift-overflow
5256 Warn about left shift overflows. This warning is enabled by
5257 default in C99 and C++11 modes (and newer).
5260 @item -Wshift-overflow=1
5261 This is the warning level of @option{-Wshift-overflow} and is enabled
5262 by default in C99 and C++11 modes (and newer). This warning level does
5263 not warn about left-shifting 1 into the sign bit. (However, in C, such
5264 an overflow is still rejected in contexts where an integer constant expression
5265 is required.) No warning is emitted in C++2A mode (and newer), as signed left
5268 @item -Wshift-overflow=2
5269 This warning level also warns about left-shifting 1 into the sign bit,
5270 unless C++14 mode (or newer) is active.
5276 Warn whenever a @code{switch} statement has an index of enumerated type
5277 and lacks a @code{case} for one or more of the named codes of that
5278 enumeration. (The presence of a @code{default} label prevents this
5279 warning.) @code{case} labels outside the enumeration range also
5280 provoke warnings when this option is used (even if there is a
5281 @code{default} label).
5282 This warning is enabled by @option{-Wall}.
5284 @item -Wswitch-default
5285 @opindex Wswitch-default
5286 @opindex Wno-switch-default
5287 Warn whenever a @code{switch} statement does not have a @code{default}
5291 @opindex Wswitch-enum
5292 @opindex Wno-switch-enum
5293 Warn whenever a @code{switch} statement has an index of enumerated type
5294 and lacks a @code{case} for one or more of the named codes of that
5295 enumeration. @code{case} labels outside the enumeration range also
5296 provoke warnings when this option is used. The only difference
5297 between @option{-Wswitch} and this option is that this option gives a
5298 warning about an omitted enumeration code even if there is a
5299 @code{default} label.
5302 @opindex Wswitch-bool
5303 @opindex Wno-switch-bool
5304 Warn whenever a @code{switch} statement has an index of boolean type
5305 and the case values are outside the range of a boolean type.
5306 It is possible to suppress this warning by casting the controlling
5307 expression to a type other than @code{bool}. For example:
5310 switch ((int) (a == 4))
5316 This warning is enabled by default for C and C++ programs.
5318 @item -Wswitch-unreachable
5319 @opindex Wswitch-unreachable
5320 @opindex Wno-switch-unreachable
5321 Warn whenever a @code{switch} statement contains statements between the
5322 controlling expression and the first case label, which will never be
5323 executed. For example:
5335 @option{-Wswitch-unreachable} does not warn if the statement between the
5336 controlling expression and the first case label is just a declaration:
5349 This warning is enabled by default for C and C++ programs.
5351 @item -Wsync-nand @r{(C and C++ only)}
5353 @opindex Wno-sync-nand
5354 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5355 built-in functions are used. These functions changed semantics in GCC 4.4.
5357 @item -Wunused-but-set-parameter
5358 @opindex Wunused-but-set-parameter
5359 @opindex Wno-unused-but-set-parameter
5360 Warn whenever a function parameter is assigned to, but otherwise unused
5361 (aside from its declaration).
5363 To suppress this warning use the @code{unused} attribute
5364 (@pxref{Variable Attributes}).
5366 This warning is also enabled by @option{-Wunused} together with
5369 @item -Wunused-but-set-variable
5370 @opindex Wunused-but-set-variable
5371 @opindex Wno-unused-but-set-variable
5372 Warn whenever a local variable is assigned to, but otherwise unused
5373 (aside from its declaration).
5374 This warning is enabled by @option{-Wall}.
5376 To suppress this warning use the @code{unused} attribute
5377 (@pxref{Variable Attributes}).
5379 This warning is also enabled by @option{-Wunused}, which is enabled
5382 @item -Wunused-function
5383 @opindex Wunused-function
5384 @opindex Wno-unused-function
5385 Warn whenever a static function is declared but not defined or a
5386 non-inline static function is unused.
5387 This warning is enabled by @option{-Wall}.
5389 @item -Wunused-label
5390 @opindex Wunused-label
5391 @opindex Wno-unused-label
5392 Warn whenever a label is declared but not used.
5393 This warning is enabled by @option{-Wall}.
5395 To suppress this warning use the @code{unused} attribute
5396 (@pxref{Variable Attributes}).
5398 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5399 @opindex Wunused-local-typedefs
5400 @opindex Wno-unused-local-typedefs
5401 Warn when a typedef locally defined in a function is not used.
5402 This warning is enabled by @option{-Wall}.
5404 @item -Wunused-parameter
5405 @opindex Wunused-parameter
5406 @opindex Wno-unused-parameter
5407 Warn whenever a function parameter is unused aside from its declaration.
5409 To suppress this warning use the @code{unused} attribute
5410 (@pxref{Variable Attributes}).
5412 @item -Wno-unused-result
5413 @opindex Wunused-result
5414 @opindex Wno-unused-result
5415 Do not warn if a caller of a function marked with attribute
5416 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5417 its return value. The default is @option{-Wunused-result}.
5419 @item -Wunused-variable
5420 @opindex Wunused-variable
5421 @opindex Wno-unused-variable
5422 Warn whenever a local or static variable is unused aside from its
5423 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5424 but not for C++. This warning is enabled by @option{-Wall}.
5426 To suppress this warning use the @code{unused} attribute
5427 (@pxref{Variable Attributes}).
5429 @item -Wunused-const-variable
5430 @itemx -Wunused-const-variable=@var{n}
5431 @opindex Wunused-const-variable
5432 @opindex Wno-unused-const-variable
5433 Warn whenever a constant static variable is unused aside from its declaration.
5434 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5435 for C, but not for C++. In C this declares variable storage, but in C++ this
5436 is not an error since const variables take the place of @code{#define}s.
5438 To suppress this warning use the @code{unused} attribute
5439 (@pxref{Variable Attributes}).
5442 @item -Wunused-const-variable=1
5443 This is the warning level that is enabled by @option{-Wunused-variable} for
5444 C. It warns only about unused static const variables defined in the main
5445 compilation unit, but not about static const variables declared in any
5448 @item -Wunused-const-variable=2
5449 This warning level also warns for unused constant static variables in
5450 headers (excluding system headers). This is the warning level of
5451 @option{-Wunused-const-variable} and must be explicitly requested since
5452 in C++ this isn't an error and in C it might be harder to clean up all
5456 @item -Wunused-value
5457 @opindex Wunused-value
5458 @opindex Wno-unused-value
5459 Warn whenever a statement computes a result that is explicitly not
5460 used. To suppress this warning cast the unused expression to
5461 @code{void}. This includes an expression-statement or the left-hand
5462 side of a comma expression that contains no side effects. For example,
5463 an expression such as @code{x[i,j]} causes a warning, while
5464 @code{x[(void)i,j]} does not.
5466 This warning is enabled by @option{-Wall}.
5471 All the above @option{-Wunused} options combined.
5473 In order to get a warning about an unused function parameter, you must
5474 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5475 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5477 @item -Wuninitialized
5478 @opindex Wuninitialized
5479 @opindex Wno-uninitialized
5480 Warn if an automatic variable is used without first being initialized
5481 or if a variable may be clobbered by a @code{setjmp} call. In C++,
5482 warn if a non-static reference or non-static @code{const} member
5483 appears in a class without constructors.
5485 If you want to warn about code that uses the uninitialized value of the
5486 variable in its own initializer, use the @option{-Winit-self} option.
5488 These warnings occur for individual uninitialized or clobbered
5489 elements of structure, union or array variables as well as for
5490 variables that are uninitialized or clobbered as a whole. They do
5491 not occur for variables or elements declared @code{volatile}. Because
5492 these warnings depend on optimization, the exact variables or elements
5493 for which there are warnings depends on the precise optimization
5494 options and version of GCC used.
5496 Note that there may be no warning about a variable that is used only
5497 to compute a value that itself is never used, because such
5498 computations may be deleted by data flow analysis before the warnings
5501 @item -Winvalid-memory-model
5502 @opindex Winvalid-memory-model
5503 @opindex Wno-invalid-memory-model
5504 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5505 and the C11 atomic generic functions with a memory consistency argument
5506 that is either invalid for the operation or outside the range of values
5507 of the @code{memory_order} enumeration. For example, since the
5508 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5509 defined for the relaxed, release, and sequentially consistent memory
5510 orders the following code is diagnosed:
5515 __atomic_store_n (i, 0, memory_order_consume);
5519 @option{-Winvalid-memory-model} is enabled by default.
5521 @item -Wmaybe-uninitialized
5522 @opindex Wmaybe-uninitialized
5523 @opindex Wno-maybe-uninitialized
5524 For an automatic (i.e.@: local) variable, if there exists a path from the
5525 function entry to a use of the variable that is initialized, but there exist
5526 some other paths for which the variable is not initialized, the compiler
5527 emits a warning if it cannot prove the uninitialized paths are not
5528 executed at run time.
5530 These warnings are only possible in optimizing compilation, because otherwise
5531 GCC does not keep track of the state of variables.
5533 These warnings are made optional because GCC may not be able to determine when
5534 the code is correct in spite of appearing to have an error. Here is one
5535 example of how this can happen:
5555 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5556 always initialized, but GCC doesn't know this. To suppress the
5557 warning, you need to provide a default case with assert(0) or
5560 @cindex @code{longjmp} warnings
5561 This option also warns when a non-volatile automatic variable might be
5562 changed by a call to @code{longjmp}.
5563 The compiler sees only the calls to @code{setjmp}. It cannot know
5564 where @code{longjmp} will be called; in fact, a signal handler could
5565 call it at any point in the code. As a result, you may get a warning
5566 even when there is in fact no problem because @code{longjmp} cannot
5567 in fact be called at the place that would cause a problem.
5569 Some spurious warnings can be avoided if you declare all the functions
5570 you use that never return as @code{noreturn}. @xref{Function
5573 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5575 @item -Wunknown-pragmas
5576 @opindex Wunknown-pragmas
5577 @opindex Wno-unknown-pragmas
5578 @cindex warning for unknown pragmas
5579 @cindex unknown pragmas, warning
5580 @cindex pragmas, warning of unknown
5581 Warn when a @code{#pragma} directive is encountered that is not understood by
5582 GCC@. If this command-line option is used, warnings are even issued
5583 for unknown pragmas in system header files. This is not the case if
5584 the warnings are only enabled by the @option{-Wall} command-line option.
5587 @opindex Wno-pragmas
5589 Do not warn about misuses of pragmas, such as incorrect parameters,
5590 invalid syntax, or conflicts between pragmas. See also
5591 @option{-Wunknown-pragmas}.
5593 @item -Wno-prio-ctor-dtor
5594 @opindex Wno-prio-ctor-dtor
5595 @opindex Wprio-ctor-dtor
5596 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5597 The use of constructor and destructor attributes allow you to assign a
5598 priority to the constructor/destructor to control its order of execution
5599 before @code{main} is called or after it returns. The priority values must be
5600 greater than 100 as the compiler reserves priority values between 0--100 for
5603 @item -Wstrict-aliasing
5604 @opindex Wstrict-aliasing
5605 @opindex Wno-strict-aliasing
5606 This option is only active when @option{-fstrict-aliasing} is active.
5607 It warns about code that might break the strict aliasing rules that the
5608 compiler is using for optimization. The warning does not catch all
5609 cases, but does attempt to catch the more common pitfalls. It is
5610 included in @option{-Wall}.
5611 It is equivalent to @option{-Wstrict-aliasing=3}
5613 @item -Wstrict-aliasing=n
5614 @opindex Wstrict-aliasing=n
5615 This option is only active when @option{-fstrict-aliasing} is active.
5616 It warns about code that might break the strict aliasing rules that the
5617 compiler is using for optimization.
5618 Higher levels correspond to higher accuracy (fewer false positives).
5619 Higher levels also correspond to more effort, similar to the way @option{-O}
5621 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5623 Level 1: Most aggressive, quick, least accurate.
5624 Possibly useful when higher levels
5625 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5626 false negatives. However, it has many false positives.
5627 Warns for all pointer conversions between possibly incompatible types,
5628 even if never dereferenced. Runs in the front end only.
5630 Level 2: Aggressive, quick, not too precise.
5631 May still have many false positives (not as many as level 1 though),
5632 and few false negatives (but possibly more than level 1).
5633 Unlike level 1, it only warns when an address is taken. Warns about
5634 incomplete types. Runs in the front end only.
5636 Level 3 (default for @option{-Wstrict-aliasing}):
5637 Should have very few false positives and few false
5638 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5639 Takes care of the common pun+dereference pattern in the front end:
5640 @code{*(int*)&some_float}.
5641 If optimization is enabled, it also runs in the back end, where it deals
5642 with multiple statement cases using flow-sensitive points-to information.
5643 Only warns when the converted pointer is dereferenced.
5644 Does not warn about incomplete types.
5646 @item -Wstrict-overflow
5647 @itemx -Wstrict-overflow=@var{n}
5648 @opindex Wstrict-overflow
5649 @opindex Wno-strict-overflow
5650 This option is only active when signed overflow is undefined.
5651 It warns about cases where the compiler optimizes based on the
5652 assumption that signed overflow does not occur. Note that it does not
5653 warn about all cases where the code might overflow: it only warns
5654 about cases where the compiler implements some optimization. Thus
5655 this warning depends on the optimization level.
5657 An optimization that assumes that signed overflow does not occur is
5658 perfectly safe if the values of the variables involved are such that
5659 overflow never does, in fact, occur. Therefore this warning can
5660 easily give a false positive: a warning about code that is not
5661 actually a problem. To help focus on important issues, several
5662 warning levels are defined. No warnings are issued for the use of
5663 undefined signed overflow when estimating how many iterations a loop
5664 requires, in particular when determining whether a loop will be
5668 @item -Wstrict-overflow=1
5669 Warn about cases that are both questionable and easy to avoid. For
5670 example the compiler simplifies
5671 @code{x + 1 > x} to @code{1}. This level of
5672 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5673 are not, and must be explicitly requested.
5675 @item -Wstrict-overflow=2
5676 Also warn about other cases where a comparison is simplified to a
5677 constant. For example: @code{abs (x) >= 0}. This can only be
5678 simplified when signed integer overflow is undefined, because
5679 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5680 zero. @option{-Wstrict-overflow} (with no level) is the same as
5681 @option{-Wstrict-overflow=2}.
5683 @item -Wstrict-overflow=3
5684 Also warn about other cases where a comparison is simplified. For
5685 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5687 @item -Wstrict-overflow=4
5688 Also warn about other simplifications not covered by the above cases.
5689 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5691 @item -Wstrict-overflow=5
5692 Also warn about cases where the compiler reduces the magnitude of a
5693 constant involved in a comparison. For example: @code{x + 2 > y} is
5694 simplified to @code{x + 1 >= y}. This is reported only at the
5695 highest warning level because this simplification applies to many
5696 comparisons, so this warning level gives a very large number of
5700 @item -Wstringop-overflow
5701 @itemx -Wstringop-overflow=@var{type}
5702 @opindex Wstringop-overflow
5703 @opindex Wno-stringop-overflow
5704 Warn for calls to string manipulation functions such as @code{memcpy} and
5705 @code{strcpy} that are determined to overflow the destination buffer. The
5706 optional argument is one greater than the type of Object Size Checking to
5707 perform to determine the size of the destination. @xref{Object Size Checking}.
5708 The argument is meaningful only for functions that operate on character arrays
5709 but not for raw memory functions like @code{memcpy} which always make use
5710 of Object Size type-0. The option also warns for calls that specify a size
5711 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5712 The option produces the best results with optimization enabled but can detect
5713 a small subset of simple buffer overflows even without optimization in
5714 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5715 correspond to the standard functions. In any case, the option warns about
5716 just a subset of buffer overflows detected by the corresponding overflow
5717 checking built-ins. For example, the option will issue a warning for
5718 the @code{strcpy} call below because it copies at least 5 characters
5719 (the string @code{"blue"} including the terminating NUL) into the buffer
5723 enum Color @{ blue, purple, yellow @};
5724 const char* f (enum Color clr)
5726 static char buf [4];
5730 case blue: str = "blue"; break;
5731 case purple: str = "purple"; break;
5732 case yellow: str = "yellow"; break;
5735 return strcpy (buf, str); // warning here
5739 Option @option{-Wstringop-overflow=2} is enabled by default.
5742 @item -Wstringop-overflow
5743 @itemx -Wstringop-overflow=1
5744 @opindex Wstringop-overflow
5745 @opindex Wno-stringop-overflow
5746 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5747 to determine the sizes of destination objects. This is the default setting
5748 of the option. At this setting the option will not warn for writes past
5749 the end of subobjects of larger objects accessed by pointers unless the
5750 size of the largest surrounding object is known. When the destination may
5751 be one of several objects it is assumed to be the largest one of them. On
5752 Linux systems, when optimization is enabled at this setting the option warns
5753 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5756 @item -Wstringop-overflow=2
5757 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5758 to determine the sizes of destination objects. At this setting the option
5759 will warn about overflows when writing to members of the largest complete
5760 objects whose exact size is known. It will, however, not warn for excessive
5761 writes to the same members of unknown objects referenced by pointers since
5762 they may point to arrays containing unknown numbers of elements.
5764 @item -Wstringop-overflow=3
5765 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5766 to determine the sizes of destination objects. At this setting the option
5767 warns about overflowing the smallest object or data member. This is the
5768 most restrictive setting of the option that may result in warnings for safe
5771 @item -Wstringop-overflow=4
5772 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5773 to determine the sizes of destination objects. At this setting the option
5774 will warn about overflowing any data members, and when the destination is
5775 one of several objects it uses the size of the largest of them to decide
5776 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5777 setting of the option may result in warnings for benign code.
5780 @item -Wstringop-truncation
5781 @opindex Wstringop-truncation
5782 @opindex Wno-stringop-truncation
5783 Warn for calls to bounded string manipulation functions such as @code{strncat},
5784 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5785 or leave the destination unchanged.
5787 In the following example, the call to @code{strncat} specifies a bound that
5788 is less than the length of the source string. As a result, the copy of
5789 the source will be truncated and so the call is diagnosed. To avoid the
5790 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5793 void append (char *buf, size_t bufsize)
5795 strncat (buf, ".txt", 3);
5799 As another example, the following call to @code{strncpy} results in copying
5800 to @code{d} just the characters preceding the terminating NUL, without
5801 appending the NUL to the end. Assuming the result of @code{strncpy} is
5802 necessarily a NUL-terminated string is a common mistake, and so the call
5803 is diagnosed. To avoid the warning when the result is not expected to be
5804 NUL-terminated, call @code{memcpy} instead.
5807 void copy (char *d, const char *s)
5809 strncpy (d, s, strlen (s));
5813 In the following example, the call to @code{strncpy} specifies the size
5814 of the destination buffer as the bound. If the length of the source
5815 string is equal to or greater than this size the result of the copy will
5816 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5817 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5818 element of the buffer to @code{NUL}.
5821 void copy (const char *s)
5824 strncpy (buf, s, sizeof buf);
5829 In situations where a character array is intended to store a sequence
5830 of bytes with no terminating @code{NUL} such an array may be annotated
5831 with attribute @code{nonstring} to avoid this warning. Such arrays,
5832 however, are not suitable arguments to functions that expect
5833 @code{NUL}-terminated strings. To help detect accidental misuses of
5834 such arrays GCC issues warnings unless it can prove that the use is
5835 safe. @xref{Common Variable Attributes}.
5837 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5838 @opindex Wsuggest-attribute=
5839 @opindex Wno-suggest-attribute=
5840 Warn for cases where adding an attribute may be beneficial. The
5841 attributes currently supported are listed below.
5844 @item -Wsuggest-attribute=pure
5845 @itemx -Wsuggest-attribute=const
5846 @itemx -Wsuggest-attribute=noreturn
5847 @itemx -Wsuggest-attribute=malloc
5848 @opindex Wsuggest-attribute=pure
5849 @opindex Wno-suggest-attribute=pure
5850 @opindex Wsuggest-attribute=const
5851 @opindex Wno-suggest-attribute=const
5852 @opindex Wsuggest-attribute=noreturn
5853 @opindex Wno-suggest-attribute=noreturn
5854 @opindex Wsuggest-attribute=malloc
5855 @opindex Wno-suggest-attribute=malloc
5857 Warn about functions that might be candidates for attributes
5858 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5859 only warns for functions visible in other compilation units or (in the case of
5860 @code{pure} and @code{const}) if it cannot prove that the function returns
5861 normally. A function returns normally if it doesn't contain an infinite loop or
5862 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5863 requires option @option{-fipa-pure-const}, which is enabled by default at
5864 @option{-O} and higher. Higher optimization levels improve the accuracy
5867 @item -Wsuggest-attribute=format
5868 @itemx -Wmissing-format-attribute
5869 @opindex Wsuggest-attribute=format
5870 @opindex Wmissing-format-attribute
5871 @opindex Wno-suggest-attribute=format
5872 @opindex Wno-missing-format-attribute
5876 Warn about function pointers that might be candidates for @code{format}
5877 attributes. Note these are only possible candidates, not absolute ones.
5878 GCC guesses that function pointers with @code{format} attributes that
5879 are used in assignment, initialization, parameter passing or return
5880 statements should have a corresponding @code{format} attribute in the
5881 resulting type. I.e.@: the left-hand side of the assignment or
5882 initialization, the type of the parameter variable, or the return type
5883 of the containing function respectively should also have a @code{format}
5884 attribute to avoid the warning.
5886 GCC also warns about function definitions that might be
5887 candidates for @code{format} attributes. Again, these are only
5888 possible candidates. GCC guesses that @code{format} attributes
5889 might be appropriate for any function that calls a function like
5890 @code{vprintf} or @code{vscanf}, but this might not always be the
5891 case, and some functions for which @code{format} attributes are
5892 appropriate may not be detected.
5894 @item -Wsuggest-attribute=cold
5895 @opindex Wsuggest-attribute=cold
5896 @opindex Wno-suggest-attribute=cold
5898 Warn about functions that might be candidates for @code{cold} attribute. This
5899 is based on static detection and generally will only warn about functions which
5900 always leads to a call to another @code{cold} function such as wrappers of
5901 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
5904 @item -Wsuggest-final-types
5905 @opindex Wno-suggest-final-types
5906 @opindex Wsuggest-final-types
5907 Warn about types with virtual methods where code quality would be improved
5908 if the type were declared with the C++11 @code{final} specifier,
5910 declared in an anonymous namespace. This allows GCC to more aggressively
5911 devirtualize the polymorphic calls. This warning is more effective with link
5912 time optimization, where the information about the class hierarchy graph is
5915 @item -Wsuggest-final-methods
5916 @opindex Wno-suggest-final-methods
5917 @opindex Wsuggest-final-methods
5918 Warn about virtual methods where code quality would be improved if the method
5919 were declared with the C++11 @code{final} specifier,
5920 or, if possible, its type were
5921 declared in an anonymous namespace or with the @code{final} specifier.
5923 more effective with link-time optimization, where the information about the
5924 class hierarchy graph is more complete. It is recommended to first consider
5925 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
5928 @item -Wsuggest-override
5929 Warn about overriding virtual functions that are not marked with the override
5933 @opindex Wno-alloc-zero
5934 @opindex Walloc-zero
5935 Warn about calls to allocation functions decorated with attribute
5936 @code{alloc_size} that specify zero bytes, including those to the built-in
5937 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
5938 @code{malloc}, and @code{realloc}. Because the behavior of these functions
5939 when called with a zero size differs among implementations (and in the case
5940 of @code{realloc} has been deprecated) relying on it may result in subtle
5941 portability bugs and should be avoided.
5943 @item -Walloc-size-larger-than=@var{byte-size}
5944 @opindex Walloc-size-larger-than=
5945 @opindex Wno-alloc-size-larger-than
5946 Warn about calls to functions decorated with attribute @code{alloc_size}
5947 that attempt to allocate objects larger than the specified number of bytes,
5948 or where the result of the size computation in an integer type with infinite
5949 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
5950 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
5951 Warnings controlled by the option can be disabled either by specifying
5952 @var{byte-size} of @samp{SIZE_MAX} or more or by
5953 @option{-Wno-alloc-size-larger-than}.
5954 @xref{Function Attributes}.
5956 @item -Wno-alloc-size-larger-than
5957 @opindex Wno-alloc-size-larger-than
5958 Disable @option{-Walloc-size-larger-than=} warnings. The option is
5959 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
5965 This option warns on all uses of @code{alloca} in the source.
5967 @item -Walloca-larger-than=@var{byte-size}
5968 @opindex Walloca-larger-than=
5969 @opindex Wno-alloca-larger-than
5970 This option warns on calls to @code{alloca} with an integer argument whose
5971 value is either zero, or that is not bounded by a controlling predicate
5972 that limits its value to at most @var{byte-size}. It also warns for calls
5973 to @code{alloca} where the bound value is unknown. Arguments of non-integer
5974 types are considered unbounded even if they appear to be constrained to
5977 For example, a bounded case of @code{alloca} could be:
5980 void func (size_t n)
5991 In the above example, passing @code{-Walloca-larger-than=1000} would not
5992 issue a warning because the call to @code{alloca} is known to be at most
5993 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
5994 the compiler would emit a warning.
5996 Unbounded uses, on the other hand, are uses of @code{alloca} with no
5997 controlling predicate constraining its integer argument. For example:
6002 void *p = alloca (n);
6007 If @code{-Walloca-larger-than=500} were passed, the above would trigger
6008 a warning, but this time because of the lack of bounds checking.
6010 Note, that even seemingly correct code involving signed integers could
6014 void func (signed int n)
6024 In the above example, @var{n} could be negative, causing a larger than
6025 expected argument to be implicitly cast into the @code{alloca} call.
6027 This option also warns when @code{alloca} is used in a loop.
6029 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6030 but is usually only effective when @option{-ftree-vrp} is active (default
6031 for @option{-O2} and above).
6033 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6035 @item -Wno-alloca-larger-than
6036 @opindex Wno-alloca-larger-than
6037 Disable @option{-Walloca-larger-than=} warnings. The option is
6038 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6040 @item -Warray-bounds
6041 @itemx -Warray-bounds=@var{n}
6042 @opindex Wno-array-bounds
6043 @opindex Warray-bounds
6044 This option is only active when @option{-ftree-vrp} is active
6045 (default for @option{-O2} and above). It warns about subscripts to arrays
6046 that are always out of bounds. This warning is enabled by @option{-Wall}.
6049 @item -Warray-bounds=1
6050 This is the warning level of @option{-Warray-bounds} and is enabled
6051 by @option{-Wall}; higher levels are not, and must be explicitly requested.
6053 @item -Warray-bounds=2
6054 This warning level also warns about out of bounds access for
6055 arrays at the end of a struct and for arrays accessed through
6056 pointers. This warning level may give a larger number of
6057 false positives and is deactivated by default.
6060 @item -Wattribute-alias=@var{n}
6061 @itemx -Wno-attribute-alias
6062 @opindex -Wattribute-alias
6063 @opindex -Wno-attribute-alias
6064 Warn about declarations using the @code{alias} and similar attributes whose
6065 target is incompatible with the type of the alias.
6066 @xref{Function Attributes,,Declaring Attributes of Functions}.
6067 The @option{-Wattribute-alias=1} is enabled by @option{-Wall}.
6070 @item -Wattribute-alias=1
6071 The default warning level of the @option{-Wattribute-alias} option diagnoses
6072 incompatibilities between the type of the alias declaration and that of its
6073 target. Such incompatibilities are typically indicative of bugs.
6075 @item -Wattribute-alias=2
6076 At this level @option{-Wattribute-alias} also diagnoses mismatches between
6077 the set of attributes of the alias declaration and the attributes applied
6078 to its target. Although in some cases such mismatches may indicate bugs,
6079 in other cases they may be benign and could be resolved simply by adding
6080 the missing attribute to the target.
6083 @item -Wbool-compare
6084 @opindex Wno-bool-compare
6085 @opindex Wbool-compare
6086 Warn about boolean expression compared with an integer value different from
6087 @code{true}/@code{false}. For instance, the following comparison is
6092 if ((n > 1) == 2) @{ @dots{} @}
6094 This warning is enabled by @option{-Wall}.
6096 @item -Wbool-operation
6097 @opindex Wno-bool-operation
6098 @opindex Wbool-operation
6099 Warn about suspicious operations on expressions of a boolean type. For
6100 instance, bitwise negation of a boolean is very likely a bug in the program.
6101 For C, this warning also warns about incrementing or decrementing a boolean,
6102 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
6103 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6105 This warning is enabled by @option{-Wall}.
6107 @item -Wduplicated-branches
6108 @opindex Wno-duplicated-branches
6109 @opindex Wduplicated-branches
6110 Warn when an if-else has identical branches. This warning detects cases like
6117 It doesn't warn when both branches contain just a null statement. This warning
6118 also warn for conditional operators:
6120 int i = x ? *p : *p;
6123 @item -Wduplicated-cond
6124 @opindex Wno-duplicated-cond
6125 @opindex Wduplicated-cond
6126 Warn about duplicated conditions in an if-else-if chain. For instance,
6127 warn for the following code:
6129 if (p->q != NULL) @{ @dots{} @}
6130 else if (p->q != NULL) @{ @dots{} @}
6133 @item -Wframe-address
6134 @opindex Wno-frame-address
6135 @opindex Wframe-address
6136 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6137 is called with an argument greater than 0. Such calls may return indeterminate
6138 values or crash the program. The warning is included in @option{-Wall}.
6140 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6141 @opindex Wno-discarded-qualifiers
6142 @opindex Wdiscarded-qualifiers
6143 Do not warn if type qualifiers on pointers are being discarded.
6144 Typically, the compiler warns if a @code{const char *} variable is
6145 passed to a function that takes a @code{char *} parameter. This option
6146 can be used to suppress such a warning.
6148 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6149 @opindex Wno-discarded-array-qualifiers
6150 @opindex Wdiscarded-array-qualifiers
6151 Do not warn if type qualifiers on arrays which are pointer targets
6152 are being discarded. Typically, the compiler warns if a
6153 @code{const int (*)[]} variable is passed to a function that
6154 takes a @code{int (*)[]} parameter. This option can be used to
6155 suppress such a warning.
6157 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6158 @opindex Wno-incompatible-pointer-types
6159 @opindex Wincompatible-pointer-types
6160 Do not warn when there is a conversion between pointers that have incompatible
6161 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
6162 which warns for pointer argument passing or assignment with different
6165 @item -Wno-int-conversion @r{(C and Objective-C only)}
6166 @opindex Wno-int-conversion
6167 @opindex Wint-conversion
6168 Do not warn about incompatible integer to pointer and pointer to integer
6169 conversions. This warning is about implicit conversions; for explicit
6170 conversions the warnings @option{-Wno-int-to-pointer-cast} and
6171 @option{-Wno-pointer-to-int-cast} may be used.
6173 @item -Wno-div-by-zero
6174 @opindex Wno-div-by-zero
6175 @opindex Wdiv-by-zero
6176 Do not warn about compile-time integer division by zero. Floating-point
6177 division by zero is not warned about, as it can be a legitimate way of
6178 obtaining infinities and NaNs.
6180 @item -Wsystem-headers
6181 @opindex Wsystem-headers
6182 @opindex Wno-system-headers
6183 @cindex warnings from system headers
6184 @cindex system headers, warnings from
6185 Print warning messages for constructs found in system header files.
6186 Warnings from system headers are normally suppressed, on the assumption
6187 that they usually do not indicate real problems and would only make the
6188 compiler output harder to read. Using this command-line option tells
6189 GCC to emit warnings from system headers as if they occurred in user
6190 code. However, note that using @option{-Wall} in conjunction with this
6191 option does @emph{not} warn about unknown pragmas in system
6192 headers---for that, @option{-Wunknown-pragmas} must also be used.
6194 @item -Wtautological-compare
6195 @opindex Wtautological-compare
6196 @opindex Wno-tautological-compare
6197 Warn if a self-comparison always evaluates to true or false. This
6198 warning detects various mistakes such as:
6202 if (i > i) @{ @dots{} @}
6205 This warning also warns about bitwise comparisons that always evaluate
6206 to true or false, for instance:
6208 if ((a & 16) == 10) @{ @dots{} @}
6210 will always be false.
6212 This warning is enabled by @option{-Wall}.
6215 @opindex Wtrampolines
6216 @opindex Wno-trampolines
6217 Warn about trampolines generated for pointers to nested functions.
6218 A trampoline is a small piece of data or code that is created at run
6219 time on the stack when the address of a nested function is taken, and is
6220 used to call the nested function indirectly. For some targets, it is
6221 made up of data only and thus requires no special treatment. But, for
6222 most targets, it is made up of code and thus requires the stack to be
6223 made executable in order for the program to work properly.
6226 @opindex Wfloat-equal
6227 @opindex Wno-float-equal
6228 Warn if floating-point values are used in equality comparisons.
6230 The idea behind this is that sometimes it is convenient (for the
6231 programmer) to consider floating-point values as approximations to
6232 infinitely precise real numbers. If you are doing this, then you need
6233 to compute (by analyzing the code, or in some other way) the maximum or
6234 likely maximum error that the computation introduces, and allow for it
6235 when performing comparisons (and when producing output, but that's a
6236 different problem). In particular, instead of testing for equality, you
6237 should check to see whether the two values have ranges that overlap; and
6238 this is done with the relational operators, so equality comparisons are
6241 @item -Wtraditional @r{(C and Objective-C only)}
6242 @opindex Wtraditional
6243 @opindex Wno-traditional
6244 Warn about certain constructs that behave differently in traditional and
6245 ISO C@. Also warn about ISO C constructs that have no traditional C
6246 equivalent, and/or problematic constructs that should be avoided.
6250 Macro parameters that appear within string literals in the macro body.
6251 In traditional C macro replacement takes place within string literals,
6252 but in ISO C it does not.
6255 In traditional C, some preprocessor directives did not exist.
6256 Traditional preprocessors only considered a line to be a directive
6257 if the @samp{#} appeared in column 1 on the line. Therefore
6258 @option{-Wtraditional} warns about directives that traditional C
6259 understands but ignores because the @samp{#} does not appear as the
6260 first character on the line. It also suggests you hide directives like
6261 @code{#pragma} not understood by traditional C by indenting them. Some
6262 traditional implementations do not recognize @code{#elif}, so this option
6263 suggests avoiding it altogether.
6266 A function-like macro that appears without arguments.
6269 The unary plus operator.
6272 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6273 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6274 constants.) Note, these suffixes appear in macros defined in the system
6275 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6276 Use of these macros in user code might normally lead to spurious
6277 warnings, however GCC's integrated preprocessor has enough context to
6278 avoid warning in these cases.
6281 A function declared external in one block and then used after the end of
6285 A @code{switch} statement has an operand of type @code{long}.
6288 A non-@code{static} function declaration follows a @code{static} one.
6289 This construct is not accepted by some traditional C compilers.
6292 The ISO type of an integer constant has a different width or
6293 signedness from its traditional type. This warning is only issued if
6294 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6295 typically represent bit patterns, are not warned about.
6298 Usage of ISO string concatenation is detected.
6301 Initialization of automatic aggregates.
6304 Identifier conflicts with labels. Traditional C lacks a separate
6305 namespace for labels.
6308 Initialization of unions. If the initializer is zero, the warning is
6309 omitted. This is done under the assumption that the zero initializer in
6310 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6311 initializer warnings and relies on default initialization to zero in the
6315 Conversions by prototypes between fixed/floating-point values and vice
6316 versa. The absence of these prototypes when compiling with traditional
6317 C causes serious problems. This is a subset of the possible
6318 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6321 Use of ISO C style function definitions. This warning intentionally is
6322 @emph{not} issued for prototype declarations or variadic functions
6323 because these ISO C features appear in your code when using
6324 libiberty's traditional C compatibility macros, @code{PARAMS} and
6325 @code{VPARAMS}. This warning is also bypassed for nested functions
6326 because that feature is already a GCC extension and thus not relevant to
6327 traditional C compatibility.
6330 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6331 @opindex Wtraditional-conversion
6332 @opindex Wno-traditional-conversion
6333 Warn if a prototype causes a type conversion that is different from what
6334 would happen to the same argument in the absence of a prototype. This
6335 includes conversions of fixed point to floating and vice versa, and
6336 conversions changing the width or signedness of a fixed-point argument
6337 except when the same as the default promotion.
6339 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6340 @opindex Wdeclaration-after-statement
6341 @opindex Wno-declaration-after-statement
6342 Warn when a declaration is found after a statement in a block. This
6343 construct, known from C++, was introduced with ISO C99 and is by default
6344 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
6349 Warn whenever a local variable or type declaration shadows another
6350 variable, parameter, type, class member (in C++), or instance variable
6351 (in Objective-C) or whenever a built-in function is shadowed. Note
6352 that in C++, the compiler warns if a local variable shadows an
6353 explicit typedef, but not if it shadows a struct/class/enum.
6354 Same as @option{-Wshadow=global}.
6356 @item -Wno-shadow-ivar @r{(Objective-C only)}
6357 @opindex Wno-shadow-ivar
6358 @opindex Wshadow-ivar
6359 Do not warn whenever a local variable shadows an instance variable in an
6362 @item -Wshadow=global
6363 @opindex Wshadow=local
6364 The default for @option{-Wshadow}. Warns for any (global) shadowing.
6366 @item -Wshadow=local
6367 @opindex Wshadow=local
6368 Warn when a local variable shadows another local variable or parameter.
6369 This warning is enabled by @option{-Wshadow=global}.
6371 @item -Wshadow=compatible-local
6372 @opindex Wshadow=compatible-local
6373 Warn when a local variable shadows another local variable or parameter
6374 whose type is compatible with that of the shadowing variable. In C++,
6375 type compatibility here means the type of the shadowing variable can be
6376 converted to that of the shadowed variable. The creation of this flag
6377 (in addition to @option{-Wshadow=local}) is based on the idea that when
6378 a local variable shadows another one of incompatible type, it is most
6379 likely intentional, not a bug or typo, as shown in the following example:
6383 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6385 for (int i = 0; i < N; ++i)
6394 Since the two variable @code{i} in the example above have incompatible types,
6395 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
6396 Because their types are incompatible, if a programmer accidentally uses one
6397 in place of the other, type checking will catch that and emit an error or
6398 warning. So not warning (about shadowing) in this case will not lead to
6399 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
6400 possibly reduce the number of warnings triggered by intentional shadowing.
6402 This warning is enabled by @option{-Wshadow=local}.
6404 @item -Wlarger-than=@var{byte-size}
6405 @opindex Wlarger-than=
6406 @opindex Wlarger-than-@var{byte-size}
6407 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6408 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6409 Warnings controlled by the option can be disabled either by specifying
6410 @var{byte-size} of @samp{SIZE_MAX} or more or by
6411 @option{-Wno-larger-than}.
6413 @item -Wno-larger-than
6414 @opindex Wno-larger-than
6415 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6416 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6418 @item -Wframe-larger-than=@var{byte-size}
6419 @opindex Wframe-larger-than=
6420 @opindex Wno-frame-larger-than
6421 Warn if the size of a function frame exceeds @var{byte-size}.
6422 The computation done to determine the stack frame size is approximate
6423 and not conservative.
6424 The actual requirements may be somewhat greater than @var{byte-size}
6425 even if you do not get a warning. In addition, any space allocated
6426 via @code{alloca}, variable-length arrays, or related constructs
6427 is not included by the compiler when determining
6428 whether or not to issue a warning.
6429 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6430 Warnings controlled by the option can be disabled either by specifying
6431 @var{byte-size} of @samp{SIZE_MAX} or more or by
6432 @option{-Wno-frame-larger-than}.
6434 @item -Wno-frame-larger-than
6435 @opindex Wno-frame-larger-than
6436 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6437 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6439 @item -Wno-free-nonheap-object
6440 @opindex Wno-free-nonheap-object
6441 @opindex Wfree-nonheap-object
6442 Do not warn when attempting to free an object that was not allocated
6445 @item -Wstack-usage=@var{byte-size}
6446 @opindex Wstack-usage
6447 @opindex Wno-stack-usage
6448 Warn if the stack usage of a function might exceed @var{byte-size}.
6449 The computation done to determine the stack usage is conservative.
6450 Any space allocated via @code{alloca}, variable-length arrays, or related
6451 constructs is included by the compiler when determining whether or not to
6454 The message is in keeping with the output of @option{-fstack-usage}.
6458 If the stack usage is fully static but exceeds the specified amount, it's:
6461 warning: stack usage is 1120 bytes
6464 If the stack usage is (partly) dynamic but bounded, it's:
6467 warning: stack usage might be 1648 bytes
6470 If the stack usage is (partly) dynamic and not bounded, it's:
6473 warning: stack usage might be unbounded
6477 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6478 Warnings controlled by the option can be disabled either by specifying
6479 @var{byte-size} of @samp{SIZE_MAX} or more or by
6480 @option{-Wno-stack-usage}.
6482 @item -Wno-stack-usage
6483 @opindex Wno-stack-usage
6484 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6485 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6487 @item -Wunsafe-loop-optimizations
6488 @opindex Wunsafe-loop-optimizations
6489 @opindex Wno-unsafe-loop-optimizations
6490 Warn if the loop cannot be optimized because the compiler cannot
6491 assume anything on the bounds of the loop indices. With
6492 @option{-funsafe-loop-optimizations} warn if the compiler makes
6495 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6496 @opindex Wno-pedantic-ms-format
6497 @opindex Wpedantic-ms-format
6498 When used in combination with @option{-Wformat}
6499 and @option{-pedantic} without GNU extensions, this option
6500 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6501 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6502 which depend on the MS runtime.
6505 @opindex Waligned-new
6506 @opindex Wno-aligned-new
6507 Warn about a new-expression of a type that requires greater alignment
6508 than the @code{alignof(std::max_align_t)} but uses an allocation
6509 function without an explicit alignment parameter. This option is
6510 enabled by @option{-Wall}.
6512 Normally this only warns about global allocation functions, but
6513 @option{-Waligned-new=all} also warns about class member allocation
6516 @item -Wplacement-new
6517 @itemx -Wplacement-new=@var{n}
6518 @opindex Wplacement-new
6519 @opindex Wno-placement-new
6520 Warn about placement new expressions with undefined behavior, such as
6521 constructing an object in a buffer that is smaller than the type of
6522 the object. For example, the placement new expression below is diagnosed
6523 because it attempts to construct an array of 64 integers in a buffer only
6529 This warning is enabled by default.
6532 @item -Wplacement-new=1
6533 This is the default warning level of @option{-Wplacement-new}. At this
6534 level the warning is not issued for some strictly undefined constructs that
6535 GCC allows as extensions for compatibility with legacy code. For example,
6536 the following @code{new} expression is not diagnosed at this level even
6537 though it has undefined behavior according to the C++ standard because
6538 it writes past the end of the one-element array.
6540 struct S @{ int n, a[1]; @};
6541 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6542 new (s->a)int [32]();
6545 @item -Wplacement-new=2
6546 At this level, in addition to diagnosing all the same constructs as at level
6547 1, a diagnostic is also issued for placement new expressions that construct
6548 an object in the last member of structure whose type is an array of a single
6549 element and whose size is less than the size of the object being constructed.
6550 While the previous example would be diagnosed, the following construct makes
6551 use of the flexible member array extension to avoid the warning at level 2.
6553 struct S @{ int n, a[]; @};
6554 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6555 new (s->a)int [32]();
6560 @item -Wpointer-arith
6561 @opindex Wpointer-arith
6562 @opindex Wno-pointer-arith
6563 Warn about anything that depends on the ``size of'' a function type or
6564 of @code{void}. GNU C assigns these types a size of 1, for
6565 convenience in calculations with @code{void *} pointers and pointers
6566 to functions. In C++, warn also when an arithmetic operation involves
6567 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6569 @item -Wpointer-compare
6570 @opindex Wpointer-compare
6571 @opindex Wno-pointer-compare
6572 Warn if a pointer is compared with a zero character constant. This usually
6573 means that the pointer was meant to be dereferenced. For example:
6576 const char *p = foo ();
6581 Note that the code above is invalid in C++11.
6583 This warning is enabled by default.
6586 @opindex Wtype-limits
6587 @opindex Wno-type-limits
6588 Warn if a comparison is always true or always false due to the limited
6589 range of the data type, but do not warn for constant expressions. For
6590 example, warn if an unsigned variable is compared against zero with
6591 @code{<} or @code{>=}. This warning is also enabled by
6594 @item -Wabsolute-value @r{(C and Objective-C only)}
6595 @opindex Wabsolute-value
6596 @opindex Wno-absolute-value
6597 Warn when a wrong absolute value function seems to be used or when it
6598 does not have any effect because its argument is an unsigned type.
6599 This warning be suppressed with an explicit type cast and it is also
6600 enabled by @option{-Wextra}.
6602 @include cppwarnopts.texi
6604 @item -Wbad-function-cast @r{(C and Objective-C only)}
6605 @opindex Wbad-function-cast
6606 @opindex Wno-bad-function-cast
6607 Warn when a function call is cast to a non-matching type.
6608 For example, warn if a call to a function returning an integer type
6609 is cast to a pointer type.
6611 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6612 @opindex Wc90-c99-compat
6613 @opindex Wno-c90-c99-compat
6614 Warn about features not present in ISO C90, but present in ISO C99.
6615 For instance, warn about use of variable length arrays, @code{long long}
6616 type, @code{bool} type, compound literals, designated initializers, and so
6617 on. This option is independent of the standards mode. Warnings are disabled
6618 in the expression that follows @code{__extension__}.
6620 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6621 @opindex Wc99-c11-compat
6622 @opindex Wno-c99-c11-compat
6623 Warn about features not present in ISO C99, but present in ISO C11.
6624 For instance, warn about use of anonymous structures and unions,
6625 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6626 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6627 and so on. This option is independent of the standards mode. Warnings are
6628 disabled in the expression that follows @code{__extension__}.
6630 @item -Wc++-compat @r{(C and Objective-C only)}
6631 @opindex Wc++-compat
6632 @opindex Wno-c++-compat
6633 Warn about ISO C constructs that are outside of the common subset of
6634 ISO C and ISO C++, e.g.@: request for implicit conversion from
6635 @code{void *} to a pointer to non-@code{void} type.
6637 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6638 @opindex Wc++11-compat
6639 @opindex Wno-c++11-compat
6640 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6641 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6642 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6643 enabled by @option{-Wall}.
6645 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6646 @opindex Wc++14-compat
6647 @opindex Wno-c++14-compat
6648 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6649 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6651 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6652 @opindex Wc++17-compat
6653 @opindex Wno-c++17-compat
6654 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6655 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6659 @opindex Wno-cast-qual
6660 Warn whenever a pointer is cast so as to remove a type qualifier from
6661 the target type. For example, warn if a @code{const char *} is cast
6662 to an ordinary @code{char *}.
6664 Also warn when making a cast that introduces a type qualifier in an
6665 unsafe way. For example, casting @code{char **} to @code{const char **}
6666 is unsafe, as in this example:
6669 /* p is char ** value. */
6670 const char **q = (const char **) p;
6671 /* Assignment of readonly string to const char * is OK. */
6673 /* Now char** pointer points to read-only memory. */
6678 @opindex Wcast-align
6679 @opindex Wno-cast-align
6680 Warn whenever a pointer is cast such that the required alignment of the
6681 target is increased. For example, warn if a @code{char *} is cast to
6682 an @code{int *} on machines where integers can only be accessed at
6683 two- or four-byte boundaries.
6685 @item -Wcast-align=strict
6686 @opindex Wcast-align=strict
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 *} regardless of the target machine.
6691 @item -Wcast-function-type
6692 @opindex Wcast-function-type
6693 @opindex Wno-cast-function-type
6694 Warn when a function pointer is cast to an incompatible function pointer.
6695 In a cast involving function types with a variable argument list only
6696 the types of initial arguments that are provided are considered.
6697 Any parameter of pointer-type matches any other pointer-type. Any benign
6698 differences in integral types are ignored, like @code{int} vs.@: @code{long}
6699 on ILP32 targets. Likewise type qualifiers are ignored. The function
6700 type @code{void (*) (void)} is special and matches everything, which can
6701 be used to suppress this warning.
6702 In a cast involving pointer to member types this warning warns whenever
6703 the type cast is changing the pointer to member type.
6704 This warning is enabled by @option{-Wextra}.
6706 @item -Wwrite-strings
6707 @opindex Wwrite-strings
6708 @opindex Wno-write-strings
6709 When compiling C, give string constants the type @code{const
6710 char[@var{length}]} so that copying the address of one into a
6711 non-@code{const} @code{char *} pointer produces a warning. These
6712 warnings help you find at compile time code that can try to write
6713 into a string constant, but only if you have been very careful about
6714 using @code{const} in declarations and prototypes. Otherwise, it is
6715 just a nuisance. This is why we did not make @option{-Wall} request
6718 When compiling C++, warn about the deprecated conversion from string
6719 literals to @code{char *}. This warning is enabled by default for C++
6723 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6724 @opindex Wcatch-value
6725 @opindex Wno-catch-value
6726 Warn about catch handlers that do not catch via reference.
6727 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6728 warn about polymorphic class types that are caught by value.
6729 With @option{-Wcatch-value=2} warn about all class types that are caught
6730 by value. With @option{-Wcatch-value=3} warn about all types that are
6731 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6735 @opindex Wno-clobbered
6736 Warn for variables that might be changed by @code{longjmp} or
6737 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6739 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6740 @opindex Wconditionally-supported
6741 @opindex Wno-conditionally-supported
6742 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6745 @opindex Wconversion
6746 @opindex Wno-conversion
6747 Warn for implicit conversions that may alter a value. This includes
6748 conversions between real and integer, like @code{abs (x)} when
6749 @code{x} is @code{double}; conversions between signed and unsigned,
6750 like @code{unsigned ui = -1}; and conversions to smaller types, like
6751 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6752 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6753 changed by the conversion like in @code{abs (2.0)}. Warnings about
6754 conversions between signed and unsigned integers can be disabled by
6755 using @option{-Wno-sign-conversion}.
6757 For C++, also warn for confusing overload resolution for user-defined
6758 conversions; and conversions that never use a type conversion
6759 operator: conversions to @code{void}, the same type, a base class or a
6760 reference to them. Warnings about conversions between signed and
6761 unsigned integers are disabled by default in C++ unless
6762 @option{-Wsign-conversion} is explicitly enabled.
6764 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6765 @opindex Wconversion-null
6766 @opindex Wno-conversion-null
6767 Do not warn for conversions between @code{NULL} and non-pointer
6768 types. @option{-Wconversion-null} is enabled by default.
6770 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6771 @opindex Wzero-as-null-pointer-constant
6772 @opindex Wno-zero-as-null-pointer-constant
6773 Warn when a literal @samp{0} is used as null pointer constant. This can
6774 be useful to facilitate the conversion to @code{nullptr} in C++11.
6776 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6777 @opindex Wsubobject-linkage
6778 @opindex Wno-subobject-linkage
6779 Warn if a class type has a base or a field whose type uses the anonymous
6780 namespace or depends on a type with no linkage. If a type A depends on
6781 a type B with no or internal linkage, defining it in multiple
6782 translation units would be an ODR violation because the meaning of B
6783 is different in each translation unit. If A only appears in a single
6784 translation unit, the best way to silence the warning is to give it
6785 internal linkage by putting it in an anonymous namespace as well. The
6786 compiler doesn't give this warning for types defined in the main .C
6787 file, as those are unlikely to have multiple definitions.
6788 @option{-Wsubobject-linkage} is enabled by default.
6790 @item -Wdangling-else
6791 @opindex Wdangling-else
6792 @opindex Wno-dangling-else
6793 Warn about constructions where there may be confusion to which
6794 @code{if} statement an @code{else} branch belongs. Here is an example of
6809 In C/C++, every @code{else} branch belongs to the innermost possible
6810 @code{if} statement, which in this example is @code{if (b)}. This is
6811 often not what the programmer expected, as illustrated in the above
6812 example by indentation the programmer chose. When there is the
6813 potential for this confusion, GCC issues a warning when this flag
6814 is specified. To eliminate the warning, add explicit braces around
6815 the innermost @code{if} statement so there is no way the @code{else}
6816 can belong to the enclosing @code{if}. The resulting code
6833 This warning is enabled by @option{-Wparentheses}.
6837 @opindex Wno-date-time
6838 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6839 are encountered as they might prevent bit-wise-identical reproducible
6842 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6843 @opindex Wdelete-incomplete
6844 @opindex Wno-delete-incomplete
6845 Warn when deleting a pointer to incomplete type, which may cause
6846 undefined behavior at runtime. This warning is enabled by default.
6848 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6849 @opindex Wuseless-cast
6850 @opindex Wno-useless-cast
6851 Warn when an expression is casted to its own type.
6854 @opindex Wempty-body
6855 @opindex Wno-empty-body
6856 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6857 while} statement. This warning is also enabled by @option{-Wextra}.
6859 @item -Wenum-compare
6860 @opindex Wenum-compare
6861 @opindex Wno-enum-compare
6862 Warn about a comparison between values of different enumerated types.
6863 In C++ enumerated type mismatches in conditional expressions are also
6864 diagnosed and the warning is enabled by default. In C this warning is
6865 enabled by @option{-Wall}.
6867 @item -Wextra-semi @r{(C++, Objective-C++ only)}
6868 @opindex Wextra-semi
6869 @opindex Wno-extra-semi
6870 Warn about redundant semicolon after in-class function definition.
6872 @item -Wjump-misses-init @r{(C, Objective-C only)}
6873 @opindex Wjump-misses-init
6874 @opindex Wno-jump-misses-init
6875 Warn if a @code{goto} statement or a @code{switch} statement jumps
6876 forward across the initialization of a variable, or jumps backward to a
6877 label after the variable has been initialized. This only warns about
6878 variables that are initialized when they are declared. This warning is
6879 only supported for C and Objective-C; in C++ this sort of branch is an
6882 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
6883 can be disabled with the @option{-Wno-jump-misses-init} option.
6885 @item -Wsign-compare
6886 @opindex Wsign-compare
6887 @opindex Wno-sign-compare
6888 @cindex warning for comparison of signed and unsigned values
6889 @cindex comparison of signed and unsigned values, warning
6890 @cindex signed and unsigned values, comparison warning
6891 Warn when a comparison between signed and unsigned values could produce
6892 an incorrect result when the signed value is converted to unsigned.
6893 In C++, this warning is also enabled by @option{-Wall}. In C, it is
6894 also enabled by @option{-Wextra}.
6896 @item -Wsign-conversion
6897 @opindex Wsign-conversion
6898 @opindex Wno-sign-conversion
6899 Warn for implicit conversions that may change the sign of an integer
6900 value, like assigning a signed integer expression to an unsigned
6901 integer variable. An explicit cast silences the warning. In C, this
6902 option is enabled also by @option{-Wconversion}.
6904 @item -Wfloat-conversion
6905 @opindex Wfloat-conversion
6906 @opindex Wno-float-conversion
6907 Warn for implicit conversions that reduce the precision of a real value.
6908 This includes conversions from real to integer, and from higher precision
6909 real to lower precision real values. This option is also enabled by
6910 @option{-Wconversion}.
6912 @item -Wno-scalar-storage-order
6913 @opindex Wno-scalar-storage-order
6914 @opindex Wscalar-storage-order
6915 Do not warn on suspicious constructs involving reverse scalar storage order.
6917 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
6918 @opindex Wsized-deallocation
6919 @opindex Wno-sized-deallocation
6920 Warn about a definition of an unsized deallocation function
6922 void operator delete (void *) noexcept;
6923 void operator delete[] (void *) noexcept;
6925 without a definition of the corresponding sized deallocation function
6927 void operator delete (void *, std::size_t) noexcept;
6928 void operator delete[] (void *, std::size_t) noexcept;
6930 or vice versa. Enabled by @option{-Wextra} along with
6931 @option{-fsized-deallocation}.
6933 @item -Wsizeof-pointer-div
6934 @opindex Wsizeof-pointer-div
6935 @opindex Wno-sizeof-pointer-div
6936 Warn for suspicious divisions of two sizeof expressions that divide
6937 the pointer size by the element size, which is the usual way to compute
6938 the array size but won't work out correctly with pointers. This warning
6939 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
6940 not an array, but a pointer. This warning is enabled by @option{-Wall}.
6942 @item -Wsizeof-pointer-memaccess
6943 @opindex Wsizeof-pointer-memaccess
6944 @opindex Wno-sizeof-pointer-memaccess
6945 Warn for suspicious length parameters to certain string and memory built-in
6946 functions if the argument uses @code{sizeof}. This warning triggers for
6947 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
6948 an array, but a pointer, and suggests a possible fix, or about
6949 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
6950 also warns about calls to bounded string copy functions like @code{strncat}
6951 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
6952 the source array. For example, in the following function the call to
6953 @code{strncat} specifies the size of the source string as the bound. That
6954 is almost certainly a mistake and so the call is diagnosed.
6956 void make_file (const char *name)
6958 char path[PATH_MAX];
6959 strncpy (path, name, sizeof path - 1);
6960 strncat (path, ".text", sizeof ".text");
6965 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
6967 @item -Wsizeof-array-argument
6968 @opindex Wsizeof-array-argument
6969 @opindex Wno-sizeof-array-argument
6970 Warn when the @code{sizeof} operator is applied to a parameter that is
6971 declared as an array in a function definition. This warning is enabled by
6972 default for C and C++ programs.
6974 @item -Wmemset-elt-size
6975 @opindex Wmemset-elt-size
6976 @opindex Wno-memset-elt-size
6977 Warn for suspicious calls to the @code{memset} built-in function, if the
6978 first argument references an array, and the third argument is a number
6979 equal to the number of elements, but not equal to the size of the array
6980 in memory. This indicates that the user has omitted a multiplication by
6981 the element size. This warning is enabled by @option{-Wall}.
6983 @item -Wmemset-transposed-args
6984 @opindex Wmemset-transposed-args
6985 @opindex Wno-memset-transposed-args
6986 Warn for suspicious calls to the @code{memset} built-in function, if the
6987 second argument is not zero and the third argument is zero. This warns e.g.@:
6988 about @code{memset (buf, sizeof buf, 0)} where most probably
6989 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
6990 is only emitted if the third argument is literal zero. If it is some
6991 expression that is folded to zero, a cast of zero to some type, etc.,
6992 it is far less likely that the user has mistakenly exchanged the arguments
6993 and no warning is emitted. This warning is enabled by @option{-Wall}.
6997 @opindex Wno-address
6998 Warn about suspicious uses of memory addresses. These include using
6999 the address of a function in a conditional expression, such as
7000 @code{void func(void); if (func)}, and comparisons against the memory
7001 address of a string literal, such as @code{if (x == "abc")}. Such
7002 uses typically indicate a programmer error: the address of a function
7003 always evaluates to true, so their use in a conditional usually
7004 indicate that the programmer forgot the parentheses in a function
7005 call; and comparisons against string literals result in unspecified
7006 behavior and are not portable in C, so they usually indicate that the
7007 programmer intended to use @code{strcmp}. This warning is enabled by
7011 @opindex Wlogical-op
7012 @opindex Wno-logical-op
7013 Warn about suspicious uses of logical operators in expressions.
7014 This includes using logical operators in contexts where a
7015 bit-wise operator is likely to be expected. Also warns when
7016 the operands of a logical operator are the same:
7019 if (a < 0 && a < 0) @{ @dots{} @}
7022 @item -Wlogical-not-parentheses
7023 @opindex Wlogical-not-parentheses
7024 @opindex Wno-logical-not-parentheses
7025 Warn about logical not used on the left hand side operand of a comparison.
7026 This option does not warn if the right operand is considered to be a boolean
7027 expression. Its purpose is to detect suspicious code like the following:
7031 if (!a > 1) @{ @dots{} @}
7034 It is possible to suppress the warning by wrapping the LHS into
7037 if ((!a) > 1) @{ @dots{} @}
7040 This warning is enabled by @option{-Wall}.
7042 @item -Waggregate-return
7043 @opindex Waggregate-return
7044 @opindex Wno-aggregate-return
7045 Warn if any functions that return structures or unions are defined or
7046 called. (In languages where you can return an array, this also elicits
7049 @item -Wno-aggressive-loop-optimizations
7050 @opindex Wno-aggressive-loop-optimizations
7051 @opindex Waggressive-loop-optimizations
7052 Warn if in a loop with constant number of iterations the compiler detects
7053 undefined behavior in some statement during one or more of the iterations.
7055 @item -Wno-attributes
7056 @opindex Wno-attributes
7057 @opindex Wattributes
7058 Do not warn if an unexpected @code{__attribute__} is used, such as
7059 unrecognized attributes, function attributes applied to variables,
7060 etc. This does not stop errors for incorrect use of supported
7063 @item -Wno-builtin-declaration-mismatch
7064 @opindex Wno-builtin-declaration-mismatch
7065 @opindex Wbuiltin-declaration-mismatch
7066 Warn if a built-in function is declared with an incompatible signature
7067 or as a non-function, or when a built-in function declared with a type
7068 that does not include a prototype is called with arguments whose promoted
7069 types do not match those expected by the function. When @option{-Wextra}
7070 is specified, also warn when a built-in function that takes arguments is
7071 declared without a prototype. The @option{-Wno-builtin-declaration-mismatch}
7072 warning is enabled by default. To avoid the warning include the appropriate
7073 header to bring the prototypes of built-in functions into scope.
7075 For example, the call to @code{memset} below is diagnosed by the warning
7076 because the function expects a value of type @code{size_t} as its argument
7077 but the type of @code{32} is @code{int}. With @option{-Wextra},
7078 the declaration of the function is diagnosed as well.
7080 extern void* memset ();
7083 memset (d, '\0', 32);
7087 @item -Wno-builtin-macro-redefined
7088 @opindex Wno-builtin-macro-redefined
7089 @opindex Wbuiltin-macro-redefined
7090 Do not warn if certain built-in macros are redefined. This suppresses
7091 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7092 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7094 @item -Wstrict-prototypes @r{(C and Objective-C only)}
7095 @opindex Wstrict-prototypes
7096 @opindex Wno-strict-prototypes
7097 Warn if a function is declared or defined without specifying the
7098 argument types. (An old-style function definition is permitted without
7099 a warning if preceded by a declaration that specifies the argument
7102 @item -Wold-style-declaration @r{(C and Objective-C only)}
7103 @opindex Wold-style-declaration
7104 @opindex Wno-old-style-declaration
7105 Warn for obsolescent usages, according to the C Standard, in a
7106 declaration. For example, warn if storage-class specifiers like
7107 @code{static} are not the first things in a declaration. This warning
7108 is also enabled by @option{-Wextra}.
7110 @item -Wold-style-definition @r{(C and Objective-C only)}
7111 @opindex Wold-style-definition
7112 @opindex Wno-old-style-definition
7113 Warn if an old-style function definition is used. A warning is given
7114 even if there is a previous prototype.
7116 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
7117 @opindex Wmissing-parameter-type
7118 @opindex Wno-missing-parameter-type
7119 A function parameter is declared without a type specifier in K&R-style
7126 This warning is also enabled by @option{-Wextra}.
7128 @item -Wmissing-prototypes @r{(C and Objective-C only)}
7129 @opindex Wmissing-prototypes
7130 @opindex Wno-missing-prototypes
7131 Warn if a global function is defined without a previous prototype
7132 declaration. This warning is issued even if the definition itself
7133 provides a prototype. Use this option to detect global functions
7134 that do not have a matching prototype declaration in a header file.
7135 This option is not valid for C++ because all function declarations
7136 provide prototypes and a non-matching declaration declares an
7137 overload rather than conflict with an earlier declaration.
7138 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7140 @item -Wmissing-declarations
7141 @opindex Wmissing-declarations
7142 @opindex Wno-missing-declarations
7143 Warn if a global function is defined without a previous declaration.
7144 Do so even if the definition itself provides a prototype.
7145 Use this option to detect global functions that are not declared in
7146 header files. In C, no warnings are issued for functions with previous
7147 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7148 missing prototypes. In C++, no warnings are issued for function templates,
7149 or for inline functions, or for functions in anonymous namespaces.
7151 @item -Wmissing-field-initializers
7152 @opindex Wmissing-field-initializers
7153 @opindex Wno-missing-field-initializers
7157 Warn if a structure's initializer has some fields missing. For
7158 example, the following code causes such a warning, because
7159 @code{x.h} is implicitly zero:
7162 struct s @{ int f, g, h; @};
7163 struct s x = @{ 3, 4 @};
7166 This option does not warn about designated initializers, so the following
7167 modification does not trigger a warning:
7170 struct s @{ int f, g, h; @};
7171 struct s x = @{ .f = 3, .g = 4 @};
7174 In C this option does not warn about the universal zero initializer
7178 struct s @{ int f, g, h; @};
7179 struct s x = @{ 0 @};
7182 Likewise, in C++ this option does not warn about the empty @{ @}
7183 initializer, for example:
7186 struct s @{ int f, g, h; @};
7190 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
7191 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7193 @item -Wno-multichar
7194 @opindex Wno-multichar
7196 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7197 Usually they indicate a typo in the user's code, as they have
7198 implementation-defined values, and should not be used in portable code.
7200 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7201 @opindex Wnormalized=
7202 @opindex Wnormalized
7203 @opindex Wno-normalized
7206 @cindex character set, input normalization
7207 In ISO C and ISO C++, two identifiers are different if they are
7208 different sequences of characters. However, sometimes when characters
7209 outside the basic ASCII character set are used, you can have two
7210 different character sequences that look the same. To avoid confusion,
7211 the ISO 10646 standard sets out some @dfn{normalization rules} which
7212 when applied ensure that two sequences that look the same are turned into
7213 the same sequence. GCC can warn you if you are using identifiers that
7214 have not been normalized; this option controls that warning.
7216 There are four levels of warning supported by GCC@. The default is
7217 @option{-Wnormalized=nfc}, which warns about any identifier that is
7218 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
7219 recommended form for most uses. It is equivalent to
7220 @option{-Wnormalized}.
7222 Unfortunately, there are some characters allowed in identifiers by
7223 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7224 identifiers. That is, there's no way to use these symbols in portable
7225 ISO C or C++ and have all your identifiers in NFC@.
7226 @option{-Wnormalized=id} suppresses the warning for these characters.
7227 It is hoped that future versions of the standards involved will correct
7228 this, which is why this option is not the default.
7230 You can switch the warning off for all characters by writing
7231 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
7232 only do this if you are using some other normalization scheme (like
7233 ``D''), because otherwise you can easily create bugs that are
7234 literally impossible to see.
7236 Some characters in ISO 10646 have distinct meanings but look identical
7237 in some fonts or display methodologies, especially once formatting has
7238 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7239 LETTER N'', displays just like a regular @code{n} that has been
7240 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
7241 normalization scheme to convert all these into a standard form as
7242 well, and GCC warns if your code is not in NFKC if you use
7243 @option{-Wnormalized=nfkc}. This warning is comparable to warning
7244 about every identifier that contains the letter O because it might be
7245 confused with the digit 0, and so is not the default, but may be
7246 useful as a local coding convention if the programming environment
7247 cannot be fixed to display these characters distinctly.
7249 @item -Wno-attribute-warning
7250 @opindex Wno-attribute-warning
7251 @opindex Wattribute-warning
7252 Do not warn about usage of functions (@pxref{Function Attributes})
7253 declared with @code{warning} attribute. By default, this warning is
7254 enabled. @option{-Wno-attribute-warning} can be used to disable the
7255 warning or @option{-Wno-error=attribute-warning} can be used to
7256 disable the error when compiled with @option{-Werror} flag.
7258 @item -Wno-deprecated
7259 @opindex Wno-deprecated
7260 @opindex Wdeprecated
7261 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
7263 @item -Wno-deprecated-declarations
7264 @opindex Wno-deprecated-declarations
7265 @opindex Wdeprecated-declarations
7266 Do not warn about uses of functions (@pxref{Function Attributes}),
7267 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7268 Attributes}) marked as deprecated by using the @code{deprecated}
7272 @opindex Wno-overflow
7274 Do not warn about compile-time overflow in constant expressions.
7279 Warn about One Definition Rule violations during link-time optimization.
7280 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
7283 @opindex Wopenmp-simd
7284 @opindex Wno-openmp-simd
7285 Warn if the vectorizer cost model overrides the OpenMP
7286 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7287 option can be used to relax the cost model.
7289 @item -Woverride-init @r{(C and Objective-C only)}
7290 @opindex Woverride-init
7291 @opindex Wno-override-init
7295 Warn if an initialized field without side effects is overridden when
7296 using designated initializers (@pxref{Designated Inits, , Designated
7299 This warning is included in @option{-Wextra}. To get other
7300 @option{-Wextra} warnings without this one, use @option{-Wextra
7301 -Wno-override-init}.
7303 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
7304 @opindex Woverride-init-side-effects
7305 @opindex Wno-override-init-side-effects
7306 Warn if an initialized field with side effects is overridden when
7307 using designated initializers (@pxref{Designated Inits, , Designated
7308 Initializers}). This warning is enabled by default.
7313 Warn if a structure is given the packed attribute, but the packed
7314 attribute has no effect on the layout or size of the structure.
7315 Such structures may be mis-aligned for little benefit. For
7316 instance, in this code, the variable @code{f.x} in @code{struct bar}
7317 is misaligned even though @code{struct bar} does not itself
7318 have the packed attribute:
7325 @} __attribute__((packed));
7333 @item -Wpacked-bitfield-compat
7334 @opindex Wpacked-bitfield-compat
7335 @opindex Wno-packed-bitfield-compat
7336 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7337 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
7338 the change can lead to differences in the structure layout. GCC
7339 informs you when the offset of such a field has changed in GCC 4.4.
7340 For example there is no longer a 4-bit padding between field @code{a}
7341 and @code{b} in this structure:
7348 @} __attribute__ ((packed));
7351 This warning is enabled by default. Use
7352 @option{-Wno-packed-bitfield-compat} to disable this warning.
7354 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7355 @opindex Wpacked-not-aligned
7356 @opindex Wno-packed-not-aligned
7357 Warn if a structure field with explicitly specified alignment in a
7358 packed struct or union is misaligned. For example, a warning will
7359 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7360 'struct S' is less than 8}, in this code:
7364 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7365 struct __attribute__ ((packed)) S @{
7371 This warning is enabled by @option{-Wall}.
7376 Warn if padding is included in a structure, either to align an element
7377 of the structure or to align the whole structure. Sometimes when this
7378 happens it is possible to rearrange the fields of the structure to
7379 reduce the padding and so make the structure smaller.
7381 @item -Wredundant-decls
7382 @opindex Wredundant-decls
7383 @opindex Wno-redundant-decls
7384 Warn if anything is declared more than once in the same scope, even in
7385 cases where multiple declaration is valid and changes nothing.
7389 @opindex Wno-restrict
7390 Warn when an object referenced by a @code{restrict}-qualified parameter
7391 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7392 argument, or when copies between such objects overlap. For example,
7393 the call to the @code{strcpy} function below attempts to truncate the string
7394 by replacing its initial characters with the last four. However, because
7395 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7396 the call is diagnosed.
7401 char a[] = "abcd1234";
7406 The @option{-Wrestrict} option detects some instances of simple overlap
7407 even without optimization but works best at @option{-O2} and above. It
7408 is included in @option{-Wall}.
7410 @item -Wnested-externs @r{(C and Objective-C only)}
7411 @opindex Wnested-externs
7412 @opindex Wno-nested-externs
7413 Warn if an @code{extern} declaration is encountered within a function.
7415 @item -Wno-inherited-variadic-ctor
7416 @opindex Winherited-variadic-ctor
7417 @opindex Wno-inherited-variadic-ctor
7418 Suppress warnings about use of C++11 inheriting constructors when the
7419 base class inherited from has a C variadic constructor; the warning is
7420 on by default because the ellipsis is not inherited.
7425 Warn if a function that is declared as inline cannot be inlined.
7426 Even with this option, the compiler does not warn about failures to
7427 inline functions declared in system headers.
7429 The compiler uses a variety of heuristics to determine whether or not
7430 to inline a function. For example, the compiler takes into account
7431 the size of the function being inlined and the amount of inlining
7432 that has already been done in the current function. Therefore,
7433 seemingly insignificant changes in the source program can cause the
7434 warnings produced by @option{-Winline} to appear or disappear.
7436 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7437 @opindex Wno-invalid-offsetof
7438 @opindex Winvalid-offsetof
7439 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7440 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
7441 to a non-standard-layout type is undefined. In existing C++ implementations,
7442 however, @code{offsetof} typically gives meaningful results.
7443 This flag is for users who are aware that they are
7444 writing nonportable code and who have deliberately chosen to ignore the
7447 The restrictions on @code{offsetof} may be relaxed in a future version
7448 of the C++ standard.
7450 @item -Wint-in-bool-context
7451 @opindex Wint-in-bool-context
7452 @opindex Wno-int-in-bool-context
7453 Warn for suspicious use of integer values where boolean values are expected,
7454 such as conditional expressions (?:) using non-boolean integer constants in
7455 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7456 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7457 for all kinds of multiplications regardless of the data type.
7458 This warning is enabled by @option{-Wall}.
7460 @item -Wno-int-to-pointer-cast
7461 @opindex Wno-int-to-pointer-cast
7462 @opindex Wint-to-pointer-cast
7463 Suppress warnings from casts to pointer type of an integer of a
7464 different size. In C++, casting to a pointer type of smaller size is
7465 an error. @option{Wint-to-pointer-cast} is enabled by default.
7468 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7469 @opindex Wno-pointer-to-int-cast
7470 @opindex Wpointer-to-int-cast
7471 Suppress warnings from casts from a pointer to an integer type of a
7475 @opindex Winvalid-pch
7476 @opindex Wno-invalid-pch
7477 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7478 the search path but cannot be used.
7482 @opindex Wno-long-long
7483 Warn if @code{long long} type is used. This is enabled by either
7484 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7485 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7487 @item -Wvariadic-macros
7488 @opindex Wvariadic-macros
7489 @opindex Wno-variadic-macros
7490 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7491 alternate syntax is used in ISO C99 mode. This is enabled by either
7492 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7493 messages, use @option{-Wno-variadic-macros}.
7497 @opindex Wno-varargs
7498 Warn upon questionable usage of the macros used to handle variable
7499 arguments like @code{va_start}. This is default. To inhibit the
7500 warning messages, use @option{-Wno-varargs}.
7502 @item -Wvector-operation-performance
7503 @opindex Wvector-operation-performance
7504 @opindex Wno-vector-operation-performance
7505 Warn if vector operation is not implemented via SIMD capabilities of the
7506 architecture. Mainly useful for the performance tuning.
7507 Vector operation can be implemented @code{piecewise}, which means that the
7508 scalar operation is performed on every vector element;
7509 @code{in parallel}, which means that the vector operation is implemented
7510 using scalars of wider type, which normally is more performance efficient;
7511 and @code{as a single scalar}, which means that vector fits into a
7514 @item -Wno-virtual-move-assign
7515 @opindex Wvirtual-move-assign
7516 @opindex Wno-virtual-move-assign
7517 Suppress warnings about inheriting from a virtual base with a
7518 non-trivial C++11 move assignment operator. This is dangerous because
7519 if the virtual base is reachable along more than one path, it is
7520 moved multiple times, which can mean both objects end up in the
7521 moved-from state. If the move assignment operator is written to avoid
7522 moving from a moved-from object, this warning can be disabled.
7527 Warn if a variable-length array is used in the code.
7528 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7529 the variable-length array.
7531 @item -Wvla-larger-than=@var{byte-size}
7532 @opindex Wvla-larger-than=
7533 @opindex Wno-vla-larger-than
7534 If this option is used, the compiler will warn for declarations of
7535 variable-length arrays whose size is either unbounded, or bounded
7536 by an argument that allows the array size to exceed @var{byte-size}
7537 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7538 works, but with variable-length arrays.
7540 Note that GCC may optimize small variable-length arrays of a known
7541 value into plain arrays, so this warning may not get triggered for
7544 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7545 is typically only effective when @option{-ftree-vrp} is active (default
7546 for @option{-O2} and above).
7548 See also @option{-Walloca-larger-than=@var{byte-size}}.
7550 @item -Wno-vla-larger-than
7551 @opindex Wno-vla-larger-than
7552 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7553 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7555 @item -Wvolatile-register-var
7556 @opindex Wvolatile-register-var
7557 @opindex Wno-volatile-register-var
7558 Warn if a register variable is declared volatile. The volatile
7559 modifier does not inhibit all optimizations that may eliminate reads
7560 and/or writes to register variables. This warning is enabled by
7563 @item -Wdisabled-optimization
7564 @opindex Wdisabled-optimization
7565 @opindex Wno-disabled-optimization
7566 Warn if a requested optimization pass is disabled. This warning does
7567 not generally indicate that there is anything wrong with your code; it
7568 merely indicates that GCC's optimizers are unable to handle the code
7569 effectively. Often, the problem is that your code is too big or too
7570 complex; GCC refuses to optimize programs when the optimization
7571 itself is likely to take inordinate amounts of time.
7573 @item -Wpointer-sign @r{(C and Objective-C only)}
7574 @opindex Wpointer-sign
7575 @opindex Wno-pointer-sign
7576 Warn for pointer argument passing or assignment with different signedness.
7577 This option is only supported for C and Objective-C@. It is implied by
7578 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7579 @option{-Wno-pointer-sign}.
7581 @item -Wstack-protector
7582 @opindex Wstack-protector
7583 @opindex Wno-stack-protector
7584 This option is only active when @option{-fstack-protector} is active. It
7585 warns about functions that are not protected against stack smashing.
7587 @item -Woverlength-strings
7588 @opindex Woverlength-strings
7589 @opindex Wno-overlength-strings
7590 Warn about string constants that are longer than the ``minimum
7591 maximum'' length specified in the C standard. Modern compilers
7592 generally allow string constants that are much longer than the
7593 standard's minimum limit, but very portable programs should avoid
7594 using longer strings.
7596 The limit applies @emph{after} string constant concatenation, and does
7597 not count the trailing NUL@. In C90, the limit was 509 characters; in
7598 C99, it was raised to 4095. C++98 does not specify a normative
7599 minimum maximum, so we do not diagnose overlength strings in C++@.
7601 This option is implied by @option{-Wpedantic}, and can be disabled with
7602 @option{-Wno-overlength-strings}.
7604 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7605 @opindex Wunsuffixed-float-constants
7606 @opindex Wno-unsuffixed-float-constants
7608 Issue a warning for any floating constant that does not have
7609 a suffix. When used together with @option{-Wsystem-headers} it
7610 warns about such constants in system header files. This can be useful
7611 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7612 from the decimal floating-point extension to C99.
7614 @item -Wno-designated-init @r{(C and Objective-C only)}
7615 Suppress warnings when a positional initializer is used to initialize
7616 a structure that has been marked with the @code{designated_init}
7620 Issue a warning when HSAIL cannot be emitted for the compiled function or
7625 @node Debugging Options
7626 @section Options for Debugging Your Program
7627 @cindex options, debugging
7628 @cindex debugging information options
7630 To tell GCC to emit extra information for use by a debugger, in almost
7631 all cases you need only to add @option{-g} to your other options.
7633 GCC allows you to use @option{-g} with
7634 @option{-O}. The shortcuts taken by optimized code may occasionally
7635 be surprising: some variables you declared may not exist
7636 at all; flow of control may briefly move where you did not expect it;
7637 some statements may not be executed because they compute constant
7638 results or their values are already at hand; some statements may
7639 execute in different places because they have been moved out of loops.
7640 Nevertheless it is possible to debug optimized output. This makes
7641 it reasonable to use the optimizer for programs that might have bugs.
7643 If you are not using some other optimization option, consider
7644 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7645 With no @option{-O} option at all, some compiler passes that collect
7646 information useful for debugging do not run at all, so that
7647 @option{-Og} may result in a better debugging experience.
7652 Produce debugging information in the operating system's native format
7653 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7656 On most systems that use stabs format, @option{-g} enables use of extra
7657 debugging information that only GDB can use; this extra information
7658 makes debugging work better in GDB but probably makes other debuggers
7660 refuse to read the program. If you want to control for certain whether
7661 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7662 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7666 Produce debugging information for use by GDB@. This means to use the
7667 most expressive format available (DWARF, stabs, or the native format
7668 if neither of those are supported), including GDB extensions if at all
7672 @itemx -gdwarf-@var{version}
7674 Produce debugging information in DWARF format (if that is supported).
7675 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7676 for most targets is 4. DWARF Version 5 is only experimental.
7678 Note that with DWARF Version 2, some ports require and always
7679 use some non-conflicting DWARF 3 extensions in the unwind tables.
7681 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7682 for maximum benefit.
7684 GCC no longer supports DWARF Version 1, which is substantially
7685 different than Version 2 and later. For historical reasons, some
7686 other DWARF-related options such as
7687 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7688 in their names, but apply to all currently-supported versions of DWARF.
7692 Produce debugging information in stabs format (if that is supported),
7693 without GDB extensions. This is the format used by DBX on most BSD
7694 systems. On MIPS, Alpha and System V Release 4 systems this option
7695 produces stabs debugging output that is not understood by DBX@.
7696 On System V Release 4 systems this option requires the GNU assembler.
7700 Produce debugging information in stabs format (if that is supported),
7701 using GNU extensions understood only by the GNU debugger (GDB)@. The
7702 use of these extensions is likely to make other debuggers crash or
7703 refuse to read the program.
7707 Produce debugging information in XCOFF format (if that is supported).
7708 This is the format used by the DBX debugger on IBM RS/6000 systems.
7712 Produce debugging information in XCOFF format (if that is supported),
7713 using GNU extensions understood only by the GNU debugger (GDB)@. The
7714 use of these extensions is likely to make other debuggers crash or
7715 refuse to read the program, and may cause assemblers other than the GNU
7716 assembler (GAS) to fail with an error.
7720 Produce debugging information in Alpha/VMS debug format (if that is
7721 supported). This is the format used by DEBUG on Alpha/VMS systems.
7724 @itemx -ggdb@var{level}
7725 @itemx -gstabs@var{level}
7726 @itemx -gxcoff@var{level}
7727 @itemx -gvms@var{level}
7728 Request debugging information and also use @var{level} to specify how
7729 much information. The default level is 2.
7731 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7734 Level 1 produces minimal information, enough for making backtraces in
7735 parts of the program that you don't plan to debug. This includes
7736 descriptions of functions and external variables, and line number
7737 tables, but no information about local variables.
7739 Level 3 includes extra information, such as all the macro definitions
7740 present in the program. Some debuggers support macro expansion when
7741 you use @option{-g3}.
7743 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7744 confusion with @option{-gdwarf-@var{level}}.
7745 Instead use an additional @option{-g@var{level}} option to change the
7746 debug level for DWARF.
7748 @item -feliminate-unused-debug-symbols
7749 @opindex feliminate-unused-debug-symbols
7750 Produce debugging information in stabs format (if that is supported),
7751 for only symbols that are actually used.
7753 @item -femit-class-debug-always
7754 @opindex femit-class-debug-always
7755 Instead of emitting debugging information for a C++ class in only one
7756 object file, emit it in all object files using the class. This option
7757 should be used only with debuggers that are unable to handle the way GCC
7758 normally emits debugging information for classes because using this
7759 option increases the size of debugging information by as much as a
7762 @item -fno-merge-debug-strings
7763 @opindex fmerge-debug-strings
7764 @opindex fno-merge-debug-strings
7765 Direct the linker to not merge together strings in the debugging
7766 information that are identical in different object files. Merging is
7767 not supported by all assemblers or linkers. Merging decreases the size
7768 of the debug information in the output file at the cost of increasing
7769 link processing time. Merging is enabled by default.
7771 @item -fdebug-prefix-map=@var{old}=@var{new}
7772 @opindex fdebug-prefix-map
7773 When compiling files residing in directory @file{@var{old}}, record
7774 debugging information describing them as if the files resided in
7775 directory @file{@var{new}} instead. This can be used to replace a
7776 build-time path with an install-time path in the debug info. It can
7777 also be used to change an absolute path to a relative path by using
7778 @file{.} for @var{new}. This can give more reproducible builds, which
7779 are location independent, but may require an extra command to tell GDB
7780 where to find the source files. See also @option{-ffile-prefix-map}.
7782 @item -fvar-tracking
7783 @opindex fvar-tracking
7784 Run variable tracking pass. It computes where variables are stored at each
7785 position in code. Better debugging information is then generated
7786 (if the debugging information format supports this information).
7788 It is enabled by default when compiling with optimization (@option{-Os},
7789 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7790 the debug info format supports it.
7792 @item -fvar-tracking-assignments
7793 @opindex fvar-tracking-assignments
7794 @opindex fno-var-tracking-assignments
7795 Annotate assignments to user variables early in the compilation and
7796 attempt to carry the annotations over throughout the compilation all the
7797 way to the end, in an attempt to improve debug information while
7798 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7800 It can be enabled even if var-tracking is disabled, in which case
7801 annotations are created and maintained, but discarded at the end.
7802 By default, this flag is enabled together with @option{-fvar-tracking},
7803 except when selective scheduling is enabled.
7806 @opindex gsplit-dwarf
7807 Separate as much DWARF debugging information as possible into a
7808 separate output file with the extension @file{.dwo}. This option allows
7809 the build system to avoid linking files with debug information. To
7810 be useful, this option requires a debugger capable of reading @file{.dwo}
7813 @item -gdescribe-dies
7814 @opindex gdescribe-dies
7815 Add description attributes to some DWARF DIEs that have no name attribute,
7816 such as artificial variables, external references and call site
7821 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7823 @item -ggnu-pubnames
7824 @opindex ggnu-pubnames
7825 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7826 suitable for conversion into a GDB@ index. This option is only useful
7827 with a linker that can produce GDB@ index version 7.
7829 @item -fdebug-types-section
7830 @opindex fdebug-types-section
7831 @opindex fno-debug-types-section
7832 When using DWARF Version 4 or higher, type DIEs can be put into
7833 their own @code{.debug_types} section instead of making them part of the
7834 @code{.debug_info} section. It is more efficient to put them in a separate
7835 comdat section since the linker can then remove duplicates.
7836 But not all DWARF consumers support @code{.debug_types} sections yet
7837 and on some objects @code{.debug_types} produces larger instead of smaller
7838 debugging information.
7840 @item -grecord-gcc-switches
7841 @itemx -gno-record-gcc-switches
7842 @opindex grecord-gcc-switches
7843 @opindex gno-record-gcc-switches
7844 This switch causes the command-line options used to invoke the
7845 compiler that may affect code generation to be appended to the
7846 DW_AT_producer attribute in DWARF debugging information. The options
7847 are concatenated with spaces separating them from each other and from
7848 the compiler version.
7849 It is enabled by default.
7850 See also @option{-frecord-gcc-switches} for another
7851 way of storing compiler options into the object file.
7853 @item -gstrict-dwarf
7854 @opindex gstrict-dwarf
7855 Disallow using extensions of later DWARF standard version than selected
7856 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
7857 DWARF extensions from later standard versions is allowed.
7859 @item -gno-strict-dwarf
7860 @opindex gno-strict-dwarf
7861 Allow using extensions of later DWARF standard version than selected with
7862 @option{-gdwarf-@var{version}}.
7864 @item -gas-loc-support
7865 @opindex gas-loc-support
7866 Inform the compiler that the assembler supports @code{.loc} directives.
7867 It may then use them for the assembler to generate DWARF2+ line number
7870 This is generally desirable, because assembler-generated line-number
7871 tables are a lot more compact than those the compiler can generate
7874 This option will be enabled by default if, at GCC configure time, the
7875 assembler was found to support such directives.
7877 @item -gno-as-loc-support
7878 @opindex gno-as-loc-support
7879 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
7880 line number tables are to be generated.
7882 @item gas-locview-support
7883 @opindex gas-locview-support
7884 Inform the compiler that the assembler supports @code{view} assignment
7885 and reset assertion checking in @code{.loc} directives.
7887 This option will be enabled by default if, at GCC configure time, the
7888 assembler was found to support them.
7890 @item gno-as-locview-support
7891 Force GCC to assign view numbers internally, if
7892 @option{-gvariable-location-views} are explicitly requested.
7895 @itemx -gno-column-info
7896 @opindex gcolumn-info
7897 @opindex gno-column-info
7898 Emit location column information into DWARF debugging information, rather
7899 than just file and line.
7900 This option is enabled by default.
7902 @item -gstatement-frontiers
7903 @itemx -gno-statement-frontiers
7904 @opindex gstatement-frontiers
7905 @opindex gno-statement-frontiers
7906 This option causes GCC to create markers in the internal representation
7907 at the beginning of statements, and to keep them roughly in place
7908 throughout compilation, using them to guide the output of @code{is_stmt}
7909 markers in the line number table. This is enabled by default when
7910 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
7911 @dots{}), and outputting DWARF 2 debug information at the normal level.
7913 @item -gvariable-location-views
7914 @itemx -gvariable-location-views=incompat5
7915 @itemx -gno-variable-location-views
7916 @opindex gvariable-location-views
7917 @opindex gvariable-location-views=incompat5
7918 @opindex gno-variable-location-views
7919 Augment variable location lists with progressive view numbers implied
7920 from the line number table. This enables debug information consumers to
7921 inspect state at certain points of the program, even if no instructions
7922 associated with the corresponding source locations are present at that
7923 point. If the assembler lacks support for view numbers in line number
7924 tables, this will cause the compiler to emit the line number table,
7925 which generally makes them somewhat less compact. The augmented line
7926 number tables and location lists are fully backward-compatible, so they
7927 can be consumed by debug information consumers that are not aware of
7928 these augmentations, but they won't derive any benefit from them either.
7930 This is enabled by default when outputting DWARF 2 debug information at
7931 the normal level, as long as there is assembler support,
7932 @option{-fvar-tracking-assignments} is enabled and
7933 @option{-gstrict-dwarf} is not. When assembler support is not
7934 available, this may still be enabled, but it will force GCC to output
7935 internal line number tables, and if
7936 @option{-ginternal-reset-location-views} is not enabled, that will most
7937 certainly lead to silently mismatching location views.
7939 There is a proposed representation for view numbers that is not backward
7940 compatible with the location list format introduced in DWARF 5, that can
7941 be enabled with @option{-gvariable-location-views=incompat5}. This
7942 option may be removed in the future, is only provided as a reference
7943 implementation of the proposed representation. Debug information
7944 consumers are not expected to support this extended format, and they
7945 would be rendered unable to decode location lists using it.
7947 @item -ginternal-reset-location-views
7948 @itemx -gnointernal-reset-location-views
7949 @opindex ginternal-reset-location-views
7950 @opindex gno-internal-reset-location-views
7951 Attempt to determine location views that can be omitted from location
7952 view lists. This requires the compiler to have very accurate insn
7953 length estimates, which isn't always the case, and it may cause
7954 incorrect view lists to be generated silently when using an assembler
7955 that does not support location view lists. The GNU assembler will flag
7956 any such error as a @code{view number mismatch}. This is only enabled
7957 on ports that define a reliable estimation function.
7959 @item -ginline-points
7960 @itemx -gno-inline-points
7961 @opindex ginline-points
7962 @opindex gno-inline-points
7963 Generate extended debug information for inlined functions. Location
7964 view tracking markers are inserted at inlined entry points, so that
7965 address and view numbers can be computed and output in debug
7966 information. This can be enabled independently of location views, in
7967 which case the view numbers won't be output, but it can only be enabled
7968 along with statement frontiers, and it is only enabled by default if
7969 location views are enabled.
7971 @item -gz@r{[}=@var{type}@r{]}
7973 Produce compressed debug sections in DWARF format, if that is supported.
7974 If @var{type} is not given, the default type depends on the capabilities
7975 of the assembler and linker used. @var{type} may be one of
7976 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
7977 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
7978 compression in traditional GNU format). If the linker doesn't support
7979 writing compressed debug sections, the option is rejected. Otherwise,
7980 if the assembler does not support them, @option{-gz} is silently ignored
7981 when producing object files.
7983 @item -femit-struct-debug-baseonly
7984 @opindex femit-struct-debug-baseonly
7985 Emit debug information for struct-like types
7986 only when the base name of the compilation source file
7987 matches the base name of file in which the struct is defined.
7989 This option substantially reduces the size of debugging information,
7990 but at significant potential loss in type information to the debugger.
7991 See @option{-femit-struct-debug-reduced} for a less aggressive option.
7992 See @option{-femit-struct-debug-detailed} for more detailed control.
7994 This option works only with DWARF debug output.
7996 @item -femit-struct-debug-reduced
7997 @opindex femit-struct-debug-reduced
7998 Emit debug information for struct-like types
7999 only when the base name of the compilation source file
8000 matches the base name of file in which the type is defined,
8001 unless the struct is a template or defined in a system header.
8003 This option significantly reduces the size of debugging information,
8004 with some potential loss in type information to the debugger.
8005 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
8006 See @option{-femit-struct-debug-detailed} for more detailed control.
8008 This option works only with DWARF debug output.
8010 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
8011 @opindex femit-struct-debug-detailed
8012 Specify the struct-like types
8013 for which the compiler generates debug information.
8014 The intent is to reduce duplicate struct debug information
8015 between different object files within the same program.
8017 This option is a detailed version of
8018 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
8019 which serves for most needs.
8021 A specification has the syntax@*
8022 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
8024 The optional first word limits the specification to
8025 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
8026 A struct type is used directly when it is the type of a variable, member.
8027 Indirect uses arise through pointers to structs.
8028 That is, when use of an incomplete struct is valid, the use is indirect.
8030 @samp{struct one direct; struct two * indirect;}.
8032 The optional second word limits the specification to
8033 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
8034 Generic structs are a bit complicated to explain.
8035 For C++, these are non-explicit specializations of template classes,
8036 or non-template classes within the above.
8037 Other programming languages have generics,
8038 but @option{-femit-struct-debug-detailed} does not yet implement them.
8040 The third word specifies the source files for those
8041 structs for which the compiler should emit debug information.
8042 The values @samp{none} and @samp{any} have the normal meaning.
8043 The value @samp{base} means that
8044 the base of name of the file in which the type declaration appears
8045 must match the base of the name of the main compilation file.
8046 In practice, this means that when compiling @file{foo.c}, debug information
8047 is generated for types declared in that file and @file{foo.h},
8048 but not other header files.
8049 The value @samp{sys} means those types satisfying @samp{base}
8050 or declared in system or compiler headers.
8052 You may need to experiment to determine the best settings for your application.
8054 The default is @option{-femit-struct-debug-detailed=all}.
8056 This option works only with DWARF debug output.
8058 @item -fno-dwarf2-cfi-asm
8059 @opindex fdwarf2-cfi-asm
8060 @opindex fno-dwarf2-cfi-asm
8061 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
8062 instead of using GAS @code{.cfi_*} directives.
8064 @item -fno-eliminate-unused-debug-types
8065 @opindex feliminate-unused-debug-types
8066 @opindex fno-eliminate-unused-debug-types
8067 Normally, when producing DWARF output, GCC avoids producing debug symbol
8068 output for types that are nowhere used in the source file being compiled.
8069 Sometimes it is useful to have GCC emit debugging
8070 information for all types declared in a compilation
8071 unit, regardless of whether or not they are actually used
8072 in that compilation unit, for example
8073 if, in the debugger, you want to cast a value to a type that is
8074 not actually used in your program (but is declared). More often,
8075 however, this results in a significant amount of wasted space.
8078 @node Optimize Options
8079 @section Options That Control Optimization
8080 @cindex optimize options
8081 @cindex options, optimization
8083 These options control various sorts of optimizations.
8085 Without any optimization option, the compiler's goal is to reduce the
8086 cost of compilation and to make debugging produce the expected
8087 results. Statements are independent: if you stop the program with a
8088 breakpoint between statements, you can then assign a new value to any
8089 variable or change the program counter to any other statement in the
8090 function and get exactly the results you expect from the source
8093 Turning on optimization flags makes the compiler attempt to improve
8094 the performance and/or code size at the expense of compilation time
8095 and possibly the ability to debug the program.
8097 The compiler performs optimization based on the knowledge it has of the
8098 program. Compiling multiple files at once to a single output file mode allows
8099 the compiler to use information gained from all of the files when compiling
8102 Not all optimizations are controlled directly by a flag. Only
8103 optimizations that have a flag are listed in this section.
8105 Most optimizations are completely disabled at @option{-O0} or if an
8106 @option{-O} level is not set on the command line, even if individual
8107 optimization flags are specified. Similarly, @option{-Og} suppresses
8108 many optimization passes.
8110 Depending on the target and how GCC was configured, a slightly different
8111 set of optimizations may be enabled at each @option{-O} level than
8112 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
8113 to find out the exact set of optimizations that are enabled at each level.
8114 @xref{Overall Options}, for examples.
8121 Optimize. Optimizing compilation takes somewhat more time, and a lot
8122 more memory for a large function.
8124 With @option{-O}, the compiler tries to reduce code size and execution
8125 time, without performing any optimizations that take a great deal of
8128 @c Note that in addition to the default_options_table list in opts.c,
8129 @c several optimization flags default to true but control optimization
8130 @c passes that are explicitly disabled at -O0.
8132 @option{-O} turns on the following optimization flags:
8134 @c Please keep the following list alphabetized.
8135 @gccoptlist{-fauto-inc-dec @gol
8136 -fbranch-count-reg @gol
8137 -fcombine-stack-adjustments @gol
8139 -fcprop-registers @gol
8142 -fdelayed-branch @gol
8144 -fforward-propagate @gol
8145 -fguess-branch-probability @gol
8146 -fif-conversion @gol
8147 -fif-conversion2 @gol
8148 -finline-functions-called-once @gol
8150 -fipa-pure-const @gol
8151 -fipa-reference @gol
8152 -fipa-reference-addressable @gol
8153 -fmerge-constants @gol
8154 -fmove-loop-invariants @gol
8155 -fomit-frame-pointer @gol
8156 -freorder-blocks @gol
8158 -fshrink-wrap-separate @gol
8159 -fsplit-wide-types @gol
8165 -ftree-coalesce-vars @gol
8166 -ftree-copy-prop @gol
8168 -ftree-dominator-opts @gol
8170 -ftree-forwprop @gol
8174 -ftree-scev-cprop @gol
8183 Optimize even more. GCC performs nearly all supported optimizations
8184 that do not involve a space-speed tradeoff.
8185 As compared to @option{-O}, this option increases both compilation time
8186 and the performance of the generated code.
8188 @option{-O2} turns on all optimization flags specified by @option{-O}. It
8189 also turns on the following optimization flags:
8191 @c Please keep the following list alphabetized!
8192 @gccoptlist{-falign-functions -falign-jumps @gol
8193 -falign-labels -falign-loops @gol
8195 -fcode-hoisting @gol
8197 -fcse-follow-jumps -fcse-skip-blocks @gol
8198 -fdelete-null-pointer-checks @gol
8199 -fdevirtualize -fdevirtualize-speculatively @gol
8200 -fexpensive-optimizations @gol
8201 -fgcse -fgcse-lm @gol
8202 -fhoist-adjacent-loads @gol
8203 -finline-small-functions @gol
8204 -findirect-inlining @gol
8205 -fipa-bit-cp -fipa-cp -fipa-icf @gol
8206 -fipa-ra -fipa-sra -fipa-vrp @gol
8207 -fisolate-erroneous-paths-dereference @gol
8209 -foptimize-sibling-calls @gol
8210 -foptimize-strlen @gol
8211 -fpartial-inlining @gol
8213 -freorder-blocks-algorithm=stc @gol
8214 -freorder-blocks-and-partition -freorder-functions @gol
8215 -frerun-cse-after-loop @gol
8216 -fschedule-insns -fschedule-insns2 @gol
8217 -fsched-interblock -fsched-spec @gol
8218 -fstore-merging @gol
8219 -fstrict-aliasing @gol
8221 -ftree-builtin-call-dce @gol
8223 -ftree-switch-conversion -ftree-tail-merge @gol
8226 Please note the warning under @option{-fgcse} about
8227 invoking @option{-O2} on programs that use computed gotos.
8231 Optimize yet more. @option{-O3} turns on all optimizations specified
8232 by @option{-O2} and also turns on the following optimization flags:
8234 @c Please keep the following list alphabetized!
8235 @gccoptlist{-fgcse-after-reload @gol
8236 -finline-functions @gol
8238 -floop-interchange @gol
8239 -floop-unroll-and-jam @gol
8241 -fpredictive-commoning @gol
8243 -ftree-loop-distribute-patterns @gol
8244 -ftree-loop-distribution @gol
8245 -ftree-loop-vectorize @gol
8246 -ftree-partial-pre @gol
8247 -ftree-slp-vectorize @gol
8248 -funswitch-loops @gol
8253 Reduce compilation time and make debugging produce the expected
8254 results. This is the default.
8258 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
8259 except those that often increase code size:
8261 @gccoptlist{-falign-functions -falign-jumps @gol
8262 -falign-labels -falign-loops @gol
8263 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
8265 It also enables @option{-finline-functions}, causes the compiler to tune for
8266 code size rather than execution speed, and performs further optimizations
8267 designed to reduce code size.
8271 Disregard strict standards compliance. @option{-Ofast} enables all
8272 @option{-O3} optimizations. It also enables optimizations that are not
8273 valid for all standard-compliant programs.
8274 It turns on @option{-ffast-math} and the Fortran-specific
8275 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
8276 specified, and @option{-fno-protect-parens}.
8280 Optimize debugging experience. @option{-Og} should be the optimization
8281 level of choice for the standard edit-compile-debug cycle, offering
8282 a reasonable level of optimization while maintaining fast compilation
8283 and a good debugging experience. It is a better choice than @option{-O0}
8284 for producing debuggable code because some compiler passes
8285 that collect debug information are disabled at @option{-O0}.
8287 Like @option{-O0}, @option{-Og} completely disables a number of
8288 optimization passes so that individual options controlling them have
8289 no effect. Otherwise @option{-Og} enables all @option{-O1}
8290 optimization flags except for those that may interfere with debugging:
8292 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
8293 -fif-conversion -fif-conversion2 @gol
8294 -finline-functions-called-once @gol
8295 -fmove-loop-invariants -fssa-phiopt @gol
8296 -ftree-bit-ccp -ftree-pta -ftree-sra}
8300 If you use multiple @option{-O} options, with or without level numbers,
8301 the last such option is the one that is effective.
8303 Options of the form @option{-f@var{flag}} specify machine-independent
8304 flags. Most flags have both positive and negative forms; the negative
8305 form of @option{-ffoo} is @option{-fno-foo}. In the table
8306 below, only one of the forms is listed---the one you typically
8307 use. You can figure out the other form by either removing @samp{no-}
8310 The following options control specific optimizations. They are either
8311 activated by @option{-O} options or are related to ones that are. You
8312 can use the following flags in the rare cases when ``fine-tuning'' of
8313 optimizations to be performed is desired.
8316 @item -fno-defer-pop
8317 @opindex fno-defer-pop
8319 For machines that must pop arguments after a function call, always pop
8320 the arguments as soon as each function returns.
8321 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
8322 this allows the compiler to let arguments accumulate on the stack for several
8323 function calls and pop them all at once.
8325 @item -fforward-propagate
8326 @opindex fforward-propagate
8327 Perform a forward propagation pass on RTL@. The pass tries to combine two
8328 instructions and checks if the result can be simplified. If loop unrolling
8329 is active, two passes are performed and the second is scheduled after
8332 This option is enabled by default at optimization levels @option{-O},
8333 @option{-O2}, @option{-O3}, @option{-Os}.
8335 @item -ffp-contract=@var{style}
8336 @opindex ffp-contract
8337 @option{-ffp-contract=off} disables floating-point expression contraction.
8338 @option{-ffp-contract=fast} enables floating-point expression contraction
8339 such as forming of fused multiply-add operations if the target has
8340 native support for them.
8341 @option{-ffp-contract=on} enables floating-point expression contraction
8342 if allowed by the language standard. This is currently not implemented
8343 and treated equal to @option{-ffp-contract=off}.
8345 The default is @option{-ffp-contract=fast}.
8347 @item -fomit-frame-pointer
8348 @opindex fomit-frame-pointer
8349 Omit the frame pointer in functions that don't need one. This avoids the
8350 instructions to save, set up and restore the frame pointer; on many targets
8351 it also makes an extra register available.
8353 On some targets this flag has no effect because the standard calling sequence
8354 always uses a frame pointer, so it cannot be omitted.
8356 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8357 is used in all functions. Several targets always omit the frame pointer in
8360 Enabled by default at @option{-O} and higher.
8362 @item -foptimize-sibling-calls
8363 @opindex foptimize-sibling-calls
8364 Optimize sibling and tail recursive calls.
8366 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8368 @item -foptimize-strlen
8369 @opindex foptimize-strlen
8370 Optimize various standard C string functions (e.g.@: @code{strlen},
8371 @code{strchr} or @code{strcpy}) and
8372 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8374 Enabled at levels @option{-O2}, @option{-O3}.
8379 Do not expand any functions inline apart from those marked with
8380 the @code{always_inline} attribute. This is the default when not
8383 Single functions can be exempted from inlining by marking them
8384 with the @code{noinline} attribute.
8386 @item -finline-small-functions
8387 @opindex finline-small-functions
8388 Integrate functions into their callers when their body is smaller than expected
8389 function call code (so overall size of program gets smaller). The compiler
8390 heuristically decides which functions are simple enough to be worth integrating
8391 in this way. This inlining applies to all functions, even those not declared
8394 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8396 @item -findirect-inlining
8397 @opindex findirect-inlining
8398 Inline also indirect calls that are discovered to be known at compile
8399 time thanks to previous inlining. This option has any effect only
8400 when inlining itself is turned on by the @option{-finline-functions}
8401 or @option{-finline-small-functions} options.
8403 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8405 @item -finline-functions
8406 @opindex finline-functions
8407 Consider all functions for inlining, even if they are not declared inline.
8408 The compiler heuristically decides which functions are worth integrating
8411 If all calls to a given function are integrated, and the function is
8412 declared @code{static}, then the function is normally not output as
8413 assembler code in its own right.
8415 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. Also enabled
8416 by @option{-fprofile-use} and @option{-fauto-profile}.
8418 @item -finline-functions-called-once
8419 @opindex finline-functions-called-once
8420 Consider all @code{static} functions called once for inlining into their
8421 caller even if they are not marked @code{inline}. If a call to a given
8422 function is integrated, then the function is not output as assembler code
8425 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
8426 but not @option{-Og}.
8428 @item -fearly-inlining
8429 @opindex fearly-inlining
8430 Inline functions marked by @code{always_inline} and functions whose body seems
8431 smaller than the function call overhead early before doing
8432 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
8433 makes profiling significantly cheaper and usually inlining faster on programs
8434 having large chains of nested wrapper functions.
8440 Perform interprocedural scalar replacement of aggregates, removal of
8441 unused parameters and replacement of parameters passed by reference
8442 by parameters passed by value.
8444 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8446 @item -finline-limit=@var{n}
8447 @opindex finline-limit
8448 By default, GCC limits the size of functions that can be inlined. This flag
8449 allows coarse control of this limit. @var{n} is the size of functions that
8450 can be inlined in number of pseudo instructions.
8452 Inlining is actually controlled by a number of parameters, which may be
8453 specified individually by using @option{--param @var{name}=@var{value}}.
8454 The @option{-finline-limit=@var{n}} option sets some of these parameters
8458 @item max-inline-insns-single
8459 is set to @var{n}/2.
8460 @item max-inline-insns-auto
8461 is set to @var{n}/2.
8464 See below for a documentation of the individual
8465 parameters controlling inlining and for the defaults of these parameters.
8467 @emph{Note:} there may be no value to @option{-finline-limit} that results
8468 in default behavior.
8470 @emph{Note:} pseudo instruction represents, in this particular context, an
8471 abstract measurement of function's size. In no way does it represent a count
8472 of assembly instructions and as such its exact meaning might change from one
8473 release to an another.
8475 @item -fno-keep-inline-dllexport
8476 @opindex fno-keep-inline-dllexport
8477 @opindex fkeep-inline-dllexport
8478 This is a more fine-grained version of @option{-fkeep-inline-functions},
8479 which applies only to functions that are declared using the @code{dllexport}
8480 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8483 @item -fkeep-inline-functions
8484 @opindex fkeep-inline-functions
8485 In C, emit @code{static} functions that are declared @code{inline}
8486 into the object file, even if the function has been inlined into all
8487 of its callers. This switch does not affect functions using the
8488 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8489 inline functions into the object file.
8491 @item -fkeep-static-functions
8492 @opindex fkeep-static-functions
8493 Emit @code{static} functions into the object file, even if the function
8496 @item -fkeep-static-consts
8497 @opindex fkeep-static-consts
8498 Emit variables declared @code{static const} when optimization isn't turned
8499 on, even if the variables aren't referenced.
8501 GCC enables this option by default. If you want to force the compiler to
8502 check if a variable is referenced, regardless of whether or not
8503 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8505 @item -fmerge-constants
8506 @opindex fmerge-constants
8507 Attempt to merge identical constants (string constants and floating-point
8508 constants) across compilation units.
8510 This option is the default for optimized compilation if the assembler and
8511 linker support it. Use @option{-fno-merge-constants} to inhibit this
8514 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8516 @item -fmerge-all-constants
8517 @opindex fmerge-all-constants
8518 Attempt to merge identical constants and identical variables.
8520 This option implies @option{-fmerge-constants}. In addition to
8521 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8522 arrays or initialized constant variables with integral or floating-point
8523 types. Languages like C or C++ require each variable, including multiple
8524 instances of the same variable in recursive calls, to have distinct locations,
8525 so using this option results in non-conforming
8528 @item -fmodulo-sched
8529 @opindex fmodulo-sched
8530 Perform swing modulo scheduling immediately before the first scheduling
8531 pass. This pass looks at innermost loops and reorders their
8532 instructions by overlapping different iterations.
8534 @item -fmodulo-sched-allow-regmoves
8535 @opindex fmodulo-sched-allow-regmoves
8536 Perform more aggressive SMS-based modulo scheduling with register moves
8537 allowed. By setting this flag certain anti-dependences edges are
8538 deleted, which triggers the generation of reg-moves based on the
8539 life-range analysis. This option is effective only with
8540 @option{-fmodulo-sched} enabled.
8542 @item -fno-branch-count-reg
8543 @opindex fno-branch-count-reg
8544 @opindex fbranch-count-reg
8545 Disable the optimization pass that scans for opportunities to use
8546 ``decrement and branch'' instructions on a count register instead of
8547 instruction sequences that decrement a register, compare it against zero, and
8548 then branch based upon the result. This option is only meaningful on
8549 architectures that support such instructions, which include x86, PowerPC,
8550 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8551 doesn't remove the decrement and branch instructions from the generated
8552 instruction stream introduced by other optimization passes.
8554 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
8555 except for @option{-Og}.
8557 @item -fno-function-cse
8558 @opindex fno-function-cse
8559 @opindex ffunction-cse
8560 Do not put function addresses in registers; make each instruction that
8561 calls a constant function contain the function's address explicitly.
8563 This option results in less efficient code, but some strange hacks
8564 that alter the assembler output may be confused by the optimizations
8565 performed when this option is not used.
8567 The default is @option{-ffunction-cse}
8569 @item -fno-zero-initialized-in-bss
8570 @opindex fno-zero-initialized-in-bss
8571 @opindex fzero-initialized-in-bss
8572 If the target supports a BSS section, GCC by default puts variables that
8573 are initialized to zero into BSS@. This can save space in the resulting
8576 This option turns off this behavior because some programs explicitly
8577 rely on variables going to the data section---e.g., so that the
8578 resulting executable can find the beginning of that section and/or make
8579 assumptions based on that.
8581 The default is @option{-fzero-initialized-in-bss}.
8583 @item -fthread-jumps
8584 @opindex fthread-jumps
8585 Perform optimizations that check to see if a jump branches to a
8586 location where another comparison subsumed by the first is found. If
8587 so, the first branch is redirected to either the destination of the
8588 second branch or a point immediately following it, depending on whether
8589 the condition is known to be true or false.
8591 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8593 @item -fsplit-wide-types
8594 @opindex fsplit-wide-types
8595 When using a type that occupies multiple registers, such as @code{long
8596 long} on a 32-bit system, split the registers apart and allocate them
8597 independently. This normally generates better code for those types,
8598 but may make debugging more difficult.
8600 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8603 @item -fcse-follow-jumps
8604 @opindex fcse-follow-jumps
8605 In common subexpression elimination (CSE), scan through jump instructions
8606 when the target of the jump is not reached by any other path. For
8607 example, when CSE encounters an @code{if} statement with an
8608 @code{else} clause, CSE follows the jump when the condition
8611 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8613 @item -fcse-skip-blocks
8614 @opindex fcse-skip-blocks
8615 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8616 follow jumps that conditionally skip over blocks. When CSE
8617 encounters a simple @code{if} statement with no else clause,
8618 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8619 body of the @code{if}.
8621 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8623 @item -frerun-cse-after-loop
8624 @opindex frerun-cse-after-loop
8625 Re-run common subexpression elimination after loop optimizations are
8628 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8632 Perform a global common subexpression elimination pass.
8633 This pass also performs global constant and copy propagation.
8635 @emph{Note:} When compiling a program using computed gotos, a GCC
8636 extension, you may get better run-time performance if you disable
8637 the global common subexpression elimination pass by adding
8638 @option{-fno-gcse} to the command line.
8640 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8644 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8645 attempts to move loads that are only killed by stores into themselves. This
8646 allows a loop containing a load/store sequence to be changed to a load outside
8647 the loop, and a copy/store within the loop.
8649 Enabled by default when @option{-fgcse} is enabled.
8653 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8654 global common subexpression elimination. This pass attempts to move
8655 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8656 loops containing a load/store sequence can be changed to a load before
8657 the loop and a store after the loop.
8659 Not enabled at any optimization level.
8663 When @option{-fgcse-las} is enabled, the global common subexpression
8664 elimination pass eliminates redundant loads that come after stores to the
8665 same memory location (both partial and full redundancies).
8667 Not enabled at any optimization level.
8669 @item -fgcse-after-reload
8670 @opindex fgcse-after-reload
8671 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8672 pass is performed after reload. The purpose of this pass is to clean up
8675 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
8677 @item -faggressive-loop-optimizations
8678 @opindex faggressive-loop-optimizations
8679 This option tells the loop optimizer to use language constraints to
8680 derive bounds for the number of iterations of a loop. This assumes that
8681 loop code does not invoke undefined behavior by for example causing signed
8682 integer overflows or out-of-bound array accesses. The bounds for the
8683 number of iterations of a loop are used to guide loop unrolling and peeling
8684 and loop exit test optimizations.
8685 This option is enabled by default.
8687 @item -funconstrained-commons
8688 @opindex funconstrained-commons
8689 This option tells the compiler that variables declared in common blocks
8690 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8691 prevents certain optimizations that depend on knowing the array bounds.
8693 @item -fcrossjumping
8694 @opindex fcrossjumping
8695 Perform cross-jumping transformation.
8696 This transformation unifies equivalent code and saves code size. The
8697 resulting code may or may not perform better than without cross-jumping.
8699 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8701 @item -fauto-inc-dec
8702 @opindex fauto-inc-dec
8703 Combine increments or decrements of addresses with memory accesses.
8704 This pass is always skipped on architectures that do not have
8705 instructions to support this. Enabled by default at @option{-O} and
8706 higher on architectures that support this.
8710 Perform dead code elimination (DCE) on RTL@.
8711 Enabled by default at @option{-O} and higher.
8715 Perform dead store elimination (DSE) on RTL@.
8716 Enabled by default at @option{-O} and higher.
8718 @item -fif-conversion
8719 @opindex fif-conversion
8720 Attempt to transform conditional jumps into branch-less equivalents. This
8721 includes use of conditional moves, min, max, set flags and abs instructions, and
8722 some tricks doable by standard arithmetics. The use of conditional execution
8723 on chips where it is available is controlled by @option{-fif-conversion2}.
8725 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8726 not with @option{-Og}.
8728 @item -fif-conversion2
8729 @opindex fif-conversion2
8730 Use conditional execution (where available) to transform conditional jumps into
8731 branch-less equivalents.
8733 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8734 not with @option{-Og}.
8736 @item -fdeclone-ctor-dtor
8737 @opindex fdeclone-ctor-dtor
8738 The C++ ABI requires multiple entry points for constructors and
8739 destructors: one for a base subobject, one for a complete object, and
8740 one for a virtual destructor that calls operator delete afterwards.
8741 For a hierarchy with virtual bases, the base and complete variants are
8742 clones, which means two copies of the function. With this option, the
8743 base and complete variants are changed to be thunks that call a common
8746 Enabled by @option{-Os}.
8748 @item -fdelete-null-pointer-checks
8749 @opindex fdelete-null-pointer-checks
8750 Assume that programs cannot safely dereference null pointers, and that
8751 no code or data element resides at address zero.
8752 This option enables simple constant
8753 folding optimizations at all optimization levels. In addition, other
8754 optimization passes in GCC use this flag to control global dataflow
8755 analyses that eliminate useless checks for null pointers; these assume
8756 that a memory access to address zero always results in a trap, so
8757 that if a pointer is checked after it has already been dereferenced,
8760 Note however that in some environments this assumption is not true.
8761 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8762 for programs that depend on that behavior.
8764 This option is enabled by default on most targets. On Nios II ELF, it
8765 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8767 Passes that use the dataflow information
8768 are enabled independently at different optimization levels.
8770 @item -fdevirtualize
8771 @opindex fdevirtualize
8772 Attempt to convert calls to virtual functions to direct calls. This
8773 is done both within a procedure and interprocedurally as part of
8774 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8775 propagation (@option{-fipa-cp}).
8776 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8778 @item -fdevirtualize-speculatively
8779 @opindex fdevirtualize-speculatively
8780 Attempt to convert calls to virtual functions to speculative direct calls.
8781 Based on the analysis of the type inheritance graph, determine for a given call
8782 the set of likely targets. If the set is small, preferably of size 1, change
8783 the call into a conditional deciding between direct and indirect calls. The
8784 speculative calls enable more optimizations, such as inlining. When they seem
8785 useless after further optimization, they are converted back into original form.
8787 @item -fdevirtualize-at-ltrans
8788 @opindex fdevirtualize-at-ltrans
8789 Stream extra information needed for aggressive devirtualization when running
8790 the link-time optimizer in local transformation mode.
8791 This option enables more devirtualization but
8792 significantly increases the size of streamed data. For this reason it is
8793 disabled by default.
8795 @item -fexpensive-optimizations
8796 @opindex fexpensive-optimizations
8797 Perform a number of minor optimizations that are relatively expensive.
8799 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8803 Attempt to remove redundant extension instructions. This is especially
8804 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8805 registers after writing to their lower 32-bit half.
8807 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8808 @option{-O3}, @option{-Os}.
8810 @item -fno-lifetime-dse
8811 @opindex fno-lifetime-dse
8812 @opindex flifetime-dse
8813 In C++ the value of an object is only affected by changes within its
8814 lifetime: when the constructor begins, the object has an indeterminate
8815 value, and any changes during the lifetime of the object are dead when
8816 the object is destroyed. Normally dead store elimination will take
8817 advantage of this; if your code relies on the value of the object
8818 storage persisting beyond the lifetime of the object, you can use this
8819 flag to disable this optimization. To preserve stores before the
8820 constructor starts (e.g.@: because your operator new clears the object
8821 storage) but still treat the object as dead after the destructor you,
8822 can use @option{-flifetime-dse=1}. The default behavior can be
8823 explicitly selected with @option{-flifetime-dse=2}.
8824 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8826 @item -flive-range-shrinkage
8827 @opindex flive-range-shrinkage
8828 Attempt to decrease register pressure through register live range
8829 shrinkage. This is helpful for fast processors with small or moderate
8832 @item -fira-algorithm=@var{algorithm}
8833 @opindex fira-algorithm
8834 Use the specified coloring algorithm for the integrated register
8835 allocator. The @var{algorithm} argument can be @samp{priority}, which
8836 specifies Chow's priority coloring, or @samp{CB}, which specifies
8837 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8838 for all architectures, but for those targets that do support it, it is
8839 the default because it generates better code.
8841 @item -fira-region=@var{region}
8842 @opindex fira-region
8843 Use specified regions for the integrated register allocator. The
8844 @var{region} argument should be one of the following:
8849 Use all loops as register allocation regions.
8850 This can give the best results for machines with a small and/or
8851 irregular register set.
8854 Use all loops except for loops with small register pressure
8855 as the regions. This value usually gives
8856 the best results in most cases and for most architectures,
8857 and is enabled by default when compiling with optimization for speed
8858 (@option{-O}, @option{-O2}, @dots{}).
8861 Use all functions as a single region.
8862 This typically results in the smallest code size, and is enabled by default for
8863 @option{-Os} or @option{-O0}.
8867 @item -fira-hoist-pressure
8868 @opindex fira-hoist-pressure
8869 Use IRA to evaluate register pressure in the code hoisting pass for
8870 decisions to hoist expressions. This option usually results in smaller
8871 code, but it can slow the compiler down.
8873 This option is enabled at level @option{-Os} for all targets.
8875 @item -fira-loop-pressure
8876 @opindex fira-loop-pressure
8877 Use IRA to evaluate register pressure in loops for decisions to move
8878 loop invariants. This option usually results in generation
8879 of faster and smaller code on machines with large register files (>= 32
8880 registers), but it can slow the compiler down.
8882 This option is enabled at level @option{-O3} for some targets.
8884 @item -fno-ira-share-save-slots
8885 @opindex fno-ira-share-save-slots
8886 @opindex fira-share-save-slots
8887 Disable sharing of stack slots used for saving call-used hard
8888 registers living through a call. Each hard register gets a
8889 separate stack slot, and as a result function stack frames are
8892 @item -fno-ira-share-spill-slots
8893 @opindex fno-ira-share-spill-slots
8894 @opindex fira-share-spill-slots
8895 Disable sharing of stack slots allocated for pseudo-registers. Each
8896 pseudo-register that does not get a hard register gets a separate
8897 stack slot, and as a result function stack frames are larger.
8901 Enable CFG-sensitive rematerialization in LRA. Instead of loading
8902 values of spilled pseudos, LRA tries to rematerialize (recalculate)
8903 values if it is profitable.
8905 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8907 @item -fdelayed-branch
8908 @opindex fdelayed-branch
8909 If supported for the target machine, attempt to reorder instructions
8910 to exploit instruction slots available after delayed branch
8913 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
8914 but not at @option{-Og}.
8916 @item -fschedule-insns
8917 @opindex fschedule-insns
8918 If supported for the target machine, attempt to reorder instructions to
8919 eliminate execution stalls due to required data being unavailable. This
8920 helps machines that have slow floating point or memory load instructions
8921 by allowing other instructions to be issued until the result of the load
8922 or floating-point instruction is required.
8924 Enabled at levels @option{-O2}, @option{-O3}.
8926 @item -fschedule-insns2
8927 @opindex fschedule-insns2
8928 Similar to @option{-fschedule-insns}, but requests an additional pass of
8929 instruction scheduling after register allocation has been done. This is
8930 especially useful on machines with a relatively small number of
8931 registers and where memory load instructions take more than one cycle.
8933 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8935 @item -fno-sched-interblock
8936 @opindex fno-sched-interblock
8937 @opindex fsched-interblock
8938 Disable instruction scheduling across basic blocks, which
8939 is normally enabled when scheduling before register allocation, i.e.@:
8940 with @option{-fschedule-insns} or at @option{-O2} or higher.
8942 @item -fno-sched-spec
8943 @opindex fno-sched-spec
8944 @opindex fsched-spec
8945 Disable speculative motion of non-load instructions, 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 -fsched-pressure
8950 @opindex fsched-pressure
8951 Enable register pressure sensitive insn scheduling before register
8952 allocation. This only makes sense when scheduling before register
8953 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
8954 @option{-O2} or higher. Usage of this option can improve the
8955 generated code and decrease its size by preventing register pressure
8956 increase above the number of available hard registers and subsequent
8957 spills in register allocation.
8959 @item -fsched-spec-load
8960 @opindex fsched-spec-load
8961 Allow speculative motion of some load instructions. This only makes
8962 sense when scheduling before register allocation, i.e.@: with
8963 @option{-fschedule-insns} or at @option{-O2} or higher.
8965 @item -fsched-spec-load-dangerous
8966 @opindex fsched-spec-load-dangerous
8967 Allow speculative motion of more load instructions. This only makes
8968 sense when scheduling before register allocation, i.e.@: with
8969 @option{-fschedule-insns} or at @option{-O2} or higher.
8971 @item -fsched-stalled-insns
8972 @itemx -fsched-stalled-insns=@var{n}
8973 @opindex fsched-stalled-insns
8974 Define how many insns (if any) can be moved prematurely from the queue
8975 of stalled insns into the ready list during the second scheduling pass.
8976 @option{-fno-sched-stalled-insns} means that no insns are moved
8977 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
8978 on how many queued insns can be moved prematurely.
8979 @option{-fsched-stalled-insns} without a value is equivalent to
8980 @option{-fsched-stalled-insns=1}.
8982 @item -fsched-stalled-insns-dep
8983 @itemx -fsched-stalled-insns-dep=@var{n}
8984 @opindex fsched-stalled-insns-dep
8985 Define how many insn groups (cycles) are examined for a dependency
8986 on a stalled insn that is a candidate for premature removal from the queue
8987 of stalled insns. This has an effect only during the second scheduling pass,
8988 and only if @option{-fsched-stalled-insns} is used.
8989 @option{-fno-sched-stalled-insns-dep} is equivalent to
8990 @option{-fsched-stalled-insns-dep=0}.
8991 @option{-fsched-stalled-insns-dep} without a value is equivalent to
8992 @option{-fsched-stalled-insns-dep=1}.
8994 @item -fsched2-use-superblocks
8995 @opindex fsched2-use-superblocks
8996 When scheduling after register allocation, use superblock scheduling.
8997 This allows motion across basic block boundaries,
8998 resulting in faster schedules. This option is experimental, as not all machine
8999 descriptions used by GCC model the CPU closely enough to avoid unreliable
9000 results from the algorithm.
9002 This only makes sense when scheduling after register allocation, i.e.@: with
9003 @option{-fschedule-insns2} or at @option{-O2} or higher.
9005 @item -fsched-group-heuristic
9006 @opindex fsched-group-heuristic
9007 Enable the group heuristic in the scheduler. This heuristic favors
9008 the instruction that belongs to a schedule group. This is enabled
9009 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9010 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9012 @item -fsched-critical-path-heuristic
9013 @opindex fsched-critical-path-heuristic
9014 Enable the critical-path heuristic in the scheduler. This heuristic favors
9015 instructions on the critical path. This is enabled by default when
9016 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9017 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9019 @item -fsched-spec-insn-heuristic
9020 @opindex fsched-spec-insn-heuristic
9021 Enable the speculative instruction heuristic in the scheduler. This
9022 heuristic favors speculative instructions with greater dependency weakness.
9023 This is enabled by default when scheduling is enabled, i.e.@:
9024 with @option{-fschedule-insns} or @option{-fschedule-insns2}
9025 or at @option{-O2} or higher.
9027 @item -fsched-rank-heuristic
9028 @opindex fsched-rank-heuristic
9029 Enable the rank heuristic in the scheduler. This heuristic favors
9030 the instruction belonging to a basic block with greater size or frequency.
9031 This is enabled by default when scheduling is enabled, i.e.@:
9032 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9033 at @option{-O2} or higher.
9035 @item -fsched-last-insn-heuristic
9036 @opindex fsched-last-insn-heuristic
9037 Enable the last-instruction heuristic in the scheduler. This heuristic
9038 favors the instruction that is less dependent on the last instruction
9039 scheduled. This is enabled by default when scheduling is enabled,
9040 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9041 at @option{-O2} or higher.
9043 @item -fsched-dep-count-heuristic
9044 @opindex fsched-dep-count-heuristic
9045 Enable the dependent-count heuristic in the scheduler. This heuristic
9046 favors the instruction that has more instructions depending on it.
9047 This is enabled by default when scheduling is enabled, i.e.@:
9048 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9049 at @option{-O2} or higher.
9051 @item -freschedule-modulo-scheduled-loops
9052 @opindex freschedule-modulo-scheduled-loops
9053 Modulo scheduling is performed before traditional scheduling. If a loop
9054 is modulo scheduled, later scheduling passes may change its schedule.
9055 Use this option to control that behavior.
9057 @item -fselective-scheduling
9058 @opindex fselective-scheduling
9059 Schedule instructions using selective scheduling algorithm. Selective
9060 scheduling runs instead of the first scheduler pass.
9062 @item -fselective-scheduling2
9063 @opindex fselective-scheduling2
9064 Schedule instructions using selective scheduling algorithm. Selective
9065 scheduling runs instead of the second scheduler pass.
9067 @item -fsel-sched-pipelining
9068 @opindex fsel-sched-pipelining
9069 Enable software pipelining of innermost loops during selective scheduling.
9070 This option has no effect unless one of @option{-fselective-scheduling} or
9071 @option{-fselective-scheduling2} is turned on.
9073 @item -fsel-sched-pipelining-outer-loops
9074 @opindex fsel-sched-pipelining-outer-loops
9075 When pipelining loops during selective scheduling, also pipeline outer loops.
9076 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
9078 @item -fsemantic-interposition
9079 @opindex fsemantic-interposition
9080 Some object formats, like ELF, allow interposing of symbols by the
9082 This means that for symbols exported from the DSO, the compiler cannot perform
9083 interprocedural propagation, inlining and other optimizations in anticipation
9084 that the function or variable in question may change. While this feature is
9085 useful, for example, to rewrite memory allocation functions by a debugging
9086 implementation, it is expensive in the terms of code quality.
9087 With @option{-fno-semantic-interposition} the compiler assumes that
9088 if interposition happens for functions the overwriting function will have
9089 precisely the same semantics (and side effects).
9090 Similarly if interposition happens
9091 for variables, the constructor of the variable will be the same. The flag
9092 has no effect for functions explicitly declared inline
9093 (where it is never allowed for interposition to change semantics)
9094 and for symbols explicitly declared weak.
9097 @opindex fshrink-wrap
9098 Emit function prologues only before parts of the function that need it,
9099 rather than at the top of the function. This flag is enabled by default at
9100 @option{-O} and higher.
9102 @item -fshrink-wrap-separate
9103 @opindex fshrink-wrap-separate
9104 Shrink-wrap separate parts of the prologue and epilogue separately, so that
9105 those parts are only executed when needed.
9106 This option is on by default, but has no effect unless @option{-fshrink-wrap}
9107 is also turned on and the target supports this.
9109 @item -fcaller-saves
9110 @opindex fcaller-saves
9111 Enable allocation of values to registers that are clobbered by
9112 function calls, by emitting extra instructions to save and restore the
9113 registers around such calls. Such allocation is done only when it
9114 seems to result in better code.
9116 This option is always enabled by default on certain machines, usually
9117 those which have no call-preserved registers to use instead.
9119 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9121 @item -fcombine-stack-adjustments
9122 @opindex fcombine-stack-adjustments
9123 Tracks stack adjustments (pushes and pops) and stack memory references
9124 and then tries to find ways to combine them.
9126 Enabled by default at @option{-O1} and higher.
9130 Use caller save registers for allocation if those registers are not used by
9131 any called function. In that case it is not necessary to save and restore
9132 them around calls. This is only possible if called functions are part of
9133 same compilation unit as current function and they are compiled before it.
9135 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
9136 is disabled if generated code will be instrumented for profiling
9137 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
9138 exactly (this happens on targets that do not expose prologues
9139 and epilogues in RTL).
9141 @item -fconserve-stack
9142 @opindex fconserve-stack
9143 Attempt to minimize stack usage. The compiler attempts to use less
9144 stack space, even if that makes the program slower. This option
9145 implies setting the @option{large-stack-frame} parameter to 100
9146 and the @option{large-stack-frame-growth} parameter to 400.
9148 @item -ftree-reassoc
9149 @opindex ftree-reassoc
9150 Perform reassociation on trees. This flag is enabled by default
9151 at @option{-O} and higher.
9153 @item -fcode-hoisting
9154 @opindex fcode-hoisting
9155 Perform code hoisting. Code hoisting tries to move the
9156 evaluation of expressions executed on all paths to the function exit
9157 as early as possible. This is especially useful as a code size
9158 optimization, but it often helps for code speed as well.
9159 This flag is enabled by default at @option{-O2} and higher.
9163 Perform partial redundancy elimination (PRE) on trees. This flag is
9164 enabled by default at @option{-O2} and @option{-O3}.
9166 @item -ftree-partial-pre
9167 @opindex ftree-partial-pre
9168 Make partial redundancy elimination (PRE) more aggressive. This flag is
9169 enabled by default at @option{-O3}.
9171 @item -ftree-forwprop
9172 @opindex ftree-forwprop
9173 Perform forward propagation on trees. This flag is enabled by default
9174 at @option{-O} and higher.
9178 Perform full redundancy elimination (FRE) on trees. The difference
9179 between FRE and PRE is that FRE only considers expressions
9180 that are computed on all paths leading to the redundant computation.
9181 This analysis is faster than PRE, though it exposes fewer redundancies.
9182 This flag is enabled by default at @option{-O} and higher.
9184 @item -ftree-phiprop
9185 @opindex ftree-phiprop
9186 Perform hoisting of loads from conditional pointers on trees. This
9187 pass is enabled by default at @option{-O} and higher.
9189 @item -fhoist-adjacent-loads
9190 @opindex fhoist-adjacent-loads
9191 Speculatively hoist loads from both branches of an if-then-else if the
9192 loads are from adjacent locations in the same structure and the target
9193 architecture has a conditional move instruction. This flag is enabled
9194 by default at @option{-O2} and higher.
9196 @item -ftree-copy-prop
9197 @opindex ftree-copy-prop
9198 Perform copy propagation on trees. This pass eliminates unnecessary
9199 copy operations. This flag is enabled by default at @option{-O} and
9202 @item -fipa-pure-const
9203 @opindex fipa-pure-const
9204 Discover which functions are pure or constant.
9205 Enabled by default at @option{-O} and higher.
9207 @item -fipa-reference
9208 @opindex fipa-reference
9209 Discover which static variables do not escape the
9211 Enabled by default at @option{-O} and higher.
9213 @item -fipa-reference-addressable
9214 @opindex fipa-reference-addressable
9215 Discover read-only, write-only and non-addressable static variables.
9216 Enabled by default at @option{-O} and higher.
9218 @item -fipa-stack-alignment
9219 @opindex fipa-stack-alignment
9220 Reduce stack alignment on call sites if possible.
9225 Perform interprocedural pointer analysis and interprocedural modification
9226 and reference analysis. This option can cause excessive memory and
9227 compile-time usage on large compilation units. It is not enabled by
9228 default at any optimization level.
9231 @opindex fipa-profile
9232 Perform interprocedural profile propagation. The functions called only from
9233 cold functions are marked as cold. Also functions executed once (such as
9234 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
9235 functions and loop less parts of functions executed once are then optimized for
9237 Enabled by default at @option{-O} and higher.
9241 Perform interprocedural constant propagation.
9242 This optimization analyzes the program to determine when values passed
9243 to functions are constants and then optimizes accordingly.
9244 This optimization can substantially increase performance
9245 if the application has constants passed to functions.
9246 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
9247 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9249 @item -fipa-cp-clone
9250 @opindex fipa-cp-clone
9251 Perform function cloning to make interprocedural constant propagation stronger.
9252 When enabled, interprocedural constant propagation performs function cloning
9253 when externally visible function can be called with constant arguments.
9254 Because this optimization can create multiple copies of functions,
9255 it may significantly increase code size
9256 (see @option{--param ipcp-unit-growth=@var{value}}).
9257 This flag is enabled by default at @option{-O3}.
9258 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9261 @opindex fipa-bit-cp
9262 When enabled, perform interprocedural bitwise constant
9263 propagation. This flag is enabled by default at @option{-O2} and
9264 by @option{-fprofile-use} and @option{-fauto-profile}.
9265 It requires that @option{-fipa-cp} is enabled.
9269 When enabled, perform interprocedural propagation of value
9270 ranges. This flag is enabled by default at @option{-O2}. It requires
9271 that @option{-fipa-cp} is enabled.
9275 Perform Identical Code Folding for functions and read-only variables.
9276 The optimization reduces code size and may disturb unwind stacks by replacing
9277 a function by equivalent one with a different name. The optimization works
9278 more effectively with link-time optimization enabled.
9280 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
9281 works on different levels and thus the optimizations are not same - there are
9282 equivalences that are found only by GCC and equivalences found only by Gold.
9284 This flag is enabled by default at @option{-O2} and @option{-Os}.
9286 @item -fisolate-erroneous-paths-dereference
9287 @opindex fisolate-erroneous-paths-dereference
9288 Detect paths that trigger erroneous or undefined behavior due to
9289 dereferencing a null pointer. Isolate those paths from the main control
9290 flow and turn the statement with erroneous or undefined behavior into a trap.
9291 This flag is enabled by default at @option{-O2} and higher and depends on
9292 @option{-fdelete-null-pointer-checks} also being enabled.
9294 @item -fisolate-erroneous-paths-attribute
9295 @opindex fisolate-erroneous-paths-attribute
9296 Detect paths that trigger erroneous or undefined behavior due to a null value
9297 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
9298 attribute. Isolate those paths from the main control flow and turn the
9299 statement with erroneous or undefined behavior into a trap. This is not
9300 currently enabled, but may be enabled by @option{-O2} in the future.
9304 Perform forward store motion on trees. This flag is
9305 enabled by default at @option{-O} and higher.
9307 @item -ftree-bit-ccp
9308 @opindex ftree-bit-ccp
9309 Perform sparse conditional bit constant propagation on trees and propagate
9310 pointer alignment information.
9311 This pass only operates on local scalar variables and is enabled by default
9312 at @option{-O1} and higher, except for @option{-Og}.
9313 It requires that @option{-ftree-ccp} is enabled.
9317 Perform sparse conditional constant propagation (CCP) on trees. This
9318 pass only operates on local scalar variables and is enabled by default
9319 at @option{-O} and higher.
9321 @item -fssa-backprop
9322 @opindex fssa-backprop
9323 Propagate information about uses of a value up the definition chain
9324 in order to simplify the definitions. For example, this pass strips
9325 sign operations if the sign of a value never matters. The flag is
9326 enabled by default at @option{-O} and higher.
9329 @opindex fssa-phiopt
9330 Perform pattern matching on SSA PHI nodes to optimize conditional
9331 code. This pass is enabled by default at @option{-O1} and higher,
9332 except for @option{-Og}.
9334 @item -ftree-switch-conversion
9335 @opindex ftree-switch-conversion
9336 Perform conversion of simple initializations in a switch to
9337 initializations from a scalar array. This flag is enabled by default
9338 at @option{-O2} and higher.
9340 @item -ftree-tail-merge
9341 @opindex ftree-tail-merge
9342 Look for identical code sequences. When found, replace one with a jump to the
9343 other. This optimization is known as tail merging or cross jumping. This flag
9344 is enabled by default at @option{-O2} and higher. The compilation time
9346 be limited using @option{max-tail-merge-comparisons} parameter and
9347 @option{max-tail-merge-iterations} parameter.
9351 Perform dead code elimination (DCE) on trees. This flag is enabled by
9352 default at @option{-O} and higher.
9354 @item -ftree-builtin-call-dce
9355 @opindex ftree-builtin-call-dce
9356 Perform conditional dead code elimination (DCE) for calls to built-in functions
9357 that may set @code{errno} but are otherwise free of side effects. This flag is
9358 enabled by default at @option{-O2} and higher if @option{-Os} is not also
9361 @item -ftree-dominator-opts
9362 @opindex ftree-dominator-opts
9363 Perform a variety of simple scalar cleanups (constant/copy
9364 propagation, redundancy elimination, range propagation and expression
9365 simplification) based on a dominator tree traversal. This also
9366 performs jump threading (to reduce jumps to jumps). This flag is
9367 enabled by default at @option{-O} and higher.
9371 Perform dead store elimination (DSE) on trees. A dead store is a store into
9372 a memory location that is later overwritten by another store without
9373 any intervening loads. In this case the earlier store can be deleted. This
9374 flag is enabled by default at @option{-O} and higher.
9378 Perform loop header copying on trees. This is beneficial since it increases
9379 effectiveness of code motion optimizations. It also saves one jump. This flag
9380 is enabled by default at @option{-O} and higher. It is not enabled
9381 for @option{-Os}, since it usually increases code size.
9383 @item -ftree-loop-optimize
9384 @opindex ftree-loop-optimize
9385 Perform loop optimizations on trees. This flag is enabled by default
9386 at @option{-O} and higher.
9388 @item -ftree-loop-linear
9389 @itemx -floop-strip-mine
9391 @opindex ftree-loop-linear
9392 @opindex floop-strip-mine
9393 @opindex floop-block
9394 Perform loop nest optimizations. Same as
9395 @option{-floop-nest-optimize}. To use this code transformation, GCC has
9396 to be configured with @option{--with-isl} to enable the Graphite loop
9397 transformation infrastructure.
9399 @item -fgraphite-identity
9400 @opindex fgraphite-identity
9401 Enable the identity transformation for graphite. For every SCoP we generate
9402 the polyhedral representation and transform it back to gimple. Using
9403 @option{-fgraphite-identity} we can check the costs or benefits of the
9404 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
9405 are also performed by the code generator isl, like index splitting and
9406 dead code elimination in loops.
9408 @item -floop-nest-optimize
9409 @opindex floop-nest-optimize
9410 Enable the isl based loop nest optimizer. This is a generic loop nest
9411 optimizer based on the Pluto optimization algorithms. It calculates a loop
9412 structure optimized for data-locality and parallelism. This option
9415 @item -floop-parallelize-all
9416 @opindex floop-parallelize-all
9417 Use the Graphite data dependence analysis to identify loops that can
9418 be parallelized. Parallelize all the loops that can be analyzed to
9419 not contain loop carried dependences without checking that it is
9420 profitable to parallelize the loops.
9422 @item -ftree-coalesce-vars
9423 @opindex ftree-coalesce-vars
9424 While transforming the program out of the SSA representation, attempt to
9425 reduce copying by coalescing versions of different user-defined
9426 variables, instead of just compiler temporaries. This may severely
9427 limit the ability to debug an optimized program compiled with
9428 @option{-fno-var-tracking-assignments}. In the negated form, this flag
9429 prevents SSA coalescing of user variables. This option is enabled by
9430 default if optimization is enabled, and it does very little otherwise.
9432 @item -ftree-loop-if-convert
9433 @opindex ftree-loop-if-convert
9434 Attempt to transform conditional jumps in the innermost loops to
9435 branch-less equivalents. The intent is to remove control-flow from
9436 the innermost loops in order to improve the ability of the
9437 vectorization pass to handle these loops. This is enabled by default
9438 if vectorization is enabled.
9440 @item -ftree-loop-distribution
9441 @opindex ftree-loop-distribution
9442 Perform loop distribution. This flag can improve cache performance on
9443 big loop bodies and allow further loop optimizations, like
9444 parallelization or vectorization, to take place. For example, the loop
9461 @item -ftree-loop-distribute-patterns
9462 @opindex ftree-loop-distribute-patterns
9463 Perform loop distribution of patterns that can be code generated with
9464 calls to a library. This flag is enabled by default at @option{-O3}, and
9465 by @option{-fprofile-use} and @option{-fauto-profile}.
9467 This pass distributes the initialization loops and generates a call to
9468 memset zero. For example, the loop
9484 and the initialization loop is transformed into a call to memset zero.
9486 @item -floop-interchange
9487 @opindex floop-interchange
9488 Perform loop interchange outside of graphite. This flag can improve cache
9489 performance on loop nest and allow further loop optimizations, like
9490 vectorization, to take place. For example, the loop
9492 for (int i = 0; i < N; i++)
9493 for (int j = 0; j < N; j++)
9494 for (int k = 0; k < N; k++)
9495 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9499 for (int i = 0; i < N; i++)
9500 for (int k = 0; k < N; k++)
9501 for (int j = 0; j < N; j++)
9502 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9504 This flag is enabled by default at @option{-O3}.
9506 @item -floop-unroll-and-jam
9507 @opindex floop-unroll-and-jam
9508 Apply unroll and jam transformations on feasible loops. In a loop
9509 nest this unrolls the outer loop by some factor and fuses the resulting
9510 multiple inner loops. This flag is enabled by default at @option{-O3}.
9512 @item -ftree-loop-im
9513 @opindex ftree-loop-im
9514 Perform loop invariant motion on trees. This pass moves only invariants that
9515 are hard to handle at RTL level (function calls, operations that expand to
9516 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9517 operands of conditions that are invariant out of the loop, so that we can use
9518 just trivial invariantness analysis in loop unswitching. The pass also includes
9521 @item -ftree-loop-ivcanon
9522 @opindex ftree-loop-ivcanon
9523 Create a canonical counter for number of iterations in loops for which
9524 determining number of iterations requires complicated analysis. Later
9525 optimizations then may determine the number easily. Useful especially
9526 in connection with unrolling.
9528 @item -ftree-scev-cprop
9529 @opindex ftree-scev-cprop
9530 Perform final value replacement. If a variable is modified in a loop
9531 in such a way that its value when exiting the loop can be determined using
9532 only its initial value and the number of loop iterations, replace uses of
9533 the final value by such a computation, provided it is sufficiently cheap.
9534 This reduces data dependencies and may allow further simplifications.
9535 Enabled by default at @option{-O} and higher.
9539 Perform induction variable optimizations (strength reduction, induction
9540 variable merging and induction variable elimination) on trees.
9542 @item -ftree-parallelize-loops=n
9543 @opindex ftree-parallelize-loops
9544 Parallelize loops, i.e., split their iteration space to run in n threads.
9545 This is only possible for loops whose iterations are independent
9546 and can be arbitrarily reordered. The optimization is only
9547 profitable on multiprocessor machines, for loops that are CPU-intensive,
9548 rather than constrained e.g.@: by memory bandwidth. This option
9549 implies @option{-pthread}, and thus is only supported on targets
9550 that have support for @option{-pthread}.
9554 Perform function-local points-to analysis on trees. This flag is
9555 enabled by default at @option{-O1} and higher, except for @option{-Og}.
9559 Perform scalar replacement of aggregates. This pass replaces structure
9560 references with scalars to prevent committing structures to memory too
9561 early. This flag is enabled by default at @option{-O1} and higher,
9562 except for @option{-Og}.
9564 @item -fstore-merging
9565 @opindex fstore-merging
9566 Perform merging of narrow stores to consecutive memory addresses. This pass
9567 merges contiguous stores of immediate values narrower than a word into fewer
9568 wider stores to reduce the number of instructions. This is enabled by default
9569 at @option{-O2} and higher as well as @option{-Os}.
9573 Perform temporary expression replacement during the SSA->normal phase. Single
9574 use/single def temporaries are replaced at their use location with their
9575 defining expression. This results in non-GIMPLE code, but gives the expanders
9576 much more complex trees to work on resulting in better RTL generation. This is
9577 enabled by default at @option{-O} and higher.
9581 Perform straight-line strength reduction on trees. This recognizes related
9582 expressions involving multiplications and replaces them by less expensive
9583 calculations when possible. This is enabled by default at @option{-O} and
9586 @item -ftree-vectorize
9587 @opindex ftree-vectorize
9588 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9589 and @option{-ftree-slp-vectorize} if not explicitly specified.
9591 @item -ftree-loop-vectorize
9592 @opindex ftree-loop-vectorize
9593 Perform loop vectorization on trees. This flag is enabled by default at
9594 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9595 and @option{-fauto-profile}.
9597 @item -ftree-slp-vectorize
9598 @opindex ftree-slp-vectorize
9599 Perform basic block vectorization on trees. This flag is enabled by default at
9600 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9601 and @option{-fauto-profile}.
9603 @item -fvect-cost-model=@var{model}
9604 @opindex fvect-cost-model
9605 Alter the cost model used for vectorization. The @var{model} argument
9606 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9607 With the @samp{unlimited} model the vectorized code-path is assumed
9608 to be profitable while with the @samp{dynamic} model a runtime check
9609 guards the vectorized code-path to enable it only for iteration
9610 counts that will likely execute faster than when executing the original
9611 scalar loop. The @samp{cheap} model disables vectorization of
9612 loops where doing so would be cost prohibitive for example due to
9613 required runtime checks for data dependence or alignment but otherwise
9614 is equal to the @samp{dynamic} model.
9615 The default cost model depends on other optimization flags and is
9616 either @samp{dynamic} or @samp{cheap}.
9618 @item -fsimd-cost-model=@var{model}
9619 @opindex fsimd-cost-model
9620 Alter the cost model used for vectorization of loops marked with the OpenMP
9621 simd directive. The @var{model} argument should be one of
9622 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9623 have the same meaning as described in @option{-fvect-cost-model} and by
9624 default a cost model defined with @option{-fvect-cost-model} is used.
9628 Perform Value Range Propagation on trees. This is similar to the
9629 constant propagation pass, but instead of values, ranges of values are
9630 propagated. This allows the optimizers to remove unnecessary range
9631 checks like array bound checks and null pointer checks. This is
9632 enabled by default at @option{-O2} and higher. Null pointer check
9633 elimination is only done if @option{-fdelete-null-pointer-checks} is
9637 @opindex fsplit-paths
9638 Split paths leading to loop backedges. This can improve dead code
9639 elimination and common subexpression elimination. This is enabled by
9640 default at @option{-O2} and above.
9642 @item -fsplit-ivs-in-unroller
9643 @opindex fsplit-ivs-in-unroller
9644 Enables expression of values of induction variables in later iterations
9645 of the unrolled loop using the value in the first iteration. This breaks
9646 long dependency chains, thus improving efficiency of the scheduling passes.
9648 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9649 same effect. However, that is not reliable in cases where the loop body
9650 is more complicated than a single basic block. It also does not work at all
9651 on some architectures due to restrictions in the CSE pass.
9653 This optimization is enabled by default.
9655 @item -fvariable-expansion-in-unroller
9656 @opindex fvariable-expansion-in-unroller
9657 With this option, the compiler creates multiple copies of some
9658 local variables when unrolling a loop, which can result in superior code.
9660 @item -fpartial-inlining
9661 @opindex fpartial-inlining
9662 Inline parts of functions. This option has any effect only
9663 when inlining itself is turned on by the @option{-finline-functions}
9664 or @option{-finline-small-functions} options.
9666 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9668 @item -fpredictive-commoning
9669 @opindex fpredictive-commoning
9670 Perform predictive commoning optimization, i.e., reusing computations
9671 (especially memory loads and stores) performed in previous
9672 iterations of loops.
9674 This option is enabled at level @option{-O3}.
9675 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9677 @item -fprefetch-loop-arrays
9678 @opindex fprefetch-loop-arrays
9679 If supported by the target machine, generate instructions to prefetch
9680 memory to improve the performance of loops that access large arrays.
9682 This option may generate better or worse code; results are highly
9683 dependent on the structure of loops within the source code.
9685 Disabled at level @option{-Os}.
9687 @item -fno-printf-return-value
9688 @opindex fno-printf-return-value
9689 @opindex fprintf-return-value
9690 Do not substitute constants for known return value of formatted output
9691 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9692 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9693 transformation allows GCC to optimize or even eliminate branches based
9694 on the known return value of these functions called with arguments that
9695 are either constant, or whose values are known to be in a range that
9696 makes determining the exact return value possible. For example, when
9697 @option{-fprintf-return-value} is in effect, both the branch and the
9698 body of the @code{if} statement (but not the call to @code{snprint})
9699 can be optimized away when @code{i} is a 32-bit or smaller integer
9700 because the return value is guaranteed to be at most 8.
9704 if (snprintf (buf, "%08x", i) >= sizeof buf)
9708 The @option{-fprintf-return-value} option relies on other optimizations
9709 and yields best results with @option{-O2} and above. It works in tandem
9710 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9711 options. The @option{-fprintf-return-value} option is enabled by default.
9714 @itemx -fno-peephole2
9715 @opindex fno-peephole
9717 @opindex fno-peephole2
9719 Disable any machine-specific peephole optimizations. The difference
9720 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9721 are implemented in the compiler; some targets use one, some use the
9722 other, a few use both.
9724 @option{-fpeephole} is enabled by default.
9725 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9727 @item -fno-guess-branch-probability
9728 @opindex fno-guess-branch-probability
9729 @opindex fguess-branch-probability
9730 Do not guess branch probabilities using heuristics.
9732 GCC uses heuristics to guess branch probabilities if they are
9733 not provided by profiling feedback (@option{-fprofile-arcs}). These
9734 heuristics are based on the control flow graph. If some branch probabilities
9735 are specified by @code{__builtin_expect}, then the heuristics are
9736 used to guess branch probabilities for the rest of the control flow graph,
9737 taking the @code{__builtin_expect} info into account. The interactions
9738 between the heuristics and @code{__builtin_expect} can be complex, and in
9739 some cases, it may be useful to disable the heuristics so that the effects
9740 of @code{__builtin_expect} are easier to understand.
9742 It is also possible to specify expected probability of the expression
9743 with @code{__builtin_expect_with_probability} built-in function.
9745 The default is @option{-fguess-branch-probability} at levels
9746 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9748 @item -freorder-blocks
9749 @opindex freorder-blocks
9750 Reorder basic blocks in the compiled function in order to reduce number of
9751 taken branches and improve code locality.
9753 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9755 @item -freorder-blocks-algorithm=@var{algorithm}
9756 @opindex freorder-blocks-algorithm
9757 Use the specified algorithm for basic block reordering. The
9758 @var{algorithm} argument can be @samp{simple}, which does not increase
9759 code size (except sometimes due to secondary effects like alignment),
9760 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9761 put all often executed code together, minimizing the number of branches
9762 executed by making extra copies of code.
9764 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9765 @samp{stc} at levels @option{-O2}, @option{-O3}.
9767 @item -freorder-blocks-and-partition
9768 @opindex freorder-blocks-and-partition
9769 In addition to reordering basic blocks in the compiled function, in order
9770 to reduce number of taken branches, partitions hot and cold basic blocks
9771 into separate sections of the assembly and @file{.o} files, to improve
9772 paging and cache locality performance.
9774 This optimization is automatically turned off in the presence of
9775 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
9776 section attribute and on any architecture that does not support named
9777 sections. When @option{-fsplit-stack} is used this option is not
9778 enabled by default (to avoid linker errors), but may be enabled
9779 explicitly (if using a working linker).
9781 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
9783 @item -freorder-functions
9784 @opindex freorder-functions
9785 Reorder functions in the object file in order to
9786 improve code locality. This is implemented by using special
9787 subsections @code{.text.hot} for most frequently executed functions and
9788 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
9789 the linker so object file format must support named sections and linker must
9790 place them in a reasonable way.
9792 Also profile feedback must be available to make this option effective. See
9793 @option{-fprofile-arcs} for details.
9795 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9797 @item -fstrict-aliasing
9798 @opindex fstrict-aliasing
9799 Allow the compiler to assume the strictest aliasing rules applicable to
9800 the language being compiled. For C (and C++), this activates
9801 optimizations based on the type of expressions. In particular, an
9802 object of one type is assumed never to reside at the same address as an
9803 object of a different type, unless the types are almost the same. For
9804 example, an @code{unsigned int} can alias an @code{int}, but not a
9805 @code{void*} or a @code{double}. A character type may alias any other
9808 @anchor{Type-punning}Pay special attention to code like this:
9821 The practice of reading from a different union member than the one most
9822 recently written to (called ``type-punning'') is common. Even with
9823 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
9824 is accessed through the union type. So, the code above works as
9825 expected. @xref{Structures unions enumerations and bit-fields
9826 implementation}. However, this code might not:
9837 Similarly, access by taking the address, casting the resulting pointer
9838 and dereferencing the result has undefined behavior, even if the cast
9839 uses a union type, e.g.:
9843 return ((union a_union *) &d)->i;
9847 The @option{-fstrict-aliasing} option is enabled at levels
9848 @option{-O2}, @option{-O3}, @option{-Os}.
9850 @item -falign-functions
9851 @itemx -falign-functions=@var{n}
9852 @itemx -falign-functions=@var{n}:@var{m}
9853 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
9854 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
9855 @opindex falign-functions
9856 Align the start of functions to the next power-of-two greater than
9857 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
9858 the first @var{m} bytes of the function can be fetched by the CPU
9859 without crossing an @var{n}-byte alignment boundary.
9861 If @var{m} is not specified, it defaults to @var{n}.
9863 Examples: @option{-falign-functions=32} aligns functions to the next
9864 32-byte boundary, @option{-falign-functions=24} aligns to the next
9865 32-byte boundary only if this can be done by skipping 23 bytes or less,
9866 @option{-falign-functions=32:7} aligns to the next
9867 32-byte boundary only if this can be done by skipping 6 bytes or less.
9869 The second pair of @var{n2}:@var{m2} values allows you to specify
9870 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
9871 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
9872 otherwise aligns to the next 32-byte boundary if this can be done
9873 by skipping 2 bytes or less.
9874 If @var{m2} is not specified, it defaults to @var{n2}.
9876 Some assemblers only support this flag when @var{n} is a power of two;
9877 in that case, it is rounded up.
9879 @option{-fno-align-functions} and @option{-falign-functions=1} are
9880 equivalent and mean that functions are not aligned.
9882 If @var{n} is not specified or is zero, use a machine-dependent default.
9883 The maximum allowed @var{n} option value is 65536.
9885 Enabled at levels @option{-O2}, @option{-O3}.
9887 @item -flimit-function-alignment
9888 If this option is enabled, the compiler tries to avoid unnecessarily
9889 overaligning functions. It attempts to instruct the assembler to align
9890 by the amount specified by @option{-falign-functions}, but not to
9891 skip more bytes than the size of the function.
9893 @item -falign-labels
9894 @itemx -falign-labels=@var{n}
9895 @itemx -falign-labels=@var{n}:@var{m}
9896 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
9897 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
9898 @opindex falign-labels
9899 Align all branch targets to a power-of-two boundary.
9901 Parameters of this option are analogous to the @option{-falign-functions} option.
9902 @option{-fno-align-labels} and @option{-falign-labels=1} are
9903 equivalent and mean that labels are not aligned.
9905 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
9906 are greater than this value, then their values are used instead.
9908 If @var{n} is not specified or is zero, use a machine-dependent default
9909 which is very likely to be @samp{1}, meaning no alignment.
9910 The maximum allowed @var{n} option value is 65536.
9912 Enabled at levels @option{-O2}, @option{-O3}.
9915 @itemx -falign-loops=@var{n}
9916 @itemx -falign-loops=@var{n}:@var{m}
9917 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
9918 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
9919 @opindex falign-loops
9920 Align loops to a power-of-two boundary. If the loops are executed
9921 many times, this makes up for any execution of the dummy padding
9924 Parameters of this option are analogous to the @option{-falign-functions} option.
9925 @option{-fno-align-loops} and @option{-falign-loops=1} are
9926 equivalent and mean that loops are not aligned.
9927 The maximum allowed @var{n} option value is 65536.
9929 If @var{n} is not specified or is zero, use a machine-dependent default.
9931 Enabled at levels @option{-O2}, @option{-O3}.
9934 @itemx -falign-jumps=@var{n}
9935 @itemx -falign-jumps=@var{n}:@var{m}
9936 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
9937 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
9938 @opindex falign-jumps
9939 Align branch targets to a power-of-two boundary, for branch targets
9940 where the targets can only be reached by jumping. In this case,
9941 no dummy operations need be executed.
9943 Parameters of this option are analogous to the @option{-falign-functions} option.
9944 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
9945 equivalent and mean that loops are not aligned.
9947 If @var{n} is not specified or is zero, use a machine-dependent default.
9948 The maximum allowed @var{n} option value is 65536.
9950 Enabled at levels @option{-O2}, @option{-O3}.
9952 @item -funit-at-a-time
9953 @opindex funit-at-a-time
9954 This option is left for compatibility reasons. @option{-funit-at-a-time}
9955 has no effect, while @option{-fno-unit-at-a-time} implies
9956 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
9960 @item -fno-toplevel-reorder
9961 @opindex fno-toplevel-reorder
9962 @opindex ftoplevel-reorder
9963 Do not reorder top-level functions, variables, and @code{asm}
9964 statements. Output them in the same order that they appear in the
9965 input file. When this option is used, unreferenced static variables
9966 are not removed. This option is intended to support existing code
9967 that relies on a particular ordering. For new code, it is better to
9968 use attributes when possible.
9970 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
9971 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
9972 Additionally @option{-fno-toplevel-reorder} implies
9973 @option{-fno-section-anchors}.
9977 Constructs webs as commonly used for register allocation purposes and assign
9978 each web individual pseudo register. This allows the register allocation pass
9979 to operate on pseudos directly, but also strengthens several other optimization
9980 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
9981 however, make debugging impossible, since variables no longer stay in a
9984 Enabled by default with @option{-funroll-loops}.
9986 @item -fwhole-program
9987 @opindex fwhole-program
9988 Assume that the current compilation unit represents the whole program being
9989 compiled. All public functions and variables with the exception of @code{main}
9990 and those merged by attribute @code{externally_visible} become static functions
9991 and in effect are optimized more aggressively by interprocedural optimizers.
9993 This option should not be used in combination with @option{-flto}.
9994 Instead relying on a linker plugin should provide safer and more precise
9997 @item -flto[=@var{n}]
9999 This option runs the standard link-time optimizer. When invoked
10000 with source code, it generates GIMPLE (one of GCC's internal
10001 representations) and writes it to special ELF sections in the object
10002 file. When the object files are linked together, all the function
10003 bodies are read from these ELF sections and instantiated as if they
10004 had been part of the same translation unit.
10006 To use the link-time optimizer, @option{-flto} and optimization
10007 options should be specified at compile time and during the final link.
10008 It is recommended that you compile all the files participating in the
10009 same link with the same options and also specify those options at
10014 gcc -c -O2 -flto foo.c
10015 gcc -c -O2 -flto bar.c
10016 gcc -o myprog -flto -O2 foo.o bar.o
10019 The first two invocations to GCC save a bytecode representation
10020 of GIMPLE into special ELF sections inside @file{foo.o} and
10021 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
10022 @file{foo.o} and @file{bar.o}, merges the two files into a single
10023 internal image, and compiles the result as usual. Since both
10024 @file{foo.o} and @file{bar.o} are merged into a single image, this
10025 causes all the interprocedural analyses and optimizations in GCC to
10026 work across the two files as if they were a single one. This means,
10027 for example, that the inliner is able to inline functions in
10028 @file{bar.o} into functions in @file{foo.o} and vice-versa.
10030 Another (simpler) way to enable link-time optimization is:
10033 gcc -o myprog -flto -O2 foo.c bar.c
10036 The above generates bytecode for @file{foo.c} and @file{bar.c},
10037 merges them together into a single GIMPLE representation and optimizes
10038 them as usual to produce @file{myprog}.
10040 The important thing to keep in mind is that to enable link-time
10041 optimizations you need to use the GCC driver to perform the link step.
10042 GCC automatically performs link-time optimization if any of the
10043 objects involved were compiled with the @option{-flto} command-line option.
10044 You can always override
10045 the automatic decision to do link-time optimization
10046 by passing @option{-fno-lto} to the link command.
10048 To make whole program optimization effective, it is necessary to make
10049 certain whole program assumptions. The compiler needs to know
10050 what functions and variables can be accessed by libraries and runtime
10051 outside of the link-time optimized unit. When supported by the linker,
10052 the linker plugin (see @option{-fuse-linker-plugin}) passes information
10053 to the compiler about used and externally visible symbols. When
10054 the linker plugin is not available, @option{-fwhole-program} should be
10055 used to allow the compiler to make these assumptions, which leads
10056 to more aggressive optimization decisions.
10058 When a file is compiled with @option{-flto} without
10059 @option{-fuse-linker-plugin}, the generated object file is larger than
10060 a regular object file because it contains GIMPLE bytecodes and the usual
10061 final code (see @option{-ffat-lto-objects}. This means that
10062 object files with LTO information can be linked as normal object
10063 files; if @option{-fno-lto} is passed to the linker, no
10064 interprocedural optimizations are applied. Note that when
10065 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
10066 but you cannot perform a regular, non-LTO link on them.
10068 When producing the final binary, GCC only
10069 applies link-time optimizations to those files that contain bytecode.
10070 Therefore, you can mix and match object files and libraries with
10071 GIMPLE bytecodes and final object code. GCC automatically selects
10072 which files to optimize in LTO mode and which files to link without
10073 further processing.
10075 Generally, options specified at link time override those
10076 specified at compile time, although in some cases GCC attempts to infer
10077 link-time options from the settings used to compile the input files.
10079 If you do not specify an optimization level option @option{-O} at
10080 link time, then GCC uses the highest optimization level
10081 used when compiling the object files. Note that it is generally
10082 ineffective to specify an optimization level option only at link time and
10083 not at compile time, for two reasons. First, compiling without
10084 optimization suppresses compiler passes that gather information
10085 needed for effective optimization at link time. Second, some early
10086 optimization passes can be performed only at compile time and
10089 There are some code generation flags preserved by GCC when
10090 generating bytecodes, as they need to be used during the final link.
10091 Currently, the following options and their settings are taken from
10092 the first object file that explicitly specifies them:
10093 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
10094 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
10095 and all the @option{-m} target flags.
10097 Certain ABI-changing flags are required to match in all compilation units,
10098 and trying to override this at link time with a conflicting value
10099 is ignored. This includes options such as @option{-freg-struct-return}
10100 and @option{-fpcc-struct-return}.
10102 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
10103 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
10104 are passed through to the link stage and merged conservatively for
10105 conflicting translation units. Specifically
10106 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
10107 precedence; and for example @option{-ffp-contract=off} takes precedence
10108 over @option{-ffp-contract=fast}. You can override them at link time.
10110 If LTO encounters objects with C linkage declared with incompatible
10111 types in separate translation units to be linked together (undefined
10112 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
10113 issued. The behavior is still undefined at run time. Similar
10114 diagnostics may be raised for other languages.
10116 Another feature of LTO is that it is possible to apply interprocedural
10117 optimizations on files written in different languages:
10121 g++ -c -flto bar.cc
10122 gfortran -c -flto baz.f90
10123 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10126 Notice that the final link is done with @command{g++} to get the C++
10127 runtime libraries and @option{-lgfortran} is added to get the Fortran
10128 runtime libraries. In general, when mixing languages in LTO mode, you
10129 should use the same link command options as when mixing languages in a
10130 regular (non-LTO) compilation.
10132 If object files containing GIMPLE bytecode are stored in a library archive, say
10133 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
10134 are using a linker with plugin support. To create static libraries suitable
10135 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
10136 and @command{ranlib};
10137 to show the symbols of object files with GIMPLE bytecode, use
10138 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
10139 and @command{nm} have been compiled with plugin support. At link time, use the
10140 flag @option{-fuse-linker-plugin} to ensure that the library participates in
10141 the LTO optimization process:
10144 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10147 With the linker plugin enabled, the linker extracts the needed
10148 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
10149 to make them part of the aggregated GIMPLE image to be optimized.
10151 If you are not using a linker with plugin support and/or do not
10152 enable the linker plugin, then the objects inside @file{libfoo.a}
10153 are extracted and linked as usual, but they do not participate
10154 in the LTO optimization process. In order to make a static library suitable
10155 for both LTO optimization and usual linkage, compile its object files with
10156 @option{-flto} @option{-ffat-lto-objects}.
10158 Link-time optimizations do not require the presence of the whole program to
10159 operate. If the program does not require any symbols to be exported, it is
10160 possible to combine @option{-flto} and @option{-fwhole-program} to allow
10161 the interprocedural optimizers to use more aggressive assumptions which may
10162 lead to improved optimization opportunities.
10163 Use of @option{-fwhole-program} is not needed when linker plugin is
10164 active (see @option{-fuse-linker-plugin}).
10166 The current implementation of LTO makes no
10167 attempt to generate bytecode that is portable between different
10168 types of hosts. The bytecode files are versioned and there is a
10169 strict version check, so bytecode files generated in one version of
10170 GCC do not work with an older or newer version of GCC.
10172 Link-time optimization does not work well with generation of debugging
10173 information on systems other than those using a combination of ELF and
10176 If you specify the optional @var{n}, the optimization and code
10177 generation done at link time is executed in parallel using @var{n}
10178 parallel jobs by utilizing an installed @command{make} program. The
10179 environment variable @env{MAKE} may be used to override the program
10180 used. The default value for @var{n} is 1.
10182 You can also specify @option{-flto=jobserver} to use GNU make's
10183 job server mode to determine the number of parallel jobs. This
10184 is useful when the Makefile calling GCC is already executing in parallel.
10185 You must prepend a @samp{+} to the command recipe in the parent Makefile
10186 for this to work. This option likely only works if @env{MAKE} is
10189 @item -flto-partition=@var{alg}
10190 @opindex flto-partition
10191 Specify the partitioning algorithm used by the link-time optimizer.
10192 The value is either @samp{1to1} to specify a partitioning mirroring
10193 the original source files or @samp{balanced} to specify partitioning
10194 into equally sized chunks (whenever possible) or @samp{max} to create
10195 new partition for every symbol where possible. Specifying @samp{none}
10196 as an algorithm disables partitioning and streaming completely.
10197 The default value is @samp{balanced}. While @samp{1to1} can be used
10198 as an workaround for various code ordering issues, the @samp{max}
10199 partitioning is intended for internal testing only.
10200 The value @samp{one} specifies that exactly one partition should be
10201 used while the value @samp{none} bypasses partitioning and executes
10202 the link-time optimization step directly from the WPA phase.
10204 @item -flto-odr-type-merging
10205 @opindex flto-odr-type-merging
10206 Enable streaming of mangled types names of C++ types and their unification
10207 at link time. This increases size of LTO object files, but enables
10208 diagnostics about One Definition Rule violations.
10210 @item -flto-compression-level=@var{n}
10211 @opindex flto-compression-level
10212 This option specifies the level of compression used for intermediate
10213 language written to LTO object files, and is only meaningful in
10214 conjunction with LTO mode (@option{-flto}). Valid
10215 values are 0 (no compression) to 9 (maximum compression). Values
10216 outside this range are clamped to either 0 or 9. If the option is not
10217 given, a default balanced compression setting is used.
10219 @item -fuse-linker-plugin
10220 @opindex fuse-linker-plugin
10221 Enables the use of a linker plugin during link-time optimization. This
10222 option relies on plugin support in the linker, which is available in gold
10223 or in GNU ld 2.21 or newer.
10225 This option enables the extraction of object files with GIMPLE bytecode out
10226 of library archives. This improves the quality of optimization by exposing
10227 more code to the link-time optimizer. This information specifies what
10228 symbols can be accessed externally (by non-LTO object or during dynamic
10229 linking). Resulting code quality improvements on binaries (and shared
10230 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
10231 See @option{-flto} for a description of the effect of this flag and how to
10234 This option is enabled by default when LTO support in GCC is enabled
10235 and GCC was configured for use with
10236 a linker supporting plugins (GNU ld 2.21 or newer or gold).
10238 @item -ffat-lto-objects
10239 @opindex ffat-lto-objects
10240 Fat LTO objects are object files that contain both the intermediate language
10241 and the object code. This makes them usable for both LTO linking and normal
10242 linking. This option is effective only when compiling with @option{-flto}
10243 and is ignored at link time.
10245 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
10246 requires the complete toolchain to be aware of LTO. It requires a linker with
10247 linker plugin support for basic functionality. Additionally,
10248 @command{nm}, @command{ar} and @command{ranlib}
10249 need to support linker plugins to allow a full-featured build environment
10250 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
10251 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
10252 to these tools. With non fat LTO makefiles need to be modified to use them.
10254 Note that modern binutils provide plugin auto-load mechanism.
10255 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
10256 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
10257 @command{gcc-ranlib}).
10259 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
10262 @item -fcompare-elim
10263 @opindex fcompare-elim
10264 After register allocation and post-register allocation instruction splitting,
10265 identify arithmetic instructions that compute processor flags similar to a
10266 comparison operation based on that arithmetic. If possible, eliminate the
10267 explicit comparison operation.
10269 This pass only applies to certain targets that cannot explicitly represent
10270 the comparison operation before register allocation is complete.
10272 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10274 @item -fcprop-registers
10275 @opindex fcprop-registers
10276 After register allocation and post-register allocation instruction splitting,
10277 perform a copy-propagation pass to try to reduce scheduling dependencies
10278 and occasionally eliminate the copy.
10280 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10282 @item -fprofile-correction
10283 @opindex fprofile-correction
10284 Profiles collected using an instrumented binary for multi-threaded programs may
10285 be inconsistent due to missed counter updates. When this option is specified,
10286 GCC uses heuristics to correct or smooth out such inconsistencies. By
10287 default, GCC emits an error message when an inconsistent profile is detected.
10289 This option is enabled by @option{-fauto-profile}.
10291 @item -fprofile-use
10292 @itemx -fprofile-use=@var{path}
10293 @opindex fprofile-use
10294 Enable profile feedback-directed optimizations,
10295 and the following optimizations, many of which
10296 are generally profitable only with profile feedback available:
10298 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10299 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10300 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10301 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10302 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10303 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10304 -fprofile-reorder-functions}
10306 Before you can use this option, you must first generate profiling information.
10307 @xref{Instrumentation Options}, for information about the
10308 @option{-fprofile-generate} option.
10310 By default, GCC emits an error message if the feedback profiles do not
10311 match the source code. This error can be turned into a warning by using
10312 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
10313 optimized code. Additionally, by default, GCC also emits a warning message if
10314 the feedback profiles do not exist (see @option{-Wmissing-profile}).
10316 If @var{path} is specified, GCC looks at the @var{path} to find
10317 the profile feedback data files. See @option{-fprofile-dir}.
10319 @item -fauto-profile
10320 @itemx -fauto-profile=@var{path}
10321 @opindex fauto-profile
10322 Enable sampling-based feedback-directed optimizations,
10323 and the following optimizations,
10324 many of which are generally profitable only with profile feedback available:
10326 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10327 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10328 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10329 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10330 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10331 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10332 -fprofile-correction}
10334 @var{path} is the name of a file containing AutoFDO profile information.
10335 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10337 Producing an AutoFDO profile data file requires running your program
10338 with the @command{perf} utility on a supported GNU/Linux target system.
10339 For more information, see @uref{https://perf.wiki.kernel.org/}.
10343 perf record -e br_inst_retired:near_taken -b -o perf.data \
10347 Then use the @command{create_gcov} tool to convert the raw profile data
10348 to a format that can be used by GCC.@ You must also supply the
10349 unstripped binary for your program to this tool.
10350 See @uref{https://github.com/google/autofdo}.
10354 create_gcov --binary=your_program.unstripped --profile=perf.data \
10355 --gcov=profile.afdo
10359 The following options control compiler behavior regarding floating-point
10360 arithmetic. These options trade off between speed and
10361 correctness. All must be specifically enabled.
10364 @item -ffloat-store
10365 @opindex ffloat-store
10366 Do not store floating-point variables in registers, and inhibit other
10367 options that might change whether a floating-point value is taken from a
10368 register or memory.
10370 @cindex floating-point precision
10371 This option prevents undesirable excess precision on machines such as
10372 the 68000 where the floating registers (of the 68881) keep more
10373 precision than a @code{double} is supposed to have. Similarly for the
10374 x86 architecture. For most programs, the excess precision does only
10375 good, but a few programs rely on the precise definition of IEEE floating
10376 point. Use @option{-ffloat-store} for such programs, after modifying
10377 them to store all pertinent intermediate computations into variables.
10379 @item -fexcess-precision=@var{style}
10380 @opindex fexcess-precision
10381 This option allows further control over excess precision on machines
10382 where floating-point operations occur in a format with more precision or
10383 range than the IEEE standard and interchange floating-point types. By
10384 default, @option{-fexcess-precision=fast} is in effect; this means that
10385 operations may be carried out in a wider precision than the types specified
10386 in the source if that would result in faster code, and it is unpredictable
10387 when rounding to the types specified in the source code takes place.
10388 When compiling C, if @option{-fexcess-precision=standard} is specified then
10389 excess precision follows the rules specified in ISO C99; in particular,
10390 both casts and assignments cause values to be rounded to their
10391 semantic types (whereas @option{-ffloat-store} only affects
10392 assignments). This option is enabled by default for C if a strict
10393 conformance option such as @option{-std=c99} is used.
10394 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10395 regardless of whether a strict conformance option is used.
10398 @option{-fexcess-precision=standard} is not implemented for languages
10399 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
10400 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10401 semantics apply without excess precision, and in the latter, rounding
10405 @opindex ffast-math
10406 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10407 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10408 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10409 @option{-fexcess-precision=fast}.
10411 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10413 This option is not turned on by any @option{-O} option besides
10414 @option{-Ofast} since it can result in incorrect output for programs
10415 that depend on an exact implementation of IEEE or ISO rules/specifications
10416 for math functions. It may, however, yield faster code for programs
10417 that do not require the guarantees of these specifications.
10419 @item -fno-math-errno
10420 @opindex fno-math-errno
10421 @opindex fmath-errno
10422 Do not set @code{errno} after calling math functions that are executed
10423 with a single instruction, e.g., @code{sqrt}. A program that relies on
10424 IEEE exceptions for math error handling may want to use this flag
10425 for speed while maintaining IEEE arithmetic compatibility.
10427 This option is not turned on by any @option{-O} option since
10428 it can result in incorrect output for programs that depend on
10429 an exact implementation of IEEE or ISO rules/specifications for
10430 math functions. It may, however, yield faster code for programs
10431 that do not require the guarantees of these specifications.
10433 The default is @option{-fmath-errno}.
10435 On Darwin systems, the math library never sets @code{errno}. There is
10436 therefore no reason for the compiler to consider the possibility that
10437 it might, and @option{-fno-math-errno} is the default.
10439 @item -funsafe-math-optimizations
10440 @opindex funsafe-math-optimizations
10442 Allow optimizations for floating-point arithmetic that (a) assume
10443 that arguments and results are valid and (b) may violate IEEE or
10444 ANSI standards. When used at link time, it may include libraries
10445 or startup files that change the default FPU control word or other
10446 similar optimizations.
10448 This option is not turned on by any @option{-O} option since
10449 it can result in incorrect output for programs that depend on
10450 an exact implementation of IEEE or ISO rules/specifications for
10451 math functions. It may, however, yield faster code for programs
10452 that do not require the guarantees of these specifications.
10453 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10454 @option{-fassociative-math} and @option{-freciprocal-math}.
10456 The default is @option{-fno-unsafe-math-optimizations}.
10458 @item -fassociative-math
10459 @opindex fassociative-math
10461 Allow re-association of operands in series of floating-point operations.
10462 This violates the ISO C and C++ language standard by possibly changing
10463 computation result. NOTE: re-ordering may change the sign of zero as
10464 well as ignore NaNs and inhibit or create underflow or overflow (and
10465 thus cannot be used on code that relies on rounding behavior like
10466 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
10467 and thus may not be used when ordered comparisons are required.
10468 This option requires that both @option{-fno-signed-zeros} and
10469 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
10470 much sense with @option{-frounding-math}. For Fortran the option
10471 is automatically enabled when both @option{-fno-signed-zeros} and
10472 @option{-fno-trapping-math} are in effect.
10474 The default is @option{-fno-associative-math}.
10476 @item -freciprocal-math
10477 @opindex freciprocal-math
10479 Allow the reciprocal of a value to be used instead of dividing by
10480 the value if this enables optimizations. For example @code{x / y}
10481 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10482 is subject to common subexpression elimination. Note that this loses
10483 precision and increases the number of flops operating on the value.
10485 The default is @option{-fno-reciprocal-math}.
10487 @item -ffinite-math-only
10488 @opindex ffinite-math-only
10489 Allow optimizations for floating-point arithmetic that assume
10490 that arguments and results are not NaNs or +-Infs.
10492 This option is not turned on by any @option{-O} option since
10493 it can result in incorrect output for programs that depend on
10494 an exact implementation of IEEE or ISO rules/specifications for
10495 math functions. It may, however, yield faster code for programs
10496 that do not require the guarantees of these specifications.
10498 The default is @option{-fno-finite-math-only}.
10500 @item -fno-signed-zeros
10501 @opindex fno-signed-zeros
10502 @opindex fsigned-zeros
10503 Allow optimizations for floating-point arithmetic that ignore the
10504 signedness of zero. IEEE arithmetic specifies the behavior of
10505 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10506 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10507 This option implies that the sign of a zero result isn't significant.
10509 The default is @option{-fsigned-zeros}.
10511 @item -fno-trapping-math
10512 @opindex fno-trapping-math
10513 @opindex ftrapping-math
10514 Compile code assuming that floating-point operations cannot generate
10515 user-visible traps. These traps include division by zero, overflow,
10516 underflow, inexact result and invalid operation. This option requires
10517 that @option{-fno-signaling-nans} be in effect. Setting this option may
10518 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10520 This option should never be turned on by any @option{-O} option since
10521 it can result in incorrect output for programs that depend on
10522 an exact implementation of IEEE or ISO rules/specifications for
10525 The default is @option{-ftrapping-math}.
10527 @item -frounding-math
10528 @opindex frounding-math
10529 Disable transformations and optimizations that assume default floating-point
10530 rounding behavior. This is round-to-zero for all floating point
10531 to integer conversions, and round-to-nearest for all other arithmetic
10532 truncations. This option should be specified for programs that change
10533 the FP rounding mode dynamically, or that may be executed with a
10534 non-default rounding mode. This option disables constant folding of
10535 floating-point expressions at compile time (which may be affected by
10536 rounding mode) and arithmetic transformations that are unsafe in the
10537 presence of sign-dependent rounding modes.
10539 The default is @option{-fno-rounding-math}.
10541 This option is experimental and does not currently guarantee to
10542 disable all GCC optimizations that are affected by rounding mode.
10543 Future versions of GCC may provide finer control of this setting
10544 using C99's @code{FENV_ACCESS} pragma. This command-line option
10545 will be used to specify the default state for @code{FENV_ACCESS}.
10547 @item -fsignaling-nans
10548 @opindex fsignaling-nans
10549 Compile code assuming that IEEE signaling NaNs may generate user-visible
10550 traps during floating-point operations. Setting this option disables
10551 optimizations that may change the number of exceptions visible with
10552 signaling NaNs. This option implies @option{-ftrapping-math}.
10554 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10557 The default is @option{-fno-signaling-nans}.
10559 This option is experimental and does not currently guarantee to
10560 disable all GCC optimizations that affect signaling NaN behavior.
10562 @item -fno-fp-int-builtin-inexact
10563 @opindex fno-fp-int-builtin-inexact
10564 @opindex ffp-int-builtin-inexact
10565 Do not allow the built-in functions @code{ceil}, @code{floor},
10566 @code{round} and @code{trunc}, and their @code{float} and @code{long
10567 double} variants, to generate code that raises the ``inexact''
10568 floating-point exception for noninteger arguments. ISO C99 and C11
10569 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10570 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
10571 functions to do so.
10573 The default is @option{-ffp-int-builtin-inexact}, allowing the
10574 exception to be raised. This option does nothing unless
10575 @option{-ftrapping-math} is in effect.
10577 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10578 generate a call to a library function then the ``inexact'' exception
10579 may be raised if the library implementation does not follow TS 18661.
10581 @item -fsingle-precision-constant
10582 @opindex fsingle-precision-constant
10583 Treat floating-point constants as single precision instead of
10584 implicitly converting them to double-precision constants.
10586 @item -fcx-limited-range
10587 @opindex fcx-limited-range
10588 When enabled, this option states that a range reduction step is not
10589 needed when performing complex division. Also, there is no checking
10590 whether the result of a complex multiplication or division is @code{NaN
10591 + I*NaN}, with an attempt to rescue the situation in that case. The
10592 default is @option{-fno-cx-limited-range}, but is enabled by
10593 @option{-ffast-math}.
10595 This option controls the default setting of the ISO C99
10596 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10599 @item -fcx-fortran-rules
10600 @opindex fcx-fortran-rules
10601 Complex multiplication and division follow Fortran rules. Range
10602 reduction is done as part of complex division, but there is no checking
10603 whether the result of a complex multiplication or division is @code{NaN
10604 + I*NaN}, with an attempt to rescue the situation in that case.
10606 The default is @option{-fno-cx-fortran-rules}.
10610 The following options control optimizations that may improve
10611 performance, but are not enabled by any @option{-O} options. This
10612 section includes experimental options that may produce broken code.
10615 @item -fbranch-probabilities
10616 @opindex fbranch-probabilities
10617 After running a program compiled with @option{-fprofile-arcs}
10618 (@pxref{Instrumentation Options}),
10619 you can compile it a second time using
10620 @option{-fbranch-probabilities}, to improve optimizations based on
10621 the number of times each branch was taken. When a program
10622 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10623 counts to a file called @file{@var{sourcename}.gcda} for each source
10624 file. The information in this data file is very dependent on the
10625 structure of the generated code, so you must use the same source code
10626 and the same optimization options for both compilations.
10628 With @option{-fbranch-probabilities}, GCC puts a
10629 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10630 These can be used to improve optimization. Currently, they are only
10631 used in one place: in @file{reorg.c}, instead of guessing which path a
10632 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10633 exactly determine which path is taken more often.
10635 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10637 @item -fprofile-values
10638 @opindex fprofile-values
10639 If combined with @option{-fprofile-arcs}, it adds code so that some
10640 data about values of expressions in the program is gathered.
10642 With @option{-fbranch-probabilities}, it reads back the data gathered
10643 from profiling values of expressions for usage in optimizations.
10645 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
10646 @option{-fauto-profile}.
10648 @item -fprofile-reorder-functions
10649 @opindex fprofile-reorder-functions
10650 Function reordering based on profile instrumentation collects
10651 first time of execution of a function and orders these functions
10652 in ascending order.
10654 Enabled with @option{-fprofile-use}.
10658 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10659 to add code to gather information about values of expressions.
10661 With @option{-fbranch-probabilities}, it reads back the data gathered
10662 and actually performs the optimizations based on them.
10663 Currently the optimizations include specialization of division operations
10664 using the knowledge about the value of the denominator.
10666 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
10668 @item -frename-registers
10669 @opindex frename-registers
10670 Attempt to avoid false dependencies in scheduled code by making use
10671 of registers left over after register allocation. This optimization
10672 most benefits processors with lots of registers. Depending on the
10673 debug information format adopted by the target, however, it can
10674 make debugging impossible, since variables no longer stay in
10675 a ``home register''.
10677 Enabled by default with @option{-funroll-loops}.
10679 @item -fschedule-fusion
10680 @opindex fschedule-fusion
10681 Performs a target dependent pass over the instruction stream to schedule
10682 instructions of same type together because target machine can execute them
10683 more efficiently if they are adjacent to each other in the instruction flow.
10685 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10689 Perform tail duplication to enlarge superblock size. This transformation
10690 simplifies the control flow of the function allowing other optimizations to do
10693 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10695 @item -funroll-loops
10696 @opindex funroll-loops
10697 Unroll loops whose number of iterations can be determined at compile time or
10698 upon entry to the loop. @option{-funroll-loops} implies
10699 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10700 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10701 a small constant number of iterations). This option makes code larger, and may
10702 or may not make it run faster.
10704 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10706 @item -funroll-all-loops
10707 @opindex funroll-all-loops
10708 Unroll all loops, even if their number of iterations is uncertain when
10709 the loop is entered. This usually makes programs run more slowly.
10710 @option{-funroll-all-loops} implies the same options as
10711 @option{-funroll-loops}.
10714 @opindex fpeel-loops
10715 Peels loops for which there is enough information that they do not
10716 roll much (from profile feedback or static analysis). It also turns on
10717 complete loop peeling (i.e.@: complete removal of loops with small constant
10718 number of iterations).
10720 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
10722 @item -fmove-loop-invariants
10723 @opindex fmove-loop-invariants
10724 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10725 at level @option{-O1} and higher, except for @option{-Og}.
10727 @item -fsplit-loops
10728 @opindex fsplit-loops
10729 Split a loop into two if it contains a condition that's always true
10730 for one side of the iteration space and false for the other.
10732 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10734 @item -funswitch-loops
10735 @opindex funswitch-loops
10736 Move branches with loop invariant conditions out of the loop, with duplicates
10737 of the loop on both branches (modified according to result of the condition).
10739 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10741 @item -ffunction-sections
10742 @itemx -fdata-sections
10743 @opindex ffunction-sections
10744 @opindex fdata-sections
10745 Place each function or data item into its own section in the output
10746 file if the target supports arbitrary sections. The name of the
10747 function or the name of the data item determines the section's name
10748 in the output file.
10750 Use these options on systems where the linker can perform optimizations to
10751 improve locality of reference in the instruction space. Most systems using the
10752 ELF object format have linkers with such optimizations. On AIX, the linker
10753 rearranges sections (CSECTs) based on the call graph. The performance impact
10756 Together with a linker garbage collection (linker @option{--gc-sections}
10757 option) these options may lead to smaller statically-linked executables (after
10760 On ELF/DWARF systems these options do not degenerate the quality of the debug
10761 information. There could be issues with other object files/debug info formats.
10763 Only use these options when there are significant benefits from doing so. When
10764 you specify these options, the assembler and linker create larger object and
10765 executable files and are also slower. These options affect code generation.
10766 They prevent optimizations by the compiler and assembler using relative
10767 locations inside a translation unit since the locations are unknown until
10768 link time. An example of such an optimization is relaxing calls to short call
10771 @item -fbranch-target-load-optimize
10772 @opindex fbranch-target-load-optimize
10773 Perform branch target register load optimization before prologue / epilogue
10775 The use of target registers can typically be exposed only during reload,
10776 thus hoisting loads out of loops and doing inter-block scheduling needs
10777 a separate optimization pass.
10779 @item -fbranch-target-load-optimize2
10780 @opindex fbranch-target-load-optimize2
10781 Perform branch target register load optimization after prologue / epilogue
10784 @item -fbtr-bb-exclusive
10785 @opindex fbtr-bb-exclusive
10786 When performing branch target register load optimization, don't reuse
10787 branch target registers within any basic block.
10790 @opindex fstdarg-opt
10791 Optimize the prologue of variadic argument functions with respect to usage of
10794 @item -fsection-anchors
10795 @opindex fsection-anchors
10796 Try to reduce the number of symbolic address calculations by using
10797 shared ``anchor'' symbols to address nearby objects. This transformation
10798 can help to reduce the number of GOT entries and GOT accesses on some
10801 For example, the implementation of the following function @code{foo}:
10804 static int a, b, c;
10805 int foo (void) @{ return a + b + c; @}
10809 usually calculates the addresses of all three variables, but if you
10810 compile it with @option{-fsection-anchors}, it accesses the variables
10811 from a common anchor point instead. The effect is similar to the
10812 following pseudocode (which isn't valid C):
10817 register int *xr = &x;
10818 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
10822 Not all targets support this option.
10824 @item --param @var{name}=@var{value}
10826 In some places, GCC uses various constants to control the amount of
10827 optimization that is done. For example, GCC does not inline functions
10828 that contain more than a certain number of instructions. You can
10829 control some of these constants on the command line using the
10830 @option{--param} option.
10832 The names of specific parameters, and the meaning of the values, are
10833 tied to the internals of the compiler, and are subject to change
10834 without notice in future releases.
10836 In order to get minimal, maximal and default value of a parameter,
10837 one can use @option{--help=param -Q} options.
10839 In each case, the @var{value} is an integer. The allowable choices for
10843 @item predictable-branch-outcome
10844 When branch is predicted to be taken with probability lower than this threshold
10845 (in percent), then it is considered well predictable.
10847 @item max-rtl-if-conversion-insns
10848 RTL if-conversion tries to remove conditional branches around a block and
10849 replace them with conditionally executed instructions. This parameter
10850 gives the maximum number of instructions in a block which should be
10851 considered for if-conversion. The compiler will
10852 also use other heuristics to decide whether if-conversion is likely to be
10855 @item max-rtl-if-conversion-predictable-cost
10856 @itemx max-rtl-if-conversion-unpredictable-cost
10857 RTL if-conversion will try to remove conditional branches around a block
10858 and replace them with conditionally executed instructions. These parameters
10859 give the maximum permissible cost for the sequence that would be generated
10860 by if-conversion depending on whether the branch is statically determined
10861 to be predictable or not. The units for this parameter are the same as
10862 those for the GCC internal seq_cost metric. The compiler will try to
10863 provide a reasonable default for this parameter using the BRANCH_COST
10866 @item max-crossjump-edges
10867 The maximum number of incoming edges to consider for cross-jumping.
10868 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
10869 the number of edges incoming to each block. Increasing values mean
10870 more aggressive optimization, making the compilation time increase with
10871 probably small improvement in executable size.
10873 @item min-crossjump-insns
10874 The minimum number of instructions that must be matched at the end
10875 of two blocks before cross-jumping is performed on them. This
10876 value is ignored in the case where all instructions in the block being
10877 cross-jumped from are matched.
10879 @item max-grow-copy-bb-insns
10880 The maximum code size expansion factor when copying basic blocks
10881 instead of jumping. The expansion is relative to a jump instruction.
10883 @item max-goto-duplication-insns
10884 The maximum number of instructions to duplicate to a block that jumps
10885 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
10886 passes, GCC factors computed gotos early in the compilation process,
10887 and unfactors them as late as possible. Only computed jumps at the
10888 end of a basic blocks with no more than max-goto-duplication-insns are
10891 @item max-delay-slot-insn-search
10892 The maximum number of instructions to consider when looking for an
10893 instruction to fill a delay slot. If more than this arbitrary number of
10894 instructions are searched, the time savings from filling the delay slot
10895 are minimal, so stop searching. Increasing values mean more
10896 aggressive optimization, making the compilation time increase with probably
10897 small improvement in execution time.
10899 @item max-delay-slot-live-search
10900 When trying to fill delay slots, the maximum number of instructions to
10901 consider when searching for a block with valid live register
10902 information. Increasing this arbitrarily chosen value means more
10903 aggressive optimization, increasing the compilation time. This parameter
10904 should be removed when the delay slot code is rewritten to maintain the
10905 control-flow graph.
10907 @item max-gcse-memory
10908 The approximate maximum amount of memory that can be allocated in
10909 order to perform the global common subexpression elimination
10910 optimization. If more memory than specified is required, the
10911 optimization is not done.
10913 @item max-gcse-insertion-ratio
10914 If the ratio of expression insertions to deletions is larger than this value
10915 for any expression, then RTL PRE inserts or removes the expression and thus
10916 leaves partially redundant computations in the instruction stream.
10918 @item max-pending-list-length
10919 The maximum number of pending dependencies scheduling allows
10920 before flushing the current state and starting over. Large functions
10921 with few branches or calls can create excessively large lists which
10922 needlessly consume memory and resources.
10924 @item max-modulo-backtrack-attempts
10925 The maximum number of backtrack attempts the scheduler should make
10926 when modulo scheduling a loop. Larger values can exponentially increase
10929 @item max-inline-insns-single
10930 Several parameters control the tree inliner used in GCC@.
10931 This number sets the maximum number of instructions (counted in GCC's
10932 internal representation) in a single function that the tree inliner
10933 considers for inlining. This only affects functions declared
10934 inline and methods implemented in a class declaration (C++).
10936 @item max-inline-insns-auto
10937 When you use @option{-finline-functions} (included in @option{-O3}),
10938 a lot of functions that would otherwise not be considered for inlining
10939 by the compiler are investigated. To those functions, a different
10940 (more restrictive) limit compared to functions declared inline can
10943 @item inline-min-speedup
10944 When estimated performance improvement of caller + callee runtime exceeds this
10945 threshold (in percent), the function can be inlined regardless of the limit on
10946 @option{--param max-inline-insns-single} and @option{--param
10947 max-inline-insns-auto}.
10949 @item large-function-insns
10950 The limit specifying really large functions. For functions larger than this
10951 limit after inlining, inlining is constrained by
10952 @option{--param large-function-growth}. This parameter is useful primarily
10953 to avoid extreme compilation time caused by non-linear algorithms used by the
10956 @item large-function-growth
10957 Specifies maximal growth of large function caused by inlining in percents.
10958 For example, parameter value 100 limits large function growth to 2.0 times
10961 @item large-unit-insns
10962 The limit specifying large translation unit. Growth caused by inlining of
10963 units larger than this limit is limited by @option{--param inline-unit-growth}.
10964 For small units this might be too tight.
10965 For example, consider a unit consisting of function A
10966 that is inline and B that just calls A three times. If B is small relative to
10967 A, the growth of unit is 300\% and yet such inlining is very sane. For very
10968 large units consisting of small inlineable functions, however, the overall unit
10969 growth limit is needed to avoid exponential explosion of code size. Thus for
10970 smaller units, the size is increased to @option{--param large-unit-insns}
10971 before applying @option{--param inline-unit-growth}.
10973 @item inline-unit-growth
10974 Specifies maximal overall growth of the compilation unit caused by inlining.
10975 For example, parameter value 20 limits unit growth to 1.2 times the original
10976 size. Cold functions (either marked cold via an attribute or by profile
10977 feedback) are not accounted into the unit size.
10979 @item ipcp-unit-growth
10980 Specifies maximal overall growth of the compilation unit caused by
10981 interprocedural constant propagation. For example, parameter value 10 limits
10982 unit growth to 1.1 times the original size.
10984 @item large-stack-frame
10985 The limit specifying large stack frames. While inlining the algorithm is trying
10986 to not grow past this limit too much.
10988 @item large-stack-frame-growth
10989 Specifies maximal growth of large stack frames caused by inlining in percents.
10990 For example, parameter value 1000 limits large stack frame growth to 11 times
10993 @item max-inline-insns-recursive
10994 @itemx max-inline-insns-recursive-auto
10995 Specifies the maximum number of instructions an out-of-line copy of a
10996 self-recursive inline
10997 function can grow into by performing recursive inlining.
10999 @option{--param max-inline-insns-recursive} applies to functions
11001 For functions not declared inline, recursive inlining
11002 happens only when @option{-finline-functions} (included in @option{-O3}) is
11003 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
11005 @item max-inline-recursive-depth
11006 @itemx max-inline-recursive-depth-auto
11007 Specifies the maximum recursion depth used for recursive inlining.
11009 @option{--param max-inline-recursive-depth} applies to functions
11010 declared inline. For functions not declared inline, recursive inlining
11011 happens only when @option{-finline-functions} (included in @option{-O3}) is
11012 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
11014 @item min-inline-recursive-probability
11015 Recursive inlining is profitable only for function having deep recursion
11016 in average and can hurt for function having little recursion depth by
11017 increasing the prologue size or complexity of function body to other
11020 When profile feedback is available (see @option{-fprofile-generate}) the actual
11021 recursion depth can be guessed from the probability that function recurses
11022 via a given call expression. This parameter limits inlining only to call
11023 expressions whose probability exceeds the given threshold (in percents).
11025 @item early-inlining-insns
11026 Specify growth that the early inliner can make. In effect it increases
11027 the amount of inlining for code having a large abstraction penalty.
11029 @item max-early-inliner-iterations
11030 Limit of iterations of the early inliner. This basically bounds
11031 the number of nested indirect calls the early inliner can resolve.
11032 Deeper chains are still handled by late inlining.
11034 @item comdat-sharing-probability
11035 Probability (in percent) that C++ inline function with comdat visibility
11036 are shared across multiple compilation units.
11038 @item profile-func-internal-id
11039 A parameter to control whether to use function internal id in profile
11040 database lookup. If the value is 0, the compiler uses an id that
11041 is based on function assembler name and filename, which makes old profile
11042 data more tolerant to source changes such as function reordering etc.
11044 @item min-vect-loop-bound
11045 The minimum number of iterations under which loops are not vectorized
11046 when @option{-ftree-vectorize} is used. The number of iterations after
11047 vectorization needs to be greater than the value specified by this option
11048 to allow vectorization.
11050 @item gcse-cost-distance-ratio
11051 Scaling factor in calculation of maximum distance an expression
11052 can be moved by GCSE optimizations. This is currently supported only in the
11053 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
11054 is with simple expressions, i.e., the expressions that have cost
11055 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
11056 hoisting of simple expressions.
11058 @item gcse-unrestricted-cost
11059 Cost, roughly measured as the cost of a single typical machine
11060 instruction, at which GCSE optimizations do not constrain
11061 the distance an expression can travel. This is currently
11062 supported only in the code hoisting pass. The lesser the cost,
11063 the more aggressive code hoisting is. Specifying 0
11064 allows all expressions to travel unrestricted distances.
11066 @item max-hoist-depth
11067 The depth of search in the dominator tree for expressions to hoist.
11068 This is used to avoid quadratic behavior in hoisting algorithm.
11069 The value of 0 does not limit on the search, but may slow down compilation
11072 @item max-tail-merge-comparisons
11073 The maximum amount of similar bbs to compare a bb with. This is used to
11074 avoid quadratic behavior in tree tail merging.
11076 @item max-tail-merge-iterations
11077 The maximum amount of iterations of the pass over the function. This is used to
11078 limit compilation time in tree tail merging.
11080 @item store-merging-allow-unaligned
11081 Allow the store merging pass to introduce unaligned stores if it is legal to
11084 @item max-stores-to-merge
11085 The maximum number of stores to attempt to merge into wider stores in the store
11088 @item max-unrolled-insns
11089 The maximum number of instructions that a loop may have to be unrolled.
11090 If a loop is unrolled, this parameter also determines how many times
11091 the loop code is unrolled.
11093 @item max-average-unrolled-insns
11094 The maximum number of instructions biased by probabilities of their execution
11095 that a loop may have to be unrolled. If a loop is unrolled,
11096 this parameter also determines how many times the loop code is unrolled.
11098 @item max-unroll-times
11099 The maximum number of unrollings of a single loop.
11101 @item max-peeled-insns
11102 The maximum number of instructions that a loop may have to be peeled.
11103 If a loop is peeled, this parameter also determines how many times
11104 the loop code is peeled.
11106 @item max-peel-times
11107 The maximum number of peelings of a single loop.
11109 @item max-peel-branches
11110 The maximum number of branches on the hot path through the peeled sequence.
11112 @item max-completely-peeled-insns
11113 The maximum number of insns of a completely peeled loop.
11115 @item max-completely-peel-times
11116 The maximum number of iterations of a loop to be suitable for complete peeling.
11118 @item max-completely-peel-loop-nest-depth
11119 The maximum depth of a loop nest suitable for complete peeling.
11121 @item max-unswitch-insns
11122 The maximum number of insns of an unswitched loop.
11124 @item max-unswitch-level
11125 The maximum number of branches unswitched in a single loop.
11127 @item lim-expensive
11128 The minimum cost of an expensive expression in the loop invariant motion.
11130 @item iv-consider-all-candidates-bound
11131 Bound on number of candidates for induction variables, below which
11132 all candidates are considered for each use in induction variable
11133 optimizations. If there are more candidates than this,
11134 only the most relevant ones are considered to avoid quadratic time complexity.
11136 @item iv-max-considered-uses
11137 The induction variable optimizations give up on loops that contain more
11138 induction variable uses.
11140 @item iv-always-prune-cand-set-bound
11141 If the number of candidates in the set is smaller than this value,
11142 always try to remove unnecessary ivs from the set
11143 when adding a new one.
11145 @item avg-loop-niter
11146 Average number of iterations of a loop.
11148 @item dse-max-object-size
11149 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
11150 Larger values may result in larger compilation times.
11152 @item dse-max-alias-queries-per-store
11153 Maximum number of queries into the alias oracle per store.
11154 Larger values result in larger compilation times and may result in more
11155 removed dead stores.
11157 @item scev-max-expr-size
11158 Bound on size of expressions used in the scalar evolutions analyzer.
11159 Large expressions slow the analyzer.
11161 @item scev-max-expr-complexity
11162 Bound on the complexity of the expressions in the scalar evolutions analyzer.
11163 Complex expressions slow the analyzer.
11165 @item max-tree-if-conversion-phi-args
11166 Maximum number of arguments in a PHI supported by TREE if conversion
11167 unless the loop is marked with simd pragma.
11169 @item vect-max-version-for-alignment-checks
11170 The maximum number of run-time checks that can be performed when
11171 doing loop versioning for alignment in the vectorizer.
11173 @item vect-max-version-for-alias-checks
11174 The maximum number of run-time checks that can be performed when
11175 doing loop versioning for alias in the vectorizer.
11177 @item vect-max-peeling-for-alignment
11178 The maximum number of loop peels to enhance access alignment
11179 for vectorizer. Value -1 means no limit.
11181 @item max-iterations-to-track
11182 The maximum number of iterations of a loop the brute-force algorithm
11183 for analysis of the number of iterations of the loop tries to evaluate.
11185 @item hot-bb-count-ws-permille
11186 A basic block profile count is considered hot if it contributes to
11187 the given permillage (i.e.@: 0...1000) of the entire profiled execution.
11189 @item hot-bb-frequency-fraction
11190 Select fraction of the entry block frequency of executions of basic block in
11191 function given basic block needs to have to be considered hot.
11193 @item max-predicted-iterations
11194 The maximum number of loop iterations we predict statically. This is useful
11195 in cases where a function contains a single loop with known bound and
11196 another loop with unknown bound.
11197 The known number of iterations is predicted correctly, while
11198 the unknown number of iterations average to roughly 10. This means that the
11199 loop without bounds appears artificially cold relative to the other one.
11201 @item builtin-expect-probability
11202 Control the probability of the expression having the specified value. This
11203 parameter takes a percentage (i.e.@: 0 ... 100) as input.
11205 @item builtin-string-cmp-inline-length
11206 The maximum length of a constant string for a builtin string cmp call
11207 eligible for inlining.
11209 @item align-threshold
11211 Select fraction of the maximal frequency of executions of a basic block in
11212 a function to align the basic block.
11214 @item align-loop-iterations
11216 A loop expected to iterate at least the selected number of iterations is
11219 @item tracer-dynamic-coverage
11220 @itemx tracer-dynamic-coverage-feedback
11222 This value is used to limit superblock formation once the given percentage of
11223 executed instructions is covered. This limits unnecessary code size
11226 The @option{tracer-dynamic-coverage-feedback} parameter
11227 is used only when profile
11228 feedback is available. The real profiles (as opposed to statically estimated
11229 ones) are much less balanced allowing the threshold to be larger value.
11231 @item tracer-max-code-growth
11232 Stop tail duplication once code growth has reached given percentage. This is
11233 a rather artificial limit, as most of the duplicates are eliminated later in
11234 cross jumping, so it may be set to much higher values than is the desired code
11237 @item tracer-min-branch-ratio
11239 Stop reverse growth when the reverse probability of best edge is less than this
11240 threshold (in percent).
11242 @item tracer-min-branch-probability
11243 @itemx tracer-min-branch-probability-feedback
11245 Stop forward growth if the best edge has probability lower than this
11248 Similarly to @option{tracer-dynamic-coverage} two parameters are
11249 provided. @option{tracer-min-branch-probability-feedback} is used for
11250 compilation with profile feedback and @option{tracer-min-branch-probability}
11251 compilation without. The value for compilation with profile feedback
11252 needs to be more conservative (higher) in order to make tracer
11255 @item stack-clash-protection-guard-size
11256 Specify the size of the operating system provided stack guard as
11257 2 raised to @var{num} bytes. Higher values may reduce the
11258 number of explicit probes, but a value larger than the operating system
11259 provided guard will leave code vulnerable to stack clash style attacks.
11261 @item stack-clash-protection-probe-interval
11262 Stack clash protection involves probing stack space as it is allocated. This
11263 param controls the maximum distance between probes into the stack as 2 raised
11264 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
11265 larger than the operating system provided guard will leave code vulnerable to
11266 stack clash style attacks.
11268 @item max-cse-path-length
11270 The maximum number of basic blocks on path that CSE considers.
11272 @item max-cse-insns
11273 The maximum number of instructions CSE processes before flushing.
11275 @item ggc-min-expand
11277 GCC uses a garbage collector to manage its own memory allocation. This
11278 parameter specifies the minimum percentage by which the garbage
11279 collector's heap should be allowed to expand between collections.
11280 Tuning this may improve compilation speed; it has no effect on code
11283 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
11284 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
11285 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
11286 GCC is not able to calculate RAM on a particular platform, the lower
11287 bound of 30% is used. Setting this parameter and
11288 @option{ggc-min-heapsize} to zero causes a full collection to occur at
11289 every opportunity. This is extremely slow, but can be useful for
11292 @item ggc-min-heapsize
11294 Minimum size of the garbage collector's heap before it begins bothering
11295 to collect garbage. The first collection occurs after the heap expands
11296 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
11297 tuning this may improve compilation speed, and has no effect on code
11300 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
11301 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
11302 with a lower bound of 4096 (four megabytes) and an upper bound of
11303 131072 (128 megabytes). If GCC is not able to calculate RAM on a
11304 particular platform, the lower bound is used. Setting this parameter
11305 very large effectively disables garbage collection. Setting this
11306 parameter and @option{ggc-min-expand} to zero causes a full collection
11307 to occur at every opportunity.
11309 @item max-reload-search-insns
11310 The maximum number of instruction reload should look backward for equivalent
11311 register. Increasing values mean more aggressive optimization, making the
11312 compilation time increase with probably slightly better performance.
11314 @item max-cselib-memory-locations
11315 The maximum number of memory locations cselib should take into account.
11316 Increasing values mean more aggressive optimization, making the compilation time
11317 increase with probably slightly better performance.
11319 @item max-sched-ready-insns
11320 The maximum number of instructions ready to be issued the scheduler should
11321 consider at any given time during the first scheduling pass. Increasing
11322 values mean more thorough searches, making the compilation time increase
11323 with probably little benefit.
11325 @item max-sched-region-blocks
11326 The maximum number of blocks in a region to be considered for
11327 interblock scheduling.
11329 @item max-pipeline-region-blocks
11330 The maximum number of blocks in a region to be considered for
11331 pipelining in the selective scheduler.
11333 @item max-sched-region-insns
11334 The maximum number of insns in a region to be considered for
11335 interblock scheduling.
11337 @item max-pipeline-region-insns
11338 The maximum number of insns in a region to be considered for
11339 pipelining in the selective scheduler.
11341 @item min-spec-prob
11342 The minimum probability (in percents) of reaching a source block
11343 for interblock speculative scheduling.
11345 @item max-sched-extend-regions-iters
11346 The maximum number of iterations through CFG to extend regions.
11347 A value of 0 disables region extensions.
11349 @item max-sched-insn-conflict-delay
11350 The maximum conflict delay for an insn to be considered for speculative motion.
11352 @item sched-spec-prob-cutoff
11353 The minimal probability of speculation success (in percents), so that
11354 speculative insns are scheduled.
11356 @item sched-state-edge-prob-cutoff
11357 The minimum probability an edge must have for the scheduler to save its
11360 @item sched-mem-true-dep-cost
11361 Minimal distance (in CPU cycles) between store and load targeting same
11364 @item selsched-max-lookahead
11365 The maximum size of the lookahead window of selective scheduling. It is a
11366 depth of search for available instructions.
11368 @item selsched-max-sched-times
11369 The maximum number of times that an instruction is scheduled during
11370 selective scheduling. This is the limit on the number of iterations
11371 through which the instruction may be pipelined.
11373 @item selsched-insns-to-rename
11374 The maximum number of best instructions in the ready list that are considered
11375 for renaming in the selective scheduler.
11378 The minimum value of stage count that swing modulo scheduler
11381 @item max-last-value-rtl
11382 The maximum size measured as number of RTLs that can be recorded in an expression
11383 in combiner for a pseudo register as last known value of that register.
11385 @item max-combine-insns
11386 The maximum number of instructions the RTL combiner tries to combine.
11388 @item integer-share-limit
11389 Small integer constants can use a shared data structure, reducing the
11390 compiler's memory usage and increasing its speed. This sets the maximum
11391 value of a shared integer constant.
11393 @item ssp-buffer-size
11394 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11395 protection when @option{-fstack-protection} is used.
11397 @item min-size-for-stack-sharing
11398 The minimum size of variables taking part in stack slot sharing when not
11401 @item max-jump-thread-duplication-stmts
11402 Maximum number of statements allowed in a block that needs to be
11403 duplicated when threading jumps.
11405 @item max-fields-for-field-sensitive
11406 Maximum number of fields in a structure treated in
11407 a field sensitive manner during pointer analysis.
11409 @item prefetch-latency
11410 Estimate on average number of instructions that are executed before
11411 prefetch finishes. The distance prefetched ahead is proportional
11412 to this constant. Increasing this number may also lead to less
11413 streams being prefetched (see @option{simultaneous-prefetches}).
11415 @item simultaneous-prefetches
11416 Maximum number of prefetches that can run at the same time.
11418 @item l1-cache-line-size
11419 The size of cache line in L1 data cache, in bytes.
11421 @item l1-cache-size
11422 The size of L1 data cache, in kilobytes.
11424 @item l2-cache-size
11425 The size of L2 data cache, in kilobytes.
11427 @item prefetch-dynamic-strides
11428 Whether the loop array prefetch pass should issue software prefetch hints
11429 for strides that are non-constant. In some cases this may be
11430 beneficial, though the fact the stride is non-constant may make it
11431 hard to predict when there is clear benefit to issuing these hints.
11433 Set to 1 if the prefetch hints should be issued for non-constant
11434 strides. Set to 0 if prefetch hints should be issued only for strides that
11435 are known to be constant and below @option{prefetch-minimum-stride}.
11437 @item prefetch-minimum-stride
11438 Minimum constant stride, in bytes, to start using prefetch hints for. If
11439 the stride is less than this threshold, prefetch hints will not be issued.
11441 This setting is useful for processors that have hardware prefetchers, in
11442 which case there may be conflicts between the hardware prefetchers and
11443 the software prefetchers. If the hardware prefetchers have a maximum
11444 stride they can handle, it should be used here to improve the use of
11445 software prefetchers.
11447 A value of -1 means we don't have a threshold and therefore
11448 prefetch hints can be issued for any constant stride.
11450 This setting is only useful for strides that are known and constant.
11452 @item loop-interchange-max-num-stmts
11453 The maximum number of stmts in a loop to be interchanged.
11455 @item loop-interchange-stride-ratio
11456 The minimum ratio between stride of two loops for interchange to be profitable.
11458 @item min-insn-to-prefetch-ratio
11459 The minimum ratio between the number of instructions and the
11460 number of prefetches to enable prefetching in a loop.
11462 @item prefetch-min-insn-to-mem-ratio
11463 The minimum ratio between the number of instructions and the
11464 number of memory references to enable prefetching in a loop.
11466 @item use-canonical-types
11467 Whether the compiler should use the ``canonical'' type system.
11468 Should always be 1, which uses a more efficient internal
11469 mechanism for comparing types in C++ and Objective-C++. However, if
11470 bugs in the canonical type system are causing compilation failures,
11471 set this value to 0 to disable canonical types.
11473 @item switch-conversion-max-branch-ratio
11474 Switch initialization conversion refuses to create arrays that are
11475 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11476 branches in the switch.
11478 @item max-partial-antic-length
11479 Maximum length of the partial antic set computed during the tree
11480 partial redundancy elimination optimization (@option{-ftree-pre}) when
11481 optimizing at @option{-O3} and above. For some sorts of source code
11482 the enhanced partial redundancy elimination optimization can run away,
11483 consuming all of the memory available on the host machine. This
11484 parameter sets a limit on the length of the sets that are computed,
11485 which prevents the runaway behavior. Setting a value of 0 for
11486 this parameter allows an unlimited set length.
11488 @item rpo-vn-max-loop-depth
11489 Maximum loop depth that is value-numbered optimistically.
11490 When the limit hits the innermost
11491 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11492 loop nest are value-numbered optimistically and the remaining ones not.
11494 @item sccvn-max-alias-queries-per-access
11495 Maximum number of alias-oracle queries we perform when looking for
11496 redundancies for loads and stores. If this limit is hit the search
11497 is aborted and the load or store is not considered redundant. The
11498 number of queries is algorithmically limited to the number of
11499 stores on all paths from the load to the function entry.
11501 @item ira-max-loops-num
11502 IRA uses regional register allocation by default. If a function
11503 contains more loops than the number given by this parameter, only at most
11504 the given number of the most frequently-executed loops form regions
11505 for regional register allocation.
11507 @item ira-max-conflict-table-size
11508 Although IRA uses a sophisticated algorithm to compress the conflict
11509 table, the table can still require excessive amounts of memory for
11510 huge functions. If the conflict table for a function could be more
11511 than the size in MB given by this parameter, the register allocator
11512 instead uses a faster, simpler, and lower-quality
11513 algorithm that does not require building a pseudo-register conflict table.
11515 @item ira-loop-reserved-regs
11516 IRA can be used to evaluate more accurate register pressure in loops
11517 for decisions to move loop invariants (see @option{-O3}). The number
11518 of available registers reserved for some other purposes is given
11519 by this parameter. Default of the parameter
11520 is the best found from numerous experiments.
11522 @item lra-inheritance-ebb-probability-cutoff
11523 LRA tries to reuse values reloaded in registers in subsequent insns.
11524 This optimization is called inheritance. EBB is used as a region to
11525 do this optimization. The parameter defines a minimal fall-through
11526 edge probability in percentage used to add BB to inheritance EBB in
11527 LRA. The default value was chosen
11528 from numerous runs of SPEC2000 on x86-64.
11530 @item loop-invariant-max-bbs-in-loop
11531 Loop invariant motion can be very expensive, both in compilation time and
11532 in amount of needed compile-time memory, with very large loops. Loops
11533 with more basic blocks than this parameter won't have loop invariant
11534 motion optimization performed on them.
11536 @item loop-max-datarefs-for-datadeps
11537 Building data dependencies is expensive for very large loops. This
11538 parameter limits the number of data references in loops that are
11539 considered for data dependence analysis. These large loops are no
11540 handled by the optimizations using loop data dependencies.
11542 @item max-vartrack-size
11543 Sets a maximum number of hash table slots to use during variable
11544 tracking dataflow analysis of any function. If this limit is exceeded
11545 with variable tracking at assignments enabled, analysis for that
11546 function is retried without it, after removing all debug insns from
11547 the function. If the limit is exceeded even without debug insns, var
11548 tracking analysis is completely disabled for the function. Setting
11549 the parameter to zero makes it unlimited.
11551 @item max-vartrack-expr-depth
11552 Sets a maximum number of recursion levels when attempting to map
11553 variable names or debug temporaries to value expressions. This trades
11554 compilation time for more complete debug information. If this is set too
11555 low, value expressions that are available and could be represented in
11556 debug information may end up not being used; setting this higher may
11557 enable the compiler to find more complex debug expressions, but compile
11558 time and memory use may grow.
11560 @item max-debug-marker-count
11561 Sets a threshold on the number of debug markers (e.g.@: begin stmt
11562 markers) to avoid complexity explosion at inlining or expanding to RTL.
11563 If a function has more such gimple stmts than the set limit, such stmts
11564 will be dropped from the inlined copy of a function, and from its RTL
11567 @item min-nondebug-insn-uid
11568 Use uids starting at this parameter for nondebug insns. The range below
11569 the parameter is reserved exclusively for debug insns created by
11570 @option{-fvar-tracking-assignments}, but debug insns may get
11571 (non-overlapping) uids above it if the reserved range is exhausted.
11573 @item ipa-sra-ptr-growth-factor
11574 IPA-SRA replaces a pointer to an aggregate with one or more new
11575 parameters only when their cumulative size is less or equal to
11576 @option{ipa-sra-ptr-growth-factor} times the size of the original
11579 @item sra-max-scalarization-size-Ospeed
11580 @itemx sra-max-scalarization-size-Osize
11581 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11582 replace scalar parts of aggregates with uses of independent scalar
11583 variables. These parameters control the maximum size, in storage units,
11584 of aggregate which is considered for replacement when compiling for
11586 (@option{sra-max-scalarization-size-Ospeed}) or size
11587 (@option{sra-max-scalarization-size-Osize}) respectively.
11589 @item tm-max-aggregate-size
11590 When making copies of thread-local variables in a transaction, this
11591 parameter specifies the size in bytes after which variables are
11592 saved with the logging functions as opposed to save/restore code
11593 sequence pairs. This option only applies when using
11596 @item graphite-max-nb-scop-params
11597 To avoid exponential effects in the Graphite loop transforms, the
11598 number of parameters in a Static Control Part (SCoP) is bounded.
11599 A value of zero can be used to lift
11600 the bound. A variable whose value is unknown at compilation time and
11601 defined outside a SCoP is a parameter of the SCoP.
11603 @item loop-block-tile-size
11604 Loop blocking or strip mining transforms, enabled with
11605 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11606 loop in the loop nest by a given number of iterations. The strip
11607 length can be changed using the @option{loop-block-tile-size}
11610 @item ipa-cp-value-list-size
11611 IPA-CP attempts to track all possible values and types passed to a function's
11612 parameter in order to propagate them and perform devirtualization.
11613 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11614 stores per one formal parameter of a function.
11616 @item ipa-cp-eval-threshold
11617 IPA-CP calculates its own score of cloning profitability heuristics
11618 and performs those cloning opportunities with scores that exceed
11619 @option{ipa-cp-eval-threshold}.
11621 @item ipa-cp-recursion-penalty
11622 Percentage penalty the recursive functions will receive when they
11623 are evaluated for cloning.
11625 @item ipa-cp-single-call-penalty
11626 Percentage penalty functions containing a single call to another
11627 function will receive when they are evaluated for cloning.
11629 @item ipa-max-agg-items
11630 IPA-CP is also capable to propagate a number of scalar values passed
11631 in an aggregate. @option{ipa-max-agg-items} controls the maximum
11632 number of such values per one parameter.
11634 @item ipa-cp-loop-hint-bonus
11635 When IPA-CP determines that a cloning candidate would make the number
11636 of iterations of a loop known, it adds a bonus of
11637 @option{ipa-cp-loop-hint-bonus} to the profitability score of
11640 @item ipa-cp-array-index-hint-bonus
11641 When IPA-CP determines that a cloning candidate would make the index of
11642 an array access known, it adds a bonus of
11643 @option{ipa-cp-array-index-hint-bonus} to the profitability
11644 score of the candidate.
11646 @item ipa-max-aa-steps
11647 During its analysis of function bodies, IPA-CP employs alias analysis
11648 in order to track values pointed to by function parameters. In order
11649 not spend too much time analyzing huge functions, it gives up and
11650 consider all memory clobbered after examining
11651 @option{ipa-max-aa-steps} statements modifying memory.
11653 @item lto-partitions
11654 Specify desired number of partitions produced during WHOPR compilation.
11655 The number of partitions should exceed the number of CPUs used for compilation.
11657 @item lto-min-partition
11658 Size of minimal partition for WHOPR (in estimated instructions).
11659 This prevents expenses of splitting very small programs into too many
11662 @item lto-max-partition
11663 Size of max partition for WHOPR (in estimated instructions).
11664 to provide an upper bound for individual size of partition.
11665 Meant to be used only with balanced partitioning.
11667 @item cxx-max-namespaces-for-diagnostic-help
11668 The maximum number of namespaces to consult for suggestions when C++
11669 name lookup fails for an identifier.
11671 @item sink-frequency-threshold
11672 The maximum relative execution frequency (in percents) of the target block
11673 relative to a statement's original block to allow statement sinking of a
11674 statement. Larger numbers result in more aggressive statement sinking.
11675 A small positive adjustment is applied for
11676 statements with memory operands as those are even more profitable so sink.
11678 @item max-stores-to-sink
11679 The maximum number of conditional store pairs that can be sunk. Set to 0
11680 if either vectorization (@option{-ftree-vectorize}) or if-conversion
11681 (@option{-ftree-loop-if-convert}) is disabled.
11683 @item allow-store-data-races
11684 Allow optimizers to introduce new data races on stores.
11685 Set to 1 to allow, otherwise to 0.
11687 @item case-values-threshold
11688 The smallest number of different values for which it is best to use a
11689 jump-table instead of a tree of conditional branches. If the value is
11690 0, use the default for the machine.
11692 @item tree-reassoc-width
11693 Set the maximum number of instructions executed in parallel in
11694 reassociated tree. This parameter overrides target dependent
11695 heuristics used by default if has non zero value.
11697 @item sched-pressure-algorithm
11698 Choose between the two available implementations of
11699 @option{-fsched-pressure}. Algorithm 1 is the original implementation
11700 and is the more likely to prevent instructions from being reordered.
11701 Algorithm 2 was designed to be a compromise between the relatively
11702 conservative approach taken by algorithm 1 and the rather aggressive
11703 approach taken by the default scheduler. It relies more heavily on
11704 having a regular register file and accurate register pressure classes.
11705 See @file{haifa-sched.c} in the GCC sources for more details.
11707 The default choice depends on the target.
11709 @item max-slsr-cand-scan
11710 Set the maximum number of existing candidates that are considered when
11711 seeking a basis for a new straight-line strength reduction candidate.
11714 Enable buffer overflow detection for global objects. This kind
11715 of protection is enabled by default if you are using
11716 @option{-fsanitize=address} option.
11717 To disable global objects protection use @option{--param asan-globals=0}.
11720 Enable buffer overflow detection for stack objects. This kind of
11721 protection is enabled by default when using @option{-fsanitize=address}.
11722 To disable stack protection use @option{--param asan-stack=0} option.
11724 @item asan-instrument-reads
11725 Enable buffer overflow detection for memory reads. This kind of
11726 protection is enabled by default when using @option{-fsanitize=address}.
11727 To disable memory reads protection use
11728 @option{--param asan-instrument-reads=0}.
11730 @item asan-instrument-writes
11731 Enable buffer overflow detection for memory writes. This kind of
11732 protection is enabled by default when using @option{-fsanitize=address}.
11733 To disable memory writes protection use
11734 @option{--param asan-instrument-writes=0} option.
11736 @item asan-memintrin
11737 Enable detection for built-in functions. This kind of protection
11738 is enabled by default when using @option{-fsanitize=address}.
11739 To disable built-in functions protection use
11740 @option{--param asan-memintrin=0}.
11742 @item asan-use-after-return
11743 Enable detection of use-after-return. This kind of protection
11744 is enabled by default when using the @option{-fsanitize=address} option.
11745 To disable it use @option{--param asan-use-after-return=0}.
11747 Note: By default the check is disabled at run time. To enable it,
11748 add @code{detect_stack_use_after_return=1} to the environment variable
11749 @env{ASAN_OPTIONS}.
11751 @item asan-instrumentation-with-call-threshold
11752 If number of memory accesses in function being instrumented
11753 is greater or equal to this number, use callbacks instead of inline checks.
11754 E.g. to disable inline code use
11755 @option{--param asan-instrumentation-with-call-threshold=0}.
11757 @item use-after-scope-direct-emission-threshold
11758 If the size of a local variable in bytes is smaller or equal to this
11759 number, directly poison (or unpoison) shadow memory instead of using
11760 run-time callbacks.
11762 @item max-fsm-thread-path-insns
11763 Maximum number of instructions to copy when duplicating blocks on a
11764 finite state automaton jump thread path.
11766 @item max-fsm-thread-length
11767 Maximum number of basic blocks on a finite state automaton jump thread
11770 @item max-fsm-thread-paths
11771 Maximum number of new jump thread paths to create for a finite state
11774 @item parloops-chunk-size
11775 Chunk size of omp schedule for loops parallelized by parloops.
11777 @item parloops-schedule
11778 Schedule type of omp schedule for loops parallelized by parloops (static,
11779 dynamic, guided, auto, runtime).
11781 @item parloops-min-per-thread
11782 The minimum number of iterations per thread of an innermost parallelized
11783 loop for which the parallelized variant is preferred over the single threaded
11784 one. Note that for a parallelized loop nest the
11785 minimum number of iterations of the outermost loop per thread is two.
11787 @item max-ssa-name-query-depth
11788 Maximum depth of recursion when querying properties of SSA names in things
11789 like fold routines. One level of recursion corresponds to following a
11792 @item hsa-gen-debug-stores
11793 Enable emission of special debug stores within HSA kernels which are
11794 then read and reported by libgomp plugin. Generation of these stores
11795 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
11798 @item max-speculative-devirt-maydefs
11799 The maximum number of may-defs we analyze when looking for a must-def
11800 specifying the dynamic type of an object that invokes a virtual call
11801 we may be able to devirtualize speculatively.
11803 @item max-vrp-switch-assertions
11804 The maximum number of assertions to add along the default edge of a switch
11805 statement during VRP.
11807 @item unroll-jam-min-percent
11808 The minimum percentage of memory references that must be optimized
11809 away for the unroll-and-jam transformation to be considered profitable.
11811 @item unroll-jam-max-unroll
11812 The maximum number of times the outer loop should be unrolled by
11813 the unroll-and-jam transformation.
11815 @item max-rtl-if-conversion-unpredictable-cost
11816 Maximum permissible cost for the sequence that would be generated
11817 by the RTL if-conversion pass for a branch that is considered unpredictable.
11819 @item max-variable-expansions-in-unroller
11820 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
11821 of times that an individual variable will be expanded during loop unrolling.
11823 @item tracer-min-branch-probability-feedback
11824 Stop forward growth if the probability of best edge is less than
11825 this threshold (in percent). Used when profile feedback is available.
11827 @item partial-inlining-entry-probability
11828 Maximum probability of the entry BB of split region
11829 (in percent relative to entry BB of the function)
11830 to make partial inlining happen.
11832 @item max-tracked-strlens
11833 Maximum number of strings for which strlen optimization pass will
11834 track string lengths.
11836 @item gcse-after-reload-partial-fraction
11837 The threshold ratio for performing partial redundancy
11838 elimination after reload.
11840 @item gcse-after-reload-critical-fraction
11841 The threshold ratio of critical edges execution count that
11842 permit performing redundancy elimination after reload.
11844 @item max-loop-header-insns
11845 The maximum number of insns in loop header duplicated
11846 by the copy loop headers pass.
11848 @item vect-epilogues-nomask
11849 Enable loop epilogue vectorization using smaller vector size.
11851 @item slp-max-insns-in-bb
11852 Maximum number of instructions in basic block to be
11853 considered for SLP vectorization.
11855 @item avoid-fma-max-bits
11856 Maximum number of bits for which we avoid creating FMAs.
11858 @item sms-loop-average-count-threshold
11859 A threshold on the average loop count considered by the swing modulo scheduler.
11861 @item sms-dfa-history
11862 The number of cycles the swing modulo scheduler considers when checking
11863 conflicts using DFA.
11865 @item hot-bb-count-fraction
11866 Select fraction of the maximal count of repetitions of basic block
11867 in program given basic block needs
11868 to have to be considered hot (used in non-LTO mode)
11870 @item max-inline-insns-recursive-auto
11871 The maximum number of instructions non-inline function
11872 can grow to via recursive inlining.
11874 @item graphite-allow-codegen-errors
11875 Whether codegen errors should be ICEs when @option{-fchecking}.
11877 @item sms-max-ii-factor
11878 A factor for tuning the upper bound that swing modulo scheduler
11879 uses for scheduling a loop.
11881 @item lra-max-considered-reload-pseudos
11882 The max number of reload pseudos which are considered during
11883 spilling a non-reload pseudo.
11885 @item max-pow-sqrt-depth
11886 Maximum depth of sqrt chains to use when synthesizing exponentiation
11887 by a real constant.
11889 @item max-dse-active-local-stores
11890 Maximum number of active local stores in RTL dead store elimination.
11892 @item asan-instrument-allocas
11893 Enable asan allocas/VLAs protection.
11895 @item max-iterations-computation-cost
11896 Bound on the cost of an expression to compute the number of iterations.
11898 @item max-isl-operations
11899 Maximum number of isl operations, 0 means unlimited.
11901 @item graphite-max-arrays-per-scop
11902 Maximum number of arrays per scop.
11904 @item max-vartrack-reverse-op-size
11905 Max. size of loc list for which reverse ops should be added.
11907 @item unlikely-bb-count-fraction
11908 The minimum fraction of profile runs a given basic block execution count
11909 must be not to be considered unlikely.
11911 @item tracer-dynamic-coverage-feedback
11912 The percentage of function, weighted by execution frequency,
11913 that must be covered by trace formation.
11914 Used when profile feedback is available.
11916 @item max-inline-recursive-depth-auto
11917 The maximum depth of recursive inlining for non-inline functions.
11919 @item fsm-scale-path-stmts
11920 Scale factor to apply to the number of statements in a threading path
11921 when comparing to the number of (scaled) blocks.
11923 @item fsm-maximum-phi-arguments
11924 Maximum number of arguments a PHI may have before the FSM threader
11925 will not try to thread through its block.
11927 @item uninit-control-dep-attempts
11928 Maximum number of nested calls to search for control dependencies
11929 during uninitialized variable analysis.
11931 @item indir-call-topn-profile
11932 Track top N target addresses in indirect-call profile.
11934 @item max-once-peeled-insns
11935 The maximum number of insns of a peeled loop that rolls only once.
11937 @item sra-max-scalarization-size-Osize
11938 Maximum size, in storage units, of an aggregate
11939 which should be considered for scalarization when compiling for size.
11941 @item fsm-scale-path-blocks
11942 Scale factor to apply to the number of blocks in a threading path
11943 when comparing to the number of (scaled) statements.
11945 @item sched-autopref-queue-depth
11946 Hardware autoprefetcher scheduler model control flag.
11947 Number of lookahead cycles the model looks into; at '
11948 ' only enable instruction sorting heuristic.
11954 @node Instrumentation Options
11955 @section Program Instrumentation Options
11956 @cindex instrumentation options
11957 @cindex program instrumentation options
11958 @cindex run-time error checking options
11959 @cindex profiling options
11960 @cindex options, program instrumentation
11961 @cindex options, run-time error checking
11962 @cindex options, profiling
11964 GCC supports a number of command-line options that control adding
11965 run-time instrumentation to the code it normally generates.
11966 For example, one purpose of instrumentation is collect profiling
11967 statistics for use in finding program hot spots, code coverage
11968 analysis, or profile-guided optimizations.
11969 Another class of program instrumentation is adding run-time checking
11970 to detect programming errors like invalid pointer
11971 dereferences or out-of-bounds array accesses, as well as deliberately
11972 hostile attacks such as stack smashing or C++ vtable hijacking.
11973 There is also a general hook which can be used to implement other
11974 forms of tracing or function-level instrumentation for debug or
11975 program analysis purposes.
11978 @cindex @command{prof}
11981 Generate extra code to write profile information suitable for the
11982 analysis program @command{prof}. You must use this option when compiling
11983 the source files you want data about, and you must also use it when
11986 @cindex @command{gprof}
11989 Generate extra code to write profile information suitable for the
11990 analysis program @command{gprof}. You must use this option when compiling
11991 the source files you want data about, and you must also use it when
11994 @item -fprofile-arcs
11995 @opindex fprofile-arcs
11996 Add code so that program flow @dfn{arcs} are instrumented. During
11997 execution the program records how many times each branch and call is
11998 executed and how many times it is taken or returns. On targets that support
11999 constructors with priority support, profiling properly handles constructors,
12000 destructors and C++ constructors (and destructors) of classes which are used
12001 as a type of a global variable.
12004 program exits it saves this data to a file called
12005 @file{@var{auxname}.gcda} for each source file. The data may be used for
12006 profile-directed optimizations (@option{-fbranch-probabilities}), or for
12007 test coverage analysis (@option{-ftest-coverage}). Each object file's
12008 @var{auxname} is generated from the name of the output file, if
12009 explicitly specified and it is not the final executable, otherwise it is
12010 the basename of the source file. In both cases any suffix is removed
12011 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
12012 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
12013 @xref{Cross-profiling}.
12015 @cindex @command{gcov}
12019 This option is used to compile and link code instrumented for coverage
12020 analysis. The option is a synonym for @option{-fprofile-arcs}
12021 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
12022 linking). See the documentation for those options for more details.
12027 Compile the source files with @option{-fprofile-arcs} plus optimization
12028 and code generation options. For test coverage analysis, use the
12029 additional @option{-ftest-coverage} option. You do not need to profile
12030 every source file in a program.
12033 Compile the source files additionally with @option{-fprofile-abs-path}
12034 to create absolute path names in the @file{.gcno} files. This allows
12035 @command{gcov} to find the correct sources in projects where compilations
12036 occur with different working directories.
12039 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
12040 (the latter implies the former).
12043 Run the program on a representative workload to generate the arc profile
12044 information. This may be repeated any number of times. You can run
12045 concurrent instances of your program, and provided that the file system
12046 supports locking, the data files will be correctly updated. Unless
12047 a strict ISO C dialect option is in effect, @code{fork} calls are
12048 detected and correctly handled without double counting.
12051 For profile-directed optimizations, compile the source files again with
12052 the same optimization and code generation options plus
12053 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
12054 Control Optimization}).
12057 For test coverage analysis, use @command{gcov} to produce human readable
12058 information from the @file{.gcno} and @file{.gcda} files. Refer to the
12059 @command{gcov} documentation for further information.
12063 With @option{-fprofile-arcs}, for each function of your program GCC
12064 creates a program flow graph, then finds a spanning tree for the graph.
12065 Only arcs that are not on the spanning tree have to be instrumented: the
12066 compiler adds code to count the number of times that these arcs are
12067 executed. When an arc is the only exit or only entrance to a block, the
12068 instrumentation code can be added to the block; otherwise, a new basic
12069 block must be created to hold the instrumentation code.
12072 @item -ftest-coverage
12073 @opindex ftest-coverage
12074 Produce a notes file that the @command{gcov} code-coverage utility
12075 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
12076 show program coverage. Each source file's note file is called
12077 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
12078 above for a description of @var{auxname} and instructions on how to
12079 generate test coverage data. Coverage data matches the source files
12080 more closely if you do not optimize.
12082 @item -fprofile-abs-path
12083 @opindex fprofile-abs-path
12084 Automatically convert relative source file names to absolute path names
12085 in the @file{.gcno} files. This allows @command{gcov} to find the correct
12086 sources in projects where compilations occur with different working
12089 @item -fprofile-dir=@var{path}
12090 @opindex fprofile-dir
12092 Set the directory to search for the profile data files in to @var{path}.
12093 This option affects only the profile data generated by
12094 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
12095 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
12096 and its related options. Both absolute and relative paths can be used.
12097 By default, GCC uses the current directory as @var{path}, thus the
12098 profile data file appears in the same directory as the object file.
12099 In order to prevent the file name clashing, if the object file name is
12100 not an absolute path, we mangle the absolute path of the
12101 @file{@var{sourcename}.gcda} file and use it as the file name of a
12104 When an executable is run in a massive parallel environment, it is recommended
12105 to save profile to different folders. That can be done with variables
12106 in @var{path} that are exported during run-time:
12114 value of environment variable @var{VAR}
12118 @item -fprofile-generate
12119 @itemx -fprofile-generate=@var{path}
12120 @opindex fprofile-generate
12122 Enable options usually used for instrumenting application to produce
12123 profile useful for later recompilation with profile feedback based
12124 optimization. You must use @option{-fprofile-generate} both when
12125 compiling and when linking your program.
12127 The following options are enabled:
12128 @option{-fprofile-arcs}, @option{-fprofile-values},
12129 @option{-finline-functions}, and @option{-fipa-bit-cp}.
12131 If @var{path} is specified, GCC looks at the @var{path} to find
12132 the profile feedback data files. See @option{-fprofile-dir}.
12134 To optimize the program based on the collected profile information, use
12135 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
12137 @item -fprofile-update=@var{method}
12138 @opindex fprofile-update
12140 Alter the update method for an application instrumented for profile
12141 feedback based optimization. The @var{method} argument should be one of
12142 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
12143 The first one is useful for single-threaded applications,
12144 while the second one prevents profile corruption by emitting thread-safe code.
12146 @strong{Warning:} When an application does not properly join all threads
12147 (or creates an detached thread), a profile file can be still corrupted.
12149 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
12150 when supported by a target, or to @samp{single} otherwise. The GCC driver
12151 automatically selects @samp{prefer-atomic} when @option{-pthread}
12152 is present in the command line.
12154 @item -fprofile-filter-files=@var{regex}
12155 @opindex fprofile-filter-files
12157 Instrument only functions from files where names match
12158 any regular expression (separated by a semi-colon).
12160 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
12161 only @file{main.c} and all C files starting with 'module'.
12163 @item -fprofile-exclude-files=@var{regex}
12164 @opindex fprofile-exclude-files
12166 Instrument only functions from files where names do not match
12167 all the regular expressions (separated by a semi-colon).
12169 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
12170 of all files that are located in @file{/usr/} folder.
12172 @item -fsanitize=address
12173 @opindex fsanitize=address
12174 Enable AddressSanitizer, a fast memory error detector.
12175 Memory access instructions are instrumented to detect
12176 out-of-bounds and use-after-free bugs.
12177 The option enables @option{-fsanitize-address-use-after-scope}.
12178 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
12179 more details. The run-time behavior can be influenced using the
12180 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
12181 the available options are shown at startup of the instrumented program. See
12182 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
12183 for a list of supported options.
12184 The option cannot be combined with @option{-fsanitize=thread}.
12186 @item -fsanitize=kernel-address
12187 @opindex fsanitize=kernel-address
12188 Enable AddressSanitizer for Linux kernel.
12189 See @uref{https://github.com/google/kasan/wiki} for more details.
12191 @item -fsanitize=pointer-compare
12192 @opindex fsanitize=pointer-compare
12193 Instrument comparison operation (<, <=, >, >=) with pointer operands.
12194 The option must be combined with either @option{-fsanitize=kernel-address} or
12195 @option{-fsanitize=address}
12196 The option cannot be combined with @option{-fsanitize=thread}.
12197 Note: By default the check is disabled at run time. To enable it,
12198 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12199 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12200 invalid operation only when both pointers are non-null.
12202 @item -fsanitize=pointer-subtract
12203 @opindex fsanitize=pointer-subtract
12204 Instrument subtraction with pointer operands.
12205 The option must be combined with either @option{-fsanitize=kernel-address} or
12206 @option{-fsanitize=address}
12207 The option cannot be combined with @option{-fsanitize=thread}.
12208 Note: By default the check is disabled at run time. To enable it,
12209 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12210 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12211 invalid operation only when both pointers are non-null.
12213 @item -fsanitize=thread
12214 @opindex fsanitize=thread
12215 Enable ThreadSanitizer, a fast data race detector.
12216 Memory access instructions are instrumented to detect
12217 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
12218 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
12219 environment variable; see
12220 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
12222 The option cannot be combined with @option{-fsanitize=address},
12223 @option{-fsanitize=leak}.
12225 Note that sanitized atomic builtins cannot throw exceptions when
12226 operating on invalid memory addresses with non-call exceptions
12227 (@option{-fnon-call-exceptions}).
12229 @item -fsanitize=leak
12230 @opindex fsanitize=leak
12231 Enable LeakSanitizer, a memory leak detector.
12232 This option only matters for linking of executables and
12233 the executable is linked against a library that overrides @code{malloc}
12234 and other allocator functions. See
12235 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
12236 details. The run-time behavior can be influenced using the
12237 @env{LSAN_OPTIONS} environment variable.
12238 The option cannot be combined with @option{-fsanitize=thread}.
12240 @item -fsanitize=undefined
12241 @opindex fsanitize=undefined
12242 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
12243 Various computations are instrumented to detect undefined behavior
12244 at runtime. Current suboptions are:
12248 @item -fsanitize=shift
12249 @opindex fsanitize=shift
12250 This option enables checking that the result of a shift operation is
12251 not undefined. Note that what exactly is considered undefined differs
12252 slightly between C and C++, as well as between ISO C90 and C99, etc.
12253 This option has two suboptions, @option{-fsanitize=shift-base} and
12254 @option{-fsanitize=shift-exponent}.
12256 @item -fsanitize=shift-exponent
12257 @opindex fsanitize=shift-exponent
12258 This option enables checking that the second argument of a shift operation
12259 is not negative and is smaller than the precision of the promoted first
12262 @item -fsanitize=shift-base
12263 @opindex fsanitize=shift-base
12264 If the second argument of a shift operation is within range, check that the
12265 result of a shift operation is not undefined. Note that what exactly is
12266 considered undefined differs slightly between C and C++, as well as between
12267 ISO C90 and C99, etc.
12269 @item -fsanitize=integer-divide-by-zero
12270 @opindex fsanitize=integer-divide-by-zero
12271 Detect integer division by zero as well as @code{INT_MIN / -1} division.
12273 @item -fsanitize=unreachable
12274 @opindex fsanitize=unreachable
12275 With this option, the compiler turns the @code{__builtin_unreachable}
12276 call into a diagnostics message call instead. When reaching the
12277 @code{__builtin_unreachable} call, the behavior is undefined.
12279 @item -fsanitize=vla-bound
12280 @opindex fsanitize=vla-bound
12281 This option instructs the compiler to check that the size of a variable
12282 length array is positive.
12284 @item -fsanitize=null
12285 @opindex fsanitize=null
12286 This option enables pointer checking. Particularly, the application
12287 built with this option turned on will issue an error message when it
12288 tries to dereference a NULL pointer, or if a reference (possibly an
12289 rvalue reference) is bound to a NULL pointer, or if a method is invoked
12290 on an object pointed by a NULL pointer.
12292 @item -fsanitize=return
12293 @opindex fsanitize=return
12294 This option enables return statement checking. Programs
12295 built with this option turned on will issue an error message
12296 when the end of a non-void function is reached without actually
12297 returning a value. This option works in C++ only.
12299 @item -fsanitize=signed-integer-overflow
12300 @opindex fsanitize=signed-integer-overflow
12301 This option enables signed integer overflow checking. We check that
12302 the result of @code{+}, @code{*}, and both unary and binary @code{-}
12303 does not overflow in the signed arithmetics. Note, integer promotion
12304 rules must be taken into account. That is, the following is not an
12307 signed char a = SCHAR_MAX;
12311 @item -fsanitize=bounds
12312 @opindex fsanitize=bounds
12313 This option enables instrumentation of array bounds. Various out of bounds
12314 accesses are detected. Flexible array members, flexible array member-like
12315 arrays, and initializers of variables with static storage are not instrumented.
12317 @item -fsanitize=bounds-strict
12318 @opindex fsanitize=bounds-strict
12319 This option enables strict instrumentation of array bounds. Most out of bounds
12320 accesses are detected, including flexible array members and flexible array
12321 member-like arrays. Initializers of variables with static storage are not
12324 @item -fsanitize=alignment
12325 @opindex fsanitize=alignment
12327 This option enables checking of alignment of pointers when they are
12328 dereferenced, or when a reference is bound to insufficiently aligned target,
12329 or when a method or constructor is invoked on insufficiently aligned object.
12331 @item -fsanitize=object-size
12332 @opindex fsanitize=object-size
12333 This option enables instrumentation of memory references using the
12334 @code{__builtin_object_size} function. Various out of bounds pointer
12335 accesses are detected.
12337 @item -fsanitize=float-divide-by-zero
12338 @opindex fsanitize=float-divide-by-zero
12339 Detect floating-point division by zero. Unlike other similar options,
12340 @option{-fsanitize=float-divide-by-zero} is not enabled by
12341 @option{-fsanitize=undefined}, since floating-point division by zero can
12342 be a legitimate way of obtaining infinities and NaNs.
12344 @item -fsanitize=float-cast-overflow
12345 @opindex fsanitize=float-cast-overflow
12346 This option enables floating-point type to integer conversion checking.
12347 We check that the result of the conversion does not overflow.
12348 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
12349 not enabled by @option{-fsanitize=undefined}.
12350 This option does not work well with @code{FE_INVALID} exceptions enabled.
12352 @item -fsanitize=nonnull-attribute
12353 @opindex fsanitize=nonnull-attribute
12355 This option enables instrumentation of calls, checking whether null values
12356 are not passed to arguments marked as requiring a non-null value by the
12357 @code{nonnull} function attribute.
12359 @item -fsanitize=returns-nonnull-attribute
12360 @opindex fsanitize=returns-nonnull-attribute
12362 This option enables instrumentation of return statements in functions
12363 marked with @code{returns_nonnull} function attribute, to detect returning
12364 of null values from such functions.
12366 @item -fsanitize=bool
12367 @opindex fsanitize=bool
12369 This option enables instrumentation of loads from bool. If a value other
12370 than 0/1 is loaded, a run-time error is issued.
12372 @item -fsanitize=enum
12373 @opindex fsanitize=enum
12375 This option enables instrumentation of loads from an enum type. If
12376 a value outside the range of values for the enum type is loaded,
12377 a run-time error is issued.
12379 @item -fsanitize=vptr
12380 @opindex fsanitize=vptr
12382 This option enables instrumentation of C++ member function calls, member
12383 accesses and some conversions between pointers to base and derived classes,
12384 to verify the referenced object has the correct dynamic type.
12386 @item -fsanitize=pointer-overflow
12387 @opindex fsanitize=pointer-overflow
12389 This option enables instrumentation of pointer arithmetics. If the pointer
12390 arithmetics overflows, a run-time error is issued.
12392 @item -fsanitize=builtin
12393 @opindex fsanitize=builtin
12395 This option enables instrumentation of arguments to selected builtin
12396 functions. If an invalid value is passed to such arguments, a run-time
12397 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12398 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12403 While @option{-ftrapv} causes traps for signed overflows to be emitted,
12404 @option{-fsanitize=undefined} gives a diagnostic message.
12405 This currently works only for the C family of languages.
12407 @item -fno-sanitize=all
12408 @opindex fno-sanitize=all
12410 This option disables all previously enabled sanitizers.
12411 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12414 @item -fasan-shadow-offset=@var{number}
12415 @opindex fasan-shadow-offset
12416 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12417 It is useful for experimenting with different shadow memory layouts in
12418 Kernel AddressSanitizer.
12420 @item -fsanitize-sections=@var{s1},@var{s2},...
12421 @opindex fsanitize-sections
12422 Sanitize global variables in selected user-defined sections. @var{si} may
12425 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
12426 @opindex fsanitize-recover
12427 @opindex fno-sanitize-recover
12428 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
12429 mentioned in comma-separated list of @var{opts}. Enabling this option
12430 for a sanitizer component causes it to attempt to continue
12431 running the program as if no error happened. This means multiple
12432 runtime errors can be reported in a single program run, and the exit
12433 code of the program may indicate success even when errors
12434 have been reported. The @option{-fno-sanitize-recover=} option
12435 can be used to alter
12436 this behavior: only the first detected error is reported
12437 and program then exits with a non-zero exit code.
12439 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12440 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12441 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12442 @option{-fsanitize=bounds-strict},
12443 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12444 For these sanitizers error recovery is turned on by default,
12445 except @option{-fsanitize=address}, for which this feature is experimental.
12446 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12447 accepted, the former enables recovery for all sanitizers that support it,
12448 the latter disables recovery for all sanitizers that support it.
12450 Even if a recovery mode is turned on the compiler side, it needs to be also
12451 enabled on the runtime library side, otherwise the failures are still fatal.
12452 The runtime library defaults to @code{halt_on_error=0} for
12453 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12454 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12455 setting the @code{halt_on_error} flag in the corresponding environment variable.
12457 Syntax without an explicit @var{opts} parameter is deprecated. It is
12458 equivalent to specifying an @var{opts} list of:
12461 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12464 @item -fsanitize-address-use-after-scope
12465 @opindex fsanitize-address-use-after-scope
12466 Enable sanitization of local variables to detect use-after-scope bugs.
12467 The option sets @option{-fstack-reuse} to @samp{none}.
12469 @item -fsanitize-undefined-trap-on-error
12470 @opindex fsanitize-undefined-trap-on-error
12471 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12472 report undefined behavior using @code{__builtin_trap} rather than
12473 a @code{libubsan} library routine. The advantage of this is that the
12474 @code{libubsan} library is not needed and is not linked in, so this
12475 is usable even in freestanding environments.
12477 @item -fsanitize-coverage=trace-pc
12478 @opindex fsanitize-coverage=trace-pc
12479 Enable coverage-guided fuzzing code instrumentation.
12480 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12482 @item -fsanitize-coverage=trace-cmp
12483 @opindex fsanitize-coverage=trace-cmp
12484 Enable dataflow guided fuzzing code instrumentation.
12485 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12486 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12487 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12488 variable or @code{__sanitizer_cov_trace_const_cmp1},
12489 @code{__sanitizer_cov_trace_const_cmp2},
12490 @code{__sanitizer_cov_trace_const_cmp4} or
12491 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12492 operand constant, @code{__sanitizer_cov_trace_cmpf} or
12493 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12494 @code{__sanitizer_cov_trace_switch} for switch statements.
12496 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12497 @opindex fcf-protection
12498 Enable code instrumentation of control-flow transfers to increase
12499 program security by checking that target addresses of control-flow
12500 transfer instructions (such as indirect function call, function return,
12501 indirect jump) are valid. This prevents diverting the flow of control
12502 to an unexpected target. This is intended to protect against such
12503 threats as Return-oriented Programming (ROP), and similarly
12504 call/jmp-oriented programming (COP/JOP).
12506 The value @code{branch} tells the compiler to implement checking of
12507 validity of control-flow transfer at the point of indirect branch
12508 instructions, i.e.@: call/jmp instructions. The value @code{return}
12509 implements checking of validity at the point of returning from a
12510 function. The value @code{full} is an alias for specifying both
12511 @code{branch} and @code{return}. The value @code{none} turns off
12514 The macro @code{__CET__} is defined when @option{-fcf-protection} is
12515 used. The first bit of @code{__CET__} is set to 1 for the value
12516 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12519 You can also use the @code{nocf_check} attribute to identify
12520 which functions and calls should be skipped from instrumentation
12521 (@pxref{Function Attributes}).
12523 Currently the x86 GNU/Linux target provides an implementation based
12524 on Intel Control-flow Enforcement Technology (CET).
12526 @item -fstack-protector
12527 @opindex fstack-protector
12528 Emit extra code to check for buffer overflows, such as stack smashing
12529 attacks. This is done by adding a guard variable to functions with
12530 vulnerable objects. This includes functions that call @code{alloca}, and
12531 functions with buffers larger than 8 bytes. The guards are initialized
12532 when a function is entered and then checked when the function exits.
12533 If a guard check fails, an error message is printed and the program exits.
12535 @item -fstack-protector-all
12536 @opindex fstack-protector-all
12537 Like @option{-fstack-protector} except that all functions are protected.
12539 @item -fstack-protector-strong
12540 @opindex fstack-protector-strong
12541 Like @option{-fstack-protector} but includes additional functions to
12542 be protected --- those that have local array definitions, or have
12543 references to local frame addresses.
12545 @item -fstack-protector-explicit
12546 @opindex fstack-protector-explicit
12547 Like @option{-fstack-protector} but only protects those functions which
12548 have the @code{stack_protect} attribute.
12550 @item -fstack-check
12551 @opindex fstack-check
12552 Generate code to verify that you do not go beyond the boundary of the
12553 stack. You should specify this flag if you are running in an
12554 environment with multiple threads, but you only rarely need to specify it in
12555 a single-threaded environment since stack overflow is automatically
12556 detected on nearly all systems if there is only one stack.
12558 Note that this switch does not actually cause checking to be done; the
12559 operating system or the language runtime must do that. The switch causes
12560 generation of code to ensure that they see the stack being extended.
12562 You can additionally specify a string parameter: @samp{no} means no
12563 checking, @samp{generic} means force the use of old-style checking,
12564 @samp{specific} means use the best checking method and is equivalent
12565 to bare @option{-fstack-check}.
12567 Old-style checking is a generic mechanism that requires no specific
12568 target support in the compiler but comes with the following drawbacks:
12572 Modified allocation strategy for large objects: they are always
12573 allocated dynamically if their size exceeds a fixed threshold. Note this
12574 may change the semantics of some code.
12577 Fixed limit on the size of the static frame of functions: when it is
12578 topped by a particular function, stack checking is not reliable and
12579 a warning is issued by the compiler.
12582 Inefficiency: because of both the modified allocation strategy and the
12583 generic implementation, code performance is hampered.
12586 Note that old-style stack checking is also the fallback method for
12587 @samp{specific} if no target support has been added in the compiler.
12589 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
12590 and stack overflows. @samp{specific} is an excellent choice when compiling
12591 Ada code. It is not generally sufficient to protect against stack-clash
12592 attacks. To protect against those you want @samp{-fstack-clash-protection}.
12594 @item -fstack-clash-protection
12595 @opindex fstack-clash-protection
12596 Generate code to prevent stack clash style attacks. When this option is
12597 enabled, the compiler will only allocate one page of stack space at a time
12598 and each page is accessed immediately after allocation. Thus, it prevents
12599 allocations from jumping over any stack guard page provided by the
12602 Most targets do not fully support stack clash protection. However, on
12603 those targets @option{-fstack-clash-protection} will protect dynamic stack
12604 allocations. @option{-fstack-clash-protection} may also provide limited
12605 protection for static stack allocations if the target supports
12606 @option{-fstack-check=specific}.
12608 @item -fstack-limit-register=@var{reg}
12609 @itemx -fstack-limit-symbol=@var{sym}
12610 @itemx -fno-stack-limit
12611 @opindex fstack-limit-register
12612 @opindex fstack-limit-symbol
12613 @opindex fno-stack-limit
12614 Generate code to ensure that the stack does not grow beyond a certain value,
12615 either the value of a register or the address of a symbol. If a larger
12616 stack is required, a signal is raised at run time. For most targets,
12617 the signal is raised before the stack overruns the boundary, so
12618 it is possible to catch the signal without taking special precautions.
12620 For instance, if the stack starts at absolute address @samp{0x80000000}
12621 and grows downwards, you can use the flags
12622 @option{-fstack-limit-symbol=__stack_limit} and
12623 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
12624 of 128KB@. Note that this may only work with the GNU linker.
12626 You can locally override stack limit checking by using the
12627 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
12629 @item -fsplit-stack
12630 @opindex fsplit-stack
12631 Generate code to automatically split the stack before it overflows.
12632 The resulting program has a discontiguous stack which can only
12633 overflow if the program is unable to allocate any more memory. This
12634 is most useful when running threaded programs, as it is no longer
12635 necessary to calculate a good stack size to use for each thread. This
12636 is currently only implemented for the x86 targets running
12639 When code compiled with @option{-fsplit-stack} calls code compiled
12640 without @option{-fsplit-stack}, there may not be much stack space
12641 available for the latter code to run. If compiling all code,
12642 including library code, with @option{-fsplit-stack} is not an option,
12643 then the linker can fix up these calls so that the code compiled
12644 without @option{-fsplit-stack} always has a large stack. Support for
12645 this is implemented in the gold linker in GNU binutils release 2.21
12648 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
12649 @opindex fvtable-verify
12650 This option is only available when compiling C++ code.
12651 It turns on (or off, if using @option{-fvtable-verify=none}) the security
12652 feature that verifies at run time, for every virtual call, that
12653 the vtable pointer through which the call is made is valid for the type of
12654 the object, and has not been corrupted or overwritten. If an invalid vtable
12655 pointer is detected at run time, an error is reported and execution of the
12656 program is immediately halted.
12658 This option causes run-time data structures to be built at program startup,
12659 which are used for verifying the vtable pointers.
12660 The options @samp{std} and @samp{preinit}
12661 control the timing of when these data structures are built. In both cases the
12662 data structures are built before execution reaches @code{main}. Using
12663 @option{-fvtable-verify=std} causes the data structures to be built after
12664 shared libraries have been loaded and initialized.
12665 @option{-fvtable-verify=preinit} causes them to be built before shared
12666 libraries have been loaded and initialized.
12668 If this option appears multiple times in the command line with different
12669 values specified, @samp{none} takes highest priority over both @samp{std} and
12670 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
12673 @opindex fvtv-debug
12674 When used in conjunction with @option{-fvtable-verify=std} or
12675 @option{-fvtable-verify=preinit}, causes debug versions of the
12676 runtime functions for the vtable verification feature to be called.
12677 This flag also causes the compiler to log information about which
12678 vtable pointers it finds for each class.
12679 This information is written to a file named @file{vtv_set_ptr_data.log}
12680 in the directory named by the environment variable @env{VTV_LOGS_DIR}
12681 if that is defined or the current working directory otherwise.
12683 Note: This feature @emph{appends} data to the log file. If you want a fresh log
12684 file, be sure to delete any existing one.
12687 @opindex fvtv-counts
12688 This is a debugging flag. When used in conjunction with
12689 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
12690 causes the compiler to keep track of the total number of virtual calls
12691 it encounters and the number of verifications it inserts. It also
12692 counts the number of calls to certain run-time library functions
12693 that it inserts and logs this information for each compilation unit.
12694 The compiler writes this information to a file named
12695 @file{vtv_count_data.log} in the directory named by the environment
12696 variable @env{VTV_LOGS_DIR} if that is defined or the current working
12697 directory otherwise. It also counts the size of the vtable pointer sets
12698 for each class, and writes this information to @file{vtv_class_set_sizes.log}
12699 in the same directory.
12701 Note: This feature @emph{appends} data to the log files. To get fresh log
12702 files, be sure to delete any existing ones.
12704 @item -finstrument-functions
12705 @opindex finstrument-functions
12706 Generate instrumentation calls for entry and exit to functions. Just
12707 after function entry and just before function exit, the following
12708 profiling functions are called with the address of the current
12709 function and its call site. (On some platforms,
12710 @code{__builtin_return_address} does not work beyond the current
12711 function, so the call site information may not be available to the
12712 profiling functions otherwise.)
12715 void __cyg_profile_func_enter (void *this_fn,
12717 void __cyg_profile_func_exit (void *this_fn,
12721 The first argument is the address of the start of the current function,
12722 which may be looked up exactly in the symbol table.
12724 This instrumentation is also done for functions expanded inline in other
12725 functions. The profiling calls indicate where, conceptually, the
12726 inline function is entered and exited. This means that addressable
12727 versions of such functions must be available. If all your uses of a
12728 function are expanded inline, this may mean an additional expansion of
12729 code size. If you use @code{extern inline} in your C code, an
12730 addressable version of such functions must be provided. (This is
12731 normally the case anyway, but if you get lucky and the optimizer always
12732 expands the functions inline, you might have gotten away without
12733 providing static copies.)
12735 A function may be given the attribute @code{no_instrument_function}, in
12736 which case this instrumentation is not done. This can be used, for
12737 example, for the profiling functions listed above, high-priority
12738 interrupt routines, and any functions from which the profiling functions
12739 cannot safely be called (perhaps signal handlers, if the profiling
12740 routines generate output or allocate memory).
12742 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
12743 @opindex finstrument-functions-exclude-file-list
12745 Set the list of functions that are excluded from instrumentation (see
12746 the description of @option{-finstrument-functions}). If the file that
12747 contains a function definition matches with one of @var{file}, then
12748 that function is not instrumented. The match is done on substrings:
12749 if the @var{file} parameter is a substring of the file name, it is
12750 considered to be a match.
12755 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
12759 excludes any inline function defined in files whose pathnames
12760 contain @file{/bits/stl} or @file{include/sys}.
12762 If, for some reason, you want to include letter @samp{,} in one of
12763 @var{sym}, write @samp{\,}. For example,
12764 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
12765 (note the single quote surrounding the option).
12767 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
12768 @opindex finstrument-functions-exclude-function-list
12770 This is similar to @option{-finstrument-functions-exclude-file-list},
12771 but this option sets the list of function names to be excluded from
12772 instrumentation. The function name to be matched is its user-visible
12773 name, such as @code{vector<int> blah(const vector<int> &)}, not the
12774 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
12775 match is done on substrings: if the @var{sym} parameter is a substring
12776 of the function name, it is considered to be a match. For C99 and C++
12777 extended identifiers, the function name must be given in UTF-8, not
12778 using universal character names.
12780 @item -fpatchable-function-entry=@var{N}[,@var{M}]
12781 @opindex fpatchable-function-entry
12782 Generate @var{N} NOPs right at the beginning
12783 of each function, with the function entry point before the @var{M}th NOP.
12784 If @var{M} is omitted, it defaults to @code{0} so the
12785 function entry points to the address just at the first NOP.
12786 The NOP instructions reserve extra space which can be used to patch in
12787 any desired instrumentation at run time, provided that the code segment
12788 is writable. The amount of space is controllable indirectly via
12789 the number of NOPs; the NOP instruction used corresponds to the instruction
12790 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
12791 is target-specific and may also depend on the architecture variant and/or
12792 other compilation options.
12794 For run-time identification, the starting addresses of these areas,
12795 which correspond to their respective function entries minus @var{M},
12796 are additionally collected in the @code{__patchable_function_entries}
12797 section of the resulting binary.
12799 Note that the value of @code{__attribute__ ((patchable_function_entry
12800 (N,M)))} takes precedence over command-line option
12801 @option{-fpatchable-function-entry=N,M}. This can be used to increase
12802 the area size or to remove it completely on a single function.
12803 If @code{N=0}, no pad location is recorded.
12805 The NOP instructions are inserted at---and maybe before, depending on
12806 @var{M}---the function entry address, even before the prologue.
12811 @node Preprocessor Options
12812 @section Options Controlling the Preprocessor
12813 @cindex preprocessor options
12814 @cindex options, preprocessor
12816 These options control the C preprocessor, which is run on each C source
12817 file before actual compilation.
12819 If you use the @option{-E} option, nothing is done except preprocessing.
12820 Some of these options make sense only together with @option{-E} because
12821 they cause the preprocessor output to be unsuitable for actual
12824 In addition to the options listed here, there are a number of options
12825 to control search paths for include files documented in
12826 @ref{Directory Options}.
12827 Options to control preprocessor diagnostics are listed in
12828 @ref{Warning Options}.
12831 @include cppopts.texi
12833 @item -Wp,@var{option}
12835 You can use @option{-Wp,@var{option}} to bypass the compiler driver
12836 and pass @var{option} directly through to the preprocessor. If
12837 @var{option} contains commas, it is split into multiple options at the
12838 commas. However, many options are modified, translated or interpreted
12839 by the compiler driver before being passed to the preprocessor, and
12840 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
12841 interface is undocumented and subject to change, so whenever possible
12842 you should avoid using @option{-Wp} and let the driver handle the
12845 @item -Xpreprocessor @var{option}
12846 @opindex Xpreprocessor
12847 Pass @var{option} as an option to the preprocessor. You can use this to
12848 supply system-specific preprocessor options that GCC does not
12851 If you want to pass an option that takes an argument, you must use
12852 @option{-Xpreprocessor} twice, once for the option and once for the argument.
12854 @item -no-integrated-cpp
12855 @opindex no-integrated-cpp
12856 Perform preprocessing as a separate pass before compilation.
12857 By default, GCC performs preprocessing as an integrated part of
12858 input tokenization and parsing.
12859 If this option is provided, the appropriate language front end
12860 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
12861 and Objective-C, respectively) is instead invoked twice,
12862 once for preprocessing only and once for actual compilation
12863 of the preprocessed input.
12864 This option may be useful in conjunction with the @option{-B} or
12865 @option{-wrapper} options to specify an alternate preprocessor or
12866 perform additional processing of the program source between
12867 normal preprocessing and compilation.
12871 @node Assembler Options
12872 @section Passing Options to the Assembler
12874 @c prevent bad page break with this line
12875 You can pass options to the assembler.
12878 @item -Wa,@var{option}
12880 Pass @var{option} as an option to the assembler. If @var{option}
12881 contains commas, it is split into multiple options at the commas.
12883 @item -Xassembler @var{option}
12884 @opindex Xassembler
12885 Pass @var{option} as an option to the assembler. You can use this to
12886 supply system-specific assembler options that GCC does not
12889 If you want to pass an option that takes an argument, you must use
12890 @option{-Xassembler} twice, once for the option and once for the argument.
12895 @section Options for Linking
12896 @cindex link options
12897 @cindex options, linking
12899 These options come into play when the compiler links object files into
12900 an executable output file. They are meaningless if the compiler is
12901 not doing a link step.
12905 @item @var{object-file-name}
12906 A file name that does not end in a special recognized suffix is
12907 considered to name an object file or library. (Object files are
12908 distinguished from libraries by the linker according to the file
12909 contents.) If linking is done, these object files are used as input
12918 If any of these options is used, then the linker is not run, and
12919 object file names should not be used as arguments. @xref{Overall
12922 @item -flinker-output=@var{type}
12923 @opindex flinker-output
12924 This option controls the code generation of the link time optimizer. By
12925 default the linker output is determined by the linker plugin automatically. For
12926 debugging the compiler and in the case of incremental linking to non-lto object
12927 file is desired, it may be useful to control the type manually.
12929 If @var{type} is @samp{exec} the code generation is configured to produce static
12930 binary. In this case @option{-fpic} and @option{-fpie} are both disabled.
12932 If @var{type} is @samp{dyn} the code generation is configured to produce shared
12933 library. In this case @option{-fpic} or @option{-fPIC} is preserved, but not
12934 enabled automatically. This makes it possible to build shared libraries without
12935 position independent code on architectures this is possible, i.e.@: on x86.
12937 If @var{type} is @samp{pie} the code generation is configured to produce
12938 @option{-fpie} executable. This result in similar optimizations as @samp{exec}
12939 except that @option{-fpie} is not disabled if specified at compilation time.
12941 If @var{type} is @samp{rel} the compiler assumes that incremental linking is
12942 done. The sections containing intermediate code for link-time optimization are
12943 merged, pre-optimized, and output to the resulting object file. In addition, if
12944 @option{-ffat-lto-objects} is specified the binary code is produced for future
12945 non-lto linking. The object file produced by incremental linking will be smaller
12946 than a static library produced from the same object files. At link-time the
12947 result of incremental linking will also load faster to compiler than a static
12948 library assuming that majority of objects in the library are used.
12950 Finally @samp{nolto-rel} configure compiler to for incremental linking where
12951 code generation is forced, final binary is produced and the intermediate code
12952 for later link-time optimization is stripped. When multiple object files are
12953 linked together the resulting code will be optimized better than with link time
12954 optimizations disabled (for example, the cross-module inlining will happen),
12955 most of benefits of whole program optimizations are however lost.
12957 During the incremental link (by @option{-r}) the linker plugin will default to
12958 @option{rel}. With current interfaces to GNU Binutils it is however not
12959 possible to link incrementally LTO objects and non-LTO objects into a single
12960 mixed object file. In the case any of object files in incremental link can not
12961 be used for link-time optimization the linker plugin will output warning and
12962 use @samp{nolto-rel}. To maintain the whole program optimization it is
12963 recommended to link such objects into static library instead. Alternatively it
12964 is possible to use H.J. Lu's binutils with support for mixed objects.
12967 @opindex fuse-ld=bfd
12968 Use the @command{bfd} linker instead of the default linker.
12970 @item -fuse-ld=gold
12971 @opindex fuse-ld=gold
12972 Use the @command{gold} linker instead of the default linker.
12975 @opindex fuse-ld=lld
12976 Use the LLVM @command{lld} linker instead of the default linker.
12979 @item -l@var{library}
12980 @itemx -l @var{library}
12982 Search the library named @var{library} when linking. (The second
12983 alternative with the library as a separate argument is only for
12984 POSIX compliance and is not recommended.)
12986 It makes a difference where in the command you write this option; the
12987 linker searches and processes libraries and object files in the order they
12988 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
12989 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
12990 to functions in @samp{z}, those functions may not be loaded.
12992 The linker searches a standard list of directories for the library,
12993 which is actually a file named @file{lib@var{library}.a}. The linker
12994 then uses this file as if it had been specified precisely by name.
12996 The directories searched include several standard system directories
12997 plus any that you specify with @option{-L}.
12999 Normally the files found this way are library files---archive files
13000 whose members are object files. The linker handles an archive file by
13001 scanning through it for members which define symbols that have so far
13002 been referenced but not defined. But if the file that is found is an
13003 ordinary object file, it is linked in the usual fashion. The only
13004 difference between using an @option{-l} option and specifying a file name
13005 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
13006 and searches several directories.
13010 You need this special case of the @option{-l} option in order to
13011 link an Objective-C or Objective-C++ program.
13013 @item -nostartfiles
13014 @opindex nostartfiles
13015 Do not use the standard system startup files when linking.
13016 The standard system libraries are used normally, unless @option{-nostdlib},
13017 @option{-nolibc}, or @option{-nodefaultlibs} is used.
13019 @item -nodefaultlibs
13020 @opindex nodefaultlibs
13021 Do not use the standard system libraries when linking.
13022 Only the libraries you specify are passed to the linker, and options
13023 specifying linkage of the system libraries, such as @option{-static-libgcc}
13024 or @option{-shared-libgcc}, are ignored.
13025 The standard startup files are used normally, unless @option{-nostartfiles}
13028 The compiler may generate calls to @code{memcmp},
13029 @code{memset}, @code{memcpy} and @code{memmove}.
13030 These entries are usually resolved by entries in
13031 libc. These entry points should be supplied through some other
13032 mechanism when this option is specified.
13036 Do not use the C library or system libraries tightly coupled with it when
13037 linking. Still link with the startup files, @file{libgcc} or toolchain
13038 provided language support libraries such as @file{libgnat}, @file{libgfortran}
13039 or @file{libstdc++} unless options preventing their inclusion are used as
13040 well. This typically removes @option{-lc} from the link command line, as well
13041 as system libraries that normally go with it and become meaningless when
13042 absence of a C library is assumed, for example @option{-lpthread} or
13043 @option{-lm} in some configurations. This is intended for bare-board
13044 targets when there is indeed no C library available.
13048 Do not use the standard system startup files or libraries when linking.
13049 No startup files and only the libraries you specify are passed to
13050 the linker, and options specifying linkage of the system libraries, such as
13051 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
13053 The compiler may generate calls to @code{memcmp}, @code{memset},
13054 @code{memcpy} and @code{memmove}.
13055 These entries are usually resolved by entries in
13056 libc. These entry points should be supplied through some other
13057 mechanism when this option is specified.
13059 @cindex @option{-lgcc}, use with @option{-nostdlib}
13060 @cindex @option{-nostdlib} and unresolved references
13061 @cindex unresolved references and @option{-nostdlib}
13062 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
13063 @cindex @option{-nodefaultlibs} and unresolved references
13064 @cindex unresolved references and @option{-nodefaultlibs}
13065 One of the standard libraries bypassed by @option{-nostdlib} and
13066 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
13067 which GCC uses to overcome shortcomings of particular machines, or special
13068 needs for some languages.
13069 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
13070 Collection (GCC) Internals},
13071 for more discussion of @file{libgcc.a}.)
13072 In most cases, you need @file{libgcc.a} even when you want to avoid
13073 other standard libraries. In other words, when you specify @option{-nostdlib}
13074 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
13075 This ensures that you have no unresolved references to internal GCC
13076 library subroutines.
13077 (An example of such an internal subroutine is @code{__main}, used to ensure C++
13078 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
13079 GNU Compiler Collection (GCC) Internals}.)
13081 @item -e @var{entry}
13082 @itemx --entry=@var{entry}
13086 Specify that the program entry point is @var{entry}. The argument is
13087 interpreted by the linker; the GNU linker accepts either a symbol name
13092 Produce a dynamically linked position independent executable on targets
13093 that support it. For predictable results, you must also specify the same
13094 set of options used for compilation (@option{-fpie}, @option{-fPIE},
13095 or model suboptions) when you specify this linker option.
13099 Don't produce a dynamically linked position independent executable.
13102 @opindex static-pie
13103 Produce a static position independent executable on targets that support
13104 it. A static position independent executable is similar to a static
13105 executable, but can be loaded at any address without a dynamic linker.
13106 For predictable results, you must also specify the same set of options
13107 used for compilation (@option{-fpie}, @option{-fPIE}, or model
13108 suboptions) when you specify this linker option.
13112 Link with the POSIX threads library. This option is supported on
13113 GNU/Linux targets, most other Unix derivatives, and also on
13114 x86 Cygwin and MinGW targets. On some targets this option also sets
13115 flags for the preprocessor, so it should be used consistently for both
13116 compilation and linking.
13120 Produce a relocatable object as output. This is also known as partial
13125 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
13126 that support it. This instructs the linker to add all symbols, not
13127 only used ones, to the dynamic symbol table. This option is needed
13128 for some uses of @code{dlopen} or to allow obtaining backtraces
13129 from within a program.
13133 Remove all symbol table and relocation information from the executable.
13137 On systems that support dynamic linking, this overrides @option{-pie}
13138 and prevents linking with the shared libraries. On other systems, this
13139 option has no effect.
13143 Produce a shared object which can then be linked with other objects to
13144 form an executable. Not all systems support this option. For predictable
13145 results, you must also specify the same set of options used for compilation
13146 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
13147 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
13148 needs to build supplementary stub code for constructors to work. On
13149 multi-libbed systems, @samp{gcc -shared} must select the correct support
13150 libraries to link against. Failing to supply the correct flags may lead
13151 to subtle defects. Supplying them in cases where they are not necessary
13154 @item -shared-libgcc
13155 @itemx -static-libgcc
13156 @opindex shared-libgcc
13157 @opindex static-libgcc
13158 On systems that provide @file{libgcc} as a shared library, these options
13159 force the use of either the shared or static version, respectively.
13160 If no shared version of @file{libgcc} was built when the compiler was
13161 configured, these options have no effect.
13163 There are several situations in which an application should use the
13164 shared @file{libgcc} instead of the static version. The most common
13165 of these is when the application wishes to throw and catch exceptions
13166 across different shared libraries. In that case, each of the libraries
13167 as well as the application itself should use the shared @file{libgcc}.
13169 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
13170 whenever you build a shared library or a main executable, because C++
13171 programs typically use exceptions, so this is the right thing to do.
13173 If, instead, you use the GCC driver to create shared libraries, you may
13174 find that they are not always linked with the shared @file{libgcc}.
13175 If GCC finds, at its configuration time, that you have a non-GNU linker
13176 or a GNU linker that does not support option @option{--eh-frame-hdr},
13177 it links the shared version of @file{libgcc} into shared libraries
13178 by default. Otherwise, it takes advantage of the linker and optimizes
13179 away the linking with the shared version of @file{libgcc}, linking with
13180 the static version of libgcc by default. This allows exceptions to
13181 propagate through such shared libraries, without incurring relocation
13182 costs at library load time.
13184 However, if a library or main executable is supposed to throw or catch
13185 exceptions, you must link it using the G++ driver, or using the option
13186 @option{-shared-libgcc}, such that it is linked with the shared
13189 @item -static-libasan
13190 @opindex static-libasan
13191 When the @option{-fsanitize=address} option is used to link a program,
13192 the GCC driver automatically links against @option{libasan}. If
13193 @file{libasan} is available as a shared library, and the @option{-static}
13194 option is not used, then this links against the shared version of
13195 @file{libasan}. The @option{-static-libasan} option directs the GCC
13196 driver to link @file{libasan} statically, without necessarily linking
13197 other libraries statically.
13199 @item -static-libtsan
13200 @opindex static-libtsan
13201 When the @option{-fsanitize=thread} option is used to link a program,
13202 the GCC driver automatically links against @option{libtsan}. If
13203 @file{libtsan} is available as a shared library, and the @option{-static}
13204 option is not used, then this links against the shared version of
13205 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
13206 driver to link @file{libtsan} statically, without necessarily linking
13207 other libraries statically.
13209 @item -static-liblsan
13210 @opindex static-liblsan
13211 When the @option{-fsanitize=leak} option is used to link a program,
13212 the GCC driver automatically links against @option{liblsan}. If
13213 @file{liblsan} is available as a shared library, and the @option{-static}
13214 option is not used, then this links against the shared version of
13215 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
13216 driver to link @file{liblsan} statically, without necessarily linking
13217 other libraries statically.
13219 @item -static-libubsan
13220 @opindex static-libubsan
13221 When the @option{-fsanitize=undefined} option is used to link a program,
13222 the GCC driver automatically links against @option{libubsan}. If
13223 @file{libubsan} is available as a shared library, and the @option{-static}
13224 option is not used, then this links against the shared version of
13225 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
13226 driver to link @file{libubsan} statically, without necessarily linking
13227 other libraries statically.
13229 @item -static-libstdc++
13230 @opindex static-libstdc++
13231 When the @command{g++} program is used to link a C++ program, it
13232 normally automatically links against @option{libstdc++}. If
13233 @file{libstdc++} is available as a shared library, and the
13234 @option{-static} option is not used, then this links against the
13235 shared version of @file{libstdc++}. That is normally fine. However, it
13236 is sometimes useful to freeze the version of @file{libstdc++} used by
13237 the program without going all the way to a fully static link. The
13238 @option{-static-libstdc++} option directs the @command{g++} driver to
13239 link @file{libstdc++} statically, without necessarily linking other
13240 libraries statically.
13244 Bind references to global symbols when building a shared object. Warn
13245 about any unresolved references (unless overridden by the link editor
13246 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
13249 @item -T @var{script}
13251 @cindex linker script
13252 Use @var{script} as the linker script. This option is supported by most
13253 systems using the GNU linker. On some targets, such as bare-board
13254 targets without an operating system, the @option{-T} option may be required
13255 when linking to avoid references to undefined symbols.
13257 @item -Xlinker @var{option}
13259 Pass @var{option} as an option to the linker. You can use this to
13260 supply system-specific linker options that GCC does not recognize.
13262 If you want to pass an option that takes a separate argument, you must use
13263 @option{-Xlinker} twice, once for the option and once for the argument.
13264 For example, to pass @option{-assert definitions}, you must write
13265 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
13266 @option{-Xlinker "-assert definitions"}, because this passes the entire
13267 string as a single argument, which is not what the linker expects.
13269 When using the GNU linker, it is usually more convenient to pass
13270 arguments to linker options using the @option{@var{option}=@var{value}}
13271 syntax than as separate arguments. For example, you can specify
13272 @option{-Xlinker -Map=output.map} rather than
13273 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
13274 this syntax for command-line options.
13276 @item -Wl,@var{option}
13278 Pass @var{option} as an option to the linker. If @var{option} contains
13279 commas, it is split into multiple options at the commas. You can use this
13280 syntax to pass an argument to the option.
13281 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
13282 linker. When using the GNU linker, you can also get the same effect with
13283 @option{-Wl,-Map=output.map}.
13285 @item -u @var{symbol}
13287 Pretend the symbol @var{symbol} is undefined, to force linking of
13288 library modules to define it. You can use @option{-u} multiple times with
13289 different symbols to force loading of additional library modules.
13291 @item -z @var{keyword}
13293 @option{-z} is passed directly on to the linker along with the keyword
13294 @var{keyword}. See the section in the documentation of your linker for
13295 permitted values and their meanings.
13298 @node Directory Options
13299 @section Options for Directory Search
13300 @cindex directory options
13301 @cindex options, directory search
13302 @cindex search path
13304 These options specify directories to search for header files, for
13305 libraries and for parts of the compiler:
13308 @include cppdiropts.texi
13310 @item -iplugindir=@var{dir}
13311 @opindex iplugindir=
13312 Set the directory to search for plugins that are passed
13313 by @option{-fplugin=@var{name}} instead of
13314 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
13315 to be used by the user, but only passed by the driver.
13319 Add directory @var{dir} to the list of directories to be searched
13322 @item -B@var{prefix}
13324 This option specifies where to find the executables, libraries,
13325 include files, and data files of the compiler itself.
13327 The compiler driver program runs one or more of the subprograms
13328 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
13329 @var{prefix} as a prefix for each program it tries to run, both with and
13330 without @samp{@var{machine}/@var{version}/} for the corresponding target
13331 machine and compiler version.
13333 For each subprogram to be run, the compiler driver first tries the
13334 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
13335 is not specified, the driver tries two standard prefixes,
13336 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
13337 those results in a file name that is found, the unmodified program
13338 name is searched for using the directories specified in your
13339 @env{PATH} environment variable.
13341 The compiler checks to see if the path provided by @option{-B}
13342 refers to a directory, and if necessary it adds a directory
13343 separator character at the end of the path.
13345 @option{-B} prefixes that effectively specify directory names also apply
13346 to libraries in the linker, because the compiler translates these
13347 options into @option{-L} options for the linker. They also apply to
13348 include files in the preprocessor, because the compiler translates these
13349 options into @option{-isystem} options for the preprocessor. In this case,
13350 the compiler appends @samp{include} to the prefix.
13352 The runtime support file @file{libgcc.a} can also be searched for using
13353 the @option{-B} prefix, if needed. If it is not found there, the two
13354 standard prefixes above are tried, and that is all. The file is left
13355 out of the link if it is not found by those means.
13357 Another way to specify a prefix much like the @option{-B} prefix is to use
13358 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
13361 As a special kludge, if the path provided by @option{-B} is
13362 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
13363 9, then it is replaced by @file{[dir/]include}. This is to help
13364 with boot-strapping the compiler.
13366 @item -no-canonical-prefixes
13367 @opindex no-canonical-prefixes
13368 Do not expand any symbolic links, resolve references to @samp{/../}
13369 or @samp{/./}, or make the path absolute when generating a relative
13372 @item --sysroot=@var{dir}
13374 Use @var{dir} as the logical root directory for headers and libraries.
13375 For example, if the compiler normally searches for headers in
13376 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
13377 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13379 If you use both this option and the @option{-isysroot} option, then
13380 the @option{--sysroot} option applies to libraries, but the
13381 @option{-isysroot} option applies to header files.
13383 The GNU linker (beginning with version 2.16) has the necessary support
13384 for this option. If your linker does not support this option, the
13385 header file aspect of @option{--sysroot} still works, but the
13386 library aspect does not.
13388 @item --no-sysroot-suffix
13389 @opindex no-sysroot-suffix
13390 For some targets, a suffix is added to the root directory specified
13391 with @option{--sysroot}, depending on the other options used, so that
13392 headers may for example be found in
13393 @file{@var{dir}/@var{suffix}/usr/include} instead of
13394 @file{@var{dir}/usr/include}. This option disables the addition of
13399 @node Code Gen Options
13400 @section Options for Code Generation Conventions
13401 @cindex code generation conventions
13402 @cindex options, code generation
13403 @cindex run-time options
13405 These machine-independent options control the interface conventions
13406 used in code generation.
13408 Most of them have both positive and negative forms; the negative form
13409 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
13410 one of the forms is listed---the one that is not the default. You
13411 can figure out the other form by either removing @samp{no-} or adding
13415 @item -fstack-reuse=@var{reuse-level}
13416 @opindex fstack_reuse
13417 This option controls stack space reuse for user declared local/auto variables
13418 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
13419 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13420 local variables and temporaries, @samp{named_vars} enables the reuse only for
13421 user defined local variables with names, and @samp{none} disables stack reuse
13422 completely. The default value is @samp{all}. The option is needed when the
13423 program extends the lifetime of a scoped local variable or a compiler generated
13424 temporary beyond the end point defined by the language. When a lifetime of
13425 a variable ends, and if the variable lives in memory, the optimizing compiler
13426 has the freedom to reuse its stack space with other temporaries or scoped
13427 local variables whose live range does not overlap with it. Legacy code extending
13428 local lifetime is likely to break with the stack reuse optimization.
13447 if (*p == 10) // out of scope use of local1
13458 A(int k) : i(k), j(k) @{ @}
13465 void foo(const A& ar)
13472 foo(A(10)); // temp object's lifetime ends when foo returns
13478 ap->i+= 10; // ap references out of scope temp whose space
13479 // is reused with a. What is the value of ap->i?
13484 The lifetime of a compiler generated temporary is well defined by the C++
13485 standard. When a lifetime of a temporary ends, and if the temporary lives
13486 in memory, the optimizing compiler has the freedom to reuse its stack
13487 space with other temporaries or scoped local variables whose live range
13488 does not overlap with it. However some of the legacy code relies on
13489 the behavior of older compilers in which temporaries' stack space is
13490 not reused, the aggressive stack reuse can lead to runtime errors. This
13491 option is used to control the temporary stack reuse optimization.
13495 This option generates traps for signed overflow on addition, subtraction,
13496 multiplication operations.
13497 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13498 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13499 @option{-fwrapv} being effective. Note that only active options override, so
13500 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13501 results in @option{-ftrapv} being effective.
13505 This option instructs the compiler to assume that signed arithmetic
13506 overflow of addition, subtraction and multiplication wraps around
13507 using twos-complement representation. This flag enables some optimizations
13508 and disables others.
13509 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13510 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13511 @option{-fwrapv} being effective. Note that only active options override, so
13512 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13513 results in @option{-ftrapv} being effective.
13515 @item -fwrapv-pointer
13516 @opindex fwrapv-pointer
13517 This option instructs the compiler to assume that pointer arithmetic
13518 overflow on addition and subtraction wraps around using twos-complement
13519 representation. This flag disables some optimizations which assume
13520 pointer overflow is invalid.
13522 @item -fstrict-overflow
13523 @opindex fstrict-overflow
13524 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13525 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13528 @opindex fexceptions
13529 Enable exception handling. Generates extra code needed to propagate
13530 exceptions. For some targets, this implies GCC generates frame
13531 unwind information for all functions, which can produce significant data
13532 size overhead, although it does not affect execution. If you do not
13533 specify this option, GCC enables it by default for languages like
13534 C++ that normally require exception handling, and disables it for
13535 languages like C that do not normally require it. However, you may need
13536 to enable this option when compiling C code that needs to interoperate
13537 properly with exception handlers written in C++. You may also wish to
13538 disable this option if you are compiling older C++ programs that don't
13539 use exception handling.
13541 @item -fnon-call-exceptions
13542 @opindex fnon-call-exceptions
13543 Generate code that allows trapping instructions to throw exceptions.
13544 Note that this requires platform-specific runtime support that does
13545 not exist everywhere. Moreover, it only allows @emph{trapping}
13546 instructions to throw exceptions, i.e.@: memory references or floating-point
13547 instructions. It does not allow exceptions to be thrown from
13548 arbitrary signal handlers such as @code{SIGALRM}.
13550 @item -fdelete-dead-exceptions
13551 @opindex fdelete-dead-exceptions
13552 Consider that instructions that may throw exceptions but don't otherwise
13553 contribute to the execution of the program can be optimized away.
13554 This option is enabled by default for the Ada front end, as permitted by
13555 the Ada language specification.
13556 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
13558 @item -funwind-tables
13559 @opindex funwind-tables
13560 Similar to @option{-fexceptions}, except that it just generates any needed
13561 static data, but does not affect the generated code in any other way.
13562 You normally do not need to enable this option; instead, a language processor
13563 that needs this handling enables it on your behalf.
13565 @item -fasynchronous-unwind-tables
13566 @opindex fasynchronous-unwind-tables
13567 Generate unwind table in DWARF format, if supported by target machine. The
13568 table is exact at each instruction boundary, so it can be used for stack
13569 unwinding from asynchronous events (such as debugger or garbage collector).
13571 @item -fno-gnu-unique
13572 @opindex fno-gnu-unique
13573 @opindex fgnu-unique
13574 On systems with recent GNU assembler and C library, the C++ compiler
13575 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
13576 of template static data members and static local variables in inline
13577 functions are unique even in the presence of @code{RTLD_LOCAL}; this
13578 is necessary to avoid problems with a library used by two different
13579 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
13580 therefore disagreeing with the other one about the binding of the
13581 symbol. But this causes @code{dlclose} to be ignored for affected
13582 DSOs; if your program relies on reinitialization of a DSO via
13583 @code{dlclose} and @code{dlopen}, you can use
13584 @option{-fno-gnu-unique}.
13586 @item -fpcc-struct-return
13587 @opindex fpcc-struct-return
13588 Return ``short'' @code{struct} and @code{union} values in memory like
13589 longer ones, rather than in registers. This convention is less
13590 efficient, but it has the advantage of allowing intercallability between
13591 GCC-compiled files and files compiled with other compilers, particularly
13592 the Portable C Compiler (pcc).
13594 The precise convention for returning structures in memory depends
13595 on the target configuration macros.
13597 Short structures and unions are those whose size and alignment match
13598 that of some integer type.
13600 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13601 switch is not binary compatible with code compiled with the
13602 @option{-freg-struct-return} switch.
13603 Use it to conform to a non-default application binary interface.
13605 @item -freg-struct-return
13606 @opindex freg-struct-return
13607 Return @code{struct} and @code{union} values in registers when possible.
13608 This is more efficient for small structures than
13609 @option{-fpcc-struct-return}.
13611 If you specify neither @option{-fpcc-struct-return} nor
13612 @option{-freg-struct-return}, GCC defaults to whichever convention is
13613 standard for the target. If there is no standard convention, GCC
13614 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13615 the principal compiler. In those cases, we can choose the standard, and
13616 we chose the more efficient register return alternative.
13618 @strong{Warning:} code compiled with the @option{-freg-struct-return}
13619 switch is not binary compatible with code compiled with the
13620 @option{-fpcc-struct-return} switch.
13621 Use it to conform to a non-default application binary interface.
13623 @item -fshort-enums
13624 @opindex fshort-enums
13625 Allocate to an @code{enum} type only as many bytes as it needs for the
13626 declared range of possible values. Specifically, the @code{enum} type
13627 is equivalent to the smallest integer type that has enough room.
13629 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13630 code that is not binary compatible with code generated without that switch.
13631 Use it to conform to a non-default application binary interface.
13633 @item -fshort-wchar
13634 @opindex fshort-wchar
13635 Override the underlying type for @code{wchar_t} to be @code{short
13636 unsigned int} instead of the default for the target. This option is
13637 useful for building programs to run under WINE@.
13639 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13640 code that is not binary compatible with code generated without that switch.
13641 Use it to conform to a non-default application binary interface.
13644 @opindex fno-common
13646 @cindex tentative definitions
13647 In C code, this option controls the placement of global variables
13648 defined without an initializer, known as @dfn{tentative definitions}
13649 in the C standard. Tentative definitions are distinct from declarations
13650 of a variable with the @code{extern} keyword, which do not allocate storage.
13652 Unix C compilers have traditionally allocated storage for
13653 uninitialized global variables in a common block. This allows the
13654 linker to resolve all tentative definitions of the same variable
13655 in different compilation units to the same object, or to a non-tentative
13657 This is the behavior specified by @option{-fcommon}, and is the default for
13658 GCC on most targets.
13659 On the other hand, this behavior is not required by ISO
13660 C, and on some targets may carry a speed or code size penalty on
13661 variable references.
13663 The @option{-fno-common} option specifies that the compiler should instead
13664 place uninitialized global variables in the BSS section of the object file.
13665 This inhibits the merging of tentative definitions by the linker so
13666 you get a multiple-definition error if the same
13667 variable is defined in more than one compilation unit.
13668 Compiling with @option{-fno-common} is useful on targets for which
13669 it provides better performance, or if you wish to verify that the
13670 program will work on other systems that always treat uninitialized
13671 variable definitions this way.
13676 Ignore the @code{#ident} directive.
13678 @item -finhibit-size-directive
13679 @opindex finhibit-size-directive
13680 Don't output a @code{.size} assembler directive, or anything else that
13681 would cause trouble if the function is split in the middle, and the
13682 two halves are placed at locations far apart in memory. This option is
13683 used when compiling @file{crtstuff.c}; you should not need to use it
13686 @item -fverbose-asm
13687 @opindex fverbose-asm
13688 Put extra commentary information in the generated assembly code to
13689 make it more readable. This option is generally only of use to those
13690 who actually need to read the generated assembly code (perhaps while
13691 debugging the compiler itself).
13693 @option{-fno-verbose-asm}, the default, causes the
13694 extra information to be omitted and is useful when comparing two assembler
13697 The added comments include:
13702 information on the compiler version and command-line options,
13705 the source code lines associated with the assembly instructions,
13706 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
13709 hints on which high-level expressions correspond to
13710 the various assembly instruction operands.
13714 For example, given this C source file:
13722 for (i = 0; i < n; i++)
13729 compiling to (x86_64) assembly via @option{-S} and emitting the result
13730 direct to stdout via @option{-o} @option{-}
13733 gcc -S test.c -fverbose-asm -Os -o -
13736 gives output similar to this:
13740 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
13747 .type test, @@function
13751 # test.c:4: int total = 0;
13752 xorl %eax, %eax # <retval>
13753 # test.c:6: for (i = 0; i < n; i++)
13754 xorl %edx, %edx # i
13756 # test.c:6: for (i = 0; i < n; i++)
13757 cmpl %edi, %edx # n, i
13759 # test.c:7: total += i * i;
13760 movl %edx, %ecx # i, tmp92
13761 imull %edx, %ecx # i, tmp92
13762 # test.c:6: for (i = 0; i < n; i++)
13764 # test.c:7: total += i * i;
13765 addl %ecx, %eax # tmp92, <retval>
13773 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
13774 .section .note.GNU-stack,"",@@progbits
13777 The comments are intended for humans rather than machines and hence the
13778 precise format of the comments is subject to change.
13780 @item -frecord-gcc-switches
13781 @opindex frecord-gcc-switches
13782 This switch causes the command line used to invoke the
13783 compiler to be recorded into the object file that is being created.
13784 This switch is only implemented on some targets and the exact format
13785 of the recording is target and binary file format dependent, but it
13786 usually takes the form of a section containing ASCII text. This
13787 switch is related to the @option{-fverbose-asm} switch, but that
13788 switch only records information in the assembler output file as
13789 comments, so it never reaches the object file.
13790 See also @option{-grecord-gcc-switches} for another
13791 way of storing compiler options into the object file.
13795 @cindex global offset table
13797 Generate position-independent code (PIC) suitable for use in a shared
13798 library, if supported for the target machine. Such code accesses all
13799 constant addresses through a global offset table (GOT)@. The dynamic
13800 loader resolves the GOT entries when the program starts (the dynamic
13801 loader is not part of GCC; it is part of the operating system). If
13802 the GOT size for the linked executable exceeds a machine-specific
13803 maximum size, you get an error message from the linker indicating that
13804 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
13805 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
13806 on the m68k and RS/6000. The x86 has no such limit.)
13808 Position-independent code requires special support, and therefore works
13809 only on certain machines. For the x86, GCC supports PIC for System V
13810 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
13811 position-independent.
13813 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13818 If supported for the target machine, emit position-independent code,
13819 suitable for dynamic linking and avoiding any limit on the size of the
13820 global offset table. This option makes a difference on AArch64, m68k,
13821 PowerPC and SPARC@.
13823 Position-independent code requires special support, and therefore works
13824 only on certain machines.
13826 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13833 These options are similar to @option{-fpic} and @option{-fPIC}, but the
13834 generated position-independent code can be only linked into executables.
13835 Usually these options are used to compile code that will be linked using
13836 the @option{-pie} GCC option.
13838 @option{-fpie} and @option{-fPIE} both define the macros
13839 @code{__pie__} and @code{__PIE__}. The macros have the value 1
13840 for @option{-fpie} and 2 for @option{-fPIE}.
13845 Do not use the PLT for external function calls in position-independent code.
13846 Instead, load the callee address at call sites from the GOT and branch to it.
13847 This leads to more efficient code by eliminating PLT stubs and exposing
13848 GOT loads to optimizations. On architectures such as 32-bit x86 where
13849 PLT stubs expect the GOT pointer in a specific register, this gives more
13850 register allocation freedom to the compiler.
13851 Lazy binding requires use of the PLT;
13852 with @option{-fno-plt} all external symbols are resolved at load time.
13854 Alternatively, the function attribute @code{noplt} can be used to avoid calls
13855 through the PLT for specific external functions.
13857 In position-dependent code, a few targets also convert calls to
13858 functions that are marked to not use the PLT to use the GOT instead.
13860 @item -fno-jump-tables
13861 @opindex fno-jump-tables
13862 @opindex fjump-tables
13863 Do not use jump tables for switch statements even where it would be
13864 more efficient than other code generation strategies. This option is
13865 of use in conjunction with @option{-fpic} or @option{-fPIC} for
13866 building code that forms part of a dynamic linker and cannot
13867 reference the address of a jump table. On some targets, jump tables
13868 do not require a GOT and this option is not needed.
13870 @item -ffixed-@var{reg}
13872 Treat the register named @var{reg} as a fixed register; generated code
13873 should never refer to it (except perhaps as a stack pointer, frame
13874 pointer or in some other fixed role).
13876 @var{reg} must be the name of a register. The register names accepted
13877 are machine-specific and are defined in the @code{REGISTER_NAMES}
13878 macro in the machine description macro file.
13880 This flag does not have a negative form, because it specifies a
13883 @item -fcall-used-@var{reg}
13884 @opindex fcall-used
13885 Treat the register named @var{reg} as an allocable register that is
13886 clobbered by function calls. It may be allocated for temporaries or
13887 variables that do not live across a call. Functions compiled this way
13888 do not save and restore the register @var{reg}.
13890 It is an error to use this flag with the frame pointer or stack pointer.
13891 Use of this flag for other registers that have fixed pervasive roles in
13892 the machine's execution model produces disastrous results.
13894 This flag does not have a negative form, because it specifies a
13897 @item -fcall-saved-@var{reg}
13898 @opindex fcall-saved
13899 Treat the register named @var{reg} as an allocable register saved by
13900 functions. It may be allocated even for temporaries or variables that
13901 live across a call. Functions compiled this way save and restore
13902 the register @var{reg} if they use it.
13904 It is an error to use this flag with the frame pointer or stack pointer.
13905 Use of this flag for other registers that have fixed pervasive roles in
13906 the machine's execution model produces disastrous results.
13908 A different sort of disaster results from the use of this flag for
13909 a register in which function values may be returned.
13911 This flag does not have a negative form, because it specifies a
13914 @item -fpack-struct[=@var{n}]
13915 @opindex fpack-struct
13916 Without a value specified, pack all structure members together without
13917 holes. When a value is specified (which must be a small power of two), pack
13918 structure members according to this value, representing the maximum
13919 alignment (that is, objects with default alignment requirements larger than
13920 this are output potentially unaligned at the next fitting location.
13922 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
13923 code that is not binary compatible with code generated without that switch.
13924 Additionally, it makes the code suboptimal.
13925 Use it to conform to a non-default application binary interface.
13927 @item -fleading-underscore
13928 @opindex fleading-underscore
13929 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
13930 change the way C symbols are represented in the object file. One use
13931 is to help link with legacy assembly code.
13933 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
13934 generate code that is not binary compatible with code generated without that
13935 switch. Use it to conform to a non-default application binary interface.
13936 Not all targets provide complete support for this switch.
13938 @item -ftls-model=@var{model}
13939 @opindex ftls-model
13940 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
13941 The @var{model} argument should be one of @samp{global-dynamic},
13942 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
13943 Note that the choice is subject to optimization: the compiler may use
13944 a more efficient model for symbols not visible outside of the translation
13945 unit, or if @option{-fpic} is not given on the command line.
13947 The default without @option{-fpic} is @samp{initial-exec}; with
13948 @option{-fpic} the default is @samp{global-dynamic}.
13950 @item -ftrampolines
13951 @opindex ftrampolines
13952 For targets that normally need trampolines for nested functions, always
13953 generate them instead of using descriptors. Otherwise, for targets that
13954 do not need them, like for example HP-PA or IA-64, do nothing.
13956 A trampoline is a small piece of code that is created at run time on the
13957 stack when the address of a nested function is taken, and is used to call
13958 the nested function indirectly. Therefore, it requires the stack to be
13959 made executable in order for the program to work properly.
13961 @option{-fno-trampolines} is enabled by default on a language by language
13962 basis to let the compiler avoid generating them, if it computes that this
13963 is safe, and replace them with descriptors. Descriptors are made up of data
13964 only, but the generated code must be prepared to deal with them. As of this
13965 writing, @option{-fno-trampolines} is enabled by default only for Ada.
13967 Moreover, code compiled with @option{-ftrampolines} and code compiled with
13968 @option{-fno-trampolines} are not binary compatible if nested functions are
13969 present. This option must therefore be used on a program-wide basis and be
13970 manipulated with extreme care.
13972 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
13973 @opindex fvisibility
13974 Set the default ELF image symbol visibility to the specified option---all
13975 symbols are marked with this unless overridden within the code.
13976 Using this feature can very substantially improve linking and
13977 load times of shared object libraries, produce more optimized
13978 code, provide near-perfect API export and prevent symbol clashes.
13979 It is @strong{strongly} recommended that you use this in any shared objects
13982 Despite the nomenclature, @samp{default} always means public; i.e.,
13983 available to be linked against from outside the shared object.
13984 @samp{protected} and @samp{internal} are pretty useless in real-world
13985 usage so the only other commonly used option is @samp{hidden}.
13986 The default if @option{-fvisibility} isn't specified is
13987 @samp{default}, i.e., make every symbol public.
13989 A good explanation of the benefits offered by ensuring ELF
13990 symbols have the correct visibility is given by ``How To Write
13991 Shared Libraries'' by Ulrich Drepper (which can be found at
13992 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
13993 solution made possible by this option to marking things hidden when
13994 the default is public is to make the default hidden and mark things
13995 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
13996 and @code{__attribute__ ((visibility("default")))} instead of
13997 @code{__declspec(dllexport)} you get almost identical semantics with
13998 identical syntax. This is a great boon to those working with
13999 cross-platform projects.
14001 For those adding visibility support to existing code, you may find
14002 @code{#pragma GCC visibility} of use. This works by you enclosing
14003 the declarations you wish to set visibility for with (for example)
14004 @code{#pragma GCC visibility push(hidden)} and
14005 @code{#pragma GCC visibility pop}.
14006 Bear in mind that symbol visibility should be viewed @strong{as
14007 part of the API interface contract} and thus all new code should
14008 always specify visibility when it is not the default; i.e., declarations
14009 only for use within the local DSO should @strong{always} be marked explicitly
14010 as hidden as so to avoid PLT indirection overheads---making this
14011 abundantly clear also aids readability and self-documentation of the code.
14012 Note that due to ISO C++ specification requirements, @code{operator new} and
14013 @code{operator delete} must always be of default visibility.
14015 Be aware that headers from outside your project, in particular system
14016 headers and headers from any other library you use, may not be
14017 expecting to be compiled with visibility other than the default. You
14018 may need to explicitly say @code{#pragma GCC visibility push(default)}
14019 before including any such headers.
14021 @code{extern} declarations are not affected by @option{-fvisibility}, so
14022 a lot of code can be recompiled with @option{-fvisibility=hidden} with
14023 no modifications. However, this means that calls to @code{extern}
14024 functions with no explicit visibility use the PLT, so it is more
14025 effective to use @code{__attribute ((visibility))} and/or
14026 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
14027 declarations should be treated as hidden.
14029 Note that @option{-fvisibility} does affect C++ vague linkage
14030 entities. This means that, for instance, an exception class that is
14031 be thrown between DSOs must be explicitly marked with default
14032 visibility so that the @samp{type_info} nodes are unified between
14035 An overview of these techniques, their benefits and how to use them
14036 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
14038 @item -fstrict-volatile-bitfields
14039 @opindex fstrict-volatile-bitfields
14040 This option should be used if accesses to volatile bit-fields (or other
14041 structure fields, although the compiler usually honors those types
14042 anyway) should use a single access of the width of the
14043 field's type, aligned to a natural alignment if possible. For
14044 example, targets with memory-mapped peripheral registers might require
14045 all such accesses to be 16 bits wide; with this flag you can
14046 declare all peripheral bit-fields as @code{unsigned short} (assuming short
14047 is 16 bits on these targets) to force GCC to use 16-bit accesses
14048 instead of, perhaps, a more efficient 32-bit access.
14050 If this option is disabled, the compiler uses the most efficient
14051 instruction. In the previous example, that might be a 32-bit load
14052 instruction, even though that accesses bytes that do not contain
14053 any portion of the bit-field, or memory-mapped registers unrelated to
14054 the one being updated.
14056 In some cases, such as when the @code{packed} attribute is applied to a
14057 structure field, it may not be possible to access the field with a single
14058 read or write that is correctly aligned for the target machine. In this
14059 case GCC falls back to generating multiple accesses rather than code that
14060 will fault or truncate the result at run time.
14062 Note: Due to restrictions of the C/C++11 memory model, write accesses are
14063 not allowed to touch non bit-field members. It is therefore recommended
14064 to define all bits of the field's type as bit-field members.
14066 The default value of this option is determined by the application binary
14067 interface for the target processor.
14069 @item -fsync-libcalls
14070 @opindex fsync-libcalls
14071 This option controls whether any out-of-line instance of the @code{__sync}
14072 family of functions may be used to implement the C++11 @code{__atomic}
14073 family of functions.
14075 The default value of this option is enabled, thus the only useful form
14076 of the option is @option{-fno-sync-libcalls}. This option is used in
14077 the implementation of the @file{libatomic} runtime library.
14081 @node Developer Options
14082 @section GCC Developer Options
14083 @cindex developer options
14084 @cindex debugging GCC
14085 @cindex debug dump options
14086 @cindex dump options
14087 @cindex compilation statistics
14089 This section describes command-line options that are primarily of
14090 interest to GCC developers, including options to support compiler
14091 testing and investigation of compiler bugs and compile-time
14092 performance problems. This includes options that produce debug dumps
14093 at various points in the compilation; that print statistics such as
14094 memory use and execution time; and that print information about GCC's
14095 configuration, such as where it searches for libraries. You should
14096 rarely need to use any of these options for ordinary compilation and
14099 Many developer options that cause GCC to dump output to a file take an
14100 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
14101 or @samp{-} to dump to standard output, and @samp{stderr} for standard
14104 If @samp{=@var{filename}} is omitted, a default dump file name is
14105 constructed by concatenating the base dump file name, a pass number,
14106 phase letter, and pass name. The base dump file name is the name of
14107 output file produced by the compiler if explicitly specified and not
14108 an executable; otherwise it is the source file name.
14109 The pass number is determined by the order passes are registered with
14110 the compiler's pass manager.
14111 This is generally the same as the order of execution, but passes
14112 registered by plugins, target-specific passes, or passes that are
14113 otherwise registered late are numbered higher than the pass named
14114 @samp{final}, even if they are executed earlier. The phase letter is
14115 one of @samp{i} (inter-procedural analysis), @samp{l}
14116 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
14117 The files are created in the directory of the output file.
14121 @item -d@var{letters}
14122 @itemx -fdump-rtl-@var{pass}
14123 @itemx -fdump-rtl-@var{pass}=@var{filename}
14125 @opindex fdump-rtl-@var{pass}
14126 Says to make debugging dumps during compilation at times specified by
14127 @var{letters}. This is used for debugging the RTL-based passes of the
14130 Some @option{-d@var{letters}} switches have different meaning when
14131 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
14132 for information about preprocessor-specific dump options.
14134 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
14135 @option{-d} option @var{letters}. Here are the possible
14136 letters for use in @var{pass} and @var{letters}, and their meanings:
14140 @item -fdump-rtl-alignments
14141 @opindex fdump-rtl-alignments
14142 Dump after branch alignments have been computed.
14144 @item -fdump-rtl-asmcons
14145 @opindex fdump-rtl-asmcons
14146 Dump after fixing rtl statements that have unsatisfied in/out constraints.
14148 @item -fdump-rtl-auto_inc_dec
14149 @opindex fdump-rtl-auto_inc_dec
14150 Dump after auto-inc-dec discovery. This pass is only run on
14151 architectures that have auto inc or auto dec instructions.
14153 @item -fdump-rtl-barriers
14154 @opindex fdump-rtl-barriers
14155 Dump after cleaning up the barrier instructions.
14157 @item -fdump-rtl-bbpart
14158 @opindex fdump-rtl-bbpart
14159 Dump after partitioning hot and cold basic blocks.
14161 @item -fdump-rtl-bbro
14162 @opindex fdump-rtl-bbro
14163 Dump after block reordering.
14165 @item -fdump-rtl-btl1
14166 @itemx -fdump-rtl-btl2
14167 @opindex fdump-rtl-btl2
14168 @opindex fdump-rtl-btl2
14169 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
14170 after the two branch
14171 target load optimization passes.
14173 @item -fdump-rtl-bypass
14174 @opindex fdump-rtl-bypass
14175 Dump after jump bypassing and control flow optimizations.
14177 @item -fdump-rtl-combine
14178 @opindex fdump-rtl-combine
14179 Dump after the RTL instruction combination pass.
14181 @item -fdump-rtl-compgotos
14182 @opindex fdump-rtl-compgotos
14183 Dump after duplicating the computed gotos.
14185 @item -fdump-rtl-ce1
14186 @itemx -fdump-rtl-ce2
14187 @itemx -fdump-rtl-ce3
14188 @opindex fdump-rtl-ce1
14189 @opindex fdump-rtl-ce2
14190 @opindex fdump-rtl-ce3
14191 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
14192 @option{-fdump-rtl-ce3} enable dumping after the three
14193 if conversion passes.
14195 @item -fdump-rtl-cprop_hardreg
14196 @opindex fdump-rtl-cprop_hardreg
14197 Dump after hard register copy propagation.
14199 @item -fdump-rtl-csa
14200 @opindex fdump-rtl-csa
14201 Dump after combining stack adjustments.
14203 @item -fdump-rtl-cse1
14204 @itemx -fdump-rtl-cse2
14205 @opindex fdump-rtl-cse1
14206 @opindex fdump-rtl-cse2
14207 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
14208 the two common subexpression elimination passes.
14210 @item -fdump-rtl-dce
14211 @opindex fdump-rtl-dce
14212 Dump after the standalone dead code elimination passes.
14214 @item -fdump-rtl-dbr
14215 @opindex fdump-rtl-dbr
14216 Dump after delayed branch scheduling.
14218 @item -fdump-rtl-dce1
14219 @itemx -fdump-rtl-dce2
14220 @opindex fdump-rtl-dce1
14221 @opindex fdump-rtl-dce2
14222 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
14223 the two dead store elimination passes.
14225 @item -fdump-rtl-eh
14226 @opindex fdump-rtl-eh
14227 Dump after finalization of EH handling code.
14229 @item -fdump-rtl-eh_ranges
14230 @opindex fdump-rtl-eh_ranges
14231 Dump after conversion of EH handling range regions.
14233 @item -fdump-rtl-expand
14234 @opindex fdump-rtl-expand
14235 Dump after RTL generation.
14237 @item -fdump-rtl-fwprop1
14238 @itemx -fdump-rtl-fwprop2
14239 @opindex fdump-rtl-fwprop1
14240 @opindex fdump-rtl-fwprop2
14241 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
14242 dumping after the two forward propagation passes.
14244 @item -fdump-rtl-gcse1
14245 @itemx -fdump-rtl-gcse2
14246 @opindex fdump-rtl-gcse1
14247 @opindex fdump-rtl-gcse2
14248 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
14249 after global common subexpression elimination.
14251 @item -fdump-rtl-init-regs
14252 @opindex fdump-rtl-init-regs
14253 Dump after the initialization of the registers.
14255 @item -fdump-rtl-initvals
14256 @opindex fdump-rtl-initvals
14257 Dump after the computation of the initial value sets.
14259 @item -fdump-rtl-into_cfglayout
14260 @opindex fdump-rtl-into_cfglayout
14261 Dump after converting to cfglayout mode.
14263 @item -fdump-rtl-ira
14264 @opindex fdump-rtl-ira
14265 Dump after iterated register allocation.
14267 @item -fdump-rtl-jump
14268 @opindex fdump-rtl-jump
14269 Dump after the second jump optimization.
14271 @item -fdump-rtl-loop2
14272 @opindex fdump-rtl-loop2
14273 @option{-fdump-rtl-loop2} enables dumping after the rtl
14274 loop optimization passes.
14276 @item -fdump-rtl-mach
14277 @opindex fdump-rtl-mach
14278 Dump after performing the machine dependent reorganization pass, if that
14281 @item -fdump-rtl-mode_sw
14282 @opindex fdump-rtl-mode_sw
14283 Dump after removing redundant mode switches.
14285 @item -fdump-rtl-rnreg
14286 @opindex fdump-rtl-rnreg
14287 Dump after register renumbering.
14289 @item -fdump-rtl-outof_cfglayout
14290 @opindex fdump-rtl-outof_cfglayout
14291 Dump after converting from cfglayout mode.
14293 @item -fdump-rtl-peephole2
14294 @opindex fdump-rtl-peephole2
14295 Dump after the peephole pass.
14297 @item -fdump-rtl-postreload
14298 @opindex fdump-rtl-postreload
14299 Dump after post-reload optimizations.
14301 @item -fdump-rtl-pro_and_epilogue
14302 @opindex fdump-rtl-pro_and_epilogue
14303 Dump after generating the function prologues and epilogues.
14305 @item -fdump-rtl-sched1
14306 @itemx -fdump-rtl-sched2
14307 @opindex fdump-rtl-sched1
14308 @opindex fdump-rtl-sched2
14309 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
14310 after the basic block scheduling passes.
14312 @item -fdump-rtl-ree
14313 @opindex fdump-rtl-ree
14314 Dump after sign/zero extension elimination.
14316 @item -fdump-rtl-seqabstr
14317 @opindex fdump-rtl-seqabstr
14318 Dump after common sequence discovery.
14320 @item -fdump-rtl-shorten
14321 @opindex fdump-rtl-shorten
14322 Dump after shortening branches.
14324 @item -fdump-rtl-sibling
14325 @opindex fdump-rtl-sibling
14326 Dump after sibling call optimizations.
14328 @item -fdump-rtl-split1
14329 @itemx -fdump-rtl-split2
14330 @itemx -fdump-rtl-split3
14331 @itemx -fdump-rtl-split4
14332 @itemx -fdump-rtl-split5
14333 @opindex fdump-rtl-split1
14334 @opindex fdump-rtl-split2
14335 @opindex fdump-rtl-split3
14336 @opindex fdump-rtl-split4
14337 @opindex fdump-rtl-split5
14338 These options enable dumping after five rounds of
14339 instruction splitting.
14341 @item -fdump-rtl-sms
14342 @opindex fdump-rtl-sms
14343 Dump after modulo scheduling. This pass is only run on some
14346 @item -fdump-rtl-stack
14347 @opindex fdump-rtl-stack
14348 Dump after conversion from GCC's ``flat register file'' registers to the
14349 x87's stack-like registers. This pass is only run on x86 variants.
14351 @item -fdump-rtl-subreg1
14352 @itemx -fdump-rtl-subreg2
14353 @opindex fdump-rtl-subreg1
14354 @opindex fdump-rtl-subreg2
14355 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
14356 the two subreg expansion passes.
14358 @item -fdump-rtl-unshare
14359 @opindex fdump-rtl-unshare
14360 Dump after all rtl has been unshared.
14362 @item -fdump-rtl-vartrack
14363 @opindex fdump-rtl-vartrack
14364 Dump after variable tracking.
14366 @item -fdump-rtl-vregs
14367 @opindex fdump-rtl-vregs
14368 Dump after converting virtual registers to hard registers.
14370 @item -fdump-rtl-web
14371 @opindex fdump-rtl-web
14372 Dump after live range splitting.
14374 @item -fdump-rtl-regclass
14375 @itemx -fdump-rtl-subregs_of_mode_init
14376 @itemx -fdump-rtl-subregs_of_mode_finish
14377 @itemx -fdump-rtl-dfinit
14378 @itemx -fdump-rtl-dfinish
14379 @opindex fdump-rtl-regclass
14380 @opindex fdump-rtl-subregs_of_mode_init
14381 @opindex fdump-rtl-subregs_of_mode_finish
14382 @opindex fdump-rtl-dfinit
14383 @opindex fdump-rtl-dfinish
14384 These dumps are defined but always produce empty files.
14387 @itemx -fdump-rtl-all
14389 @opindex fdump-rtl-all
14390 Produce all the dumps listed above.
14394 Annotate the assembler output with miscellaneous debugging information.
14398 Dump all macro definitions, at the end of preprocessing, in addition to
14403 Produce a core dump whenever an error occurs.
14407 Annotate the assembler output with a comment indicating which
14408 pattern and alternative is used. The length and cost of each instruction are
14413 Dump the RTL in the assembler output as a comment before each instruction.
14414 Also turns on @option{-dp} annotation.
14418 Just generate RTL for a function instead of compiling it. Usually used
14419 with @option{-fdump-rtl-expand}.
14423 @opindex fdump-debug
14424 Dump debugging information generated during the debug
14427 @item -fdump-earlydebug
14428 @opindex fdump-earlydebug
14429 Dump debugging information generated during the early debug
14432 @item -fdump-noaddr
14433 @opindex fdump-noaddr
14434 When doing debugging dumps, suppress address output. This makes it more
14435 feasible to use diff on debugging dumps for compiler invocations with
14436 different compiler binaries and/or different
14437 text / bss / data / heap / stack / dso start locations.
14440 @opindex freport-bug
14441 Collect and dump debug information into a temporary file if an
14442 internal compiler error (ICE) occurs.
14444 @item -fdump-unnumbered
14445 @opindex fdump-unnumbered
14446 When doing debugging dumps, suppress instruction numbers and address output.
14447 This makes it more feasible to use diff on debugging dumps for compiler
14448 invocations with different options, in particular with and without
14451 @item -fdump-unnumbered-links
14452 @opindex fdump-unnumbered-links
14453 When doing debugging dumps (see @option{-d} option above), suppress
14454 instruction numbers for the links to the previous and next instructions
14457 @item -fdump-ipa-@var{switch}
14458 @itemx -fdump-ipa-@var{switch}-@var{options}
14460 Control the dumping at various stages of inter-procedural analysis
14461 language tree to a file. The file name is generated by appending a
14462 switch specific suffix to the source file name, and the file is created
14463 in the same directory as the output file. The following dumps are
14468 Enables all inter-procedural analysis dumps.
14471 Dumps information about call-graph optimization, unused function removal,
14472 and inlining decisions.
14475 Dump after function inlining.
14479 Additionally, the options @option{-optimized}, @option{-missed},
14480 @option{-note}, and @option{-all} can be provided, with the same meaning
14481 as for @option{-fopt-info}, defaulting to @option{-optimized}.
14483 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14484 information on callsites that were inlined, along with callsites
14485 that were not inlined.
14487 By default, the dump will contain messages about successful
14488 optimizations (equivalent to @option{-optimized}) together with
14489 low-level details about the analysis.
14491 @item -fdump-lang-all
14492 @itemx -fdump-lang-@var{switch}
14493 @itemx -fdump-lang-@var{switch}-@var{options}
14494 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14495 @opindex fdump-lang-all
14496 @opindex fdump-lang
14497 Control the dumping of language-specific information. The @var{options}
14498 and @var{filename} portions behave as described in the
14499 @option{-fdump-tree} option. The following @var{switch} values are
14505 Enable all language-specific dumps.
14508 Dump class hierarchy information. Virtual table information is emitted
14509 unless '@option{slim}' is specified. This option is applicable to C++ only.
14512 Dump the raw internal tree data. This option is applicable to C++ only.
14516 @item -fdump-passes
14517 @opindex fdump-passes
14518 Print on @file{stderr} the list of optimization passes that are turned
14519 on and off by the current command-line options.
14521 @item -fdump-statistics-@var{option}
14522 @opindex fdump-statistics
14523 Enable and control dumping of pass statistics in a separate file. The
14524 file name is generated by appending a suffix ending in
14525 @samp{.statistics} to the source file name, and the file is created in
14526 the same directory as the output file. If the @samp{-@var{option}}
14527 form is used, @samp{-stats} causes counters to be summed over the
14528 whole compilation unit while @samp{-details} dumps every event as
14529 the passes generate them. The default with no option is to sum
14530 counters for each function compiled.
14532 @item -fdump-tree-all
14533 @itemx -fdump-tree-@var{switch}
14534 @itemx -fdump-tree-@var{switch}-@var{options}
14535 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
14536 @opindex fdump-tree-all
14537 @opindex fdump-tree
14538 Control the dumping at various stages of processing the intermediate
14539 language tree to a file. If the @samp{-@var{options}}
14540 form is used, @var{options} is a list of @samp{-} separated options
14541 which control the details of the dump. Not all options are applicable
14542 to all dumps; those that are not meaningful are ignored. The
14543 following options are available
14547 Print the address of each node. Usually this is not meaningful as it
14548 changes according to the environment and source file. Its primary use
14549 is for tying up a dump file with a debug environment.
14551 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
14552 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
14553 use working backward from mangled names in the assembly file.
14555 When dumping front-end intermediate representations, inhibit dumping
14556 of members of a scope or body of a function merely because that scope
14557 has been reached. Only dump such items when they are directly reachable
14558 by some other path.
14560 When dumping pretty-printed trees, this option inhibits dumping the
14561 bodies of control structures.
14563 When dumping RTL, print the RTL in slim (condensed) form instead of
14564 the default LISP-like representation.
14566 Print a raw representation of the tree. By default, trees are
14567 pretty-printed into a C-like representation.
14569 Enable more detailed dumps (not honored by every dump option). Also
14570 include information from the optimization passes.
14572 Enable dumping various statistics about the pass (not honored by every dump
14575 Enable showing basic block boundaries (disabled in raw dumps).
14577 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
14578 dump a representation of the control flow graph suitable for viewing with
14579 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
14580 the file is pretty-printed as a subgraph, so that GraphViz can render them
14581 all in a single plot.
14583 This option currently only works for RTL dumps, and the RTL is always
14584 dumped in slim form.
14586 Enable showing virtual operands for every statement.
14588 Enable showing line numbers for statements.
14590 Enable showing the unique ID (@code{DECL_UID}) for each variable.
14592 Enable showing the tree dump for each statement.
14594 Enable showing the EH region number holding each statement.
14596 Enable showing scalar evolution analysis details.
14598 Enable showing optimization information (only available in certain
14601 Enable showing missed optimization information (only available in certain
14604 Enable other detailed optimization information (only available in
14607 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
14608 and @option{lineno}.
14610 Turn on all optimization options, i.e., @option{optimized},
14611 @option{missed}, and @option{note}.
14614 To determine what tree dumps are available or find the dump for a pass
14615 of interest follow the steps below.
14619 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
14620 look for a code that corresponds to the pass you are interested in.
14621 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
14622 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
14623 The number at the end distinguishes distinct invocations of the same pass.
14625 To enable the creation of the dump file, append the pass code to
14626 the @option{-fdump-} option prefix and invoke GCC with it. For example,
14627 to enable the dump from the Early Value Range Propagation pass, invoke
14628 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
14629 specify the name of the dump file. If you don't specify one, GCC
14630 creates as described below.
14632 Find the pass dump in a file whose name is composed of three components
14633 separated by a period: the name of the source file GCC was invoked to
14634 compile, a numeric suffix indicating the pass number followed by the
14635 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
14636 and finally the pass code. For example, the Early VRP pass dump might
14637 be in a file named @file{myfile.c.038t.evrp} in the current working
14638 directory. Note that the numeric codes are not stable and may change
14639 from one version of GCC to another.
14643 @itemx -fopt-info-@var{options}
14644 @itemx -fopt-info-@var{options}=@var{filename}
14646 Controls optimization dumps from various optimization passes. If the
14647 @samp{-@var{options}} form is used, @var{options} is a list of
14648 @samp{-} separated option keywords to select the dump details and
14651 The @var{options} can be divided into three groups:
14654 options describing what kinds of messages should be emitted,
14656 options describing the verbosity of the dump, and
14658 options describing which optimizations should be included.
14660 The options from each group can be freely mixed as they are
14661 non-overlapping. However, in case of any conflicts,
14662 the later options override the earlier options on the command
14665 The following options control which kinds of messages should be emitted:
14669 Print information when an optimization is successfully applied. It is
14670 up to a pass to decide which information is relevant. For example, the
14671 vectorizer passes print the source location of loops which are
14672 successfully vectorized.
14674 Print information about missed optimizations. Individual passes
14675 control which information to include in the output.
14677 Print verbose information about optimizations, such as certain
14678 transformations, more detailed messages about decisions etc.
14680 Print detailed optimization information. This includes
14681 @samp{optimized}, @samp{missed}, and @samp{note}.
14684 The following option controls the dump verbosity:
14688 By default, only ``high-level'' messages are emitted. This option enables
14689 additional, more detailed, messages, which are likely to only be of interest
14693 One or more of the following option keywords can be used to describe a
14694 group of optimizations:
14698 Enable dumps from all interprocedural optimizations.
14700 Enable dumps from all loop optimizations.
14702 Enable dumps from all inlining optimizations.
14704 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
14706 Enable dumps from all vectorization optimizations.
14708 Enable dumps from all optimizations. This is a superset of
14709 the optimization groups listed above.
14712 If @var{options} is
14713 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
14714 about successful optimizations from all the passes, omitting messages
14715 that are treated as ``internals''.
14717 If the @var{filename} is provided, then the dumps from all the
14718 applicable optimizations are concatenated into the @var{filename}.
14719 Otherwise the dump is output onto @file{stderr}. Though multiple
14720 @option{-fopt-info} options are accepted, only one of them can include
14721 a @var{filename}. If other filenames are provided then all but the
14722 first such option are ignored.
14724 Note that the output @var{filename} is overwritten
14725 in case of multiple translation units. If a combined output from
14726 multiple translation units is desired, @file{stderr} should be used
14729 In the following example, the optimization info is output to
14738 gcc -O3 -fopt-info-missed=missed.all
14742 outputs missed optimization report from all the passes into
14743 @file{missed.all}, and this one:
14746 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
14750 prints information about missed optimization opportunities from
14751 vectorization passes on @file{stderr}.
14752 Note that @option{-fopt-info-vec-missed} is equivalent to
14753 @option{-fopt-info-missed-vec}. The order of the optimization group
14754 names and message types listed after @option{-fopt-info} does not matter.
14756 As another example,
14758 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
14762 outputs information about missed optimizations as well as
14763 optimized locations from all the inlining passes into
14769 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
14773 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
14774 in conflict since only one output file is allowed. In this case, only
14775 the first option takes effect and the subsequent options are
14776 ignored. Thus only @file{vec.miss} is produced which contains
14777 dumps from the vectorizer about missed opportunities.
14779 @item -fsave-optimization-record
14780 @opindex fsave-optimization-record
14781 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
14782 were performed, for those optimizations that support @option{-fopt-info}.
14784 This option is experimental and the format of the data within the
14785 compressed JSON file is subject to change.
14787 It is roughly equivalent to a machine-readable version of
14788 @option{-fopt-info-all}, as a collection of messages with source file,
14789 line number and column number, with the following additional data for
14795 the execution count of the code being optimized, along with metadata about
14796 whether this was from actual profile data, or just an estimate, allowing
14797 consumers to prioritize messages by code hotness,
14800 the function name of the code being optimized, where applicable,
14803 the ``inlining chain'' for the code being optimized, so that when
14804 a function is inlined into several different places (which might
14805 themselves be inlined), the reader can distinguish between the copies,
14808 objects identifying those parts of the message that refer to expressions,
14809 statements or symbol-table nodes, which of these categories they are, and,
14810 when available, their source code location,
14813 the GCC pass that emitted the message, and
14816 the location in GCC's own code from which the message was emitted
14820 Additionally, some messages are logically nested within other
14821 messages, reflecting implementation details of the optimization
14824 @item -fsched-verbose=@var{n}
14825 @opindex fsched-verbose
14826 On targets that use instruction scheduling, this option controls the
14827 amount of debugging output the scheduler prints to the dump files.
14829 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
14830 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
14831 For @var{n} greater than one, it also output basic block probabilities,
14832 detailed ready list information and unit/insn info. For @var{n} greater
14833 than two, it includes RTL at abort point, control-flow and regions info.
14834 And for @var{n} over four, @option{-fsched-verbose} also includes
14839 @item -fenable-@var{kind}-@var{pass}
14840 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
14844 This is a set of options that are used to explicitly disable/enable
14845 optimization passes. These options are intended for use for debugging GCC.
14846 Compiler users should use regular options for enabling/disabling
14851 @item -fdisable-ipa-@var{pass}
14852 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
14853 statically invoked in the compiler multiple times, the pass name should be
14854 appended with a sequential number starting from 1.
14856 @item -fdisable-rtl-@var{pass}
14857 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
14858 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
14859 statically invoked in the compiler multiple times, the pass name should be
14860 appended with a sequential number starting from 1. @var{range-list} is a
14861 comma-separated list of function ranges or assembler names. Each range is a number
14862 pair separated by a colon. The range is inclusive in both ends. If the range
14863 is trivial, the number pair can be simplified as a single number. If the
14864 function's call graph node's @var{uid} falls within one of the specified ranges,
14865 the @var{pass} is disabled for that function. The @var{uid} is shown in the
14866 function header of a dump file, and the pass names can be dumped by using
14867 option @option{-fdump-passes}.
14869 @item -fdisable-tree-@var{pass}
14870 @itemx -fdisable-tree-@var{pass}=@var{range-list}
14871 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
14874 @item -fenable-ipa-@var{pass}
14875 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
14876 statically invoked in the compiler multiple times, the pass name should be
14877 appended with a sequential number starting from 1.
14879 @item -fenable-rtl-@var{pass}
14880 @itemx -fenable-rtl-@var{pass}=@var{range-list}
14881 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
14882 description and examples.
14884 @item -fenable-tree-@var{pass}
14885 @itemx -fenable-tree-@var{pass}=@var{range-list}
14886 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
14887 of option arguments.
14891 Here are some examples showing uses of these options.
14895 # disable ccp1 for all functions
14896 -fdisable-tree-ccp1
14897 # disable complete unroll for function whose cgraph node uid is 1
14898 -fenable-tree-cunroll=1
14899 # disable gcse2 for functions at the following ranges [1,1],
14900 # [300,400], and [400,1000]
14901 # disable gcse2 for functions foo and foo2
14902 -fdisable-rtl-gcse2=foo,foo2
14903 # disable early inlining
14904 -fdisable-tree-einline
14905 # disable ipa inlining
14906 -fdisable-ipa-inline
14907 # enable tree full unroll
14908 -fenable-tree-unroll
14913 @itemx -fchecking=@var{n}
14915 @opindex fno-checking
14916 Enable internal consistency checking. The default depends on
14917 the compiler configuration. @option{-fchecking=2} enables further
14918 internal consistency checking that might affect code generation.
14920 @item -frandom-seed=@var{string}
14921 @opindex frandom-seed
14922 This option provides a seed that GCC uses in place of
14923 random numbers in generating certain symbol names
14924 that have to be different in every compiled file. It is also used to
14925 place unique stamps in coverage data files and the object files that
14926 produce them. You can use the @option{-frandom-seed} option to produce
14927 reproducibly identical object files.
14929 The @var{string} can either be a number (decimal, octal or hex) or an
14930 arbitrary string (in which case it's converted to a number by
14933 The @var{string} should be different for every file you compile.
14936 @itemx -save-temps=cwd
14937 @opindex save-temps
14938 Store the usual ``temporary'' intermediate files permanently; place them
14939 in the current directory and name them based on the source file. Thus,
14940 compiling @file{foo.c} with @option{-c -save-temps} produces files
14941 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
14942 preprocessed @file{foo.i} output file even though the compiler now
14943 normally uses an integrated preprocessor.
14945 When used in combination with the @option{-x} command-line option,
14946 @option{-save-temps} is sensible enough to avoid over writing an
14947 input source file with the same extension as an intermediate file.
14948 The corresponding intermediate file may be obtained by renaming the
14949 source file before using @option{-save-temps}.
14951 If you invoke GCC in parallel, compiling several different source
14952 files that share a common base name in different subdirectories or the
14953 same source file compiled for multiple output destinations, it is
14954 likely that the different parallel compilers will interfere with each
14955 other, and overwrite the temporary files. For instance:
14958 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
14959 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
14962 may result in @file{foo.i} and @file{foo.o} being written to
14963 simultaneously by both compilers.
14965 @item -save-temps=obj
14966 @opindex save-temps=obj
14967 Store the usual ``temporary'' intermediate files permanently. If the
14968 @option{-o} option is used, the temporary files are based on the
14969 object file. If the @option{-o} option is not used, the
14970 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
14975 gcc -save-temps=obj -c foo.c
14976 gcc -save-temps=obj -c bar.c -o dir/xbar.o
14977 gcc -save-temps=obj foobar.c -o dir2/yfoobar
14981 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
14982 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
14983 @file{dir2/yfoobar.o}.
14985 @item -time@r{[}=@var{file}@r{]}
14987 Report the CPU time taken by each subprocess in the compilation
14988 sequence. For C source files, this is the compiler proper and assembler
14989 (plus the linker if linking is done).
14991 Without the specification of an output file, the output looks like this:
14998 The first number on each line is the ``user time'', that is time spent
14999 executing the program itself. The second number is ``system time'',
15000 time spent executing operating system routines on behalf of the program.
15001 Both numbers are in seconds.
15003 With the specification of an output file, the output is appended to the
15004 named file, and it looks like this:
15007 0.12 0.01 cc1 @var{options}
15008 0.00 0.01 as @var{options}
15011 The ``user time'' and the ``system time'' are moved before the program
15012 name, and the options passed to the program are displayed, so that one
15013 can later tell what file was being compiled, and with which options.
15015 @item -fdump-final-insns@r{[}=@var{file}@r{]}
15016 @opindex fdump-final-insns
15017 Dump the final internal representation (RTL) to @var{file}. If the
15018 optional argument is omitted (or if @var{file} is @code{.}), the name
15019 of the dump file is determined by appending @code{.gkd} to the
15020 compilation output file name.
15022 @item -fcompare-debug@r{[}=@var{opts}@r{]}
15023 @opindex fcompare-debug
15024 @opindex fno-compare-debug
15025 If no error occurs during compilation, run the compiler a second time,
15026 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
15027 passed to the second compilation. Dump the final internal
15028 representation in both compilations, and print an error if they differ.
15030 If the equal sign is omitted, the default @option{-gtoggle} is used.
15032 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
15033 and nonzero, implicitly enables @option{-fcompare-debug}. If
15034 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
15035 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
15038 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
15039 is equivalent to @option{-fno-compare-debug}, which disables the dumping
15040 of the final representation and the second compilation, preventing even
15041 @env{GCC_COMPARE_DEBUG} from taking effect.
15043 To verify full coverage during @option{-fcompare-debug} testing, set
15044 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
15045 which GCC rejects as an invalid option in any actual compilation
15046 (rather than preprocessing, assembly or linking). To get just a
15047 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
15048 not overridden} will do.
15050 @item -fcompare-debug-second
15051 @opindex fcompare-debug-second
15052 This option is implicitly passed to the compiler for the second
15053 compilation requested by @option{-fcompare-debug}, along with options to
15054 silence warnings, and omitting other options that would cause the compiler
15055 to produce output to files or to standard output as a side effect. Dump
15056 files and preserved temporary files are renamed so as to contain the
15057 @code{.gk} additional extension during the second compilation, to avoid
15058 overwriting those generated by the first.
15060 When this option is passed to the compiler driver, it causes the
15061 @emph{first} compilation to be skipped, which makes it useful for little
15062 other than debugging the compiler proper.
15066 Turn off generation of debug info, if leaving out this option
15067 generates it, or turn it on at level 2 otherwise. The position of this
15068 argument in the command line does not matter; it takes effect after all
15069 other options are processed, and it does so only once, no matter how
15070 many times it is given. This is mainly intended to be used with
15071 @option{-fcompare-debug}.
15073 @item -fvar-tracking-assignments-toggle
15074 @opindex fvar-tracking-assignments-toggle
15075 @opindex fno-var-tracking-assignments-toggle
15076 Toggle @option{-fvar-tracking-assignments}, in the same way that
15077 @option{-gtoggle} toggles @option{-g}.
15081 Makes the compiler print out each function name as it is compiled, and
15082 print some statistics about each pass when it finishes.
15084 @item -ftime-report
15085 @opindex ftime-report
15086 Makes the compiler print some statistics about the time consumed by each
15087 pass when it finishes.
15089 @item -ftime-report-details
15090 @opindex ftime-report-details
15091 Record the time consumed by infrastructure parts separately for each pass.
15093 @item -fira-verbose=@var{n}
15094 @opindex fira-verbose
15095 Control the verbosity of the dump file for the integrated register allocator.
15096 The default value is 5. If the value @var{n} is greater or equal to 10,
15097 the dump output is sent to stderr using the same format as @var{n} minus 10.
15100 @opindex flto-report
15101 Prints a report with internal details on the workings of the link-time
15102 optimizer. The contents of this report vary from version to version.
15103 It is meant to be useful to GCC developers when processing object
15104 files in LTO mode (via @option{-flto}).
15106 Disabled by default.
15108 @item -flto-report-wpa
15109 @opindex flto-report-wpa
15110 Like @option{-flto-report}, but only print for the WPA phase of Link
15114 @opindex fmem-report
15115 Makes the compiler print some statistics about permanent memory
15116 allocation when it finishes.
15118 @item -fmem-report-wpa
15119 @opindex fmem-report-wpa
15120 Makes the compiler print some statistics about permanent memory
15121 allocation for the WPA phase only.
15123 @item -fpre-ipa-mem-report
15124 @opindex fpre-ipa-mem-report
15125 @item -fpost-ipa-mem-report
15126 @opindex fpost-ipa-mem-report
15127 Makes the compiler print some statistics about permanent memory
15128 allocation before or after interprocedural optimization.
15130 @item -fprofile-report
15131 @opindex fprofile-report
15132 Makes the compiler print some statistics about consistency of the
15133 (estimated) profile and effect of individual passes.
15135 @item -fstack-usage
15136 @opindex fstack-usage
15137 Makes the compiler output stack usage information for the program, on a
15138 per-function basis. The filename for the dump is made by appending
15139 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
15140 the output file, if explicitly specified and it is not an executable,
15141 otherwise it is the basename of the source file. An entry is made up
15146 The name of the function.
15150 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
15153 The qualifier @code{static} means that the function manipulates the stack
15154 statically: a fixed number of bytes are allocated for the frame on function
15155 entry and released on function exit; no stack adjustments are otherwise made
15156 in the function. The second field is this fixed number of bytes.
15158 The qualifier @code{dynamic} means that the function manipulates the stack
15159 dynamically: in addition to the static allocation described above, stack
15160 adjustments are made in the body of the function, for example to push/pop
15161 arguments around function calls. If the qualifier @code{bounded} is also
15162 present, the amount of these adjustments is bounded at compile time and
15163 the second field is an upper bound of the total amount of stack used by
15164 the function. If it is not present, the amount of these adjustments is
15165 not bounded at compile time and the second field only represents the
15170 Emit statistics about front-end processing at the end of the compilation.
15171 This option is supported only by the C++ front end, and
15172 the information is generally only useful to the G++ development team.
15174 @item -fdbg-cnt-list
15175 @opindex fdbg-cnt-list
15176 Print the name and the counter upper bound for all debug counters.
15179 @item -fdbg-cnt=@var{counter-value-list}
15181 Set the internal debug counter lower and upper bound. @var{counter-value-list}
15182 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
15183 tuples which sets the lower and the upper bound of each debug
15184 counter @var{name}. The @var{lower_bound} is optional and is zero
15185 initialized if not set.
15186 All debug counters have the initial upper bound of @code{UINT_MAX};
15187 thus @code{dbg_cnt} returns true always unless the upper bound
15188 is set by this option.
15189 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
15190 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
15191 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
15193 @item -print-file-name=@var{library}
15194 @opindex print-file-name
15195 Print the full absolute name of the library file @var{library} that
15196 would be used when linking---and don't do anything else. With this
15197 option, GCC does not compile or link anything; it just prints the
15200 @item -print-multi-directory
15201 @opindex print-multi-directory
15202 Print the directory name corresponding to the multilib selected by any
15203 other switches present in the command line. This directory is supposed
15204 to exist in @env{GCC_EXEC_PREFIX}.
15206 @item -print-multi-lib
15207 @opindex print-multi-lib
15208 Print the mapping from multilib directory names to compiler switches
15209 that enable them. The directory name is separated from the switches by
15210 @samp{;}, and each switch starts with an @samp{@@} instead of the
15211 @samp{-}, without spaces between multiple switches. This is supposed to
15212 ease shell processing.
15214 @item -print-multi-os-directory
15215 @opindex print-multi-os-directory
15216 Print the path to OS libraries for the selected
15217 multilib, relative to some @file{lib} subdirectory. If OS libraries are
15218 present in the @file{lib} subdirectory and no multilibs are used, this is
15219 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
15220 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
15221 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
15222 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
15224 @item -print-multiarch
15225 @opindex print-multiarch
15226 Print the path to OS libraries for the selected multiarch,
15227 relative to some @file{lib} subdirectory.
15229 @item -print-prog-name=@var{program}
15230 @opindex print-prog-name
15231 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
15233 @item -print-libgcc-file-name
15234 @opindex print-libgcc-file-name
15235 Same as @option{-print-file-name=libgcc.a}.
15237 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
15238 but you do want to link with @file{libgcc.a}. You can do:
15241 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
15244 @item -print-search-dirs
15245 @opindex print-search-dirs
15246 Print the name of the configured installation directory and a list of
15247 program and library directories @command{gcc} searches---and don't do anything else.
15249 This is useful when @command{gcc} prints the error message
15250 @samp{installation problem, cannot exec cpp0: No such file or directory}.
15251 To resolve this you either need to put @file{cpp0} and the other compiler
15252 components where @command{gcc} expects to find them, or you can set the environment
15253 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
15254 Don't forget the trailing @samp{/}.
15255 @xref{Environment Variables}.
15257 @item -print-sysroot
15258 @opindex print-sysroot
15259 Print the target sysroot directory that is used during
15260 compilation. This is the target sysroot specified either at configure
15261 time or using the @option{--sysroot} option, possibly with an extra
15262 suffix that depends on compilation options. If no target sysroot is
15263 specified, the option prints nothing.
15265 @item -print-sysroot-headers-suffix
15266 @opindex print-sysroot-headers-suffix
15267 Print the suffix added to the target sysroot when searching for
15268 headers, or give an error if the compiler is not configured with such
15269 a suffix---and don't do anything else.
15272 @opindex dumpmachine
15273 Print the compiler's target machine (for example,
15274 @samp{i686-pc-linux-gnu})---and don't do anything else.
15277 @opindex dumpversion
15278 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
15279 anything else. This is the compiler version used in filesystem paths and
15280 specs. Depending on how the compiler has been configured it can be just
15281 a single number (major version), two numbers separated by a dot (major and
15282 minor version) or three numbers separated by dots (major, minor and patchlevel
15285 @item -dumpfullversion
15286 @opindex dumpfullversion
15287 Print the full compiler version---and don't do anything else. The output is
15288 always three numbers separated by dots, major, minor and patchlevel version.
15292 Print the compiler's built-in specs---and don't do anything else. (This
15293 is used when GCC itself is being built.) @xref{Spec Files}.
15296 @node Submodel Options
15297 @section Machine-Dependent Options
15298 @cindex submodel options
15299 @cindex specifying hardware config
15300 @cindex hardware models and configurations, specifying
15301 @cindex target-dependent options
15302 @cindex machine-dependent options
15304 Each target machine supported by GCC can have its own options---for
15305 example, to allow you to compile for a particular processor variant or
15306 ABI, or to control optimizations specific to that machine. By
15307 convention, the names of machine-specific options start with
15310 Some configurations of the compiler also support additional target-specific
15311 options, usually for compatibility with other compilers on the same
15314 @c This list is ordered alphanumerically by subsection name.
15315 @c It should be the same order and spelling as these options are listed
15316 @c in Machine Dependent Options
15319 * AArch64 Options::
15320 * Adapteva Epiphany Options::
15324 * Blackfin Options::
15330 * DEC Alpha Options::
15334 * GNU/Linux Options::
15344 * MicroBlaze Options::
15347 * MN10300 Options::
15351 * Nios II Options::
15352 * Nvidia PTX Options::
15353 * OpenRISC Options::
15355 * picoChip Options::
15356 * PowerPC Options::
15357 * PowerPC SPE Options::
15360 * RS/6000 and PowerPC Options::
15362 * S/390 and zSeries Options::
15365 * Solaris 2 Options::
15368 * System V Options::
15369 * TILE-Gx Options::
15370 * TILEPro Options::
15375 * VxWorks Options::
15377 * x86 Windows Options::
15378 * Xstormy16 Options::
15380 * zSeries Options::
15383 @node AArch64 Options
15384 @subsection AArch64 Options
15385 @cindex AArch64 Options
15387 These options are defined for AArch64 implementations:
15391 @item -mabi=@var{name}
15393 Generate code for the specified data model. Permissible values
15394 are @samp{ilp32} for SysV-like data model where int, long int and pointers
15395 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15396 but long int and pointers are 64 bits.
15398 The default depends on the specific target configuration. Note that
15399 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15400 entire program with the same ABI, and link with a compatible set of libraries.
15403 @opindex mbig-endian
15404 Generate big-endian code. This is the default when GCC is configured for an
15405 @samp{aarch64_be-*-*} target.
15407 @item -mgeneral-regs-only
15408 @opindex mgeneral-regs-only
15409 Generate code which uses only the general-purpose registers. This will prevent
15410 the compiler from using floating-point and Advanced SIMD registers but will not
15411 impose any restrictions on the assembler.
15413 @item -mlittle-endian
15414 @opindex mlittle-endian
15415 Generate little-endian code. This is the default when GCC is configured for an
15416 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15418 @item -mcmodel=tiny
15419 @opindex mcmodel=tiny
15420 Generate code for the tiny code model. The program and its statically defined
15421 symbols must be within 1MB of each other. Programs can be statically or
15422 dynamically linked.
15424 @item -mcmodel=small
15425 @opindex mcmodel=small
15426 Generate code for the small code model. The program and its statically defined
15427 symbols must be within 4GB of each other. Programs can be statically or
15428 dynamically linked. This is the default code model.
15430 @item -mcmodel=large
15431 @opindex mcmodel=large
15432 Generate code for the large code model. This makes no assumptions about
15433 addresses and sizes of sections. Programs can be statically linked only.
15435 @item -mstrict-align
15436 @itemx -mno-strict-align
15437 @opindex mstrict-align
15438 @opindex mno-strict-align
15439 Avoid or allow generating memory accesses that may not be aligned on a natural
15440 object boundary as described in the architecture specification.
15442 @item -momit-leaf-frame-pointer
15443 @itemx -mno-omit-leaf-frame-pointer
15444 @opindex momit-leaf-frame-pointer
15445 @opindex mno-omit-leaf-frame-pointer
15446 Omit or keep the frame pointer in leaf functions. The former behavior is the
15449 @item -mtls-dialect=desc
15450 @opindex mtls-dialect=desc
15451 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15452 of TLS variables. This is the default.
15454 @item -mtls-dialect=traditional
15455 @opindex mtls-dialect=traditional
15456 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15459 @item -mtls-size=@var{size}
15461 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
15462 This option requires binutils 2.26 or newer.
15464 @item -mfix-cortex-a53-835769
15465 @itemx -mno-fix-cortex-a53-835769
15466 @opindex mfix-cortex-a53-835769
15467 @opindex mno-fix-cortex-a53-835769
15468 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15469 This involves inserting a NOP instruction between memory instructions and
15470 64-bit integer multiply-accumulate instructions.
15472 @item -mfix-cortex-a53-843419
15473 @itemx -mno-fix-cortex-a53-843419
15474 @opindex mfix-cortex-a53-843419
15475 @opindex mno-fix-cortex-a53-843419
15476 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15477 This erratum workaround is made at link time and this will only pass the
15478 corresponding flag to the linker.
15480 @item -mlow-precision-recip-sqrt
15481 @itemx -mno-low-precision-recip-sqrt
15482 @opindex mlow-precision-recip-sqrt
15483 @opindex mno-low-precision-recip-sqrt
15484 Enable or disable the reciprocal square root approximation.
15485 This option only has an effect if @option{-ffast-math} or
15486 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15487 precision of reciprocal square root results to about 16 bits for
15488 single precision and to 32 bits for double precision.
15490 @item -mlow-precision-sqrt
15491 @itemx -mno-low-precision-sqrt
15492 @opindex mlow-precision-sqrt
15493 @opindex mno-low-precision-sqrt
15494 Enable or disable the square root approximation.
15495 This option only has an effect if @option{-ffast-math} or
15496 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15497 precision of square root results to about 16 bits for
15498 single precision and to 32 bits for double precision.
15499 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
15501 @item -mlow-precision-div
15502 @itemx -mno-low-precision-div
15503 @opindex mlow-precision-div
15504 @opindex mno-low-precision-div
15505 Enable or disable the division approximation.
15506 This option only has an effect if @option{-ffast-math} or
15507 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15508 precision of division results to about 16 bits for
15509 single precision and to 32 bits for double precision.
15511 @item -mtrack-speculation
15512 @itemx -mno-track-speculation
15513 Enable or disable generation of additional code to track speculative
15514 execution through conditional branches. The tracking state can then
15515 be used by the compiler when expanding calls to
15516 @code{__builtin_speculation_safe_copy} to permit a more efficient code
15517 sequence to be generated.
15519 @item -march=@var{name}
15521 Specify the name of the target architecture and, optionally, one or
15522 more feature modifiers. This option has the form
15523 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
15525 The permissible values for @var{arch} are @samp{armv8-a},
15526 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a} or @samp{armv8.4-a}
15529 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
15530 support for the ARMv8.4-A architecture extensions.
15532 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
15533 support for the ARMv8.3-A architecture extensions.
15535 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
15536 support for the ARMv8.2-A architecture extensions.
15538 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
15539 support for the ARMv8.1-A architecture extension. In particular, it
15540 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
15542 The value @samp{native} is available on native AArch64 GNU/Linux and
15543 causes the compiler to pick the architecture of the host system. This
15544 option has no effect if the compiler is unable to recognize the
15545 architecture of the host system,
15547 The permissible values for @var{feature} are listed in the sub-section
15548 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15549 Feature Modifiers}. Where conflicting feature modifiers are
15550 specified, the right-most feature is used.
15552 GCC uses @var{name} to determine what kind of instructions it can emit
15553 when generating assembly code. If @option{-march} is specified
15554 without either of @option{-mtune} or @option{-mcpu} also being
15555 specified, the code is tuned to perform well across a range of target
15556 processors implementing the target architecture.
15558 @item -mtune=@var{name}
15560 Specify the name of the target processor for which GCC should tune the
15561 performance of the code. Permissible values for this option are:
15562 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
15563 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
15564 @samp{cortex-a76}, @samp{ares}, @samp{exynos-m1}, @samp{falkor},
15565 @samp{qdf24xx}, @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
15566 @samp{thunderx}, @samp{thunderxt88}, @samp{thunderxt88p1}, @samp{thunderxt81},
15567 @samp{tsv110}, @samp{thunderxt83}, @samp{thunderx2t99},
15568 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15569 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15570 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
15573 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15574 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15575 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
15576 should tune for a big.LITTLE system.
15578 Additionally on native AArch64 GNU/Linux systems the value
15579 @samp{native} tunes performance to the host system. This option has no effect
15580 if the compiler is unable to recognize the processor of the host system.
15582 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
15583 are specified, the code is tuned to perform well across a range
15584 of target processors.
15586 This option cannot be suffixed by feature modifiers.
15588 @item -mcpu=@var{name}
15590 Specify the name of the target processor, optionally suffixed by one
15591 or more feature modifiers. This option has the form
15592 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
15593 the permissible values for @var{cpu} are the same as those available
15594 for @option{-mtune}. The permissible values for @var{feature} are
15595 documented in the sub-section on
15596 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15597 Feature Modifiers}. Where conflicting feature modifiers are
15598 specified, the right-most feature is used.
15600 GCC uses @var{name} to determine what kind of instructions it can emit when
15601 generating assembly code (as if by @option{-march}) and to determine
15602 the target processor for which to tune for performance (as if
15603 by @option{-mtune}). Where this option is used in conjunction
15604 with @option{-march} or @option{-mtune}, those options take precedence
15605 over the appropriate part of this option.
15607 @item -moverride=@var{string}
15609 Override tuning decisions made by the back-end in response to a
15610 @option{-mtune=} switch. The syntax, semantics, and accepted values
15611 for @var{string} in this option are not guaranteed to be consistent
15614 This option is only intended to be useful when developing GCC.
15616 @item -mverbose-cost-dump
15617 @opindex mverbose-cost-dump
15618 Enable verbose cost model dumping in the debug dump files. This option is
15619 provided for use in debugging the compiler.
15621 @item -mpc-relative-literal-loads
15622 @itemx -mno-pc-relative-literal-loads
15623 @opindex mpc-relative-literal-loads
15624 @opindex mno-pc-relative-literal-loads
15625 Enable or disable PC-relative literal loads. With this option literal pools are
15626 accessed using a single instruction and emitted after each function. This
15627 limits the maximum size of functions to 1MB. This is enabled by default for
15628 @option{-mcmodel=tiny}.
15630 @item -msign-return-address=@var{scope}
15631 @opindex msign-return-address
15632 Select the function scope on which return address signing will be applied.
15633 Permissible values are @samp{none}, which disables return address signing,
15634 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
15635 functions, and @samp{all}, which enables pointer signing for all functions. The
15636 default value is @samp{none}.
15638 @item -msve-vector-bits=@var{bits}
15639 @opindex msve-vector-bits
15640 Specify the number of bits in an SVE vector register. This option only has
15641 an effect when SVE is enabled.
15643 GCC supports two forms of SVE code generation: ``vector-length
15644 agnostic'' output that works with any size of vector register and
15645 ``vector-length specific'' output that only works when the vector
15646 registers are a particular size. Replacing @var{bits} with
15647 @samp{scalable} selects vector-length agnostic output while
15648 replacing it with a number selects vector-length specific output.
15649 The possible lengths in the latter case are: 128, 256, 512, 1024
15650 and 2048. @samp{scalable} is the default.
15652 At present, @samp{-msve-vector-bits=128} produces the same output
15653 as @samp{-msve-vector-bits=scalable}.
15657 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
15658 @anchor{aarch64-feature-modifiers}
15659 @cindex @option{-march} feature modifiers
15660 @cindex @option{-mcpu} feature modifiers
15661 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
15662 the following and their inverses @option{no@var{feature}}:
15666 Enable CRC extension. This is on by default for
15667 @option{-march=armv8.1-a}.
15669 Enable Crypto extension. This also enables Advanced SIMD and floating-point
15672 Enable floating-point instructions. This is on by default for all possible
15673 values for options @option{-march} and @option{-mcpu}.
15675 Enable Advanced SIMD instructions. This also enables floating-point
15676 instructions. This is on by default for all possible values for options
15677 @option{-march} and @option{-mcpu}.
15679 Enable Scalable Vector Extension instructions. This also enables Advanced
15680 SIMD and floating-point instructions.
15682 Enable Large System Extension instructions. This is on by default for
15683 @option{-march=armv8.1-a}.
15685 Enable Round Double Multiply Accumulate instructions. This is on by default
15686 for @option{-march=armv8.1-a}.
15688 Enable FP16 extension. This also enables floating-point instructions.
15690 Enable FP16 fmla extension. This also enables FP16 extensions and
15691 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.
15694 Enable the RcPc extension. This does not change code generation from GCC,
15695 but is passed on to the assembler, enabling inline asm statements to use
15696 instructions from the RcPc extension.
15698 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
15700 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
15703 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
15705 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
15706 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
15708 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
15709 Use of this option with architectures prior to Armv8.2-A is not supported.
15711 Enable the Statistical Profiling extension. This option is only to enable the
15712 extension at the assembler level and does not affect code generation.
15716 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
15717 which implies @option{fp}.
15718 Conversely, @option{nofp} implies @option{nosimd}, which implies
15719 @option{nocrypto}, @option{noaes} and @option{nosha2}.
15721 @node Adapteva Epiphany Options
15722 @subsection Adapteva Epiphany Options
15724 These @samp{-m} options are defined for Adapteva Epiphany:
15727 @item -mhalf-reg-file
15728 @opindex mhalf-reg-file
15729 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
15730 That allows code to run on hardware variants that lack these registers.
15732 @item -mprefer-short-insn-regs
15733 @opindex mprefer-short-insn-regs
15734 Preferentially allocate registers that allow short instruction generation.
15735 This can result in increased instruction count, so this may either reduce or
15736 increase overall code size.
15738 @item -mbranch-cost=@var{num}
15739 @opindex mbranch-cost
15740 Set the cost of branches to roughly @var{num} ``simple'' instructions.
15741 This cost is only a heuristic and is not guaranteed to produce
15742 consistent results across releases.
15746 Enable the generation of conditional moves.
15748 @item -mnops=@var{num}
15750 Emit @var{num} NOPs before every other generated instruction.
15752 @item -mno-soft-cmpsf
15753 @opindex mno-soft-cmpsf
15754 @opindex msoft-cmpsf
15755 For single-precision floating-point comparisons, emit an @code{fsub} instruction
15756 and test the flags. This is faster than a software comparison, but can
15757 get incorrect results in the presence of NaNs, or when two different small
15758 numbers are compared such that their difference is calculated as zero.
15759 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
15760 software comparisons.
15762 @item -mstack-offset=@var{num}
15763 @opindex mstack-offset
15764 Set the offset between the top of the stack and the stack pointer.
15765 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
15766 can be used by leaf functions without stack allocation.
15767 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
15768 Note also that this option changes the ABI; compiling a program with a
15769 different stack offset than the libraries have been compiled with
15770 generally does not work.
15771 This option can be useful if you want to evaluate if a different stack
15772 offset would give you better code, but to actually use a different stack
15773 offset to build working programs, it is recommended to configure the
15774 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
15776 @item -mno-round-nearest
15777 @opindex mno-round-nearest
15778 @opindex mround-nearest
15779 Make the scheduler assume that the rounding mode has been set to
15780 truncating. The default is @option{-mround-nearest}.
15783 @opindex mlong-calls
15784 If not otherwise specified by an attribute, assume all calls might be beyond
15785 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
15786 function address into a register before performing a (otherwise direct) call.
15787 This is the default.
15789 @item -mshort-calls
15790 @opindex short-calls
15791 If not otherwise specified by an attribute, assume all direct calls are
15792 in the range of the @code{b} / @code{bl} instructions, so use these instructions
15793 for direct calls. The default is @option{-mlong-calls}.
15797 Assume addresses can be loaded as 16-bit unsigned values. This does not
15798 apply to function addresses for which @option{-mlong-calls} semantics
15801 @item -mfp-mode=@var{mode}
15803 Set the prevailing mode of the floating-point unit.
15804 This determines the floating-point mode that is provided and expected
15805 at function call and return time. Making this mode match the mode you
15806 predominantly need at function start can make your programs smaller and
15807 faster by avoiding unnecessary mode switches.
15809 @var{mode} can be set to one the following values:
15813 Any mode at function entry is valid, and retained or restored when
15814 the function returns, and when it calls other functions.
15815 This mode is useful for compiling libraries or other compilation units
15816 you might want to incorporate into different programs with different
15817 prevailing FPU modes, and the convenience of being able to use a single
15818 object file outweighs the size and speed overhead for any extra
15819 mode switching that might be needed, compared with what would be needed
15820 with a more specific choice of prevailing FPU mode.
15823 This is the mode used for floating-point calculations with
15824 truncating (i.e.@: round towards zero) rounding mode. That includes
15825 conversion from floating point to integer.
15827 @item round-nearest
15828 This is the mode used for floating-point calculations with
15829 round-to-nearest-or-even rounding mode.
15832 This is the mode used to perform integer calculations in the FPU, e.g.@:
15833 integer multiply, or integer multiply-and-accumulate.
15836 The default is @option{-mfp-mode=caller}
15838 @item -mno-split-lohi
15839 @itemx -mno-postinc
15840 @itemx -mno-postmodify
15841 @opindex mno-split-lohi
15842 @opindex msplit-lohi
15843 @opindex mno-postinc
15845 @opindex mno-postmodify
15846 @opindex mpostmodify
15847 Code generation tweaks that disable, respectively, splitting of 32-bit
15848 loads, generation of post-increment addresses, and generation of
15849 post-modify addresses. The defaults are @option{msplit-lohi},
15850 @option{-mpost-inc}, and @option{-mpost-modify}.
15852 @item -mnovect-double
15853 @opindex mno-vect-double
15854 @opindex mvect-double
15855 Change the preferred SIMD mode to SImode. The default is
15856 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
15858 @item -max-vect-align=@var{num}
15859 @opindex max-vect-align
15860 The maximum alignment for SIMD vector mode types.
15861 @var{num} may be 4 or 8. The default is 8.
15862 Note that this is an ABI change, even though many library function
15863 interfaces are unaffected if they don't use SIMD vector modes
15864 in places that affect size and/or alignment of relevant types.
15866 @item -msplit-vecmove-early
15867 @opindex msplit-vecmove-early
15868 Split vector moves into single word moves before reload. In theory this
15869 can give better register allocation, but so far the reverse seems to be
15870 generally the case.
15872 @item -m1reg-@var{reg}
15874 Specify a register to hold the constant @minus{}1, which makes loading small negative
15875 constants and certain bitmasks faster.
15876 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
15877 which specify use of that register as a fixed register,
15878 and @samp{none}, which means that no register is used for this
15879 purpose. The default is @option{-m1reg-none}.
15884 @subsection ARC Options
15885 @cindex ARC options
15887 The following options control the architecture variant for which code
15890 @c architecture variants
15893 @item -mbarrel-shifter
15894 @opindex mbarrel-shifter
15895 Generate instructions supported by barrel shifter. This is the default
15896 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
15899 @opindex mjli-alawys
15900 Force to call a function using jli_s instruction. This option is
15901 valid only for ARCv2 architecture.
15903 @item -mcpu=@var{cpu}
15905 Set architecture type, register usage, and instruction scheduling
15906 parameters for @var{cpu}. There are also shortcut alias options
15907 available for backward compatibility and convenience. Supported
15908 values for @var{cpu} are
15914 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
15918 Compile for ARC601. Alias: @option{-mARC601}.
15923 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
15924 This is the default when configured with @option{--with-cpu=arc700}@.
15927 Compile for ARC EM.
15930 Compile for ARC HS.
15933 Compile for ARC EM CPU with no hardware extensions.
15936 Compile for ARC EM4 CPU.
15939 Compile for ARC EM4 DMIPS CPU.
15942 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
15946 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
15947 double assist instructions.
15950 Compile for ARC HS CPU with no hardware extensions except the atomic
15954 Compile for ARC HS34 CPU.
15957 Compile for ARC HS38 CPU.
15960 Compile for ARC HS38 CPU with all hardware extensions on.
15963 Compile for ARC 600 CPU with @code{norm} instructions enabled.
15965 @item arc600_mul32x16
15966 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
15967 instructions enabled.
15970 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
15971 instructions enabled.
15974 Compile for ARC 601 CPU with @code{norm} instructions enabled.
15976 @item arc601_mul32x16
15977 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
15978 instructions enabled.
15981 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
15982 instructions enabled.
15985 Compile for ARC 700 on NPS400 chip.
15988 Compile for ARC EM minimalist configuration featuring reduced register
15995 @itemx -mdpfp-compact
15996 @opindex mdpfp-compact
15997 Generate double-precision FPX instructions, tuned for the compact
16001 @opindex mdpfp-fast
16002 Generate double-precision FPX instructions, tuned for the fast
16005 @item -mno-dpfp-lrsr
16006 @opindex mno-dpfp-lrsr
16007 Disable @code{lr} and @code{sr} instructions from using FPX extension
16012 Generate extended arithmetic instructions. Currently only
16013 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
16014 supported. This is always enabled for @option{-mcpu=ARC700}.
16019 Do not generate @code{mpy}-family instructions for ARC700. This option is
16024 Generate 32x16-bit multiply and multiply-accumulate instructions.
16028 Generate @code{mul64} and @code{mulu64} instructions.
16029 Only valid for @option{-mcpu=ARC600}.
16033 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
16038 @itemx -mspfp-compact
16039 @opindex mspfp-compact
16040 Generate single-precision FPX instructions, tuned for the compact
16044 @opindex mspfp-fast
16045 Generate single-precision FPX instructions, tuned for the fast
16050 Enable generation of ARC SIMD instructions via target-specific
16051 builtins. Only valid for @option{-mcpu=ARC700}.
16054 @opindex msoft-float
16055 This option ignored; it is provided for compatibility purposes only.
16056 Software floating-point code is emitted by default, and this default
16057 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
16058 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
16059 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
16063 Generate @code{swap} instructions.
16067 This enables use of the locked load/store conditional extension to implement
16068 atomic memory built-in functions. Not available for ARC 6xx or ARC
16073 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
16075 @item -mcode-density
16076 @opindex mcode-density
16077 Enable code density instructions for ARC EM.
16078 This option is on by default for ARC HS.
16082 Enable double load/store operations for ARC HS cores.
16084 @item -mtp-regno=@var{regno}
16086 Specify thread pointer register number.
16088 @item -mmpy-option=@var{multo}
16089 @opindex mmpy-option
16090 Compile ARCv2 code with a multiplier design option. You can specify
16091 the option using either a string or numeric value for @var{multo}.
16092 @samp{wlh1} is the default value. The recognized values are:
16097 No multiplier available.
16101 16x16 multiplier, fully pipelined.
16102 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
16106 32x32 multiplier, fully
16107 pipelined (1 stage). The following instructions are additionally
16108 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16112 32x32 multiplier, fully pipelined
16113 (2 stages). The following instructions are additionally enabled: @code{mpy},
16114 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16118 Two 16x16 multipliers, blocking,
16119 sequential. The following instructions are additionally enabled: @code{mpy},
16120 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16124 One 16x16 multiplier, blocking,
16125 sequential. The following instructions are additionally enabled: @code{mpy},
16126 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16130 One 32x4 multiplier, blocking,
16131 sequential. The following instructions are additionally enabled: @code{mpy},
16132 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16136 ARC HS SIMD support.
16140 ARC HS SIMD support.
16144 ARC HS SIMD support.
16148 This option is only available for ARCv2 cores@.
16150 @item -mfpu=@var{fpu}
16152 Enables support for specific floating-point hardware extensions for ARCv2
16153 cores. Supported values for @var{fpu} are:
16158 Enables support for single-precision floating-point hardware
16162 Enables support for double-precision floating-point hardware
16163 extensions. The single-precision floating-point extension is also
16164 enabled. Not available for ARC EM@.
16167 Enables support for double-precision floating-point hardware
16168 extensions using double-precision assist instructions. The single-precision
16169 floating-point extension is also enabled. This option is
16170 only available for ARC EM@.
16173 Enables support for double-precision floating-point hardware
16174 extensions using double-precision assist instructions.
16175 The single-precision floating-point, square-root, and divide
16176 extensions are 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 and fused multiply and add
16183 hardware 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 All single-precision floating-point hardware extensions are also
16190 enabled. This option is only available for ARC EM@.
16193 Enables support for single-precision floating-point, square-root and divide
16194 hardware extensions@.
16197 Enables support for double-precision floating-point, square-root and divide
16198 hardware extensions. This option
16199 includes option @samp{fpus_div}. Not available for ARC EM@.
16202 Enables support for single-precision floating-point and
16203 fused multiply and add hardware extensions@.
16206 Enables support for double-precision floating-point and
16207 fused multiply and add hardware extensions. This option
16208 includes option @samp{fpus_fma}. Not available for ARC EM@.
16211 Enables support for all single-precision floating-point hardware
16215 Enables support for all single- and double-precision floating-point
16216 hardware extensions. Not available for ARC EM@.
16220 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
16221 @opindex mirq-ctrl-saved
16222 Specifies general-purposes registers that the processor automatically
16223 saves/restores on interrupt entry and exit. @var{register-range} is
16224 specified as two registers separated by a dash. The register range
16225 always starts with @code{r0}, the upper limit is @code{fp} register.
16226 @var{blink} and @var{lp_count} are optional. This option is only
16227 valid for ARC EM and ARC HS cores.
16229 @item -mrgf-banked-regs=@var{number}
16230 @opindex mrgf-banked-regs
16231 Specifies the number of registers replicated in second register bank
16232 on entry to fast interrupt. Fast interrupts are interrupts with the
16233 highest priority level P0. These interrupts save only PC and STATUS32
16234 registers to avoid memory transactions during interrupt entry and exit
16235 sequences. Use this option when you are using fast interrupts in an
16236 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
16238 @item -mlpc-width=@var{width}
16239 @opindex mlpc-width
16240 Specify the width of the @code{lp_count} register. Valid values for
16241 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
16242 fixed to 32 bits. If the width is less than 32, the compiler does not
16243 attempt to transform loops in your program to use the zero-delay loop
16244 mechanism unless it is known that the @code{lp_count} register can
16245 hold the required loop-counter value. Depending on the width
16246 specified, the compiler and run-time library might continue to use the
16247 loop mechanism for various needs. This option defines macro
16248 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
16252 This option instructs the compiler to generate code for a 16-entry
16253 register file. This option defines the @code{__ARC_RF16__}
16254 preprocessor macro.
16256 @item -mbranch-index
16257 @opindex mbranch-index
16258 Enable use of @code{bi} or @code{bih} instructions to implement jump
16263 The following options are passed through to the assembler, and also
16264 define preprocessor macro symbols.
16266 @c Flags used by the assembler, but for which we define preprocessor
16267 @c macro symbols as well.
16270 @opindex mdsp-packa
16271 Passed down to the assembler to enable the DSP Pack A extensions.
16272 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
16277 Passed down to the assembler to enable the dual Viterbi butterfly
16278 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
16279 option is deprecated.
16281 @c ARC700 4.10 extension instruction
16284 Passed down to the assembler to enable the locked load/store
16285 conditional extension. Also sets the preprocessor symbol
16290 Passed down to the assembler. Also sets the preprocessor symbol
16291 @code{__Xxmac_d16}. This option is deprecated.
16295 Passed down to the assembler. Also sets the preprocessor symbol
16296 @code{__Xxmac_24}. This option is deprecated.
16298 @c ARC700 4.10 extension instruction
16301 Passed down to the assembler to enable the 64-bit time-stamp counter
16302 extension instruction. Also sets the preprocessor symbol
16303 @code{__Xrtsc}. This option is deprecated.
16305 @c ARC700 4.10 extension instruction
16308 Passed down to the assembler to enable the swap byte ordering
16309 extension instruction. Also sets the preprocessor symbol
16313 @opindex mtelephony
16314 Passed down to the assembler to enable dual- and single-operand
16315 instructions for telephony. Also sets the preprocessor symbol
16316 @code{__Xtelephony}. This option is deprecated.
16320 Passed down to the assembler to enable the XY memory extension. Also
16321 sets the preprocessor symbol @code{__Xxy}.
16325 The following options control how the assembly code is annotated:
16327 @c Assembly annotation options
16331 Annotate assembler instructions with estimated addresses.
16333 @item -mannotate-align
16334 @opindex mannotate-align
16335 Explain what alignment considerations lead to the decision to make an
16336 instruction short or long.
16340 The following options are passed through to the linker:
16342 @c options passed through to the linker
16346 Passed through to the linker, to specify use of the @code{arclinux} emulation.
16347 This option is enabled by default in tool chains built for
16348 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
16349 when profiling is not requested.
16351 @item -marclinux_prof
16352 @opindex marclinux_prof
16353 Passed through to the linker, to specify use of the
16354 @code{arclinux_prof} emulation. This option is enabled by default in
16355 tool chains built for @w{@code{arc-linux-uclibc}} and
16356 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
16360 The following options control the semantics of generated code:
16362 @c semantically relevant code generation options
16365 @opindex mlong-calls
16366 Generate calls as register indirect calls, thus providing access
16367 to the full 32-bit address range.
16369 @item -mmedium-calls
16370 @opindex mmedium-calls
16371 Don't use less than 25-bit addressing range for calls, which is the
16372 offset available for an unconditional branch-and-link
16373 instruction. Conditional execution of function calls is suppressed, to
16374 allow use of the 25-bit range, rather than the 21-bit range with
16375 conditional branch-and-link. This is the default for tool chains built
16376 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
16380 Put definitions of externally-visible data in a small data section if
16381 that data is no bigger than @var{num} bytes. The default value of
16382 @var{num} is 4 for any ARC configuration, or 8 when we have double
16383 load/store operations.
16388 Do not generate sdata references. This is the default for tool chains
16389 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
16392 @item -mvolatile-cache
16393 @opindex mvolatile-cache
16394 Use ordinarily cached memory accesses for volatile references. This is the
16397 @item -mno-volatile-cache
16398 @opindex mno-volatile-cache
16399 @opindex mvolatile-cache
16400 Enable cache bypass for volatile references.
16404 The following options fine tune code generation:
16405 @c code generation tuning options
16408 @opindex malign-call
16409 Do alignment optimizations for call instructions.
16411 @item -mauto-modify-reg
16412 @opindex mauto-modify-reg
16413 Enable the use of pre/post modify with register displacement.
16415 @item -mbbit-peephole
16416 @opindex mbbit-peephole
16417 Enable bbit peephole2.
16421 This option disables a target-specific pass in @file{arc_reorg} to
16422 generate compare-and-branch (@code{br@var{cc}}) instructions.
16423 It has no effect on
16424 generation of these instructions driven by the combiner pass.
16426 @item -mcase-vector-pcrel
16427 @opindex mcase-vector-pcrel
16428 Use PC-relative switch case tables to enable case table shortening.
16429 This is the default for @option{-Os}.
16431 @item -mcompact-casesi
16432 @opindex mcompact-casesi
16433 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
16434 and only available for ARCv1 cores. This option is deprecated.
16436 @item -mno-cond-exec
16437 @opindex mno-cond-exec
16438 Disable the ARCompact-specific pass to generate conditional
16439 execution instructions.
16441 Due to delay slot scheduling and interactions between operand numbers,
16442 literal sizes, instruction lengths, and the support for conditional execution,
16443 the target-independent pass to generate conditional execution is often lacking,
16444 so the ARC port has kept a special pass around that tries to find more
16445 conditional execution generation opportunities after register allocation,
16446 branch shortening, and delay slot scheduling have been done. This pass
16447 generally, but not always, improves performance and code size, at the cost of
16448 extra compilation time, which is why there is an option to switch it off.
16449 If you have a problem with call instructions exceeding their allowable
16450 offset range because they are conditionalized, you should consider using
16451 @option{-mmedium-calls} instead.
16453 @item -mearly-cbranchsi
16454 @opindex mearly-cbranchsi
16455 Enable pre-reload use of the @code{cbranchsi} pattern.
16457 @item -mexpand-adddi
16458 @opindex mexpand-adddi
16459 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
16460 @code{add.f}, @code{adc} etc. This option is deprecated.
16462 @item -mindexed-loads
16463 @opindex mindexed-loads
16464 Enable the use of indexed loads. This can be problematic because some
16465 optimizers then assume that indexed stores exist, which is not
16470 Enable Local Register Allocation. This is still experimental for ARC,
16471 so by default the compiler uses standard reload
16472 (i.e.@: @option{-mno-lra}).
16474 @item -mlra-priority-none
16475 @opindex mlra-priority-none
16476 Don't indicate any priority for target registers.
16478 @item -mlra-priority-compact
16479 @opindex mlra-priority-compact
16480 Indicate target register priority for r0..r3 / r12..r15.
16482 @item -mlra-priority-noncompact
16483 @opindex mlra-priority-noncompact
16484 Reduce target register priority for r0..r3 / r12..r15.
16487 @opindex mmillicode
16488 When optimizing for size (using @option{-Os}), prologues and epilogues
16489 that have to save or restore a large number of registers are often
16490 shortened by using call to a special function in libgcc; this is
16491 referred to as a @emph{millicode} call. As these calls can pose
16492 performance issues, and/or cause linking issues when linking in a
16493 nonstandard way, this option is provided to turn on or off millicode
16496 @item -mcode-density-frame
16497 @opindex mcode-density-frame
16498 This option enable the compiler to emit @code{enter} and @code{leave}
16499 instructions. These instructions are only valid for CPUs with
16500 code-density feature.
16503 @opindex mmixed-code
16504 Tweak register allocation to help 16-bit instruction generation.
16505 This generally has the effect of decreasing the average instruction size
16506 while increasing the instruction count.
16510 Enable @samp{q} instruction alternatives.
16511 This is the default for @option{-Os}.
16515 Enable @samp{Rcq} constraint handling.
16516 Most short code generation depends on this.
16517 This is the default.
16521 Enable @samp{Rcw} constraint handling.
16522 Most ccfsm condexec mostly depends on this.
16523 This is the default.
16525 @item -msize-level=@var{level}
16526 @opindex msize-level
16527 Fine-tune size optimization with regards to instruction lengths and alignment.
16528 The recognized values for @var{level} are:
16531 No size optimization. This level is deprecated and treated like @samp{1}.
16534 Short instructions are used opportunistically.
16537 In addition, alignment of loops and of code after barriers are dropped.
16540 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
16544 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
16545 the behavior when this is not set is equivalent to level @samp{1}.
16547 @item -mtune=@var{cpu}
16549 Set instruction scheduling parameters for @var{cpu}, overriding any implied
16550 by @option{-mcpu=}.
16552 Supported values for @var{cpu} are
16556 Tune for ARC600 CPU.
16559 Tune for ARC601 CPU.
16562 Tune for ARC700 CPU with standard multiplier block.
16565 Tune for ARC700 CPU with XMAC block.
16568 Tune for ARC725D CPU.
16571 Tune for ARC750D CPU.
16575 @item -mmultcost=@var{num}
16577 Cost to assume for a multiply instruction, with @samp{4} being equal to a
16578 normal instruction.
16580 @item -munalign-prob-threshold=@var{probability}
16581 @opindex munalign-prob-threshold
16582 Set probability threshold for unaligning branches.
16583 When tuning for @samp{ARC700} and optimizing for speed, branches without
16584 filled delay slot are preferably emitted unaligned and long, unless
16585 profiling indicates that the probability for the branch to be taken
16586 is below @var{probability}. @xref{Cross-profiling}.
16587 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
16591 The following options are maintained for backward compatibility, but
16592 are now deprecated and will be removed in a future release:
16594 @c Deprecated options
16602 @opindex mbig-endian
16605 Compile code for big-endian targets. Use of these options is now
16606 deprecated. Big-endian code is supported by configuring GCC to build
16607 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
16608 for which big endian is the default.
16610 @item -mlittle-endian
16611 @opindex mlittle-endian
16614 Compile code for little-endian targets. Use of these options is now
16615 deprecated. Little-endian code is supported by configuring GCC to build
16616 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
16617 for which little endian is the default.
16619 @item -mbarrel_shifter
16620 @opindex mbarrel_shifter
16621 Replaced by @option{-mbarrel-shifter}.
16623 @item -mdpfp_compact
16624 @opindex mdpfp_compact
16625 Replaced by @option{-mdpfp-compact}.
16628 @opindex mdpfp_fast
16629 Replaced by @option{-mdpfp-fast}.
16632 @opindex mdsp_packa
16633 Replaced by @option{-mdsp-packa}.
16637 Replaced by @option{-mea}.
16641 Replaced by @option{-mmac-24}.
16645 Replaced by @option{-mmac-d16}.
16647 @item -mspfp_compact
16648 @opindex mspfp_compact
16649 Replaced by @option{-mspfp-compact}.
16652 @opindex mspfp_fast
16653 Replaced by @option{-mspfp-fast}.
16655 @item -mtune=@var{cpu}
16657 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
16658 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
16659 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
16661 @item -multcost=@var{num}
16663 Replaced by @option{-mmultcost}.
16668 @subsection ARM Options
16669 @cindex ARM options
16671 These @samp{-m} options are defined for the ARM port:
16674 @item -mabi=@var{name}
16676 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
16677 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
16680 @opindex mapcs-frame
16681 Generate a stack frame that is compliant with the ARM Procedure Call
16682 Standard for all functions, even if this is not strictly necessary for
16683 correct execution of the code. Specifying @option{-fomit-frame-pointer}
16684 with this option causes the stack frames not to be generated for
16685 leaf functions. The default is @option{-mno-apcs-frame}.
16686 This option is deprecated.
16690 This is a synonym for @option{-mapcs-frame} and is deprecated.
16693 @c not currently implemented
16694 @item -mapcs-stack-check
16695 @opindex mapcs-stack-check
16696 Generate code to check the amount of stack space available upon entry to
16697 every function (that actually uses some stack space). If there is
16698 insufficient space available then either the function
16699 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
16700 called, depending upon the amount of stack space required. The runtime
16701 system is required to provide these functions. The default is
16702 @option{-mno-apcs-stack-check}, since this produces smaller code.
16704 @c not currently implemented
16705 @item -mapcs-reentrant
16706 @opindex mapcs-reentrant
16707 Generate reentrant, position-independent code. The default is
16708 @option{-mno-apcs-reentrant}.
16711 @item -mthumb-interwork
16712 @opindex mthumb-interwork
16713 Generate code that supports calling between the ARM and Thumb
16714 instruction sets. Without this option, on pre-v5 architectures, the
16715 two instruction sets cannot be reliably used inside one program. The
16716 default is @option{-mno-thumb-interwork}, since slightly larger code
16717 is generated when @option{-mthumb-interwork} is specified. In AAPCS
16718 configurations this option is meaningless.
16720 @item -mno-sched-prolog
16721 @opindex mno-sched-prolog
16722 @opindex msched-prolog
16723 Prevent the reordering of instructions in the function prologue, or the
16724 merging of those instruction with the instructions in the function's
16725 body. This means that all functions start with a recognizable set
16726 of instructions (or in fact one of a choice from a small set of
16727 different function prologues), and this information can be used to
16728 locate the start of functions inside an executable piece of code. The
16729 default is @option{-msched-prolog}.
16731 @item -mfloat-abi=@var{name}
16732 @opindex mfloat-abi
16733 Specifies which floating-point ABI to use. Permissible values
16734 are: @samp{soft}, @samp{softfp} and @samp{hard}.
16736 Specifying @samp{soft} causes GCC to generate output containing
16737 library calls for floating-point operations.
16738 @samp{softfp} allows the generation of code using hardware floating-point
16739 instructions, but still uses the soft-float calling conventions.
16740 @samp{hard} allows generation of floating-point instructions
16741 and uses FPU-specific calling conventions.
16743 The default depends on the specific target configuration. Note that
16744 the hard-float and soft-float ABIs are not link-compatible; you must
16745 compile your entire program with the same ABI, and link with a
16746 compatible set of libraries.
16748 @item -mlittle-endian
16749 @opindex mlittle-endian
16750 Generate code for a processor running in little-endian mode. This is
16751 the default for all standard configurations.
16754 @opindex mbig-endian
16755 Generate code for a processor running in big-endian mode; the default is
16756 to compile code for a little-endian processor.
16761 When linking a big-endian image select between BE8 and BE32 formats.
16762 The option has no effect for little-endian images and is ignored. The
16763 default is dependent on the selected target architecture. For ARMv6
16764 and later architectures the default is BE8, for older architectures
16765 the default is BE32. BE32 format has been deprecated by ARM.
16767 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
16769 This specifies the name of the target ARM architecture. GCC uses this
16770 name to determine what kind of instructions it can emit when generating
16771 assembly code. This option can be used in conjunction with or instead
16772 of the @option{-mcpu=} option.
16774 Permissible names are:
16776 @samp{armv5t}, @samp{armv5te},
16777 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
16778 @samp{armv6z}, @samp{armv6zk},
16779 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
16780 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
16785 @samp{armv6-m}, @samp{armv6s-m},
16786 @samp{armv7-m}, @samp{armv7e-m},
16787 @samp{armv8-m.base}, @samp{armv8-m.main},
16788 @samp{iwmmxt} and @samp{iwmmxt2}.
16790 Additionally, the following architectures, which lack support for the
16791 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
16793 Many of the architectures support extensions. These can be added by
16794 appending @samp{+@var{extension}} to the architecture name. Extension
16795 options are processed in order and capabilities accumulate. An extension
16796 will also enable any necessary base extensions
16797 upon which it depends. For example, the @samp{+crypto} extension
16798 will always enable the @samp{+simd} extension. The exception to the
16799 additive construction is for extensions that are prefixed with
16800 @samp{+no@dots{}}: these extensions disable the specified option and
16801 any other extensions that may depend on the presence of that
16804 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
16805 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
16806 entirely disabled by the @samp{+nofp} option that follows it.
16808 Most extension names are generically named, but have an effect that is
16809 dependent upon the architecture to which it is applied. For example,
16810 the @samp{+simd} option can be applied to both @samp{armv7-a} and
16811 @samp{armv8-a} architectures, but will enable the original ARMv7-A
16812 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
16813 variant for @samp{armv8-a}.
16815 The table below lists the supported extensions for each architecture.
16816 Architectures not mentioned do not support any extensions.
16829 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
16830 used as an alias for this extension.
16833 Disable the floating-point instructions.
16837 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
16840 The VFPv3 floating-point instructions, with 16 double-precision
16841 registers. The extension @samp{+vfpv3-d16} can be used as an alias
16842 for this extension. Note that floating-point is not supported by the
16843 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
16844 ARMv7-R architectures.
16847 Disable the floating-point instructions.
16853 The VFPv3 floating-point instructions, with 16 double-precision
16854 registers. The extension @samp{+vfpv3-d16} can be used as an alias
16855 for this extension.
16858 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
16859 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
16860 for this extension.
16863 The VFPv3 floating-point instructions, with 32 double-precision
16866 @item +vfpv3-d16-fp16
16867 The VFPv3 floating-point instructions, with 16 double-precision
16868 registers and the half-precision floating-point conversion operations.
16871 The VFPv3 floating-point instructions, with 32 double-precision
16872 registers and the half-precision floating-point conversion operations.
16875 The VFPv4 floating-point instructions, with 16 double-precision
16879 The VFPv4 floating-point instructions, with 32 double-precision
16883 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
16884 the half-precision floating-point conversion operations.
16887 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
16890 Disable the Advanced SIMD instructions (does not disable floating point).
16893 Disable the floating-point and Advanced SIMD instructions.
16897 The extended version of the ARMv7-A architecture with support for
16901 The VFPv4 floating-point instructions, with 16 double-precision registers.
16902 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
16905 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
16906 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
16909 The VFPv3 floating-point instructions, with 16 double-precision
16913 The VFPv3 floating-point instructions, with 32 double-precision
16916 @item +vfpv3-d16-fp16
16917 The VFPv3 floating-point instructions, with 16 double-precision
16918 registers and the half-precision floating-point conversion operations.
16921 The VFPv3 floating-point instructions, with 32 double-precision
16922 registers and the half-precision floating-point conversion operations.
16925 The VFPv4 floating-point instructions, with 16 double-precision
16929 The VFPv4 floating-point instructions, with 32 double-precision
16933 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
16934 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
16937 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
16938 the half-precision floating-point conversion operations.
16941 Disable the Advanced SIMD instructions (does not disable floating point).
16944 Disable the floating-point and Advanced SIMD instructions.
16950 The Cyclic Redundancy Check (CRC) instructions.
16952 The ARMv8-A Advanced SIMD and floating-point instructions.
16954 The cryptographic instructions.
16956 Disable the cryptographic instructions.
16958 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16960 Speculation Barrier Instruction.
16962 Execution and Data Prediction Restriction Instructions.
16968 The ARMv8.1-A Advanced SIMD and floating-point instructions.
16971 The cryptographic instructions. This also enables the Advanced SIMD and
16972 floating-point instructions.
16975 Disable the cryptographic instructions.
16978 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16981 Speculation Barrier Instruction.
16984 Execution and Data Prediction Restriction Instructions.
16991 The half-precision floating-point data processing instructions.
16992 This also enables the Advanced SIMD and floating-point instructions.
16995 The half-precision floating-point fmla extension. This also enables
16996 the half-precision floating-point extension and Advanced SIMD and
16997 floating-point instructions.
17000 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17003 The cryptographic instructions. This also enables the Advanced SIMD and
17004 floating-point instructions.
17007 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
17010 Disable the cryptographic extension.
17013 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17016 Speculation Barrier Instruction.
17019 Execution and Data Prediction Restriction Instructions.
17025 The half-precision floating-point data processing instructions.
17026 This also enables the Advanced SIMD and floating-point instructions as well
17027 as the Dot Product extension and the half-precision floating-point fmla
17031 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17032 Dot Product extension.
17035 The cryptographic instructions. This also enables the Advanced SIMD and
17036 floating-point instructions as well as the Dot Product extension.
17039 Disable the cryptographic extension.
17042 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17045 Speculation Barrier Instruction.
17048 Execution and Data Prediction Restriction Instructions.
17054 The half-precision floating-point data processing instructions.
17055 This also enables the Advanced SIMD and floating-point instructions as well
17056 as the Dot Product extension and the half-precision floating-point fmla
17060 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17061 Dot Product extension.
17064 The cryptographic instructions. This also enables the Advanced SIMD and
17065 floating-point instructions as well as the Dot Product extension.
17068 Disable the cryptographic extension.
17071 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17077 The single-precision VFPv3 floating-point instructions. The extension
17078 @samp{+vfpv3xd} can be used as an alias for this extension.
17081 The VFPv3 floating-point instructions with 16 double-precision registers.
17082 The extension +vfpv3-d16 can be used as an alias for this extension.
17085 Disable the floating-point extension.
17088 The ARM-state integer division instructions.
17091 Disable the ARM-state integer division extension.
17097 The single-precision VFPv4 floating-point instructions.
17100 The single-precision FPv5 floating-point instructions.
17103 The single- and double-precision FPv5 floating-point instructions.
17106 Disable the floating-point extensions.
17112 The DSP instructions.
17115 Disable the DSP extension.
17118 The single-precision floating-point instructions.
17121 The single- and double-precision floating-point instructions.
17124 Disable the floating-point extension.
17130 The Cyclic Redundancy Check (CRC) instructions.
17132 The single-precision FPv5 floating-point instructions.
17134 The ARMv8-A Advanced SIMD and floating-point instructions.
17136 The cryptographic instructions.
17138 Disable the cryptographic instructions.
17140 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17145 @option{-march=native} causes the compiler to auto-detect the architecture
17146 of the build computer. At present, this feature is only supported on
17147 GNU/Linux, and not all architectures are recognized. If the auto-detect
17148 is unsuccessful the option has no effect.
17150 @item -mtune=@var{name}
17152 This option specifies the name of the target ARM processor for
17153 which GCC should tune the performance of the code.
17154 For some ARM implementations better performance can be obtained by using
17156 Permissible names are: @samp{arm2}, @samp{arm250},
17157 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
17158 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
17159 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
17160 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
17162 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
17163 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
17164 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
17165 @samp{strongarm1110},
17166 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
17167 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
17168 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
17169 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
17170 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
17171 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
17172 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
17173 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
17174 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
17175 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
17176 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17177 @samp{cortex-a76}, @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
17178 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
17186 @samp{cortex-m0plus},
17187 @samp{cortex-m1.small-multiply},
17188 @samp{cortex-m0.small-multiply},
17189 @samp{cortex-m0plus.small-multiply},
17191 @samp{marvell-pj4},
17192 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
17193 @samp{fa526}, @samp{fa626},
17194 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
17197 Additionally, this option can specify that GCC should tune the performance
17198 of the code for a big.LITTLE system. Permissible names are:
17199 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
17200 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17201 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
17202 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
17204 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
17205 performance for a blend of processors within architecture @var{arch}.
17206 The aim is to generate code that run well on the current most popular
17207 processors, balancing between optimizations that benefit some CPUs in the
17208 range, and avoiding performance pitfalls of other CPUs. The effects of
17209 this option may change in future GCC versions as CPU models come and go.
17211 @option{-mtune} permits the same extension options as @option{-mcpu}, but
17212 the extension options do not affect the tuning of the generated code.
17214 @option{-mtune=native} causes the compiler to auto-detect the CPU
17215 of the build computer. At present, this feature is only supported on
17216 GNU/Linux, and not all architectures are recognized. If the auto-detect is
17217 unsuccessful the option has no effect.
17219 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
17221 This specifies the name of the target ARM processor. GCC uses this name
17222 to derive the name of the target ARM architecture (as if specified
17223 by @option{-march}) and the ARM processor type for which to tune for
17224 performance (as if specified by @option{-mtune}). Where this option
17225 is used in conjunction with @option{-march} or @option{-mtune},
17226 those options take precedence over the appropriate part of this option.
17228 Many of the supported CPUs implement optional architectural
17229 extensions. Where this is so the architectural extensions are
17230 normally enabled by default. If implementations that lack the
17231 extension exist, then the extension syntax can be used to disable
17232 those extensions that have been omitted. For floating-point and
17233 Advanced SIMD (Neon) instructions, the settings of the options
17234 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
17235 floating-point and Advanced SIMD instructions will only be used if
17236 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
17237 @option{-mfpu} other than @samp{auto} will override the available
17238 floating-point and SIMD extension instructions.
17240 For example, @samp{cortex-a9} can be found in three major
17241 configurations: integer only, with just a floating-point unit or with
17242 floating-point and Advanced SIMD. The default is to enable all the
17243 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
17244 be used to disable just the SIMD or both the SIMD and floating-point
17245 instructions respectively.
17247 Permissible names for this option are the same as those for
17250 The following extension options are common to the listed CPUs:
17254 Disable the DSP instructions on @samp{cortex-m33}.
17257 Disables the floating-point instructions on @samp{arm9e},
17258 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
17259 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
17260 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
17261 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
17262 Disables the floating-point and SIMD instructions on
17263 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
17264 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
17265 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
17266 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
17267 @samp{cortex-a53} and @samp{cortex-a55}.
17270 Disables the double-precision component of the floating-point instructions
17271 on @samp{cortex-r5}, @samp{cortex-r52} and @samp{cortex-m7}.
17274 Disables the SIMD (but not floating-point) instructions on
17275 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
17276 and @samp{cortex-a9}.
17279 Enables the cryptographic instructions on @samp{cortex-a32},
17280 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
17281 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
17282 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17283 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
17284 @samp{cortex-a75.cortex-a55}.
17287 Additionally the @samp{generic-armv7-a} pseudo target defaults to
17288 VFPv3 with 16 double-precision registers. It supports the following
17289 extension options: @samp{vfpv3-d16}, @samp{vfpv3},
17290 @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16}, @samp{vfpv4-d16},
17291 @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3}, @samp{neon-fp16},
17292 @samp{neon-vfpv4}. The meanings are the same as for the extensions to
17293 @option{-march=armv7-a}.
17295 @option{-mcpu=generic-@var{arch}} is also permissible, and is
17296 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
17297 See @option{-mtune} for more information.
17299 @option{-mcpu=native} causes the compiler to auto-detect the CPU
17300 of the build computer. At present, this feature is only supported on
17301 GNU/Linux, and not all architectures are recognized. If the auto-detect
17302 is unsuccessful the option has no effect.
17304 @item -mfpu=@var{name}
17306 This specifies what floating-point hardware (or hardware emulation) is
17307 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
17309 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
17310 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
17311 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
17312 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
17313 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
17314 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
17315 is an alias for @samp{vfpv2}.
17317 The setting @samp{auto} is the default and is special. It causes the
17318 compiler to select the floating-point and Advanced SIMD instructions
17319 based on the settings of @option{-mcpu} and @option{-march}.
17321 If the selected floating-point hardware includes the NEON extension
17322 (e.g.@: @option{-mfpu=neon}), note that floating-point
17323 operations are not generated by GCC's auto-vectorization pass unless
17324 @option{-funsafe-math-optimizations} is also specified. This is
17325 because NEON hardware does not fully implement the IEEE 754 standard for
17326 floating-point arithmetic (in particular denormal values are treated as
17327 zero), so the use of NEON instructions may lead to a loss of precision.
17329 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}).
17331 @item -mfp16-format=@var{name}
17332 @opindex mfp16-format
17333 Specify the format of the @code{__fp16} half-precision floating-point type.
17334 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
17335 the default is @samp{none}, in which case the @code{__fp16} type is not
17336 defined. @xref{Half-Precision}, for more information.
17338 @item -mstructure-size-boundary=@var{n}
17339 @opindex mstructure-size-boundary
17340 The sizes of all structures and unions are rounded up to a multiple
17341 of the number of bits set by this option. Permissible values are 8, 32
17342 and 64. The default value varies for different toolchains. For the COFF
17343 targeted toolchain the default value is 8. A value of 64 is only allowed
17344 if the underlying ABI supports it.
17346 Specifying a larger number can produce faster, more efficient code, but
17347 can also increase the size of the program. Different values are potentially
17348 incompatible. Code compiled with one value cannot necessarily expect to
17349 work with code or libraries compiled with another value, if they exchange
17350 information using structures or unions.
17352 This option is deprecated.
17354 @item -mabort-on-noreturn
17355 @opindex mabort-on-noreturn
17356 Generate a call to the function @code{abort} at the end of a
17357 @code{noreturn} function. It is executed if the function tries to
17361 @itemx -mno-long-calls
17362 @opindex mlong-calls
17363 @opindex mno-long-calls
17364 Tells the compiler to perform function calls by first loading the
17365 address of the function into a register and then performing a subroutine
17366 call on this register. This switch is needed if the target function
17367 lies outside of the 64-megabyte addressing range of the offset-based
17368 version of subroutine call instruction.
17370 Even if this switch is enabled, not all function calls are turned
17371 into long calls. The heuristic is that static functions, functions
17372 that have the @code{short_call} attribute, functions that are inside
17373 the scope of a @code{#pragma no_long_calls} directive, and functions whose
17374 definitions have already been compiled within the current compilation
17375 unit are not turned into long calls. The exceptions to this rule are
17376 that weak function definitions, functions with the @code{long_call}
17377 attribute or the @code{section} attribute, and functions that are within
17378 the scope of a @code{#pragma long_calls} directive are always
17379 turned into long calls.
17381 This feature is not enabled by default. Specifying
17382 @option{-mno-long-calls} restores the default behavior, as does
17383 placing the function calls within the scope of a @code{#pragma
17384 long_calls_off} directive. Note these switches have no effect on how
17385 the compiler generates code to handle function calls via function
17388 @item -msingle-pic-base
17389 @opindex msingle-pic-base
17390 Treat the register used for PIC addressing as read-only, rather than
17391 loading it in the prologue for each function. The runtime system is
17392 responsible for initializing this register with an appropriate value
17393 before execution begins.
17395 @item -mpic-register=@var{reg}
17396 @opindex mpic-register
17397 Specify the register to be used for PIC addressing.
17398 For standard PIC base case, the default is any suitable register
17399 determined by compiler. For single PIC base case, the default is
17400 @samp{R9} if target is EABI based or stack-checking is enabled,
17401 otherwise the default is @samp{R10}.
17403 @item -mpic-data-is-text-relative
17404 @opindex mpic-data-is-text-relative
17405 Assume that the displacement between the text and data segments is fixed
17406 at static link time. This permits using PC-relative addressing
17407 operations to access data known to be in the data segment. For
17408 non-VxWorks RTP targets, this option is enabled by default. When
17409 disabled on such targets, it will enable @option{-msingle-pic-base} by
17412 @item -mpoke-function-name
17413 @opindex mpoke-function-name
17414 Write the name of each function into the text section, directly
17415 preceding the function prologue. The generated code is similar to this:
17419 .ascii "arm_poke_function_name", 0
17422 .word 0xff000000 + (t1 - t0)
17423 arm_poke_function_name
17425 stmfd sp!, @{fp, ip, lr, pc@}
17429 When performing a stack backtrace, code can inspect the value of
17430 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
17431 location @code{pc - 12} and the top 8 bits are set, then we know that
17432 there is a function name embedded immediately preceding this location
17433 and has length @code{((pc[-3]) & 0xff000000)}.
17440 Select between generating code that executes in ARM and Thumb
17441 states. The default for most configurations is to generate code
17442 that executes in ARM state, but the default can be changed by
17443 configuring GCC with the @option{--with-mode=}@var{state}
17446 You can also override the ARM and Thumb mode for each function
17447 by using the @code{target("thumb")} and @code{target("arm")} function attributes
17448 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
17451 @opindex mflip-thumb
17452 Switch ARM/Thumb modes on alternating functions.
17453 This option is provided for regression testing of mixed Thumb/ARM code
17454 generation, and is not intended for ordinary use in compiling code.
17457 @opindex mtpcs-frame
17458 Generate a stack frame that is compliant with the Thumb Procedure Call
17459 Standard for all non-leaf functions. (A leaf function is one that does
17460 not call any other functions.) The default is @option{-mno-tpcs-frame}.
17462 @item -mtpcs-leaf-frame
17463 @opindex mtpcs-leaf-frame
17464 Generate a stack frame that is compliant with the Thumb Procedure Call
17465 Standard for all leaf functions. (A leaf function is one that does
17466 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
17468 @item -mcallee-super-interworking
17469 @opindex mcallee-super-interworking
17470 Gives all externally visible functions in the file being compiled an ARM
17471 instruction set header which switches to Thumb mode before executing the
17472 rest of the function. This allows these functions to be called from
17473 non-interworking code. This option is not valid in AAPCS configurations
17474 because interworking is enabled by default.
17476 @item -mcaller-super-interworking
17477 @opindex mcaller-super-interworking
17478 Allows calls via function pointers (including virtual functions) to
17479 execute correctly regardless of whether the target code has been
17480 compiled for interworking or not. There is a small overhead in the cost
17481 of executing a function pointer if this option is enabled. This option
17482 is not valid in AAPCS configurations because interworking is enabled
17485 @item -mtp=@var{name}
17487 Specify the access model for the thread local storage pointer. The valid
17488 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
17489 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
17490 (supported in the arm6k architecture), and @samp{auto}, which uses the
17491 best available method for the selected processor. The default setting is
17494 @item -mtls-dialect=@var{dialect}
17495 @opindex mtls-dialect
17496 Specify the dialect to use for accessing thread local storage. Two
17497 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
17498 @samp{gnu} dialect selects the original GNU scheme for supporting
17499 local and global dynamic TLS models. The @samp{gnu2} dialect
17500 selects the GNU descriptor scheme, which provides better performance
17501 for shared libraries. The GNU descriptor scheme is compatible with
17502 the original scheme, but does require new assembler, linker and
17503 library support. Initial and local exec TLS models are unaffected by
17504 this option and always use the original scheme.
17506 @item -mword-relocations
17507 @opindex mword-relocations
17508 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
17509 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
17510 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
17511 is specified. This option conflicts with @option{-mslow-flash-data}.
17513 @item -mfix-cortex-m3-ldrd
17514 @opindex mfix-cortex-m3-ldrd
17515 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
17516 with overlapping destination and base registers are used. This option avoids
17517 generating these instructions. This option is enabled by default when
17518 @option{-mcpu=cortex-m3} is specified.
17520 @item -munaligned-access
17521 @itemx -mno-unaligned-access
17522 @opindex munaligned-access
17523 @opindex mno-unaligned-access
17524 Enables (or disables) reading and writing of 16- and 32- bit values
17525 from addresses that are not 16- or 32- bit aligned. By default
17526 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
17527 ARMv8-M Baseline architectures, and enabled for all other
17528 architectures. If unaligned access is not enabled then words in packed
17529 data structures are accessed a byte at a time.
17531 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
17532 generated object file to either true or false, depending upon the
17533 setting of this option. If unaligned access is enabled then the
17534 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
17537 @item -mneon-for-64bits
17538 @opindex mneon-for-64bits
17539 Enables using Neon to handle scalar 64-bits operations. This is
17540 disabled by default since the cost of moving data from core registers
17543 @item -mslow-flash-data
17544 @opindex mslow-flash-data
17545 Assume loading data from flash is slower than fetching instruction.
17546 Therefore literal load is minimized for better performance.
17547 This option is only supported when compiling for ARMv7 M-profile and
17548 off by default. It conflicts with @option{-mword-relocations}.
17550 @item -masm-syntax-unified
17551 @opindex masm-syntax-unified
17552 Assume inline assembler is using unified asm syntax. The default is
17553 currently off which implies divided syntax. This option has no impact
17554 on Thumb2. However, this may change in future releases of GCC.
17555 Divided syntax should be considered deprecated.
17557 @item -mrestrict-it
17558 @opindex mrestrict-it
17559 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
17560 IT blocks can only contain a single 16-bit instruction from a select
17561 set of instructions. This option is on by default for ARMv8-A Thumb mode.
17563 @item -mprint-tune-info
17564 @opindex mprint-tune-info
17565 Print CPU tuning information as comment in assembler file. This is
17566 an option used only for regression testing of the compiler and not
17567 intended for ordinary use in compiling code. This option is disabled
17570 @item -mverbose-cost-dump
17571 @opindex mverbose-cost-dump
17572 Enable verbose cost model dumping in the debug dump files. This option is
17573 provided for use in debugging the compiler.
17576 @opindex mpure-code
17577 Do not allow constant data to be placed in code sections.
17578 Additionally, when compiling for ELF object format give all text sections the
17579 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
17580 is only available when generating non-pic code for M-profile targets with the
17585 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
17586 Development Tools Engineering Specification", which can be found on
17587 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
17591 @subsection AVR Options
17592 @cindex AVR Options
17594 These options are defined for AVR implementations:
17597 @item -mmcu=@var{mcu}
17599 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
17601 The default for this option is@tie{}@samp{avr2}.
17603 GCC supports the following AVR devices and ISAs:
17605 @include avr-mmcu.texi
17610 Assume that all data in static storage can be accessed by LDS / STS
17611 instructions. This option has only an effect on reduced Tiny devices like
17612 ATtiny40. See also the @code{absdata}
17613 @ref{AVR Variable Attributes,variable attribute}.
17615 @item -maccumulate-args
17616 @opindex maccumulate-args
17617 Accumulate outgoing function arguments and acquire/release the needed
17618 stack space for outgoing function arguments once in function
17619 prologue/epilogue. Without this option, outgoing arguments are pushed
17620 before calling a function and popped afterwards.
17622 Popping the arguments after the function call can be expensive on
17623 AVR so that accumulating the stack space might lead to smaller
17624 executables because arguments need not be removed from the
17625 stack after such a function call.
17627 This option can lead to reduced code size for functions that perform
17628 several calls to functions that get their arguments on the stack like
17629 calls to printf-like functions.
17631 @item -mbranch-cost=@var{cost}
17632 @opindex mbranch-cost
17633 Set the branch costs for conditional branch instructions to
17634 @var{cost}. Reasonable values for @var{cost} are small, non-negative
17635 integers. The default branch cost is 0.
17637 @item -mcall-prologues
17638 @opindex mcall-prologues
17639 Functions prologues/epilogues are expanded as calls to appropriate
17640 subroutines. Code size is smaller.
17642 @item -mgas-isr-prologues
17643 @opindex mgas-isr-prologues
17644 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
17645 instruction supported by GNU Binutils.
17646 If this option is on, the feature can still be disabled for individual
17647 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
17648 function attribute. This feature is activated per default
17649 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
17650 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
17654 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
17655 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
17656 and @code{long long} is 4 bytes. Please note that this option does not
17657 conform to the C standards, but it results in smaller code
17660 @item -mmain-is-OS_task
17661 @opindex mmain-is-OS_task
17662 Do not save registers in @code{main}. The effect is the same like
17663 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
17664 to @code{main}. It is activated per default if optimization is on.
17666 @item -mn-flash=@var{num}
17668 Assume that the flash memory has a size of
17669 @var{num} times 64@tie{}KiB.
17671 @item -mno-interrupts
17672 @opindex mno-interrupts
17673 Generated code is not compatible with hardware interrupts.
17674 Code size is smaller.
17678 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
17679 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
17680 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
17681 the assembler's command line and the @option{--relax} option to the
17682 linker's command line.
17684 Jump relaxing is performed by the linker because jump offsets are not
17685 known before code is located. Therefore, the assembler code generated by the
17686 compiler is the same, but the instructions in the executable may
17687 differ from instructions in the assembler code.
17689 Relaxing must be turned on if linker stubs are needed, see the
17690 section on @code{EIND} and linker stubs below.
17694 Assume that the device supports the Read-Modify-Write
17695 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
17697 @item -mshort-calls
17698 @opindex mshort-calls
17700 Assume that @code{RJMP} and @code{RCALL} can target the whole
17703 This option is used internally for multilib selection. It is
17704 not an optimization option, and you don't need to set it by hand.
17708 Treat the stack pointer register as an 8-bit register,
17709 i.e.@: assume the high byte of the stack pointer is zero.
17710 In general, you don't need to set this option by hand.
17712 This option is used internally by the compiler to select and
17713 build multilibs for architectures @code{avr2} and @code{avr25}.
17714 These architectures mix devices with and without @code{SPH}.
17715 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
17716 the compiler driver adds or removes this option from the compiler
17717 proper's command line, because the compiler then knows if the device
17718 or architecture has an 8-bit stack pointer and thus no @code{SPH}
17723 Use address register @code{X} in a way proposed by the hardware. This means
17724 that @code{X} is only used in indirect, post-increment or
17725 pre-decrement addressing.
17727 Without this option, the @code{X} register may be used in the same way
17728 as @code{Y} or @code{Z} which then is emulated by additional
17730 For example, loading a value with @code{X+const} addressing with a
17731 small non-negative @code{const < 64} to a register @var{Rn} is
17735 adiw r26, const ; X += const
17736 ld @var{Rn}, X ; @var{Rn} = *X
17737 sbiw r26, const ; X -= const
17741 @opindex mtiny-stack
17742 Only change the lower 8@tie{}bits of the stack pointer.
17744 @item -mfract-convert-truncate
17745 @opindex mfract-convert-truncate
17746 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
17749 @opindex nodevicelib
17750 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
17752 @item -Waddr-space-convert
17753 @opindex Waddr-space-convert
17754 @opindex Wno-addr-space-convert
17755 Warn about conversions between address spaces in the case where the
17756 resulting address space is not contained in the incoming address space.
17758 @item -Wmisspelled-isr
17759 @opindex Wmisspelled-isr
17760 @opindex Wno-misspelled-isr
17761 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
17762 Enabled by default.
17765 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
17766 @cindex @code{EIND}
17767 Pointers in the implementation are 16@tie{}bits wide.
17768 The address of a function or label is represented as word address so
17769 that indirect jumps and calls can target any code address in the
17770 range of 64@tie{}Ki words.
17772 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
17773 bytes of program memory space, there is a special function register called
17774 @code{EIND} that serves as most significant part of the target address
17775 when @code{EICALL} or @code{EIJMP} instructions are used.
17777 Indirect jumps and calls on these devices are handled as follows by
17778 the compiler and are subject to some limitations:
17783 The compiler never sets @code{EIND}.
17786 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
17787 instructions or might read @code{EIND} directly in order to emulate an
17788 indirect call/jump by means of a @code{RET} instruction.
17791 The compiler assumes that @code{EIND} never changes during the startup
17792 code or during the application. In particular, @code{EIND} is not
17793 saved/restored in function or interrupt service routine
17797 For indirect calls to functions and computed goto, the linker
17798 generates @emph{stubs}. Stubs are jump pads sometimes also called
17799 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
17800 The stub contains a direct jump to the desired address.
17803 Linker relaxation must be turned on so that the linker generates
17804 the stubs correctly in all situations. See the compiler option
17805 @option{-mrelax} and the linker option @option{--relax}.
17806 There are corner cases where the linker is supposed to generate stubs
17807 but aborts without relaxation and without a helpful error message.
17810 The default linker script is arranged for code with @code{EIND = 0}.
17811 If code is supposed to work for a setup with @code{EIND != 0}, a custom
17812 linker script has to be used in order to place the sections whose
17813 name start with @code{.trampolines} into the segment where @code{EIND}
17817 The startup code from libgcc never sets @code{EIND}.
17818 Notice that startup code is a blend of code from libgcc and AVR-LibC.
17819 For the impact of AVR-LibC on @code{EIND}, see the
17820 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
17823 It is legitimate for user-specific startup code to set up @code{EIND}
17824 early, for example by means of initialization code located in
17825 section @code{.init3}. Such code runs prior to general startup code
17826 that initializes RAM and calls constructors, but after the bit
17827 of startup code from AVR-LibC that sets @code{EIND} to the segment
17828 where the vector table is located.
17830 #include <avr/io.h>
17833 __attribute__((section(".init3"),naked,used,no_instrument_function))
17834 init3_set_eind (void)
17836 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
17837 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
17842 The @code{__trampolines_start} symbol is defined in the linker script.
17845 Stubs are generated automatically by the linker if
17846 the following two conditions are met:
17849 @item The address of a label is taken by means of the @code{gs} modifier
17850 (short for @emph{generate stubs}) like so:
17852 LDI r24, lo8(gs(@var{func}))
17853 LDI r25, hi8(gs(@var{func}))
17855 @item The final location of that label is in a code segment
17856 @emph{outside} the segment where the stubs are located.
17860 The compiler emits such @code{gs} modifiers for code labels in the
17861 following situations:
17863 @item Taking address of a function or code label.
17864 @item Computed goto.
17865 @item If prologue-save function is used, see @option{-mcall-prologues}
17866 command-line option.
17867 @item Switch/case dispatch tables. If you do not want such dispatch
17868 tables you can specify the @option{-fno-jump-tables} command-line option.
17869 @item C and C++ constructors/destructors called during startup/shutdown.
17870 @item If the tools hit a @code{gs()} modifier explained above.
17874 Jumping to non-symbolic addresses like so is @emph{not} supported:
17879 /* Call function at word address 0x2 */
17880 return ((int(*)(void)) 0x2)();
17884 Instead, a stub has to be set up, i.e.@: the function has to be called
17885 through a symbol (@code{func_4} in the example):
17890 extern int func_4 (void);
17892 /* Call function at byte address 0x4 */
17897 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
17898 Alternatively, @code{func_4} can be defined in the linker script.
17901 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
17902 @cindex @code{RAMPD}
17903 @cindex @code{RAMPX}
17904 @cindex @code{RAMPY}
17905 @cindex @code{RAMPZ}
17906 Some AVR devices support memories larger than the 64@tie{}KiB range
17907 that can be accessed with 16-bit pointers. To access memory locations
17908 outside this 64@tie{}KiB range, the content of a @code{RAMP}
17909 register is used as high part of the address:
17910 The @code{X}, @code{Y}, @code{Z} address register is concatenated
17911 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
17912 register, respectively, to get a wide address. Similarly,
17913 @code{RAMPD} is used together with direct addressing.
17917 The startup code initializes the @code{RAMP} special function
17918 registers with zero.
17921 If a @ref{AVR Named Address Spaces,named address space} other than
17922 generic or @code{__flash} is used, then @code{RAMPZ} is set
17923 as needed before the operation.
17926 If the device supports RAM larger than 64@tie{}KiB and the compiler
17927 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
17928 is reset to zero after the operation.
17931 If the device comes with a specific @code{RAMP} register, the ISR
17932 prologue/epilogue saves/restores that SFR and initializes it with
17933 zero in case the ISR code might (implicitly) use it.
17936 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
17937 If you use inline assembler to read from locations outside the
17938 16-bit address range and change one of the @code{RAMP} registers,
17939 you must reset it to zero after the access.
17943 @subsubsection AVR Built-in Macros
17945 GCC defines several built-in macros so that the user code can test
17946 for the presence or absence of features. Almost any of the following
17947 built-in macros are deduced from device capabilities and thus
17948 triggered by the @option{-mmcu=} command-line option.
17950 For even more AVR-specific built-in macros see
17951 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
17956 Build-in macro that resolves to a decimal number that identifies the
17957 architecture and depends on the @option{-mmcu=@var{mcu}} option.
17958 Possible values are:
17960 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
17961 @code{4}, @code{5}, @code{51}, @code{6}
17963 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
17964 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
17969 @code{102}, @code{103}, @code{104},
17970 @code{105}, @code{106}, @code{107}
17972 for @var{mcu}=@code{avrtiny},
17973 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
17974 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
17975 If @var{mcu} specifies a device, this built-in macro is set
17976 accordingly. For example, with @option{-mmcu=atmega8} the macro is
17977 defined to @code{4}.
17979 @item __AVR_@var{Device}__
17980 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
17981 the device's name. For example, @option{-mmcu=atmega8} defines the
17982 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
17983 @code{__AVR_ATtiny261A__}, etc.
17985 The built-in macros' names follow
17986 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
17987 the device name as from the AVR user manual. The difference between
17988 @var{Device} in the built-in macro and @var{device} in
17989 @option{-mmcu=@var{device}} is that the latter is always lowercase.
17991 If @var{device} is not a device but only a core architecture like
17992 @samp{avr51}, this macro is not defined.
17994 @item __AVR_DEVICE_NAME__
17995 Setting @option{-mmcu=@var{device}} defines this built-in macro to
17996 the device's name. For example, with @option{-mmcu=atmega8} the macro
17997 is defined to @code{atmega8}.
17999 If @var{device} is not a device but only a core architecture like
18000 @samp{avr51}, this macro is not defined.
18002 @item __AVR_XMEGA__
18003 The device / architecture belongs to the XMEGA family of devices.
18005 @item __AVR_HAVE_ELPM__
18006 The device has the @code{ELPM} instruction.
18008 @item __AVR_HAVE_ELPMX__
18009 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
18010 R@var{n},Z+} instructions.
18012 @item __AVR_HAVE_MOVW__
18013 The device has the @code{MOVW} instruction to perform 16-bit
18014 register-register moves.
18016 @item __AVR_HAVE_LPMX__
18017 The device has the @code{LPM R@var{n},Z} and
18018 @code{LPM R@var{n},Z+} instructions.
18020 @item __AVR_HAVE_MUL__
18021 The device has a hardware multiplier.
18023 @item __AVR_HAVE_JMP_CALL__
18024 The device has the @code{JMP} and @code{CALL} instructions.
18025 This is the case for devices with more than 8@tie{}KiB of program
18028 @item __AVR_HAVE_EIJMP_EICALL__
18029 @itemx __AVR_3_BYTE_PC__
18030 The device has the @code{EIJMP} and @code{EICALL} instructions.
18031 This is the case for devices with more than 128@tie{}KiB of program memory.
18032 This also means that the program counter
18033 (PC) is 3@tie{}bytes wide.
18035 @item __AVR_2_BYTE_PC__
18036 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
18037 with up to 128@tie{}KiB of program memory.
18039 @item __AVR_HAVE_8BIT_SP__
18040 @itemx __AVR_HAVE_16BIT_SP__
18041 The stack pointer (SP) register is treated as 8-bit respectively
18042 16-bit register by the compiler.
18043 The definition of these macros is affected by @option{-mtiny-stack}.
18045 @item __AVR_HAVE_SPH__
18047 The device has the SPH (high part of stack pointer) special function
18048 register or has an 8-bit stack pointer, respectively.
18049 The definition of these macros is affected by @option{-mmcu=} and
18050 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
18053 @item __AVR_HAVE_RAMPD__
18054 @itemx __AVR_HAVE_RAMPX__
18055 @itemx __AVR_HAVE_RAMPY__
18056 @itemx __AVR_HAVE_RAMPZ__
18057 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
18058 @code{RAMPZ} special function register, respectively.
18060 @item __NO_INTERRUPTS__
18061 This macro reflects the @option{-mno-interrupts} command-line option.
18063 @item __AVR_ERRATA_SKIP__
18064 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
18065 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18066 instructions because of a hardware erratum. Skip instructions are
18067 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
18068 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
18071 @item __AVR_ISA_RMW__
18072 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
18074 @item __AVR_SFR_OFFSET__=@var{offset}
18075 Instructions that can address I/O special function registers directly
18076 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
18077 address as if addressed by an instruction to access RAM like @code{LD}
18078 or @code{STS}. This offset depends on the device architecture and has
18079 to be subtracted from the RAM address in order to get the
18080 respective I/O@tie{}address.
18082 @item __AVR_SHORT_CALLS__
18083 The @option{-mshort-calls} command line option is set.
18085 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
18086 Some devices support reading from flash memory by means of @code{LD*}
18087 instructions. The flash memory is seen in the data address space
18088 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
18089 is not defined, this feature is not available. If defined,
18090 the address space is linear and there is no need to put
18091 @code{.rodata} into RAM. This is handled by the default linker
18092 description file, and is currently available for
18093 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
18094 there is no need to use address spaces like @code{__flash} or
18095 features like attribute @code{progmem} and @code{pgm_read_*}.
18097 @item __WITH_AVRLIBC__
18098 The compiler is configured to be used together with AVR-Libc.
18099 See the @option{--with-avrlibc} configure option.
18103 @node Blackfin Options
18104 @subsection Blackfin Options
18105 @cindex Blackfin Options
18108 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
18110 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
18111 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
18112 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
18113 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
18114 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
18115 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
18116 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
18117 @samp{bf561}, @samp{bf592}.
18119 The optional @var{sirevision} specifies the silicon revision of the target
18120 Blackfin processor. Any workarounds available for the targeted silicon revision
18121 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
18122 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
18123 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
18124 hexadecimal digits representing the major and minor numbers in the silicon
18125 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
18126 is not defined. If @var{sirevision} is @samp{any}, the
18127 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
18128 If this optional @var{sirevision} is not used, GCC assumes the latest known
18129 silicon revision of the targeted Blackfin processor.
18131 GCC defines a preprocessor macro for the specified @var{cpu}.
18132 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
18133 provided by libgloss to be linked in if @option{-msim} is not given.
18135 Without this option, @samp{bf532} is used as the processor by default.
18137 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
18138 only the preprocessor macro is defined.
18142 Specifies that the program will be run on the simulator. This causes
18143 the simulator BSP provided by libgloss to be linked in. This option
18144 has effect only for @samp{bfin-elf} toolchain.
18145 Certain other options, such as @option{-mid-shared-library} and
18146 @option{-mfdpic}, imply @option{-msim}.
18148 @item -momit-leaf-frame-pointer
18149 @opindex momit-leaf-frame-pointer
18150 Don't keep the frame pointer in a register for leaf functions. This
18151 avoids the instructions to save, set up and restore frame pointers and
18152 makes an extra register available in leaf functions.
18154 @item -mspecld-anomaly
18155 @opindex mspecld-anomaly
18156 When enabled, the compiler ensures that the generated code does not
18157 contain speculative loads after jump instructions. If this option is used,
18158 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
18160 @item -mno-specld-anomaly
18161 @opindex mno-specld-anomaly
18162 @opindex mspecld-anomaly
18163 Don't generate extra code to prevent speculative loads from occurring.
18165 @item -mcsync-anomaly
18166 @opindex mcsync-anomaly
18167 When enabled, the compiler ensures that the generated code does not
18168 contain CSYNC or SSYNC instructions too soon after conditional branches.
18169 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
18171 @item -mno-csync-anomaly
18172 @opindex mno-csync-anomaly
18173 @opindex mcsync-anomaly
18174 Don't generate extra code to prevent CSYNC or SSYNC instructions from
18175 occurring too soon after a conditional branch.
18179 When enabled, the compiler is free to take advantage of the knowledge that
18180 the entire program fits into the low 64k of memory.
18183 @opindex mno-low64k
18184 Assume that the program is arbitrarily large. This is the default.
18186 @item -mstack-check-l1
18187 @opindex mstack-check-l1
18188 Do stack checking using information placed into L1 scratchpad memory by the
18191 @item -mid-shared-library
18192 @opindex mid-shared-library
18193 Generate code that supports shared libraries via the library ID method.
18194 This allows for execute in place and shared libraries in an environment
18195 without virtual memory management. This option implies @option{-fPIC}.
18196 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18198 @item -mno-id-shared-library
18199 @opindex mno-id-shared-library
18200 @opindex mid-shared-library
18201 Generate code that doesn't assume ID-based shared libraries are being used.
18202 This is the default.
18204 @item -mleaf-id-shared-library
18205 @opindex mleaf-id-shared-library
18206 Generate code that supports shared libraries via the library ID method,
18207 but assumes that this library or executable won't link against any other
18208 ID shared libraries. That allows the compiler to use faster code for jumps
18211 @item -mno-leaf-id-shared-library
18212 @opindex mno-leaf-id-shared-library
18213 @opindex mleaf-id-shared-library
18214 Do not assume that the code being compiled won't link against any ID shared
18215 libraries. Slower code is generated for jump and call insns.
18217 @item -mshared-library-id=n
18218 @opindex mshared-library-id
18219 Specifies the identification number of the ID-based shared library being
18220 compiled. Specifying a value of 0 generates more compact code; specifying
18221 other values forces the allocation of that number to the current
18222 library but is no more space- or time-efficient than omitting this option.
18226 Generate code that allows the data segment to be located in a different
18227 area of memory from the text segment. This allows for execute in place in
18228 an environment without virtual memory management by eliminating relocations
18229 against the text section.
18231 @item -mno-sep-data
18232 @opindex mno-sep-data
18234 Generate code that assumes that the data segment follows the text segment.
18235 This is the default.
18238 @itemx -mno-long-calls
18239 @opindex mlong-calls
18240 @opindex mno-long-calls
18241 Tells the compiler to perform function calls by first loading the
18242 address of the function into a register and then performing a subroutine
18243 call on this register. This switch is needed if the target function
18244 lies outside of the 24-bit addressing range of the offset-based
18245 version of subroutine call instruction.
18247 This feature is not enabled by default. Specifying
18248 @option{-mno-long-calls} restores the default behavior. Note these
18249 switches have no effect on how the compiler generates code to handle
18250 function calls via function pointers.
18254 Link with the fast floating-point library. This library relaxes some of
18255 the IEEE floating-point standard's rules for checking inputs against
18256 Not-a-Number (NAN), in the interest of performance.
18259 @opindex minline-plt
18260 Enable inlining of PLT entries in function calls to functions that are
18261 not known to bind locally. It has no effect without @option{-mfdpic}.
18264 @opindex mmulticore
18265 Build a standalone application for multicore Blackfin processors.
18266 This option causes proper start files and link scripts supporting
18267 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
18268 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
18270 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
18271 selects the one-application-per-core programming model. Without
18272 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
18273 programming model is used. In this model, the main function of Core B
18274 should be named as @code{coreb_main}.
18276 If this option is not used, the single-core application programming
18281 Build a standalone application for Core A of BF561 when using
18282 the one-application-per-core programming model. Proper start files
18283 and link scripts are used to support Core A, and the macro
18284 @code{__BFIN_COREA} is defined.
18285 This option can only be used in conjunction with @option{-mmulticore}.
18289 Build a standalone application for Core B of BF561 when using
18290 the one-application-per-core programming model. Proper start files
18291 and link scripts are used to support Core B, and the macro
18292 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
18293 should be used instead of @code{main}.
18294 This option can only be used in conjunction with @option{-mmulticore}.
18298 Build a standalone application for SDRAM. Proper start files and
18299 link scripts are used to put the application into SDRAM, and the macro
18300 @code{__BFIN_SDRAM} is defined.
18301 The loader should initialize SDRAM before loading the application.
18305 Assume that ICPLBs are enabled at run time. This has an effect on certain
18306 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
18307 are enabled; for standalone applications the default is off.
18311 @subsection C6X Options
18312 @cindex C6X Options
18315 @item -march=@var{name}
18317 This specifies the name of the target architecture. GCC uses this
18318 name to determine what kind of instructions it can emit when generating
18319 assembly code. Permissible names are: @samp{c62x},
18320 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
18323 @opindex mbig-endian
18324 Generate code for a big-endian target.
18326 @item -mlittle-endian
18327 @opindex mlittle-endian
18328 Generate code for a little-endian target. This is the default.
18332 Choose startup files and linker script suitable for the simulator.
18334 @item -msdata=default
18335 @opindex msdata=default
18336 Put small global and static data in the @code{.neardata} section,
18337 which is pointed to by register @code{B14}. Put small uninitialized
18338 global and static data in the @code{.bss} section, which is adjacent
18339 to the @code{.neardata} section. Put small read-only data into the
18340 @code{.rodata} section. The corresponding sections used for large
18341 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
18344 @opindex msdata=all
18345 Put all data, not just small objects, into the sections reserved for
18346 small data, and use addressing relative to the @code{B14} register to
18350 @opindex msdata=none
18351 Make no use of the sections reserved for small data, and use absolute
18352 addresses to access all data. Put all initialized global and static
18353 data in the @code{.fardata} section, and all uninitialized data in the
18354 @code{.far} section. Put all constant data into the @code{.const}
18359 @subsection CRIS Options
18360 @cindex CRIS Options
18362 These options are defined specifically for the CRIS ports.
18365 @item -march=@var{architecture-type}
18366 @itemx -mcpu=@var{architecture-type}
18369 Generate code for the specified architecture. The choices for
18370 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
18371 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
18372 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
18375 @item -mtune=@var{architecture-type}
18377 Tune to @var{architecture-type} everything applicable about the generated
18378 code, except for the ABI and the set of available instructions. The
18379 choices for @var{architecture-type} are the same as for
18380 @option{-march=@var{architecture-type}}.
18382 @item -mmax-stack-frame=@var{n}
18383 @opindex mmax-stack-frame
18384 Warn when the stack frame of a function exceeds @var{n} bytes.
18390 The options @option{-metrax4} and @option{-metrax100} are synonyms for
18391 @option{-march=v3} and @option{-march=v8} respectively.
18393 @item -mmul-bug-workaround
18394 @itemx -mno-mul-bug-workaround
18395 @opindex mmul-bug-workaround
18396 @opindex mno-mul-bug-workaround
18397 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
18398 models where it applies. This option is active by default.
18402 Enable CRIS-specific verbose debug-related information in the assembly
18403 code. This option also has the effect of turning off the @samp{#NO_APP}
18404 formatted-code indicator to the assembler at the beginning of the
18409 Do not use condition-code results from previous instruction; always emit
18410 compare and test instructions before use of condition codes.
18412 @item -mno-side-effects
18413 @opindex mno-side-effects
18414 @opindex mside-effects
18415 Do not emit instructions with side effects in addressing modes other than
18418 @item -mstack-align
18419 @itemx -mno-stack-align
18420 @itemx -mdata-align
18421 @itemx -mno-data-align
18422 @itemx -mconst-align
18423 @itemx -mno-const-align
18424 @opindex mstack-align
18425 @opindex mno-stack-align
18426 @opindex mdata-align
18427 @opindex mno-data-align
18428 @opindex mconst-align
18429 @opindex mno-const-align
18430 These options (@samp{no-} options) arrange (eliminate arrangements) for the
18431 stack frame, individual data and constants to be aligned for the maximum
18432 single data access size for the chosen CPU model. The default is to
18433 arrange for 32-bit alignment. ABI details such as structure layout are
18434 not affected by these options.
18442 Similar to the stack- data- and const-align options above, these options
18443 arrange for stack frame, writable data and constants to all be 32-bit,
18444 16-bit or 8-bit aligned. The default is 32-bit alignment.
18446 @item -mno-prologue-epilogue
18447 @itemx -mprologue-epilogue
18448 @opindex mno-prologue-epilogue
18449 @opindex mprologue-epilogue
18450 With @option{-mno-prologue-epilogue}, the normal function prologue and
18451 epilogue which set up the stack frame are omitted and no return
18452 instructions or return sequences are generated in the code. Use this
18453 option only together with visual inspection of the compiled code: no
18454 warnings or errors are generated when call-saved registers must be saved,
18455 or storage for local variables needs to be allocated.
18459 @opindex mno-gotplt
18461 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
18462 instruction sequences that load addresses for functions from the PLT part
18463 of the GOT rather than (traditional on other architectures) calls to the
18464 PLT@. The default is @option{-mgotplt}.
18468 Legacy no-op option only recognized with the cris-axis-elf and
18469 cris-axis-linux-gnu targets.
18473 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
18477 This option, recognized for the cris-axis-elf, arranges
18478 to link with input-output functions from a simulator library. Code,
18479 initialized data and zero-initialized data are allocated consecutively.
18483 Like @option{-sim}, but pass linker options to locate initialized data at
18484 0x40000000 and zero-initialized data at 0x80000000.
18488 @subsection CR16 Options
18489 @cindex CR16 Options
18491 These options are defined specifically for the CR16 ports.
18497 Enable the use of multiply-accumulate instructions. Disabled by default.
18501 @opindex mcr16cplus
18503 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
18508 Links the library libsim.a which is in compatible with simulator. Applicable
18509 to ELF compiler only.
18513 Choose integer type as 32-bit wide.
18517 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
18519 @item -mdata-model=@var{model}
18520 @opindex mdata-model
18521 Choose a data model. The choices for @var{model} are @samp{near},
18522 @samp{far} or @samp{medium}. @samp{medium} is default.
18523 However, @samp{far} is not valid with @option{-mcr16c}, as the
18524 CR16C architecture does not support the far data model.
18527 @node C-SKY Options
18528 @subsection C-SKY Options
18529 @cindex C-SKY Options
18531 GCC supports these options when compiling for C-SKY V2 processors.
18535 @item -march=@var{arch}
18537 Specify the C-SKY target architecture. Valid values for @var{arch} are:
18538 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
18539 The default is @samp{ck810}.
18541 @item -mcpu=@var{cpu}
18543 Specify the C-SKY target processor. Valid values for @var{cpu} are:
18544 @samp{ck801}, @samp{ck801t},
18545 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
18546 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
18547 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
18548 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
18549 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
18550 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
18551 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
18552 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
18553 @samp{ck803eftr1}, @samp{ck803efhtr1},
18554 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
18555 @samp{ck803sef}, @samp{ck803seft},
18556 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
18557 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
18558 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
18559 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
18562 @opindex mbig-endian
18565 @itemx -mlittle-endian
18566 @opindex mlittle-endian
18570 Select big- or little-endian code. The default is little-endian.
18573 @opindex mhard-float
18574 @itemx -msoft-float
18575 @opindex msoft-float
18577 Select hardware or software floating-point implementations.
18578 The default is soft float.
18580 @item -mdouble-float
18581 @itemx -mno-double-float
18582 @opindex mdouble-float
18583 When @option{-mhard-float} is in effect, enable generation of
18584 double-precision float instructions. This is the default except
18585 when compiling for CK803.
18590 When @option{-mhard-float} is in effect, enable generation of
18591 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
18592 This is the default except when compiling for CK803.
18594 @item -mfpu=@var{fpu}
18596 Select the floating-point processor. This option can only be used with
18597 @option{-mhard-float}.
18598 Values for @var{fpu} are
18599 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
18600 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
18601 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
18606 Enable the extended @code{lrw} instruction. This option defaults to on
18607 for CK801 and off otherwise.
18612 Enable interrupt stack instructions; the default is off.
18614 The @option{-mistack} option is required to handle the
18615 @code{interrupt} and @code{isr} function attributes
18616 (@pxref{C-SKY Function Attributes}).
18620 Enable multiprocessor instructions; the default is off.
18624 Enable coprocessor instructions; the default is off.
18628 Enable coprocessor instructions; the default is off.
18632 Enable C-SKY security instructions; the default is off.
18636 Enable C-SKY trust instructions; the default is off.
18644 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
18645 All of these options default to off.
18650 Generate divide instructions. Default is off.
18655 Generate code for Smart Mode, using only registers numbered 0-7 to allow
18656 use of 16-bit instructions. This option is ignored for CK801 where this
18657 is the required behavior, and it defaults to on for CK802.
18658 For other targets, the default is off.
18660 @item -mhigh-registers
18661 @itemx -mno-high-registers
18662 @opindex mhigh-registers
18663 Generate code using the high registers numbered 16-31. This option
18664 is not supported on CK801, CK802, or CK803, and is enabled by default
18665 for other processors.
18670 Generate code using global anchor symbol addresses.
18673 @itemx -mno-pushpop
18675 Generate code using @code{push} and @code{pop} instructions. This option
18678 @item -mmultiple-stld
18680 @itemx -mno-multiple-stld
18682 @opindex mmultiple-stld
18683 Generate code using @code{stm} and @code{ldm} instructions. This option
18684 isn't supported on CK801 but is enabled by default on other processors.
18687 @itemx -mno-constpool
18688 @opindex mconstpool
18689 Create constant pools in the compiler instead of deferring it to the
18690 assembler. This option is the default and required for correct code
18691 generation on CK801 and CK802, and is optional on other processors.
18694 @item -mno-stack-size
18695 @opindex mstack-size
18696 Emit @code{.stack_size} directives for each function in the assembly
18697 output. This option defaults to off.
18702 Generate code for the C-SKY compiler runtime instead of libgcc. This
18703 option defaults to off.
18705 @item -mbranch-cost=@var{n}
18706 @opindex mbranch-cost=
18707 Set the branch costs to roughly @code{n} instructions. The default is 1.
18709 @item -msched-prolog
18710 @itemx -mno-sched-prolog
18711 @opindex msched-prolog
18712 Permit scheduling of function prologue and epilogue sequences. Using
18713 this option can result in code that is not compliant with the C-SKY V2 ABI
18714 prologue requirements and that cannot be debugged or backtraced.
18715 It is disabled by default.
18719 @node Darwin Options
18720 @subsection Darwin Options
18721 @cindex Darwin options
18723 These options are defined for all architectures running the Darwin operating
18726 FSF GCC on Darwin does not create ``fat'' object files; it creates
18727 an object file for the single architecture that GCC was built to
18728 target. Apple's GCC on Darwin does create ``fat'' files if multiple
18729 @option{-arch} options are used; it does so by running the compiler or
18730 linker multiple times and joining the results together with
18733 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
18734 @samp{i686}) is determined by the flags that specify the ISA
18735 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
18736 @option{-force_cpusubtype_ALL} option can be used to override this.
18738 The Darwin tools vary in their behavior when presented with an ISA
18739 mismatch. The assembler, @file{as}, only permits instructions to
18740 be used that are valid for the subtype of the file it is generating,
18741 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
18742 The linker for shared libraries, @file{/usr/bin/libtool}, fails
18743 and prints an error if asked to create a shared library with a less
18744 restrictive subtype than its input files (for instance, trying to put
18745 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
18746 for executables, @command{ld}, quietly gives the executable the most
18747 restrictive subtype of any of its input files.
18752 Add the framework directory @var{dir} to the head of the list of
18753 directories to be searched for header files. These directories are
18754 interleaved with those specified by @option{-I} options and are
18755 scanned in a left-to-right order.
18757 A framework directory is a directory with frameworks in it. A
18758 framework is a directory with a @file{Headers} and/or
18759 @file{PrivateHeaders} directory contained directly in it that ends
18760 in @file{.framework}. The name of a framework is the name of this
18761 directory excluding the @file{.framework}. Headers associated with
18762 the framework are found in one of those two directories, with
18763 @file{Headers} being searched first. A subframework is a framework
18764 directory that is in a framework's @file{Frameworks} directory.
18765 Includes of subframework headers can only appear in a header of a
18766 framework that contains the subframework, or in a sibling subframework
18767 header. Two subframeworks are siblings if they occur in the same
18768 framework. A subframework should not have the same name as a
18769 framework; a warning is issued if this is violated. Currently a
18770 subframework cannot have subframeworks; in the future, the mechanism
18771 may be extended to support this. The standard frameworks can be found
18772 in @file{/System/Library/Frameworks} and
18773 @file{/Library/Frameworks}. An example include looks like
18774 @code{#include <Framework/header.h>}, where @file{Framework} denotes
18775 the name of the framework and @file{header.h} is found in the
18776 @file{PrivateHeaders} or @file{Headers} directory.
18778 @item -iframework@var{dir}
18779 @opindex iframework
18780 Like @option{-F} except the directory is a treated as a system
18781 directory. The main difference between this @option{-iframework} and
18782 @option{-F} is that with @option{-iframework} the compiler does not
18783 warn about constructs contained within header files found via
18784 @var{dir}. This option is valid only for the C family of languages.
18788 Emit debugging information for symbols that are used. For stabs
18789 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
18790 This is by default ON@.
18794 Emit debugging information for all symbols and types.
18796 @item -mmacosx-version-min=@var{version}
18797 The earliest version of MacOS X that this executable will run on
18798 is @var{version}. Typical values of @var{version} include @code{10.1},
18799 @code{10.2}, and @code{10.3.9}.
18801 If the compiler was built to use the system's headers by default,
18802 then the default for this option is the system version on which the
18803 compiler is running, otherwise the default is to make choices that
18804 are compatible with as many systems and code bases as possible.
18808 Enable kernel development mode. The @option{-mkernel} option sets
18809 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
18810 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
18811 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
18812 applicable. This mode also sets @option{-mno-altivec},
18813 @option{-msoft-float}, @option{-fno-builtin} and
18814 @option{-mlong-branch} for PowerPC targets.
18816 @item -mone-byte-bool
18817 @opindex mone-byte-bool
18818 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
18819 By default @code{sizeof(bool)} is @code{4} when compiling for
18820 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
18821 option has no effect on x86.
18823 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
18824 to generate code that is not binary compatible with code generated
18825 without that switch. Using this switch may require recompiling all
18826 other modules in a program, including system libraries. Use this
18827 switch to conform to a non-default data model.
18829 @item -mfix-and-continue
18830 @itemx -ffix-and-continue
18831 @itemx -findirect-data
18832 @opindex mfix-and-continue
18833 @opindex ffix-and-continue
18834 @opindex findirect-data
18835 Generate code suitable for fast turnaround development, such as to
18836 allow GDB to dynamically load @file{.o} files into already-running
18837 programs. @option{-findirect-data} and @option{-ffix-and-continue}
18838 are provided for backwards compatibility.
18842 Loads all members of static archive libraries.
18843 See man ld(1) for more information.
18845 @item -arch_errors_fatal
18846 @opindex arch_errors_fatal
18847 Cause the errors having to do with files that have the wrong architecture
18850 @item -bind_at_load
18851 @opindex bind_at_load
18852 Causes the output file to be marked such that the dynamic linker will
18853 bind all undefined references when the file is loaded or launched.
18857 Produce a Mach-o bundle format file.
18858 See man ld(1) for more information.
18860 @item -bundle_loader @var{executable}
18861 @opindex bundle_loader
18862 This option specifies the @var{executable} that will load the build
18863 output file being linked. See man ld(1) for more information.
18866 @opindex dynamiclib
18867 When passed this option, GCC produces a dynamic library instead of
18868 an executable when linking, using the Darwin @file{libtool} command.
18870 @item -force_cpusubtype_ALL
18871 @opindex force_cpusubtype_ALL
18872 This causes GCC's output file to have the @samp{ALL} subtype, instead of
18873 one controlled by the @option{-mcpu} or @option{-march} option.
18875 @item -allowable_client @var{client_name}
18876 @itemx -client_name
18877 @itemx -compatibility_version
18878 @itemx -current_version
18880 @itemx -dependency-file
18882 @itemx -dylinker_install_name
18884 @itemx -exported_symbols_list
18887 @itemx -flat_namespace
18888 @itemx -force_flat_namespace
18889 @itemx -headerpad_max_install_names
18892 @itemx -install_name
18893 @itemx -keep_private_externs
18894 @itemx -multi_module
18895 @itemx -multiply_defined
18896 @itemx -multiply_defined_unused
18899 @itemx -no_dead_strip_inits_and_terms
18900 @itemx -nofixprebinding
18901 @itemx -nomultidefs
18903 @itemx -noseglinkedit
18904 @itemx -pagezero_size
18906 @itemx -prebind_all_twolevel_modules
18907 @itemx -private_bundle
18909 @itemx -read_only_relocs
18911 @itemx -sectobjectsymbols
18915 @itemx -sectobjectsymbols
18918 @itemx -segs_read_only_addr
18920 @itemx -segs_read_write_addr
18921 @itemx -seg_addr_table
18922 @itemx -seg_addr_table_filename
18923 @itemx -seglinkedit
18925 @itemx -segs_read_only_addr
18926 @itemx -segs_read_write_addr
18927 @itemx -single_module
18929 @itemx -sub_library
18931 @itemx -sub_umbrella
18932 @itemx -twolevel_namespace
18935 @itemx -unexported_symbols_list
18936 @itemx -weak_reference_mismatches
18937 @itemx -whatsloaded
18938 @opindex allowable_client
18939 @opindex client_name
18940 @opindex compatibility_version
18941 @opindex current_version
18942 @opindex dead_strip
18943 @opindex dependency-file
18944 @opindex dylib_file
18945 @opindex dylinker_install_name
18947 @opindex exported_symbols_list
18949 @opindex flat_namespace
18950 @opindex force_flat_namespace
18951 @opindex headerpad_max_install_names
18952 @opindex image_base
18954 @opindex install_name
18955 @opindex keep_private_externs
18956 @opindex multi_module
18957 @opindex multiply_defined
18958 @opindex multiply_defined_unused
18959 @opindex noall_load
18960 @opindex no_dead_strip_inits_and_terms
18961 @opindex nofixprebinding
18962 @opindex nomultidefs
18964 @opindex noseglinkedit
18965 @opindex pagezero_size
18967 @opindex prebind_all_twolevel_modules
18968 @opindex private_bundle
18969 @opindex read_only_relocs
18971 @opindex sectobjectsymbols
18974 @opindex sectcreate
18975 @opindex sectobjectsymbols
18978 @opindex segs_read_only_addr
18979 @opindex segs_read_write_addr
18980 @opindex seg_addr_table
18981 @opindex seg_addr_table_filename
18982 @opindex seglinkedit
18984 @opindex segs_read_only_addr
18985 @opindex segs_read_write_addr
18986 @opindex single_module
18988 @opindex sub_library
18989 @opindex sub_umbrella
18990 @opindex twolevel_namespace
18993 @opindex unexported_symbols_list
18994 @opindex weak_reference_mismatches
18995 @opindex whatsloaded
18996 These options are passed to the Darwin linker. The Darwin linker man page
18997 describes them in detail.
19000 @node DEC Alpha Options
19001 @subsection DEC Alpha Options
19003 These @samp{-m} options are defined for the DEC Alpha implementations:
19006 @item -mno-soft-float
19007 @itemx -msoft-float
19008 @opindex mno-soft-float
19009 @opindex msoft-float
19010 Use (do not use) the hardware floating-point instructions for
19011 floating-point operations. When @option{-msoft-float} is specified,
19012 functions in @file{libgcc.a} are used to perform floating-point
19013 operations. Unless they are replaced by routines that emulate the
19014 floating-point operations, or compiled in such a way as to call such
19015 emulations routines, these routines issue floating-point
19016 operations. If you are compiling for an Alpha without floating-point
19017 operations, you must ensure that the library is built so as not to call
19020 Note that Alpha implementations without floating-point operations are
19021 required to have floating-point registers.
19024 @itemx -mno-fp-regs
19026 @opindex mno-fp-regs
19027 Generate code that uses (does not use) the floating-point register set.
19028 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
19029 register set is not used, floating-point operands are passed in integer
19030 registers as if they were integers and floating-point results are passed
19031 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
19032 so any function with a floating-point argument or return value called by code
19033 compiled with @option{-mno-fp-regs} must also be compiled with that
19036 A typical use of this option is building a kernel that does not use,
19037 and hence need not save and restore, any floating-point registers.
19041 The Alpha architecture implements floating-point hardware optimized for
19042 maximum performance. It is mostly compliant with the IEEE floating-point
19043 standard. However, for full compliance, software assistance is
19044 required. This option generates code fully IEEE-compliant code
19045 @emph{except} that the @var{inexact-flag} is not maintained (see below).
19046 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
19047 defined during compilation. The resulting code is less efficient but is
19048 able to correctly support denormalized numbers and exceptional IEEE
19049 values such as not-a-number and plus/minus infinity. Other Alpha
19050 compilers call this option @option{-ieee_with_no_inexact}.
19052 @item -mieee-with-inexact
19053 @opindex mieee-with-inexact
19054 This is like @option{-mieee} except the generated code also maintains
19055 the IEEE @var{inexact-flag}. Turning on this option causes the
19056 generated code to implement fully-compliant IEEE math. In addition to
19057 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
19058 macro. On some Alpha implementations the resulting code may execute
19059 significantly slower than the code generated by default. Since there is
19060 very little code that depends on the @var{inexact-flag}, you should
19061 normally not specify this option. Other Alpha compilers call this
19062 option @option{-ieee_with_inexact}.
19064 @item -mfp-trap-mode=@var{trap-mode}
19065 @opindex mfp-trap-mode
19066 This option controls what floating-point related traps are enabled.
19067 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
19068 The trap mode can be set to one of four values:
19072 This is the default (normal) setting. The only traps that are enabled
19073 are the ones that cannot be disabled in software (e.g., division by zero
19077 In addition to the traps enabled by @samp{n}, underflow traps are enabled
19081 Like @samp{u}, but the instructions are marked to be safe for software
19082 completion (see Alpha architecture manual for details).
19085 Like @samp{su}, but inexact traps are enabled as well.
19088 @item -mfp-rounding-mode=@var{rounding-mode}
19089 @opindex mfp-rounding-mode
19090 Selects the IEEE rounding mode. Other Alpha compilers call this option
19091 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
19096 Normal IEEE rounding mode. Floating-point numbers are rounded towards
19097 the nearest machine number or towards the even machine number in case
19101 Round towards minus infinity.
19104 Chopped rounding mode. Floating-point numbers are rounded towards zero.
19107 Dynamic rounding mode. A field in the floating-point control register
19108 (@var{fpcr}, see Alpha architecture reference manual) controls the
19109 rounding mode in effect. The C library initializes this register for
19110 rounding towards plus infinity. Thus, unless your program modifies the
19111 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
19114 @item -mtrap-precision=@var{trap-precision}
19115 @opindex mtrap-precision
19116 In the Alpha architecture, floating-point traps are imprecise. This
19117 means without software assistance it is impossible to recover from a
19118 floating trap and program execution normally needs to be terminated.
19119 GCC can generate code that can assist operating system trap handlers
19120 in determining the exact location that caused a floating-point trap.
19121 Depending on the requirements of an application, different levels of
19122 precisions can be selected:
19126 Program precision. This option is the default and means a trap handler
19127 can only identify which program caused a floating-point exception.
19130 Function precision. The trap handler can determine the function that
19131 caused a floating-point exception.
19134 Instruction precision. The trap handler can determine the exact
19135 instruction that caused a floating-point exception.
19138 Other Alpha compilers provide the equivalent options called
19139 @option{-scope_safe} and @option{-resumption_safe}.
19141 @item -mieee-conformant
19142 @opindex mieee-conformant
19143 This option marks the generated code as IEEE conformant. You must not
19144 use this option unless you also specify @option{-mtrap-precision=i} and either
19145 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
19146 is to emit the line @samp{.eflag 48} in the function prologue of the
19147 generated assembly file.
19149 @item -mbuild-constants
19150 @opindex mbuild-constants
19151 Normally GCC examines a 32- or 64-bit integer constant to
19152 see if it can construct it from smaller constants in two or three
19153 instructions. If it cannot, it outputs the constant as a literal and
19154 generates code to load it from the data segment at run time.
19156 Use this option to require GCC to construct @emph{all} integer constants
19157 using code, even if it takes more instructions (the maximum is six).
19159 You typically use this option to build a shared library dynamic
19160 loader. Itself a shared library, it must relocate itself in memory
19161 before it can find the variables and constants in its own data segment.
19179 Indicate whether GCC should generate code to use the optional BWX,
19180 CIX, FIX and MAX instruction sets. The default is to use the instruction
19181 sets supported by the CPU type specified via @option{-mcpu=} option or that
19182 of the CPU on which GCC was built if none is specified.
19185 @itemx -mfloat-ieee
19186 @opindex mfloat-vax
19187 @opindex mfloat-ieee
19188 Generate code that uses (does not use) VAX F and G floating-point
19189 arithmetic instead of IEEE single and double precision.
19191 @item -mexplicit-relocs
19192 @itemx -mno-explicit-relocs
19193 @opindex mexplicit-relocs
19194 @opindex mno-explicit-relocs
19195 Older Alpha assemblers provided no way to generate symbol relocations
19196 except via assembler macros. Use of these macros does not allow
19197 optimal instruction scheduling. GNU binutils as of version 2.12
19198 supports a new syntax that allows the compiler to explicitly mark
19199 which relocations should apply to which instructions. This option
19200 is mostly useful for debugging, as GCC detects the capabilities of
19201 the assembler when it is built and sets the default accordingly.
19204 @itemx -mlarge-data
19205 @opindex msmall-data
19206 @opindex mlarge-data
19207 When @option{-mexplicit-relocs} is in effect, static data is
19208 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
19209 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
19210 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
19211 16-bit relocations off of the @code{$gp} register. This limits the
19212 size of the small data area to 64KB, but allows the variables to be
19213 directly accessed via a single instruction.
19215 The default is @option{-mlarge-data}. With this option the data area
19216 is limited to just below 2GB@. Programs that require more than 2GB of
19217 data must use @code{malloc} or @code{mmap} to allocate the data in the
19218 heap instead of in the program's data segment.
19220 When generating code for shared libraries, @option{-fpic} implies
19221 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
19224 @itemx -mlarge-text
19225 @opindex msmall-text
19226 @opindex mlarge-text
19227 When @option{-msmall-text} is used, the compiler assumes that the
19228 code of the entire program (or shared library) fits in 4MB, and is
19229 thus reachable with a branch instruction. When @option{-msmall-data}
19230 is used, the compiler can assume that all local symbols share the
19231 same @code{$gp} value, and thus reduce the number of instructions
19232 required for a function call from 4 to 1.
19234 The default is @option{-mlarge-text}.
19236 @item -mcpu=@var{cpu_type}
19238 Set the instruction set and instruction scheduling parameters for
19239 machine type @var{cpu_type}. You can specify either the @samp{EV}
19240 style name or the corresponding chip number. GCC supports scheduling
19241 parameters for the EV4, EV5 and EV6 family of processors and
19242 chooses the default values for the instruction set from the processor
19243 you specify. If you do not specify a processor type, GCC defaults
19244 to the processor on which the compiler was built.
19246 Supported values for @var{cpu_type} are
19252 Schedules as an EV4 and has no instruction set extensions.
19256 Schedules as an EV5 and has no instruction set extensions.
19260 Schedules as an EV5 and supports the BWX extension.
19265 Schedules as an EV5 and supports the BWX and MAX extensions.
19269 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
19273 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
19276 Native toolchains also support the value @samp{native},
19277 which selects the best architecture option for the host processor.
19278 @option{-mcpu=native} has no effect if GCC does not recognize
19281 @item -mtune=@var{cpu_type}
19283 Set only the instruction scheduling parameters for machine type
19284 @var{cpu_type}. The instruction set is not changed.
19286 Native toolchains also support the value @samp{native},
19287 which selects the best architecture option for the host processor.
19288 @option{-mtune=native} has no effect if GCC does not recognize
19291 @item -mmemory-latency=@var{time}
19292 @opindex mmemory-latency
19293 Sets the latency the scheduler should assume for typical memory
19294 references as seen by the application. This number is highly
19295 dependent on the memory access patterns used by the application
19296 and the size of the external cache on the machine.
19298 Valid options for @var{time} are
19302 A decimal number representing clock cycles.
19308 The compiler contains estimates of the number of clock cycles for
19309 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19310 (also called Dcache, Scache, and Bcache), as well as to main memory.
19311 Note that L3 is only valid for EV5.
19317 @subsection FR30 Options
19318 @cindex FR30 Options
19320 These options are defined specifically for the FR30 port.
19324 @item -msmall-model
19325 @opindex msmall-model
19326 Use the small address space model. This can produce smaller code, but
19327 it does assume that all symbolic values and addresses fit into a
19332 Assume that runtime support has been provided and so there is no need
19333 to include the simulator library (@file{libsim.a}) on the linker
19339 @subsection FT32 Options
19340 @cindex FT32 Options
19342 These options are defined specifically for the FT32 port.
19348 Specifies that the program will be run on the simulator. This causes
19349 an alternate runtime startup and library to be linked.
19350 You must not use this option when generating programs that will run on
19351 real hardware; you must provide your own runtime library for whatever
19352 I/O functions are needed.
19356 Enable Local Register Allocation. This is still experimental for FT32,
19357 so by default the compiler uses standard reload.
19361 Do not use div and mod instructions.
19365 Enable use of the extended instructions of the FT32B processor.
19369 Compress all code using the Ft32B code compression scheme.
19373 Do not generate code that reads program memory.
19378 @subsection FRV Options
19379 @cindex FRV Options
19385 Only use the first 32 general-purpose registers.
19390 Use all 64 general-purpose registers.
19395 Use only the first 32 floating-point registers.
19400 Use all 64 floating-point registers.
19403 @opindex mhard-float
19405 Use hardware instructions for floating-point operations.
19408 @opindex msoft-float
19410 Use library routines for floating-point operations.
19415 Dynamically allocate condition code registers.
19420 Do not try to dynamically allocate condition code registers, only
19421 use @code{icc0} and @code{fcc0}.
19426 Change ABI to use double word insns.
19432 Do not use double word instructions.
19437 Use floating-point double instructions.
19440 @opindex mno-double
19442 Do not use floating-point double instructions.
19447 Use media instructions.
19452 Do not use media instructions.
19457 Use multiply and add/subtract instructions.
19460 @opindex mno-muladd
19462 Do not use multiply and add/subtract instructions.
19467 Select the FDPIC ABI, which uses function descriptors to represent
19468 pointers to functions. Without any PIC/PIE-related options, it
19469 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
19470 assumes GOT entries and small data are within a 12-bit range from the
19471 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
19472 are computed with 32 bits.
19473 With a @samp{bfin-elf} target, this option implies @option{-msim}.
19476 @opindex minline-plt
19478 Enable inlining of PLT entries in function calls to functions that are
19479 not known to bind locally. It has no effect without @option{-mfdpic}.
19480 It's enabled by default if optimizing for speed and compiling for
19481 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
19482 optimization option such as @option{-O3} or above is present in the
19488 Assume a large TLS segment when generating thread-local code.
19493 Do not assume a large TLS segment when generating thread-local code.
19498 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
19499 that is known to be in read-only sections. It's enabled by default,
19500 except for @option{-fpic} or @option{-fpie}: even though it may help
19501 make the global offset table smaller, it trades 1 instruction for 4.
19502 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
19503 one of which may be shared by multiple symbols, and it avoids the need
19504 for a GOT entry for the referenced symbol, so it's more likely to be a
19505 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
19507 @item -multilib-library-pic
19508 @opindex multilib-library-pic
19510 Link with the (library, not FD) pic libraries. It's implied by
19511 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
19512 @option{-fpic} without @option{-mfdpic}. You should never have to use
19516 @opindex mlinked-fp
19518 Follow the EABI requirement of always creating a frame pointer whenever
19519 a stack frame is allocated. This option is enabled by default and can
19520 be disabled with @option{-mno-linked-fp}.
19523 @opindex mlong-calls
19525 Use indirect addressing to call functions outside the current
19526 compilation unit. This allows the functions to be placed anywhere
19527 within the 32-bit address space.
19529 @item -malign-labels
19530 @opindex malign-labels
19532 Try to align labels to an 8-byte boundary by inserting NOPs into the
19533 previous packet. This option only has an effect when VLIW packing
19534 is enabled. It doesn't create new packets; it merely adds NOPs to
19537 @item -mlibrary-pic
19538 @opindex mlibrary-pic
19540 Generate position-independent EABI code.
19545 Use only the first four media accumulator registers.
19550 Use all eight media accumulator registers.
19555 Pack VLIW instructions.
19560 Do not pack VLIW instructions.
19563 @opindex mno-eflags
19565 Do not mark ABI switches in e_flags.
19568 @opindex mcond-move
19570 Enable the use of conditional-move instructions (default).
19572 This switch is mainly for debugging the compiler and will likely be removed
19573 in a future version.
19575 @item -mno-cond-move
19576 @opindex mno-cond-move
19578 Disable the use of conditional-move instructions.
19580 This switch is mainly for debugging the compiler and will likely be removed
19581 in a future version.
19586 Enable the use of conditional set instructions (default).
19588 This switch is mainly for debugging the compiler and will likely be removed
19589 in a future version.
19594 Disable the use of conditional set instructions.
19596 This switch is mainly for debugging the compiler and will likely be removed
19597 in a future version.
19600 @opindex mcond-exec
19602 Enable the use of conditional execution (default).
19604 This switch is mainly for debugging the compiler and will likely be removed
19605 in a future version.
19607 @item -mno-cond-exec
19608 @opindex mno-cond-exec
19610 Disable the use of conditional execution.
19612 This switch is mainly for debugging the compiler and will likely be removed
19613 in a future version.
19615 @item -mvliw-branch
19616 @opindex mvliw-branch
19618 Run a pass to pack branches into VLIW instructions (default).
19620 This switch is mainly for debugging the compiler and will likely be removed
19621 in a future version.
19623 @item -mno-vliw-branch
19624 @opindex mno-vliw-branch
19626 Do not run a pass to pack branches into VLIW instructions.
19628 This switch is mainly for debugging the compiler and will likely be removed
19629 in a future version.
19631 @item -mmulti-cond-exec
19632 @opindex mmulti-cond-exec
19634 Enable optimization of @code{&&} and @code{||} in conditional execution
19637 This switch is mainly for debugging the compiler and will likely be removed
19638 in a future version.
19640 @item -mno-multi-cond-exec
19641 @opindex mno-multi-cond-exec
19643 Disable optimization of @code{&&} and @code{||} in conditional execution.
19645 This switch is mainly for debugging the compiler and will likely be removed
19646 in a future version.
19648 @item -mnested-cond-exec
19649 @opindex mnested-cond-exec
19651 Enable nested conditional execution optimizations (default).
19653 This switch is mainly for debugging the compiler and will likely be removed
19654 in a future version.
19656 @item -mno-nested-cond-exec
19657 @opindex mno-nested-cond-exec
19659 Disable nested conditional execution optimizations.
19661 This switch is mainly for debugging the compiler and will likely be removed
19662 in a future version.
19664 @item -moptimize-membar
19665 @opindex moptimize-membar
19667 This switch removes redundant @code{membar} instructions from the
19668 compiler-generated code. It is enabled by default.
19670 @item -mno-optimize-membar
19671 @opindex mno-optimize-membar
19672 @opindex moptimize-membar
19674 This switch disables the automatic removal of redundant @code{membar}
19675 instructions from the generated code.
19677 @item -mtomcat-stats
19678 @opindex mtomcat-stats
19680 Cause gas to print out tomcat statistics.
19682 @item -mcpu=@var{cpu}
19685 Select the processor type for which to generate code. Possible values are
19686 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
19687 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
19691 @node GNU/Linux Options
19692 @subsection GNU/Linux Options
19694 These @samp{-m} options are defined for GNU/Linux targets:
19699 Use the GNU C library. This is the default except
19700 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
19701 @samp{*-*-linux-*android*} targets.
19705 Use uClibc C library. This is the default on
19706 @samp{*-*-linux-*uclibc*} targets.
19710 Use the musl C library. This is the default on
19711 @samp{*-*-linux-*musl*} targets.
19715 Use Bionic C library. This is the default on
19716 @samp{*-*-linux-*android*} targets.
19720 Compile code compatible with Android platform. This is the default on
19721 @samp{*-*-linux-*android*} targets.
19723 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
19724 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
19725 this option makes the GCC driver pass Android-specific options to the linker.
19726 Finally, this option causes the preprocessor macro @code{__ANDROID__}
19729 @item -tno-android-cc
19730 @opindex tno-android-cc
19731 Disable compilation effects of @option{-mandroid}, i.e., do not enable
19732 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
19733 @option{-fno-rtti} by default.
19735 @item -tno-android-ld
19736 @opindex tno-android-ld
19737 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
19738 linking options to the linker.
19742 @node H8/300 Options
19743 @subsection H8/300 Options
19745 These @samp{-m} options are defined for the H8/300 implementations:
19750 Shorten some address references at link time, when possible; uses the
19751 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
19752 ld, Using ld}, for a fuller description.
19756 Generate code for the H8/300H@.
19760 Generate code for the H8S@.
19764 Generate code for the H8S and H8/300H in the normal mode. This switch
19765 must be used either with @option{-mh} or @option{-ms}.
19769 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
19773 Extended registers are stored on stack before execution of function
19774 with monitor attribute. Default option is @option{-mexr}.
19775 This option is valid only for H8S targets.
19780 Extended registers are not stored on stack before execution of function
19781 with monitor attribute. Default option is @option{-mno-exr}.
19782 This option is valid only for H8S targets.
19786 Make @code{int} data 32 bits by default.
19789 @opindex malign-300
19790 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
19791 The default for the H8/300H and H8S is to align longs and floats on
19793 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
19794 This option has no effect on the H8/300.
19798 @subsection HPPA Options
19799 @cindex HPPA Options
19801 These @samp{-m} options are defined for the HPPA family of computers:
19804 @item -march=@var{architecture-type}
19806 Generate code for the specified architecture. The choices for
19807 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
19808 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
19809 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
19810 architecture option for your machine. Code compiled for lower numbered
19811 architectures runs on higher numbered architectures, but not the
19814 @item -mpa-risc-1-0
19815 @itemx -mpa-risc-1-1
19816 @itemx -mpa-risc-2-0
19817 @opindex mpa-risc-1-0
19818 @opindex mpa-risc-1-1
19819 @opindex mpa-risc-2-0
19820 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
19822 @item -mcaller-copies
19823 @opindex mcaller-copies
19824 The caller copies function arguments passed by hidden reference. This
19825 option should be used with care as it is not compatible with the default
19826 32-bit runtime. However, only aggregates larger than eight bytes are
19827 passed by hidden reference and the option provides better compatibility
19830 @item -mjump-in-delay
19831 @opindex mjump-in-delay
19832 This option is ignored and provided for compatibility purposes only.
19834 @item -mdisable-fpregs
19835 @opindex mdisable-fpregs
19836 Prevent floating-point registers from being used in any manner. This is
19837 necessary for compiling kernels that perform lazy context switching of
19838 floating-point registers. If you use this option and attempt to perform
19839 floating-point operations, the compiler aborts.
19841 @item -mdisable-indexing
19842 @opindex mdisable-indexing
19843 Prevent the compiler from using indexing address modes. This avoids some
19844 rather obscure problems when compiling MIG generated code under MACH@.
19846 @item -mno-space-regs
19847 @opindex mno-space-regs
19848 @opindex mspace-regs
19849 Generate code that assumes the target has no space registers. This allows
19850 GCC to generate faster indirect calls and use unscaled index address modes.
19852 Such code is suitable for level 0 PA systems and kernels.
19854 @item -mfast-indirect-calls
19855 @opindex mfast-indirect-calls
19856 Generate code that assumes calls never cross space boundaries. This
19857 allows GCC to emit code that performs faster indirect calls.
19859 This option does not work in the presence of shared libraries or nested
19862 @item -mfixed-range=@var{register-range}
19863 @opindex mfixed-range
19864 Generate code treating the given register range as fixed registers.
19865 A fixed register is one that the register allocator cannot use. This is
19866 useful when compiling kernel code. A register range is specified as
19867 two registers separated by a dash. Multiple register ranges can be
19868 specified separated by a comma.
19870 @item -mlong-load-store
19871 @opindex mlong-load-store
19872 Generate 3-instruction load and store sequences as sometimes required by
19873 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
19876 @item -mportable-runtime
19877 @opindex mportable-runtime
19878 Use the portable calling conventions proposed by HP for ELF systems.
19882 Enable the use of assembler directives only GAS understands.
19884 @item -mschedule=@var{cpu-type}
19886 Schedule code according to the constraints for the machine type
19887 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
19888 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
19889 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
19890 proper scheduling option for your machine. The default scheduling is
19894 @opindex mlinker-opt
19895 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
19896 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
19897 linkers in which they give bogus error messages when linking some programs.
19900 @opindex msoft-float
19901 Generate output containing library calls for floating point.
19902 @strong{Warning:} the requisite libraries are not available for all HPPA
19903 targets. Normally the facilities of the machine's usual C compiler are
19904 used, but this cannot be done directly in cross-compilation. You must make
19905 your own arrangements to provide suitable library functions for
19908 @option{-msoft-float} changes the calling convention in the output file;
19909 therefore, it is only useful if you compile @emph{all} of a program with
19910 this option. In particular, you need to compile @file{libgcc.a}, the
19911 library that comes with GCC, with @option{-msoft-float} in order for
19916 Generate the predefine, @code{_SIO}, for server IO@. The default is
19917 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
19918 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
19919 options are available under HP-UX and HI-UX@.
19923 Use options specific to GNU @command{ld}.
19924 This passes @option{-shared} to @command{ld} when
19925 building a shared library. It is the default when GCC is configured,
19926 explicitly or implicitly, with the GNU linker. This option does not
19927 affect which @command{ld} is called; it only changes what parameters
19928 are passed to that @command{ld}.
19929 The @command{ld} that is called is determined by the
19930 @option{--with-ld} configure option, GCC's program search path, and
19931 finally by the user's @env{PATH}. The linker used by GCC can be printed
19932 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
19933 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
19937 Use options specific to HP @command{ld}.
19938 This passes @option{-b} to @command{ld} when building
19939 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
19940 links. It is the default when GCC is configured, explicitly or
19941 implicitly, with the HP linker. This option does not affect
19942 which @command{ld} is called; it only changes what parameters are passed to that
19944 The @command{ld} that is called is determined by the @option{--with-ld}
19945 configure option, GCC's program search path, and finally by the user's
19946 @env{PATH}. The linker used by GCC can be printed using @samp{which
19947 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
19948 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
19951 @opindex mno-long-calls
19952 @opindex mlong-calls
19953 Generate code that uses long call sequences. This ensures that a call
19954 is always able to reach linker generated stubs. The default is to generate
19955 long calls only when the distance from the call site to the beginning
19956 of the function or translation unit, as the case may be, exceeds a
19957 predefined limit set by the branch type being used. The limits for
19958 normal calls are 7,600,000 and 240,000 bytes, respectively for the
19959 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
19962 Distances are measured from the beginning of functions when using the
19963 @option{-ffunction-sections} option, or when using the @option{-mgas}
19964 and @option{-mno-portable-runtime} options together under HP-UX with
19967 It is normally not desirable to use this option as it degrades
19968 performance. However, it may be useful in large applications,
19969 particularly when partial linking is used to build the application.
19971 The types of long calls used depends on the capabilities of the
19972 assembler and linker, and the type of code being generated. The
19973 impact on systems that support long absolute calls, and long pic
19974 symbol-difference or pc-relative calls should be relatively small.
19975 However, an indirect call is used on 32-bit ELF systems in pic code
19976 and it is quite long.
19978 @item -munix=@var{unix-std}
19980 Generate compiler predefines and select a startfile for the specified
19981 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
19982 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
19983 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
19984 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
19985 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
19988 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
19989 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
19990 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
19991 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
19992 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
19993 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
19995 It is @emph{important} to note that this option changes the interfaces
19996 for various library routines. It also affects the operational behavior
19997 of the C library. Thus, @emph{extreme} care is needed in using this
20000 Library code that is intended to operate with more than one UNIX
20001 standard must test, set and restore the variable @code{__xpg4_extended_mask}
20002 as appropriate. Most GNU software doesn't provide this capability.
20006 Suppress the generation of link options to search libdld.sl when the
20007 @option{-static} option is specified on HP-UX 10 and later.
20011 The HP-UX implementation of setlocale in libc has a dependency on
20012 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20013 when the @option{-static} option is specified, special link options
20014 are needed to resolve this dependency.
20016 On HP-UX 10 and later, the GCC driver adds the necessary options to
20017 link with libdld.sl when the @option{-static} option is specified.
20018 This causes the resulting binary to be dynamic. On the 64-bit port,
20019 the linkers generate dynamic binaries by default in any case. The
20020 @option{-nolibdld} option can be used to prevent the GCC driver from
20021 adding these link options.
20025 Add support for multithreading with the @dfn{dce thread} library
20026 under HP-UX@. This option sets flags for both the preprocessor and
20030 @node IA-64 Options
20031 @subsection IA-64 Options
20032 @cindex IA-64 Options
20034 These are the @samp{-m} options defined for the Intel IA-64 architecture.
20038 @opindex mbig-endian
20039 Generate code for a big-endian target. This is the default for HP-UX@.
20041 @item -mlittle-endian
20042 @opindex mlittle-endian
20043 Generate code for a little-endian target. This is the default for AIX5
20049 @opindex mno-gnu-as
20050 Generate (or don't) code for the GNU assembler. This is the default.
20051 @c Also, this is the default if the configure option @option{--with-gnu-as}
20057 @opindex mno-gnu-ld
20058 Generate (or don't) code for the GNU linker. This is the default.
20059 @c Also, this is the default if the configure option @option{--with-gnu-ld}
20064 Generate code that does not use a global pointer register. The result
20065 is not position independent code, and violates the IA-64 ABI@.
20067 @item -mvolatile-asm-stop
20068 @itemx -mno-volatile-asm-stop
20069 @opindex mvolatile-asm-stop
20070 @opindex mno-volatile-asm-stop
20071 Generate (or don't) a stop bit immediately before and after volatile asm
20074 @item -mregister-names
20075 @itemx -mno-register-names
20076 @opindex mregister-names
20077 @opindex mno-register-names
20078 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
20079 the stacked registers. This may make assembler output more readable.
20085 Disable (or enable) optimizations that use the small data section. This may
20086 be useful for working around optimizer bugs.
20088 @item -mconstant-gp
20089 @opindex mconstant-gp
20090 Generate code that uses a single constant global pointer value. This is
20091 useful when compiling kernel code.
20095 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
20096 This is useful when compiling firmware code.
20098 @item -minline-float-divide-min-latency
20099 @opindex minline-float-divide-min-latency
20100 Generate code for inline divides of floating-point values
20101 using the minimum latency algorithm.
20103 @item -minline-float-divide-max-throughput
20104 @opindex minline-float-divide-max-throughput
20105 Generate code for inline divides of floating-point values
20106 using the maximum throughput algorithm.
20108 @item -mno-inline-float-divide
20109 @opindex mno-inline-float-divide
20110 Do not generate inline code for divides of floating-point values.
20112 @item -minline-int-divide-min-latency
20113 @opindex minline-int-divide-min-latency
20114 Generate code for inline divides of integer values
20115 using the minimum latency algorithm.
20117 @item -minline-int-divide-max-throughput
20118 @opindex minline-int-divide-max-throughput
20119 Generate code for inline divides of integer values
20120 using the maximum throughput algorithm.
20122 @item -mno-inline-int-divide
20123 @opindex mno-inline-int-divide
20124 @opindex minline-int-divide
20125 Do not generate inline code for divides of integer values.
20127 @item -minline-sqrt-min-latency
20128 @opindex minline-sqrt-min-latency
20129 Generate code for inline square roots
20130 using the minimum latency algorithm.
20132 @item -minline-sqrt-max-throughput
20133 @opindex minline-sqrt-max-throughput
20134 Generate code for inline square roots
20135 using the maximum throughput algorithm.
20137 @item -mno-inline-sqrt
20138 @opindex mno-inline-sqrt
20139 Do not generate inline code for @code{sqrt}.
20142 @itemx -mno-fused-madd
20143 @opindex mfused-madd
20144 @opindex mno-fused-madd
20145 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
20146 instructions. The default is to use these instructions.
20148 @item -mno-dwarf2-asm
20149 @itemx -mdwarf2-asm
20150 @opindex mno-dwarf2-asm
20151 @opindex mdwarf2-asm
20152 Don't (or do) generate assembler code for the DWARF line number debugging
20153 info. This may be useful when not using the GNU assembler.
20155 @item -mearly-stop-bits
20156 @itemx -mno-early-stop-bits
20157 @opindex mearly-stop-bits
20158 @opindex mno-early-stop-bits
20159 Allow stop bits to be placed earlier than immediately preceding the
20160 instruction that triggered the stop bit. This can improve instruction
20161 scheduling, but does not always do so.
20163 @item -mfixed-range=@var{register-range}
20164 @opindex mfixed-range
20165 Generate code treating the given register range as fixed registers.
20166 A fixed register is one that the register allocator cannot use. This is
20167 useful when compiling kernel code. A register range is specified as
20168 two registers separated by a dash. Multiple register ranges can be
20169 specified separated by a comma.
20171 @item -mtls-size=@var{tls-size}
20173 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
20176 @item -mtune=@var{cpu-type}
20178 Tune the instruction scheduling for a particular CPU, Valid values are
20179 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
20180 and @samp{mckinley}.
20186 Generate code for a 32-bit or 64-bit environment.
20187 The 32-bit environment sets int, long and pointer to 32 bits.
20188 The 64-bit environment sets int to 32 bits and long and pointer
20189 to 64 bits. These are HP-UX specific flags.
20191 @item -mno-sched-br-data-spec
20192 @itemx -msched-br-data-spec
20193 @opindex mno-sched-br-data-spec
20194 @opindex msched-br-data-spec
20195 (Dis/En)able data speculative scheduling before reload.
20196 This results in generation of @code{ld.a} instructions and
20197 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20198 The default setting is disabled.
20200 @item -msched-ar-data-spec
20201 @itemx -mno-sched-ar-data-spec
20202 @opindex msched-ar-data-spec
20203 @opindex mno-sched-ar-data-spec
20204 (En/Dis)able data speculative scheduling after reload.
20205 This results in generation of @code{ld.a} instructions and
20206 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20207 The default setting is enabled.
20209 @item -mno-sched-control-spec
20210 @itemx -msched-control-spec
20211 @opindex mno-sched-control-spec
20212 @opindex msched-control-spec
20213 (Dis/En)able control speculative scheduling. This feature is
20214 available only during region scheduling (i.e.@: before reload).
20215 This results in generation of the @code{ld.s} instructions and
20216 the corresponding check instructions @code{chk.s}.
20217 The default setting is disabled.
20219 @item -msched-br-in-data-spec
20220 @itemx -mno-sched-br-in-data-spec
20221 @opindex msched-br-in-data-spec
20222 @opindex mno-sched-br-in-data-spec
20223 (En/Dis)able speculative scheduling of the instructions that
20224 are dependent on the data speculative loads before reload.
20225 This is effective only with @option{-msched-br-data-spec} enabled.
20226 The default setting is enabled.
20228 @item -msched-ar-in-data-spec
20229 @itemx -mno-sched-ar-in-data-spec
20230 @opindex msched-ar-in-data-spec
20231 @opindex mno-sched-ar-in-data-spec
20232 (En/Dis)able speculative scheduling of the instructions that
20233 are dependent on the data speculative loads after reload.
20234 This is effective only with @option{-msched-ar-data-spec} enabled.
20235 The default setting is enabled.
20237 @item -msched-in-control-spec
20238 @itemx -mno-sched-in-control-spec
20239 @opindex msched-in-control-spec
20240 @opindex mno-sched-in-control-spec
20241 (En/Dis)able speculative scheduling of the instructions that
20242 are dependent on the control speculative loads.
20243 This is effective only with @option{-msched-control-spec} enabled.
20244 The default setting is enabled.
20246 @item -mno-sched-prefer-non-data-spec-insns
20247 @itemx -msched-prefer-non-data-spec-insns
20248 @opindex mno-sched-prefer-non-data-spec-insns
20249 @opindex msched-prefer-non-data-spec-insns
20250 If enabled, data-speculative instructions are chosen for schedule
20251 only if there are no other choices at the moment. This makes
20252 the use of the data speculation much more conservative.
20253 The default setting is disabled.
20255 @item -mno-sched-prefer-non-control-spec-insns
20256 @itemx -msched-prefer-non-control-spec-insns
20257 @opindex mno-sched-prefer-non-control-spec-insns
20258 @opindex msched-prefer-non-control-spec-insns
20259 If enabled, control-speculative instructions are chosen for schedule
20260 only if there are no other choices at the moment. This makes
20261 the use of the control speculation much more conservative.
20262 The default setting is disabled.
20264 @item -mno-sched-count-spec-in-critical-path
20265 @itemx -msched-count-spec-in-critical-path
20266 @opindex mno-sched-count-spec-in-critical-path
20267 @opindex msched-count-spec-in-critical-path
20268 If enabled, speculative dependencies are considered during
20269 computation of the instructions priorities. This makes the use of the
20270 speculation a bit more conservative.
20271 The default setting is disabled.
20273 @item -msched-spec-ldc
20274 @opindex msched-spec-ldc
20275 Use a simple data speculation check. This option is on by default.
20277 @item -msched-control-spec-ldc
20278 @opindex msched-spec-ldc
20279 Use a simple check for control speculation. This option is on by default.
20281 @item -msched-stop-bits-after-every-cycle
20282 @opindex msched-stop-bits-after-every-cycle
20283 Place a stop bit after every cycle when scheduling. This option is on
20286 @item -msched-fp-mem-deps-zero-cost
20287 @opindex msched-fp-mem-deps-zero-cost
20288 Assume that floating-point stores and loads are not likely to cause a conflict
20289 when placed into the same instruction group. This option is disabled by
20292 @item -msel-sched-dont-check-control-spec
20293 @opindex msel-sched-dont-check-control-spec
20294 Generate checks for control speculation in selective scheduling.
20295 This flag is disabled by default.
20297 @item -msched-max-memory-insns=@var{max-insns}
20298 @opindex msched-max-memory-insns
20299 Limit on the number of memory insns per instruction group, giving lower
20300 priority to subsequent memory insns attempting to schedule in the same
20301 instruction group. Frequently useful to prevent cache bank conflicts.
20302 The default value is 1.
20304 @item -msched-max-memory-insns-hard-limit
20305 @opindex msched-max-memory-insns-hard-limit
20306 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
20307 disallowing more than that number in an instruction group.
20308 Otherwise, the limit is ``soft'', meaning that non-memory operations
20309 are preferred when the limit is reached, but memory operations may still
20315 @subsection LM32 Options
20316 @cindex LM32 options
20318 These @option{-m} options are defined for the LatticeMico32 architecture:
20321 @item -mbarrel-shift-enabled
20322 @opindex mbarrel-shift-enabled
20323 Enable barrel-shift instructions.
20325 @item -mdivide-enabled
20326 @opindex mdivide-enabled
20327 Enable divide and modulus instructions.
20329 @item -mmultiply-enabled
20330 @opindex multiply-enabled
20331 Enable multiply instructions.
20333 @item -msign-extend-enabled
20334 @opindex msign-extend-enabled
20335 Enable sign extend instructions.
20337 @item -muser-enabled
20338 @opindex muser-enabled
20339 Enable user-defined instructions.
20344 @subsection M32C Options
20345 @cindex M32C options
20348 @item -mcpu=@var{name}
20350 Select the CPU for which code is generated. @var{name} may be one of
20351 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
20352 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
20353 the M32C/80 series.
20357 Specifies that the program will be run on the simulator. This causes
20358 an alternate runtime library to be linked in which supports, for
20359 example, file I/O@. You must not use this option when generating
20360 programs that will run on real hardware; you must provide your own
20361 runtime library for whatever I/O functions are needed.
20363 @item -memregs=@var{number}
20365 Specifies the number of memory-based pseudo-registers GCC uses
20366 during code generation. These pseudo-registers are used like real
20367 registers, so there is a tradeoff between GCC's ability to fit the
20368 code into available registers, and the performance penalty of using
20369 memory instead of registers. Note that all modules in a program must
20370 be compiled with the same value for this option. Because of that, you
20371 must not use this option with GCC's default runtime libraries.
20375 @node M32R/D Options
20376 @subsection M32R/D Options
20377 @cindex M32R/D options
20379 These @option{-m} options are defined for Renesas M32R/D architectures:
20384 Generate code for the M32R/2@.
20388 Generate code for the M32R/X@.
20392 Generate code for the M32R@. This is the default.
20394 @item -mmodel=small
20395 @opindex mmodel=small
20396 Assume all objects live in the lower 16MB of memory (so that their addresses
20397 can be loaded with the @code{ld24} instruction), and assume all subroutines
20398 are reachable with the @code{bl} instruction.
20399 This is the default.
20401 The addressability of a particular object can be set with the
20402 @code{model} attribute.
20404 @item -mmodel=medium
20405 @opindex mmodel=medium
20406 Assume objects may be anywhere in the 32-bit address space (the compiler
20407 generates @code{seth/add3} instructions to load their addresses), and
20408 assume all subroutines are reachable with the @code{bl} instruction.
20410 @item -mmodel=large
20411 @opindex mmodel=large
20412 Assume objects may be anywhere in the 32-bit address space (the compiler
20413 generates @code{seth/add3} instructions to load their addresses), and
20414 assume subroutines may not be reachable with the @code{bl} instruction
20415 (the compiler generates the much slower @code{seth/add3/jl}
20416 instruction sequence).
20419 @opindex msdata=none
20420 Disable use of the small data area. Variables are put into
20421 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
20422 @code{section} attribute has been specified).
20423 This is the default.
20425 The small data area consists of sections @code{.sdata} and @code{.sbss}.
20426 Objects may be explicitly put in the small data area with the
20427 @code{section} attribute using one of these sections.
20429 @item -msdata=sdata
20430 @opindex msdata=sdata
20431 Put small global and static data in the small data area, but do not
20432 generate special code to reference them.
20435 @opindex msdata=use
20436 Put small global and static data in the small data area, and generate
20437 special instructions to reference them.
20441 @cindex smaller data references
20442 Put global and static objects less than or equal to @var{num} bytes
20443 into the small data or BSS sections instead of the normal data or BSS
20444 sections. The default value of @var{num} is 8.
20445 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
20446 for this option to have any effect.
20448 All modules should be compiled with the same @option{-G @var{num}} value.
20449 Compiling with different values of @var{num} may or may not work; if it
20450 doesn't the linker gives an error message---incorrect code is not
20455 Makes the M32R-specific code in the compiler display some statistics
20456 that might help in debugging programs.
20458 @item -malign-loops
20459 @opindex malign-loops
20460 Align all loops to a 32-byte boundary.
20462 @item -mno-align-loops
20463 @opindex mno-align-loops
20464 Do not enforce a 32-byte alignment for loops. This is the default.
20466 @item -missue-rate=@var{number}
20467 @opindex missue-rate=@var{number}
20468 Issue @var{number} instructions per cycle. @var{number} can only be 1
20471 @item -mbranch-cost=@var{number}
20472 @opindex mbranch-cost=@var{number}
20473 @var{number} can only be 1 or 2. If it is 1 then branches are
20474 preferred over conditional code, if it is 2, then the opposite applies.
20476 @item -mflush-trap=@var{number}
20477 @opindex mflush-trap=@var{number}
20478 Specifies the trap number to use to flush the cache. The default is
20479 12. Valid numbers are between 0 and 15 inclusive.
20481 @item -mno-flush-trap
20482 @opindex mno-flush-trap
20483 Specifies that the cache cannot be flushed by using a trap.
20485 @item -mflush-func=@var{name}
20486 @opindex mflush-func=@var{name}
20487 Specifies the name of the operating system function to call to flush
20488 the cache. The default is @samp{_flush_cache}, but a function call
20489 is only used if a trap is not available.
20491 @item -mno-flush-func
20492 @opindex mno-flush-func
20493 Indicates that there is no OS function for flushing the cache.
20497 @node M680x0 Options
20498 @subsection M680x0 Options
20499 @cindex M680x0 options
20501 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
20502 The default settings depend on which architecture was selected when
20503 the compiler was configured; the defaults for the most common choices
20507 @item -march=@var{arch}
20509 Generate code for a specific M680x0 or ColdFire instruction set
20510 architecture. Permissible values of @var{arch} for M680x0
20511 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
20512 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
20513 architectures are selected according to Freescale's ISA classification
20514 and the permissible values are: @samp{isaa}, @samp{isaaplus},
20515 @samp{isab} and @samp{isac}.
20517 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
20518 code for a ColdFire target. The @var{arch} in this macro is one of the
20519 @option{-march} arguments given above.
20521 When used together, @option{-march} and @option{-mtune} select code
20522 that runs on a family of similar processors but that is optimized
20523 for a particular microarchitecture.
20525 @item -mcpu=@var{cpu}
20527 Generate code for a specific M680x0 or ColdFire processor.
20528 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
20529 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
20530 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
20531 below, which also classifies the CPUs into families:
20533 @multitable @columnfractions 0.20 0.80
20534 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
20535 @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}
20536 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
20537 @item @samp{5206e} @tab @samp{5206e}
20538 @item @samp{5208} @tab @samp{5207} @samp{5208}
20539 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
20540 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
20541 @item @samp{5216} @tab @samp{5214} @samp{5216}
20542 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
20543 @item @samp{5225} @tab @samp{5224} @samp{5225}
20544 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
20545 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
20546 @item @samp{5249} @tab @samp{5249}
20547 @item @samp{5250} @tab @samp{5250}
20548 @item @samp{5271} @tab @samp{5270} @samp{5271}
20549 @item @samp{5272} @tab @samp{5272}
20550 @item @samp{5275} @tab @samp{5274} @samp{5275}
20551 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
20552 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
20553 @item @samp{5307} @tab @samp{5307}
20554 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
20555 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
20556 @item @samp{5407} @tab @samp{5407}
20557 @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}
20560 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
20561 @var{arch} is compatible with @var{cpu}. Other combinations of
20562 @option{-mcpu} and @option{-march} are rejected.
20564 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
20565 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
20566 where the value of @var{family} is given by the table above.
20568 @item -mtune=@var{tune}
20570 Tune the code for a particular microarchitecture within the
20571 constraints set by @option{-march} and @option{-mcpu}.
20572 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
20573 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
20574 and @samp{cpu32}. The ColdFire microarchitectures
20575 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
20577 You can also use @option{-mtune=68020-40} for code that needs
20578 to run relatively well on 68020, 68030 and 68040 targets.
20579 @option{-mtune=68020-60} is similar but includes 68060 targets
20580 as well. These two options select the same tuning decisions as
20581 @option{-m68020-40} and @option{-m68020-60} respectively.
20583 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
20584 when tuning for 680x0 architecture @var{arch}. It also defines
20585 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
20586 option is used. If GCC is tuning for a range of architectures,
20587 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
20588 it defines the macros for every architecture in the range.
20590 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
20591 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
20592 of the arguments given above.
20598 Generate output for a 68000. This is the default
20599 when the compiler is configured for 68000-based systems.
20600 It is equivalent to @option{-march=68000}.
20602 Use this option for microcontrollers with a 68000 or EC000 core,
20603 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
20607 Generate output for a 68010. This is the default
20608 when the compiler is configured for 68010-based systems.
20609 It is equivalent to @option{-march=68010}.
20615 Generate output for a 68020. This is the default
20616 when the compiler is configured for 68020-based systems.
20617 It is equivalent to @option{-march=68020}.
20621 Generate output for a 68030. This is the default when the compiler is
20622 configured for 68030-based systems. It is equivalent to
20623 @option{-march=68030}.
20627 Generate output for a 68040. This is the default when the compiler is
20628 configured for 68040-based systems. It is equivalent to
20629 @option{-march=68040}.
20631 This option inhibits the use of 68881/68882 instructions that have to be
20632 emulated by software on the 68040. Use this option if your 68040 does not
20633 have code to emulate those instructions.
20637 Generate output for a 68060. This is the default when the compiler is
20638 configured for 68060-based systems. It is equivalent to
20639 @option{-march=68060}.
20641 This option inhibits the use of 68020 and 68881/68882 instructions that
20642 have to be emulated by software on the 68060. Use this option if your 68060
20643 does not have code to emulate those instructions.
20647 Generate output for a CPU32. This is the default
20648 when the compiler is configured for CPU32-based systems.
20649 It is equivalent to @option{-march=cpu32}.
20651 Use this option for microcontrollers with a
20652 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
20653 68336, 68340, 68341, 68349 and 68360.
20657 Generate output for a 520X ColdFire CPU@. This is the default
20658 when the compiler is configured for 520X-based systems.
20659 It is equivalent to @option{-mcpu=5206}, and is now deprecated
20660 in favor of that option.
20662 Use this option for microcontroller with a 5200 core, including
20663 the MCF5202, MCF5203, MCF5204 and MCF5206.
20667 Generate output for a 5206e ColdFire CPU@. The option is now
20668 deprecated in favor of the equivalent @option{-mcpu=5206e}.
20672 Generate output for a member of the ColdFire 528X family.
20673 The option is now deprecated in favor of the equivalent
20674 @option{-mcpu=528x}.
20678 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
20679 in favor of the equivalent @option{-mcpu=5307}.
20683 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
20684 in favor of the equivalent @option{-mcpu=5407}.
20688 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
20689 This includes use of hardware floating-point instructions.
20690 The option is equivalent to @option{-mcpu=547x}, and is now
20691 deprecated in favor of that option.
20695 Generate output for a 68040, without using any of the new instructions.
20696 This results in code that can run relatively efficiently on either a
20697 68020/68881 or a 68030 or a 68040. The generated code does use the
20698 68881 instructions that are emulated on the 68040.
20700 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
20704 Generate output for a 68060, without using any of the new instructions.
20705 This results in code that can run relatively efficiently on either a
20706 68020/68881 or a 68030 or a 68040. The generated code does use the
20707 68881 instructions that are emulated on the 68060.
20709 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
20713 @opindex mhard-float
20715 Generate floating-point instructions. This is the default for 68020
20716 and above, and for ColdFire devices that have an FPU@. It defines the
20717 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
20718 on ColdFire targets.
20721 @opindex msoft-float
20722 Do not generate floating-point instructions; use library calls instead.
20723 This is the default for 68000, 68010, and 68832 targets. It is also
20724 the default for ColdFire devices that have no FPU.
20730 Generate (do not generate) ColdFire hardware divide and remainder
20731 instructions. If @option{-march} is used without @option{-mcpu},
20732 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
20733 architectures. Otherwise, the default is taken from the target CPU
20734 (either the default CPU, or the one specified by @option{-mcpu}). For
20735 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
20736 @option{-mcpu=5206e}.
20738 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
20742 Consider type @code{int} to be 16 bits wide, like @code{short int}.
20743 Additionally, parameters passed on the stack are also aligned to a
20744 16-bit boundary even on targets whose API mandates promotion to 32-bit.
20748 Do not consider type @code{int} to be 16 bits wide. This is the default.
20751 @itemx -mno-bitfield
20752 @opindex mnobitfield
20753 @opindex mno-bitfield
20754 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
20755 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
20759 Do use the bit-field instructions. The @option{-m68020} option implies
20760 @option{-mbitfield}. This is the default if you use a configuration
20761 designed for a 68020.
20765 Use a different function-calling convention, in which functions
20766 that take a fixed number of arguments return with the @code{rtd}
20767 instruction, which pops their arguments while returning. This
20768 saves one instruction in the caller since there is no need to pop
20769 the arguments there.
20771 This calling convention is incompatible with the one normally
20772 used on Unix, so you cannot use it if you need to call libraries
20773 compiled with the Unix compiler.
20775 Also, you must provide function prototypes for all functions that
20776 take variable numbers of arguments (including @code{printf});
20777 otherwise incorrect code is generated for calls to those
20780 In addition, seriously incorrect code results if you call a
20781 function with too many arguments. (Normally, extra arguments are
20782 harmlessly ignored.)
20784 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
20785 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
20787 The default is @option{-mno-rtd}.
20790 @itemx -mno-align-int
20791 @opindex malign-int
20792 @opindex mno-align-int
20793 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
20794 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
20795 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
20796 Aligning variables on 32-bit boundaries produces code that runs somewhat
20797 faster on processors with 32-bit busses at the expense of more memory.
20799 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
20800 aligns structures containing the above types differently than
20801 most published application binary interface specifications for the m68k.
20805 Use the pc-relative addressing mode of the 68000 directly, instead of
20806 using a global offset table. At present, this option implies @option{-fpic},
20807 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
20808 not presently supported with @option{-mpcrel}, though this could be supported for
20809 68020 and higher processors.
20811 @item -mno-strict-align
20812 @itemx -mstrict-align
20813 @opindex mno-strict-align
20814 @opindex mstrict-align
20815 Do not (do) assume that unaligned memory references are handled by
20819 Generate code that allows the data segment to be located in a different
20820 area of memory from the text segment. This allows for execute-in-place in
20821 an environment without virtual memory management. This option implies
20824 @item -mno-sep-data
20825 Generate code that assumes that the data segment follows the text segment.
20826 This is the default.
20828 @item -mid-shared-library
20829 Generate code that supports shared libraries via the library ID method.
20830 This allows for execute-in-place and shared libraries in an environment
20831 without virtual memory management. This option implies @option{-fPIC}.
20833 @item -mno-id-shared-library
20834 Generate code that doesn't assume ID-based shared libraries are being used.
20835 This is the default.
20837 @item -mshared-library-id=n
20838 Specifies the identification number of the ID-based shared library being
20839 compiled. Specifying a value of 0 generates more compact code; specifying
20840 other values forces the allocation of that number to the current
20841 library, but is no more space- or time-efficient than omitting this option.
20847 When generating position-independent code for ColdFire, generate code
20848 that works if the GOT has more than 8192 entries. This code is
20849 larger and slower than code generated without this option. On M680x0
20850 processors, this option is not needed; @option{-fPIC} suffices.
20852 GCC normally uses a single instruction to load values from the GOT@.
20853 While this is relatively efficient, it only works if the GOT
20854 is smaller than about 64k. Anything larger causes the linker
20855 to report an error such as:
20857 @cindex relocation truncated to fit (ColdFire)
20859 relocation truncated to fit: R_68K_GOT16O foobar
20862 If this happens, you should recompile your code with @option{-mxgot}.
20863 It should then work with very large GOTs. However, code generated with
20864 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
20865 the value of a global symbol.
20867 Note that some linkers, including newer versions of the GNU linker,
20868 can create multiple GOTs and sort GOT entries. If you have such a linker,
20869 you should only need to use @option{-mxgot} when compiling a single
20870 object file that accesses more than 8192 GOT entries. Very few do.
20872 These options have no effect unless GCC is generating
20873 position-independent code.
20875 @item -mlong-jump-table-offsets
20876 @opindex mlong-jump-table-offsets
20877 Use 32-bit offsets in @code{switch} tables. The default is to use
20882 @node MCore Options
20883 @subsection MCore Options
20884 @cindex MCore options
20886 These are the @samp{-m} options defined for the Motorola M*Core
20892 @itemx -mno-hardlit
20894 @opindex mno-hardlit
20895 Inline constants into the code stream if it can be done in two
20896 instructions or less.
20902 Use the divide instruction. (Enabled by default).
20904 @item -mrelax-immediate
20905 @itemx -mno-relax-immediate
20906 @opindex mrelax-immediate
20907 @opindex mno-relax-immediate
20908 Allow arbitrary-sized immediates in bit operations.
20910 @item -mwide-bitfields
20911 @itemx -mno-wide-bitfields
20912 @opindex mwide-bitfields
20913 @opindex mno-wide-bitfields
20914 Always treat bit-fields as @code{int}-sized.
20916 @item -m4byte-functions
20917 @itemx -mno-4byte-functions
20918 @opindex m4byte-functions
20919 @opindex mno-4byte-functions
20920 Force all functions to be aligned to a 4-byte boundary.
20922 @item -mcallgraph-data
20923 @itemx -mno-callgraph-data
20924 @opindex mcallgraph-data
20925 @opindex mno-callgraph-data
20926 Emit callgraph information.
20929 @itemx -mno-slow-bytes
20930 @opindex mslow-bytes
20931 @opindex mno-slow-bytes
20932 Prefer word access when reading byte quantities.
20934 @item -mlittle-endian
20935 @itemx -mbig-endian
20936 @opindex mlittle-endian
20937 @opindex mbig-endian
20938 Generate code for a little-endian target.
20944 Generate code for the 210 processor.
20948 Assume that runtime support has been provided and so omit the
20949 simulator library (@file{libsim.a)} from the linker command line.
20951 @item -mstack-increment=@var{size}
20952 @opindex mstack-increment
20953 Set the maximum amount for a single stack increment operation. Large
20954 values can increase the speed of programs that contain functions
20955 that need a large amount of stack space, but they can also trigger a
20956 segmentation fault if the stack is extended too much. The default
20962 @subsection MeP Options
20963 @cindex MeP options
20969 Enables the @code{abs} instruction, which is the absolute difference
20970 between two registers.
20974 Enables all the optional instructions---average, multiply, divide, bit
20975 operations, leading zero, absolute difference, min/max, clip, and
20981 Enables the @code{ave} instruction, which computes the average of two
20984 @item -mbased=@var{n}
20986 Variables of size @var{n} bytes or smaller are placed in the
20987 @code{.based} section by default. Based variables use the @code{$tp}
20988 register as a base register, and there is a 128-byte limit to the
20989 @code{.based} section.
20993 Enables the bit operation instructions---bit test (@code{btstm}), set
20994 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
20995 test-and-set (@code{tas}).
20997 @item -mc=@var{name}
20999 Selects which section constant data is placed in. @var{name} may
21000 be @samp{tiny}, @samp{near}, or @samp{far}.
21004 Enables the @code{clip} instruction. Note that @option{-mclip} is not
21005 useful unless you also provide @option{-mminmax}.
21007 @item -mconfig=@var{name}
21009 Selects one of the built-in core configurations. Each MeP chip has
21010 one or more modules in it; each module has a core CPU and a variety of
21011 coprocessors, optional instructions, and peripherals. The
21012 @code{MeP-Integrator} tool, not part of GCC, provides these
21013 configurations through this option; using this option is the same as
21014 using all the corresponding command-line options. The default
21015 configuration is @samp{default}.
21019 Enables the coprocessor instructions. By default, this is a 32-bit
21020 coprocessor. Note that the coprocessor is normally enabled via the
21021 @option{-mconfig=} option.
21025 Enables the 32-bit coprocessor's instructions.
21029 Enables the 64-bit coprocessor's instructions.
21033 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21037 Causes constant variables to be placed in the @code{.near} section.
21041 Enables the @code{div} and @code{divu} instructions.
21045 Generate big-endian code.
21049 Generate little-endian code.
21051 @item -mio-volatile
21052 @opindex mio-volatile
21053 Tells the compiler that any variable marked with the @code{io}
21054 attribute is to be considered volatile.
21058 Causes variables to be assigned to the @code{.far} section by default.
21062 Enables the @code{leadz} (leading zero) instruction.
21066 Causes variables to be assigned to the @code{.near} section by default.
21070 Enables the @code{min} and @code{max} instructions.
21074 Enables the multiplication and multiply-accumulate instructions.
21078 Disables all the optional instructions enabled by @option{-mall-opts}.
21082 Enables the @code{repeat} and @code{erepeat} instructions, used for
21083 low-overhead looping.
21087 Causes all variables to default to the @code{.tiny} section. Note
21088 that there is a 65536-byte limit to this section. Accesses to these
21089 variables use the @code{%gp} base register.
21093 Enables the saturation instructions. Note that the compiler does not
21094 currently generate these itself, but this option is included for
21095 compatibility with other tools, like @code{as}.
21099 Link the SDRAM-based runtime instead of the default ROM-based runtime.
21103 Link the simulator run-time libraries.
21107 Link the simulator runtime libraries, excluding built-in support
21108 for reset and exception vectors and tables.
21112 Causes all functions to default to the @code{.far} section. Without
21113 this option, functions default to the @code{.near} section.
21115 @item -mtiny=@var{n}
21117 Variables that are @var{n} bytes or smaller are allocated to the
21118 @code{.tiny} section. These variables use the @code{$gp} base
21119 register. The default for this option is 4, but note that there's a
21120 65536-byte limit to the @code{.tiny} section.
21124 @node MicroBlaze Options
21125 @subsection MicroBlaze Options
21126 @cindex MicroBlaze Options
21131 @opindex msoft-float
21132 Use software emulation for floating point (default).
21135 @opindex mhard-float
21136 Use hardware floating-point instructions.
21140 Do not optimize block moves, use @code{memcpy}.
21142 @item -mno-clearbss
21143 @opindex mno-clearbss
21144 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
21146 @item -mcpu=@var{cpu-type}
21148 Use features of, and schedule code for, the given CPU.
21149 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
21150 where @var{X} is a major version, @var{YY} is the minor version, and
21151 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
21152 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
21154 @item -mxl-soft-mul
21155 @opindex mxl-soft-mul
21156 Use software multiply emulation (default).
21158 @item -mxl-soft-div
21159 @opindex mxl-soft-div
21160 Use software emulation for divides (default).
21162 @item -mxl-barrel-shift
21163 @opindex mxl-barrel-shift
21164 Use the hardware barrel shifter.
21166 @item -mxl-pattern-compare
21167 @opindex mxl-pattern-compare
21168 Use pattern compare instructions.
21170 @item -msmall-divides
21171 @opindex msmall-divides
21172 Use table lookup optimization for small signed integer divisions.
21174 @item -mxl-stack-check
21175 @opindex mxl-stack-check
21176 This option is deprecated. Use @option{-fstack-check} instead.
21179 @opindex mxl-gp-opt
21180 Use GP-relative @code{.sdata}/@code{.sbss} sections.
21182 @item -mxl-multiply-high
21183 @opindex mxl-multiply-high
21184 Use multiply high instructions for high part of 32x32 multiply.
21186 @item -mxl-float-convert
21187 @opindex mxl-float-convert
21188 Use hardware floating-point conversion instructions.
21190 @item -mxl-float-sqrt
21191 @opindex mxl-float-sqrt
21192 Use hardware floating-point square root instruction.
21195 @opindex mbig-endian
21196 Generate code for a big-endian target.
21198 @item -mlittle-endian
21199 @opindex mlittle-endian
21200 Generate code for a little-endian target.
21203 @opindex mxl-reorder
21204 Use reorder instructions (swap and byte reversed load/store).
21206 @item -mxl-mode-@var{app-model}
21207 Select application model @var{app-model}. Valid models are
21210 normal executable (default), uses startup code @file{crt0.o}.
21212 @item -mpic-data-is-text-relative
21213 @opindex mpic-data-is-text-relative
21214 Assume that the displacement between the text and data segments is fixed
21215 at static link time. This allows data to be referenced by offset from start of
21216 text address instead of GOT since PC-relative addressing is not supported.
21219 for use with Xilinx Microprocessor Debugger (XMD) based
21220 software intrusive debug agent called xmdstub. This uses startup file
21221 @file{crt1.o} and sets the start address of the program to 0x800.
21224 for applications that are loaded using a bootloader.
21225 This model uses startup file @file{crt2.o} which does not contain a processor
21226 reset vector handler. This is suitable for transferring control on a
21227 processor reset to the bootloader rather than the application.
21230 for applications that do not require any of the
21231 MicroBlaze vectors. This option may be useful for applications running
21232 within a monitoring application. This model uses @file{crt3.o} as a startup file.
21235 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
21236 @option{-mxl-mode-@var{app-model}}.
21241 @subsection MIPS Options
21242 @cindex MIPS options
21248 Generate big-endian code.
21252 Generate little-endian code. This is the default for @samp{mips*el-*-*}
21255 @item -march=@var{arch}
21257 Generate code that runs on @var{arch}, which can be the name of a
21258 generic MIPS ISA, or the name of a particular processor.
21260 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
21261 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
21262 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
21263 @samp{mips64r5} and @samp{mips64r6}.
21264 The processor names are:
21265 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
21266 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
21267 @samp{5kc}, @samp{5kf},
21269 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
21270 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
21271 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
21272 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
21273 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
21274 @samp{i6400}, @samp{i6500},
21276 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
21277 @samp{gs464e}, @samp{gs264e},
21279 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
21280 @samp{m5100}, @samp{m5101},
21281 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
21283 @samp{p5600}, @samp{p6600},
21284 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
21285 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
21286 @samp{rm7000}, @samp{rm9000},
21287 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
21290 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
21291 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
21292 @samp{xlr} and @samp{xlp}.
21293 The special value @samp{from-abi} selects the
21294 most compatible architecture for the selected ABI (that is,
21295 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
21297 The native Linux/GNU toolchain also supports the value @samp{native},
21298 which selects the best architecture option for the host processor.
21299 @option{-march=native} has no effect if GCC does not recognize
21302 In processor names, a final @samp{000} can be abbreviated as @samp{k}
21303 (for example, @option{-march=r2k}). Prefixes are optional, and
21304 @samp{vr} may be written @samp{r}.
21306 Names of the form @samp{@var{n}f2_1} refer to processors with
21307 FPUs clocked at half the rate of the core, names of the form
21308 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
21309 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
21310 processors with FPUs clocked a ratio of 3:2 with respect to the core.
21311 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
21312 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
21313 accepted as synonyms for @samp{@var{n}f1_1}.
21315 GCC defines two macros based on the value of this option. The first
21316 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
21317 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
21318 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
21319 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
21320 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
21322 Note that the @code{_MIPS_ARCH} macro uses the processor names given
21323 above. In other words, it has the full prefix and does not
21324 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
21325 the macro names the resolved architecture (either @code{"mips1"} or
21326 @code{"mips3"}). It names the default architecture when no
21327 @option{-march} option is given.
21329 @item -mtune=@var{arch}
21331 Optimize for @var{arch}. Among other things, this option controls
21332 the way instructions are scheduled, and the perceived cost of arithmetic
21333 operations. The list of @var{arch} values is the same as for
21336 When this option is not used, GCC optimizes for the processor
21337 specified by @option{-march}. By using @option{-march} and
21338 @option{-mtune} together, it is possible to generate code that
21339 runs on a family of processors, but optimize the code for one
21340 particular member of that family.
21342 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
21343 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
21344 @option{-march} ones described above.
21348 Equivalent to @option{-march=mips1}.
21352 Equivalent to @option{-march=mips2}.
21356 Equivalent to @option{-march=mips3}.
21360 Equivalent to @option{-march=mips4}.
21364 Equivalent to @option{-march=mips32}.
21368 Equivalent to @option{-march=mips32r3}.
21372 Equivalent to @option{-march=mips32r5}.
21376 Equivalent to @option{-march=mips32r6}.
21380 Equivalent to @option{-march=mips64}.
21384 Equivalent to @option{-march=mips64r2}.
21388 Equivalent to @option{-march=mips64r3}.
21392 Equivalent to @option{-march=mips64r5}.
21396 Equivalent to @option{-march=mips64r6}.
21401 @opindex mno-mips16
21402 Generate (do not generate) MIPS16 code. If GCC is targeting a
21403 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
21405 MIPS16 code generation can also be controlled on a per-function basis
21406 by means of @code{mips16} and @code{nomips16} attributes.
21407 @xref{Function Attributes}, for more information.
21409 @item -mflip-mips16
21410 @opindex mflip-mips16
21411 Generate MIPS16 code on alternating functions. This option is provided
21412 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
21413 not intended for ordinary use in compiling user code.
21415 @item -minterlink-compressed
21416 @itemx -mno-interlink-compressed
21417 @opindex minterlink-compressed
21418 @opindex mno-interlink-compressed
21419 Require (do not require) that code using the standard (uncompressed) MIPS ISA
21420 be link-compatible with MIPS16 and microMIPS code, and vice versa.
21422 For example, code using the standard ISA encoding cannot jump directly
21423 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
21424 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
21425 knows that the target of the jump is not compressed.
21427 @item -minterlink-mips16
21428 @itemx -mno-interlink-mips16
21429 @opindex minterlink-mips16
21430 @opindex mno-interlink-mips16
21431 Aliases of @option{-minterlink-compressed} and
21432 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
21433 and are retained for backwards compatibility.
21445 Generate code for the given ABI@.
21447 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
21448 generates 64-bit code when you select a 64-bit architecture, but you
21449 can use @option{-mgp32} to get 32-bit code instead.
21451 For information about the O64 ABI, see
21452 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
21454 GCC supports a variant of the o32 ABI in which floating-point registers
21455 are 64 rather than 32 bits wide. You can select this combination with
21456 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
21457 and @code{mfhc1} instructions and is therefore only supported for
21458 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
21460 The register assignments for arguments and return values remain the
21461 same, but each scalar value is passed in a single 64-bit register
21462 rather than a pair of 32-bit registers. For example, scalar
21463 floating-point values are returned in @samp{$f0} only, not a
21464 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
21465 remains the same in that the even-numbered double-precision registers
21468 Two additional variants of the o32 ABI are supported to enable
21469 a transition from 32-bit to 64-bit registers. These are FPXX
21470 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
21471 The FPXX extension mandates that all code must execute correctly
21472 when run using 32-bit or 64-bit registers. The code can be interlinked
21473 with either FP32 or FP64, but not both.
21474 The FP64A extension is similar to the FP64 extension but forbids the
21475 use of odd-numbered single-precision registers. This can be used
21476 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
21477 processors and allows both FP32 and FP64A code to interlink and
21478 run in the same process without changing FPU modes.
21481 @itemx -mno-abicalls
21483 @opindex mno-abicalls
21484 Generate (do not generate) code that is suitable for SVR4-style
21485 dynamic objects. @option{-mabicalls} is the default for SVR4-based
21490 Generate (do not generate) code that is fully position-independent,
21491 and that can therefore be linked into shared libraries. This option
21492 only affects @option{-mabicalls}.
21494 All @option{-mabicalls} code has traditionally been position-independent,
21495 regardless of options like @option{-fPIC} and @option{-fpic}. However,
21496 as an extension, the GNU toolchain allows executables to use absolute
21497 accesses for locally-binding symbols. It can also use shorter GP
21498 initialization sequences and generate direct calls to locally-defined
21499 functions. This mode is selected by @option{-mno-shared}.
21501 @option{-mno-shared} depends on binutils 2.16 or higher and generates
21502 objects that can only be linked by the GNU linker. However, the option
21503 does not affect the ABI of the final executable; it only affects the ABI
21504 of relocatable objects. Using @option{-mno-shared} generally makes
21505 executables both smaller and quicker.
21507 @option{-mshared} is the default.
21513 Assume (do not assume) that the static and dynamic linkers
21514 support PLTs and copy relocations. This option only affects
21515 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
21516 has no effect without @option{-msym32}.
21518 You can make @option{-mplt} the default by configuring
21519 GCC with @option{--with-mips-plt}. The default is
21520 @option{-mno-plt} otherwise.
21526 Lift (do not lift) the usual restrictions on the size of the global
21529 GCC normally uses a single instruction to load values from the GOT@.
21530 While this is relatively efficient, it only works if the GOT
21531 is smaller than about 64k. Anything larger causes the linker
21532 to report an error such as:
21534 @cindex relocation truncated to fit (MIPS)
21536 relocation truncated to fit: R_MIPS_GOT16 foobar
21539 If this happens, you should recompile your code with @option{-mxgot}.
21540 This works with very large GOTs, although the code is also
21541 less efficient, since it takes three instructions to fetch the
21542 value of a global symbol.
21544 Note that some linkers can create multiple GOTs. If you have such a
21545 linker, you should only need to use @option{-mxgot} when a single object
21546 file accesses more than 64k's worth of GOT entries. Very few do.
21548 These options have no effect unless GCC is generating position
21553 Assume that general-purpose registers are 32 bits wide.
21557 Assume that general-purpose registers are 64 bits wide.
21561 Assume that floating-point registers are 32 bits wide.
21565 Assume that floating-point registers are 64 bits wide.
21569 Do not assume the width of floating-point registers.
21572 @opindex mhard-float
21573 Use floating-point coprocessor instructions.
21576 @opindex msoft-float
21577 Do not use floating-point coprocessor instructions. Implement
21578 floating-point calculations using library calls instead.
21582 Equivalent to @option{-msoft-float}, but additionally asserts that the
21583 program being compiled does not perform any floating-point operations.
21584 This option is presently supported only by some bare-metal MIPS
21585 configurations, where it may select a special set of libraries
21586 that lack all floating-point support (including, for example, the
21587 floating-point @code{printf} formats).
21588 If code compiled with @option{-mno-float} accidentally contains
21589 floating-point operations, it is likely to suffer a link-time
21590 or run-time failure.
21592 @item -msingle-float
21593 @opindex msingle-float
21594 Assume that the floating-point coprocessor only supports single-precision
21597 @item -mdouble-float
21598 @opindex mdouble-float
21599 Assume that the floating-point coprocessor supports double-precision
21600 operations. This is the default.
21603 @itemx -mno-odd-spreg
21604 @opindex modd-spreg
21605 @opindex mno-odd-spreg
21606 Enable the use of odd-numbered single-precision floating-point registers
21607 for the o32 ABI. This is the default for processors that are known to
21608 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
21612 @itemx -mabs=legacy
21614 @opindex mabs=legacy
21615 These options control the treatment of the special not-a-number (NaN)
21616 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
21617 @code{neg.@i{fmt}} machine instructions.
21619 By default or when @option{-mabs=legacy} is used the legacy
21620 treatment is selected. In this case these instructions are considered
21621 arithmetic and avoided where correct operation is required and the
21622 input operand might be a NaN. A longer sequence of instructions that
21623 manipulate the sign bit of floating-point datum manually is used
21624 instead unless the @option{-ffinite-math-only} option has also been
21627 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
21628 this case these instructions are considered non-arithmetic and therefore
21629 operating correctly in all cases, including in particular where the
21630 input operand is a NaN. These instructions are therefore always used
21631 for the respective operations.
21634 @itemx -mnan=legacy
21636 @opindex mnan=legacy
21637 These options control the encoding of the special not-a-number (NaN)
21638 IEEE 754 floating-point data.
21640 The @option{-mnan=legacy} option selects the legacy encoding. In this
21641 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
21642 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
21643 by the first bit of their trailing significand field being 1.
21645 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
21646 this case qNaNs are denoted by the first bit of their trailing
21647 significand field being 1, whereas sNaNs are denoted by the first bit of
21648 their trailing significand field being 0.
21650 The default is @option{-mnan=legacy} unless GCC has been configured with
21651 @option{--with-nan=2008}.
21657 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
21658 implement atomic memory built-in functions. When neither option is
21659 specified, GCC uses the instructions if the target architecture
21662 @option{-mllsc} is useful if the runtime environment can emulate the
21663 instructions and @option{-mno-llsc} can be useful when compiling for
21664 nonstandard ISAs. You can make either option the default by
21665 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
21666 respectively. @option{--with-llsc} is the default for some
21667 configurations; see the installation documentation for details.
21673 Use (do not use) revision 1 of the MIPS DSP ASE@.
21674 @xref{MIPS DSP Built-in Functions}. This option defines the
21675 preprocessor macro @code{__mips_dsp}. It also defines
21676 @code{__mips_dsp_rev} to 1.
21682 Use (do not use) revision 2 of the MIPS DSP ASE@.
21683 @xref{MIPS DSP Built-in Functions}. This option defines the
21684 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
21685 It also defines @code{__mips_dsp_rev} to 2.
21688 @itemx -mno-smartmips
21689 @opindex msmartmips
21690 @opindex mno-smartmips
21691 Use (do not use) the MIPS SmartMIPS ASE.
21693 @item -mpaired-single
21694 @itemx -mno-paired-single
21695 @opindex mpaired-single
21696 @opindex mno-paired-single
21697 Use (do not use) paired-single floating-point instructions.
21698 @xref{MIPS Paired-Single Support}. This option requires
21699 hardware floating-point support to be enabled.
21705 Use (do not use) MIPS Digital Media Extension instructions.
21706 This option can only be used when generating 64-bit code and requires
21707 hardware floating-point support to be enabled.
21712 @opindex mno-mips3d
21713 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
21714 The option @option{-mips3d} implies @option{-mpaired-single}.
21717 @itemx -mno-micromips
21718 @opindex mmicromips
21719 @opindex mno-mmicromips
21720 Generate (do not generate) microMIPS code.
21722 MicroMIPS code generation can also be controlled on a per-function basis
21723 by means of @code{micromips} and @code{nomicromips} attributes.
21724 @xref{Function Attributes}, for more information.
21730 Use (do not use) MT Multithreading instructions.
21736 Use (do not use) the MIPS MCU ASE instructions.
21742 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
21748 Use (do not use) the MIPS Virtualization (VZ) instructions.
21754 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
21760 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
21766 Use (do not use) the MIPS Global INValidate (GINV) instructions.
21768 @item -mloongson-mmi
21769 @itemx -mno-loongson-mmi
21770 @opindex mloongson-mmi
21771 @opindex mno-loongson-mmi
21772 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
21774 @item -mloongson-ext
21775 @itemx -mno-loongson-ext
21776 @opindex mloongson-ext
21777 @opindex mno-loongson-ext
21778 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
21780 @item -mloongson-ext2
21781 @itemx -mno-loongson-ext2
21782 @opindex mloongson-ext2
21783 @opindex mno-loongson-ext2
21784 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
21788 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
21789 an explanation of the default and the way that the pointer size is
21794 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
21796 The default size of @code{int}s, @code{long}s and pointers depends on
21797 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
21798 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
21799 32-bit @code{long}s. Pointers are the same size as @code{long}s,
21800 or the same size as integer registers, whichever is smaller.
21806 Assume (do not assume) that all symbols have 32-bit values, regardless
21807 of the selected ABI@. This option is useful in combination with
21808 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
21809 to generate shorter and faster references to symbolic addresses.
21813 Put definitions of externally-visible data in a small data section
21814 if that data is no bigger than @var{num} bytes. GCC can then generate
21815 more efficient accesses to the data; see @option{-mgpopt} for details.
21817 The default @option{-G} option depends on the configuration.
21819 @item -mlocal-sdata
21820 @itemx -mno-local-sdata
21821 @opindex mlocal-sdata
21822 @opindex mno-local-sdata
21823 Extend (do not extend) the @option{-G} behavior to local data too,
21824 such as to static variables in C@. @option{-mlocal-sdata} is the
21825 default for all configurations.
21827 If the linker complains that an application is using too much small data,
21828 you might want to try rebuilding the less performance-critical parts with
21829 @option{-mno-local-sdata}. You might also want to build large
21830 libraries with @option{-mno-local-sdata}, so that the libraries leave
21831 more room for the main program.
21833 @item -mextern-sdata
21834 @itemx -mno-extern-sdata
21835 @opindex mextern-sdata
21836 @opindex mno-extern-sdata
21837 Assume (do not assume) that externally-defined data is in
21838 a small data section if the size of that data is within the @option{-G} limit.
21839 @option{-mextern-sdata} is the default for all configurations.
21841 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
21842 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
21843 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
21844 is placed in a small data section. If @var{Var} is defined by another
21845 module, you must either compile that module with a high-enough
21846 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
21847 definition. If @var{Var} is common, you must link the application
21848 with a high-enough @option{-G} setting.
21850 The easiest way of satisfying these restrictions is to compile
21851 and link every module with the same @option{-G} option. However,
21852 you may wish to build a library that supports several different
21853 small data limits. You can do this by compiling the library with
21854 the highest supported @option{-G} setting and additionally using
21855 @option{-mno-extern-sdata} to stop the library from making assumptions
21856 about externally-defined data.
21862 Use (do not use) GP-relative accesses for symbols that are known to be
21863 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
21864 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
21867 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
21868 might not hold the value of @code{_gp}. For example, if the code is
21869 part of a library that might be used in a boot monitor, programs that
21870 call boot monitor routines pass an unknown value in @code{$gp}.
21871 (In such situations, the boot monitor itself is usually compiled
21872 with @option{-G0}.)
21874 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
21875 @option{-mno-extern-sdata}.
21877 @item -membedded-data
21878 @itemx -mno-embedded-data
21879 @opindex membedded-data
21880 @opindex mno-embedded-data
21881 Allocate variables to the read-only data section first if possible, then
21882 next in the small data section if possible, otherwise in data. This gives
21883 slightly slower code than the default, but reduces the amount of RAM required
21884 when executing, and thus may be preferred for some embedded systems.
21886 @item -muninit-const-in-rodata
21887 @itemx -mno-uninit-const-in-rodata
21888 @opindex muninit-const-in-rodata
21889 @opindex mno-uninit-const-in-rodata
21890 Put uninitialized @code{const} variables in the read-only data section.
21891 This option is only meaningful in conjunction with @option{-membedded-data}.
21893 @item -mcode-readable=@var{setting}
21894 @opindex mcode-readable
21895 Specify whether GCC may generate code that reads from executable sections.
21896 There are three possible settings:
21899 @item -mcode-readable=yes
21900 Instructions may freely access executable sections. This is the
21903 @item -mcode-readable=pcrel
21904 MIPS16 PC-relative load instructions can access executable sections,
21905 but other instructions must not do so. This option is useful on 4KSc
21906 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
21907 It is also useful on processors that can be configured to have a dual
21908 instruction/data SRAM interface and that, like the M4K, automatically
21909 redirect PC-relative loads to the instruction RAM.
21911 @item -mcode-readable=no
21912 Instructions must not access executable sections. This option can be
21913 useful on targets that are configured to have a dual instruction/data
21914 SRAM interface but that (unlike the M4K) do not automatically redirect
21915 PC-relative loads to the instruction RAM.
21918 @item -msplit-addresses
21919 @itemx -mno-split-addresses
21920 @opindex msplit-addresses
21921 @opindex mno-split-addresses
21922 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
21923 relocation operators. This option has been superseded by
21924 @option{-mexplicit-relocs} but is retained for backwards compatibility.
21926 @item -mexplicit-relocs
21927 @itemx -mno-explicit-relocs
21928 @opindex mexplicit-relocs
21929 @opindex mno-explicit-relocs
21930 Use (do not use) assembler relocation operators when dealing with symbolic
21931 addresses. The alternative, selected by @option{-mno-explicit-relocs},
21932 is to use assembler macros instead.
21934 @option{-mexplicit-relocs} is the default if GCC was configured
21935 to use an assembler that supports relocation operators.
21937 @item -mcheck-zero-division
21938 @itemx -mno-check-zero-division
21939 @opindex mcheck-zero-division
21940 @opindex mno-check-zero-division
21941 Trap (do not trap) on integer division by zero.
21943 The default is @option{-mcheck-zero-division}.
21945 @item -mdivide-traps
21946 @itemx -mdivide-breaks
21947 @opindex mdivide-traps
21948 @opindex mdivide-breaks
21949 MIPS systems check for division by zero by generating either a
21950 conditional trap or a break instruction. Using traps results in
21951 smaller code, but is only supported on MIPS II and later. Also, some
21952 versions of the Linux kernel have a bug that prevents trap from
21953 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
21954 allow conditional traps on architectures that support them and
21955 @option{-mdivide-breaks} to force the use of breaks.
21957 The default is usually @option{-mdivide-traps}, but this can be
21958 overridden at configure time using @option{--with-divide=breaks}.
21959 Divide-by-zero checks can be completely disabled using
21960 @option{-mno-check-zero-division}.
21962 @item -mload-store-pairs
21963 @itemx -mno-load-store-pairs
21964 @opindex mload-store-pairs
21965 @opindex mno-load-store-pairs
21966 Enable (disable) an optimization that pairs consecutive load or store
21967 instructions to enable load/store bonding. This option is enabled by
21968 default but only takes effect when the selected architecture is known
21969 to support bonding.
21974 @opindex mno-memcpy
21975 Force (do not force) the use of @code{memcpy} for non-trivial block
21976 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
21977 most constant-sized copies.
21980 @itemx -mno-long-calls
21981 @opindex mlong-calls
21982 @opindex mno-long-calls
21983 Disable (do not disable) use of the @code{jal} instruction. Calling
21984 functions using @code{jal} is more efficient but requires the caller
21985 and callee to be in the same 256 megabyte segment.
21987 This option has no effect on abicalls code. The default is
21988 @option{-mno-long-calls}.
21994 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
21995 instructions, as provided by the R4650 ISA@.
22001 Enable (disable) use of the @code{madd} and @code{msub} integer
22002 instructions. The default is @option{-mimadd} on architectures
22003 that support @code{madd} and @code{msub} except for the 74k
22004 architecture where it was found to generate slower code.
22007 @itemx -mno-fused-madd
22008 @opindex mfused-madd
22009 @opindex mno-fused-madd
22010 Enable (disable) use of the floating-point multiply-accumulate
22011 instructions, when they are available. The default is
22012 @option{-mfused-madd}.
22014 On the R8000 CPU when multiply-accumulate instructions are used,
22015 the intermediate product is calculated to infinite precision
22016 and is not subject to the FCSR Flush to Zero bit. This may be
22017 undesirable in some circumstances. On other processors the result
22018 is numerically identical to the equivalent computation using
22019 separate multiply, add, subtract and negate instructions.
22023 Tell the MIPS assembler to not run its preprocessor over user
22024 assembler files (with a @samp{.s} suffix) when assembling them.
22027 @itemx -mno-fix-24k
22029 @opindex mno-fix-24k
22030 Work around the 24K E48 (lost data on stores during refill) errata.
22031 The workarounds are implemented by the assembler rather than by GCC@.
22034 @itemx -mno-fix-r4000
22035 @opindex mfix-r4000
22036 @opindex mno-fix-r4000
22037 Work around certain R4000 CPU errata:
22040 A double-word or a variable shift may give an incorrect result if executed
22041 immediately after starting an integer division.
22043 A double-word or a variable shift may give an incorrect result if executed
22044 while an integer multiplication is in progress.
22046 An integer division may give an incorrect result if started in a delay slot
22047 of a taken branch or a jump.
22051 @itemx -mno-fix-r4400
22052 @opindex mfix-r4400
22053 @opindex mno-fix-r4400
22054 Work around certain R4400 CPU errata:
22057 A double-word or a variable shift may give an incorrect result if executed
22058 immediately after starting an integer division.
22062 @itemx -mno-fix-r10000
22063 @opindex mfix-r10000
22064 @opindex mno-fix-r10000
22065 Work around certain R10000 errata:
22068 @code{ll}/@code{sc} sequences may not behave atomically on revisions
22069 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22072 This option can only be used if the target architecture supports
22073 branch-likely instructions. @option{-mfix-r10000} is the default when
22074 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
22078 @itemx -mno-fix-rm7000
22079 @opindex mfix-rm7000
22080 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
22081 workarounds are implemented by the assembler rather than by GCC@.
22084 @itemx -mno-fix-vr4120
22085 @opindex mfix-vr4120
22086 Work around certain VR4120 errata:
22089 @code{dmultu} does not always produce the correct result.
22091 @code{div} and @code{ddiv} do not always produce the correct result if one
22092 of the operands is negative.
22094 The workarounds for the division errata rely on special functions in
22095 @file{libgcc.a}. At present, these functions are only provided by
22096 the @code{mips64vr*-elf} configurations.
22098 Other VR4120 errata require a NOP to be inserted between certain pairs of
22099 instructions. These errata are handled by the assembler, not by GCC itself.
22102 @opindex mfix-vr4130
22103 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
22104 workarounds are implemented by the assembler rather than by GCC,
22105 although GCC avoids using @code{mflo} and @code{mfhi} if the
22106 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
22107 instructions are available instead.
22110 @itemx -mno-fix-sb1
22112 Work around certain SB-1 CPU core errata.
22113 (This flag currently works around the SB-1 revision 2
22114 ``F1'' and ``F2'' floating-point errata.)
22116 @item -mr10k-cache-barrier=@var{setting}
22117 @opindex mr10k-cache-barrier
22118 Specify whether GCC should insert cache barriers to avoid the
22119 side effects of speculation on R10K processors.
22121 In common with many processors, the R10K tries to predict the outcome
22122 of a conditional branch and speculatively executes instructions from
22123 the ``taken'' branch. It later aborts these instructions if the
22124 predicted outcome is wrong. However, on the R10K, even aborted
22125 instructions can have side effects.
22127 This problem only affects kernel stores and, depending on the system,
22128 kernel loads. As an example, a speculatively-executed store may load
22129 the target memory into cache and mark the cache line as dirty, even if
22130 the store itself is later aborted. If a DMA operation writes to the
22131 same area of memory before the ``dirty'' line is flushed, the cached
22132 data overwrites the DMA-ed data. See the R10K processor manual
22133 for a full description, including other potential problems.
22135 One workaround is to insert cache barrier instructions before every memory
22136 access that might be speculatively executed and that might have side
22137 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
22138 controls GCC's implementation of this workaround. It assumes that
22139 aborted accesses to any byte in the following regions does not have
22144 the memory occupied by the current function's stack frame;
22147 the memory occupied by an incoming stack argument;
22150 the memory occupied by an object with a link-time-constant address.
22153 It is the kernel's responsibility to ensure that speculative
22154 accesses to these regions are indeed safe.
22156 If the input program contains a function declaration such as:
22162 then the implementation of @code{foo} must allow @code{j foo} and
22163 @code{jal foo} to be executed speculatively. GCC honors this
22164 restriction for functions it compiles itself. It expects non-GCC
22165 functions (such as hand-written assembly code) to do the same.
22167 The option has three forms:
22170 @item -mr10k-cache-barrier=load-store
22171 Insert a cache barrier before a load or store that might be
22172 speculatively executed and that might have side effects even
22175 @item -mr10k-cache-barrier=store
22176 Insert a cache barrier before a store that might be speculatively
22177 executed and that might have side effects even if aborted.
22179 @item -mr10k-cache-barrier=none
22180 Disable the insertion of cache barriers. This is the default setting.
22183 @item -mflush-func=@var{func}
22184 @itemx -mno-flush-func
22185 @opindex mflush-func
22186 Specifies the function to call to flush the I and D caches, or to not
22187 call any such function. If called, the function must take the same
22188 arguments as the common @code{_flush_func}, that is, the address of the
22189 memory range for which the cache is being flushed, the size of the
22190 memory range, and the number 3 (to flush both caches). The default
22191 depends on the target GCC was configured for, but commonly is either
22192 @code{_flush_func} or @code{__cpu_flush}.
22194 @item mbranch-cost=@var{num}
22195 @opindex mbranch-cost
22196 Set the cost of branches to roughly @var{num} ``simple'' instructions.
22197 This cost is only a heuristic and is not guaranteed to produce
22198 consistent results across releases. A zero cost redundantly selects
22199 the default, which is based on the @option{-mtune} setting.
22201 @item -mbranch-likely
22202 @itemx -mno-branch-likely
22203 @opindex mbranch-likely
22204 @opindex mno-branch-likely
22205 Enable or disable use of Branch Likely instructions, regardless of the
22206 default for the selected architecture. By default, Branch Likely
22207 instructions may be generated if they are supported by the selected
22208 architecture. An exception is for the MIPS32 and MIPS64 architectures
22209 and processors that implement those architectures; for those, Branch
22210 Likely instructions are not be generated by default because the MIPS32
22211 and MIPS64 architectures specifically deprecate their use.
22213 @item -mcompact-branches=never
22214 @itemx -mcompact-branches=optimal
22215 @itemx -mcompact-branches=always
22216 @opindex mcompact-branches=never
22217 @opindex mcompact-branches=optimal
22218 @opindex mcompact-branches=always
22219 These options control which form of branches will be generated. The
22220 default is @option{-mcompact-branches=optimal}.
22222 The @option{-mcompact-branches=never} option ensures that compact branch
22223 instructions will never be generated.
22225 The @option{-mcompact-branches=always} option ensures that a compact
22226 branch instruction will be generated if available. If a compact branch
22227 instruction is not available, a delay slot form of the branch will be
22230 This option is supported from MIPS Release 6 onwards.
22232 The @option{-mcompact-branches=optimal} option will cause a delay slot
22233 branch to be used if one is available in the current ISA and the delay
22234 slot is successfully filled. If the delay slot is not filled, a compact
22235 branch will be chosen if one is available.
22237 @item -mfp-exceptions
22238 @itemx -mno-fp-exceptions
22239 @opindex mfp-exceptions
22240 Specifies whether FP exceptions are enabled. This affects how
22241 FP instructions are scheduled for some processors.
22242 The default is that FP exceptions are
22245 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
22246 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
22249 @item -mvr4130-align
22250 @itemx -mno-vr4130-align
22251 @opindex mvr4130-align
22252 The VR4130 pipeline is two-way superscalar, but can only issue two
22253 instructions together if the first one is 8-byte aligned. When this
22254 option is enabled, GCC aligns pairs of instructions that it
22255 thinks should execute in parallel.
22257 This option only has an effect when optimizing for the VR4130.
22258 It normally makes code faster, but at the expense of making it bigger.
22259 It is enabled by default at optimization level @option{-O3}.
22264 Enable (disable) generation of @code{synci} instructions on
22265 architectures that support it. The @code{synci} instructions (if
22266 enabled) are generated when @code{__builtin___clear_cache} is
22269 This option defaults to @option{-mno-synci}, but the default can be
22270 overridden by configuring GCC with @option{--with-synci}.
22272 When compiling code for single processor systems, it is generally safe
22273 to use @code{synci}. However, on many multi-core (SMP) systems, it
22274 does not invalidate the instruction caches on all cores and may lead
22275 to undefined behavior.
22277 @item -mrelax-pic-calls
22278 @itemx -mno-relax-pic-calls
22279 @opindex mrelax-pic-calls
22280 Try to turn PIC calls that are normally dispatched via register
22281 @code{$25} into direct calls. This is only possible if the linker can
22282 resolve the destination at link time and if the destination is within
22283 range for a direct call.
22285 @option{-mrelax-pic-calls} is the default if GCC was configured to use
22286 an assembler and a linker that support the @code{.reloc} assembly
22287 directive and @option{-mexplicit-relocs} is in effect. With
22288 @option{-mno-explicit-relocs}, this optimization can be performed by the
22289 assembler and the linker alone without help from the compiler.
22291 @item -mmcount-ra-address
22292 @itemx -mno-mcount-ra-address
22293 @opindex mmcount-ra-address
22294 @opindex mno-mcount-ra-address
22295 Emit (do not emit) code that allows @code{_mcount} to modify the
22296 calling function's return address. When enabled, this option extends
22297 the usual @code{_mcount} interface with a new @var{ra-address}
22298 parameter, which has type @code{intptr_t *} and is passed in register
22299 @code{$12}. @code{_mcount} can then modify the return address by
22300 doing both of the following:
22303 Returning the new address in register @code{$31}.
22305 Storing the new address in @code{*@var{ra-address}},
22306 if @var{ra-address} is nonnull.
22309 The default is @option{-mno-mcount-ra-address}.
22311 @item -mframe-header-opt
22312 @itemx -mno-frame-header-opt
22313 @opindex mframe-header-opt
22314 Enable (disable) frame header optimization in the o32 ABI. When using the
22315 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
22316 function to write out register arguments. When enabled, this optimization
22317 will suppress the allocation of the frame header if it can be determined that
22320 This optimization is off by default at all optimization levels.
22323 @itemx -mno-lxc1-sxc1
22324 @opindex mlxc1-sxc1
22325 When applicable, enable (disable) the generation of @code{lwxc1},
22326 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
22331 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
22332 @code{madd.d} and related instructions. Enabled by default.
22337 @subsection MMIX Options
22338 @cindex MMIX Options
22340 These options are defined for the MMIX:
22344 @itemx -mno-libfuncs
22346 @opindex mno-libfuncs
22347 Specify that intrinsic library functions are being compiled, passing all
22348 values in registers, no matter the size.
22351 @itemx -mno-epsilon
22353 @opindex mno-epsilon
22354 Generate floating-point comparison instructions that compare with respect
22355 to the @code{rE} epsilon register.
22357 @item -mabi=mmixware
22359 @opindex mabi=mmixware
22361 Generate code that passes function parameters and return values that (in
22362 the called function) are seen as registers @code{$0} and up, as opposed to
22363 the GNU ABI which uses global registers @code{$231} and up.
22365 @item -mzero-extend
22366 @itemx -mno-zero-extend
22367 @opindex mzero-extend
22368 @opindex mno-zero-extend
22369 When reading data from memory in sizes shorter than 64 bits, use (do not
22370 use) zero-extending load instructions by default, rather than
22371 sign-extending ones.
22374 @itemx -mno-knuthdiv
22376 @opindex mno-knuthdiv
22377 Make the result of a division yielding a remainder have the same sign as
22378 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
22379 remainder follows the sign of the dividend. Both methods are
22380 arithmetically valid, the latter being almost exclusively used.
22382 @item -mtoplevel-symbols
22383 @itemx -mno-toplevel-symbols
22384 @opindex mtoplevel-symbols
22385 @opindex mno-toplevel-symbols
22386 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
22387 code can be used with the @code{PREFIX} assembly directive.
22391 Generate an executable in the ELF format, rather than the default
22392 @samp{mmo} format used by the @command{mmix} simulator.
22394 @item -mbranch-predict
22395 @itemx -mno-branch-predict
22396 @opindex mbranch-predict
22397 @opindex mno-branch-predict
22398 Use (do not use) the probable-branch instructions, when static branch
22399 prediction indicates a probable branch.
22401 @item -mbase-addresses
22402 @itemx -mno-base-addresses
22403 @opindex mbase-addresses
22404 @opindex mno-base-addresses
22405 Generate (do not generate) code that uses @emph{base addresses}. Using a
22406 base address automatically generates a request (handled by the assembler
22407 and the linker) for a constant to be set up in a global register. The
22408 register is used for one or more base address requests within the range 0
22409 to 255 from the value held in the register. The generally leads to short
22410 and fast code, but the number of different data items that can be
22411 addressed is limited. This means that a program that uses lots of static
22412 data may require @option{-mno-base-addresses}.
22414 @item -msingle-exit
22415 @itemx -mno-single-exit
22416 @opindex msingle-exit
22417 @opindex mno-single-exit
22418 Force (do not force) generated code to have a single exit point in each
22422 @node MN10300 Options
22423 @subsection MN10300 Options
22424 @cindex MN10300 options
22426 These @option{-m} options are defined for Matsushita MN10300 architectures:
22431 Generate code to avoid bugs in the multiply instructions for the MN10300
22432 processors. This is the default.
22434 @item -mno-mult-bug
22435 @opindex mno-mult-bug
22436 Do not generate code to avoid bugs in the multiply instructions for the
22437 MN10300 processors.
22441 Generate code using features specific to the AM33 processor.
22445 Do not generate code using features specific to the AM33 processor. This
22450 Generate code using features specific to the AM33/2.0 processor.
22454 Generate code using features specific to the AM34 processor.
22456 @item -mtune=@var{cpu-type}
22458 Use the timing characteristics of the indicated CPU type when
22459 scheduling instructions. This does not change the targeted processor
22460 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
22461 @samp{am33-2} or @samp{am34}.
22463 @item -mreturn-pointer-on-d0
22464 @opindex mreturn-pointer-on-d0
22465 When generating a function that returns a pointer, return the pointer
22466 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
22467 only in @code{a0}, and attempts to call such functions without a prototype
22468 result in errors. Note that this option is on by default; use
22469 @option{-mno-return-pointer-on-d0} to disable it.
22473 Do not link in the C run-time initialization object file.
22477 Indicate to the linker that it should perform a relaxation optimization pass
22478 to shorten branches, calls and absolute memory addresses. This option only
22479 has an effect when used on the command line for the final link step.
22481 This option makes symbolic debugging impossible.
22485 Allow the compiler to generate @emph{Long Instruction Word}
22486 instructions if the target is the @samp{AM33} or later. This is the
22487 default. This option defines the preprocessor macro @code{__LIW__}.
22491 Do not allow the compiler to generate @emph{Long Instruction Word}
22492 instructions. This option defines the preprocessor macro
22497 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
22498 instructions if the target is the @samp{AM33} or later. This is the
22499 default. This option defines the preprocessor macro @code{__SETLB__}.
22503 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
22504 instructions. This option defines the preprocessor macro
22505 @code{__NO_SETLB__}.
22509 @node Moxie Options
22510 @subsection Moxie Options
22511 @cindex Moxie Options
22517 Generate big-endian code. This is the default for @samp{moxie-*-*}
22522 Generate little-endian code.
22526 Generate mul.x and umul.x instructions. This is the default for
22527 @samp{moxiebox-*-*} configurations.
22531 Do not link in the C run-time initialization object file.
22535 @node MSP430 Options
22536 @subsection MSP430 Options
22537 @cindex MSP430 Options
22539 These options are defined for the MSP430:
22545 Force assembly output to always use hex constants. Normally such
22546 constants are signed decimals, but this option is available for
22547 testsuite and/or aesthetic purposes.
22551 Select the MCU to target. This is used to create a C preprocessor
22552 symbol based upon the MCU name, converted to upper case and pre- and
22553 post-fixed with @samp{__}. This in turn is used by the
22554 @file{msp430.h} header file to select an MCU-specific supplementary
22557 The option also sets the ISA to use. If the MCU name is one that is
22558 known to only support the 430 ISA then that is selected, otherwise the
22559 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
22560 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
22561 name selects the 430X ISA.
22563 In addition an MCU-specific linker script is added to the linker
22564 command line. The script's name is the name of the MCU with
22565 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
22566 command line defines the C preprocessor symbol @code{__XXX__} and
22567 cause the linker to search for a script called @file{xxx.ld}.
22569 This option is also passed on to the assembler.
22572 @itemx -mno-warn-mcu
22574 @opindex mno-warn-mcu
22575 This option enables or disables warnings about conflicts between the
22576 MCU name specified by the @option{-mmcu} option and the ISA set by the
22577 @option{-mcpu} option and/or the hardware multiply support set by the
22578 @option{-mhwmult} option. It also toggles warnings about unrecognized
22579 MCU names. This option is on by default.
22583 Specifies the ISA to use. Accepted values are @samp{msp430},
22584 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
22585 @option{-mmcu=} option should be used to select the ISA.
22589 Link to the simulator runtime libraries and linker script. Overrides
22590 any scripts that would be selected by the @option{-mmcu=} option.
22594 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
22598 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
22602 This option is passed to the assembler and linker, and allows the
22603 linker to perform certain optimizations that cannot be done until
22608 Describes the type of hardware multiply supported by the target.
22609 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
22610 for the original 16-bit-only multiply supported by early MCUs.
22611 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
22612 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
22613 A value of @samp{auto} can also be given. This tells GCC to deduce
22614 the hardware multiply support based upon the MCU name provided by the
22615 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
22616 the MCU name is not recognized then no hardware multiply support is
22617 assumed. @code{auto} is the default setting.
22619 Hardware multiplies are normally performed by calling a library
22620 routine. This saves space in the generated code. When compiling at
22621 @option{-O3} or higher however the hardware multiplier is invoked
22622 inline. This makes for bigger, but faster code.
22624 The hardware multiply routines disable interrupts whilst running and
22625 restore the previous interrupt state when they finish. This makes
22626 them safe to use inside interrupt handlers as well as in normal code.
22630 Enable the use of a minimum runtime environment - no static
22631 initializers or constructors. This is intended for memory-constrained
22632 devices. The compiler includes special symbols in some objects
22633 that tell the linker and runtime which code fragments are required.
22635 @item -mcode-region=
22636 @itemx -mdata-region=
22637 @opindex mcode-region
22638 @opindex mdata-region
22639 These options tell the compiler where to place functions and data that
22640 do not have one of the @code{lower}, @code{upper}, @code{either} or
22641 @code{section} attributes. Possible values are @code{lower},
22642 @code{upper}, @code{either} or @code{any}. The first three behave
22643 like the corresponding attribute. The fourth possible value -
22644 @code{any} - is the default. It leaves placement entirely up to the
22645 linker script and how it assigns the standard sections
22646 (@code{.text}, @code{.data}, etc) to the memory regions.
22648 @item -msilicon-errata=
22649 @opindex msilicon-errata
22650 This option passes on a request to assembler to enable the fixes for
22651 the named silicon errata.
22653 @item -msilicon-errata-warn=
22654 @opindex msilicon-errata-warn
22655 This option passes on a request to the assembler to enable warning
22656 messages when a silicon errata might need to be applied.
22660 @node NDS32 Options
22661 @subsection NDS32 Options
22662 @cindex NDS32 Options
22664 These options are defined for NDS32 implementations:
22669 @opindex mbig-endian
22670 Generate code in big-endian mode.
22672 @item -mlittle-endian
22673 @opindex mlittle-endian
22674 Generate code in little-endian mode.
22676 @item -mreduced-regs
22677 @opindex mreduced-regs
22678 Use reduced-set registers for register allocation.
22681 @opindex mfull-regs
22682 Use full-set registers for register allocation.
22686 Generate conditional move instructions.
22690 Do not generate conditional move instructions.
22694 Generate performance extension instructions.
22696 @item -mno-ext-perf
22697 @opindex mno-ext-perf
22698 Do not generate performance extension instructions.
22701 @opindex mext-perf2
22702 Generate performance extension 2 instructions.
22704 @item -mno-ext-perf2
22705 @opindex mno-ext-perf2
22706 Do not generate performance extension 2 instructions.
22709 @opindex mext-string
22710 Generate string extension instructions.
22712 @item -mno-ext-string
22713 @opindex mno-ext-string
22714 Do not generate string extension instructions.
22718 Generate v3 push25/pop25 instructions.
22721 @opindex mno-v3push
22722 Do not generate v3 push25/pop25 instructions.
22726 Generate 16-bit instructions.
22729 @opindex mno-16-bit
22730 Do not generate 16-bit instructions.
22732 @item -misr-vector-size=@var{num}
22733 @opindex misr-vector-size
22734 Specify the size of each interrupt vector, which must be 4 or 16.
22736 @item -mcache-block-size=@var{num}
22737 @opindex mcache-block-size
22738 Specify the size of each cache block,
22739 which must be a power of 2 between 4 and 512.
22741 @item -march=@var{arch}
22743 Specify the name of the target architecture.
22745 @item -mcmodel=@var{code-model}
22747 Set the code model to one of
22750 All the data and read-only data segments must be within 512KB addressing space.
22751 The text segment must be within 16MB addressing space.
22752 @item @samp{medium}
22753 The data segment must be within 512KB while the read-only data segment can be
22754 within 4GB addressing space. The text segment should be still within 16MB
22757 All the text and data segments can be within 4GB addressing space.
22761 @opindex mctor-dtor
22762 Enable constructor/destructor feature.
22766 Guide linker to relax instructions.
22770 @node Nios II Options
22771 @subsection Nios II Options
22772 @cindex Nios II options
22773 @cindex Altera Nios II options
22775 These are the options defined for the Altera Nios II processor.
22781 @cindex smaller data references
22782 Put global and static objects less than or equal to @var{num} bytes
22783 into the small data or BSS sections instead of the normal data or BSS
22784 sections. The default value of @var{num} is 8.
22786 @item -mgpopt=@var{option}
22791 Generate (do not generate) GP-relative accesses. The following
22792 @var{option} names are recognized:
22797 Do not generate GP-relative accesses.
22800 Generate GP-relative accesses for small data objects that are not
22801 external, weak, or uninitialized common symbols.
22802 Also use GP-relative addressing for objects that
22803 have been explicitly placed in a small data section via a @code{section}
22807 As for @samp{local}, but also generate GP-relative accesses for
22808 small data objects that are external, weak, or common. If you use this option,
22809 you must ensure that all parts of your program (including libraries) are
22810 compiled with the same @option{-G} setting.
22813 Generate GP-relative accesses for all data objects in the program. If you
22814 use this option, the entire data and BSS segments
22815 of your program must fit in 64K of memory and you must use an appropriate
22816 linker script to allocate them within the addressable range of the
22820 Generate GP-relative addresses for function pointers as well as data
22821 pointers. If you use this option, the entire text, 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
22828 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
22829 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
22831 The default is @option{-mgpopt} except when @option{-fpic} or
22832 @option{-fPIC} is specified to generate position-independent code.
22833 Note that the Nios II ABI does not permit GP-relative accesses from
22836 You may need to specify @option{-mno-gpopt} explicitly when building
22837 programs that include large amounts of small data, including large
22838 GOT data sections. In this case, the 16-bit offset for GP-relative
22839 addressing may not be large enough to allow access to the entire
22840 small data section.
22842 @item -mgprel-sec=@var{regexp}
22843 @opindex mgprel-sec
22844 This option specifies additional section names that can be accessed via
22845 GP-relative addressing. It is most useful in conjunction with
22846 @code{section} attributes on variable declarations
22847 (@pxref{Common Variable Attributes}) and a custom linker script.
22848 The @var{regexp} is a POSIX Extended Regular Expression.
22850 This option does not affect the behavior of the @option{-G} option, and
22851 the specified sections are in addition to the standard @code{.sdata}
22852 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
22854 @item -mr0rel-sec=@var{regexp}
22855 @opindex mr0rel-sec
22856 This option specifies names of sections that can be accessed via a
22857 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
22858 of the 32-bit address space. It is most useful in conjunction with
22859 @code{section} attributes on variable declarations
22860 (@pxref{Common Variable Attributes}) and a custom linker script.
22861 The @var{regexp} is a POSIX Extended Regular Expression.
22863 In contrast to the use of GP-relative addressing for small data,
22864 zero-based addressing is never generated by default and there are no
22865 conventional section names used in standard linker scripts for sections
22866 in the low or high areas of memory.
22872 Generate little-endian (default) or big-endian (experimental) code,
22875 @item -march=@var{arch}
22877 This specifies the name of the target Nios II architecture. GCC uses this
22878 name to determine what kind of instructions it can emit when generating
22879 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
22881 The preprocessor macro @code{__nios2_arch__} is available to programs,
22882 with value 1 or 2, indicating the targeted ISA level.
22884 @item -mbypass-cache
22885 @itemx -mno-bypass-cache
22886 @opindex mno-bypass-cache
22887 @opindex mbypass-cache
22888 Force all load and store instructions to always bypass cache by
22889 using I/O variants of the instructions. The default is not to
22892 @item -mno-cache-volatile
22893 @itemx -mcache-volatile
22894 @opindex mcache-volatile
22895 @opindex mno-cache-volatile
22896 Volatile memory access bypass the cache using the I/O variants of
22897 the load and store instructions. The default is not to bypass the cache.
22899 @item -mno-fast-sw-div
22900 @itemx -mfast-sw-div
22901 @opindex mno-fast-sw-div
22902 @opindex mfast-sw-div
22903 Do not use table-based fast divide for small numbers. The default
22904 is to use the fast divide at @option{-O3} and above.
22908 @itemx -mno-hw-mulx
22912 @opindex mno-hw-mul
22914 @opindex mno-hw-mulx
22916 @opindex mno-hw-div
22918 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
22919 instructions by the compiler. The default is to emit @code{mul}
22920 and not emit @code{div} and @code{mulx}.
22926 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
22927 CDX (code density) instructions. Enabling these instructions also
22928 requires @option{-march=r2}. Since these instructions are optional
22929 extensions to the R2 architecture, the default is not to emit them.
22931 @item -mcustom-@var{insn}=@var{N}
22932 @itemx -mno-custom-@var{insn}
22933 @opindex mcustom-@var{insn}
22934 @opindex mno-custom-@var{insn}
22935 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
22936 custom instruction with encoding @var{N} when generating code that uses
22937 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
22938 instruction 253 for single-precision floating-point add operations instead
22939 of the default behavior of using a library call.
22941 The following values of @var{insn} are supported. Except as otherwise
22942 noted, floating-point operations are expected to be implemented with
22943 normal IEEE 754 semantics and correspond directly to the C operators or the
22944 equivalent GCC built-in functions (@pxref{Other Builtins}).
22946 Single-precision floating point:
22949 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
22950 Binary arithmetic operations.
22956 Unary absolute value.
22958 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
22959 Comparison operations.
22961 @item @samp{fmins}, @samp{fmaxs}
22962 Floating-point minimum and maximum. These instructions are only
22963 generated if @option{-ffinite-math-only} is specified.
22965 @item @samp{fsqrts}
22966 Unary square root operation.
22968 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
22969 Floating-point trigonometric and exponential functions. These instructions
22970 are only generated if @option{-funsafe-math-optimizations} is also specified.
22974 Double-precision floating point:
22977 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
22978 Binary arithmetic operations.
22984 Unary absolute value.
22986 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
22987 Comparison operations.
22989 @item @samp{fmind}, @samp{fmaxd}
22990 Double-precision minimum and maximum. These instructions are only
22991 generated if @option{-ffinite-math-only} is specified.
22993 @item @samp{fsqrtd}
22994 Unary square root operation.
22996 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
22997 Double-precision trigonometric and exponential functions. These instructions
22998 are only generated if @option{-funsafe-math-optimizations} is also specified.
23004 @item @samp{fextsd}
23005 Conversion from single precision to double precision.
23007 @item @samp{ftruncds}
23008 Conversion from double precision to single precision.
23010 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
23011 Conversion from floating point to signed or unsigned integer types, with
23012 truncation towards zero.
23015 Conversion from single-precision floating point to signed integer,
23016 rounding to the nearest integer and ties away from zero.
23017 This corresponds to the @code{__builtin_lroundf} function when
23018 @option{-fno-math-errno} is used.
23020 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
23021 Conversion from signed or unsigned integer types to floating-point types.
23025 In addition, all of the following transfer instructions for internal
23026 registers X and Y must be provided to use any of the double-precision
23027 floating-point instructions. Custom instructions taking two
23028 double-precision source operands expect the first operand in the
23029 64-bit register X. The other operand (or only operand of a unary
23030 operation) is given to the custom arithmetic instruction with the
23031 least significant half in source register @var{src1} and the most
23032 significant half in @var{src2}. A custom instruction that returns a
23033 double-precision result returns the most significant 32 bits in the
23034 destination register and the other half in 32-bit register Y.
23035 GCC automatically generates the necessary code sequences to write
23036 register X and/or read register Y when double-precision floating-point
23037 instructions are used.
23042 Write @var{src1} into the least significant half of X and @var{src2} into
23043 the most significant half of X.
23046 Write @var{src1} into Y.
23048 @item @samp{frdxhi}, @samp{frdxlo}
23049 Read the most or least (respectively) significant half of X and store it in
23053 Read the value of Y and store it into @var{dest}.
23056 Note that you can gain more local control over generation of Nios II custom
23057 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
23058 and @code{target("no-custom-@var{insn}")} function attributes
23059 (@pxref{Function Attributes})
23060 or pragmas (@pxref{Function Specific Option Pragmas}).
23062 @item -mcustom-fpu-cfg=@var{name}
23063 @opindex mcustom-fpu-cfg
23065 This option enables a predefined, named set of custom instruction encodings
23066 (see @option{-mcustom-@var{insn}} above).
23067 Currently, the following sets are defined:
23069 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
23070 @gccoptlist{-mcustom-fmuls=252 @gol
23071 -mcustom-fadds=253 @gol
23072 -mcustom-fsubs=254 @gol
23073 -fsingle-precision-constant}
23075 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
23076 @gccoptlist{-mcustom-fmuls=252 @gol
23077 -mcustom-fadds=253 @gol
23078 -mcustom-fsubs=254 @gol
23079 -mcustom-fdivs=255 @gol
23080 -fsingle-precision-constant}
23082 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
23083 @gccoptlist{-mcustom-floatus=243 @gol
23084 -mcustom-fixsi=244 @gol
23085 -mcustom-floatis=245 @gol
23086 -mcustom-fcmpgts=246 @gol
23087 -mcustom-fcmples=249 @gol
23088 -mcustom-fcmpeqs=250 @gol
23089 -mcustom-fcmpnes=251 @gol
23090 -mcustom-fmuls=252 @gol
23091 -mcustom-fadds=253 @gol
23092 -mcustom-fsubs=254 @gol
23093 -mcustom-fdivs=255 @gol
23094 -fsingle-precision-constant}
23096 Custom instruction assignments given by individual
23097 @option{-mcustom-@var{insn}=} options override those given by
23098 @option{-mcustom-fpu-cfg=}, regardless of the
23099 order of the options on the command line.
23101 Note that you can gain more local control over selection of a FPU
23102 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
23103 function attribute (@pxref{Function Attributes})
23104 or pragma (@pxref{Function Specific Option Pragmas}).
23108 These additional @samp{-m} options are available for the Altera Nios II
23109 ELF (bare-metal) target:
23115 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
23116 startup and termination code, and is typically used in conjunction with
23117 @option{-msys-crt0=} to specify the location of the alternate startup code
23118 provided by the HAL BSP.
23122 Link with a limited version of the C library, @option{-lsmallc}, rather than
23125 @item -msys-crt0=@var{startfile}
23127 @var{startfile} is the file name of the startfile (crt0) to use
23128 when linking. This option is only useful in conjunction with @option{-mhal}.
23130 @item -msys-lib=@var{systemlib}
23132 @var{systemlib} is the library name of the library that provides
23133 low-level system calls required by the C library,
23134 e.g.@: @code{read} and @code{write}.
23135 This option is typically used to link with a library provided by a HAL BSP.
23139 @node Nvidia PTX Options
23140 @subsection Nvidia PTX Options
23141 @cindex Nvidia PTX options
23142 @cindex nvptx options
23144 These options are defined for Nvidia PTX:
23152 Generate code for 32-bit or 64-bit ABI.
23154 @item -misa=@var{ISA-string}
23156 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
23157 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
23158 @samp{sm_35}. The default ISA is sm_30.
23161 @opindex mmainkernel
23162 Link in code for a __main kernel. This is for stand-alone instead of
23163 offloading execution.
23167 Apply partitioned execution optimizations. This is the default when any
23168 level of optimization is selected.
23171 @opindex msoft-stack
23172 Generate code that does not use @code{.local} memory
23173 directly for stack storage. Instead, a per-warp stack pointer is
23174 maintained explicitly. This enables variable-length stack allocation (with
23175 variable-length arrays or @code{alloca}), and when global memory is used for
23176 underlying storage, makes it possible to access automatic variables from other
23177 threads, or with atomic instructions. This code generation variant is used
23178 for OpenMP offloading, but the option is exposed on its own for the purpose
23179 of testing the compiler; to generate code suitable for linking into programs
23180 using OpenMP offloading, use option @option{-mgomp}.
23182 @item -muniform-simt
23183 @opindex muniform-simt
23184 Switch to code generation variant that allows to execute all threads in each
23185 warp, while maintaining memory state and side effects as if only one thread
23186 in each warp was active outside of OpenMP SIMD regions. All atomic operations
23187 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
23188 current lane index equals the master lane index), and the register being
23189 assigned is copied via a shuffle instruction from the master lane. Outside of
23190 SIMD regions lane 0 is the master; inside, each thread sees itself as the
23191 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
23192 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
23193 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
23194 with current lane index to compute the master lane index.
23198 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
23199 @option{-muniform-simt} options, and selects corresponding multilib variant.
23203 @node OpenRISC Options
23204 @subsection OpenRISC Options
23205 @cindex OpenRISC Options
23207 These options are defined for OpenRISC:
23211 @item -mboard=@var{name}
23213 Configure a board specific runtime. This will be passed to the linker for
23214 newlib board library linking. The default is @code{or1ksim}.
23218 For compatibility, it's always newlib for elf now.
23222 Generate code for hardware which supports divide instructions. This is the
23227 Generate code for hardware which supports multiply instructions. This is the
23232 Generate code for hardware which supports the conditional move (@code{l.cmov})
23237 Generate code for hardware which supports rotate right instructions.
23241 Generate code for hardware which supports sign-extension instructions.
23245 Generate code for hardware which supports set flag immediate (@code{l.sf*i})
23250 Generate code for hardware which supports shift immediate related instructions
23251 (i.e. @code{l.srai}, @code{l.srli}, @code{l.slli}, @code{1.rori}). Note, to
23252 enable generation of the @code{l.rori} instruction the @option{-mror} flag must
23257 Generate code for hardware which requires divide instruction emulation.
23261 Generate code for hardware which requires multiply instruction emulation.
23265 @node PDP-11 Options
23266 @subsection PDP-11 Options
23267 @cindex PDP-11 Options
23269 These options are defined for the PDP-11:
23274 Use hardware FPP floating point. This is the default. (FIS floating
23275 point on the PDP-11/40 is not supported.) Implies -m45.
23278 @opindex msoft-float
23279 Do not use hardware floating point.
23283 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
23287 Return floating-point results in memory. This is the default.
23291 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
23295 Generate code for a PDP-11/45. This is the default.
23299 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
23305 Use 16-bit @code{int}. This is the default.
23311 Use 32-bit @code{int}.
23315 Target has split instruction and data space. Implies -m45.
23319 Use Unix assembler syntax.
23323 Use DEC assembler syntax.
23327 Use GNU assembler syntax. This is the default.
23331 Use the new LRA register allocator. By default, the old ``reload''
23335 @node picoChip Options
23336 @subsection picoChip Options
23337 @cindex picoChip options
23339 These @samp{-m} options are defined for picoChip implementations:
23343 @item -mae=@var{ae_type}
23345 Set the instruction set, register set, and instruction scheduling
23346 parameters for array element type @var{ae_type}. Supported values
23347 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
23349 @option{-mae=ANY} selects a completely generic AE type. Code
23350 generated with this option runs on any of the other AE types. The
23351 code is not as efficient as it would be if compiled for a specific
23352 AE type, and some types of operation (e.g., multiplication) do not
23353 work properly on all types of AE.
23355 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
23356 for compiled code, and is the default.
23358 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
23359 option may suffer from poor performance of byte (char) manipulation,
23360 since the DSP AE does not provide hardware support for byte load/stores.
23362 @item -msymbol-as-address
23363 Enable the compiler to directly use a symbol name as an address in a
23364 load/store instruction, without first loading it into a
23365 register. Typically, the use of this option generates larger
23366 programs, which run faster than when the option isn't used. However, the
23367 results vary from program to program, so it is left as a user option,
23368 rather than being permanently enabled.
23370 @item -mno-inefficient-warnings
23371 Disables warnings about the generation of inefficient code. These
23372 warnings can be generated, for example, when compiling code that
23373 performs byte-level memory operations on the MAC AE type. The MAC AE has
23374 no hardware support for byte-level memory operations, so all byte
23375 load/stores must be synthesized from word load/store operations. This is
23376 inefficient and a warning is generated to indicate
23377 that you should rewrite the code to avoid byte operations, or to target
23378 an AE type that has the necessary hardware support. This option disables
23383 @node PowerPC Options
23384 @subsection PowerPC Options
23385 @cindex PowerPC options
23387 These are listed under @xref{RS/6000 and PowerPC Options}.
23389 @node PowerPC SPE Options
23390 @subsection PowerPC SPE Options
23391 @cindex PowerPC SPE options
23393 These @samp{-m} options are defined for PowerPC SPE:
23398 @itemx -mno-popcntb
23402 @opindex mno-popcntb
23403 You use these options to specify which instructions are available on the
23404 processor you are using. The default value of these options is
23405 determined when configuring GCC@. Specifying the
23406 @option{-mcpu=@var{cpu_type}} overrides the specification of these
23407 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
23408 rather than the options listed above.
23410 The @option{-mmfcrf} option allows GCC to generate the move from
23411 condition register field instruction implemented on the POWER4
23412 processor and other processors that support the PowerPC V2.01
23414 The @option{-mpopcntb} option allows GCC to generate the popcount and
23415 double-precision FP reciprocal estimate instruction implemented on the
23416 POWER5 processor and other processors that support the PowerPC V2.02
23419 @item -mcpu=@var{cpu_type}
23421 Set architecture type, register usage, and
23422 instruction scheduling parameters for machine type @var{cpu_type}.
23423 Supported values for @var{cpu_type} are @samp{8540}, @samp{8548},
23426 @option{-mcpu=powerpc} specifies pure 32-bit PowerPC (either
23427 endian), with an appropriate, generic processor model assumed for
23428 scheduling purposes.
23430 Specifying @samp{native} as cpu type detects and selects the
23431 architecture option that corresponds to the host processor of the
23432 system performing the compilation.
23433 @option{-mcpu=native} has no effect if GCC does not recognize the
23436 The other options specify a specific processor. Code generated under
23437 those options runs best on that processor, and may not run at all on
23440 The @option{-mcpu} options automatically enable or disable the
23443 @gccoptlist{-mhard-float -mmfcrf -mmultiple @gol
23444 -mpopcntb -mpopcntd @gol
23445 -msingle-float -mdouble-float @gol
23448 The particular options set for any particular CPU varies between
23449 compiler versions, depending on what setting seems to produce optimal
23450 code for that CPU; it doesn't necessarily reflect the actual hardware's
23451 capabilities. If you wish to set an individual option to a particular
23452 value, you may specify it after the @option{-mcpu} option, like
23453 @option{-mcpu=8548}.
23455 @item -mtune=@var{cpu_type}
23457 Set the instruction scheduling parameters for machine type
23458 @var{cpu_type}, but do not set the architecture type or register usage,
23459 as @option{-mcpu=@var{cpu_type}} does. The same
23460 values for @var{cpu_type} are used for @option{-mtune} as for
23461 @option{-mcpu}. If both are specified, the code generated uses the
23462 architecture and registers set by @option{-mcpu}, but the
23463 scheduling parameters set by @option{-mtune}.
23466 @opindex msecure-plt
23467 Generate code that allows @command{ld} and @command{ld.so}
23468 to build executables and shared
23469 libraries with non-executable @code{.plt} and @code{.got} sections.
23471 32-bit SYSV ABI option.
23475 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
23477 requires @code{.plt} and @code{.got}
23478 sections that are both writable and executable.
23479 This is a PowerPC 32-bit SYSV ABI option.
23485 This switch enables or disables the generation of ISEL instructions.
23487 @item -misel=@var{yes/no}
23488 This switch has been deprecated. Use @option{-misel} and
23489 @option{-mno-isel} instead.
23495 This switch enables or disables the generation of SPE simd
23498 @item -mspe=@var{yes/no}
23499 This option has been deprecated. Use @option{-mspe} and
23500 @option{-mno-spe} instead.
23503 @itemx -mno-float128
23505 @opindex mno-float128
23506 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
23507 and use either software emulation for IEEE 128-bit floating point or
23508 hardware instructions.
23510 @item -mfloat-gprs=@var{yes/single/double/no}
23511 @itemx -mfloat-gprs
23512 @opindex mfloat-gprs
23513 This switch enables or disables the generation of floating-point
23514 operations on the general-purpose registers for architectures that
23517 The argument @samp{yes} or @samp{single} enables the use of
23518 single-precision floating-point operations.
23520 The argument @samp{double} enables the use of single and
23521 double-precision floating-point operations.
23523 The argument @samp{no} disables floating-point operations on the
23524 general-purpose registers.
23526 This option is currently only available on the MPC854x.
23529 @itemx -mno-fp-in-toc
23530 @itemx -mno-sum-in-toc
23531 @itemx -mminimal-toc
23533 @opindex mno-fp-in-toc
23534 @opindex mno-sum-in-toc
23535 @opindex mminimal-toc
23536 Modify generation of the TOC (Table Of Contents), which is created for
23537 every executable file. The @option{-mfull-toc} option is selected by
23538 default. In that case, GCC allocates at least one TOC entry for
23539 each unique non-automatic variable reference in your program. GCC
23540 also places floating-point constants in the TOC@. However, only
23541 16,384 entries are available in the TOC@.
23543 If you receive a linker error message that saying you have overflowed
23544 the available TOC space, you can reduce the amount of TOC space used
23545 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
23546 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
23547 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
23548 generate code to calculate the sum of an address and a constant at
23549 run time instead of putting that sum into the TOC@. You may specify one
23550 or both of these options. Each causes GCC to produce very slightly
23551 slower and larger code at the expense of conserving TOC space.
23553 If you still run out of space in the TOC even when you specify both of
23554 these options, specify @option{-mminimal-toc} instead. This option causes
23555 GCC to make only one TOC entry for every file. When you specify this
23556 option, GCC produces code that is slower and larger but which
23557 uses extremely little TOC space. You may wish to use this option
23558 only on files that contain less frequently-executed code.
23562 Disables the 64-bit ABI. GCC defaults to @option{-maix32}.
23565 @itemx -mno-xl-compat
23566 @opindex mxl-compat
23567 @opindex mno-xl-compat
23568 Produce code that conforms more closely to IBM XL compiler semantics
23569 when using AIX-compatible ABI@. Pass floating-point arguments to
23570 prototyped functions beyond the register save area (RSA) on the stack
23571 in addition to argument FPRs. Do not assume that most significant
23572 double in 128-bit long double value is properly rounded when comparing
23573 values and converting to double. Use XL symbol names for long double
23576 The AIX calling convention was extended but not initially documented to
23577 handle an obscure K&R C case of calling a function that takes the
23578 address of its arguments with fewer arguments than declared. IBM XL
23579 compilers access floating-point arguments that do not fit in the
23580 RSA from the stack when a subroutine is compiled without
23581 optimization. Because always storing floating-point arguments on the
23582 stack is inefficient and rarely needed, this option is not enabled by
23583 default and only is necessary when calling subroutines compiled by IBM
23584 XL compilers without optimization.
23586 @item -malign-natural
23587 @itemx -malign-power
23588 @opindex malign-natural
23589 @opindex malign-power
23590 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
23591 @option{-malign-natural} overrides the ABI-defined alignment of larger
23592 types, such as floating-point doubles, on their natural size-based boundary.
23593 The option @option{-malign-power} instructs GCC to follow the ABI-specified
23594 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
23596 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
23600 @itemx -mhard-float
23601 @opindex msoft-float
23602 @opindex mhard-float
23603 Generate code that does not use (uses) the floating-point register set.
23604 Software floating-point emulation is provided if you use the
23605 @option{-msoft-float} option, and pass the option to GCC when linking.
23607 @item -msingle-float
23608 @itemx -mdouble-float
23609 @opindex msingle-float
23610 @opindex mdouble-float
23611 Generate code for single- or double-precision floating-point operations.
23612 @option{-mdouble-float} implies @option{-msingle-float}.
23615 @itemx -mno-multiple
23617 @opindex mno-multiple
23618 Generate code that uses (does not use) the load multiple word
23619 instructions and the store multiple word instructions. These
23620 instructions are generated by default on POWER systems, and not
23621 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
23622 PowerPC systems, since those instructions do not work when the
23623 processor is in little-endian mode. The exceptions are PPC740 and
23624 PPC750 which permit these instructions in little-endian mode.
23629 @opindex mno-update
23630 Generate code that uses (does not use) the load or store instructions
23631 that update the base register to the address of the calculated memory
23632 location. These instructions are generated by default. If you use
23633 @option{-mno-update}, there is a small window between the time that the
23634 stack pointer is updated and the address of the previous frame is
23635 stored, which means code that walks the stack frame across interrupts or
23636 signals may get corrupted data.
23638 @item -mavoid-indexed-addresses
23639 @itemx -mno-avoid-indexed-addresses
23640 @opindex mavoid-indexed-addresses
23641 @opindex mno-avoid-indexed-addresses
23642 Generate code that tries to avoid (not avoid) the use of indexed load
23643 or store instructions. These instructions can incur a performance
23644 penalty on Power6 processors in certain situations, such as when
23645 stepping through large arrays that cross a 16M boundary. This option
23646 is enabled by default when targeting Power6 and disabled otherwise.
23649 @itemx -mno-fused-madd
23650 @opindex mfused-madd
23651 @opindex mno-fused-madd
23652 Generate code that uses (does not use) the floating-point multiply and
23653 accumulate instructions. These instructions are generated by default
23654 if hardware floating point is used. The machine-dependent
23655 @option{-mfused-madd} option is now mapped to the machine-independent
23656 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
23657 mapped to @option{-ffp-contract=off}.
23659 @item -mno-strict-align
23660 @itemx -mstrict-align
23661 @opindex mno-strict-align
23662 @opindex mstrict-align
23663 On System V.4 and embedded PowerPC systems do not (do) assume that
23664 unaligned memory references are handled by the system.
23666 @item -mrelocatable
23667 @itemx -mno-relocatable
23668 @opindex mrelocatable
23669 @opindex mno-relocatable
23670 Generate code that allows (does not allow) a static executable to be
23671 relocated to a different address at run time. A simple embedded
23672 PowerPC system loader should relocate the entire contents of
23673 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
23674 a table of 32-bit addresses generated by this option. For this to
23675 work, all objects linked together must be compiled with
23676 @option{-mrelocatable} or @option{-mrelocatable-lib}.
23677 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
23679 @item -mrelocatable-lib
23680 @itemx -mno-relocatable-lib
23681 @opindex mrelocatable-lib
23682 @opindex mno-relocatable-lib
23683 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
23684 @code{.fixup} section to allow static executables to be relocated at
23685 run time, but @option{-mrelocatable-lib} does not use the smaller stack
23686 alignment of @option{-mrelocatable}. Objects compiled with
23687 @option{-mrelocatable-lib} may be linked with objects compiled with
23688 any combination of the @option{-mrelocatable} options.
23694 On System V.4 and embedded PowerPC systems do not (do) assume that
23695 register 2 contains a pointer to a global area pointing to the addresses
23696 used in the program.
23699 @itemx -mlittle-endian
23701 @opindex mlittle-endian
23702 On System V.4 and embedded PowerPC systems compile code for the
23703 processor in little-endian mode. The @option{-mlittle-endian} option is
23704 the same as @option{-mlittle}.
23707 @itemx -mbig-endian
23709 @opindex mbig-endian
23710 On System V.4 and embedded PowerPC systems compile code for the
23711 processor in big-endian mode. The @option{-mbig-endian} option is
23712 the same as @option{-mbig}.
23714 @item -mdynamic-no-pic
23715 @opindex mdynamic-no-pic
23716 On Darwin and Mac OS X systems, compile code so that it is not
23717 relocatable, but that its external references are relocatable. The
23718 resulting code is suitable for applications, but not shared
23721 @item -msingle-pic-base
23722 @opindex msingle-pic-base
23723 Treat the register used for PIC addressing as read-only, rather than
23724 loading it in the prologue for each function. The runtime system is
23725 responsible for initializing this register with an appropriate value
23726 before execution begins.
23728 @item -mprioritize-restricted-insns=@var{priority}
23729 @opindex mprioritize-restricted-insns
23730 This option controls the priority that is assigned to
23731 dispatch-slot restricted instructions during the second scheduling
23732 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
23733 or @samp{2} to assign no, highest, or second-highest (respectively)
23734 priority to dispatch-slot restricted
23737 @item -msched-costly-dep=@var{dependence_type}
23738 @opindex msched-costly-dep
23739 This option controls which dependences are considered costly
23740 by the target during instruction scheduling. The argument
23741 @var{dependence_type} takes one of the following values:
23745 No dependence is costly.
23748 All dependences are costly.
23750 @item @samp{true_store_to_load}
23751 A true dependence from store to load is costly.
23753 @item @samp{store_to_load}
23754 Any dependence from store to load is costly.
23757 Any dependence for which the latency is greater than or equal to
23758 @var{number} is costly.
23761 @item -minsert-sched-nops=@var{scheme}
23762 @opindex minsert-sched-nops
23763 This option controls which NOP insertion scheme is used during
23764 the second scheduling pass. The argument @var{scheme} takes one of the
23772 Pad with NOPs any dispatch group that has vacant issue slots,
23773 according to the scheduler's grouping.
23775 @item @samp{regroup_exact}
23776 Insert NOPs to force costly dependent insns into
23777 separate groups. Insert exactly as many NOPs as needed to force an insn
23778 to a new group, according to the estimated processor grouping.
23781 Insert NOPs to force costly dependent insns into
23782 separate groups. Insert @var{number} NOPs to force an insn to a new group.
23786 @opindex mcall-sysv
23787 On System V.4 and embedded PowerPC systems compile code using calling
23788 conventions that adhere to the March 1995 draft of the System V
23789 Application Binary Interface, PowerPC processor supplement. This is the
23790 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
23792 @item -mcall-sysv-eabi
23794 @opindex mcall-sysv-eabi
23795 @opindex mcall-eabi
23796 Specify both @option{-mcall-sysv} and @option{-meabi} options.
23798 @item -mcall-sysv-noeabi
23799 @opindex mcall-sysv-noeabi
23800 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
23802 @item -mcall-aixdesc
23804 On System V.4 and embedded PowerPC systems compile code for the AIX
23808 @opindex mcall-linux
23809 On System V.4 and embedded PowerPC systems compile code for the
23810 Linux-based GNU system.
23812 @item -mcall-freebsd
23813 @opindex mcall-freebsd
23814 On System V.4 and embedded PowerPC systems compile code for the
23815 FreeBSD operating system.
23817 @item -mcall-netbsd
23818 @opindex mcall-netbsd
23819 On System V.4 and embedded PowerPC systems compile code for the
23820 NetBSD operating system.
23822 @item -mcall-openbsd
23823 @opindex mcall-netbsd
23824 On System V.4 and embedded PowerPC systems compile code for the
23825 OpenBSD operating system.
23827 @item -maix-struct-return
23828 @opindex maix-struct-return
23829 Return all structures in memory (as specified by the AIX ABI)@.
23831 @item -msvr4-struct-return
23832 @opindex msvr4-struct-return
23833 Return structures smaller than 8 bytes in registers (as specified by the
23836 @item -mabi=@var{abi-type}
23838 Extend the current ABI with a particular extension, or remove such extension.
23839 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
23840 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
23841 @samp{elfv1}, @samp{elfv2}@.
23845 Extend the current ABI with SPE ABI extensions. This does not change
23846 the default ABI, instead it adds the SPE ABI extensions to the current
23850 @opindex mabi=no-spe
23851 Disable Book-E SPE ABI extensions for the current ABI@.
23853 @item -mabi=ibmlongdouble
23854 @opindex mabi=ibmlongdouble
23855 Change the current ABI to use IBM extended-precision long double.
23856 This is not likely to work if your system defaults to using IEEE
23857 extended-precision long double. If you change the long double type
23858 from IEEE extended-precision, the compiler will issue a warning unless
23859 you use the @option{-Wno-psabi} option.
23861 @item -mabi=ieeelongdouble
23862 @opindex mabi=ieeelongdouble
23863 Change the current ABI to use IEEE extended-precision long double.
23864 This is not likely to work if your system defaults to using IBM
23865 extended-precision long double. If you change the long double type
23866 from IBM extended-precision, the compiler will issue a warning unless
23867 you use the @option{-Wno-psabi} option.
23870 @opindex mabi=elfv1
23871 Change the current ABI to use the ELFv1 ABI.
23872 This is the default ABI for big-endian PowerPC 64-bit Linux.
23873 Overriding the default ABI requires special system support and is
23874 likely to fail in spectacular ways.
23877 @opindex mabi=elfv2
23878 Change the current ABI to use the ELFv2 ABI.
23879 This is the default ABI for little-endian PowerPC 64-bit Linux.
23880 Overriding the default ABI requires special system support and is
23881 likely to fail in spectacular ways.
23883 @item -mgnu-attribute
23884 @itemx -mno-gnu-attribute
23885 @opindex mgnu-attribute
23886 @opindex mno-gnu-attribute
23887 Emit .gnu_attribute assembly directives to set tag/value pairs in a
23888 .gnu.attributes section that specify ABI variations in function
23889 parameters or return values.
23892 @itemx -mno-prototype
23893 @opindex mprototype
23894 @opindex mno-prototype
23895 On System V.4 and embedded PowerPC systems assume that all calls to
23896 variable argument functions are properly prototyped. Otherwise, the
23897 compiler must insert an instruction before every non-prototyped call to
23898 set or clear bit 6 of the condition code register (@code{CR}) to
23899 indicate whether floating-point values are passed in the floating-point
23900 registers in case the function takes variable arguments. With
23901 @option{-mprototype}, only calls to prototyped variable argument functions
23902 set or clear the bit.
23906 On embedded PowerPC systems, assume that the startup module is called
23907 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
23908 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
23913 On embedded PowerPC systems, assume that the startup module is called
23914 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
23919 On embedded PowerPC systems, assume that the startup module is called
23920 @file{crt0.o} and the standard C libraries are @file{libads.a} and
23923 @item -myellowknife
23924 @opindex myellowknife
23925 On embedded PowerPC systems, assume that the startup module is called
23926 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
23931 On System V.4 and embedded PowerPC systems, specify that you are
23932 compiling for a VxWorks system.
23936 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
23937 header to indicate that @samp{eabi} extended relocations are used.
23943 On System V.4 and embedded PowerPC systems do (do not) adhere to the
23944 Embedded Applications Binary Interface (EABI), which is a set of
23945 modifications to the System V.4 specifications. Selecting @option{-meabi}
23946 means that the stack is aligned to an 8-byte boundary, a function
23947 @code{__eabi} is called from @code{main} to set up the EABI
23948 environment, and the @option{-msdata} option can use both @code{r2} and
23949 @code{r13} to point to two separate small data areas. Selecting
23950 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
23951 no EABI initialization function is called from @code{main}, and the
23952 @option{-msdata} option only uses @code{r13} to point to a single
23953 small data area. The @option{-meabi} option is on by default if you
23954 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
23957 @opindex msdata=eabi
23958 On System V.4 and embedded PowerPC systems, put small initialized
23959 @code{const} global and static data in the @code{.sdata2} section, which
23960 is pointed to by register @code{r2}. Put small initialized
23961 non-@code{const} global and static data in the @code{.sdata} section,
23962 which is pointed to by register @code{r13}. Put small uninitialized
23963 global and static data in the @code{.sbss} section, which is adjacent to
23964 the @code{.sdata} section. The @option{-msdata=eabi} option is
23965 incompatible with the @option{-mrelocatable} option. The
23966 @option{-msdata=eabi} option also sets the @option{-memb} option.
23969 @opindex msdata=sysv
23970 On System V.4 and embedded PowerPC systems, put small global and static
23971 data in the @code{.sdata} section, which is pointed to by register
23972 @code{r13}. Put small uninitialized global and static data in the
23973 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
23974 The @option{-msdata=sysv} option is incompatible with the
23975 @option{-mrelocatable} option.
23977 @item -msdata=default
23979 @opindex msdata=default
23981 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
23982 compile code the same as @option{-msdata=eabi}, otherwise compile code the
23983 same as @option{-msdata=sysv}.
23986 @opindex msdata=data
23987 On System V.4 and embedded PowerPC systems, put small global
23988 data in the @code{.sdata} section. Put small uninitialized global
23989 data in the @code{.sbss} section. Do not use register @code{r13}
23990 to address small data however. This is the default behavior unless
23991 other @option{-msdata} options are used.
23995 @opindex msdata=none
23997 On embedded PowerPC systems, put all initialized global and static data
23998 in the @code{.data} section, and all uninitialized data in the
23999 @code{.bss} section.
24001 @item -mblock-move-inline-limit=@var{num}
24002 @opindex mblock-move-inline-limit
24003 Inline all block moves (such as calls to @code{memcpy} or structure
24004 copies) less than or equal to @var{num} bytes. The minimum value for
24005 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
24006 targets. The default value is target-specific.
24010 @cindex smaller data references (PowerPC)
24011 @cindex .sdata/.sdata2 references (PowerPC)
24012 On embedded PowerPC systems, put global and static items less than or
24013 equal to @var{num} bytes into the small data or BSS sections instead of
24014 the normal data or BSS section. By default, @var{num} is 8. The
24015 @option{-G @var{num}} switch is also passed to the linker.
24016 All modules should be compiled with the same @option{-G @var{num}} value.
24019 @itemx -mno-regnames
24021 @opindex mno-regnames
24022 On System V.4 and embedded PowerPC systems do (do not) emit register
24023 names in the assembly language output using symbolic forms.
24026 @itemx -mno-longcall
24028 @opindex mno-longcall
24029 By default assume that all calls are far away so that a longer and more
24030 expensive calling sequence is required. This is required for calls
24031 farther than 32 megabytes (33,554,432 bytes) from the current location.
24032 A short call is generated if the compiler knows
24033 the call cannot be that far away. This setting can be overridden by
24034 the @code{shortcall} function attribute, or by @code{#pragma
24037 Some linkers are capable of detecting out-of-range calls and generating
24038 glue code on the fly. On these systems, long calls are unnecessary and
24039 generate slower code. As of this writing, the AIX linker can do this,
24040 as can the GNU linker for PowerPC/64. It is planned to add this feature
24041 to the GNU linker for 32-bit PowerPC systems as well.
24043 In the future, GCC may ignore all longcall specifications
24044 when the linker is known to generate glue.
24046 @item -mtls-markers
24047 @itemx -mno-tls-markers
24048 @opindex mtls-markers
24049 @opindex mno-tls-markers
24050 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
24051 specifying the function argument. The relocation allows the linker to
24052 reliably associate function call with argument setup instructions for
24053 TLS optimization, which in turn allows GCC to better schedule the
24059 This option enables use of the reciprocal estimate and
24060 reciprocal square root estimate instructions with additional
24061 Newton-Raphson steps to increase precision instead of doing a divide or
24062 square root and divide for floating-point arguments. You should use
24063 the @option{-ffast-math} option when using @option{-mrecip} (or at
24064 least @option{-funsafe-math-optimizations},
24065 @option{-ffinite-math-only}, @option{-freciprocal-math} and
24066 @option{-fno-trapping-math}). Note that while the throughput of the
24067 sequence is generally higher than the throughput of the non-reciprocal
24068 instruction, the precision of the sequence can be decreased by up to 2
24069 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
24072 @item -mrecip=@var{opt}
24073 @opindex mrecip=opt
24074 This option controls which reciprocal estimate instructions
24075 may be used. @var{opt} is a comma-separated list of options, which may
24076 be preceded by a @code{!} to invert the option:
24081 Enable all estimate instructions.
24084 Enable the default instructions, equivalent to @option{-mrecip}.
24087 Disable all estimate instructions, equivalent to @option{-mno-recip}.
24090 Enable the reciprocal approximation instructions for both
24091 single and double precision.
24094 Enable the single-precision reciprocal approximation instructions.
24097 Enable the double-precision reciprocal approximation instructions.
24100 Enable the reciprocal square root approximation instructions for both
24101 single and double precision.
24104 Enable the single-precision reciprocal square root approximation instructions.
24107 Enable the double-precision reciprocal square root approximation instructions.
24111 So, for example, @option{-mrecip=all,!rsqrtd} enables
24112 all of the reciprocal estimate instructions, except for the
24113 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
24114 which handle the double-precision reciprocal square root calculations.
24116 @item -mrecip-precision
24117 @itemx -mno-recip-precision
24118 @opindex mrecip-precision
24119 Assume (do not assume) that the reciprocal estimate instructions
24120 provide higher-precision estimates than is mandated by the PowerPC
24121 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
24122 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
24123 The double-precision square root estimate instructions are not generated by
24124 default on low-precision machines, since they do not provide an
24125 estimate that converges after three steps.
24127 @item -mpointers-to-nested-functions
24128 @itemx -mno-pointers-to-nested-functions
24129 @opindex mpointers-to-nested-functions
24130 Generate (do not generate) code to load up the static chain register
24131 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
24132 systems where a function pointer points to a 3-word descriptor giving
24133 the function address, TOC value to be loaded in register @code{r2}, and
24134 static chain value to be loaded in register @code{r11}. The
24135 @option{-mpointers-to-nested-functions} is on by default. You cannot
24136 call through pointers to nested functions or pointers
24137 to functions compiled in other languages that use the static chain if
24138 you use @option{-mno-pointers-to-nested-functions}.
24140 @item -msave-toc-indirect
24141 @itemx -mno-save-toc-indirect
24142 @opindex msave-toc-indirect
24143 Generate (do not generate) code to save the TOC value in the reserved
24144 stack location in the function prologue if the function calls through
24145 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
24146 saved in the prologue, it is saved just before the call through the
24147 pointer. The @option{-mno-save-toc-indirect} option is the default.
24149 @item -mcompat-align-parm
24150 @itemx -mno-compat-align-parm
24151 @opindex mcompat-align-parm
24152 Generate (do not generate) code to pass structure parameters with a
24153 maximum alignment of 64 bits, for compatibility with older versions
24156 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
24157 structure parameter on a 128-bit boundary when that structure contained
24158 a member requiring 128-bit alignment. This is corrected in more
24159 recent versions of GCC. This option may be used to generate code
24160 that is compatible with functions compiled with older versions of
24163 The @option{-mno-compat-align-parm} option is the default.
24165 @item -mstack-protector-guard=@var{guard}
24166 @itemx -mstack-protector-guard-reg=@var{reg}
24167 @itemx -mstack-protector-guard-offset=@var{offset}
24168 @itemx -mstack-protector-guard-symbol=@var{symbol}
24169 @opindex mstack-protector-guard
24170 @opindex mstack-protector-guard-reg
24171 @opindex mstack-protector-guard-offset
24172 @opindex mstack-protector-guard-symbol
24173 Generate stack protection code using canary at @var{guard}. Supported
24174 locations are @samp{global} for global canary or @samp{tls} for per-thread
24175 canary in the TLS block (the default with GNU libc version 2.4 or later).
24177 With the latter choice the options
24178 @option{-mstack-protector-guard-reg=@var{reg}} and
24179 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
24180 which register to use as base register for reading the canary, and from what
24181 offset from that base register. The default for those is as specified in the
24182 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
24183 the offset with a symbol reference to a canary in the TLS block.
24187 @node RISC-V Options
24188 @subsection RISC-V Options
24189 @cindex RISC-V Options
24191 These command-line options are defined for RISC-V targets:
24194 @item -mbranch-cost=@var{n}
24195 @opindex mbranch-cost
24196 Set the cost of branches to roughly @var{n} instructions.
24201 When generating PIC code, do or don't allow the use of PLTs. Ignored for
24202 non-PIC. The default is @option{-mplt}.
24204 @item -mabi=@var{ABI-string}
24206 Specify integer and floating-point calling convention. @var{ABI-string}
24207 contains two parts: the size of integer types and the registers used for
24208 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
24209 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
24210 32-bit), and that floating-point values up to 64 bits wide are passed in F
24211 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
24212 allows the compiler to generate code that uses the F and D extensions but only
24213 allows floating-point values up to 32 bits long to be passed in registers; or
24214 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
24215 passed in registers.
24217 The default for this argument is system dependent, users who want a specific
24218 calling convention should specify one explicitly. The valid calling
24219 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
24220 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
24221 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
24222 invalid because the ABI requires 64-bit values be passed in F registers, but F
24223 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
24224 only be used with the @samp{rv32e} architecture. This ABI is not well
24225 specified at present, and is subject to change.
24230 Do or don't use hardware floating-point divide and square root instructions.
24231 This requires the F or D extensions for floating-point registers. The default
24232 is to use them if the specified architecture has these instructions.
24237 Do or don't use hardware instructions for integer division. This requires the
24238 M extension. The default is to use them if the specified architecture has
24239 these instructions.
24241 @item -march=@var{ISA-string}
24243 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
24244 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
24247 @item -mtune=@var{processor-string}
24249 Optimize the output for the given processor, specified by microarchitecture
24252 @item -mpreferred-stack-boundary=@var{num}
24253 @opindex mpreferred-stack-boundary
24254 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
24255 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
24256 the default is 4 (16 bytes or 128-bits).
24258 @strong{Warning:} If you use this switch, then you must build all modules with
24259 the same value, including any libraries. This includes the system libraries
24260 and startup modules.
24262 @item -msmall-data-limit=@var{n}
24263 @opindex msmall-data-limit
24264 Put global and static data smaller than @var{n} bytes into a special section
24267 @item -msave-restore
24268 @itemx -mno-save-restore
24269 @opindex msave-restore
24270 Do or don't use smaller but slower prologue and epilogue code that uses
24271 library function calls. The default is to use fast inline prologues and
24274 @item -mstrict-align
24275 @itemx -mno-strict-align
24276 @opindex mstrict-align
24277 Do not or do generate unaligned memory accesses. The default is set depending
24278 on whether the processor we are optimizing for supports fast unaligned access
24281 @item -mcmodel=medlow
24282 @opindex mcmodel=medlow
24283 Generate code for the medium-low code model. The program and its statically
24284 defined symbols must lie within a single 2 GiB address range and must lie
24285 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
24286 statically or dynamically linked. This is the default code model.
24288 @item -mcmodel=medany
24289 @opindex mcmodel=medany
24290 Generate code for the medium-any code model. The program and its statically
24291 defined symbols must be within any single 2 GiB address range. Programs can be
24292 statically or dynamically linked.
24294 @item -mexplicit-relocs
24295 @itemx -mno-exlicit-relocs
24296 Use or do not use assembler relocation operators when dealing with symbolic
24297 addresses. The alternative is to use assembler macros instead, which may
24298 limit optimization.
24302 Take advantage of linker relaxations to reduce the number of instructions
24303 required to materialize symbol addresses. The default is to take advantage of
24304 linker relaxations.
24309 @subsection RL78 Options
24310 @cindex RL78 Options
24316 Links in additional target libraries to support operation within a
24325 Specifies the type of hardware multiplication and division support to
24326 be used. The simplest is @code{none}, which uses software for both
24327 multiplication and division. This is the default. The @code{g13}
24328 value is for the hardware multiply/divide peripheral found on the
24329 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
24330 the multiplication and division instructions supported by the RL78/G14
24331 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
24332 the value @code{mg10} is an alias for @code{none}.
24334 In addition a C preprocessor macro is defined, based upon the setting
24335 of this option. Possible values are: @code{__RL78_MUL_NONE__},
24336 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
24343 Specifies the RL78 core to target. The default is the G14 core, also
24344 known as an S3 core or just RL78. The G13 or S2 core does not have
24345 multiply or divide instructions, instead it uses a hardware peripheral
24346 for these operations. The G10 or S1 core does not have register
24347 banks, so it uses a different calling convention.
24349 If this option is set it also selects the type of hardware multiply
24350 support to use, unless this is overridden by an explicit
24351 @option{-mmul=none} option on the command line. Thus specifying
24352 @option{-mcpu=g13} enables the use of the G13 hardware multiply
24353 peripheral and specifying @option{-mcpu=g10} disables the use of
24354 hardware multiplications altogether.
24356 Note, although the RL78/G14 core is the default target, specifying
24357 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
24358 change the behavior of the toolchain since it also enables G14
24359 hardware multiply support. If these options are not specified on the
24360 command line then software multiplication routines will be used even
24361 though the code targets the RL78 core. This is for backwards
24362 compatibility with older toolchains which did not have hardware
24363 multiply and divide support.
24365 In addition a C preprocessor macro is defined, based upon the setting
24366 of this option. Possible values are: @code{__RL78_G10__},
24367 @code{__RL78_G13__} or @code{__RL78_G14__}.
24377 These are aliases for the corresponding @option{-mcpu=} option. They
24378 are provided for backwards compatibility.
24382 Allow the compiler to use all of the available registers. By default
24383 registers @code{r24..r31} are reserved for use in interrupt handlers.
24384 With this option enabled these registers can be used in ordinary
24387 @item -m64bit-doubles
24388 @itemx -m32bit-doubles
24389 @opindex m64bit-doubles
24390 @opindex m32bit-doubles
24391 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24392 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24393 @option{-m32bit-doubles}.
24395 @item -msave-mduc-in-interrupts
24396 @itemx -mno-save-mduc-in-interrupts
24397 @opindex msave-mduc-in-interrupts
24398 @opindex mno-save-mduc-in-interrupts
24399 Specifies that interrupt handler functions should preserve the
24400 MDUC registers. This is only necessary if normal code might use
24401 the MDUC registers, for example because it performs multiplication
24402 and division operations. The default is to ignore the MDUC registers
24403 as this makes the interrupt handlers faster. The target option -mg13
24404 needs to be passed for this to work as this feature is only available
24405 on the G13 target (S2 core). The MDUC registers will only be saved
24406 if the interrupt handler performs a multiplication or division
24407 operation or it calls another function.
24411 @node RS/6000 and PowerPC Options
24412 @subsection IBM RS/6000 and PowerPC Options
24413 @cindex RS/6000 and PowerPC Options
24414 @cindex IBM RS/6000 and PowerPC Options
24416 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
24418 @item -mpowerpc-gpopt
24419 @itemx -mno-powerpc-gpopt
24420 @itemx -mpowerpc-gfxopt
24421 @itemx -mno-powerpc-gfxopt
24424 @itemx -mno-powerpc64
24428 @itemx -mno-popcntb
24430 @itemx -mno-popcntd
24439 @itemx -mno-hard-dfp
24440 @opindex mpowerpc-gpopt
24441 @opindex mno-powerpc-gpopt
24442 @opindex mpowerpc-gfxopt
24443 @opindex mno-powerpc-gfxopt
24444 @opindex mpowerpc64
24445 @opindex mno-powerpc64
24449 @opindex mno-popcntb
24451 @opindex mno-popcntd
24457 @opindex mno-mfpgpr
24459 @opindex mno-hard-dfp
24460 You use these options to specify which instructions are available on the
24461 processor you are using. The default value of these options is
24462 determined when configuring GCC@. Specifying the
24463 @option{-mcpu=@var{cpu_type}} overrides the specification of these
24464 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
24465 rather than the options listed above.
24467 Specifying @option{-mpowerpc-gpopt} allows
24468 GCC to use the optional PowerPC architecture instructions in the
24469 General Purpose group, including floating-point square root. Specifying
24470 @option{-mpowerpc-gfxopt} allows GCC to
24471 use the optional PowerPC architecture instructions in the Graphics
24472 group, including floating-point select.
24474 The @option{-mmfcrf} option allows GCC to generate the move from
24475 condition register field instruction implemented on the POWER4
24476 processor and other processors that support the PowerPC V2.01
24478 The @option{-mpopcntb} option allows GCC to generate the popcount and
24479 double-precision FP reciprocal estimate instruction implemented on the
24480 POWER5 processor and other processors that support the PowerPC V2.02
24482 The @option{-mpopcntd} option allows GCC to generate the popcount
24483 instruction implemented on the POWER7 processor and other processors
24484 that support the PowerPC V2.06 architecture.
24485 The @option{-mfprnd} option allows GCC to generate the FP round to
24486 integer instructions implemented on the POWER5+ processor and other
24487 processors that support the PowerPC V2.03 architecture.
24488 The @option{-mcmpb} option allows GCC to generate the compare bytes
24489 instruction implemented on the POWER6 processor and other processors
24490 that support the PowerPC V2.05 architecture.
24491 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
24492 general-purpose register instructions implemented on the POWER6X
24493 processor and other processors that support the extended PowerPC V2.05
24495 The @option{-mhard-dfp} option allows GCC to generate the decimal
24496 floating-point instructions implemented on some POWER processors.
24498 The @option{-mpowerpc64} option allows GCC to generate the additional
24499 64-bit instructions that are found in the full PowerPC64 architecture
24500 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24501 @option{-mno-powerpc64}.
24503 @item -mcpu=@var{cpu_type}
24505 Set architecture type, register usage, and
24506 instruction scheduling parameters for machine type @var{cpu_type}.
24507 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
24508 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
24509 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
24510 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
24511 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
24512 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
24513 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
24514 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
24515 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
24516 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
24517 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
24518 @samp{rs64}, and @samp{native}.
24520 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
24521 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
24522 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
24523 architecture machine types, with an appropriate, generic processor
24524 model assumed for scheduling purposes.
24526 Specifying @samp{native} as cpu type detects and selects the
24527 architecture option that corresponds to the host processor of the
24528 system performing the compilation.
24529 @option{-mcpu=native} has no effect if GCC does not recognize the
24532 The other options specify a specific processor. Code generated under
24533 those options runs best on that processor, and may not run at all on
24536 The @option{-mcpu} options automatically enable or disable the
24539 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
24540 -mpopcntb -mpopcntd -mpowerpc64 @gol
24541 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
24542 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
24543 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
24544 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
24546 The particular options set for any particular CPU varies between
24547 compiler versions, depending on what setting seems to produce optimal
24548 code for that CPU; it doesn't necessarily reflect the actual hardware's
24549 capabilities. If you wish to set an individual option to a particular
24550 value, you may specify it after the @option{-mcpu} option, like
24551 @option{-mcpu=970 -mno-altivec}.
24553 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
24554 not enabled or disabled by the @option{-mcpu} option at present because
24555 AIX does not have full support for these options. You may still
24556 enable or disable them individually if you're sure it'll work in your
24559 @item -mtune=@var{cpu_type}
24561 Set the instruction scheduling parameters for machine type
24562 @var{cpu_type}, but do not set the architecture type or register usage,
24563 as @option{-mcpu=@var{cpu_type}} does. The same
24564 values for @var{cpu_type} are used for @option{-mtune} as for
24565 @option{-mcpu}. If both are specified, the code generated uses the
24566 architecture and registers set by @option{-mcpu}, but the
24567 scheduling parameters set by @option{-mtune}.
24569 @item -mcmodel=small
24570 @opindex mcmodel=small
24571 Generate PowerPC64 code for the small model: The TOC is limited to
24574 @item -mcmodel=medium
24575 @opindex mcmodel=medium
24576 Generate PowerPC64 code for the medium model: The TOC and other static
24577 data may be up to a total of 4G in size. This is the default for 64-bit
24580 @item -mcmodel=large
24581 @opindex mcmodel=large
24582 Generate PowerPC64 code for the large model: The TOC may be up to 4G
24583 in size. Other data and code is only limited by the 64-bit address
24587 @itemx -mno-altivec
24589 @opindex mno-altivec
24590 Generate code that uses (does not use) AltiVec instructions, and also
24591 enable the use of built-in functions that allow more direct access to
24592 the AltiVec instruction set. You may also need to set
24593 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
24596 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
24597 @option{-maltivec=be}, the element order for AltiVec intrinsics such
24598 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
24599 match array element order corresponding to the endianness of the
24600 target. That is, element zero identifies the leftmost element in a
24601 vector register when targeting a big-endian platform, and identifies
24602 the rightmost element in a vector register when targeting a
24603 little-endian platform.
24606 @opindex maltivec=be
24607 Generate AltiVec instructions using big-endian element order,
24608 regardless of whether the target is big- or little-endian. This is
24609 the default when targeting a big-endian platform. Using this option
24610 is currently deprecated. Support for this feature will be removed in
24613 The element order is used to interpret element numbers in AltiVec
24614 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
24615 @code{vec_insert}. By default, these match array element order
24616 corresponding to the endianness for the target.
24619 @opindex maltivec=le
24620 Generate AltiVec instructions using little-endian element order,
24621 regardless of whether the target is big- or little-endian. This is
24622 the default when targeting a little-endian platform. This option is
24623 currently ignored when targeting a big-endian platform.
24625 The element order is used to interpret element numbers in AltiVec
24626 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
24627 @code{vec_insert}. By default, these match array element order
24628 corresponding to the endianness for the target.
24633 @opindex mno-vrsave
24634 Generate VRSAVE instructions when generating AltiVec code.
24637 @opindex msecure-plt
24638 Generate code that allows @command{ld} and @command{ld.so}
24639 to build executables and shared
24640 libraries with non-executable @code{.plt} and @code{.got} sections.
24642 32-bit SYSV ABI option.
24646 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
24648 requires @code{.plt} and @code{.got}
24649 sections that are both writable and executable.
24650 This is a PowerPC 32-bit SYSV ABI option.
24656 This switch enables or disables the generation of ISEL instructions.
24662 Generate code that uses (does not use) vector/scalar (VSX)
24663 instructions, and also enable the use of built-in functions that allow
24664 more direct access to the VSX instruction set.
24669 @opindex mno-crypto
24670 Enable the use (disable) of the built-in functions that allow direct
24671 access to the cryptographic instructions that were added in version
24672 2.07 of the PowerPC ISA.
24678 Enable (disable) the use of the built-in functions that allow direct
24679 access to the Hardware Transactional Memory (HTM) instructions that
24680 were added in version 2.07 of the PowerPC ISA.
24682 @item -mpower8-fusion
24683 @itemx -mno-power8-fusion
24684 @opindex mpower8-fusion
24685 @opindex mno-power8-fusion
24686 Generate code that keeps (does not keeps) some integer operations
24687 adjacent so that the instructions can be fused together on power8 and
24690 @item -mpower8-vector
24691 @itemx -mno-power8-vector
24692 @opindex mpower8-vector
24693 @opindex mno-power8-vector
24694 Generate code that uses (does not use) the vector and scalar
24695 instructions that were added in version 2.07 of the PowerPC ISA. Also
24696 enable the use of built-in functions that allow more direct access to
24697 the vector instructions.
24699 @item -mquad-memory
24700 @itemx -mno-quad-memory
24701 @opindex mquad-memory
24702 @opindex mno-quad-memory
24703 Generate code that uses (does not use) the non-atomic quad word memory
24704 instructions. The @option{-mquad-memory} option requires use of
24707 @item -mquad-memory-atomic
24708 @itemx -mno-quad-memory-atomic
24709 @opindex mquad-memory-atomic
24710 @opindex mno-quad-memory-atomic
24711 Generate code that uses (does not use) the atomic quad word memory
24712 instructions. The @option{-mquad-memory-atomic} option requires use of
24716 @itemx -mno-float128
24718 @opindex mno-float128
24719 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24720 and use either software emulation for IEEE 128-bit floating point or
24721 hardware instructions.
24723 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24724 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24725 use the IEEE 128-bit floating point support. The IEEE 128-bit
24726 floating point support only works on PowerPC Linux systems.
24728 The default for @option{-mfloat128} is enabled on PowerPC Linux
24729 systems using the VSX instruction set, and disabled on other systems.
24731 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24732 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24733 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24734 floating point instructions. Otherwise, if you do not specify to
24735 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24736 system, IEEE 128-bit floating point will be done with software
24739 @item -mfloat128-hardware
24740 @itemx -mno-float128-hardware
24741 @opindex mfloat128-hardware
24742 @opindex mno-float128-hardware
24743 Enable/disable using ISA 3.0 hardware instructions to support the
24744 @var{__float128} data type.
24746 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24747 Linux systems using the ISA 3.0 instruction set, and disabled on other
24754 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24755 targets (including GNU/Linux). The 32-bit environment sets int, long
24756 and pointer to 32 bits and generates code that runs on any PowerPC
24757 variant. The 64-bit environment sets int to 32 bits and long and
24758 pointer to 64 bits, and generates code for PowerPC64, as for
24759 @option{-mpowerpc64}.
24762 @itemx -mno-fp-in-toc
24763 @itemx -mno-sum-in-toc
24764 @itemx -mminimal-toc
24766 @opindex mno-fp-in-toc
24767 @opindex mno-sum-in-toc
24768 @opindex mminimal-toc
24769 Modify generation of the TOC (Table Of Contents), which is created for
24770 every executable file. The @option{-mfull-toc} option is selected by
24771 default. In that case, GCC allocates at least one TOC entry for
24772 each unique non-automatic variable reference in your program. GCC
24773 also places floating-point constants in the TOC@. However, only
24774 16,384 entries are available in the TOC@.
24776 If you receive a linker error message that saying you have overflowed
24777 the available TOC space, you can reduce the amount of TOC space used
24778 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24779 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24780 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24781 generate code to calculate the sum of an address and a constant at
24782 run time instead of putting that sum into the TOC@. You may specify one
24783 or both of these options. Each causes GCC to produce very slightly
24784 slower and larger code at the expense of conserving TOC space.
24786 If you still run out of space in the TOC even when you specify both of
24787 these options, specify @option{-mminimal-toc} instead. This option causes
24788 GCC to make only one TOC entry for every file. When you specify this
24789 option, GCC produces code that is slower and larger but which
24790 uses extremely little TOC space. You may wish to use this option
24791 only on files that contain less frequently-executed code.
24797 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24798 @code{long} type, and the infrastructure needed to support them.
24799 Specifying @option{-maix64} implies @option{-mpowerpc64},
24800 while @option{-maix32} disables the 64-bit ABI and
24801 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
24804 @itemx -mno-xl-compat
24805 @opindex mxl-compat
24806 @opindex mno-xl-compat
24807 Produce code that conforms more closely to IBM XL compiler semantics
24808 when using AIX-compatible ABI@. Pass floating-point arguments to
24809 prototyped functions beyond the register save area (RSA) on the stack
24810 in addition to argument FPRs. Do not assume that most significant
24811 double in 128-bit long double value is properly rounded when comparing
24812 values and converting to double. Use XL symbol names for long double
24815 The AIX calling convention was extended but not initially documented to
24816 handle an obscure K&R C case of calling a function that takes the
24817 address of its arguments with fewer arguments than declared. IBM XL
24818 compilers access floating-point arguments that do not fit in the
24819 RSA from the stack when a subroutine is compiled without
24820 optimization. Because always storing floating-point arguments on the
24821 stack is inefficient and rarely needed, this option is not enabled by
24822 default and only is necessary when calling subroutines compiled by IBM
24823 XL compilers without optimization.
24827 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
24828 application written to use message passing with special startup code to
24829 enable the application to run. The system must have PE installed in the
24830 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24831 must be overridden with the @option{-specs=} option to specify the
24832 appropriate directory location. The Parallel Environment does not
24833 support threads, so the @option{-mpe} option and the @option{-pthread}
24834 option are incompatible.
24836 @item -malign-natural
24837 @itemx -malign-power
24838 @opindex malign-natural
24839 @opindex malign-power
24840 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24841 @option{-malign-natural} overrides the ABI-defined alignment of larger
24842 types, such as floating-point doubles, on their natural size-based boundary.
24843 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24844 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
24846 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24850 @itemx -mhard-float
24851 @opindex msoft-float
24852 @opindex mhard-float
24853 Generate code that does not use (uses) the floating-point register set.
24854 Software floating-point emulation is provided if you use the
24855 @option{-msoft-float} option, and pass the option to GCC when linking.
24858 @itemx -mno-multiple
24860 @opindex mno-multiple
24861 Generate code that uses (does not use) the load multiple word
24862 instructions and the store multiple word instructions. These
24863 instructions are generated by default on POWER systems, and not
24864 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
24865 PowerPC systems, since those instructions do not work when the
24866 processor is in little-endian mode. The exceptions are PPC740 and
24867 PPC750 which permit these instructions in little-endian mode.
24872 @opindex mno-update
24873 Generate code that uses (does not use) the load or store instructions
24874 that update the base register to the address of the calculated memory
24875 location. These instructions are generated by default. If you use
24876 @option{-mno-update}, there is a small window between the time that the
24877 stack pointer is updated and the address of the previous frame is
24878 stored, which means code that walks the stack frame across interrupts or
24879 signals may get corrupted data.
24881 @item -mavoid-indexed-addresses
24882 @itemx -mno-avoid-indexed-addresses
24883 @opindex mavoid-indexed-addresses
24884 @opindex mno-avoid-indexed-addresses
24885 Generate code that tries to avoid (not avoid) the use of indexed load
24886 or store instructions. These instructions can incur a performance
24887 penalty on Power6 processors in certain situations, such as when
24888 stepping through large arrays that cross a 16M boundary. This option
24889 is enabled by default when targeting Power6 and disabled otherwise.
24892 @itemx -mno-fused-madd
24893 @opindex mfused-madd
24894 @opindex mno-fused-madd
24895 Generate code that uses (does not use) the floating-point multiply and
24896 accumulate instructions. These instructions are generated by default
24897 if hardware floating point is used. The machine-dependent
24898 @option{-mfused-madd} option is now mapped to the machine-independent
24899 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24900 mapped to @option{-ffp-contract=off}.
24906 Generate code that uses (does not use) the half-word multiply and
24907 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24908 These instructions are generated by default when targeting those
24915 Generate code that uses (does not use) the string-search @samp{dlmzb}
24916 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
24917 generated by default when targeting those processors.
24919 @item -mno-bit-align
24921 @opindex mno-bit-align
24922 @opindex mbit-align
24923 On System V.4 and embedded PowerPC systems do not (do) force structures
24924 and unions that contain bit-fields to be aligned to the base type of the
24927 For example, by default a structure containing nothing but 8
24928 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24929 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
24930 the structure is aligned to a 1-byte boundary and is 1 byte in
24933 @item -mno-strict-align
24934 @itemx -mstrict-align
24935 @opindex mno-strict-align
24936 @opindex mstrict-align
24937 On System V.4 and embedded PowerPC systems do not (do) assume that
24938 unaligned memory references are handled by the system.
24940 @item -mrelocatable
24941 @itemx -mno-relocatable
24942 @opindex mrelocatable
24943 @opindex mno-relocatable
24944 Generate code that allows (does not allow) a static executable to be
24945 relocated to a different address at run time. A simple embedded
24946 PowerPC system loader should relocate the entire contents of
24947 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24948 a table of 32-bit addresses generated by this option. For this to
24949 work, all objects linked together must be compiled with
24950 @option{-mrelocatable} or @option{-mrelocatable-lib}.
24951 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24953 @item -mrelocatable-lib
24954 @itemx -mno-relocatable-lib
24955 @opindex mrelocatable-lib
24956 @opindex mno-relocatable-lib
24957 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24958 @code{.fixup} section to allow static executables to be relocated at
24959 run time, but @option{-mrelocatable-lib} does not use the smaller stack
24960 alignment of @option{-mrelocatable}. Objects compiled with
24961 @option{-mrelocatable-lib} may be linked with objects compiled with
24962 any combination of the @option{-mrelocatable} options.
24968 On System V.4 and embedded PowerPC systems do not (do) assume that
24969 register 2 contains a pointer to a global area pointing to the addresses
24970 used in the program.
24973 @itemx -mlittle-endian
24975 @opindex mlittle-endian
24976 On System V.4 and embedded PowerPC systems compile code for the
24977 processor in little-endian mode. The @option{-mlittle-endian} option is
24978 the same as @option{-mlittle}.
24981 @itemx -mbig-endian
24983 @opindex mbig-endian
24984 On System V.4 and embedded PowerPC systems compile code for the
24985 processor in big-endian mode. The @option{-mbig-endian} option is
24986 the same as @option{-mbig}.
24988 @item -mdynamic-no-pic
24989 @opindex mdynamic-no-pic
24990 On Darwin and Mac OS X systems, compile code so that it is not
24991 relocatable, but that its external references are relocatable. The
24992 resulting code is suitable for applications, but not shared
24995 @item -msingle-pic-base
24996 @opindex msingle-pic-base
24997 Treat the register used for PIC addressing as read-only, rather than
24998 loading it in the prologue for each function. The runtime system is
24999 responsible for initializing this register with an appropriate value
25000 before execution begins.
25002 @item -mprioritize-restricted-insns=@var{priority}
25003 @opindex mprioritize-restricted-insns
25004 This option controls the priority that is assigned to
25005 dispatch-slot restricted instructions during the second scheduling
25006 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
25007 or @samp{2} to assign no, highest, or second-highest (respectively)
25008 priority to dispatch-slot restricted
25011 @item -msched-costly-dep=@var{dependence_type}
25012 @opindex msched-costly-dep
25013 This option controls which dependences are considered costly
25014 by the target during instruction scheduling. The argument
25015 @var{dependence_type} takes one of the following values:
25019 No dependence is costly.
25022 All dependences are costly.
25024 @item @samp{true_store_to_load}
25025 A true dependence from store to load is costly.
25027 @item @samp{store_to_load}
25028 Any dependence from store to load is costly.
25031 Any dependence for which the latency is greater than or equal to
25032 @var{number} is costly.
25035 @item -minsert-sched-nops=@var{scheme}
25036 @opindex minsert-sched-nops
25037 This option controls which NOP insertion scheme is used during
25038 the second scheduling pass. The argument @var{scheme} takes one of the
25046 Pad with NOPs any dispatch group that has vacant issue slots,
25047 according to the scheduler's grouping.
25049 @item @samp{regroup_exact}
25050 Insert NOPs to force costly dependent insns into
25051 separate groups. Insert exactly as many NOPs as needed to force an insn
25052 to a new group, according to the estimated processor grouping.
25055 Insert NOPs to force costly dependent insns into
25056 separate groups. Insert @var{number} NOPs to force an insn to a new group.
25060 @opindex mcall-sysv
25061 On System V.4 and embedded PowerPC systems compile code using calling
25062 conventions that adhere to the March 1995 draft of the System V
25063 Application Binary Interface, PowerPC processor supplement. This is the
25064 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
25066 @item -mcall-sysv-eabi
25068 @opindex mcall-sysv-eabi
25069 @opindex mcall-eabi
25070 Specify both @option{-mcall-sysv} and @option{-meabi} options.
25072 @item -mcall-sysv-noeabi
25073 @opindex mcall-sysv-noeabi
25074 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
25076 @item -mcall-aixdesc
25078 On System V.4 and embedded PowerPC systems compile code for the AIX
25082 @opindex mcall-linux
25083 On System V.4 and embedded PowerPC systems compile code for the
25084 Linux-based GNU system.
25086 @item -mcall-freebsd
25087 @opindex mcall-freebsd
25088 On System V.4 and embedded PowerPC systems compile code for the
25089 FreeBSD operating system.
25091 @item -mcall-netbsd
25092 @opindex mcall-netbsd
25093 On System V.4 and embedded PowerPC systems compile code for the
25094 NetBSD operating system.
25096 @item -mcall-openbsd
25097 @opindex mcall-netbsd
25098 On System V.4 and embedded PowerPC systems compile code for the
25099 OpenBSD operating system.
25101 @item -mtraceback=@var{traceback_type}
25102 @opindex mtraceback
25103 Select the type of traceback table. Valid values for @var{traceback_type}
25104 are @samp{full}, @samp{part}, and @samp{no}.
25106 @item -maix-struct-return
25107 @opindex maix-struct-return
25108 Return all structures in memory (as specified by the AIX ABI)@.
25110 @item -msvr4-struct-return
25111 @opindex msvr4-struct-return
25112 Return structures smaller than 8 bytes in registers (as specified by the
25115 @item -mabi=@var{abi-type}
25117 Extend the current ABI with a particular extension, or remove such extension.
25118 Valid values are @samp{altivec}, @samp{no-altivec},
25119 @samp{ibmlongdouble}, @samp{ieeelongdouble},
25120 @samp{elfv1}, @samp{elfv2}@.
25122 @item -mabi=ibmlongdouble
25123 @opindex mabi=ibmlongdouble
25124 Change the current ABI to use IBM extended-precision long double.
25125 This is not likely to work if your system defaults to using IEEE
25126 extended-precision long double. If you change the long double type
25127 from IEEE extended-precision, the compiler will issue a warning unless
25128 you use the @option{-Wno-psabi} option.
25130 @item -mabi=ieeelongdouble
25131 @opindex mabi=ieeelongdouble
25132 Change the current ABI to use IEEE extended-precision long double.
25133 This is not likely to work if your system defaults to using IBM
25134 extended-precision long double. If you change the long double type
25135 from IBM extended-precision, the compiler will issue a warning unless
25136 you use the @option{-Wno-psabi} option.
25139 @opindex mabi=elfv1
25140 Change the current ABI to use the ELFv1 ABI.
25141 This is the default ABI for big-endian PowerPC 64-bit Linux.
25142 Overriding the default ABI requires special system support and is
25143 likely to fail in spectacular ways.
25146 @opindex mabi=elfv2
25147 Change the current ABI to use the ELFv2 ABI.
25148 This is the default ABI for little-endian PowerPC 64-bit Linux.
25149 Overriding the default ABI requires special system support and is
25150 likely to fail in spectacular ways.
25152 @item -mgnu-attribute
25153 @itemx -mno-gnu-attribute
25154 @opindex mgnu-attribute
25155 @opindex mno-gnu-attribute
25156 Emit .gnu_attribute assembly directives to set tag/value pairs in a
25157 .gnu.attributes section that specify ABI variations in function
25158 parameters or return values.
25161 @itemx -mno-prototype
25162 @opindex mprototype
25163 @opindex mno-prototype
25164 On System V.4 and embedded PowerPC systems assume that all calls to
25165 variable argument functions are properly prototyped. Otherwise, the
25166 compiler must insert an instruction before every non-prototyped call to
25167 set or clear bit 6 of the condition code register (@code{CR}) to
25168 indicate whether floating-point values are passed in the floating-point
25169 registers in case the function takes variable arguments. With
25170 @option{-mprototype}, only calls to prototyped variable argument functions
25171 set or clear the bit.
25175 On embedded PowerPC systems, assume that the startup module is called
25176 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
25177 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
25182 On embedded PowerPC systems, assume that the startup module is called
25183 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
25188 On embedded PowerPC systems, assume that the startup module is called
25189 @file{crt0.o} and the standard C libraries are @file{libads.a} and
25192 @item -myellowknife
25193 @opindex myellowknife
25194 On embedded PowerPC systems, assume that the startup module is called
25195 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
25200 On System V.4 and embedded PowerPC systems, specify that you are
25201 compiling for a VxWorks system.
25205 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
25206 header to indicate that @samp{eabi} extended relocations are used.
25212 On System V.4 and embedded PowerPC systems do (do not) adhere to the
25213 Embedded Applications Binary Interface (EABI), which is a set of
25214 modifications to the System V.4 specifications. Selecting @option{-meabi}
25215 means that the stack is aligned to an 8-byte boundary, a function
25216 @code{__eabi} is called from @code{main} to set up the EABI
25217 environment, and the @option{-msdata} option can use both @code{r2} and
25218 @code{r13} to point to two separate small data areas. Selecting
25219 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
25220 no EABI initialization function is called from @code{main}, and the
25221 @option{-msdata} option only uses @code{r13} to point to a single
25222 small data area. The @option{-meabi} option is on by default if you
25223 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
25226 @opindex msdata=eabi
25227 On System V.4 and embedded PowerPC systems, put small initialized
25228 @code{const} global and static data in the @code{.sdata2} section, which
25229 is pointed to by register @code{r2}. Put small initialized
25230 non-@code{const} global and static data in the @code{.sdata} section,
25231 which is pointed to by register @code{r13}. Put small uninitialized
25232 global and static data in the @code{.sbss} section, which is adjacent to
25233 the @code{.sdata} section. The @option{-msdata=eabi} option is
25234 incompatible with the @option{-mrelocatable} option. The
25235 @option{-msdata=eabi} option also sets the @option{-memb} option.
25238 @opindex msdata=sysv
25239 On System V.4 and embedded PowerPC systems, put small global and static
25240 data in the @code{.sdata} section, which is pointed to by register
25241 @code{r13}. Put small uninitialized global and static data in the
25242 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
25243 The @option{-msdata=sysv} option is incompatible with the
25244 @option{-mrelocatable} option.
25246 @item -msdata=default
25248 @opindex msdata=default
25250 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
25251 compile code the same as @option{-msdata=eabi}, otherwise compile code the
25252 same as @option{-msdata=sysv}.
25255 @opindex msdata=data
25256 On System V.4 and embedded PowerPC systems, put small global
25257 data in the @code{.sdata} section. Put small uninitialized global
25258 data in the @code{.sbss} section. Do not use register @code{r13}
25259 to address small data however. This is the default behavior unless
25260 other @option{-msdata} options are used.
25264 @opindex msdata=none
25266 On embedded PowerPC systems, put all initialized global and static data
25267 in the @code{.data} section, and all uninitialized data in the
25268 @code{.bss} section.
25270 @item -mreadonly-in-sdata
25271 @opindex mreadonly-in-sdata
25272 @opindex mno-readonly-in-sdata
25273 Put read-only objects in the @code{.sdata} section as well. This is the
25276 @item -mblock-move-inline-limit=@var{num}
25277 @opindex mblock-move-inline-limit
25278 Inline all block moves (such as calls to @code{memcpy} or structure
25279 copies) less than or equal to @var{num} bytes. The minimum value for
25280 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
25281 targets. The default value is target-specific.
25283 @item -mblock-compare-inline-limit=@var{num}
25284 @opindex mblock-compare-inline-limit
25285 Generate non-looping inline code for all block compares (such as calls
25286 to @code{memcmp} or structure compares) less than or equal to @var{num}
25287 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
25288 block compare is disabled. The default value is target-specific.
25290 @item -mblock-compare-inline-loop-limit=@var{num}
25291 @opindex mblock-compare-inline-loop-limit
25292 Generate an inline expansion using loop code for all block compares that
25293 are less than or equal to @var{num} bytes, but greater than the limit
25294 for non-loop inline block compare expansion. If the block length is not
25295 constant, at most @var{num} bytes will be compared before @code{memcmp}
25296 is called to compare the remainder of the block. The default value is
25299 @item -mstring-compare-inline-limit=@var{num}
25300 @opindex mstring-compare-inline-limit
25301 Compare at most @var{num} string bytes with inline code.
25302 If the difference or end of string is not found at the
25303 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
25304 take care of the rest of the comparison. The default is 64 bytes.
25308 @cindex smaller data references (PowerPC)
25309 @cindex .sdata/.sdata2 references (PowerPC)
25310 On embedded PowerPC systems, put global and static items less than or
25311 equal to @var{num} bytes into the small data or BSS sections instead of
25312 the normal data or BSS section. By default, @var{num} is 8. The
25313 @option{-G @var{num}} switch is also passed to the linker.
25314 All modules should be compiled with the same @option{-G @var{num}} value.
25317 @itemx -mno-regnames
25319 @opindex mno-regnames
25320 On System V.4 and embedded PowerPC systems do (do not) emit register
25321 names in the assembly language output using symbolic forms.
25324 @itemx -mno-longcall
25326 @opindex mno-longcall
25327 By default assume that all calls are far away so that a longer and more
25328 expensive calling sequence is required. This is required for calls
25329 farther than 32 megabytes (33,554,432 bytes) from the current location.
25330 A short call is generated if the compiler knows
25331 the call cannot be that far away. This setting can be overridden by
25332 the @code{shortcall} function attribute, or by @code{#pragma
25335 Some linkers are capable of detecting out-of-range calls and generating
25336 glue code on the fly. On these systems, long calls are unnecessary and
25337 generate slower code. As of this writing, the AIX linker can do this,
25338 as can the GNU linker for PowerPC/64. It is planned to add this feature
25339 to the GNU linker for 32-bit PowerPC systems as well.
25341 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
25342 callee, L42}, plus a @dfn{branch island} (glue code). The two target
25343 addresses represent the callee and the branch island. The
25344 Darwin/PPC linker prefers the first address and generates a @code{bl
25345 callee} if the PPC @code{bl} instruction reaches the callee directly;
25346 otherwise, the linker generates @code{bl L42} to call the branch
25347 island. The branch island is appended to the body of the
25348 calling function; it computes the full 32-bit address of the callee
25351 On Mach-O (Darwin) systems, this option directs the compiler emit to
25352 the glue for every direct call, and the Darwin linker decides whether
25353 to use or discard it.
25355 In the future, GCC may ignore all longcall specifications
25356 when the linker is known to generate glue.
25358 @item -mtls-markers
25359 @itemx -mno-tls-markers
25360 @opindex mtls-markers
25361 @opindex mno-tls-markers
25362 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
25363 specifying the function argument. The relocation allows the linker to
25364 reliably associate function call with argument setup instructions for
25365 TLS optimization, which in turn allows GCC to better schedule the
25371 This option enables use of the reciprocal estimate and
25372 reciprocal square root estimate instructions with additional
25373 Newton-Raphson steps to increase precision instead of doing a divide or
25374 square root and divide for floating-point arguments. You should use
25375 the @option{-ffast-math} option when using @option{-mrecip} (or at
25376 least @option{-funsafe-math-optimizations},
25377 @option{-ffinite-math-only}, @option{-freciprocal-math} and
25378 @option{-fno-trapping-math}). Note that while the throughput of the
25379 sequence is generally higher than the throughput of the non-reciprocal
25380 instruction, the precision of the sequence can be decreased by up to 2
25381 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
25384 @item -mrecip=@var{opt}
25385 @opindex mrecip=opt
25386 This option controls which reciprocal estimate instructions
25387 may be used. @var{opt} is a comma-separated list of options, which may
25388 be preceded by a @code{!} to invert the option:
25393 Enable all estimate instructions.
25396 Enable the default instructions, equivalent to @option{-mrecip}.
25399 Disable all estimate instructions, equivalent to @option{-mno-recip}.
25402 Enable the reciprocal approximation instructions for both
25403 single and double precision.
25406 Enable the single-precision reciprocal approximation instructions.
25409 Enable the double-precision reciprocal approximation instructions.
25412 Enable the reciprocal square root approximation instructions for both
25413 single and double precision.
25416 Enable the single-precision reciprocal square root approximation instructions.
25419 Enable the double-precision reciprocal square root approximation instructions.
25423 So, for example, @option{-mrecip=all,!rsqrtd} enables
25424 all of the reciprocal estimate instructions, except for the
25425 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
25426 which handle the double-precision reciprocal square root calculations.
25428 @item -mrecip-precision
25429 @itemx -mno-recip-precision
25430 @opindex mrecip-precision
25431 Assume (do not assume) that the reciprocal estimate instructions
25432 provide higher-precision estimates than is mandated by the PowerPC
25433 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
25434 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
25435 The double-precision square root estimate instructions are not generated by
25436 default on low-precision machines, since they do not provide an
25437 estimate that converges after three steps.
25439 @item -mveclibabi=@var{type}
25440 @opindex mveclibabi
25441 Specifies the ABI type to use for vectorizing intrinsics using an
25442 external library. The only type supported at present is @samp{mass},
25443 which specifies to use IBM's Mathematical Acceleration Subsystem
25444 (MASS) libraries for vectorizing intrinsics using external libraries.
25445 GCC currently emits calls to @code{acosd2}, @code{acosf4},
25446 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
25447 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
25448 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
25449 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
25450 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
25451 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
25452 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
25453 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
25454 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
25455 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
25456 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
25457 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
25458 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
25459 for power7. Both @option{-ftree-vectorize} and
25460 @option{-funsafe-math-optimizations} must also be enabled. The MASS
25461 libraries must be specified at link time.
25466 Generate (do not generate) the @code{friz} instruction when the
25467 @option{-funsafe-math-optimizations} option is used to optimize
25468 rounding of floating-point values to 64-bit integer and back to floating
25469 point. The @code{friz} instruction does not return the same value if
25470 the floating-point number is too large to fit in an integer.
25472 @item -mpointers-to-nested-functions
25473 @itemx -mno-pointers-to-nested-functions
25474 @opindex mpointers-to-nested-functions
25475 Generate (do not generate) code to load up the static chain register
25476 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
25477 systems where a function pointer points to a 3-word descriptor giving
25478 the function address, TOC value to be loaded in register @code{r2}, and
25479 static chain value to be loaded in register @code{r11}. The
25480 @option{-mpointers-to-nested-functions} is on by default. You cannot
25481 call through pointers to nested functions or pointers
25482 to functions compiled in other languages that use the static chain if
25483 you use @option{-mno-pointers-to-nested-functions}.
25485 @item -msave-toc-indirect
25486 @itemx -mno-save-toc-indirect
25487 @opindex msave-toc-indirect
25488 Generate (do not generate) code to save the TOC value in the reserved
25489 stack location in the function prologue if the function calls through
25490 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
25491 saved in the prologue, it is saved just before the call through the
25492 pointer. The @option{-mno-save-toc-indirect} option is the default.
25494 @item -mcompat-align-parm
25495 @itemx -mno-compat-align-parm
25496 @opindex mcompat-align-parm
25497 Generate (do not generate) code to pass structure parameters with a
25498 maximum alignment of 64 bits, for compatibility with older versions
25501 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25502 structure parameter on a 128-bit boundary when that structure contained
25503 a member requiring 128-bit alignment. This is corrected in more
25504 recent versions of GCC. This option may be used to generate code
25505 that is compatible with functions compiled with older versions of
25508 The @option{-mno-compat-align-parm} option is the default.
25510 @item -mstack-protector-guard=@var{guard}
25511 @itemx -mstack-protector-guard-reg=@var{reg}
25512 @itemx -mstack-protector-guard-offset=@var{offset}
25513 @itemx -mstack-protector-guard-symbol=@var{symbol}
25514 @opindex mstack-protector-guard
25515 @opindex mstack-protector-guard-reg
25516 @opindex mstack-protector-guard-offset
25517 @opindex mstack-protector-guard-symbol
25518 Generate stack protection code using canary at @var{guard}. Supported
25519 locations are @samp{global} for global canary or @samp{tls} for per-thread
25520 canary in the TLS block (the default with GNU libc version 2.4 or later).
25522 With the latter choice the options
25523 @option{-mstack-protector-guard-reg=@var{reg}} and
25524 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25525 which register to use as base register for reading the canary, and from what
25526 offset from that base register. The default for those is as specified in the
25527 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
25528 the offset with a symbol reference to a canary in the TLS block.
25532 @subsection RX Options
25535 These command-line options are defined for RX targets:
25538 @item -m64bit-doubles
25539 @itemx -m32bit-doubles
25540 @opindex m64bit-doubles
25541 @opindex m32bit-doubles
25542 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25543 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25544 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
25545 works on 32-bit values, which is why the default is
25546 @option{-m32bit-doubles}.
25552 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
25553 floating-point hardware. The default is enabled for the RX600
25554 series and disabled for the RX200 series.
25556 Floating-point instructions are only generated for 32-bit floating-point
25557 values, however, so the FPU hardware is not used for doubles if the
25558 @option{-m64bit-doubles} option is used.
25560 @emph{Note} If the @option{-fpu} option is enabled then
25561 @option{-funsafe-math-optimizations} is also enabled automatically.
25562 This is because the RX FPU instructions are themselves unsafe.
25564 @item -mcpu=@var{name}
25566 Selects the type of RX CPU to be targeted. Currently three types are
25567 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
25568 the specific @samp{RX610} CPU. The default is @samp{RX600}.
25570 The only difference between @samp{RX600} and @samp{RX610} is that the
25571 @samp{RX610} does not support the @code{MVTIPL} instruction.
25573 The @samp{RX200} series does not have a hardware floating-point unit
25574 and so @option{-nofpu} is enabled by default when this type is
25577 @item -mbig-endian-data
25578 @itemx -mlittle-endian-data
25579 @opindex mbig-endian-data
25580 @opindex mlittle-endian-data
25581 Store data (but not code) in the big-endian format. The default is
25582 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
25585 @item -msmall-data-limit=@var{N}
25586 @opindex msmall-data-limit
25587 Specifies the maximum size in bytes of global and static variables
25588 which can be placed into the small data area. Using the small data
25589 area can lead to smaller and faster code, but the size of area is
25590 limited and it is up to the programmer to ensure that the area does
25591 not overflow. Also when the small data area is used one of the RX's
25592 registers (usually @code{r13}) is reserved for use pointing to this
25593 area, so it is no longer available for use by the compiler. This
25594 could result in slower and/or larger code if variables are pushed onto
25595 the stack instead of being held in this register.
25597 Note, common variables (variables that have not been initialized) and
25598 constants are not placed into the small data area as they are assigned
25599 to other sections in the output executable.
25601 The default value is zero, which disables this feature. Note, this
25602 feature is not enabled by default with higher optimization levels
25603 (@option{-O2} etc) because of the potentially detrimental effects of
25604 reserving a register. It is up to the programmer to experiment and
25605 discover whether this feature is of benefit to their program. See the
25606 description of the @option{-mpid} option for a description of how the
25607 actual register to hold the small data area pointer is chosen.
25613 Use the simulator runtime. The default is to use the libgloss
25614 board-specific runtime.
25616 @item -mas100-syntax
25617 @itemx -mno-as100-syntax
25618 @opindex mas100-syntax
25619 @opindex mno-as100-syntax
25620 When generating assembler output use a syntax that is compatible with
25621 Renesas's AS100 assembler. This syntax can also be handled by the GAS
25622 assembler, but it has some restrictions so it is not generated by default.
25624 @item -mmax-constant-size=@var{N}
25625 @opindex mmax-constant-size
25626 Specifies the maximum size, in bytes, of a constant that can be used as
25627 an operand in a RX instruction. Although the RX instruction set does
25628 allow constants of up to 4 bytes in length to be used in instructions,
25629 a longer value equates to a longer instruction. Thus in some
25630 circumstances it can be beneficial to restrict the size of constants
25631 that are used in instructions. Constants that are too big are instead
25632 placed into a constant pool and referenced via register indirection.
25634 The value @var{N} can be between 0 and 4. A value of 0 (the default)
25635 or 4 means that constants of any size are allowed.
25639 Enable linker relaxation. Linker relaxation is a process whereby the
25640 linker attempts to reduce the size of a program by finding shorter
25641 versions of various instructions. Disabled by default.
25643 @item -mint-register=@var{N}
25644 @opindex mint-register
25645 Specify the number of registers to reserve for fast interrupt handler
25646 functions. The value @var{N} can be between 0 and 4. A value of 1
25647 means that register @code{r13} is reserved for the exclusive use
25648 of fast interrupt handlers. A value of 2 reserves @code{r13} and
25649 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
25650 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
25651 A value of 0, the default, does not reserve any registers.
25653 @item -msave-acc-in-interrupts
25654 @opindex msave-acc-in-interrupts
25655 Specifies that interrupt handler functions should preserve the
25656 accumulator register. This is only necessary if normal code might use
25657 the accumulator register, for example because it performs 64-bit
25658 multiplications. The default is to ignore the accumulator as this
25659 makes the interrupt handlers faster.
25665 Enables the generation of position independent data. When enabled any
25666 access to constant data is done via an offset from a base address
25667 held in a register. This allows the location of constant data to be
25668 determined at run time without requiring the executable to be
25669 relocated, which is a benefit to embedded applications with tight
25670 memory constraints. Data that can be modified is not affected by this
25673 Note, using this feature reserves a register, usually @code{r13}, for
25674 the constant data base address. This can result in slower and/or
25675 larger code, especially in complicated functions.
25677 The actual register chosen to hold the constant data base address
25678 depends upon whether the @option{-msmall-data-limit} and/or the
25679 @option{-mint-register} command-line options are enabled. Starting
25680 with register @code{r13} and proceeding downwards, registers are
25681 allocated first to satisfy the requirements of @option{-mint-register},
25682 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
25683 is possible for the small data area register to be @code{r8} if both
25684 @option{-mint-register=4} and @option{-mpid} are specified on the
25687 By default this feature is not enabled. The default can be restored
25688 via the @option{-mno-pid} command-line option.
25690 @item -mno-warn-multiple-fast-interrupts
25691 @itemx -mwarn-multiple-fast-interrupts
25692 @opindex mno-warn-multiple-fast-interrupts
25693 @opindex mwarn-multiple-fast-interrupts
25694 Prevents GCC from issuing a warning message if it finds more than one
25695 fast interrupt handler when it is compiling a file. The default is to
25696 issue a warning for each extra fast interrupt handler found, as the RX
25697 only supports one such interrupt.
25699 @item -mallow-string-insns
25700 @itemx -mno-allow-string-insns
25701 @opindex mallow-string-insns
25702 @opindex mno-allow-string-insns
25703 Enables or disables the use of the string manipulation instructions
25704 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
25705 @code{SWHILE} and also the @code{RMPA} instruction. These
25706 instructions may prefetch data, which is not safe to do if accessing
25707 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
25708 for more information).
25710 The default is to allow these instructions, but it is not possible for
25711 GCC to reliably detect all circumstances where a string instruction
25712 might be used to access an I/O register, so their use cannot be
25713 disabled automatically. Instead it is reliant upon the programmer to
25714 use the @option{-mno-allow-string-insns} option if their program
25715 accesses I/O space.
25717 When the instructions are enabled GCC defines the C preprocessor
25718 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25719 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25725 Use only (or not only) @code{JSR} instructions to access functions.
25726 This option can be used when code size exceeds the range of @code{BSR}
25727 instructions. Note that @option{-mno-jsr} does not mean to not use
25728 @code{JSR} but instead means that any type of branch may be used.
25731 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25732 has special significance to the RX port when used with the
25733 @code{interrupt} function attribute. This attribute indicates a
25734 function intended to process fast interrupts. GCC ensures
25735 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25736 and/or @code{r13} and only provided that the normal use of the
25737 corresponding registers have been restricted via the
25738 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25741 @node S/390 and zSeries Options
25742 @subsection S/390 and zSeries Options
25743 @cindex S/390 and zSeries Options
25745 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25749 @itemx -msoft-float
25750 @opindex mhard-float
25751 @opindex msoft-float
25752 Use (do not use) the hardware floating-point instructions and registers
25753 for floating-point operations. When @option{-msoft-float} is specified,
25754 functions in @file{libgcc.a} are used to perform floating-point
25755 operations. When @option{-mhard-float} is specified, the compiler
25756 generates IEEE floating-point instructions. This is the default.
25759 @itemx -mno-hard-dfp
25761 @opindex mno-hard-dfp
25762 Use (do not use) the hardware decimal-floating-point instructions for
25763 decimal-floating-point operations. When @option{-mno-hard-dfp} is
25764 specified, functions in @file{libgcc.a} are used to perform
25765 decimal-floating-point operations. When @option{-mhard-dfp} is
25766 specified, the compiler generates decimal-floating-point hardware
25767 instructions. This is the default for @option{-march=z9-ec} or higher.
25769 @item -mlong-double-64
25770 @itemx -mlong-double-128
25771 @opindex mlong-double-64
25772 @opindex mlong-double-128
25773 These switches control the size of @code{long double} type. A size
25774 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25775 type. This is the default.
25778 @itemx -mno-backchain
25779 @opindex mbackchain
25780 @opindex mno-backchain
25781 Store (do not store) the address of the caller's frame as backchain pointer
25782 into the callee's stack frame.
25783 A backchain may be needed to allow debugging using tools that do not understand
25784 DWARF call frame information.
25785 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25786 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25787 the backchain is placed into the topmost word of the 96/160 byte register
25790 In general, code compiled with @option{-mbackchain} is call-compatible with
25791 code compiled with @option{-mmo-backchain}; however, use of the backchain
25792 for debugging purposes usually requires that the whole binary is built with
25793 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
25794 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25795 to build a linux kernel use @option{-msoft-float}.
25797 The default is to not maintain the backchain.
25799 @item -mpacked-stack
25800 @itemx -mno-packed-stack
25801 @opindex mpacked-stack
25802 @opindex mno-packed-stack
25803 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
25804 specified, the compiler uses the all fields of the 96/160 byte register save
25805 area only for their default purpose; unused fields still take up stack space.
25806 When @option{-mpacked-stack} is specified, register save slots are densely
25807 packed at the top of the register save area; unused space is reused for other
25808 purposes, allowing for more efficient use of the available stack space.
25809 However, when @option{-mbackchain} is also in effect, the topmost word of
25810 the save area is always used to store the backchain, and the return address
25811 register is always saved two words below the backchain.
25813 As long as the stack frame backchain is not used, code generated with
25814 @option{-mpacked-stack} is call-compatible with code generated with
25815 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
25816 S/390 or zSeries generated code that uses the stack frame backchain at run
25817 time, not just for debugging purposes. Such code is not call-compatible
25818 with code compiled with @option{-mpacked-stack}. Also, note that the
25819 combination of @option{-mbackchain},
25820 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25821 to build a linux kernel use @option{-msoft-float}.
25823 The default is to not use the packed stack layout.
25826 @itemx -mno-small-exec
25827 @opindex msmall-exec
25828 @opindex mno-small-exec
25829 Generate (or do not generate) code using the @code{bras} instruction
25830 to do subroutine calls.
25831 This only works reliably if the total executable size does not
25832 exceed 64k. The default is to use the @code{basr} instruction instead,
25833 which does not have this limitation.
25839 When @option{-m31} is specified, generate code compliant to the
25840 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
25841 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
25842 particular to generate 64-bit instructions. For the @samp{s390}
25843 targets, the default is @option{-m31}, while the @samp{s390x}
25844 targets default to @option{-m64}.
25850 When @option{-mzarch} is specified, generate code using the
25851 instructions available on z/Architecture.
25852 When @option{-mesa} is specified, generate code using the
25853 instructions available on ESA/390. Note that @option{-mesa} is
25854 not possible with @option{-m64}.
25855 When generating code compliant to the GNU/Linux for S/390 ABI,
25856 the default is @option{-mesa}. When generating code compliant
25857 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25863 The @option{-mhtm} option enables a set of builtins making use of
25864 instructions available with the transactional execution facility
25865 introduced with the IBM zEnterprise EC12 machine generation
25866 @ref{S/390 System z Built-in Functions}.
25867 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25873 When @option{-mvx} is specified, generate code using the instructions
25874 available with the vector extension facility introduced with the IBM
25875 z13 machine generation.
25876 This option changes the ABI for some vector type values with regard to
25877 alignment and calling conventions. In case vector type values are
25878 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25879 command will be added to mark the resulting binary with the ABI used.
25880 @option{-mvx} is enabled by default when using @option{-march=z13}.
25883 @itemx -mno-zvector
25885 @opindex mno-zvector
25886 The @option{-mzvector} option enables vector language extensions and
25887 builtins using instructions available with the vector extension
25888 facility introduced with the IBM z13 machine generation.
25889 This option adds support for @samp{vector} to be used as a keyword to
25890 define vector type variables and arguments. @samp{vector} is only
25891 available when GNU extensions are enabled. It will not be expanded
25892 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25893 In addition to the GCC low-level builtins @option{-mzvector} enables
25894 a set of builtins added for compatibility with AltiVec-style
25895 implementations like Power and Cell. In order to make use of these
25896 builtins the header file @file{vecintrin.h} needs to be included.
25897 @option{-mzvector} is disabled by default.
25903 Generate (or do not generate) code using the @code{mvcle} instruction
25904 to perform block moves. When @option{-mno-mvcle} is specified,
25905 use a @code{mvc} loop instead. This is the default unless optimizing for
25912 Print (or do not print) additional debug information when compiling.
25913 The default is to not print debug information.
25915 @item -march=@var{cpu-type}
25917 Generate code that runs on @var{cpu-type}, which is the name of a
25918 system representing a certain processor type. Possible values for
25919 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25920 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25921 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11}, and
25924 The default is @option{-march=z900}.
25926 Specifying @samp{native} as cpu type can be used to select the best
25927 architecture option for the host processor.
25928 @option{-march=native} has no effect if GCC does not recognize the
25931 @item -mtune=@var{cpu-type}
25933 Tune to @var{cpu-type} everything applicable about the generated code,
25934 except for the ABI and the set of available instructions.
25935 The list of @var{cpu-type} values is the same as for @option{-march}.
25936 The default is the value used for @option{-march}.
25939 @itemx -mno-tpf-trace
25940 @opindex mtpf-trace
25941 @opindex mno-tpf-trace
25942 Generate code that adds (does not add) in TPF OS specific branches to trace
25943 routines in the operating system. This option is off by default, even
25944 when compiling for the TPF OS@.
25947 @itemx -mno-fused-madd
25948 @opindex mfused-madd
25949 @opindex mno-fused-madd
25950 Generate code that uses (does not use) the floating-point multiply and
25951 accumulate instructions. These instructions are generated by default if
25952 hardware floating point is used.
25954 @item -mwarn-framesize=@var{framesize}
25955 @opindex mwarn-framesize
25956 Emit a warning if the current function exceeds the given frame size. Because
25957 this is a compile-time check it doesn't need to be a real problem when the program
25958 runs. It is intended to identify functions that most probably cause
25959 a stack overflow. It is useful to be used in an environment with limited stack
25960 size e.g.@: the linux kernel.
25962 @item -mwarn-dynamicstack
25963 @opindex mwarn-dynamicstack
25964 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
25965 arrays. This is generally a bad idea with a limited stack size.
25967 @item -mstack-guard=@var{stack-guard}
25968 @itemx -mstack-size=@var{stack-size}
25969 @opindex mstack-guard
25970 @opindex mstack-size
25971 If these options are provided the S/390 back end emits additional instructions in
25972 the function prologue that trigger a trap if the stack size is @var{stack-guard}
25973 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
25974 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
25975 the frame size of the compiled function is chosen.
25976 These options are intended to be used to help debugging stack overflow problems.
25977 The additionally emitted code causes only little overhead and hence can also be
25978 used in production-like systems without greater performance degradation. The given
25979 values have to be exact powers of 2 and @var{stack-size} has to be greater than
25980 @var{stack-guard} without exceeding 64k.
25981 In order to be efficient the extra code makes the assumption that the stack starts
25982 at an address aligned to the value given by @var{stack-size}.
25983 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
25985 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
25987 If the hotpatch option is enabled, a ``hot-patching'' function
25988 prologue is generated for all functions in the compilation unit.
25989 The funtion label is prepended with the given number of two-byte
25990 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
25991 the label, 2 * @var{post-halfwords} bytes are appended, using the
25992 largest NOP like instructions the architecture allows (maximum
25995 If both arguments are zero, hotpatching is disabled.
25997 This option can be overridden for individual functions with the
25998 @code{hotpatch} attribute.
26001 @node Score Options
26002 @subsection Score Options
26003 @cindex Score Options
26005 These options are defined for Score implementations:
26010 Compile code for big-endian mode. This is the default.
26014 Compile code for little-endian mode.
26018 Disable generation of @code{bcnz} instructions.
26022 Enable generation of unaligned load and store instructions.
26026 Enable the use of multiply-accumulate instructions. Disabled by default.
26030 Specify the SCORE5 as the target architecture.
26034 Specify the SCORE5U of the target architecture.
26038 Specify the SCORE7 as the target architecture. This is the default.
26042 Specify the SCORE7D as the target architecture.
26046 @subsection SH Options
26048 These @samp{-m} options are defined for the SH implementations:
26053 Generate code for the SH1.
26057 Generate code for the SH2.
26060 Generate code for the SH2e.
26064 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
26065 that the floating-point unit is not used.
26067 @item -m2a-single-only
26068 @opindex m2a-single-only
26069 Generate code for the SH2a-FPU, in such a way that no double-precision
26070 floating-point operations are used.
26073 @opindex m2a-single
26074 Generate code for the SH2a-FPU assuming the floating-point unit is in
26075 single-precision mode by default.
26079 Generate code for the SH2a-FPU assuming the floating-point unit is in
26080 double-precision mode by default.
26084 Generate code for the SH3.
26088 Generate code for the SH3e.
26092 Generate code for the SH4 without a floating-point unit.
26094 @item -m4-single-only
26095 @opindex m4-single-only
26096 Generate code for the SH4 with a floating-point unit that only
26097 supports single-precision arithmetic.
26101 Generate code for the SH4 assuming the floating-point unit is in
26102 single-precision mode by default.
26106 Generate code for the SH4.
26110 Generate code for SH4-100.
26112 @item -m4-100-nofpu
26113 @opindex m4-100-nofpu
26114 Generate code for SH4-100 in such a way that the
26115 floating-point unit is not used.
26117 @item -m4-100-single
26118 @opindex m4-100-single
26119 Generate code for SH4-100 assuming the floating-point unit is in
26120 single-precision mode by default.
26122 @item -m4-100-single-only
26123 @opindex m4-100-single-only
26124 Generate code for SH4-100 in such a way that no double-precision
26125 floating-point operations are used.
26129 Generate code for SH4-200.
26131 @item -m4-200-nofpu
26132 @opindex m4-200-nofpu
26133 Generate code for SH4-200 without in such a way that the
26134 floating-point unit is not used.
26136 @item -m4-200-single
26137 @opindex m4-200-single
26138 Generate code for SH4-200 assuming the floating-point unit is in
26139 single-precision mode by default.
26141 @item -m4-200-single-only
26142 @opindex m4-200-single-only
26143 Generate code for SH4-200 in such a way that no double-precision
26144 floating-point operations are used.
26148 Generate code for SH4-300.
26150 @item -m4-300-nofpu
26151 @opindex m4-300-nofpu
26152 Generate code for SH4-300 without in such a way that the
26153 floating-point unit is not used.
26155 @item -m4-300-single
26156 @opindex m4-300-single
26157 Generate code for SH4-300 in such a way that no double-precision
26158 floating-point operations are used.
26160 @item -m4-300-single-only
26161 @opindex m4-300-single-only
26162 Generate code for SH4-300 in such a way that no double-precision
26163 floating-point operations are used.
26167 Generate code for SH4-340 (no MMU, no FPU).
26171 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
26176 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
26177 floating-point unit is not used.
26179 @item -m4a-single-only
26180 @opindex m4a-single-only
26181 Generate code for the SH4a, in such a way that no double-precision
26182 floating-point operations are used.
26185 @opindex m4a-single
26186 Generate code for the SH4a assuming the floating-point unit is in
26187 single-precision mode by default.
26191 Generate code for the SH4a.
26195 Same as @option{-m4a-nofpu}, except that it implicitly passes
26196 @option{-dsp} to the assembler. GCC doesn't generate any DSP
26197 instructions at the moment.
26201 Compile code for the processor in big-endian mode.
26205 Compile code for the processor in little-endian mode.
26209 Align doubles at 64-bit boundaries. Note that this changes the calling
26210 conventions, and thus some functions from the standard C library do
26211 not work unless you recompile it first with @option{-mdalign}.
26215 Shorten some address references at link time, when possible; uses the
26216 linker option @option{-relax}.
26220 Use 32-bit offsets in @code{switch} tables. The default is to use
26225 Enable the use of bit manipulation instructions on SH2A.
26229 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
26230 alignment constraints.
26234 Comply with the calling conventions defined by Renesas.
26237 @opindex mno-renesas
26238 Comply with the calling conventions defined for GCC before the Renesas
26239 conventions were available. This option is the default for all
26240 targets of the SH toolchain.
26243 @opindex mnomacsave
26244 Mark the @code{MAC} register as call-clobbered, even if
26245 @option{-mrenesas} is given.
26251 Control the IEEE compliance of floating-point comparisons, which affects the
26252 handling of cases where the result of a comparison is unordered. By default
26253 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
26254 enabled @option{-mno-ieee} is implicitly set, which results in faster
26255 floating-point greater-equal and less-equal comparisons. The implicit settings
26256 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
26258 @item -minline-ic_invalidate
26259 @opindex minline-ic_invalidate
26260 Inline code to invalidate instruction cache entries after setting up
26261 nested function trampolines.
26262 This option has no effect if @option{-musermode} is in effect and the selected
26263 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
26265 If the selected code generation option does not allow the use of the @code{icbi}
26266 instruction, and @option{-musermode} is not in effect, the inlined code
26267 manipulates the instruction cache address array directly with an associative
26268 write. This not only requires privileged mode at run time, but it also
26269 fails if the cache line had been mapped via the TLB and has become unmapped.
26273 Dump instruction size and location in the assembly code.
26276 @opindex mpadstruct
26277 This option is deprecated. It pads structures to multiple of 4 bytes,
26278 which is incompatible with the SH ABI@.
26280 @item -matomic-model=@var{model}
26281 @opindex matomic-model=@var{model}
26282 Sets the model of atomic operations and additional parameters as a comma
26283 separated list. For details on the atomic built-in functions see
26284 @ref{__atomic Builtins}. The following models and parameters are supported:
26289 Disable compiler generated atomic sequences and emit library calls for atomic
26290 operations. This is the default if the target is not @code{sh*-*-linux*}.
26293 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
26294 built-in functions. The generated atomic sequences require additional support
26295 from the interrupt/exception handling code of the system and are only suitable
26296 for SH3* and SH4* single-core systems. This option is enabled by default when
26297 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
26298 this option also partially utilizes the hardware atomic instructions
26299 @code{movli.l} and @code{movco.l} to create more efficient code, unless
26300 @samp{strict} is specified.
26303 Generate software atomic sequences that use a variable in the thread control
26304 block. This is a variation of the gUSA sequences which can also be used on
26305 SH1* and SH2* targets. The generated atomic sequences require additional
26306 support from the interrupt/exception handling code of the system and are only
26307 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
26308 parameter has to be specified as well.
26311 Generate software atomic sequences that temporarily disable interrupts by
26312 setting @code{SR.IMASK = 1111}. This model works only when the program runs
26313 in privileged mode and is only suitable for single-core systems. Additional
26314 support from the interrupt/exception handling code of the system is not
26315 required. This model is enabled by default when the target is
26316 @code{sh*-*-linux*} and SH1* or SH2*.
26319 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
26320 instructions only. This is only available on SH4A and is suitable for
26321 multi-core systems. Since the hardware instructions support only 32 bit atomic
26322 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
26323 Code compiled with this option is also compatible with other software
26324 atomic model interrupt/exception handling systems if executed on an SH4A
26325 system. Additional support from the interrupt/exception handling code of the
26326 system is not required for this model.
26329 This parameter specifies the offset in bytes of the variable in the thread
26330 control block structure that should be used by the generated atomic sequences
26331 when the @samp{soft-tcb} model has been selected. For other models this
26332 parameter is ignored. The specified value must be an integer multiple of four
26333 and in the range 0-1020.
26336 This parameter prevents mixed usage of multiple atomic models, even if they
26337 are compatible, and makes the compiler generate atomic sequences of the
26338 specified model only.
26344 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
26345 Notice that depending on the particular hardware and software configuration
26346 this can degrade overall performance due to the operand cache line flushes
26347 that are implied by the @code{tas.b} instruction. On multi-core SH4A
26348 processors the @code{tas.b} instruction must be used with caution since it
26349 can result in data corruption for certain cache configurations.
26352 @opindex mprefergot
26353 When generating position-independent code, emit function calls using
26354 the Global Offset Table instead of the Procedure Linkage Table.
26357 @itemx -mno-usermode
26359 @opindex mno-usermode
26360 Don't allow (allow) the compiler generating privileged mode code. Specifying
26361 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
26362 inlined code would not work in user mode. @option{-musermode} is the default
26363 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
26364 @option{-musermode} has no effect, since there is no user mode.
26366 @item -multcost=@var{number}
26367 @opindex multcost=@var{number}
26368 Set the cost to assume for a multiply insn.
26370 @item -mdiv=@var{strategy}
26371 @opindex mdiv=@var{strategy}
26372 Set the division strategy to be used for integer division operations.
26373 @var{strategy} can be one of:
26378 Calls a library function that uses the single-step division instruction
26379 @code{div1} to perform the operation. Division by zero calculates an
26380 unspecified result and does not trap. This is the default except for SH4,
26381 SH2A and SHcompact.
26384 Calls a library function that performs the operation in double precision
26385 floating point. Division by zero causes a floating-point exception. This is
26386 the default for SHcompact with FPU. Specifying this for targets that do not
26387 have a double precision FPU defaults to @code{call-div1}.
26390 Calls a library function that uses a lookup table for small divisors and
26391 the @code{div1} instruction with case distinction for larger divisors. Division
26392 by zero calculates an unspecified result and does not trap. This is the default
26393 for SH4. Specifying this for targets that do not have dynamic shift
26394 instructions defaults to @code{call-div1}.
26398 When a division strategy has not been specified the default strategy is
26399 selected based on the current target. For SH2A the default strategy is to
26400 use the @code{divs} and @code{divu} instructions instead of library function
26403 @item -maccumulate-outgoing-args
26404 @opindex maccumulate-outgoing-args
26405 Reserve space once for outgoing arguments in the function prologue rather
26406 than around each call. Generally beneficial for performance and size. Also
26407 needed for unwinding to avoid changing the stack frame around conditional code.
26409 @item -mdivsi3_libfunc=@var{name}
26410 @opindex mdivsi3_libfunc=@var{name}
26411 Set the name of the library function used for 32-bit signed division to
26413 This only affects the name used in the @samp{call} division strategies, and
26414 the compiler still expects the same sets of input/output/clobbered registers as
26415 if this option were not present.
26417 @item -mfixed-range=@var{register-range}
26418 @opindex mfixed-range
26419 Generate code treating the given register range as fixed registers.
26420 A fixed register is one that the register allocator can not use. This is
26421 useful when compiling kernel code. A register range is specified as
26422 two registers separated by a dash. Multiple register ranges can be
26423 specified separated by a comma.
26425 @item -mbranch-cost=@var{num}
26426 @opindex mbranch-cost=@var{num}
26427 Assume @var{num} to be the cost for a branch instruction. Higher numbers
26428 make the compiler try to generate more branch-free code if possible.
26429 If not specified the value is selected depending on the processor type that
26430 is being compiled for.
26433 @itemx -mno-zdcbranch
26434 @opindex mzdcbranch
26435 @opindex mno-zdcbranch
26436 Assume (do not assume) that zero displacement conditional branch instructions
26437 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
26438 compiler prefers zero displacement branch code sequences. This is
26439 enabled by default when generating code for SH4 and SH4A. It can be explicitly
26440 disabled by specifying @option{-mno-zdcbranch}.
26442 @item -mcbranch-force-delay-slot
26443 @opindex mcbranch-force-delay-slot
26444 Force the usage of delay slots for conditional branches, which stuffs the delay
26445 slot with a @code{nop} if a suitable instruction cannot be found. By default
26446 this option is disabled. It can be enabled to work around hardware bugs as
26447 found in the original SH7055.
26450 @itemx -mno-fused-madd
26451 @opindex mfused-madd
26452 @opindex mno-fused-madd
26453 Generate code that uses (does not use) the floating-point multiply and
26454 accumulate instructions. These instructions are generated by default
26455 if hardware floating point is used. The machine-dependent
26456 @option{-mfused-madd} option is now mapped to the machine-independent
26457 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26458 mapped to @option{-ffp-contract=off}.
26464 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
26465 and cosine approximations. The option @option{-mfsca} must be used in
26466 combination with @option{-funsafe-math-optimizations}. It is enabled by default
26467 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
26468 approximations even if @option{-funsafe-math-optimizations} is in effect.
26474 Allow or disallow the compiler to emit the @code{fsrra} instruction for
26475 reciprocal square root approximations. The option @option{-mfsrra} must be used
26476 in combination with @option{-funsafe-math-optimizations} and
26477 @option{-ffinite-math-only}. It is enabled by default when generating code for
26478 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
26479 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
26482 @item -mpretend-cmove
26483 @opindex mpretend-cmove
26484 Prefer zero-displacement conditional branches for conditional move instruction
26485 patterns. This can result in faster code on the SH4 processor.
26489 Generate code using the FDPIC ABI.
26493 @node Solaris 2 Options
26494 @subsection Solaris 2 Options
26495 @cindex Solaris 2 options
26497 These @samp{-m} options are supported on Solaris 2:
26500 @item -mclear-hwcap
26501 @opindex mclear-hwcap
26502 @option{-mclear-hwcap} tells the compiler to remove the hardware
26503 capabilities generated by the Solaris assembler. This is only necessary
26504 when object files use ISA extensions not supported by the current
26505 machine, but check at runtime whether or not to use them.
26507 @item -mimpure-text
26508 @opindex mimpure-text
26509 @option{-mimpure-text}, used in addition to @option{-shared}, tells
26510 the compiler to not pass @option{-z text} to the linker when linking a
26511 shared object. Using this option, you can link position-dependent
26512 code into a shared object.
26514 @option{-mimpure-text} suppresses the ``relocations remain against
26515 allocatable but non-writable sections'' linker error message.
26516 However, the necessary relocations trigger copy-on-write, and the
26517 shared object is not actually shared across processes. Instead of
26518 using @option{-mimpure-text}, you should compile all source code with
26519 @option{-fpic} or @option{-fPIC}.
26523 These switches are supported in addition to the above on Solaris 2:
26528 This is a synonym for @option{-pthread}.
26531 @node SPARC Options
26532 @subsection SPARC Options
26533 @cindex SPARC options
26535 These @samp{-m} options are supported on the SPARC:
26538 @item -mno-app-regs
26540 @opindex mno-app-regs
26542 Specify @option{-mapp-regs} to generate output using the global registers
26543 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
26544 global register 1, each global register 2 through 4 is then treated as an
26545 allocable register that is clobbered by function calls. This is the default.
26547 To be fully SVR4 ABI-compliant at the cost of some performance loss,
26548 specify @option{-mno-app-regs}. You should compile libraries and system
26549 software with this option.
26555 With @option{-mflat}, the compiler does not generate save/restore instructions
26556 and uses a ``flat'' or single register window model. This model is compatible
26557 with the regular register window model. The local registers and the input
26558 registers (0--5) are still treated as ``call-saved'' registers and are
26559 saved on the stack as needed.
26561 With @option{-mno-flat} (the default), the compiler generates save/restore
26562 instructions (except for leaf functions). This is the normal operating mode.
26565 @itemx -mhard-float
26567 @opindex mhard-float
26568 Generate output containing floating-point instructions. This is the
26572 @itemx -msoft-float
26574 @opindex msoft-float
26575 Generate output containing library calls for floating point.
26576 @strong{Warning:} the requisite libraries are not available for all SPARC
26577 targets. Normally the facilities of the machine's usual C compiler are
26578 used, but this cannot be done directly in cross-compilation. You must make
26579 your own arrangements to provide suitable library functions for
26580 cross-compilation. The embedded targets @samp{sparc-*-aout} and
26581 @samp{sparclite-*-*} do provide software floating-point support.
26583 @option{-msoft-float} changes the calling convention in the output file;
26584 therefore, it is only useful if you compile @emph{all} of a program with
26585 this option. In particular, you need to compile @file{libgcc.a}, the
26586 library that comes with GCC, with @option{-msoft-float} in order for
26589 @item -mhard-quad-float
26590 @opindex mhard-quad-float
26591 Generate output containing quad-word (long double) floating-point
26594 @item -msoft-quad-float
26595 @opindex msoft-quad-float
26596 Generate output containing library calls for quad-word (long double)
26597 floating-point instructions. The functions called are those specified
26598 in the SPARC ABI@. This is the default.
26600 As of this writing, there are no SPARC implementations that have hardware
26601 support for the quad-word floating-point instructions. They all invoke
26602 a trap handler for one of these instructions, and then the trap handler
26603 emulates the effect of the instruction. Because of the trap handler overhead,
26604 this is much slower than calling the ABI library routines. Thus the
26605 @option{-msoft-quad-float} option is the default.
26607 @item -mno-unaligned-doubles
26608 @itemx -munaligned-doubles
26609 @opindex mno-unaligned-doubles
26610 @opindex munaligned-doubles
26611 Assume that doubles have 8-byte alignment. This is the default.
26613 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
26614 alignment only if they are contained in another type, or if they have an
26615 absolute address. Otherwise, it assumes they have 4-byte alignment.
26616 Specifying this option avoids some rare compatibility problems with code
26617 generated by other compilers. It is not the default because it results
26618 in a performance loss, especially for floating-point code.
26621 @itemx -mno-user-mode
26622 @opindex muser-mode
26623 @opindex mno-user-mode
26624 Do not generate code that can only run in supervisor mode. This is relevant
26625 only for the @code{casa} instruction emitted for the LEON3 processor. This
26628 @item -mfaster-structs
26629 @itemx -mno-faster-structs
26630 @opindex mfaster-structs
26631 @opindex mno-faster-structs
26632 With @option{-mfaster-structs}, the compiler assumes that structures
26633 should have 8-byte alignment. This enables the use of pairs of
26634 @code{ldd} and @code{std} instructions for copies in structure
26635 assignment, in place of twice as many @code{ld} and @code{st} pairs.
26636 However, the use of this changed alignment directly violates the SPARC
26637 ABI@. Thus, it's intended only for use on targets where the developer
26638 acknowledges that their resulting code is not directly in line with
26639 the rules of the ABI@.
26641 @item -mstd-struct-return
26642 @itemx -mno-std-struct-return
26643 @opindex mstd-struct-return
26644 @opindex mno-std-struct-return
26645 With @option{-mstd-struct-return}, the compiler generates checking code
26646 in functions returning structures or unions to detect size mismatches
26647 between the two sides of function calls, as per the 32-bit ABI@.
26649 The default is @option{-mno-std-struct-return}. This option has no effect
26656 Enable Local Register Allocation. This is the default for SPARC since GCC 7
26657 so @option{-mno-lra} needs to be passed to get old Reload.
26659 @item -mcpu=@var{cpu_type}
26661 Set the instruction set, register set, and instruction scheduling parameters
26662 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26663 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
26664 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
26665 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
26666 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
26667 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
26669 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
26670 which selects the best architecture option for the host processor.
26671 @option{-mcpu=native} has no effect if GCC does not recognize
26674 Default instruction scheduling parameters are used for values that select
26675 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
26676 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
26678 Here is a list of each supported architecture and their supported
26686 supersparc, hypersparc, leon, leon3
26689 f930, f934, sparclite86x
26695 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26699 By default (unless configured otherwise), GCC generates code for the V7
26700 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
26701 additionally optimizes it for the Cypress CY7C602 chip, as used in the
26702 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
26703 SPARCStation 1, 2, IPX etc.
26705 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
26706 architecture. The only difference from V7 code is that the compiler emits
26707 the integer multiply and integer divide instructions which exist in SPARC-V8
26708 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
26709 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
26712 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
26713 the SPARC architecture. This adds the integer multiply, integer divide step
26714 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26715 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26716 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
26717 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26718 MB86934 chip, which is the more recent SPARClite with FPU@.
26720 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26721 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
26722 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26723 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
26724 optimizes it for the TEMIC SPARClet chip.
26726 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26727 architecture. This adds 64-bit integer and floating-point move instructions,
26728 3 additional floating-point condition code registers and conditional move
26729 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
26730 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
26731 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26732 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26733 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26734 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
26735 additionally optimizes it for Sun UltraSPARC T2 chips. With
26736 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26737 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
26738 additionally optimizes it for Sun UltraSPARC T4 chips. With
26739 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26740 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
26741 additionally optimizes it for Oracle M8 chips.
26743 @item -mtune=@var{cpu_type}
26745 Set the instruction scheduling parameters for machine type
26746 @var{cpu_type}, but do not set the instruction set or register set that the
26747 option @option{-mcpu=@var{cpu_type}} does.
26749 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26750 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26751 that select a particular CPU implementation. Those are
26752 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26753 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26754 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26755 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26756 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
26757 and GNU/Linux toolchains, @samp{native} can also be used.
26762 @opindex mno-v8plus
26763 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
26764 difference from the V8 ABI is that the global and out registers are
26765 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
26766 mode for all SPARC-V9 processors.
26772 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26773 Visual Instruction Set extensions. The default is @option{-mno-vis}.
26779 With @option{-mvis2}, GCC generates code that takes advantage of
26780 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
26781 default is @option{-mvis2} when targeting a cpu that supports such
26782 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
26783 also sets @option{-mvis}.
26789 With @option{-mvis3}, GCC generates code that takes advantage of
26790 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
26791 default is @option{-mvis3} when targeting a cpu that supports such
26792 instructions, such as niagara-3 and later. Setting @option{-mvis3}
26793 also sets @option{-mvis2} and @option{-mvis}.
26799 With @option{-mvis4}, GCC generates code that takes advantage of
26800 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
26801 default is @option{-mvis4} when targeting a cpu that supports such
26802 instructions, such as niagara-7 and later. Setting @option{-mvis4}
26803 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26809 With @option{-mvis4b}, GCC generates code that takes advantage of
26810 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26811 the additional VIS instructions introduced in the Oracle SPARC
26812 Architecture 2017. The default is @option{-mvis4b} when targeting a
26813 cpu that supports such instructions, such as m8 and later. Setting
26814 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26815 @option{-mvis2} and @option{-mvis}.
26820 @opindex mno-cbcond
26821 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26822 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
26823 when targeting a CPU that supports such instructions, such as Niagara-4 and
26830 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26831 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
26832 when targeting a CPU that supports such instructions, such as Niagara-3 and
26838 @opindex mno-fsmuld
26839 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26840 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
26841 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26842 or V9 with FPU except @option{-mcpu=leon}.
26848 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26849 Population Count instruction. The default is @option{-mpopc}
26850 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26857 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26858 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
26859 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26863 @opindex mfix-at697f
26864 Enable the documented workaround for the single erratum of the Atmel AT697F
26865 processor (which corresponds to erratum #13 of the AT697E processor).
26868 @opindex mfix-ut699
26869 Enable the documented workarounds for the floating-point errata and the data
26870 cache nullify errata of the UT699 processor.
26873 @opindex mfix-ut700
26874 Enable the documented workaround for the back-to-back store errata of
26875 the UT699E/UT700 processor.
26877 @item -mfix-gr712rc
26878 @opindex mfix-gr712rc
26879 Enable the documented workaround for the back-to-back store errata of
26880 the GR712RC processor.
26883 These @samp{-m} options are supported in addition to the above
26884 on SPARC-V9 processors in 64-bit environments:
26891 Generate code for a 32-bit or 64-bit environment.
26892 The 32-bit environment sets int, long and pointer to 32 bits.
26893 The 64-bit environment sets int to 32 bits and long and pointer
26896 @item -mcmodel=@var{which}
26898 Set the code model to one of
26902 The Medium/Low code model: 64-bit addresses, programs
26903 must be linked in the low 32 bits of memory. Programs can be statically
26904 or dynamically linked.
26907 The Medium/Middle code model: 64-bit addresses, programs
26908 must be linked in the low 44 bits of memory, the text and data segments must
26909 be less than 2GB in size and the data segment must be located within 2GB of
26913 The Medium/Anywhere code model: 64-bit addresses, programs
26914 may be linked anywhere in memory, the text and data segments must be less
26915 than 2GB in size and the data segment must be located within 2GB of the
26919 The Medium/Anywhere code model for embedded systems:
26920 64-bit addresses, the text and data segments must be less than 2GB in
26921 size, both starting anywhere in memory (determined at link time). The
26922 global register %g4 points to the base of the data segment. Programs
26923 are statically linked and PIC is not supported.
26926 @item -mmemory-model=@var{mem-model}
26927 @opindex mmemory-model
26928 Set the memory model in force on the processor to one of
26932 The default memory model for the processor and operating system.
26935 Relaxed Memory Order
26938 Partial Store Order
26944 Sequential Consistency
26947 These memory models are formally defined in Appendix D of the SPARC-V9
26948 architecture manual, as set in the processor's @code{PSTATE.MM} field.
26951 @itemx -mno-stack-bias
26952 @opindex mstack-bias
26953 @opindex mno-stack-bias
26954 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
26955 frame pointer if present, are offset by @minus{}2047 which must be added back
26956 when making stack frame references. This is the default in 64-bit mode.
26957 Otherwise, assume no such offset is present.
26961 @subsection SPU Options
26962 @cindex SPU options
26964 These @samp{-m} options are supported on the SPU:
26968 @itemx -merror-reloc
26969 @opindex mwarn-reloc
26970 @opindex merror-reloc
26972 The loader for SPU does not handle dynamic relocations. By default, GCC
26973 gives an error when it generates code that requires a dynamic
26974 relocation. @option{-mno-error-reloc} disables the error,
26975 @option{-mwarn-reloc} generates a warning instead.
26978 @itemx -munsafe-dma
26980 @opindex munsafe-dma
26982 Instructions that initiate or test completion of DMA must not be
26983 reordered with respect to loads and stores of the memory that is being
26985 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
26986 memory accesses, but that can lead to inefficient code in places where the
26987 memory is known to not change. Rather than mark the memory as volatile,
26988 you can use @option{-msafe-dma} to tell the compiler to treat
26989 the DMA instructions as potentially affecting all memory.
26991 @item -mbranch-hints
26992 @opindex mbranch-hints
26994 By default, GCC generates a branch hint instruction to avoid
26995 pipeline stalls for always-taken or probably-taken branches. A hint
26996 is not generated closer than 8 instructions away from its branch.
26997 There is little reason to disable them, except for debugging purposes,
26998 or to make an object a little bit smaller.
27002 @opindex msmall-mem
27003 @opindex mlarge-mem
27005 By default, GCC generates code assuming that addresses are never larger
27006 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
27007 a full 32-bit address.
27012 By default, GCC links against startup code that assumes the SPU-style
27013 main function interface (which has an unconventional parameter list).
27014 With @option{-mstdmain}, GCC links your program against startup
27015 code that assumes a C99-style interface to @code{main}, including a
27016 local copy of @code{argv} strings.
27018 @item -mfixed-range=@var{register-range}
27019 @opindex mfixed-range
27020 Generate code treating the given register range as fixed registers.
27021 A fixed register is one that the register allocator cannot use. This is
27022 useful when compiling kernel code. A register range is specified as
27023 two registers separated by a dash. Multiple register ranges can be
27024 specified separated by a comma.
27030 Compile code assuming that pointers to the PPU address space accessed
27031 via the @code{__ea} named address space qualifier are either 32 or 64
27032 bits wide. The default is 32 bits. As this is an ABI-changing option,
27033 all object code in an executable must be compiled with the same setting.
27035 @item -maddress-space-conversion
27036 @itemx -mno-address-space-conversion
27037 @opindex maddress-space-conversion
27038 @opindex mno-address-space-conversion
27039 Allow/disallow treating the @code{__ea} address space as superset
27040 of the generic address space. This enables explicit type casts
27041 between @code{__ea} and generic pointer as well as implicit
27042 conversions of generic pointers to @code{__ea} pointers. The
27043 default is to allow address space pointer conversions.
27045 @item -mcache-size=@var{cache-size}
27046 @opindex mcache-size
27047 This option controls the version of libgcc that the compiler links to an
27048 executable and selects a software-managed cache for accessing variables
27049 in the @code{__ea} address space with a particular cache size. Possible
27050 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
27051 and @samp{128}. The default cache size is 64KB.
27053 @item -matomic-updates
27054 @itemx -mno-atomic-updates
27055 @opindex matomic-updates
27056 @opindex mno-atomic-updates
27057 This option controls the version of libgcc that the compiler links to an
27058 executable and selects whether atomic updates to the software-managed
27059 cache of PPU-side variables are used. If you use atomic updates, changes
27060 to a PPU variable from SPU code using the @code{__ea} named address space
27061 qualifier do not interfere with changes to other PPU variables residing
27062 in the same cache line from PPU code. If you do not use atomic updates,
27063 such interference may occur; however, writing back cache lines is
27064 more efficient. The default behavior is to use atomic updates.
27067 @itemx -mdual-nops=@var{n}
27068 @opindex mdual-nops
27069 By default, GCC inserts NOPs to increase dual issue when it expects
27070 it to increase performance. @var{n} can be a value from 0 to 10. A
27071 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
27072 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
27074 @item -mhint-max-nops=@var{n}
27075 @opindex mhint-max-nops
27076 Maximum number of NOPs to insert for a branch hint. A branch hint must
27077 be at least 8 instructions away from the branch it is affecting. GCC
27078 inserts up to @var{n} NOPs to enforce this, otherwise it does not
27079 generate the branch hint.
27081 @item -mhint-max-distance=@var{n}
27082 @opindex mhint-max-distance
27083 The encoding of the branch hint instruction limits the hint to be within
27084 256 instructions of the branch it is affecting. By default, GCC makes
27085 sure it is within 125.
27088 @opindex msafe-hints
27089 Work around a hardware bug that causes the SPU to stall indefinitely.
27090 By default, GCC inserts the @code{hbrp} instruction to make sure
27091 this stall won't happen.
27095 @node System V Options
27096 @subsection Options for System V
27098 These additional options are available on System V Release 4 for
27099 compatibility with other compilers on those systems:
27104 Create a shared object.
27105 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
27109 Identify the versions of each tool used by the compiler, in a
27110 @code{.ident} assembler directive in the output.
27114 Refrain from adding @code{.ident} directives to the output file (this is
27117 @item -YP,@var{dirs}
27119 Search the directories @var{dirs}, and no others, for libraries
27120 specified with @option{-l}.
27122 @item -Ym,@var{dir}
27124 Look in the directory @var{dir} to find the M4 preprocessor.
27125 The assembler uses this option.
27126 @c This is supposed to go with a -Yd for predefined M4 macro files, but
27127 @c the generic assembler that comes with Solaris takes just -Ym.
27130 @node TILE-Gx Options
27131 @subsection TILE-Gx Options
27132 @cindex TILE-Gx options
27134 These @samp{-m} options are supported on the TILE-Gx:
27137 @item -mcmodel=small
27138 @opindex mcmodel=small
27139 Generate code for the small model. The distance for direct calls is
27140 limited to 500M in either direction. PC-relative addresses are 32
27141 bits. Absolute addresses support the full address range.
27143 @item -mcmodel=large
27144 @opindex mcmodel=large
27145 Generate code for the large model. There is no limitation on call
27146 distance, pc-relative addresses, or absolute addresses.
27148 @item -mcpu=@var{name}
27150 Selects the type of CPU to be targeted. Currently the only supported
27151 type is @samp{tilegx}.
27157 Generate code for a 32-bit or 64-bit environment. The 32-bit
27158 environment sets int, long, and pointer to 32 bits. The 64-bit
27159 environment sets int to 32 bits and long and pointer to 64 bits.
27162 @itemx -mlittle-endian
27163 @opindex mbig-endian
27164 @opindex mlittle-endian
27165 Generate code in big/little endian mode, respectively.
27168 @node TILEPro Options
27169 @subsection TILEPro Options
27170 @cindex TILEPro options
27172 These @samp{-m} options are supported on the TILEPro:
27175 @item -mcpu=@var{name}
27177 Selects the type of CPU to be targeted. Currently the only supported
27178 type is @samp{tilepro}.
27182 Generate code for a 32-bit environment, which sets int, long, and
27183 pointer to 32 bits. This is the only supported behavior so the flag
27184 is essentially ignored.
27188 @subsection V850 Options
27189 @cindex V850 Options
27191 These @samp{-m} options are defined for V850 implementations:
27195 @itemx -mno-long-calls
27196 @opindex mlong-calls
27197 @opindex mno-long-calls
27198 Treat all calls as being far away (near). If calls are assumed to be
27199 far away, the compiler always loads the function's address into a
27200 register, and calls indirect through the pointer.
27206 Do not optimize (do optimize) basic blocks that use the same index
27207 pointer 4 or more times to copy pointer into the @code{ep} register, and
27208 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
27209 option is on by default if you optimize.
27211 @item -mno-prolog-function
27212 @itemx -mprolog-function
27213 @opindex mno-prolog-function
27214 @opindex mprolog-function
27215 Do not use (do use) external functions to save and restore registers
27216 at the prologue and epilogue of a function. The external functions
27217 are slower, but use less code space if more than one function saves
27218 the same number of registers. The @option{-mprolog-function} option
27219 is on by default if you optimize.
27223 Try to make the code as small as possible. At present, this just turns
27224 on the @option{-mep} and @option{-mprolog-function} options.
27226 @item -mtda=@var{n}
27228 Put static or global variables whose size is @var{n} bytes or less into
27229 the tiny data area that register @code{ep} points to. The tiny data
27230 area can hold up to 256 bytes in total (128 bytes for byte references).
27232 @item -msda=@var{n}
27234 Put static or global variables whose size is @var{n} bytes or less into
27235 the small data area that register @code{gp} points to. The small data
27236 area can hold up to 64 kilobytes.
27238 @item -mzda=@var{n}
27240 Put static or global variables whose size is @var{n} bytes or less into
27241 the first 32 kilobytes of memory.
27245 Specify that the target processor is the V850.
27249 Specify that the target processor is the V850E3V5. The preprocessor
27250 constant @code{__v850e3v5__} is defined if this option is used.
27254 Specify that the target processor is the V850E3V5. This is an alias for
27255 the @option{-mv850e3v5} option.
27259 Specify that the target processor is the V850E2V3. The preprocessor
27260 constant @code{__v850e2v3__} is defined if this option is used.
27264 Specify that the target processor is the V850E2. The preprocessor
27265 constant @code{__v850e2__} is defined if this option is used.
27269 Specify that the target processor is the V850E1. The preprocessor
27270 constants @code{__v850e1__} and @code{__v850e__} are defined if
27271 this option is used.
27275 Specify that the target processor is the V850ES. This is an alias for
27276 the @option{-mv850e1} option.
27280 Specify that the target processor is the V850E@. The preprocessor
27281 constant @code{__v850e__} is defined if this option is used.
27283 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
27284 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
27285 are defined then a default target processor is chosen and the
27286 relevant @samp{__v850*__} preprocessor constant is defined.
27288 The preprocessor constants @code{__v850} and @code{__v851__} are always
27289 defined, regardless of which processor variant is the target.
27291 @item -mdisable-callt
27292 @itemx -mno-disable-callt
27293 @opindex mdisable-callt
27294 @opindex mno-disable-callt
27295 This option suppresses generation of the @code{CALLT} instruction for the
27296 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
27299 This option is enabled by default when the RH850 ABI is
27300 in use (see @option{-mrh850-abi}), and disabled by default when the
27301 GCC ABI is in use. If @code{CALLT} instructions are being generated
27302 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
27308 Pass on (or do not pass on) the @option{-mrelax} command-line option
27312 @itemx -mno-long-jumps
27313 @opindex mlong-jumps
27314 @opindex mno-long-jumps
27315 Disable (or re-enable) the generation of PC-relative jump instructions.
27318 @itemx -mhard-float
27319 @opindex msoft-float
27320 @opindex mhard-float
27321 Disable (or re-enable) the generation of hardware floating point
27322 instructions. This option is only significant when the target
27323 architecture is @samp{V850E2V3} or higher. If hardware floating point
27324 instructions are being generated then the C preprocessor symbol
27325 @code{__FPU_OK__} is defined, otherwise the symbol
27326 @code{__NO_FPU__} is defined.
27330 Enables the use of the e3v5 LOOP instruction. The use of this
27331 instruction is not enabled by default when the e3v5 architecture is
27332 selected because its use is still experimental.
27336 @opindex mrh850-abi
27338 Enables support for the RH850 version of the V850 ABI. This is the
27339 default. With this version of the ABI the following rules apply:
27343 Integer sized structures and unions are returned via a memory pointer
27344 rather than a register.
27347 Large structures and unions (more than 8 bytes in size) are passed by
27351 Functions are aligned to 16-bit boundaries.
27354 The @option{-m8byte-align} command-line option is supported.
27357 The @option{-mdisable-callt} command-line option is enabled by
27358 default. The @option{-mno-disable-callt} command-line option is not
27362 When this version of the ABI is enabled the C preprocessor symbol
27363 @code{__V850_RH850_ABI__} is defined.
27367 Enables support for the old GCC version of the V850 ABI. With this
27368 version of the ABI the following rules apply:
27372 Integer sized structures and unions are returned in register @code{r10}.
27375 Large structures and unions (more than 8 bytes in size) are passed by
27379 Functions are aligned to 32-bit boundaries, unless optimizing for
27383 The @option{-m8byte-align} command-line option is not supported.
27386 The @option{-mdisable-callt} command-line option is supported but not
27387 enabled by default.
27390 When this version of the ABI is enabled the C preprocessor symbol
27391 @code{__V850_GCC_ABI__} is defined.
27393 @item -m8byte-align
27394 @itemx -mno-8byte-align
27395 @opindex m8byte-align
27396 @opindex mno-8byte-align
27397 Enables support for @code{double} and @code{long long} types to be
27398 aligned on 8-byte boundaries. The default is to restrict the
27399 alignment of all objects to at most 4-bytes. When
27400 @option{-m8byte-align} is in effect the C preprocessor symbol
27401 @code{__V850_8BYTE_ALIGN__} is defined.
27404 @opindex mbig-switch
27405 Generate code suitable for big switch tables. Use this option only if
27406 the assembler/linker complain about out of range branches within a switch
27411 This option causes r2 and r5 to be used in the code generated by
27412 the compiler. This setting is the default.
27414 @item -mno-app-regs
27415 @opindex mno-app-regs
27416 This option causes r2 and r5 to be treated as fixed registers.
27421 @subsection VAX Options
27422 @cindex VAX options
27424 These @samp{-m} options are defined for the VAX:
27429 Do not output certain jump instructions (@code{aobleq} and so on)
27430 that the Unix assembler for the VAX cannot handle across long
27435 Do output those jump instructions, on the assumption that the
27436 GNU assembler is being used.
27440 Output code for G-format floating-point numbers instead of D-format.
27443 @node Visium Options
27444 @subsection Visium Options
27445 @cindex Visium options
27451 A program which performs file I/O and is destined to run on an MCM target
27452 should be linked with this option. It causes the libraries libc.a and
27453 libdebug.a to be linked. The program should be run on the target under
27454 the control of the GDB remote debugging stub.
27458 A program which performs file I/O and is destined to run on the simulator
27459 should be linked with option. This causes libraries libc.a and libsim.a to
27463 @itemx -mhard-float
27465 @opindex mhard-float
27466 Generate code containing floating-point instructions. This is the
27470 @itemx -msoft-float
27472 @opindex msoft-float
27473 Generate code containing library calls for floating-point.
27475 @option{-msoft-float} changes the calling convention in the output file;
27476 therefore, it is only useful if you compile @emph{all} of a program with
27477 this option. In particular, you need to compile @file{libgcc.a}, the
27478 library that comes with GCC, with @option{-msoft-float} in order for
27481 @item -mcpu=@var{cpu_type}
27483 Set the instruction set, register set, and instruction scheduling parameters
27484 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
27485 @samp{mcm}, @samp{gr5} and @samp{gr6}.
27487 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
27489 By default (unless configured otherwise), GCC generates code for the GR5
27490 variant of the Visium architecture.
27492 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
27493 architecture. The only difference from GR5 code is that the compiler will
27494 generate block move instructions.
27496 @item -mtune=@var{cpu_type}
27498 Set the instruction scheduling parameters for machine type @var{cpu_type},
27499 but do not set the instruction set or register set that the option
27500 @option{-mcpu=@var{cpu_type}} would.
27504 Generate code for the supervisor mode, where there are no restrictions on
27505 the access to general registers. This is the default.
27508 @opindex muser-mode
27509 Generate code for the user mode, where the access to some general registers
27510 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
27511 mode; on the GR6, only registers r29 to r31 are affected.
27515 @subsection VMS Options
27517 These @samp{-m} options are defined for the VMS implementations:
27520 @item -mvms-return-codes
27521 @opindex mvms-return-codes
27522 Return VMS condition codes from @code{main}. The default is to return POSIX-style
27523 condition (e.g.@: error) codes.
27525 @item -mdebug-main=@var{prefix}
27526 @opindex mdebug-main=@var{prefix}
27527 Flag the first routine whose name starts with @var{prefix} as the main
27528 routine for the debugger.
27532 Default to 64-bit memory allocation routines.
27534 @item -mpointer-size=@var{size}
27535 @opindex mpointer-size=@var{size}
27536 Set the default size of pointers. Possible options for @var{size} are
27537 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
27538 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
27539 The later option disables @code{pragma pointer_size}.
27542 @node VxWorks Options
27543 @subsection VxWorks Options
27544 @cindex VxWorks Options
27546 The options in this section are defined for all VxWorks targets.
27547 Options specific to the target hardware are listed with the other
27548 options for that target.
27553 GCC can generate code for both VxWorks kernels and real time processes
27554 (RTPs). This option switches from the former to the latter. It also
27555 defines the preprocessor macro @code{__RTP__}.
27558 @opindex non-static
27559 Link an RTP executable against shared libraries rather than static
27560 libraries. The options @option{-static} and @option{-shared} can
27561 also be used for RTPs (@pxref{Link Options}); @option{-static}
27568 These options are passed down to the linker. They are defined for
27569 compatibility with Diab.
27572 @opindex Xbind-lazy
27573 Enable lazy binding of function calls. This option is equivalent to
27574 @option{-Wl,-z,now} and is defined for compatibility with Diab.
27578 Disable lazy binding of function calls. This option is the default and
27579 is defined for compatibility with Diab.
27583 @subsection x86 Options
27584 @cindex x86 Options
27586 These @samp{-m} options are defined for the x86 family of computers.
27590 @item -march=@var{cpu-type}
27592 Generate instructions for the machine type @var{cpu-type}. In contrast to
27593 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
27594 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
27595 to generate code that may not run at all on processors other than the one
27596 indicated. Specifying @option{-march=@var{cpu-type}} implies
27597 @option{-mtune=@var{cpu-type}}.
27599 The choices for @var{cpu-type} are:
27603 This selects the CPU to generate code for at compilation time by determining
27604 the processor type of the compiling machine. Using @option{-march=native}
27605 enables all instruction subsets supported by the local machine (hence
27606 the result might not run on different machines). Using @option{-mtune=native}
27607 produces code optimized for the local machine under the constraints
27608 of the selected instruction set.
27611 A generic CPU with 64-bit extensions.
27614 Original Intel i386 CPU@.
27617 Intel i486 CPU@. (No scheduling is implemented for this chip.)
27621 Intel Pentium CPU with no MMX support.
27624 Intel Lakemont MCU, based on Intel Pentium CPU.
27627 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
27630 Intel Pentium Pro CPU@.
27633 When used with @option{-march}, the Pentium Pro
27634 instruction set is used, so the code runs on all i686 family chips.
27635 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
27638 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
27643 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
27647 Intel Pentium M; low-power version of Intel Pentium III CPU
27648 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
27652 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
27655 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
27659 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
27660 SSE2 and SSE3 instruction set support.
27663 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
27664 instruction set support.
27667 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27668 SSE4.1, SSE4.2 and POPCNT instruction set support.
27671 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27672 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
27675 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27676 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
27679 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27680 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
27681 instruction set support.
27684 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27685 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27686 BMI, BMI2 and F16C instruction set support.
27689 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27690 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27691 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
27694 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27695 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27696 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
27697 XSAVES instruction set support.
27700 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
27701 instruction set support.
27704 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27705 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
27708 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27709 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
27710 instruction set support.
27712 @item goldmont-plus
27713 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27714 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27715 PTWRITE, RDPID, SGX and UMIP instruction set support.
27718 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27719 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27720 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27723 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27724 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27725 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27726 AVX512CD instruction set support.
27729 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27730 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27731 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27732 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27734 @item skylake-avx512
27735 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27736 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27737 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27738 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27741 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27742 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27743 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27744 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27745 AVX512IFMA, SHA and UMIP instruction set support.
27747 @item icelake-client
27748 Intel Icelake Client 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, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27753 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27755 @item icelake-server
27756 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27757 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27758 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27759 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27760 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27761 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27765 AMD K6 CPU with MMX instruction set support.
27769 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27772 @itemx athlon-tbird
27773 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27779 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27780 instruction set support.
27786 Processors based on the AMD K8 core with x86-64 instruction set support,
27787 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27788 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27789 instruction set extensions.)
27792 @itemx opteron-sse3
27793 @itemx athlon64-sse3
27794 Improved versions of AMD K8 cores with SSE3 instruction set support.
27798 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
27799 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27800 instruction set extensions.)
27803 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
27804 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27805 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27807 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27808 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
27809 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27812 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27813 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27814 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27815 64-bit instruction set extensions.
27817 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27818 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27819 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27820 SSE4.2, ABM and 64-bit instruction set extensions.
27823 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27824 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27825 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27826 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27827 instruction set extensions.
27829 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27830 supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27831 MWAITX, SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27832 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27833 instruction set extensions.)
27837 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
27838 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27839 instruction set extensions.)
27842 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27843 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27844 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27847 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27851 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27852 instruction set support.
27855 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27856 (No scheduling is implemented for this chip.)
27859 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27860 (No scheduling is implemented for this chip.)
27863 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27864 (No scheduling is implemented for this chip.)
27867 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27868 (No scheduling is implemented for this chip.)
27871 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27872 (No scheduling is implemented for this chip.)
27875 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27876 (No scheduling is implemented for this chip.)
27879 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27880 (No scheduling is implemented for this chip.)
27883 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27884 AVX and AVX2 instruction set support.
27885 (No scheduling is implemented for this chip.)
27888 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27889 instruction set support.
27890 (No scheduling is implemented for this chip.)
27893 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27894 instruction set support.
27895 (No scheduling is implemented for this chip.)
27898 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27899 instruction set support.
27900 (No scheduling is implemented for this chip.)
27903 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27904 instruction set support.
27905 (No scheduling is implemented for this chip.)
27908 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27909 instruction set support.
27910 (No scheduling is implemented for this chip.)
27913 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27914 instruction set support.
27915 (No scheduling is implemented for this chip.)
27918 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27921 @item -mtune=@var{cpu-type}
27923 Tune to @var{cpu-type} everything applicable about the generated code, except
27924 for the ABI and the set of available instructions.
27925 While picking a specific @var{cpu-type} schedules things appropriately
27926 for that particular chip, the compiler does not generate any code that
27927 cannot run on the default machine type unless you use a
27928 @option{-march=@var{cpu-type}} option.
27929 For example, if GCC is configured for i686-pc-linux-gnu
27930 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27931 but still runs on i686 machines.
27933 The choices for @var{cpu-type} are the same as for @option{-march}.
27934 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27938 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27939 If you know the CPU on which your code will run, then you should use
27940 the corresponding @option{-mtune} or @option{-march} option instead of
27941 @option{-mtune=generic}. But, if you do not know exactly what CPU users
27942 of your application will have, then you should use this option.
27944 As new processors are deployed in the marketplace, the behavior of this
27945 option will change. Therefore, if you upgrade to a newer version of
27946 GCC, code generation controlled by this option will change to reflect
27948 that are most common at the time that version of GCC is released.
27950 There is no @option{-march=generic} option because @option{-march}
27951 indicates the instruction set the compiler can use, and there is no
27952 generic instruction set applicable to all processors. In contrast,
27953 @option{-mtune} indicates the processor (or, in this case, collection of
27954 processors) for which the code is optimized.
27957 Produce code optimized for the most current Intel processors, which are
27958 Haswell and Silvermont for this version of GCC. If you know the CPU
27959 on which your code will run, then you should use the corresponding
27960 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27961 But, if you want your application performs better on both Haswell and
27962 Silvermont, then you should use this option.
27964 As new Intel processors are deployed in the marketplace, the behavior of
27965 this option will change. Therefore, if you upgrade to a newer version of
27966 GCC, code generation controlled by this option will change to reflect
27967 the most current Intel processors at the time that version of GCC is
27970 There is no @option{-march=intel} option because @option{-march} indicates
27971 the instruction set the compiler can use, and there is no common
27972 instruction set applicable to all processors. In contrast,
27973 @option{-mtune} indicates the processor (or, in this case, collection of
27974 processors) for which the code is optimized.
27977 @item -mcpu=@var{cpu-type}
27979 A deprecated synonym for @option{-mtune}.
27981 @item -mfpmath=@var{unit}
27983 Generate floating-point arithmetic for selected unit @var{unit}. The choices
27984 for @var{unit} are:
27988 Use the standard 387 floating-point coprocessor present on the majority of chips and
27989 emulated otherwise. Code compiled with this option runs almost everywhere.
27990 The temporary results are computed in 80-bit precision instead of the precision
27991 specified by the type, resulting in slightly different results compared to most
27992 of other chips. See @option{-ffloat-store} for more detailed description.
27994 This is the default choice for non-Darwin x86-32 targets.
27997 Use scalar floating-point instructions present in the SSE instruction set.
27998 This instruction set is supported by Pentium III and newer chips,
27999 and in the AMD line
28000 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
28001 instruction set supports only single-precision arithmetic, thus the double and
28002 extended-precision arithmetic are still done using 387. A later version, present
28003 only in Pentium 4 and AMD x86-64 chips, supports double-precision
28006 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
28007 or @option{-msse2} switches to enable SSE extensions and make this option
28008 effective. For the x86-64 compiler, these extensions are enabled by default.
28010 The resulting code should be considerably faster in the majority of cases and avoid
28011 the numerical instability problems of 387 code, but may break some existing
28012 code that expects temporaries to be 80 bits.
28014 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
28015 and the default choice for x86-32 targets with the SSE2 instruction set
28016 when @option{-ffast-math} is enabled.
28021 Attempt to utilize both instruction sets at once. This effectively doubles the
28022 amount of available registers, and on chips with separate execution units for
28023 387 and SSE the execution resources too. Use this option with care, as it is
28024 still experimental, because the GCC register allocator does not model separate
28025 functional units well, resulting in unstable performance.
28028 @item -masm=@var{dialect}
28029 @opindex masm=@var{dialect}
28030 Output assembly instructions using selected @var{dialect}. Also affects
28031 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
28032 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
28033 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
28034 not support @samp{intel}.
28037 @itemx -mno-ieee-fp
28039 @opindex mno-ieee-fp
28040 Control whether or not the compiler uses IEEE floating-point
28041 comparisons. These correctly handle the case where the result of a
28042 comparison is unordered.
28045 @itemx -mhard-float
28047 @opindex mhard-float
28048 Generate output containing 80387 instructions for floating point.
28051 @itemx -msoft-float
28053 @opindex msoft-float
28054 Generate output containing library calls for floating point.
28056 @strong{Warning:} the requisite libraries are not part of GCC@.
28057 Normally the facilities of the machine's usual C compiler are used, but
28058 this cannot be done directly in cross-compilation. You must make your
28059 own arrangements to provide suitable library functions for
28062 On machines where a function returns floating-point results in the 80387
28063 register stack, some floating-point opcodes may be emitted even if
28064 @option{-msoft-float} is used.
28066 @item -mno-fp-ret-in-387
28067 @opindex mno-fp-ret-in-387
28068 @opindex mfp-ret-in-387
28069 Do not use the FPU registers for return values of functions.
28071 The usual calling convention has functions return values of types
28072 @code{float} and @code{double} in an FPU register, even if there
28073 is no FPU@. The idea is that the operating system should emulate
28076 The option @option{-mno-fp-ret-in-387} causes such values to be returned
28077 in ordinary CPU registers instead.
28079 @item -mno-fancy-math-387
28080 @opindex mno-fancy-math-387
28081 @opindex mfancy-math-387
28082 Some 387 emulators do not support the @code{sin}, @code{cos} and
28083 @code{sqrt} instructions for the 387. Specify this option to avoid
28084 generating those instructions.
28085 This option is overridden when @option{-march}
28086 indicates that the target CPU always has an FPU and so the
28087 instruction does not need emulation. These
28088 instructions are not generated unless you also use the
28089 @option{-funsafe-math-optimizations} switch.
28091 @item -malign-double
28092 @itemx -mno-align-double
28093 @opindex malign-double
28094 @opindex mno-align-double
28095 Control whether GCC aligns @code{double}, @code{long double}, and
28096 @code{long long} variables on a two-word boundary or a one-word
28097 boundary. Aligning @code{double} variables on a two-word boundary
28098 produces code that runs somewhat faster on a Pentium at the
28099 expense of more memory.
28101 On x86-64, @option{-malign-double} is enabled by default.
28103 @strong{Warning:} if you use the @option{-malign-double} switch,
28104 structures containing the above types are aligned differently than
28105 the published application binary interface specifications for the x86-32
28106 and are not binary compatible with structures in code compiled
28107 without that switch.
28109 @item -m96bit-long-double
28110 @itemx -m128bit-long-double
28111 @opindex m96bit-long-double
28112 @opindex m128bit-long-double
28113 These switches control the size of @code{long double} type. The x86-32
28114 application binary interface specifies the size to be 96 bits,
28115 so @option{-m96bit-long-double} is the default in 32-bit mode.
28117 Modern architectures (Pentium and newer) prefer @code{long double}
28118 to be aligned to an 8- or 16-byte boundary. In arrays or structures
28119 conforming to the ABI, this is not possible. So specifying
28120 @option{-m128bit-long-double} aligns @code{long double}
28121 to a 16-byte boundary by padding the @code{long double} with an additional
28124 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
28125 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
28127 Notice that neither of these options enable any extra precision over the x87
28128 standard of 80 bits for a @code{long double}.
28130 @strong{Warning:} if you override the default value for your target ABI, this
28131 changes the size of
28132 structures and arrays containing @code{long double} variables,
28133 as well as modifying the function calling convention for functions taking
28134 @code{long double}. Hence they are not binary-compatible
28135 with code compiled without that switch.
28137 @item -mlong-double-64
28138 @itemx -mlong-double-80
28139 @itemx -mlong-double-128
28140 @opindex mlong-double-64
28141 @opindex mlong-double-80
28142 @opindex mlong-double-128
28143 These switches control the size of @code{long double} type. A size
28144 of 64 bits makes the @code{long double} type equivalent to the @code{double}
28145 type. This is the default for 32-bit Bionic C library. A size
28146 of 128 bits makes the @code{long double} type equivalent to the
28147 @code{__float128} type. This is the default for 64-bit Bionic C library.
28149 @strong{Warning:} if you override the default value for your target ABI, this
28150 changes the size of
28151 structures and arrays containing @code{long double} variables,
28152 as well as modifying the function calling convention for functions taking
28153 @code{long double}. Hence they are not binary-compatible
28154 with code compiled without that switch.
28156 @item -malign-data=@var{type}
28157 @opindex malign-data
28158 Control how GCC aligns variables. Supported values for @var{type} are
28159 @samp{compat} uses increased alignment value compatible uses GCC 4.8
28160 and earlier, @samp{abi} uses alignment value as specified by the
28161 psABI, and @samp{cacheline} uses increased alignment value to match
28162 the cache line size. @samp{compat} is the default.
28164 @item -mlarge-data-threshold=@var{threshold}
28165 @opindex mlarge-data-threshold
28166 When @option{-mcmodel=medium} is specified, data objects larger than
28167 @var{threshold} are placed in the large data section. This value must be the
28168 same across all objects linked into the binary, and defaults to 65535.
28172 Use a different function-calling convention, in which functions that
28173 take a fixed number of arguments return with the @code{ret @var{num}}
28174 instruction, which pops their arguments while returning. This saves one
28175 instruction in the caller since there is no need to pop the arguments
28178 You can specify that an individual function is called with this calling
28179 sequence with the function attribute @code{stdcall}. You can also
28180 override the @option{-mrtd} option by using the function attribute
28181 @code{cdecl}. @xref{Function Attributes}.
28183 @strong{Warning:} this calling convention is incompatible with the one
28184 normally used on Unix, so you cannot use it if you need to call
28185 libraries compiled with the Unix compiler.
28187 Also, you must provide function prototypes for all functions that
28188 take variable numbers of arguments (including @code{printf});
28189 otherwise incorrect code is generated for calls to those
28192 In addition, seriously incorrect code results if you call a
28193 function with too many arguments. (Normally, extra arguments are
28194 harmlessly ignored.)
28196 @item -mregparm=@var{num}
28198 Control how many registers are used to pass integer arguments. By
28199 default, no registers are used to pass arguments, and at most 3
28200 registers can be used. You can control this behavior for a specific
28201 function by using the function attribute @code{regparm}.
28202 @xref{Function Attributes}.
28204 @strong{Warning:} if you use this switch, and
28205 @var{num} is nonzero, then you must build all modules with the same
28206 value, including any libraries. This includes the system libraries and
28210 @opindex msseregparm
28211 Use SSE register passing conventions for float and double arguments
28212 and return values. You can control this behavior for a specific
28213 function by using the function attribute @code{sseregparm}.
28214 @xref{Function Attributes}.
28216 @strong{Warning:} if you use this switch then you must build all
28217 modules with the same value, including any libraries. This includes
28218 the system libraries and startup modules.
28220 @item -mvect8-ret-in-mem
28221 @opindex mvect8-ret-in-mem
28222 Return 8-byte vectors in memory instead of MMX registers. This is the
28223 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
28224 Studio compilers until version 12. Later compiler versions (starting
28225 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
28226 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
28227 you need to remain compatible with existing code produced by those
28228 previous compiler versions or older versions of GCC@.
28237 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
28238 is specified, the significands of results of floating-point operations are
28239 rounded to 24 bits (single precision); @option{-mpc64} rounds the
28240 significands of results of floating-point operations to 53 bits (double
28241 precision) and @option{-mpc80} rounds the significands of results of
28242 floating-point operations to 64 bits (extended double precision), which is
28243 the default. When this option is used, floating-point operations in higher
28244 precisions are not available to the programmer without setting the FPU
28245 control word explicitly.
28247 Setting the rounding of floating-point operations to less than the default
28248 80 bits can speed some programs by 2% or more. Note that some mathematical
28249 libraries assume that extended-precision (80-bit) floating-point operations
28250 are enabled by default; routines in such libraries could suffer significant
28251 loss of accuracy, typically through so-called ``catastrophic cancellation'',
28252 when this option is used to set the precision to less than extended precision.
28254 @item -mstackrealign
28255 @opindex mstackrealign
28256 Realign the stack at entry. On the x86, the @option{-mstackrealign}
28257 option generates an alternate prologue and epilogue that realigns the
28258 run-time stack if necessary. This supports mixing legacy codes that keep
28259 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
28260 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
28261 applicable to individual functions.
28263 @item -mpreferred-stack-boundary=@var{num}
28264 @opindex mpreferred-stack-boundary
28265 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
28266 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
28267 the default is 4 (16 bytes or 128 bits).
28269 @strong{Warning:} When generating code for the x86-64 architecture with
28270 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
28271 used to keep the stack boundary aligned to 8 byte boundary. Since
28272 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
28273 intended to be used in controlled environment where stack space is
28274 important limitation. This option leads to wrong code when functions
28275 compiled with 16 byte stack alignment (such as functions from a standard
28276 library) are called with misaligned stack. In this case, SSE
28277 instructions may lead to misaligned memory access traps. In addition,
28278 variable arguments are handled incorrectly for 16 byte aligned
28279 objects (including x87 long double and __int128), leading to wrong
28280 results. You must build all modules with
28281 @option{-mpreferred-stack-boundary=3}, including any libraries. This
28282 includes the system libraries and startup modules.
28284 @item -mincoming-stack-boundary=@var{num}
28285 @opindex mincoming-stack-boundary
28286 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
28287 boundary. If @option{-mincoming-stack-boundary} is not specified,
28288 the one specified by @option{-mpreferred-stack-boundary} is used.
28290 On Pentium and Pentium Pro, @code{double} and @code{long double} values
28291 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
28292 suffer significant run time performance penalties. On Pentium III, the
28293 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
28294 properly if it is not 16-byte aligned.
28296 To ensure proper alignment of this values on the stack, the stack boundary
28297 must be as aligned as that required by any value stored on the stack.
28298 Further, every function must be generated such that it keeps the stack
28299 aligned. Thus calling a function compiled with a higher preferred
28300 stack boundary from a function compiled with a lower preferred stack
28301 boundary most likely misaligns the stack. It is recommended that
28302 libraries that use callbacks always use the default setting.
28304 This extra alignment does consume extra stack space, and generally
28305 increases code size. Code that is sensitive to stack space usage, such
28306 as embedded systems and operating system kernels, may want to reduce the
28307 preferred alignment to @option{-mpreferred-stack-boundary=2}.
28364 @itemx -mavx512ifma
28365 @opindex mavx512ifma
28367 @itemx -mavx512vbmi
28368 @opindex mavx512vbmi
28379 @itemx -mclflushopt
28380 @opindex mclflushopt
28406 @itemx -mprefetchwt1
28407 @opindex mprefetchwt1
28465 @itemx -mavx512vbmi2
28466 @opindex mavx512vbmi2
28477 @itemx -mvpclmulqdq
28478 @opindex mvpclmulqdq
28480 @itemx -mavx512bitalg
28481 @opindex mavx512bitalg
28487 @opindex mmovdir64b
28489 @itemx -mavx512vpopcntdq
28490 @opindex mavx512vpopcntdq
28494 These switches enable the use of instructions in the MMX, SSE,
28495 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
28496 SHA, AES, PCLMUL, FSGSBASE, PTWRITE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
28497 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, BMI, BMI2, VAES, WAITPKG,
28498 FXSR, XSAVE, XSAVEOPT, LZCNT, RTM, MWAITX, PKU, IBT, SHSTK, AVX512VBMI2,
28499 GFNI, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B,
28500 AVX512VPOPCNTDQ, CLDEMOTE, 3DNow!@: or enhanced 3DNow!@: extended instruction
28501 sets. Each has a corresponding @option{-mno-} option to disable use of these
28504 These extensions are also available as built-in functions: see
28505 @ref{x86 Built-in Functions}, for details of the functions enabled and
28506 disabled by these switches.
28508 To generate SSE/SSE2 instructions automatically from floating-point
28509 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
28511 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
28512 generates new AVX instructions or AVX equivalence for all SSEx instructions
28515 These options enable GCC to use these extended instructions in
28516 generated code, even without @option{-mfpmath=sse}. Applications that
28517 perform run-time CPU detection must compile separate files for each
28518 supported architecture, using the appropriate flags. In particular,
28519 the file containing the CPU detection code should be compiled without
28522 @item -mdump-tune-features
28523 @opindex mdump-tune-features
28524 This option instructs GCC to dump the names of the x86 performance
28525 tuning features and default settings. The names can be used in
28526 @option{-mtune-ctrl=@var{feature-list}}.
28528 @item -mtune-ctrl=@var{feature-list}
28529 @opindex mtune-ctrl=@var{feature-list}
28530 This option is used to do fine grain control of x86 code generation features.
28531 @var{feature-list} is a comma separated list of @var{feature} names. See also
28532 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
28533 on if it is not preceded with @samp{^}, otherwise, it is turned off.
28534 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
28535 developers. Using it may lead to code paths not covered by testing and can
28536 potentially result in compiler ICEs or runtime errors.
28539 @opindex mno-default
28540 This option instructs GCC to turn off all tunable features. See also
28541 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
28545 This option instructs GCC to emit a @code{cld} instruction in the prologue
28546 of functions that use string instructions. String instructions depend on
28547 the DF flag to select between autoincrement or autodecrement mode. While the
28548 ABI specifies the DF flag to be cleared on function entry, some operating
28549 systems violate this specification by not clearing the DF flag in their
28550 exception dispatchers. The exception handler can be invoked with the DF flag
28551 set, which leads to wrong direction mode when string instructions are used.
28552 This option can be enabled by default on 32-bit x86 targets by configuring
28553 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
28554 instructions can be suppressed with the @option{-mno-cld} compiler option
28558 @opindex mvzeroupper
28559 This option instructs GCC to emit a @code{vzeroupper} instruction
28560 before a transfer of control flow out of the function to minimize
28561 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
28564 @item -mprefer-avx128
28565 @opindex mprefer-avx128
28566 This option instructs GCC to use 128-bit AVX instructions instead of
28567 256-bit AVX instructions in the auto-vectorizer.
28569 @item -mprefer-vector-width=@var{opt}
28570 @opindex mprefer-vector-width
28571 This option instructs GCC to use @var{opt}-bit vector width in instructions
28572 instead of default on the selected platform.
28576 No extra limitations applied to GCC other than defined by the selected platform.
28579 Prefer 128-bit vector width for instructions.
28582 Prefer 256-bit vector width for instructions.
28585 Prefer 512-bit vector width for instructions.
28590 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
28591 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
28592 objects. This is useful for atomic updates of data structures exceeding one
28593 machine word in size. The compiler uses this instruction to implement
28594 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
28595 128-bit integers, a library call is always used.
28599 This option enables generation of @code{SAHF} instructions in 64-bit code.
28600 Early Intel Pentium 4 CPUs with Intel 64 support,
28601 prior to the introduction of Pentium 4 G1 step in December 2005,
28602 lacked the @code{LAHF} and @code{SAHF} instructions
28603 which are supported by AMD64.
28604 These are load and store instructions, respectively, for certain status flags.
28605 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
28606 @code{drem}, and @code{remainder} built-in functions;
28607 see @ref{Other Builtins} for details.
28611 This option enables use of the @code{movbe} instruction to implement
28612 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
28616 The @option{-mshstk} option enables shadow stack built-in functions
28617 from x86 Control-flow Enforcement Technology (CET).
28621 This option enables built-in functions @code{__builtin_ia32_crc32qi},
28622 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
28623 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
28627 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
28628 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
28629 with an additional Newton-Raphson step
28630 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
28631 (and their vectorized
28632 variants) for single-precision floating-point arguments. These instructions
28633 are generated only when @option{-funsafe-math-optimizations} is enabled
28634 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
28635 Note that while the throughput of the sequence is higher than the throughput
28636 of the non-reciprocal instruction, the precision of the sequence can be
28637 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
28639 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
28640 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
28641 combination), and doesn't need @option{-mrecip}.
28643 Also note that GCC emits the above sequence with additional Newton-Raphson step
28644 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
28645 already with @option{-ffast-math} (or the above option combination), and
28646 doesn't need @option{-mrecip}.
28648 @item -mrecip=@var{opt}
28649 @opindex mrecip=opt
28650 This option controls which reciprocal estimate instructions
28651 may be used. @var{opt} is a comma-separated list of options, which may
28652 be preceded by a @samp{!} to invert the option:
28656 Enable all estimate instructions.
28659 Enable the default instructions, equivalent to @option{-mrecip}.
28662 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28665 Enable the approximation for scalar division.
28668 Enable the approximation for vectorized division.
28671 Enable the approximation for scalar square root.
28674 Enable the approximation for vectorized square root.
28677 So, for example, @option{-mrecip=all,!sqrt} enables
28678 all of the reciprocal approximations, except for square root.
28680 @item -mveclibabi=@var{type}
28681 @opindex mveclibabi
28682 Specifies the ABI type to use for vectorizing intrinsics using an
28683 external library. Supported values for @var{type} are @samp{svml}
28684 for the Intel short
28685 vector math library and @samp{acml} for the AMD math core library.
28686 To use this option, both @option{-ftree-vectorize} and
28687 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
28688 ABI-compatible library must be specified at link time.
28690 GCC currently emits calls to @code{vmldExp2},
28691 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
28692 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
28693 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
28694 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
28695 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
28696 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
28697 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
28698 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
28699 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
28700 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
28701 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
28702 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
28703 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
28704 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
28705 when @option{-mveclibabi=acml} is used.
28707 @item -mabi=@var{name}
28709 Generate code for the specified calling convention. Permissible values
28710 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28711 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
28712 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28713 You can control this behavior for specific functions by
28714 using the function attributes @code{ms_abi} and @code{sysv_abi}.
28715 @xref{Function Attributes}.
28717 @item -mforce-indirect-call
28718 @opindex mforce-indirect-call
28719 Force all calls to functions to be indirect. This is useful
28720 when using Intel Processor Trace where it generates more precise timing
28721 information for function calls.
28723 @item -mcall-ms2sysv-xlogues
28724 @opindex mcall-ms2sysv-xlogues
28725 @opindex mno-call-ms2sysv-xlogues
28726 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28727 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
28728 default, the code for saving and restoring these registers is emitted inline,
28729 resulting in fairly lengthy prologues and epilogues. Using
28730 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28731 use stubs in the static portion of libgcc to perform these saves and restores,
28732 thus reducing function size at the cost of a few extra instructions.
28734 @item -mtls-dialect=@var{type}
28735 @opindex mtls-dialect
28736 Generate code to access thread-local storage using the @samp{gnu} or
28737 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
28738 @samp{gnu2} is more efficient, but it may add compile- and run-time
28739 requirements that cannot be satisfied on all systems.
28742 @itemx -mno-push-args
28743 @opindex mpush-args
28744 @opindex mno-push-args
28745 Use PUSH operations to store outgoing parameters. This method is shorter
28746 and usually equally fast as method using SUB/MOV operations and is enabled
28747 by default. In some cases disabling it may improve performance because of
28748 improved scheduling and reduced dependencies.
28750 @item -maccumulate-outgoing-args
28751 @opindex maccumulate-outgoing-args
28752 If enabled, the maximum amount of space required for outgoing arguments is
28753 computed in the function prologue. This is faster on most modern CPUs
28754 because of reduced dependencies, improved scheduling and reduced stack usage
28755 when the preferred stack boundary is not equal to 2. The drawback is a notable
28756 increase in code size. This switch implies @option{-mno-push-args}.
28760 Support thread-safe exception handling on MinGW. Programs that rely
28761 on thread-safe exception handling must compile and link all code with the
28762 @option{-mthreads} option. When compiling, @option{-mthreads} defines
28763 @option{-D_MT}; when linking, it links in a special thread helper library
28764 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28766 @item -mms-bitfields
28767 @itemx -mno-ms-bitfields
28768 @opindex mms-bitfields
28769 @opindex mno-ms-bitfields
28771 Enable/disable bit-field layout compatible with the native Microsoft
28774 If @code{packed} is used on a structure, or if bit-fields are used,
28775 it may be that the Microsoft ABI lays out the structure differently
28776 than the way GCC normally does. Particularly when moving packed
28777 data between functions compiled with GCC and the native Microsoft compiler
28778 (either via function call or as data in a file), it may be necessary to access
28781 This option is enabled by default for Microsoft Windows
28782 targets. This behavior can also be controlled locally by use of variable
28783 or type attributes. For more information, see @ref{x86 Variable Attributes}
28784 and @ref{x86 Type Attributes}.
28786 The Microsoft structure layout algorithm is fairly simple with the exception
28787 of the bit-field packing.
28788 The padding and alignment of members of structures and whether a bit-field
28789 can straddle a storage-unit boundary are determine by these rules:
28792 @item Structure members are stored sequentially in the order in which they are
28793 declared: the first member has the lowest memory address and the last member
28796 @item Every data object has an alignment requirement. The alignment requirement
28797 for all data except structures, unions, and arrays is either the size of the
28798 object or the current packing size (specified with either the
28799 @code{aligned} attribute or the @code{pack} pragma),
28800 whichever is less. For structures, unions, and arrays,
28801 the alignment requirement is the largest alignment requirement of its members.
28802 Every object is allocated an offset so that:
28805 offset % alignment_requirement == 0
28808 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28809 unit if the integral types are the same size and if the next bit-field fits
28810 into the current allocation unit without crossing the boundary imposed by the
28811 common alignment requirements of the bit-fields.
28814 MSVC interprets zero-length bit-fields in the following ways:
28817 @item If a zero-length bit-field is inserted between two bit-fields that
28818 are normally coalesced, the bit-fields are not coalesced.
28825 unsigned long bf_1 : 12;
28827 unsigned long bf_2 : 12;
28832 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
28833 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28835 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28836 alignment of the zero-length bit-field is greater than the member that follows it,
28837 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28858 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28859 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
28860 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28863 Taking this into account, it is important to note the following:
28866 @item If a zero-length bit-field follows a normal bit-field, the type of the
28867 zero-length bit-field may affect the alignment of the structure as whole. For
28868 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28869 normal bit-field, and is of type short.
28871 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28872 still affect the alignment of the structure:
28883 Here, @code{t4} takes up 4 bytes.
28886 @item Zero-length bit-fields following non-bit-field members are ignored:
28898 Here, @code{t5} takes up 2 bytes.
28902 @item -mno-align-stringops
28903 @opindex mno-align-stringops
28904 @opindex malign-stringops
28905 Do not align the destination of inlined string operations. This switch reduces
28906 code size and improves performance in case the destination is already aligned,
28907 but GCC doesn't know about it.
28909 @item -minline-all-stringops
28910 @opindex minline-all-stringops
28911 By default GCC inlines string operations only when the destination is
28912 known to be aligned to least a 4-byte boundary.
28913 This enables more inlining and increases code
28914 size, but may improve performance of code that depends on fast
28915 @code{memcpy}, @code{strlen},
28916 and @code{memset} for short lengths.
28918 @item -minline-stringops-dynamically
28919 @opindex minline-stringops-dynamically
28920 For string operations of unknown size, use run-time checks with
28921 inline code for small blocks and a library call for large blocks.
28923 @item -mstringop-strategy=@var{alg}
28924 @opindex mstringop-strategy=@var{alg}
28925 Override the internal decision heuristic for the particular algorithm to use
28926 for inlining string operations. The allowed values for @var{alg} are:
28932 Expand using i386 @code{rep} prefix of the specified size.
28936 @itemx unrolled_loop
28937 Expand into an inline loop.
28940 Always use a library call.
28943 @item -mmemcpy-strategy=@var{strategy}
28944 @opindex mmemcpy-strategy=@var{strategy}
28945 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28946 should be inlined and what inline algorithm to use when the expected size
28947 of the copy operation is known. @var{strategy}
28948 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
28949 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28950 the max byte size with which inline algorithm @var{alg} is allowed. For the last
28951 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28952 in the list must be specified in increasing order. The minimal byte size for
28953 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
28956 @item -mmemset-strategy=@var{strategy}
28957 @opindex mmemset-strategy=@var{strategy}
28958 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28959 @code{__builtin_memset} expansion.
28961 @item -momit-leaf-frame-pointer
28962 @opindex momit-leaf-frame-pointer
28963 Don't keep the frame pointer in a register for leaf functions. This
28964 avoids the instructions to save, set up, and restore frame pointers and
28965 makes an extra register available in leaf functions. The option
28966 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28967 which might make debugging harder.
28969 @item -mtls-direct-seg-refs
28970 @itemx -mno-tls-direct-seg-refs
28971 @opindex mtls-direct-seg-refs
28972 Controls whether TLS variables may be accessed with offsets from the
28973 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28974 or whether the thread base pointer must be added. Whether or not this
28975 is valid depends on the operating system, and whether it maps the
28976 segment to cover the entire TLS area.
28978 For systems that use the GNU C Library, the default is on.
28981 @itemx -mno-sse2avx
28983 Specify that the assembler should encode SSE instructions with VEX
28984 prefix. The option @option{-mavx} turns this on by default.
28989 If profiling is active (@option{-pg}), put the profiling
28990 counter call before the prologue.
28991 Note: On x86 architectures the attribute @code{ms_hook_prologue}
28992 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
28994 @item -mrecord-mcount
28995 @itemx -mno-record-mcount
28996 @opindex mrecord-mcount
28997 If profiling is active (@option{-pg}), generate a __mcount_loc section
28998 that contains pointers to each profiling call. This is useful for
28999 automatically patching and out calls.
29002 @itemx -mno-nop-mcount
29003 @opindex mnop-mcount
29004 If profiling is active (@option{-pg}), generate the calls to
29005 the profiling functions as NOPs. This is useful when they
29006 should be patched in later dynamically. This is likely only
29007 useful together with @option{-mrecord-mcount}.
29009 @item -mskip-rax-setup
29010 @itemx -mno-skip-rax-setup
29011 @opindex mskip-rax-setup
29012 When generating code for the x86-64 architecture with SSE extensions
29013 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
29014 register when there are no variable arguments passed in vector registers.
29016 @strong{Warning:} Since RAX register is used to avoid unnecessarily
29017 saving vector registers on stack when passing variable arguments, the
29018 impacts of this option are callees may waste some stack space,
29019 misbehave or jump to a random location. GCC 4.4 or newer don't have
29020 those issues, regardless the RAX register value.
29023 @itemx -mno-8bit-idiv
29024 @opindex m8bit-idiv
29025 On some processors, like Intel Atom, 8-bit unsigned integer divide is
29026 much faster than 32-bit/64-bit integer divide. This option generates a
29027 run-time check. If both dividend and divisor are within range of 0
29028 to 255, 8-bit unsigned integer divide is used instead of
29029 32-bit/64-bit integer divide.
29031 @item -mavx256-split-unaligned-load
29032 @itemx -mavx256-split-unaligned-store
29033 @opindex mavx256-split-unaligned-load
29034 @opindex mavx256-split-unaligned-store
29035 Split 32-byte AVX unaligned load and store.
29037 @item -mstack-protector-guard=@var{guard}
29038 @itemx -mstack-protector-guard-reg=@var{reg}
29039 @itemx -mstack-protector-guard-offset=@var{offset}
29040 @opindex mstack-protector-guard
29041 @opindex mstack-protector-guard-reg
29042 @opindex mstack-protector-guard-offset
29043 Generate stack protection code using canary at @var{guard}. Supported
29044 locations are @samp{global} for global canary or @samp{tls} for per-thread
29045 canary in the TLS block (the default). This option has effect only when
29046 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
29048 With the latter choice the options
29049 @option{-mstack-protector-guard-reg=@var{reg}} and
29050 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
29051 which segment register (@code{%fs} or @code{%gs}) to use as base register
29052 for reading the canary, and from what offset from that base register.
29053 The default for those is as specified in the relevant ABI.
29055 @item -mgeneral-regs-only
29056 @opindex mgeneral-regs-only
29057 Generate code that uses only the general-purpose registers. This
29058 prevents the compiler from using floating-point, vector, mask and bound
29061 @item -mindirect-branch=@var{choice}
29062 @opindex mindirect-branch
29063 Convert indirect call and jump with @var{choice}. The default is
29064 @samp{keep}, which keeps indirect call and jump unmodified.
29065 @samp{thunk} converts indirect call and jump to call and return thunk.
29066 @samp{thunk-inline} converts indirect call and jump to inlined call
29067 and return thunk. @samp{thunk-extern} converts indirect call and jump
29068 to external call and return thunk provided in a separate object file.
29069 You can control this behavior for a specific function by using the
29070 function attribute @code{indirect_branch}. @xref{Function Attributes}.
29072 Note that @option{-mcmodel=large} is incompatible with
29073 @option{-mindirect-branch=thunk} and
29074 @option{-mindirect-branch=thunk-extern} since the thunk function may
29075 not be reachable in the large code model.
29077 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
29078 @option{-fcf-protection=branch} since the external thunk can not be modified
29079 to disable control-flow check.
29081 @item -mfunction-return=@var{choice}
29082 @opindex mfunction-return
29083 Convert function return with @var{choice}. The default is @samp{keep},
29084 which keeps function return unmodified. @samp{thunk} converts function
29085 return to call and return thunk. @samp{thunk-inline} converts function
29086 return to inlined call and return thunk. @samp{thunk-extern} converts
29087 function return to external call and return thunk provided in a separate
29088 object file. You can control this behavior for a specific function by
29089 using the function attribute @code{function_return}.
29090 @xref{Function Attributes}.
29092 Note that @option{-mcmodel=large} is incompatible with
29093 @option{-mfunction-return=thunk} and
29094 @option{-mfunction-return=thunk-extern} since the thunk function may
29095 not be reachable in the large code model.
29098 @item -mindirect-branch-register
29099 @opindex mindirect-branch-register
29100 Force indirect call and jump via register.
29104 These @samp{-m} switches are supported in addition to the above
29105 on x86-64 processors in 64-bit environments.
29118 Generate code for a 16-bit, 32-bit or 64-bit environment.
29119 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
29121 generates code that runs on any i386 system.
29123 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
29124 types to 64 bits, and generates code for the x86-64 architecture.
29125 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
29126 and @option{-mdynamic-no-pic} options.
29128 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
29130 generates code for the x86-64 architecture.
29132 The @option{-m16} option is the same as @option{-m32}, except for that
29133 it outputs the @code{.code16gcc} assembly directive at the beginning of
29134 the assembly output so that the binary can run in 16-bit mode.
29136 The @option{-miamcu} option generates code which conforms to Intel MCU
29137 psABI. It requires the @option{-m32} option to be turned on.
29139 @item -mno-red-zone
29140 @opindex mno-red-zone
29142 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
29143 by the x86-64 ABI; it is a 128-byte area beyond the location of the
29144 stack pointer that is not modified by signal or interrupt handlers
29145 and therefore can be used for temporary data without adjusting the stack
29146 pointer. The flag @option{-mno-red-zone} disables this red zone.
29148 @item -mcmodel=small
29149 @opindex mcmodel=small
29150 Generate code for the small code model: the program and its symbols must
29151 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
29152 Programs can be statically or dynamically linked. This is the default
29155 @item -mcmodel=kernel
29156 @opindex mcmodel=kernel
29157 Generate code for the kernel code model. The kernel runs in the
29158 negative 2 GB of the address space.
29159 This model has to be used for Linux kernel code.
29161 @item -mcmodel=medium
29162 @opindex mcmodel=medium
29163 Generate code for the medium model: the program is linked in the lower 2
29164 GB of the address space. Small symbols are also placed there. Symbols
29165 with sizes larger than @option{-mlarge-data-threshold} are put into
29166 large data or BSS sections and can be located above 2GB. Programs can
29167 be statically or dynamically linked.
29169 @item -mcmodel=large
29170 @opindex mcmodel=large
29171 Generate code for the large model. This model makes no assumptions
29172 about addresses and sizes of sections.
29174 @item -maddress-mode=long
29175 @opindex maddress-mode=long
29176 Generate code for long address mode. This is only supported for 64-bit
29177 and x32 environments. It is the default address mode for 64-bit
29180 @item -maddress-mode=short
29181 @opindex maddress-mode=short
29182 Generate code for short address mode. This is only supported for 32-bit
29183 and x32 environments. It is the default address mode for 32-bit and
29187 @node x86 Windows Options
29188 @subsection x86 Windows Options
29189 @cindex x86 Windows Options
29190 @cindex Windows Options for x86
29192 These additional options are available for Microsoft Windows targets:
29198 specifies that a console application is to be generated, by
29199 instructing the linker to set the PE header subsystem type
29200 required for console applications.
29201 This option is available for Cygwin and MinGW targets and is
29202 enabled by default on those targets.
29206 This option is available for Cygwin and MinGW targets. It
29207 specifies that a DLL---a dynamic link library---is to be
29208 generated, enabling the selection of the required runtime
29209 startup object and entry point.
29211 @item -mnop-fun-dllimport
29212 @opindex mnop-fun-dllimport
29213 This option is available for Cygwin and MinGW targets. It
29214 specifies that the @code{dllimport} attribute should be ignored.
29218 This option is available for MinGW targets. It specifies
29219 that MinGW-specific thread support is to be used.
29223 This option is available for MinGW-w64 targets. It causes
29224 the @code{UNICODE} preprocessor macro to be predefined, and
29225 chooses Unicode-capable runtime startup code.
29229 This option is available for Cygwin and MinGW targets. It
29230 specifies that the typical Microsoft Windows predefined macros are to
29231 be set in the pre-processor, but does not influence the choice
29232 of runtime library/startup code.
29236 This option is available for Cygwin and MinGW targets. It
29237 specifies that a GUI application is to be generated by
29238 instructing the linker to set the PE header subsystem type
29241 @item -fno-set-stack-executable
29242 @opindex fno-set-stack-executable
29243 @opindex fset-stack-executable
29244 This option is available for MinGW targets. It specifies that
29245 the executable flag for the stack used by nested functions isn't
29246 set. This is necessary for binaries running in kernel mode of
29247 Microsoft Windows, as there the User32 API, which is used to set executable
29248 privileges, isn't available.
29250 @item -fwritable-relocated-rdata
29251 @opindex fno-writable-relocated-rdata
29252 @opindex fwritable-relocated-rdata
29253 This option is available for MinGW and Cygwin targets. It specifies
29254 that relocated-data in read-only section is put into the @code{.data}
29255 section. This is a necessary for older runtimes not supporting
29256 modification of @code{.rdata} sections for pseudo-relocation.
29258 @item -mpe-aligned-commons
29259 @opindex mpe-aligned-commons
29260 This option is available for Cygwin and MinGW targets. It
29261 specifies that the GNU extension to the PE file format that
29262 permits the correct alignment of COMMON variables should be
29263 used when generating code. It is enabled by default if
29264 GCC detects that the target assembler found during configuration
29265 supports the feature.
29268 See also under @ref{x86 Options} for standard options.
29270 @node Xstormy16 Options
29271 @subsection Xstormy16 Options
29272 @cindex Xstormy16 Options
29274 These options are defined for Xstormy16:
29279 Choose startup files and linker script suitable for the simulator.
29282 @node Xtensa Options
29283 @subsection Xtensa Options
29284 @cindex Xtensa Options
29286 These options are supported for Xtensa targets:
29290 @itemx -mno-const16
29292 @opindex mno-const16
29293 Enable or disable use of @code{CONST16} instructions for loading
29294 constant values. The @code{CONST16} instruction is currently not a
29295 standard option from Tensilica. When enabled, @code{CONST16}
29296 instructions are always used in place of the standard @code{L32R}
29297 instructions. The use of @code{CONST16} is enabled by default only if
29298 the @code{L32R} instruction is not available.
29301 @itemx -mno-fused-madd
29302 @opindex mfused-madd
29303 @opindex mno-fused-madd
29304 Enable or disable use of fused multiply/add and multiply/subtract
29305 instructions in the floating-point option. This has no effect if the
29306 floating-point option is not also enabled. Disabling fused multiply/add
29307 and multiply/subtract instructions forces the compiler to use separate
29308 instructions for the multiply and add/subtract operations. This may be
29309 desirable in some cases where strict IEEE 754-compliant results are
29310 required: the fused multiply add/subtract instructions do not round the
29311 intermediate result, thereby producing results with @emph{more} bits of
29312 precision than specified by the IEEE standard. Disabling fused multiply
29313 add/subtract instructions also ensures that the program output is not
29314 sensitive to the compiler's ability to combine multiply and add/subtract
29317 @item -mserialize-volatile
29318 @itemx -mno-serialize-volatile
29319 @opindex mserialize-volatile
29320 @opindex mno-serialize-volatile
29321 When this option is enabled, GCC inserts @code{MEMW} instructions before
29322 @code{volatile} memory references to guarantee sequential consistency.
29323 The default is @option{-mserialize-volatile}. Use
29324 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
29326 @item -mforce-no-pic
29327 @opindex mforce-no-pic
29328 For targets, like GNU/Linux, where all user-mode Xtensa code must be
29329 position-independent code (PIC), this option disables PIC for compiling
29332 @item -mtext-section-literals
29333 @itemx -mno-text-section-literals
29334 @opindex mtext-section-literals
29335 @opindex mno-text-section-literals
29336 These options control the treatment of literal pools. The default is
29337 @option{-mno-text-section-literals}, which places literals in a separate
29338 section in the output file. This allows the literal pool to be placed
29339 in a data RAM/ROM, and it also allows the linker to combine literal
29340 pools from separate object files to remove redundant literals and
29341 improve code size. With @option{-mtext-section-literals}, the literals
29342 are interspersed in the text section in order to keep them as close as
29343 possible to their references. This may be necessary for large assembly
29344 files. Literals for each function are placed right before that function.
29346 @item -mauto-litpools
29347 @itemx -mno-auto-litpools
29348 @opindex mauto-litpools
29349 @opindex mno-auto-litpools
29350 These options control the treatment of literal pools. The default is
29351 @option{-mno-auto-litpools}, which places literals in a separate
29352 section in the output file unless @option{-mtext-section-literals} is
29353 used. With @option{-mauto-litpools} the literals are interspersed in
29354 the text section by the assembler. Compiler does not produce explicit
29355 @code{.literal} directives and loads literals into registers with
29356 @code{MOVI} instructions instead of @code{L32R} to let the assembler
29357 do relaxation and place literals as necessary. This option allows
29358 assembler to create several literal pools per function and assemble
29359 very big functions, which may not be possible with
29360 @option{-mtext-section-literals}.
29362 @item -mtarget-align
29363 @itemx -mno-target-align
29364 @opindex mtarget-align
29365 @opindex mno-target-align
29366 When this option is enabled, GCC instructs the assembler to
29367 automatically align instructions to reduce branch penalties at the
29368 expense of some code density. The assembler attempts to widen density
29369 instructions to align branch targets and the instructions following call
29370 instructions. If there are not enough preceding safe density
29371 instructions to align a target, no widening is performed. The
29372 default is @option{-mtarget-align}. These options do not affect the
29373 treatment of auto-aligned instructions like @code{LOOP}, which the
29374 assembler always aligns, either by widening density instructions or
29375 by inserting NOP instructions.
29378 @itemx -mno-longcalls
29379 @opindex mlongcalls
29380 @opindex mno-longcalls
29381 When this option is enabled, GCC instructs the assembler to translate
29382 direct calls to indirect calls unless it can determine that the target
29383 of a direct call is in the range allowed by the call instruction. This
29384 translation typically occurs for calls to functions in other source
29385 files. Specifically, the assembler translates a direct @code{CALL}
29386 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
29387 The default is @option{-mno-longcalls}. This option should be used in
29388 programs where the call target can potentially be out of range. This
29389 option is implemented in the assembler, not the compiler, so the
29390 assembly code generated by GCC still shows direct call
29391 instructions---look at the disassembled object code to see the actual
29392 instructions. Note that the assembler uses an indirect call for
29393 every cross-file call, not just those that really are out of range.
29396 @node zSeries Options
29397 @subsection zSeries Options
29398 @cindex zSeries options
29400 These are listed under @xref{S/390 and zSeries Options}.
29406 @section Specifying Subprocesses and the Switches to Pass to Them
29409 @command{gcc} is a driver program. It performs its job by invoking a
29410 sequence of other programs to do the work of compiling, assembling and
29411 linking. GCC interprets its command-line parameters and uses these to
29412 deduce which programs it should invoke, and which command-line options
29413 it ought to place on their command lines. This behavior is controlled
29414 by @dfn{spec strings}. In most cases there is one spec string for each
29415 program that GCC can invoke, but a few programs have multiple spec
29416 strings to control their behavior. The spec strings built into GCC can
29417 be overridden by using the @option{-specs=} command-line switch to specify
29420 @dfn{Spec files} are plain-text files that are used to construct spec
29421 strings. They consist of a sequence of directives separated by blank
29422 lines. The type of directive is determined by the first non-whitespace
29423 character on the line, which can be one of the following:
29426 @item %@var{command}
29427 Issues a @var{command} to the spec file processor. The commands that can
29431 @item %include <@var{file}>
29432 @cindex @code{%include}
29433 Search for @var{file} and insert its text at the current point in the
29436 @item %include_noerr <@var{file}>
29437 @cindex @code{%include_noerr}
29438 Just like @samp{%include}, but do not generate an error message if the include
29439 file cannot be found.
29441 @item %rename @var{old_name} @var{new_name}
29442 @cindex @code{%rename}
29443 Rename the spec string @var{old_name} to @var{new_name}.
29447 @item *[@var{spec_name}]:
29448 This tells the compiler to create, override or delete the named spec
29449 string. All lines after this directive up to the next directive or
29450 blank line are considered to be the text for the spec string. If this
29451 results in an empty string then the spec is deleted. (Or, if the
29452 spec did not exist, then nothing happens.) Otherwise, if the spec
29453 does not currently exist a new spec is created. If the spec does
29454 exist then its contents are overridden by the text of this
29455 directive, unless the first character of that text is the @samp{+}
29456 character, in which case the text is appended to the spec.
29458 @item [@var{suffix}]:
29459 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
29460 and up to the next directive or blank line are considered to make up the
29461 spec string for the indicated suffix. When the compiler encounters an
29462 input file with the named suffix, it processes the spec string in
29463 order to work out how to compile that file. For example:
29467 z-compile -input %i
29470 This says that any input file whose name ends in @samp{.ZZ} should be
29471 passed to the program @samp{z-compile}, which should be invoked with the
29472 command-line switch @option{-input} and with the result of performing the
29473 @samp{%i} substitution. (See below.)
29475 As an alternative to providing a spec string, the text following a
29476 suffix directive can be one of the following:
29479 @item @@@var{language}
29480 This says that the suffix is an alias for a known @var{language}. This is
29481 similar to using the @option{-x} command-line switch to GCC to specify a
29482 language explicitly. For example:
29489 Says that .ZZ files are, in fact, C++ source files.
29492 This causes an error messages saying:
29495 @var{name} compiler not installed on this system.
29499 GCC already has an extensive list of suffixes built into it.
29500 This directive adds an entry to the end of the list of suffixes, but
29501 since the list is searched from the end backwards, it is effectively
29502 possible to override earlier entries using this technique.
29506 GCC has the following spec strings built into it. Spec files can
29507 override these strings or create their own. Note that individual
29508 targets can also add their own spec strings to this list.
29511 asm Options to pass to the assembler
29512 asm_final Options to pass to the assembler post-processor
29513 cpp Options to pass to the C preprocessor
29514 cc1 Options to pass to the C compiler
29515 cc1plus Options to pass to the C++ compiler
29516 endfile Object files to include at the end of the link
29517 link Options to pass to the linker
29518 lib Libraries to include on the command line to the linker
29519 libgcc Decides which GCC support library to pass to the linker
29520 linker Sets the name of the linker
29521 predefines Defines to be passed to the C preprocessor
29522 signed_char Defines to pass to CPP to say whether @code{char} is signed
29524 startfile Object files to include at the start of the link
29527 Here is a small example of a spec file:
29530 %rename lib old_lib
29533 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
29536 This example renames the spec called @samp{lib} to @samp{old_lib} and
29537 then overrides the previous definition of @samp{lib} with a new one.
29538 The new definition adds in some extra command-line options before
29539 including the text of the old definition.
29541 @dfn{Spec strings} are a list of command-line options to be passed to their
29542 corresponding program. In addition, the spec strings can contain
29543 @samp{%}-prefixed sequences to substitute variable text or to
29544 conditionally insert text into the command line. Using these constructs
29545 it is possible to generate quite complex command lines.
29547 Here is a table of all defined @samp{%}-sequences for spec
29548 strings. Note that spaces are not generated automatically around the
29549 results of expanding these sequences. Therefore you can concatenate them
29550 together or combine them with constant text in a single argument.
29554 Substitute one @samp{%} into the program name or argument.
29557 Substitute the name of the input file being processed.
29560 Substitute the basename of the input file being processed.
29561 This is the substring up to (and not including) the last period
29562 and not including the directory.
29565 This is the same as @samp{%b}, but include the file suffix (text after
29569 Marks the argument containing or following the @samp{%d} as a
29570 temporary file name, so that that file is deleted if GCC exits
29571 successfully. Unlike @samp{%g}, this contributes no text to the
29574 @item %g@var{suffix}
29575 Substitute a file name that has suffix @var{suffix} and is chosen
29576 once per compilation, and mark the argument in the same way as
29577 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
29578 name is now chosen in a way that is hard to predict even when previously
29579 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
29580 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
29581 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
29582 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
29583 was simply substituted with a file name chosen once per compilation,
29584 without regard to any appended suffix (which was therefore treated
29585 just like ordinary text), making such attacks more likely to succeed.
29587 @item %u@var{suffix}
29588 Like @samp{%g}, but generates a new temporary file name
29589 each time it appears instead of once per compilation.
29591 @item %U@var{suffix}
29592 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
29593 new one if there is no such last file name. In the absence of any
29594 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
29595 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
29596 involves the generation of two distinct file names, one
29597 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
29598 simply substituted with a file name chosen for the previous @samp{%u},
29599 without regard to any appended suffix.
29601 @item %j@var{suffix}
29602 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
29603 writable, and if @option{-save-temps} is not used;
29604 otherwise, substitute the name
29605 of a temporary file, just like @samp{%u}. This temporary file is not
29606 meant for communication between processes, but rather as a junk
29607 disposal mechanism.
29609 @item %|@var{suffix}
29610 @itemx %m@var{suffix}
29611 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
29612 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
29613 all. These are the two most common ways to instruct a program that it
29614 should read from standard input or write to standard output. If you
29615 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
29616 construct: see for example @file{f/lang-specs.h}.
29618 @item %.@var{SUFFIX}
29619 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
29620 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
29621 terminated by the next space or %.
29624 Marks the argument containing or following the @samp{%w} as the
29625 designated output file of this compilation. This puts the argument
29626 into the sequence of arguments that @samp{%o} substitutes.
29629 Substitutes the names of all the output files, with spaces
29630 automatically placed around them. You should write spaces
29631 around the @samp{%o} as well or the results are undefined.
29632 @samp{%o} is for use in the specs for running the linker.
29633 Input files whose names have no recognized suffix are not compiled
29634 at all, but they are included among the output files, so they are
29638 Substitutes the suffix for object files. Note that this is
29639 handled specially when it immediately follows @samp{%g, %u, or %U},
29640 because of the need for those to form complete file names. The
29641 handling is such that @samp{%O} is treated exactly as if it had already
29642 been substituted, except that @samp{%g, %u, and %U} do not currently
29643 support additional @var{suffix} characters following @samp{%O} as they do
29644 following, for example, @samp{.o}.
29647 Substitutes the standard macro predefinitions for the
29648 current target machine. Use this when running @command{cpp}.
29651 Like @samp{%p}, but puts @samp{__} before and after the name of each
29652 predefined macro, except for macros that start with @samp{__} or with
29653 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
29657 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
29658 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
29659 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
29660 and @option{-imultilib} as necessary.
29663 Current argument is the name of a library or startup file of some sort.
29664 Search for that file in a standard list of directories and substitute
29665 the full name found. The current working directory is included in the
29666 list of directories scanned.
29669 Current argument is the name of a linker script. Search for that file
29670 in the current list of directories to scan for libraries. If the file
29671 is located insert a @option{--script} option into the command line
29672 followed by the full path name found. If the file is not found then
29673 generate an error message. Note: the current working directory is not
29677 Print @var{str} as an error message. @var{str} is terminated by a newline.
29678 Use this when inconsistent options are detected.
29680 @item %(@var{name})
29681 Substitute the contents of spec string @var{name} at this point.
29683 @item %x@{@var{option}@}
29684 Accumulate an option for @samp{%X}.
29687 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29691 Output the accumulated assembler options specified by @option{-Wa}.
29694 Output the accumulated preprocessor options specified by @option{-Wp}.
29697 Process the @code{asm} spec. This is used to compute the
29698 switches to be passed to the assembler.
29701 Process the @code{asm_final} spec. This is a spec string for
29702 passing switches to an assembler post-processor, if such a program is
29706 Process the @code{link} spec. This is the spec for computing the
29707 command line passed to the linker. Typically it makes use of the
29708 @samp{%L %G %S %D and %E} sequences.
29711 Dump out a @option{-L} option for each directory that GCC believes might
29712 contain startup files. If the target supports multilibs then the
29713 current multilib directory is prepended to each of these paths.
29716 Process the @code{lib} spec. This is a spec string for deciding which
29717 libraries are included on the command line to the linker.
29720 Process the @code{libgcc} spec. This is a spec string for deciding
29721 which GCC support library is included on the command line to the linker.
29724 Process the @code{startfile} spec. This is a spec for deciding which
29725 object files are the first ones passed to the linker. Typically
29726 this might be a file named @file{crt0.o}.
29729 Process the @code{endfile} spec. This is a spec string that specifies
29730 the last object files that are passed to the linker.
29733 Process the @code{cpp} spec. This is used to construct the arguments
29734 to be passed to the C preprocessor.
29737 Process the @code{cc1} spec. This is used to construct the options to be
29738 passed to the actual C compiler (@command{cc1}).
29741 Process the @code{cc1plus} spec. This is used to construct the options to be
29742 passed to the actual C++ compiler (@command{cc1plus}).
29745 Substitute the variable part of a matched option. See below.
29746 Note that each comma in the substituted string is replaced by
29750 Remove all occurrences of @code{-S} from the command line. Note---this
29751 command is position dependent. @samp{%} commands in the spec string
29752 before this one see @code{-S}, @samp{%} commands in the spec string
29753 after this one do not.
29755 @item %:@var{function}(@var{args})
29756 Call the named function @var{function}, passing it @var{args}.
29757 @var{args} is first processed as a nested spec string, then split
29758 into an argument vector in the usual fashion. The function returns
29759 a string which is processed as if it had appeared literally as part
29760 of the current spec.
29762 The following built-in spec functions are provided:
29765 @item @code{getenv}
29766 The @code{getenv} spec function takes two arguments: an environment
29767 variable name and a string. If the environment variable is not
29768 defined, a fatal error is issued. Otherwise, the return value is the
29769 value of the environment variable concatenated with the string. For
29770 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29773 %:getenv(TOPDIR /include)
29776 expands to @file{/path/to/top/include}.
29778 @item @code{if-exists}
29779 The @code{if-exists} spec function takes one argument, an absolute
29780 pathname to a file. If the file exists, @code{if-exists} returns the
29781 pathname. Here is a small example of its usage:
29785 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29788 @item @code{if-exists-else}
29789 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29790 spec function, except that it takes two arguments. The first argument is
29791 an absolute pathname to a file. If the file exists, @code{if-exists-else}
29792 returns the pathname. If it does not exist, it returns the second argument.
29793 This way, @code{if-exists-else} can be used to select one file or another,
29794 based on the existence of the first. Here is a small example of its usage:
29798 crt0%O%s %:if-exists(crti%O%s) \
29799 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29802 @item @code{replace-outfile}
29803 The @code{replace-outfile} spec function takes two arguments. It looks for the
29804 first argument in the outfiles array and replaces it with the second argument. Here
29805 is a small example of its usage:
29808 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29811 @item @code{remove-outfile}
29812 The @code{remove-outfile} spec function takes one argument. It looks for the
29813 first argument in the outfiles array and removes it. Here is a small example
29817 %:remove-outfile(-lm)
29820 @item @code{pass-through-libs}
29821 The @code{pass-through-libs} spec function takes any number of arguments. It
29822 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29823 assumes are the names of linker input library archive files) and returns a
29824 result containing all the found arguments each prepended by
29825 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
29826 intended to be passed to the LTO linker plugin.
29829 %:pass-through-libs(%G %L %G)
29832 @item @code{print-asm-header}
29833 The @code{print-asm-header} function takes no arguments and simply
29834 prints a banner like:
29840 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29843 It is used to separate compiler options from assembler options
29844 in the @option{--target-help} output.
29848 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29849 If that switch is not specified, this substitutes nothing. Note that
29850 the leading dash is omitted when specifying this option, and it is
29851 automatically inserted if the substitution is performed. Thus the spec
29852 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29853 and outputs the command-line option @option{-foo}.
29856 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29857 deleted on failure.
29860 Substitutes all the switches specified to GCC whose names start
29861 with @code{-S}, but which also take an argument. This is used for
29862 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29863 GCC considers @option{-o foo} as being
29864 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
29865 text, including the space. Thus two arguments are generated.
29868 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29869 (the order of @code{S} and @code{T} in the spec is not significant).
29870 There can be any number of ampersand-separated variables; for each the
29871 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
29874 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29877 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29880 Substitutes @code{X} if one or more switches whose names start with
29881 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
29882 once, no matter how many such switches appeared. However, if @code{%*}
29883 appears somewhere in @code{X}, then @code{X} is substituted once
29884 for each matching switch, with the @code{%*} replaced by the part of
29885 that switch matching the @code{*}.
29887 If @code{%*} appears as the last part of a spec sequence then a space
29888 is added after the end of the last substitution. If there is more
29889 text in the sequence, however, then a space is not generated. This
29890 allows the @code{%*} substitution to be used as part of a larger
29891 string. For example, a spec string like this:
29894 %@{mcu=*:--script=%*/memory.ld@}
29898 when matching an option like @option{-mcu=newchip} produces:
29901 --script=newchip/memory.ld
29905 Substitutes @code{X}, if processing a file with suffix @code{S}.
29908 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29911 Substitutes @code{X}, if processing a file for language @code{S}.
29914 Substitutes @code{X}, if not processing a file for language @code{S}.
29917 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29918 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29919 @code{*} sequences as well, although they have a stronger binding than
29920 the @samp{|}. If @code{%*} appears in @code{X}, all of the
29921 alternatives must be starred, and only the first matching alternative
29924 For example, a spec string like this:
29927 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29931 outputs the following command-line options from the following input
29932 command-line options:
29937 -d fred.c -foo -baz -boggle
29938 -d jim.d -bar -baz -boggle
29941 @item %@{S:X; T:Y; :D@}
29943 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29944 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
29945 be as many clauses as you need. This may be combined with @code{.},
29946 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
29951 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29952 or similar construct can use a backslash to ignore the special meaning
29953 of the character following it, thus allowing literal matching of a
29954 character that is otherwise specially treated. For example,
29955 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29956 @option{-std=iso9899:1999} option is given.
29958 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29959 construct may contain other nested @samp{%} constructs or spaces, or
29960 even newlines. They are processed as usual, as described above.
29961 Trailing white space in @code{X} is ignored. White space may also
29962 appear anywhere on the left side of the colon in these constructs,
29963 except between @code{.} or @code{*} and the corresponding word.
29965 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29966 handled specifically in these constructs. If another value of
29967 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
29968 @option{-W} switch is found later in the command line, the earlier
29969 switch value is ignored, except with @{@code{S}*@} where @code{S} is
29970 just one letter, which passes all matching options.
29972 The character @samp{|} at the beginning of the predicate text is used to
29973 indicate that a command should be piped to the following command, but
29974 only if @option{-pipe} is specified.
29976 It is built into GCC which switches take arguments and which do not.
29977 (You might think it would be useful to generalize this to allow each
29978 compiler's spec to say which switches take arguments. But this cannot
29979 be done in a consistent fashion. GCC cannot even decide which input
29980 files have been specified without knowing which switches take arguments,
29981 and it must know which input files to compile in order to tell which
29984 GCC also knows implicitly that arguments starting in @option{-l} are to be
29985 treated as compiler output files, and passed to the linker in their
29986 proper position among the other output files.
29988 @node Environment Variables
29989 @section Environment Variables Affecting GCC
29990 @cindex environment variables
29992 @c man begin ENVIRONMENT
29993 This section describes several environment variables that affect how GCC
29994 operates. Some of them work by specifying directories or prefixes to use
29995 when searching for various kinds of files. Some are used to specify other
29996 aspects of the compilation environment.
29998 Note that you can also specify places to search using options such as
29999 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
30000 take precedence over places specified using environment variables, which
30001 in turn take precedence over those specified by the configuration of GCC@.
30002 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
30003 GNU Compiler Collection (GCC) Internals}.
30008 @c @itemx LC_COLLATE
30010 @c @itemx LC_MONETARY
30011 @c @itemx LC_NUMERIC
30016 @c @findex LC_COLLATE
30017 @findex LC_MESSAGES
30018 @c @findex LC_MONETARY
30019 @c @findex LC_NUMERIC
30023 These environment variables control the way that GCC uses
30024 localization information which allows GCC to work with different
30025 national conventions. GCC inspects the locale categories
30026 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
30027 so. These locale categories can be set to any value supported by your
30028 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
30029 Kingdom encoded in UTF-8.
30031 The @env{LC_CTYPE} environment variable specifies character
30032 classification. GCC uses it to determine the character boundaries in
30033 a string; this is needed for some multibyte encodings that contain quote
30034 and escape characters that are otherwise interpreted as a string
30037 The @env{LC_MESSAGES} environment variable specifies the language to
30038 use in diagnostic messages.
30040 If the @env{LC_ALL} environment variable is set, it overrides the value
30041 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
30042 and @env{LC_MESSAGES} default to the value of the @env{LANG}
30043 environment variable. If none of these variables are set, GCC
30044 defaults to traditional C English behavior.
30048 If @env{TMPDIR} is set, it specifies the directory to use for temporary
30049 files. GCC uses temporary files to hold the output of one stage of
30050 compilation which is to be used as input to the next stage: for example,
30051 the output of the preprocessor, which is the input to the compiler
30054 @item GCC_COMPARE_DEBUG
30055 @findex GCC_COMPARE_DEBUG
30056 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
30057 @option{-fcompare-debug} to the compiler driver. See the documentation
30058 of this option for more details.
30060 @item GCC_EXEC_PREFIX
30061 @findex GCC_EXEC_PREFIX
30062 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
30063 names of the subprograms executed by the compiler. No slash is added
30064 when this prefix is combined with the name of a subprogram, but you can
30065 specify a prefix that ends with a slash if you wish.
30067 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
30068 an appropriate prefix to use based on the pathname it is invoked with.
30070 If GCC cannot find the subprogram using the specified prefix, it
30071 tries looking in the usual places for the subprogram.
30073 The default value of @env{GCC_EXEC_PREFIX} is
30074 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
30075 the installed compiler. In many cases @var{prefix} is the value
30076 of @code{prefix} when you ran the @file{configure} script.
30078 Other prefixes specified with @option{-B} take precedence over this prefix.
30080 This prefix is also used for finding files such as @file{crt0.o} that are
30083 In addition, the prefix is used in an unusual way in finding the
30084 directories to search for header files. For each of the standard
30085 directories whose name normally begins with @samp{/usr/local/lib/gcc}
30086 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
30087 replacing that beginning with the specified prefix to produce an
30088 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
30089 @file{foo/bar} just before it searches the standard directory
30090 @file{/usr/local/lib/bar}.
30091 If a standard directory begins with the configured
30092 @var{prefix} then the value of @var{prefix} is replaced by
30093 @env{GCC_EXEC_PREFIX} when looking for header files.
30095 @item COMPILER_PATH
30096 @findex COMPILER_PATH
30097 The value of @env{COMPILER_PATH} is a colon-separated list of
30098 directories, much like @env{PATH}. GCC tries the directories thus
30099 specified when searching for subprograms, if it cannot find the
30100 subprograms using @env{GCC_EXEC_PREFIX}.
30103 @findex LIBRARY_PATH
30104 The value of @env{LIBRARY_PATH} is a colon-separated list of
30105 directories, much like @env{PATH}. When configured as a native compiler,
30106 GCC tries the directories thus specified when searching for special
30107 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
30108 using GCC also uses these directories when searching for ordinary
30109 libraries for the @option{-l} option (but directories specified with
30110 @option{-L} come first).
30114 @cindex locale definition
30115 This variable is used to pass locale information to the compiler. One way in
30116 which this information is used is to determine the character set to be used
30117 when character literals, string literals and comments are parsed in C and C++.
30118 When the compiler is configured to allow multibyte characters,
30119 the following values for @env{LANG} are recognized:
30123 Recognize JIS characters.
30125 Recognize SJIS characters.
30127 Recognize EUCJP characters.
30130 If @env{LANG} is not defined, or if it has some other value, then the
30131 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
30132 recognize and translate multibyte characters.
30136 Some additional environment variables affect the behavior of the
30139 @include cppenv.texi
30143 @node Precompiled Headers
30144 @section Using Precompiled Headers
30145 @cindex precompiled headers
30146 @cindex speed of compilation
30148 Often large projects have many header files that are included in every
30149 source file. The time the compiler takes to process these header files
30150 over and over again can account for nearly all of the time required to
30151 build the project. To make builds faster, GCC allows you to
30152 @dfn{precompile} a header file.
30154 To create a precompiled header file, simply compile it as you would any
30155 other file, if necessary using the @option{-x} option to make the driver
30156 treat it as a C or C++ header file. You may want to use a
30157 tool like @command{make} to keep the precompiled header up-to-date when
30158 the headers it contains change.
30160 A precompiled header file is searched for when @code{#include} is
30161 seen in the compilation. As it searches for the included file
30162 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
30163 compiler looks for a precompiled header in each directory just before it
30164 looks for the include file in that directory. The name searched for is
30165 the name specified in the @code{#include} with @samp{.gch} appended. If
30166 the precompiled header file cannot be used, it is ignored.
30168 For instance, if you have @code{#include "all.h"}, and you have
30169 @file{all.h.gch} in the same directory as @file{all.h}, then the
30170 precompiled header file is used if possible, and the original
30171 header is used otherwise.
30173 Alternatively, you might decide to put the precompiled header file in a
30174 directory and use @option{-I} to ensure that directory is searched
30175 before (or instead of) the directory containing the original header.
30176 Then, if you want to check that the precompiled header file is always
30177 used, you can put a file of the same name as the original header in this
30178 directory containing an @code{#error} command.
30180 This also works with @option{-include}. So yet another way to use
30181 precompiled headers, good for projects not designed with precompiled
30182 header files in mind, is to simply take most of the header files used by
30183 a project, include them from another header file, precompile that header
30184 file, and @option{-include} the precompiled header. If the header files
30185 have guards against multiple inclusion, they are skipped because
30186 they've already been included (in the precompiled header).
30188 If you need to precompile the same header file for different
30189 languages, targets, or compiler options, you can instead make a
30190 @emph{directory} named like @file{all.h.gch}, and put each precompiled
30191 header in the directory, perhaps using @option{-o}. It doesn't matter
30192 what you call the files in the directory; every precompiled header in
30193 the directory is considered. The first precompiled header
30194 encountered in the directory that is valid for this compilation is
30195 used; they're searched in no particular order.
30197 There are many other possibilities, limited only by your imagination,
30198 good sense, and the constraints of your build system.
30200 A precompiled header file can be used only when these conditions apply:
30204 Only one precompiled header can be used in a particular compilation.
30207 A precompiled header cannot be used once the first C token is seen. You
30208 can have preprocessor directives before a precompiled header; you cannot
30209 include a precompiled header from inside another header.
30212 The precompiled header file must be produced for the same language as
30213 the current compilation. You cannot use a C precompiled header for a C++
30217 The precompiled header file must have been produced by the same compiler
30218 binary as the current compilation is using.
30221 Any macros defined before the precompiled header is included must
30222 either be defined in the same way as when the precompiled header was
30223 generated, or must not affect the precompiled header, which usually
30224 means that they don't appear in the precompiled header at all.
30226 The @option{-D} option is one way to define a macro before a
30227 precompiled header is included; using a @code{#define} can also do it.
30228 There are also some options that define macros implicitly, like
30229 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
30232 @item If debugging information is output when using the precompiled
30233 header, using @option{-g} or similar, the same kind of debugging information
30234 must have been output when building the precompiled header. However,
30235 a precompiled header built using @option{-g} can be used in a compilation
30236 when no debugging information is being output.
30238 @item The same @option{-m} options must generally be used when building
30239 and using the precompiled header. @xref{Submodel Options},
30240 for any cases where this rule is relaxed.
30242 @item Each of the following options must be the same when building and using
30243 the precompiled header:
30245 @gccoptlist{-fexceptions}
30248 Some other command-line options starting with @option{-f},
30249 @option{-p}, or @option{-O} must be defined in the same way as when
30250 the precompiled header was generated. At present, it's not clear
30251 which options are safe to change and which are not; the safest choice
30252 is to use exactly the same options when generating and using the
30253 precompiled header. The following are known to be safe:
30255 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
30256 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
30257 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
30262 For all of these except the last, the compiler automatically
30263 ignores the precompiled header if the conditions aren't met. If you
30264 find an option combination that doesn't work and doesn't cause the
30265 precompiled header to be ignored, please consider filing a bug report,
30268 If you do use differing options when generating and using the
30269 precompiled header, the actual behavior is a mixture of the
30270 behavior for the options. For instance, if you use @option{-g} to
30271 generate the precompiled header but not when using it, you may or may
30272 not get debugging information for routines in the precompiled header.