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 @gol
233 -Wnamespaces -Wnarrowing @gol
234 -Wnoexcept -Wnoexcept-type -Wclass-memaccess @gol
235 -Wnon-virtual-dtor -Wreorder -Wregister @gol
236 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
237 -Wno-non-template-friend -Wold-style-cast @gol
238 -Woverloaded-virtual -Wno-pmf-conversions @gol
239 -Wsign-promo -Wvirtual-inheritance}
241 @item Objective-C and Objective-C++ Language Options
242 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
243 Objective-C and Objective-C++ Dialects}.
244 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
245 -fgnu-runtime -fnext-runtime @gol
246 -fno-nil-receivers @gol
247 -fobjc-abi-version=@var{n} @gol
248 -fobjc-call-cxx-cdtors @gol
249 -fobjc-direct-dispatch @gol
250 -fobjc-exceptions @gol
253 -fobjc-std=objc1 @gol
254 -fno-local-ivars @gol
255 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
256 -freplace-objc-classes @gol
259 -Wassign-intercept @gol
260 -Wno-protocol -Wselector @gol
261 -Wstrict-selector-match @gol
262 -Wundeclared-selector}
264 @item Diagnostic Message Formatting Options
265 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
266 @gccoptlist{-fmessage-length=@var{n} @gol
267 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
268 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
269 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
270 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
271 -fdiagnostics-show-template-tree -fno-elide-type @gol
274 @item Warning Options
275 @xref{Warning Options,,Options to Request or Suppress Warnings}.
276 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
277 -pedantic-errors @gol
278 -w -Wextra -Wall -Waddress -Waggregate-return @gol
279 -Walloc-zero -Walloc-size-larger-than=@var{byte-size}
280 -Walloca -Walloca-larger-than=@var{byte-size} @gol
281 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
282 -Wno-attributes -Wbool-compare -Wbool-operation @gol
283 -Wno-builtin-declaration-mismatch @gol
284 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
285 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
286 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
287 -Wchar-subscripts -Wcatch-value -Wcatch-value=@var{n} @gol
288 -Wclobbered -Wcomment -Wconditionally-supported @gol
289 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
290 -Wdelete-incomplete @gol
291 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
292 -Wdisabled-optimization @gol
293 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
294 -Wno-div-by-zero -Wdouble-promotion @gol
295 -Wduplicated-branches -Wduplicated-cond @gol
296 -Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol
297 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
298 -Wfloat-equal -Wformat -Wformat=2 @gol
299 -Wno-format-contains-nul -Wno-format-extra-args @gol
300 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
301 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
302 -Wformat-y2k -Wframe-address @gol
303 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
304 -Wjump-misses-init @gol
305 -Wif-not-aligned @gol
306 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
307 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
308 -Wimplicit-function-declaration -Wimplicit-int @gol
309 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
310 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
311 -Winvalid-pch -Wlarger-than=@var{byte-size} @gol
312 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
313 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
314 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
315 -Wmissing-field-initializers -Wmissing-include-dirs @gol
316 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
317 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
318 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
319 -Woverride-init-side-effects -Woverlength-strings @gol
320 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
321 -Wparentheses -Wno-pedantic-ms-format @gol
322 -Wplacement-new -Wplacement-new=@var{n} @gol
323 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
324 -Wno-pragmas -Wredundant-decls -Wrestrict -Wno-return-local-addr @gol
325 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
326 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
327 -Wshift-overflow -Wshift-overflow=@var{n} @gol
328 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
329 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
330 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
331 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
332 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
333 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
334 -Wstringop-overflow=@var{n} -Wstringop-truncation @gol
335 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
336 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
337 -Wmissing-format-attribute -Wsubobject-linkage @gol
338 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
339 -Wswitch-unreachable -Wsync-nand @gol
340 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
341 -Wtype-limits -Wundef @gol
342 -Wuninitialized -Wunknown-pragmas @gol
343 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
344 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
345 -Wunused-parameter -Wno-unused-result @gol
346 -Wunused-value -Wunused-variable @gol
347 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
348 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
349 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
350 -Wvla -Wvla-larger-than=@var{byte-size} -Wvolatile-register-var @gol
352 -Wzero-as-null-pointer-constant -Whsa}
354 @item C and Objective-C-only Warning Options
355 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
356 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
357 -Wold-style-declaration -Wold-style-definition @gol
358 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
359 -Wdeclaration-after-statement -Wpointer-sign}
361 @item Debugging Options
362 @xref{Debugging Options,,Options for Debugging Your Program}.
363 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
364 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
365 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
366 -gas-loc-support -gno-as-loc-support @gol
367 -gas-locview-support -gno-as-locview-support @gol
368 -gcolumn-info -gno-column-info @gol
369 -gstatement-frontiers -gno-statement-frontiers @gol
370 -gvariable-location-views -gno-variable-location-views @gol
371 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
372 -ginline-points -gno-inline-points @gol
373 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
375 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
376 -fno-eliminate-unused-debug-types @gol
377 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
378 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
379 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
380 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
381 -fvar-tracking -fvar-tracking-assignments}
383 @item Optimization Options
384 @xref{Optimize Options,,Options that Control Optimization}.
385 @gccoptlist{-faggressive-loop-optimizations @gol
386 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
387 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
388 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
389 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
390 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
391 -fauto-inc-dec -fbranch-probabilities @gol
392 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
393 -fbtr-bb-exclusive -fcaller-saves @gol
394 -fcombine-stack-adjustments -fconserve-stack @gol
395 -fcompare-elim -fcprop-registers -fcrossjumping @gol
396 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
397 -fcx-limited-range @gol
398 -fdata-sections -fdce -fdelayed-branch @gol
399 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
400 -fdevirtualize-at-ltrans -fdse @gol
401 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
402 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
403 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
404 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
405 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
406 -fif-conversion2 -findirect-inlining @gol
407 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
408 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
409 -fipa-bit-cp -fipa-vrp @gol
410 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol
411 -fira-algorithm=@var{algorithm} @gol
412 -fira-region=@var{region} -fira-hoist-pressure @gol
413 -fira-loop-pressure -fno-ira-share-save-slots @gol
414 -fno-ira-share-spill-slots @gol
415 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
416 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
417 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
418 -floop-block -floop-interchange -floop-strip-mine @gol
419 -floop-unroll-and-jam -floop-nest-optimize @gol
420 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
421 -flto-partition=@var{alg} -fmerge-all-constants @gol
422 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
423 -fmove-loop-invariants -fno-branch-count-reg @gol
424 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
425 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
426 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
427 -fno-sched-spec -fno-signed-zeros @gol
428 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
429 -fomit-frame-pointer -foptimize-sibling-calls @gol
430 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
431 -fprefetch-loop-arrays @gol
432 -fprofile-correction @gol
433 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
434 -fprofile-reorder-functions @gol
435 -freciprocal-math -free -frename-registers -freorder-blocks @gol
436 -freorder-blocks-algorithm=@var{algorithm} @gol
437 -freorder-blocks-and-partition -freorder-functions @gol
438 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
439 -frounding-math -fsave-optimization-record @gol
440 -fsched2-use-superblocks -fsched-pressure @gol
441 -fsched-spec-load -fsched-spec-load-dangerous @gol
442 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
443 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
444 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
445 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
446 -fschedule-fusion @gol
447 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
448 -fselective-scheduling -fselective-scheduling2 @gol
449 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
450 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
451 -fsignaling-nans @gol
452 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
454 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
455 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
456 -fthread-jumps -ftracer -ftree-bit-ccp @gol
457 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
458 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
459 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
460 -ftree-loop-if-convert -ftree-loop-im @gol
461 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
462 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
463 -ftree-loop-vectorize @gol
464 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
465 -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
466 -ftree-switch-conversion -ftree-tail-merge @gol
467 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
468 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
469 -funsafe-math-optimizations -funswitch-loops @gol
470 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
471 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
472 --param @var{name}=@var{value}
473 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
475 @item Program Instrumentation Options
476 @xref{Instrumentation Options,,Program Instrumentation Options}.
477 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
478 -fprofile-abs-path @gol
479 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
480 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
481 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
482 -fsanitize-undefined-trap-on-error -fbounds-check @gol
483 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
484 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
485 -fstack-protector-explicit -fstack-check @gol
486 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
487 -fno-stack-limit -fsplit-stack @gol
488 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
489 -fvtv-counts -fvtv-debug @gol
490 -finstrument-functions @gol
491 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
492 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
494 @item Preprocessor Options
495 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
496 @gccoptlist{-A@var{question}=@var{answer} @gol
497 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
498 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
499 -dD -dI -dM -dN -dU @gol
500 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
501 -fexec-charset=@var{charset} -fextended-identifiers @gol
502 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
503 -fno-canonical-system-headers @gol -fpch-deps -fpch-preprocess @gol
504 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
505 -fwide-exec-charset=@var{charset} -fworking-directory @gol
506 -H -imacros @var{file} -include @var{file} @gol
507 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
508 -no-integrated-cpp -P -pthread -remap @gol
509 -traditional -traditional-cpp -trigraphs @gol
510 -U@var{macro} -undef @gol
511 -Wp,@var{option} -Xpreprocessor @var{option}}
513 @item Assembler Options
514 @xref{Assembler Options,,Passing Options to the Assembler}.
515 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
518 @xref{Link Options,,Options for Linking}.
519 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
520 -nostartfiles -nodefaultlibs -nostdlib -pie -pthread -rdynamic @gol
521 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
522 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
523 -shared -shared-libgcc -symbolic @gol
524 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
525 -u @var{symbol} -z @var{keyword}}
527 @item Directory Options
528 @xref{Directory Options,,Options for Directory Search}.
529 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
530 -idirafter @var{dir} @gol
531 -imacros @var{file} -imultilib @var{dir} @gol
532 -iplugindir=@var{dir} -iprefix @var{file} @gol
533 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
534 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
535 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
536 -nostdinc -nostdinc++ --sysroot=@var{dir}}
538 @item Code Generation Options
539 @xref{Code Gen Options,,Options for Code Generation Conventions}.
540 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
541 -ffixed-@var{reg} -fexceptions @gol
542 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
543 -fasynchronous-unwind-tables @gol
545 -finhibit-size-directive -fno-common -fno-ident @gol
546 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
547 -fno-jump-tables @gol
548 -frecord-gcc-switches @gol
549 -freg-struct-return -fshort-enums -fshort-wchar @gol
550 -fverbose-asm -fpack-struct[=@var{n}] @gol
551 -fleading-underscore -ftls-model=@var{model} @gol
552 -fstack-reuse=@var{reuse_level} @gol
553 -ftrampolines -ftrapv -fwrapv @gol
554 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
555 -fstrict-volatile-bitfields -fsync-libcalls}
557 @item Developer Options
558 @xref{Developer Options,,GCC Developer Options}.
559 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
560 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
561 -fdbg-cnt=@var{counter-value-list} @gol
562 -fdisable-ipa-@var{pass_name} @gol
563 -fdisable-rtl-@var{pass_name} @gol
564 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
565 -fdisable-tree-@var{pass_name} @gol
566 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
567 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
568 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
569 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
570 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
572 -fdump-lang-@var{switch} @gol
573 -fdump-lang-@var{switch}-@var{options} @gol
574 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
576 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
577 -fdump-statistics @gol
579 -fdump-tree-@var{switch} @gol
580 -fdump-tree-@var{switch}-@var{options} @gol
581 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
582 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
583 -fenable-@var{kind}-@var{pass} @gol
584 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
585 -fira-verbose=@var{n} @gol
586 -flto-report -flto-report-wpa -fmem-report-wpa @gol
587 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
588 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
589 -fprofile-report @gol
590 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
591 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
592 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
593 -fvar-tracking-assignments-toggle -gtoggle @gol
594 -print-file-name=@var{library} -print-libgcc-file-name @gol
595 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
596 -print-prog-name=@var{program} -print-search-dirs -Q @gol
597 -print-sysroot -print-sysroot-headers-suffix @gol
598 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
600 @item Machine-Dependent Options
601 @xref{Submodel Options,,Machine-Dependent Options}.
602 @c This list is ordered alphanumerically by subsection name.
603 @c Try and put the significant identifier (CPU or system) first,
604 @c so users have a clue at guessing where the ones they want will be.
606 @emph{AArch64 Options}
607 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
608 -mgeneral-regs-only @gol
609 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
610 -mstrict-align -mno-strict-align @gol
611 -momit-leaf-frame-pointer @gol
612 -mtls-dialect=desc -mtls-dialect=traditional @gol
613 -mtls-size=@var{size} @gol
614 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
615 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
616 -mpc-relative-literal-loads @gol
617 -msign-return-address=@var{scope} @gol
618 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
619 -moverride=@var{string} -mverbose-cost-dump}
621 @emph{Adapteva Epiphany Options}
622 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
623 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
624 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
625 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
626 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
627 -msplit-vecmove-early -m1reg-@var{reg}}
630 @gccoptlist{-mbarrel-shifter -mjli-always @gol
631 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
632 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
633 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
634 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
635 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
636 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
637 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
638 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
639 -mvolatile-cache -mtp-regno=@var{regno} @gol
640 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
641 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
642 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
643 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
644 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
645 -mtune=@var{cpu} -mmultcost=@var{num} @gol
646 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
647 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16}
650 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
651 -mabi=@var{name} @gol
652 -mapcs-stack-check -mno-apcs-stack-check @gol
653 -mapcs-reentrant -mno-apcs-reentrant @gol
654 -msched-prolog -mno-sched-prolog @gol
655 -mlittle-endian -mbig-endian @gol
657 -mfloat-abi=@var{name} @gol
658 -mfp16-format=@var{name}
659 -mthumb-interwork -mno-thumb-interwork @gol
660 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
661 -mtune=@var{name} -mprint-tune-info @gol
662 -mstructure-size-boundary=@var{n} @gol
663 -mabort-on-noreturn @gol
664 -mlong-calls -mno-long-calls @gol
665 -msingle-pic-base -mno-single-pic-base @gol
666 -mpic-register=@var{reg} @gol
667 -mnop-fun-dllimport @gol
668 -mpoke-function-name @gol
669 -mthumb -marm -mflip-thumb @gol
670 -mtpcs-frame -mtpcs-leaf-frame @gol
671 -mcaller-super-interworking -mcallee-super-interworking @gol
672 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
673 -mword-relocations @gol
674 -mfix-cortex-m3-ldrd @gol
675 -munaligned-access @gol
676 -mneon-for-64bits @gol
677 -mslow-flash-data @gol
678 -masm-syntax-unified @gol
680 -mverbose-cost-dump @gol
685 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
686 -mbranch-cost=@var{cost} @gol
687 -mcall-prologues -mgas-isr-prologues -mint8 @gol
688 -mn_flash=@var{size} -mno-interrupts @gol
689 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
690 -mfract-convert-truncate @gol
691 -mshort-calls -nodevicelib @gol
692 -Waddr-space-convert -Wmisspelled-isr}
694 @emph{Blackfin Options}
695 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
696 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
697 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
698 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
699 -mno-id-shared-library -mshared-library-id=@var{n} @gol
700 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
701 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
702 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
706 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
707 -msim -msdata=@var{sdata-type}}
710 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
711 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
712 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
713 -mstack-align -mdata-align -mconst-align @gol
714 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
715 -melf -maout -melinux -mlinux -sim -sim2 @gol
716 -mmul-bug-workaround -mno-mul-bug-workaround}
719 @gccoptlist{-mmac @gol
720 -mcr16cplus -mcr16c @gol
721 -msim -mint32 -mbit-ops
722 -mdata-model=@var{model}}
724 @emph{Darwin Options}
725 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
726 -arch_only -bind_at_load -bundle -bundle_loader @gol
727 -client_name -compatibility_version -current_version @gol
729 -dependency-file -dylib_file -dylinker_install_name @gol
730 -dynamic -dynamiclib -exported_symbols_list @gol
731 -filelist -flat_namespace -force_cpusubtype_ALL @gol
732 -force_flat_namespace -headerpad_max_install_names @gol
734 -image_base -init -install_name -keep_private_externs @gol
735 -multi_module -multiply_defined -multiply_defined_unused @gol
736 -noall_load -no_dead_strip_inits_and_terms @gol
737 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
738 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
739 -private_bundle -read_only_relocs -sectalign @gol
740 -sectobjectsymbols -whyload -seg1addr @gol
741 -sectcreate -sectobjectsymbols -sectorder @gol
742 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
743 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
744 -segprot -segs_read_only_addr -segs_read_write_addr @gol
745 -single_module -static -sub_library -sub_umbrella @gol
746 -twolevel_namespace -umbrella -undefined @gol
747 -unexported_symbols_list -weak_reference_mismatches @gol
748 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
749 -mkernel -mone-byte-bool}
751 @emph{DEC Alpha Options}
752 @gccoptlist{-mno-fp-regs -msoft-float @gol
753 -mieee -mieee-with-inexact -mieee-conformant @gol
754 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
755 -mtrap-precision=@var{mode} -mbuild-constants @gol
756 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
757 -mbwx -mmax -mfix -mcix @gol
758 -mfloat-vax -mfloat-ieee @gol
759 -mexplicit-relocs -msmall-data -mlarge-data @gol
760 -msmall-text -mlarge-text @gol
761 -mmemory-latency=@var{time}}
764 @gccoptlist{-msmall-model -mno-lsim}
767 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
770 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
771 -mhard-float -msoft-float @gol
772 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
773 -mdouble -mno-double @gol
774 -mmedia -mno-media -mmuladd -mno-muladd @gol
775 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
776 -mlinked-fp -mlong-calls -malign-labels @gol
777 -mlibrary-pic -macc-4 -macc-8 @gol
778 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
779 -moptimize-membar -mno-optimize-membar @gol
780 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
781 -mvliw-branch -mno-vliw-branch @gol
782 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
783 -mno-nested-cond-exec -mtomcat-stats @gol
787 @emph{GNU/Linux Options}
788 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
789 -tno-android-cc -tno-android-ld}
791 @emph{H8/300 Options}
792 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
795 @gccoptlist{-march=@var{architecture-type} @gol
796 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
797 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
798 -mfixed-range=@var{register-range} @gol
799 -mjump-in-delay -mlinker-opt -mlong-calls @gol
800 -mlong-load-store -mno-disable-fpregs @gol
801 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
802 -mno-jump-in-delay -mno-long-load-store @gol
803 -mno-portable-runtime -mno-soft-float @gol
804 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
805 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
806 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
807 -munix=@var{unix-std} -nolibdld -static -threads}
810 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
811 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
812 -mconstant-gp -mauto-pic -mfused-madd @gol
813 -minline-float-divide-min-latency @gol
814 -minline-float-divide-max-throughput @gol
815 -mno-inline-float-divide @gol
816 -minline-int-divide-min-latency @gol
817 -minline-int-divide-max-throughput @gol
818 -mno-inline-int-divide @gol
819 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
820 -mno-inline-sqrt @gol
821 -mdwarf2-asm -mearly-stop-bits @gol
822 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
823 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
824 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
825 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
826 -msched-spec-ldc -msched-spec-control-ldc @gol
827 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
828 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
829 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
830 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
833 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
834 -msign-extend-enabled -muser-enabled}
836 @emph{M32R/D Options}
837 @gccoptlist{-m32r2 -m32rx -m32r @gol
839 -malign-loops -mno-align-loops @gol
840 -missue-rate=@var{number} @gol
841 -mbranch-cost=@var{number} @gol
842 -mmodel=@var{code-size-model-type} @gol
843 -msdata=@var{sdata-type} @gol
844 -mno-flush-func -mflush-func=@var{name} @gol
845 -mno-flush-trap -mflush-trap=@var{number} @gol
849 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
851 @emph{M680x0 Options}
852 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
853 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
854 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
855 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
856 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
857 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
858 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
859 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
860 -mxgot -mno-xgot -mlong-jump-table-offsets}
863 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
864 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
865 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
866 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
867 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
870 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
871 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
872 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
873 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
876 @emph{MicroBlaze Options}
877 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
878 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
879 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
880 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
881 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}
882 -mpic-data-is-text-relative}
885 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
886 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
887 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
888 -mips16 -mno-mips16 -mflip-mips16 @gol
889 -minterlink-compressed -mno-interlink-compressed @gol
890 -minterlink-mips16 -mno-interlink-mips16 @gol
891 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
892 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
893 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
894 -mno-float -msingle-float -mdouble-float @gol
895 -modd-spreg -mno-odd-spreg @gol
896 -mabs=@var{mode} -mnan=@var{encoding} @gol
897 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
900 -mvirt -mno-virt @gol
903 -mginv -mno-ginv @gol
904 -mmicromips -mno-micromips @gol
906 -mfpu=@var{fpu-type} @gol
907 -msmartmips -mno-smartmips @gol
908 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
909 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
910 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
911 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
912 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
913 -membedded-data -mno-embedded-data @gol
914 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
915 -mcode-readable=@var{setting} @gol
916 -msplit-addresses -mno-split-addresses @gol
917 -mexplicit-relocs -mno-explicit-relocs @gol
918 -mcheck-zero-division -mno-check-zero-division @gol
919 -mdivide-traps -mdivide-breaks @gol
920 -mload-store-pairs -mno-load-store-pairs @gol
921 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
922 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
923 -mfix-24k -mno-fix-24k @gol
924 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
925 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
926 -mfix-vr4120 -mno-fix-vr4120 @gol
927 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
928 -mflush-func=@var{func} -mno-flush-func @gol
929 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
930 -mcompact-branches=@var{policy} @gol
931 -mfp-exceptions -mno-fp-exceptions @gol
932 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
933 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
934 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
935 -mframe-header-opt -mno-frame-header-opt}
938 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
939 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
940 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
941 -mno-base-addresses -msingle-exit -mno-single-exit}
943 @emph{MN10300 Options}
944 @gccoptlist{-mmult-bug -mno-mult-bug @gol
945 -mno-am33 -mam33 -mam33-2 -mam34 @gol
946 -mtune=@var{cpu-type} @gol
947 -mreturn-pointer-on-d0 @gol
948 -mno-crt0 -mrelax -mliw -msetlb}
951 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
953 @emph{MSP430 Options}
954 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
956 -mcode-region= -mdata-region= @gol
957 -msilicon-errata= -msilicon-errata-warn= @gol
961 @gccoptlist{-mbig-endian -mlittle-endian @gol
962 -mreduced-regs -mfull-regs @gol
963 -mcmov -mno-cmov @gol
964 -mext-perf -mno-ext-perf @gol
965 -mext-perf2 -mno-ext-perf2 @gol
966 -mext-string -mno-ext-string @gol
967 -mv3push -mno-v3push @gol
968 -m16bit -mno-16bit @gol
969 -misr-vector-size=@var{num} @gol
970 -mcache-block-size=@var{num} @gol
971 -march=@var{arch} @gol
972 -mcmodel=@var{code-model} @gol
975 @emph{Nios II Options}
976 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
977 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
979 -mno-bypass-cache -mbypass-cache @gol
980 -mno-cache-volatile -mcache-volatile @gol
981 -mno-fast-sw-div -mfast-sw-div @gol
982 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
983 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
984 -mcustom-fpu-cfg=@var{name} @gol
985 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
986 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
988 @emph{Nvidia PTX Options}
989 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
991 @emph{PDP-11 Options}
992 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
993 -mint32 -mno-int16 -mint16 -mno-int32 @gol
994 -mfloat32 -mno-float64 -mfloat64 -mno-float32 @gol
995 -msplit -munix-asm -mdec-asm -mgnu-asm}
997 @emph{picoChip Options}
998 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
999 -msymbol-as-address -mno-inefficient-warnings}
1001 @emph{PowerPC Options}
1002 See RS/6000 and PowerPC Options.
1004 @emph{PowerPC SPE Options}
1005 @gccoptlist{-mcpu=@var{cpu-type} @gol
1006 -mtune=@var{cpu-type} @gol
1007 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb @gol
1008 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1009 -m32 -mxl-compat -mno-xl-compat @gol
1010 -malign-power -malign-natural @gol
1011 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1012 -msingle-float -mdouble-float @gol
1013 -mupdate -mno-update @gol
1014 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1015 -mstrict-align -mno-strict-align -mrelocatable @gol
1016 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1017 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1018 -msingle-pic-base @gol
1019 -mprioritize-restricted-insns=@var{priority} @gol
1020 -msched-costly-dep=@var{dependence_type} @gol
1021 -minsert-sched-nops=@var{scheme} @gol
1022 -mcall-sysv -mcall-netbsd @gol
1023 -maix-struct-return -msvr4-struct-return @gol
1024 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1025 -mblock-move-inline-limit=@var{num} @gol
1026 -misel -mno-isel @gol
1027 -misel=yes -misel=no @gol
1029 -mspe=yes -mspe=no @gol
1030 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
1031 -mprototype -mno-prototype @gol
1032 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1033 -msdata=@var{opt} -mvxworks -G @var{num} @gol
1034 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1035 -mno-recip-precision @gol
1036 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1037 -msave-toc-indirect -mno-save-toc-indirect @gol
1038 -mcompat-align-parm -mno-compat-align-parm @gol
1039 -mfloat128 -mno-float128 @gol
1040 -mgnu-attribute -mno-gnu-attribute @gol
1041 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1042 -mstack-protector-guard-offset=@var{offset}}
1044 @emph{RISC-V Options}
1045 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1047 -mabi=@var{ABI-string} @gol
1048 -mfdiv -mno-fdiv @gol
1050 -march=@var{ISA-string} @gol
1051 -mtune=@var{processor-string} @gol
1052 -mpreferred-stack-boundary=@var{num} @gol
1053 -msmall-data-limit=@var{N-bytes} @gol
1054 -msave-restore -mno-save-restore @gol
1055 -mstrict-align -mno-strict-align @gol
1056 -mcmodel=medlow -mcmodel=medany @gol
1057 -mexplicit-relocs -mno-explicit-relocs @gol
1058 -mrelax -mno-relax @gol}
1061 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1062 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1063 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1065 @emph{RS/6000 and PowerPC Options}
1066 @gccoptlist{-mcpu=@var{cpu-type} @gol
1067 -mtune=@var{cpu-type} @gol
1068 -mcmodel=@var{code-model} @gol
1070 -maltivec -mno-altivec @gol
1071 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1072 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1073 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1074 -mfprnd -mno-fprnd @gol
1075 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
1076 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1077 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1078 -malign-power -malign-natural @gol
1079 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1080 -mupdate -mno-update @gol
1081 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1082 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1083 -mstrict-align -mno-strict-align -mrelocatable @gol
1084 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1085 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1086 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
1087 -mprioritize-restricted-insns=@var{priority} @gol
1088 -msched-costly-dep=@var{dependence_type} @gol
1089 -minsert-sched-nops=@var{scheme} @gol
1090 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1091 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1092 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1093 -mtraceback=@var{traceback_type} @gol
1094 -maix-struct-return -msvr4-struct-return @gol
1095 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1096 -mblock-move-inline-limit=@var{num} @gol
1097 -mblock-compare-inline-limit=@var{num} @gol
1098 -mblock-compare-inline-loop-limit=@var{num} @gol
1099 -mstring-compare-inline-limit=@var{num} @gol
1100 -misel -mno-isel @gol
1101 -misel=yes -misel=no @gol
1102 -mvrsave -mno-vrsave @gol
1103 -mmulhw -mno-mulhw @gol
1104 -mdlmzb -mno-dlmzb @gol
1105 -mprototype -mno-prototype @gol
1106 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1107 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1108 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1109 -mno-recip-precision @gol
1110 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1111 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1112 -msave-toc-indirect -mno-save-toc-indirect @gol
1113 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1114 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1115 -mquad-memory -mno-quad-memory @gol
1116 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1117 -mcompat-align-parm -mno-compat-align-parm @gol
1118 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1119 -mgnu-attribute -mno-gnu-attribute @gol
1120 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1121 -mstack-protector-guard-offset=@var{offset}}
1124 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1126 -mbig-endian-data -mlittle-endian-data @gol
1129 -mas100-syntax -mno-as100-syntax@gol
1131 -mmax-constant-size=@gol
1134 -mallow-string-insns -mno-allow-string-insns@gol
1136 -mno-warn-multiple-fast-interrupts@gol
1137 -msave-acc-in-interrupts}
1139 @emph{S/390 and zSeries Options}
1140 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1141 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1142 -mlong-double-64 -mlong-double-128 @gol
1143 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1144 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1145 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1146 -mhtm -mvx -mzvector @gol
1147 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1148 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1149 -mhotpatch=@var{halfwords},@var{halfwords}}
1151 @emph{Score Options}
1152 @gccoptlist{-meb -mel @gol
1156 -mscore5 -mscore5u -mscore7 -mscore7d}
1159 @gccoptlist{-m1 -m2 -m2e @gol
1160 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1162 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1163 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1164 -mb -ml -mdalign -mrelax @gol
1165 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1166 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1167 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1168 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1169 -maccumulate-outgoing-args @gol
1170 -matomic-model=@var{atomic-model} @gol
1171 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1172 -mcbranch-force-delay-slot @gol
1173 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1174 -mpretend-cmove -mtas}
1176 @emph{Solaris 2 Options}
1177 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1180 @emph{SPARC Options}
1181 @gccoptlist{-mcpu=@var{cpu-type} @gol
1182 -mtune=@var{cpu-type} @gol
1183 -mcmodel=@var{code-model} @gol
1184 -mmemory-model=@var{mem-model} @gol
1185 -m32 -m64 -mapp-regs -mno-app-regs @gol
1186 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1187 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1188 -mhard-quad-float -msoft-quad-float @gol
1189 -mstack-bias -mno-stack-bias @gol
1190 -mstd-struct-return -mno-std-struct-return @gol
1191 -munaligned-doubles -mno-unaligned-doubles @gol
1192 -muser-mode -mno-user-mode @gol
1193 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1194 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1195 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1196 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1197 -mpopc -mno-popc -msubxc -mno-subxc @gol
1198 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1202 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1203 -msafe-dma -munsafe-dma @gol
1205 -msmall-mem -mlarge-mem -mstdmain @gol
1206 -mfixed-range=@var{register-range} @gol
1208 -maddress-space-conversion -mno-address-space-conversion @gol
1209 -mcache-size=@var{cache-size} @gol
1210 -matomic-updates -mno-atomic-updates}
1212 @emph{System V Options}
1213 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1215 @emph{TILE-Gx Options}
1216 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1217 -mcmodel=@var{code-model}}
1219 @emph{TILEPro Options}
1220 @gccoptlist{-mcpu=@var{cpu} -m32}
1223 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1224 -mprolog-function -mno-prolog-function -mspace @gol
1225 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1226 -mapp-regs -mno-app-regs @gol
1227 -mdisable-callt -mno-disable-callt @gol
1228 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1229 -mv850e -mv850 -mv850e3v5 @gol
1240 @gccoptlist{-mg -mgnu -munix}
1242 @emph{Visium Options}
1243 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1244 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1247 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1248 -mpointer-size=@var{size}}
1250 @emph{VxWorks Options}
1251 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1252 -Xbind-lazy -Xbind-now}
1255 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1256 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1257 -mfpmath=@var{unit} @gol
1258 -masm=@var{dialect} -mno-fancy-math-387 @gol
1259 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1260 -mno-wide-multiply -mrtd -malign-double @gol
1261 -mpreferred-stack-boundary=@var{num} @gol
1262 -mincoming-stack-boundary=@var{num} @gol
1263 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1264 -mrecip -mrecip=@var{opt} @gol
1265 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1266 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1267 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1268 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1269 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1270 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1271 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1272 -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp @gol
1273 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1274 -mshstk -mforce-indirect-call -mavx512vbmi2 @gol
1275 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq
1277 -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1278 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1279 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1280 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1281 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1282 -mregparm=@var{num} -msseregparm @gol
1283 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1284 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1285 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1286 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1287 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1288 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1289 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1290 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1291 -mstack-protector-guard-reg=@var{reg} @gol
1292 -mstack-protector-guard-offset=@var{offset} @gol
1293 -mstack-protector-guard-symbol=@var{symbol} -mmitigate-rop @gol
1294 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1295 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1296 -mindirect-branch-register}
1298 @emph{x86 Windows Options}
1299 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1300 -mnop-fun-dllimport -mthread @gol
1301 -municode -mwin32 -mwindows -fno-set-stack-executable}
1303 @emph{Xstormy16 Options}
1306 @emph{Xtensa Options}
1307 @gccoptlist{-mconst16 -mno-const16 @gol
1308 -mfused-madd -mno-fused-madd @gol
1310 -mserialize-volatile -mno-serialize-volatile @gol
1311 -mtext-section-literals -mno-text-section-literals @gol
1312 -mauto-litpools -mno-auto-litpools @gol
1313 -mtarget-align -mno-target-align @gol
1314 -mlongcalls -mno-longcalls}
1316 @emph{zSeries Options}
1317 See S/390 and zSeries Options.
1321 @node Overall Options
1322 @section Options Controlling the Kind of Output
1324 Compilation can involve up to four stages: preprocessing, compilation
1325 proper, assembly and linking, always in that order. GCC is capable of
1326 preprocessing and compiling several files either into several
1327 assembler input files, or into one assembler input file; then each
1328 assembler input file produces an object file, and linking combines all
1329 the object files (those newly compiled, and those specified as input)
1330 into an executable file.
1332 @cindex file name suffix
1333 For any given input file, the file name suffix determines what kind of
1334 compilation is done:
1338 C source code that must be preprocessed.
1341 C source code that should not be preprocessed.
1344 C++ source code that should not be preprocessed.
1347 Objective-C source code. Note that you must link with the @file{libobjc}
1348 library to make an Objective-C program work.
1351 Objective-C source code that should not be preprocessed.
1355 Objective-C++ source code. Note that you must link with the @file{libobjc}
1356 library to make an Objective-C++ program work. Note that @samp{.M} refers
1357 to a literal capital M@.
1359 @item @var{file}.mii
1360 Objective-C++ source code that should not be preprocessed.
1363 C, C++, Objective-C or Objective-C++ header file to be turned into a
1364 precompiled header (default), or C, C++ header file to be turned into an
1365 Ada spec (via the @option{-fdump-ada-spec} switch).
1368 @itemx @var{file}.cp
1369 @itemx @var{file}.cxx
1370 @itemx @var{file}.cpp
1371 @itemx @var{file}.CPP
1372 @itemx @var{file}.c++
1374 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1375 the last two letters must both be literally @samp{x}. Likewise,
1376 @samp{.C} refers to a literal capital C@.
1380 Objective-C++ source code that must be preprocessed.
1382 @item @var{file}.mii
1383 Objective-C++ source code that should not be preprocessed.
1387 @itemx @var{file}.hp
1388 @itemx @var{file}.hxx
1389 @itemx @var{file}.hpp
1390 @itemx @var{file}.HPP
1391 @itemx @var{file}.h++
1392 @itemx @var{file}.tcc
1393 C++ header file to be turned into a precompiled header or Ada spec.
1396 @itemx @var{file}.for
1397 @itemx @var{file}.ftn
1398 Fixed form Fortran source code that should not be preprocessed.
1401 @itemx @var{file}.FOR
1402 @itemx @var{file}.fpp
1403 @itemx @var{file}.FPP
1404 @itemx @var{file}.FTN
1405 Fixed form Fortran source code that must be preprocessed (with the traditional
1408 @item @var{file}.f90
1409 @itemx @var{file}.f95
1410 @itemx @var{file}.f03
1411 @itemx @var{file}.f08
1412 Free form Fortran source code that should not be preprocessed.
1414 @item @var{file}.F90
1415 @itemx @var{file}.F95
1416 @itemx @var{file}.F03
1417 @itemx @var{file}.F08
1418 Free form Fortran source code that must be preprocessed (with the
1419 traditional preprocessor).
1424 @item @var{file}.brig
1425 BRIG files (binary representation of HSAIL).
1427 @item @var{file}.ads
1428 Ada source code file that contains a library unit declaration (a
1429 declaration of a package, subprogram, or generic, or a generic
1430 instantiation), or a library unit renaming declaration (a package,
1431 generic, or subprogram renaming declaration). Such files are also
1434 @item @var{file}.adb
1435 Ada source code file containing a library unit body (a subprogram or
1436 package body). Such files are also called @dfn{bodies}.
1438 @c GCC also knows about some suffixes for languages not yet included:
1449 @itemx @var{file}.sx
1450 Assembler code that must be preprocessed.
1453 An object file to be fed straight into linking.
1454 Any file name with no recognized suffix is treated this way.
1458 You can specify the input language explicitly with the @option{-x} option:
1461 @item -x @var{language}
1462 Specify explicitly the @var{language} for the following input files
1463 (rather than letting the compiler choose a default based on the file
1464 name suffix). This option applies to all following input files until
1465 the next @option{-x} option. Possible values for @var{language} are:
1467 c c-header cpp-output
1468 c++ c++-header c++-cpp-output
1469 objective-c objective-c-header objective-c-cpp-output
1470 objective-c++ objective-c++-header objective-c++-cpp-output
1471 assembler assembler-with-cpp
1473 f77 f77-cpp-input f95 f95-cpp-input
1479 Turn off any specification of a language, so that subsequent files are
1480 handled according to their file name suffixes (as they are if @option{-x}
1481 has not been used at all).
1484 If you only want some of the stages of compilation, you can use
1485 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1486 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1487 @command{gcc} is to stop. Note that some combinations (for example,
1488 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1493 Compile or assemble the source files, but do not link. The linking
1494 stage simply is not done. The ultimate output is in the form of an
1495 object file for each source file.
1497 By default, the object file name for a source file is made by replacing
1498 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1500 Unrecognized input files, not requiring compilation or assembly, are
1505 Stop after the stage of compilation proper; do not assemble. The output
1506 is in the form of an assembler code file for each non-assembler input
1509 By default, the assembler file name for a source file is made by
1510 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1512 Input files that don't require compilation are ignored.
1516 Stop after the preprocessing stage; do not run the compiler proper. The
1517 output is in the form of preprocessed source code, which is sent to the
1520 Input files that don't require preprocessing are ignored.
1522 @cindex output file option
1525 Place output in file @var{file}. This applies to whatever
1526 sort of output is being produced, whether it be an executable file,
1527 an object file, an assembler file or preprocessed C code.
1529 If @option{-o} is not specified, the default is to put an executable
1530 file in @file{a.out}, the object file for
1531 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1532 assembler file in @file{@var{source}.s}, a precompiled header file in
1533 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1538 Print (on standard error output) the commands executed to run the stages
1539 of compilation. Also print the version number of the compiler driver
1540 program and of the preprocessor and the compiler proper.
1544 Like @option{-v} except the commands are not executed and arguments
1545 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1546 This is useful for shell scripts to capture the driver-generated command lines.
1550 Print (on the standard output) a description of the command-line options
1551 understood by @command{gcc}. If the @option{-v} option is also specified
1552 then @option{--help} is also passed on to the various processes
1553 invoked by @command{gcc}, so that they can display the command-line options
1554 they accept. If the @option{-Wextra} option has also been specified
1555 (prior to the @option{--help} option), then command-line options that
1556 have no documentation associated with them are also displayed.
1559 @opindex target-help
1560 Print (on the standard output) a description of target-specific command-line
1561 options for each tool. For some targets extra target-specific
1562 information may also be printed.
1564 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1565 Print (on the standard output) a description of the command-line
1566 options understood by the compiler that fit into all specified classes
1567 and qualifiers. These are the supported classes:
1570 @item @samp{optimizers}
1571 Display all of the optimization options supported by the
1574 @item @samp{warnings}
1575 Display all of the options controlling warning messages
1576 produced by the compiler.
1579 Display target-specific options. Unlike the
1580 @option{--target-help} option however, target-specific options of the
1581 linker and assembler are not displayed. This is because those
1582 tools do not currently support the extended @option{--help=} syntax.
1585 Display the values recognized by the @option{--param}
1588 @item @var{language}
1589 Display the options supported for @var{language}, where
1590 @var{language} is the name of one of the languages supported in this
1594 Display the options that are common to all languages.
1597 These are the supported qualifiers:
1600 @item @samp{undocumented}
1601 Display only those options that are undocumented.
1604 Display options taking an argument that appears after an equal
1605 sign in the same continuous piece of text, such as:
1606 @samp{--help=target}.
1608 @item @samp{separate}
1609 Display options taking an argument that appears as a separate word
1610 following the original option, such as: @samp{-o output-file}.
1613 Thus for example to display all the undocumented target-specific
1614 switches supported by the compiler, use:
1617 --help=target,undocumented
1620 The sense of a qualifier can be inverted by prefixing it with the
1621 @samp{^} character, so for example to display all binary warning
1622 options (i.e., ones that are either on or off and that do not take an
1623 argument) that have a description, use:
1626 --help=warnings,^joined,^undocumented
1629 The argument to @option{--help=} should not consist solely of inverted
1632 Combining several classes is possible, although this usually
1633 restricts the output so much that there is nothing to display. One
1634 case where it does work, however, is when one of the classes is
1635 @var{target}. For example, to display all the target-specific
1636 optimization options, use:
1639 --help=target,optimizers
1642 The @option{--help=} option can be repeated on the command line. Each
1643 successive use displays its requested class of options, skipping
1644 those that have already been displayed.
1646 If the @option{-Q} option appears on the command line before the
1647 @option{--help=} option, then the descriptive text displayed by
1648 @option{--help=} is changed. Instead of describing the displayed
1649 options, an indication is given as to whether the option is enabled,
1650 disabled or set to a specific value (assuming that the compiler
1651 knows this at the point where the @option{--help=} option is used).
1653 Here is a truncated example from the ARM port of @command{gcc}:
1656 % gcc -Q -mabi=2 --help=target -c
1657 The following options are target specific:
1659 -mabort-on-noreturn [disabled]
1663 The output is sensitive to the effects of previous command-line
1664 options, so for example it is possible to find out which optimizations
1665 are enabled at @option{-O2} by using:
1668 -Q -O2 --help=optimizers
1671 Alternatively you can discover which binary optimizations are enabled
1672 by @option{-O3} by using:
1675 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1676 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1677 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1682 Display the version number and copyrights of the invoked GCC@.
1684 @item -pass-exit-codes
1685 @opindex pass-exit-codes
1686 Normally the @command{gcc} program exits with the code of 1 if any
1687 phase of the compiler returns a non-success return code. If you specify
1688 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1689 the numerically highest error produced by any phase returning an error
1690 indication. The C, C++, and Fortran front ends return 4 if an internal
1691 compiler error is encountered.
1695 Use pipes rather than temporary files for communication between the
1696 various stages of compilation. This fails to work on some systems where
1697 the assembler is unable to read from a pipe; but the GNU assembler has
1700 @item -specs=@var{file}
1702 Process @var{file} after the compiler reads in the standard @file{specs}
1703 file, in order to override the defaults which the @command{gcc} driver
1704 program uses when determining what switches to pass to @command{cc1},
1705 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1706 @option{-specs=@var{file}} can be specified on the command line, and they
1707 are processed in order, from left to right. @xref{Spec Files}, for
1708 information about the format of the @var{file}.
1712 Invoke all subcommands under a wrapper program. The name of the
1713 wrapper program and its parameters are passed as a comma separated
1717 gcc -c t.c -wrapper gdb,--args
1721 This invokes all subprograms of @command{gcc} under
1722 @samp{gdb --args}, thus the invocation of @command{cc1} is
1723 @samp{gdb --args cc1 @dots{}}.
1725 @item -ffile-prefix-map=@var{old}=@var{new}
1726 @opindex ffile-prefix-map
1727 When compiling files residing in directory @file{@var{old}}, record
1728 any references to them in the result of the compilation as if the
1729 files resided in directory @file{@var{new}} instead. Specifying this
1730 option is equivalent to specifying all the individual
1731 @option{-f*-prefix-map} options. This can be used to make reproducible
1732 builds that are location independent. See also
1733 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1735 @item -fplugin=@var{name}.so
1737 Load the plugin code in file @var{name}.so, assumed to be a
1738 shared object to be dlopen'd by the compiler. The base name of
1739 the shared object file is used to identify the plugin for the
1740 purposes of argument parsing (See
1741 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1742 Each plugin should define the callback functions specified in the
1745 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1746 @opindex fplugin-arg
1747 Define an argument called @var{key} with a value of @var{value}
1748 for the plugin called @var{name}.
1750 @item -fdump-ada-spec@r{[}-slim@r{]}
1751 @opindex fdump-ada-spec
1752 For C and C++ source and include files, generate corresponding Ada specs.
1753 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1754 GNAT User's Guide}, which provides detailed documentation on this feature.
1756 @item -fada-spec-parent=@var{unit}
1757 @opindex fada-spec-parent
1758 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1759 Ada specs as child units of parent @var{unit}.
1761 @item -fdump-go-spec=@var{file}
1762 @opindex fdump-go-spec
1763 For input files in any language, generate corresponding Go
1764 declarations in @var{file}. This generates Go @code{const},
1765 @code{type}, @code{var}, and @code{func} declarations which may be a
1766 useful way to start writing a Go interface to code written in some
1769 @include @value{srcdir}/../libiberty/at-file.texi
1773 @section Compiling C++ Programs
1775 @cindex suffixes for C++ source
1776 @cindex C++ source file suffixes
1777 C++ source files conventionally use one of the suffixes @samp{.C},
1778 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1779 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1780 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1781 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1782 files with these names and compiles them as C++ programs even if you
1783 call the compiler the same way as for compiling C programs (usually
1784 with the name @command{gcc}).
1788 However, the use of @command{gcc} does not add the C++ library.
1789 @command{g++} is a program that calls GCC and automatically specifies linking
1790 against the C++ library. It treats @samp{.c},
1791 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1792 files unless @option{-x} is used. This program is also useful when
1793 precompiling a C header file with a @samp{.h} extension for use in C++
1794 compilations. On many systems, @command{g++} is also installed with
1795 the name @command{c++}.
1797 @cindex invoking @command{g++}
1798 When you compile C++ programs, you may specify many of the same
1799 command-line options that you use for compiling programs in any
1800 language; or command-line options meaningful for C and related
1801 languages; or options that are meaningful only for C++ programs.
1802 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1803 explanations of options for languages related to C@.
1804 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1805 explanations of options that are meaningful only for C++ programs.
1807 @node C Dialect Options
1808 @section Options Controlling C Dialect
1809 @cindex dialect options
1810 @cindex language dialect options
1811 @cindex options, dialect
1813 The following options control the dialect of C (or languages derived
1814 from C, such as C++, Objective-C and Objective-C++) that the compiler
1818 @cindex ANSI support
1822 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1823 equivalent to @option{-std=c++98}.
1825 This turns off certain features of GCC that are incompatible with ISO
1826 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1827 such as the @code{asm} and @code{typeof} keywords, and
1828 predefined macros such as @code{unix} and @code{vax} that identify the
1829 type of system you are using. It also enables the undesirable and
1830 rarely used ISO trigraph feature. For the C compiler,
1831 it disables recognition of C++ style @samp{//} comments as well as
1832 the @code{inline} keyword.
1834 The alternate keywords @code{__asm__}, @code{__extension__},
1835 @code{__inline__} and @code{__typeof__} continue to work despite
1836 @option{-ansi}. You would not want to use them in an ISO C program, of
1837 course, but it is useful to put them in header files that might be included
1838 in compilations done with @option{-ansi}. Alternate predefined macros
1839 such as @code{__unix__} and @code{__vax__} are also available, with or
1840 without @option{-ansi}.
1842 The @option{-ansi} option does not cause non-ISO programs to be
1843 rejected gratuitously. For that, @option{-Wpedantic} is required in
1844 addition to @option{-ansi}. @xref{Warning Options}.
1846 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1847 option is used. Some header files may notice this macro and refrain
1848 from declaring certain functions or defining certain macros that the
1849 ISO standard doesn't call for; this is to avoid interfering with any
1850 programs that might use these names for other things.
1852 Functions that are normally built in but do not have semantics
1853 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1854 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1855 built-in functions provided by GCC}, for details of the functions
1860 Determine the language standard. @xref{Standards,,Language Standards
1861 Supported by GCC}, for details of these standard versions. This option
1862 is currently only supported when compiling C or C++.
1864 The compiler can accept several base standards, such as @samp{c90} or
1865 @samp{c++98}, and GNU dialects of those standards, such as
1866 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1867 compiler accepts all programs following that standard plus those
1868 using GNU extensions that do not contradict it. For example,
1869 @option{-std=c90} turns off certain features of GCC that are
1870 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1871 keywords, but not other GNU extensions that do not have a meaning in
1872 ISO C90, such as omitting the middle term of a @code{?:}
1873 expression. On the other hand, when a GNU dialect of a standard is
1874 specified, all features supported by the compiler are enabled, even when
1875 those features change the meaning of the base standard. As a result, some
1876 strict-conforming programs may be rejected. The particular standard
1877 is used by @option{-Wpedantic} to identify which features are GNU
1878 extensions given that version of the standard. For example
1879 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1880 comments, while @option{-std=gnu99 -Wpedantic} does not.
1882 A value for this option must be provided; possible values are
1888 Support all ISO C90 programs (certain GNU extensions that conflict
1889 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1891 @item iso9899:199409
1892 ISO C90 as modified in amendment 1.
1898 ISO C99. This standard is substantially completely supported, modulo
1899 bugs and floating-point issues
1900 (mainly but not entirely relating to optional C99 features from
1901 Annexes F and G). See
1902 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1903 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1908 ISO C11, the 2011 revision of the ISO C standard. This standard is
1909 substantially completely supported, modulo bugs, floating-point issues
1910 (mainly but not entirely relating to optional C11 features from
1911 Annexes F and G) and the optional Annexes K (Bounds-checking
1912 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1918 ISO C17, the 2017 revision of the ISO C standard (expected to be
1919 published in 2018). This standard is
1920 same as C11 except for corrections of defects (all of which are also
1921 applied with @option{-std=c11}) and a new value of
1922 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1926 GNU dialect of ISO C90 (including some C99 features).
1930 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1934 GNU dialect of ISO C11.
1935 The name @samp{gnu1x} is deprecated.
1939 GNU dialect of ISO C17. This is the default for C code.
1943 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1944 additional defect reports. Same as @option{-ansi} for C++ code.
1948 GNU dialect of @option{-std=c++98}.
1952 The 2011 ISO C++ standard plus amendments.
1953 The name @samp{c++0x} is deprecated.
1957 GNU dialect of @option{-std=c++11}.
1958 The name @samp{gnu++0x} is deprecated.
1962 The 2014 ISO C++ standard plus amendments.
1963 The name @samp{c++1y} is deprecated.
1967 GNU dialect of @option{-std=c++14}.
1968 This is the default for C++ code.
1969 The name @samp{gnu++1y} is deprecated.
1973 The 2017 ISO C++ standard plus amendments.
1974 The name @samp{c++1z} is deprecated.
1978 GNU dialect of @option{-std=c++17}.
1979 The name @samp{gnu++1z} is deprecated.
1982 The next revision of the ISO C++ standard, tentatively planned for
1983 2020. Support is highly experimental, and will almost certainly
1984 change in incompatible ways in future releases.
1987 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
1988 and will almost certainly change in incompatible ways in future
1992 @item -fgnu89-inline
1993 @opindex fgnu89-inline
1994 The option @option{-fgnu89-inline} tells GCC to use the traditional
1995 GNU semantics for @code{inline} functions when in C99 mode.
1996 @xref{Inline,,An Inline Function is As Fast As a Macro}.
1997 Using this option is roughly equivalent to adding the
1998 @code{gnu_inline} function attribute to all inline functions
1999 (@pxref{Function Attributes}).
2001 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2002 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2003 specifies the default behavior).
2004 This option is not supported in @option{-std=c90} or
2005 @option{-std=gnu90} mode.
2007 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2008 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2009 in effect for @code{inline} functions. @xref{Common Predefined
2010 Macros,,,cpp,The C Preprocessor}.
2012 @item -fpermitted-flt-eval-methods=@var{style}
2013 @opindex fpermitted-flt-eval-methods
2014 @opindex fpermitted-flt-eval-methods=c11
2015 @opindex fpermitted-flt-eval-methods=ts-18661-3
2016 ISO/IEC TS 18661-3 defines new permissible values for
2017 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2018 a semantic type that is an interchange or extended format should be
2019 evaluated to the precision and range of that type. These new values are
2020 a superset of those permitted under C99/C11, which does not specify the
2021 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2022 conforming to C11 may not have been written expecting the possibility of
2025 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2026 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2027 or the extended set of values specified in ISO/IEC TS 18661-3.
2029 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2031 The default when in a standards compliant mode (@option{-std=c11} or similar)
2032 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2033 dialect (@option{-std=gnu11} or similar) is
2034 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2036 @item -aux-info @var{filename}
2038 Output to the given filename prototyped declarations for all functions
2039 declared and/or defined in a translation unit, including those in header
2040 files. This option is silently ignored in any language other than C@.
2042 Besides declarations, the file indicates, in comments, the origin of
2043 each declaration (source file and line), whether the declaration was
2044 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2045 @samp{O} for old, respectively, in the first character after the line
2046 number and the colon), and whether it came from a declaration or a
2047 definition (@samp{C} or @samp{F}, respectively, in the following
2048 character). In the case of function definitions, a K&R-style list of
2049 arguments followed by their declarations is also provided, inside
2050 comments, after the declaration.
2052 @item -fallow-parameterless-variadic-functions
2053 @opindex fallow-parameterless-variadic-functions
2054 Accept variadic functions without named parameters.
2056 Although it is possible to define such a function, this is not very
2057 useful as it is not possible to read the arguments. This is only
2058 supported for C as this construct is allowed by C++.
2062 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2063 keyword, so that code can use these words as identifiers. You can use
2064 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2065 instead. @option{-ansi} implies @option{-fno-asm}.
2067 In C++, this switch only affects the @code{typeof} keyword, since
2068 @code{asm} and @code{inline} are standard keywords. You may want to
2069 use the @option{-fno-gnu-keywords} flag instead, which has the same
2070 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2071 switch only affects the @code{asm} and @code{typeof} keywords, since
2072 @code{inline} is a standard keyword in ISO C99.
2075 @itemx -fno-builtin-@var{function}
2076 @opindex fno-builtin
2077 @cindex built-in functions
2078 Don't recognize built-in functions that do not begin with
2079 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2080 functions provided by GCC}, for details of the functions affected,
2081 including those which are not built-in functions when @option{-ansi} or
2082 @option{-std} options for strict ISO C conformance are used because they
2083 do not have an ISO standard meaning.
2085 GCC normally generates special code to handle certain built-in functions
2086 more efficiently; for instance, calls to @code{alloca} may become single
2087 instructions which adjust the stack directly, and calls to @code{memcpy}
2088 may become inline copy loops. The resulting code is often both smaller
2089 and faster, but since the function calls no longer appear as such, you
2090 cannot set a breakpoint on those calls, nor can you change the behavior
2091 of the functions by linking with a different library. In addition,
2092 when a function is recognized as a built-in function, GCC may use
2093 information about that function to warn about problems with calls to
2094 that function, or to generate more efficient code, even if the
2095 resulting code still contains calls to that function. For example,
2096 warnings are given with @option{-Wformat} for bad calls to
2097 @code{printf} when @code{printf} is built in and @code{strlen} is
2098 known not to modify global memory.
2100 With the @option{-fno-builtin-@var{function}} option
2101 only the built-in function @var{function} is
2102 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2103 function is named that is not built-in in this version of GCC, this
2104 option is ignored. There is no corresponding
2105 @option{-fbuiltin-@var{function}} option; if you wish to enable
2106 built-in functions selectively when using @option{-fno-builtin} or
2107 @option{-ffreestanding}, you may define macros such as:
2110 #define abs(n) __builtin_abs ((n))
2111 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2117 Enable parsing of function definitions marked with @code{__GIMPLE}.
2118 This is an experimental feature that allows unit testing of GIMPLE
2123 @cindex hosted environment
2125 Assert that compilation targets a hosted environment. This implies
2126 @option{-fbuiltin}. A hosted environment is one in which the
2127 entire standard library is available, and in which @code{main} has a return
2128 type of @code{int}. Examples are nearly everything except a kernel.
2129 This is equivalent to @option{-fno-freestanding}.
2131 @item -ffreestanding
2132 @opindex ffreestanding
2133 @cindex hosted environment
2135 Assert that compilation targets a freestanding environment. This
2136 implies @option{-fno-builtin}. A freestanding environment
2137 is one in which the standard library may not exist, and program startup may
2138 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2139 This is equivalent to @option{-fno-hosted}.
2141 @xref{Standards,,Language Standards Supported by GCC}, for details of
2142 freestanding and hosted environments.
2146 @cindex OpenACC accelerator programming
2147 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2148 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2149 compiler generates accelerated code according to the OpenACC Application
2150 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2151 implies @option{-pthread}, and thus is only supported on targets that
2152 have support for @option{-pthread}.
2154 @item -fopenacc-dim=@var{geom}
2155 @opindex fopenacc-dim
2156 @cindex OpenACC accelerator programming
2157 Specify default compute dimensions for parallel offload regions that do
2158 not explicitly specify. The @var{geom} value is a triple of
2159 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2160 can be omitted, to use a target-specific default value.
2164 @cindex OpenMP parallel
2165 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2166 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2167 compiler generates parallel code according to the OpenMP Application
2168 Program Interface v4.5 @w{@uref{http://www.openmp.org/}}. This option
2169 implies @option{-pthread}, and thus is only supported on targets that
2170 have support for @option{-pthread}. @option{-fopenmp} implies
2171 @option{-fopenmp-simd}.
2174 @opindex fopenmp-simd
2177 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2178 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2183 When the option @option{-fgnu-tm} is specified, the compiler
2184 generates code for the Linux variant of Intel's current Transactional
2185 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2186 an experimental feature whose interface may change in future versions
2187 of GCC, as the official specification changes. Please note that not
2188 all architectures are supported for this feature.
2190 For more information on GCC's support for transactional memory,
2191 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2192 Transactional Memory Library}.
2194 Note that the transactional memory feature is not supported with
2195 non-call exceptions (@option{-fnon-call-exceptions}).
2197 @item -fms-extensions
2198 @opindex fms-extensions
2199 Accept some non-standard constructs used in Microsoft header files.
2201 In C++ code, this allows member names in structures to be similar
2202 to previous types declarations.
2211 Some cases of unnamed fields in structures and unions are only
2212 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2213 fields within structs/unions}, for details.
2215 Note that this option is off for all targets but x86
2216 targets using ms-abi.
2218 @item -fplan9-extensions
2219 @opindex fplan9-extensions
2220 Accept some non-standard constructs used in Plan 9 code.
2222 This enables @option{-fms-extensions}, permits passing pointers to
2223 structures with anonymous fields to functions that expect pointers to
2224 elements of the type of the field, and permits referring to anonymous
2225 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2226 struct/union fields within structs/unions}, for details. This is only
2227 supported for C, not C++.
2229 @item -fcond-mismatch
2230 @opindex fcond-mismatch
2231 Allow conditional expressions with mismatched types in the second and
2232 third arguments. The value of such an expression is void. This option
2233 is not supported for C++.
2235 @item -flax-vector-conversions
2236 @opindex flax-vector-conversions
2237 Allow implicit conversions between vectors with differing numbers of
2238 elements and/or incompatible element types. This option should not be
2241 @item -funsigned-char
2242 @opindex funsigned-char
2243 Let the type @code{char} be unsigned, like @code{unsigned char}.
2245 Each kind of machine has a default for what @code{char} should
2246 be. It is either like @code{unsigned char} by default or like
2247 @code{signed char} by default.
2249 Ideally, a portable program should always use @code{signed char} or
2250 @code{unsigned char} when it depends on the signedness of an object.
2251 But many programs have been written to use plain @code{char} and
2252 expect it to be signed, or expect it to be unsigned, depending on the
2253 machines they were written for. This option, and its inverse, let you
2254 make such a program work with the opposite default.
2256 The type @code{char} is always a distinct type from each of
2257 @code{signed char} or @code{unsigned char}, even though its behavior
2258 is always just like one of those two.
2261 @opindex fsigned-char
2262 Let the type @code{char} be signed, like @code{signed char}.
2264 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2265 the negative form of @option{-funsigned-char}. Likewise, the option
2266 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2268 @item -fsigned-bitfields
2269 @itemx -funsigned-bitfields
2270 @itemx -fno-signed-bitfields
2271 @itemx -fno-unsigned-bitfields
2272 @opindex fsigned-bitfields
2273 @opindex funsigned-bitfields
2274 @opindex fno-signed-bitfields
2275 @opindex fno-unsigned-bitfields
2276 These options control whether a bit-field is signed or unsigned, when the
2277 declaration does not use either @code{signed} or @code{unsigned}. By
2278 default, such a bit-field is signed, because this is consistent: the
2279 basic integer types such as @code{int} are signed types.
2281 @item -fsso-struct=@var{endianness}
2282 @opindex fsso-struct
2283 Set the default scalar storage order of structures and unions to the
2284 specified endianness. The accepted values are @samp{big-endian},
2285 @samp{little-endian} and @samp{native} for the native endianness of
2286 the target (the default). This option is not supported for C++.
2288 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2289 code that is not binary compatible with code generated without it if the
2290 specified endianness is not the native endianness of the target.
2293 @node C++ Dialect Options
2294 @section Options Controlling C++ Dialect
2296 @cindex compiler options, C++
2297 @cindex C++ options, command-line
2298 @cindex options, C++
2299 This section describes the command-line options that are only meaningful
2300 for C++ programs. You can also use most of the GNU compiler options
2301 regardless of what language your program is in. For example, you
2302 might compile a file @file{firstClass.C} like this:
2305 g++ -g -fstrict-enums -O -c firstClass.C
2309 In this example, only @option{-fstrict-enums} is an option meant
2310 only for C++ programs; you can use the other options with any
2311 language supported by GCC@.
2313 Some options for compiling C programs, such as @option{-std}, are also
2314 relevant for C++ programs.
2315 @xref{C Dialect Options,,Options Controlling C Dialect}.
2317 Here is a list of options that are @emph{only} for compiling C++ programs:
2321 @item -fabi-version=@var{n}
2322 @opindex fabi-version
2323 Use version @var{n} of the C++ ABI@. The default is version 0.
2325 Version 0 refers to the version conforming most closely to
2326 the C++ ABI specification. Therefore, the ABI obtained using version 0
2327 will change in different versions of G++ as ABI bugs are fixed.
2329 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2331 Version 2 is the version of the C++ ABI that first appeared in G++
2332 3.4, and was the default through G++ 4.9.
2334 Version 3 corrects an error in mangling a constant address as a
2337 Version 4, which first appeared in G++ 4.5, implements a standard
2338 mangling for vector types.
2340 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2341 attribute const/volatile on function pointer types, decltype of a
2342 plain decl, and use of a function parameter in the declaration of
2345 Version 6, which first appeared in G++ 4.7, corrects the promotion
2346 behavior of C++11 scoped enums and the mangling of template argument
2347 packs, const/static_cast, prefix ++ and --, and a class scope function
2348 used as a template argument.
2350 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2351 builtin type and corrects the mangling of lambdas in default argument
2354 Version 8, which first appeared in G++ 4.9, corrects the substitution
2355 behavior of function types with function-cv-qualifiers.
2357 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2360 Version 10, which first appeared in G++ 6.1, adds mangling of
2361 attributes that affect type identity, such as ia32 calling convention
2362 attributes (e.g. @samp{stdcall}).
2364 Version 11, which first appeared in G++ 7, corrects the mangling of
2365 sizeof... expressions and operator names. For multiple entities with
2366 the same name within a function, that are declared in different scopes,
2367 the mangling now changes starting with the twelfth occurrence. It also
2368 implies @option{-fnew-inheriting-ctors}.
2370 Version 12, which first appeared in G++ 8, corrects the calling
2371 conventions for empty classes on the x86_64 target and for classes
2372 with only deleted copy/move constructors. It accidentally changes the
2373 calling convention for classes with a deleted copy constructor and a
2374 trivial move constructor.
2376 Version 13, which first appeared in G++ 8.2, fixes the accidental
2377 change in version 12.
2379 See also @option{-Wabi}.
2381 @item -fabi-compat-version=@var{n}
2382 @opindex fabi-compat-version
2383 On targets that support strong aliases, G++
2384 works around mangling changes by creating an alias with the correct
2385 mangled name when defining a symbol with an incorrect mangled name.
2386 This switch specifies which ABI version to use for the alias.
2388 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2389 compatibility). If another ABI version is explicitly selected, this
2390 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2391 use @option{-fabi-compat-version=2}.
2393 If this option is not provided but @option{-Wabi=@var{n}} is, that
2394 version is used for compatibility aliases. If this option is provided
2395 along with @option{-Wabi} (without the version), the version from this
2396 option is used for the warning.
2398 @item -fno-access-control
2399 @opindex fno-access-control
2400 Turn off all access checking. This switch is mainly useful for working
2401 around bugs in the access control code.
2404 @opindex faligned-new
2405 Enable support for C++17 @code{new} of types that require more
2406 alignment than @code{void* ::operator new(std::size_t)} provides. A
2407 numeric argument such as @code{-faligned-new=32} can be used to
2408 specify how much alignment (in bytes) is provided by that function,
2409 but few users will need to override the default of
2410 @code{alignof(std::max_align_t)}.
2412 This flag is enabled by default for @option{-std=c++17}.
2416 Check that the pointer returned by @code{operator new} is non-null
2417 before attempting to modify the storage allocated. This check is
2418 normally unnecessary because the C++ standard specifies that
2419 @code{operator new} only returns @code{0} if it is declared
2420 @code{throw()}, in which case the compiler always checks the
2421 return value even without this option. In all other cases, when
2422 @code{operator new} has a non-empty exception specification, memory
2423 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2424 @samp{new (nothrow)}.
2428 Enable support for the C++ Extensions for Concepts Technical
2429 Specification, ISO 19217 (2015), which allows code like
2432 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2433 template <Addable T> T add (T a, T b) @{ return a + b; @}
2436 @item -fconstexpr-depth=@var{n}
2437 @opindex fconstexpr-depth
2438 Set the maximum nested evaluation depth for C++11 constexpr functions
2439 to @var{n}. A limit is needed to detect endless recursion during
2440 constant expression evaluation. The minimum specified by the standard
2443 @item -fconstexpr-loop-limit=@var{n}
2444 @opindex fconstexpr-loop-limit
2445 Set the maximum number of iterations for a loop in C++14 constexpr functions
2446 to @var{n}. A limit is needed to detect infinite loops during
2447 constant expression evaluation. The default is 262144 (1<<18).
2449 @item -fdeduce-init-list
2450 @opindex fdeduce-init-list
2451 Enable deduction of a template type parameter as
2452 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2455 template <class T> auto forward(T t) -> decltype (realfn (t))
2462 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2466 This deduction was implemented as a possible extension to the
2467 originally proposed semantics for the C++11 standard, but was not part
2468 of the final standard, so it is disabled by default. This option is
2469 deprecated, and may be removed in a future version of G++.
2471 @item -fno-elide-constructors
2472 @opindex fno-elide-constructors
2473 The C++ standard allows an implementation to omit creating a temporary
2474 that is only used to initialize another object of the same type.
2475 Specifying this option disables that optimization, and forces G++ to
2476 call the copy constructor in all cases. This option also causes G++
2477 to call trivial member functions which otherwise would be expanded inline.
2479 In C++17, the compiler is required to omit these temporaries, but this
2480 option still affects trivial member functions.
2482 @item -fno-enforce-eh-specs
2483 @opindex fno-enforce-eh-specs
2484 Don't generate code to check for violation of exception specifications
2485 at run time. This option violates the C++ standard, but may be useful
2486 for reducing code size in production builds, much like defining
2487 @code{NDEBUG}. This does not give user code permission to throw
2488 exceptions in violation of the exception specifications; the compiler
2489 still optimizes based on the specifications, so throwing an
2490 unexpected exception results in undefined behavior at run time.
2492 @item -fextern-tls-init
2493 @itemx -fno-extern-tls-init
2494 @opindex fextern-tls-init
2495 @opindex fno-extern-tls-init
2496 The C++11 and OpenMP standards allow @code{thread_local} and
2497 @code{threadprivate} variables to have dynamic (runtime)
2498 initialization. To support this, any use of such a variable goes
2499 through a wrapper function that performs any necessary initialization.
2500 When the use and definition of the variable are in the same
2501 translation unit, this overhead can be optimized away, but when the
2502 use is in a different translation unit there is significant overhead
2503 even if the variable doesn't actually need dynamic initialization. If
2504 the programmer can be sure that no use of the variable in a
2505 non-defining TU needs to trigger dynamic initialization (either
2506 because the variable is statically initialized, or a use of the
2507 variable in the defining TU will be executed before any uses in
2508 another TU), they can avoid this overhead with the
2509 @option{-fno-extern-tls-init} option.
2511 On targets that support symbol aliases, the default is
2512 @option{-fextern-tls-init}. On targets that do not support symbol
2513 aliases, the default is @option{-fno-extern-tls-init}.
2515 @item -fno-gnu-keywords
2516 @opindex fno-gnu-keywords
2517 Do not recognize @code{typeof} as a keyword, so that code can use this
2518 word as an identifier. You can use the keyword @code{__typeof__} instead.
2519 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2520 @option{-std=c++98}, @option{-std=c++11}, etc.
2522 @item -fno-implicit-templates
2523 @opindex fno-implicit-templates
2524 Never emit code for non-inline templates that are instantiated
2525 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2526 @xref{Template Instantiation}, for more information.
2528 @item -fno-implicit-inline-templates
2529 @opindex fno-implicit-inline-templates
2530 Don't emit code for implicit instantiations of inline templates, either.
2531 The default is to handle inlines differently so that compiles with and
2532 without optimization need the same set of explicit instantiations.
2534 @item -fno-implement-inlines
2535 @opindex fno-implement-inlines
2536 To save space, do not emit out-of-line copies of inline functions
2537 controlled by @code{#pragma implementation}. This causes linker
2538 errors if these functions are not inlined everywhere they are called.
2540 @item -fms-extensions
2541 @opindex fms-extensions
2542 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2543 int and getting a pointer to member function via non-standard syntax.
2545 @item -fnew-inheriting-ctors
2546 @opindex fnew-inheriting-ctors
2547 Enable the P0136 adjustment to the semantics of C++11 constructor
2548 inheritance. This is part of C++17 but also considered to be a Defect
2549 Report against C++11 and C++14. This flag is enabled by default
2550 unless @option{-fabi-version=10} or lower is specified.
2552 @item -fnew-ttp-matching
2553 @opindex fnew-ttp-matching
2554 Enable the P0522 resolution to Core issue 150, template template
2555 parameters and default arguments: this allows a template with default
2556 template arguments as an argument for a template template parameter
2557 with fewer template parameters. This flag is enabled by default for
2558 @option{-std=c++17}.
2560 @item -fno-nonansi-builtins
2561 @opindex fno-nonansi-builtins
2562 Disable built-in declarations of functions that are not mandated by
2563 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2564 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2567 @opindex fnothrow-opt
2568 Treat a @code{throw()} exception specification as if it were a
2569 @code{noexcept} specification to reduce or eliminate the text size
2570 overhead relative to a function with no exception specification. If
2571 the function has local variables of types with non-trivial
2572 destructors, the exception specification actually makes the
2573 function smaller because the EH cleanups for those variables can be
2574 optimized away. The semantic effect is that an exception thrown out of
2575 a function with such an exception specification results in a call
2576 to @code{terminate} rather than @code{unexpected}.
2578 @item -fno-operator-names
2579 @opindex fno-operator-names
2580 Do not treat the operator name keywords @code{and}, @code{bitand},
2581 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2582 synonyms as keywords.
2584 @item -fno-optional-diags
2585 @opindex fno-optional-diags
2586 Disable diagnostics that the standard says a compiler does not need to
2587 issue. Currently, the only such diagnostic issued by G++ is the one for
2588 a name having multiple meanings within a class.
2591 @opindex fpermissive
2592 Downgrade some diagnostics about nonconformant code from errors to
2593 warnings. Thus, using @option{-fpermissive} allows some
2594 nonconforming code to compile.
2596 @item -fno-pretty-templates
2597 @opindex fno-pretty-templates
2598 When an error message refers to a specialization of a function
2599 template, the compiler normally prints the signature of the
2600 template followed by the template arguments and any typedefs or
2601 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2602 rather than @code{void f(int)}) so that it's clear which template is
2603 involved. When an error message refers to a specialization of a class
2604 template, the compiler omits any template arguments that match
2605 the default template arguments for that template. If either of these
2606 behaviors make it harder to understand the error message rather than
2607 easier, you can use @option{-fno-pretty-templates} to disable them.
2611 Enable automatic template instantiation at link time. This option also
2612 implies @option{-fno-implicit-templates}. @xref{Template
2613 Instantiation}, for more information.
2617 Disable generation of information about every class with virtual
2618 functions for use by the C++ run-time type identification features
2619 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2620 of the language, you can save some space by using this flag. Note that
2621 exception handling uses the same information, but G++ generates it as
2622 needed. The @code{dynamic_cast} operator can still be used for casts that
2623 do not require run-time type information, i.e.@: casts to @code{void *} or to
2624 unambiguous base classes.
2626 @item -fsized-deallocation
2627 @opindex fsized-deallocation
2628 Enable the built-in global declarations
2630 void operator delete (void *, std::size_t) noexcept;
2631 void operator delete[] (void *, std::size_t) noexcept;
2633 as introduced in C++14. This is useful for user-defined replacement
2634 deallocation functions that, for example, use the size of the object
2635 to make deallocation faster. Enabled by default under
2636 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2637 warns about places that might want to add a definition.
2639 @item -fstrict-enums
2640 @opindex fstrict-enums
2641 Allow the compiler to optimize using the assumption that a value of
2642 enumerated type can only be one of the values of the enumeration (as
2643 defined in the C++ standard; basically, a value that can be
2644 represented in the minimum number of bits needed to represent all the
2645 enumerators). This assumption may not be valid if the program uses a
2646 cast to convert an arbitrary integer value to the enumerated type.
2648 @item -fstrong-eval-order
2649 @opindex fstrong-eval-order
2650 Evaluate member access, array subscripting, and shift expressions in
2651 left-to-right order, and evaluate assignment in right-to-left order,
2652 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2653 @option{-fstrong-eval-order=some} enables just the ordering of member
2654 access and shift expressions, and is the default without
2655 @option{-std=c++17}.
2657 @item -ftemplate-backtrace-limit=@var{n}
2658 @opindex ftemplate-backtrace-limit
2659 Set the maximum number of template instantiation notes for a single
2660 warning or error to @var{n}. The default value is 10.
2662 @item -ftemplate-depth=@var{n}
2663 @opindex ftemplate-depth
2664 Set the maximum instantiation depth for template classes to @var{n}.
2665 A limit on the template instantiation depth is needed to detect
2666 endless recursions during template class instantiation. ANSI/ISO C++
2667 conforming programs must not rely on a maximum depth greater than 17
2668 (changed to 1024 in C++11). The default value is 900, as the compiler
2669 can run out of stack space before hitting 1024 in some situations.
2671 @item -fno-threadsafe-statics
2672 @opindex fno-threadsafe-statics
2673 Do not emit the extra code to use the routines specified in the C++
2674 ABI for thread-safe initialization of local statics. You can use this
2675 option to reduce code size slightly in code that doesn't need to be
2678 @item -fuse-cxa-atexit
2679 @opindex fuse-cxa-atexit
2680 Register destructors for objects with static storage duration with the
2681 @code{__cxa_atexit} function rather than the @code{atexit} function.
2682 This option is required for fully standards-compliant handling of static
2683 destructors, but only works if your C library supports
2684 @code{__cxa_atexit}.
2686 @item -fno-use-cxa-get-exception-ptr
2687 @opindex fno-use-cxa-get-exception-ptr
2688 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2689 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2690 if the runtime routine is not available.
2692 @item -fvisibility-inlines-hidden
2693 @opindex fvisibility-inlines-hidden
2694 This switch declares that the user does not attempt to compare
2695 pointers to inline functions or methods where the addresses of the two functions
2696 are taken in different shared objects.
2698 The effect of this is that GCC may, effectively, mark inline methods with
2699 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2700 appear in the export table of a DSO and do not require a PLT indirection
2701 when used within the DSO@. Enabling this option can have a dramatic effect
2702 on load and link times of a DSO as it massively reduces the size of the
2703 dynamic export table when the library makes heavy use of templates.
2705 The behavior of this switch is not quite the same as marking the
2706 methods as hidden directly, because it does not affect static variables
2707 local to the function or cause the compiler to deduce that
2708 the function is defined in only one shared object.
2710 You may mark a method as having a visibility explicitly to negate the
2711 effect of the switch for that method. For example, if you do want to
2712 compare pointers to a particular inline method, you might mark it as
2713 having default visibility. Marking the enclosing class with explicit
2714 visibility has no effect.
2716 Explicitly instantiated inline methods are unaffected by this option
2717 as their linkage might otherwise cross a shared library boundary.
2718 @xref{Template Instantiation}.
2720 @item -fvisibility-ms-compat
2721 @opindex fvisibility-ms-compat
2722 This flag attempts to use visibility settings to make GCC's C++
2723 linkage model compatible with that of Microsoft Visual Studio.
2725 The flag makes these changes to GCC's linkage model:
2729 It sets the default visibility to @code{hidden}, like
2730 @option{-fvisibility=hidden}.
2733 Types, but not their members, are not hidden by default.
2736 The One Definition Rule is relaxed for types without explicit
2737 visibility specifications that are defined in more than one
2738 shared object: those declarations are permitted if they are
2739 permitted when this option is not used.
2742 In new code it is better to use @option{-fvisibility=hidden} and
2743 export those classes that are intended to be externally visible.
2744 Unfortunately it is possible for code to rely, perhaps accidentally,
2745 on the Visual Studio behavior.
2747 Among the consequences of these changes are that static data members
2748 of the same type with the same name but defined in different shared
2749 objects are different, so changing one does not change the other;
2750 and that pointers to function members defined in different shared
2751 objects may not compare equal. When this flag is given, it is a
2752 violation of the ODR to define types with the same name differently.
2756 Do not use weak symbol support, even if it is provided by the linker.
2757 By default, G++ uses weak symbols if they are available. This
2758 option exists only for testing, and should not be used by end-users;
2759 it results in inferior code and has no benefits. This option may
2760 be removed in a future release of G++.
2764 Do not search for header files in the standard directories specific to
2765 C++, but do still search the other standard directories. (This option
2766 is used when building the C++ library.)
2769 In addition, these optimization, warning, and code generation options
2770 have meanings only for C++ programs:
2773 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2776 Warn when G++ it generates code that is probably not compatible with
2777 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2778 ABI with each major release, normally @option{-Wabi} will warn only if
2779 there is a check added later in a release series for an ABI issue
2780 discovered since the initial release. @option{-Wabi} will warn about
2781 more things if an older ABI version is selected (with
2782 @option{-fabi-version=@var{n}}).
2784 @option{-Wabi} can also be used with an explicit version number to
2785 warn about compatibility with a particular @option{-fabi-version}
2786 level, e.g. @option{-Wabi=2} to warn about changes relative to
2787 @option{-fabi-version=2}.
2789 If an explicit version number is provided and
2790 @option{-fabi-compat-version} is not specified, the version number
2791 from this option is used for compatibility aliases. If no explicit
2792 version number is provided with this option, but
2793 @option{-fabi-compat-version} is specified, that version number is
2794 used for ABI warnings.
2796 Although an effort has been made to warn about
2797 all such cases, there are probably some cases that are not warned about,
2798 even though G++ is generating incompatible code. There may also be
2799 cases where warnings are emitted even though the code that is generated
2802 You should rewrite your code to avoid these warnings if you are
2803 concerned about the fact that code generated by G++ may not be binary
2804 compatible with code generated by other compilers.
2806 Known incompatibilities in @option{-fabi-version=2} (which was the
2807 default from GCC 3.4 to 4.9) include:
2812 A template with a non-type template parameter of reference type was
2813 mangled incorrectly:
2816 template <int &> struct S @{@};
2820 This was fixed in @option{-fabi-version=3}.
2823 SIMD vector types declared using @code{__attribute ((vector_size))} were
2824 mangled in a non-standard way that does not allow for overloading of
2825 functions taking vectors of different sizes.
2827 The mangling was changed in @option{-fabi-version=4}.
2830 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2831 qualifiers, and @code{decltype} of a plain declaration was folded away.
2833 These mangling issues were fixed in @option{-fabi-version=5}.
2836 Scoped enumerators passed as arguments to a variadic function are
2837 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2838 On most targets this does not actually affect the parameter passing
2839 ABI, as there is no way to pass an argument smaller than @code{int}.
2841 Also, the ABI changed the mangling of template argument packs,
2842 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2843 a class scope function used as a template argument.
2845 These issues were corrected in @option{-fabi-version=6}.
2848 Lambdas in default argument scope were mangled incorrectly, and the
2849 ABI changed the mangling of @code{nullptr_t}.
2851 These issues were corrected in @option{-fabi-version=7}.
2854 When mangling a function type with function-cv-qualifiers, the
2855 un-qualified function type was incorrectly treated as a substitution
2858 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2861 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2862 unaligned accesses. Note that this did not affect the ABI of a
2863 function with a @code{nullptr_t} parameter, as parameters have a
2866 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2869 Target-specific attributes that affect the identity of a type, such as
2870 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2871 did not affect the mangled name, leading to name collisions when
2872 function pointers were used as template arguments.
2874 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2878 It also warns about psABI-related changes. The known psABI changes at this
2884 For SysV/x86-64, unions with @code{long double} members are
2885 passed in memory as specified in psABI. For example:
2895 @code{union U} is always passed in memory.
2899 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2902 Warn when a type with an ABI tag is used in a context that does not
2903 have that ABI tag. See @ref{C++ Attributes} for more information
2906 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2907 @opindex Wctor-dtor-privacy
2908 @opindex Wno-ctor-dtor-privacy
2909 Warn when a class seems unusable because all the constructors or
2910 destructors in that class are private, and it has neither friends nor
2911 public static member functions. Also warn if there are no non-private
2912 methods, and there's at least one private member function that isn't
2913 a constructor or destructor.
2915 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2916 @opindex Wdelete-non-virtual-dtor
2917 @opindex Wno-delete-non-virtual-dtor
2918 Warn when @code{delete} is used to destroy an instance of a class that
2919 has virtual functions and non-virtual destructor. It is unsafe to delete
2920 an instance of a derived class through a pointer to a base class if the
2921 base class does not have a virtual destructor. This warning is enabled
2924 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
2925 @opindex Wdeprecated-copy
2926 @opindex Wno-deprecated-copy
2927 Warn that the implicit declaration of a copy constructor or copy
2928 assignment operator is deprecated if the class has a user-provided
2929 copy constructor, copy assignment operator, or destructor, in C++11
2930 and up. This warning is enabled by @option{-Wall}.
2932 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
2933 @opindex Winit-list-lifetime
2934 @opindex Wno-init-list-lifetime
2935 Do not warn about uses of @code{std::initializer_list} that are likely
2936 to result in dangling pointers. Since the underlying array for an
2937 @code{initializer_list} is handled like a normal C++ temporary object,
2938 it is easy to inadvertently keep a pointer to the array past the end
2939 of the array's lifetime. For example:
2943 If a function returns a temporary @code{initializer_list}, or a local
2944 @code{initializer_list} variable, the array's lifetime ends at the end
2945 of the return statement, so the value returned has a dangling pointer.
2948 If a new-expression creates an @code{initializer_list}, the array only
2949 lives until the end of the enclosing full-expression, so the
2950 @code{initializer_list} in the heap has a dangling pointer.
2953 When an @code{initializer_list} variable is assigned from a
2954 brace-enclosed initializer list, the temporary array created for the
2955 right side of the assignment only lives until the end of the
2956 full-expression, so at the next statement the @code{initializer_list}
2957 variable has a dangling pointer.
2960 // li's initial underlying array lives as long as li
2961 std::initializer_list<int> li = @{ 1,2,3 @};
2962 // assignment changes li to point to a temporary array
2964 // now the temporary is gone and li has a dangling pointer
2965 int i = li.begin()[0] // undefined behavior
2969 When a list constructor stores the @code{begin} pointer from the
2970 @code{initializer_list} argument, this doesn't extend the lifetime of
2971 the array, so if a class variable is constructed from a temporary
2972 @code{initializer_list}, the pointer is left dangling by the end of
2973 the variable declaration statement.
2977 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2978 @opindex Wliteral-suffix
2979 @opindex Wno-literal-suffix
2980 Warn when a string or character literal is followed by a ud-suffix which does
2981 not begin with an underscore. As a conforming extension, GCC treats such
2982 suffixes as separate preprocessing tokens in order to maintain backwards
2983 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2987 #define __STDC_FORMAT_MACROS
2988 #include <inttypes.h>
2993 printf("My int64: %" PRId64"\n", i64);
2997 In this case, @code{PRId64} is treated as a separate preprocessing token.
2999 Additionally, warn when a user-defined literal operator is declared with
3000 a literal suffix identifier that doesn't begin with an underscore. Literal
3001 suffix identifiers that don't begin with an underscore are reserved for
3002 future standardization.
3004 This warning is enabled by default.
3006 @item -Wlto-type-mismatch
3007 @opindex Wlto-type-mismatch
3008 @opindex Wno-lto-type-mismatch
3010 During the link-time optimization warn about type mismatches in
3011 global declarations from different compilation units.
3012 Requires @option{-flto} to be enabled. Enabled by default.
3014 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3016 @opindex Wno-narrowing
3017 For C++11 and later standards, narrowing conversions are diagnosed by default,
3018 as required by the standard. A narrowing conversion from a constant produces
3019 an error, and a narrowing conversion from a non-constant produces a warning,
3020 but @option{-Wno-narrowing} suppresses the diagnostic.
3021 Note that this does not affect the meaning of well-formed code;
3022 narrowing conversions are still considered ill-formed in SFINAE contexts.
3024 With @option{-Wnarrowing} in C++98, warn when a narrowing
3025 conversion prohibited by C++11 occurs within
3029 int i = @{ 2.2 @}; // error: narrowing from double to int
3032 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3034 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3036 @opindex Wno-noexcept
3037 Warn when a noexcept-expression evaluates to false because of a call
3038 to a function that does not have a non-throwing exception
3039 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3040 the compiler to never throw an exception.
3042 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3043 @opindex Wnoexcept-type
3044 @opindex Wno-noexcept-type
3045 Warn if the C++17 feature making @code{noexcept} part of a function
3046 type changes the mangled name of a symbol relative to C++14. Enabled
3047 by @option{-Wabi} and @option{-Wc++17-compat}.
3052 template <class T> void f(T t) @{ t(); @};
3054 void h() @{ f(g); @}
3058 In C++14, @code{f} calls calls @code{f<void(*)()>}, but in
3059 C++17 it calls @code{f<void(*)()noexcept>}.
3061 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3062 @opindex Wclass-memaccess
3063 @opindex Wno-class-memaccess
3064 Warn when the destination of a call to a raw memory function such as
3065 @code{memset} or @code{memcpy} is an object of class type, and when writing
3066 into such an object might bypass the class non-trivial or deleted constructor
3067 or copy assignment, violate const-correctness or encapsulation, or corrupt
3068 virtual table pointers. Modifying the representation of such objects may
3069 violate invariants maintained by member functions of the class. For example,
3070 the call to @code{memset} below is undefined because it modifies a non-trivial
3071 class object and is, therefore, diagnosed. The safe way to either initialize
3072 or clear the storage of objects of such types is by using the appropriate
3073 constructor or assignment operator, if one is available.
3075 std::string str = "abc";
3076 memset (&str, 0, sizeof str);
3078 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3079 Explicitly casting the pointer to the class object to @code{void *} or
3080 to a type that can be safely accessed by the raw memory function suppresses
3083 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3084 @opindex Wnon-virtual-dtor
3085 @opindex Wno-non-virtual-dtor
3086 Warn when a class has virtual functions and an accessible non-virtual
3087 destructor itself or in an accessible polymorphic base class, in which
3088 case it is possible but unsafe to delete an instance of a derived
3089 class through a pointer to the class itself or base class. This
3090 warning is automatically enabled if @option{-Weffc++} is specified.
3092 @item -Wregister @r{(C++ and Objective-C++ only)}
3094 @opindex Wno-register
3095 Warn on uses of the @code{register} storage class specifier, except
3096 when it is part of the GNU @ref{Explicit Register Variables} extension.
3097 The use of the @code{register} keyword as storage class specifier has
3098 been deprecated in C++11 and removed in C++17.
3099 Enabled by default with @option{-std=c++17}.
3101 @item -Wreorder @r{(C++ and Objective-C++ only)}
3103 @opindex Wno-reorder
3104 @cindex reordering, warning
3105 @cindex warning for reordering of member initializers
3106 Warn when the order of member initializers given in the code does not
3107 match the order in which they must be executed. For instance:
3113 A(): j (0), i (1) @{ @}
3118 The compiler rearranges the member initializers for @code{i}
3119 and @code{j} to match the declaration order of the members, emitting
3120 a warning to that effect. This warning is enabled by @option{-Wall}.
3122 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3123 @opindex fext-numeric-literals
3124 @opindex fno-ext-numeric-literals
3125 Accept imaginary, fixed-point, or machine-defined
3126 literal number suffixes as GNU extensions.
3127 When this option is turned off these suffixes are treated
3128 as C++11 user-defined literal numeric suffixes.
3129 This is on by default for all pre-C++11 dialects and all GNU dialects:
3130 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3131 @option{-std=gnu++14}.
3132 This option is off by default
3133 for ISO C++11 onwards (@option{-std=c++11}, ...).
3136 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3139 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3142 Warn about violations of the following style guidelines from Scott Meyers'
3143 @cite{Effective C++} series of books:
3147 Define a copy constructor and an assignment operator for classes
3148 with dynamically-allocated memory.
3151 Prefer initialization to assignment in constructors.
3154 Have @code{operator=} return a reference to @code{*this}.
3157 Don't try to return a reference when you must return an object.
3160 Distinguish between prefix and postfix forms of increment and
3161 decrement operators.
3164 Never overload @code{&&}, @code{||}, or @code{,}.
3168 This option also enables @option{-Wnon-virtual-dtor}, which is also
3169 one of the effective C++ recommendations. However, the check is
3170 extended to warn about the lack of virtual destructor in accessible
3171 non-polymorphic bases classes too.
3173 When selecting this option, be aware that the standard library
3174 headers do not obey all of these guidelines; use @samp{grep -v}
3175 to filter out those warnings.
3177 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3178 @opindex Wstrict-null-sentinel
3179 @opindex Wno-strict-null-sentinel
3180 Warn about the use of an uncasted @code{NULL} as sentinel. When
3181 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3182 to @code{__null}. Although it is a null pointer constant rather than a
3183 null pointer, it is guaranteed to be of the same size as a pointer.
3184 But this use is not portable across different compilers.
3186 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3187 @opindex Wno-non-template-friend
3188 @opindex Wnon-template-friend
3189 Disable warnings when non-template friend functions are declared
3190 within a template. In very old versions of GCC that predate implementation
3191 of the ISO standard, declarations such as
3192 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3193 could be interpreted as a particular specialization of a template
3194 function; the warning exists to diagnose compatibility problems,
3195 and is enabled by default.
3197 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3198 @opindex Wold-style-cast
3199 @opindex Wno-old-style-cast
3200 Warn if an old-style (C-style) cast to a non-void type is used within
3201 a C++ program. The new-style casts (@code{dynamic_cast},
3202 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3203 less vulnerable to unintended effects and much easier to search for.
3205 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3206 @opindex Woverloaded-virtual
3207 @opindex Wno-overloaded-virtual
3208 @cindex overloaded virtual function, warning
3209 @cindex warning for overloaded virtual function
3210 Warn when a function declaration hides virtual functions from a
3211 base class. For example, in:
3218 struct B: public A @{
3223 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3234 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3235 @opindex Wno-pmf-conversions
3236 @opindex Wpmf-conversions
3237 Disable the diagnostic for converting a bound pointer to member function
3240 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3241 @opindex Wsign-promo
3242 @opindex Wno-sign-promo
3243 Warn when overload resolution chooses a promotion from unsigned or
3244 enumerated type to a signed type, over a conversion to an unsigned type of
3245 the same size. Previous versions of G++ tried to preserve
3246 unsignedness, but the standard mandates the current behavior.
3248 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3250 @opindex Wno-templates
3251 Warn when a primary template declaration is encountered. Some coding
3252 rules disallow templates, and this may be used to enforce that rule.
3253 The warning is inactive inside a system header file, such as the STL, so
3254 one can still use the STL. One may also instantiate or specialize
3257 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3258 @opindex Wmultiple-inheritance
3259 @opindex Wno-multiple-inheritance
3260 Warn when a class is defined with multiple direct base classes. Some
3261 coding rules disallow multiple inheritance, and this may be used to
3262 enforce that rule. The warning is inactive inside a system header file,
3263 such as the STL, so one can still use the STL. One may also define
3264 classes that indirectly use multiple inheritance.
3266 @item -Wvirtual-inheritance
3267 @opindex Wvirtual-inheritance
3268 @opindex Wno-virtual-inheritance
3269 Warn when a class is defined with a virtual direct base class. Some
3270 coding rules disallow multiple inheritance, and this may be used to
3271 enforce that rule. The warning is inactive inside a system header file,
3272 such as the STL, so one can still use the STL. One may also define
3273 classes that indirectly use virtual inheritance.
3276 @opindex Wnamespaces
3277 @opindex Wno-namespaces
3278 Warn when a namespace definition is opened. Some coding rules disallow
3279 namespaces, and this may be used to enforce that rule. The warning is
3280 inactive inside a system header file, such as the STL, so one can still
3281 use the STL. One may also use using directives and qualified names.
3283 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3285 @opindex Wno-terminate
3286 Disable the warning about a throw-expression that will immediately
3287 result in a call to @code{terminate}.
3290 @node Objective-C and Objective-C++ Dialect Options
3291 @section Options Controlling Objective-C and Objective-C++ Dialects
3293 @cindex compiler options, Objective-C and Objective-C++
3294 @cindex Objective-C and Objective-C++ options, command-line
3295 @cindex options, Objective-C and Objective-C++
3296 (NOTE: This manual does not describe the Objective-C and Objective-C++
3297 languages themselves. @xref{Standards,,Language Standards
3298 Supported by GCC}, for references.)
3300 This section describes the command-line options that are only meaningful
3301 for Objective-C and Objective-C++ programs. You can also use most of
3302 the language-independent GNU compiler options.
3303 For example, you might compile a file @file{some_class.m} like this:
3306 gcc -g -fgnu-runtime -O -c some_class.m
3310 In this example, @option{-fgnu-runtime} is an option meant only for
3311 Objective-C and Objective-C++ programs; you can use the other options with
3312 any language supported by GCC@.
3314 Note that since Objective-C is an extension of the C language, Objective-C
3315 compilations may also use options specific to the C front-end (e.g.,
3316 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3317 C++-specific options (e.g., @option{-Wabi}).
3319 Here is a list of options that are @emph{only} for compiling Objective-C
3320 and Objective-C++ programs:
3323 @item -fconstant-string-class=@var{class-name}
3324 @opindex fconstant-string-class
3325 Use @var{class-name} as the name of the class to instantiate for each
3326 literal string specified with the syntax @code{@@"@dots{}"}. The default
3327 class name is @code{NXConstantString} if the GNU runtime is being used, and
3328 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3329 @option{-fconstant-cfstrings} option, if also present, overrides the
3330 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3331 to be laid out as constant CoreFoundation strings.
3334 @opindex fgnu-runtime
3335 Generate object code compatible with the standard GNU Objective-C
3336 runtime. This is the default for most types of systems.
3338 @item -fnext-runtime
3339 @opindex fnext-runtime
3340 Generate output compatible with the NeXT runtime. This is the default
3341 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3342 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3345 @item -fno-nil-receivers
3346 @opindex fno-nil-receivers
3347 Assume that all Objective-C message dispatches (@code{[receiver
3348 message:arg]}) in this translation unit ensure that the receiver is
3349 not @code{nil}. This allows for more efficient entry points in the
3350 runtime to be used. This option is only available in conjunction with
3351 the NeXT runtime and ABI version 0 or 1.
3353 @item -fobjc-abi-version=@var{n}
3354 @opindex fobjc-abi-version
3355 Use version @var{n} of the Objective-C ABI for the selected runtime.
3356 This option is currently supported only for the NeXT runtime. In that
3357 case, Version 0 is the traditional (32-bit) ABI without support for
3358 properties and other Objective-C 2.0 additions. Version 1 is the
3359 traditional (32-bit) ABI with support for properties and other
3360 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3361 nothing is specified, the default is Version 0 on 32-bit target
3362 machines, and Version 2 on 64-bit target machines.
3364 @item -fobjc-call-cxx-cdtors
3365 @opindex fobjc-call-cxx-cdtors
3366 For each Objective-C class, check if any of its instance variables is a
3367 C++ object with a non-trivial default constructor. If so, synthesize a
3368 special @code{- (id) .cxx_construct} instance method which runs
3369 non-trivial default constructors on any such instance variables, in order,
3370 and then return @code{self}. Similarly, check if any instance variable
3371 is a C++ object with a non-trivial destructor, and if so, synthesize a
3372 special @code{- (void) .cxx_destruct} method which runs
3373 all such default destructors, in reverse order.
3375 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3376 methods thusly generated only operate on instance variables
3377 declared in the current Objective-C class, and not those inherited
3378 from superclasses. It is the responsibility of the Objective-C
3379 runtime to invoke all such methods in an object's inheritance
3380 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3381 by the runtime immediately after a new object instance is allocated;
3382 the @code{- (void) .cxx_destruct} methods are invoked immediately
3383 before the runtime deallocates an object instance.
3385 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3386 support for invoking the @code{- (id) .cxx_construct} and
3387 @code{- (void) .cxx_destruct} methods.
3389 @item -fobjc-direct-dispatch
3390 @opindex fobjc-direct-dispatch
3391 Allow fast jumps to the message dispatcher. On Darwin this is
3392 accomplished via the comm page.
3394 @item -fobjc-exceptions
3395 @opindex fobjc-exceptions
3396 Enable syntactic support for structured exception handling in
3397 Objective-C, similar to what is offered by C++. This option
3398 is required to use the Objective-C keywords @code{@@try},
3399 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3400 @code{@@synchronized}. This option is available with both the GNU
3401 runtime and the NeXT runtime (but not available in conjunction with
3402 the NeXT runtime on Mac OS X 10.2 and earlier).
3406 Enable garbage collection (GC) in Objective-C and Objective-C++
3407 programs. This option is only available with the NeXT runtime; the
3408 GNU runtime has a different garbage collection implementation that
3409 does not require special compiler flags.
3411 @item -fobjc-nilcheck
3412 @opindex fobjc-nilcheck
3413 For the NeXT runtime with version 2 of the ABI, check for a nil
3414 receiver in method invocations before doing the actual method call.
3415 This is the default and can be disabled using
3416 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3417 checked for nil in this way no matter what this flag is set to.
3418 Currently this flag does nothing when the GNU runtime, or an older
3419 version of the NeXT runtime ABI, is used.
3421 @item -fobjc-std=objc1
3423 Conform to the language syntax of Objective-C 1.0, the language
3424 recognized by GCC 4.0. This only affects the Objective-C additions to
3425 the C/C++ language; it does not affect conformance to C/C++ standards,
3426 which is controlled by the separate C/C++ dialect option flags. When
3427 this option is used with the Objective-C or Objective-C++ compiler,
3428 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3429 This is useful if you need to make sure that your Objective-C code can
3430 be compiled with older versions of GCC@.
3432 @item -freplace-objc-classes
3433 @opindex freplace-objc-classes
3434 Emit a special marker instructing @command{ld(1)} not to statically link in
3435 the resulting object file, and allow @command{dyld(1)} to load it in at
3436 run time instead. This is used in conjunction with the Fix-and-Continue
3437 debugging mode, where the object file in question may be recompiled and
3438 dynamically reloaded in the course of program execution, without the need
3439 to restart the program itself. Currently, Fix-and-Continue functionality
3440 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3445 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3446 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3447 compile time) with static class references that get initialized at load time,
3448 which improves run-time performance. Specifying the @option{-fzero-link} flag
3449 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3450 to be retained. This is useful in Zero-Link debugging mode, since it allows
3451 for individual class implementations to be modified during program execution.
3452 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3453 regardless of command-line options.
3455 @item -fno-local-ivars
3456 @opindex fno-local-ivars
3457 @opindex flocal-ivars
3458 By default instance variables in Objective-C can be accessed as if
3459 they were local variables from within the methods of the class they're
3460 declared in. This can lead to shadowing between instance variables
3461 and other variables declared either locally inside a class method or
3462 globally with the same name. Specifying the @option{-fno-local-ivars}
3463 flag disables this behavior thus avoiding variable shadowing issues.
3465 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3466 @opindex fivar-visibility
3467 Set the default instance variable visibility to the specified option
3468 so that instance variables declared outside the scope of any access
3469 modifier directives default to the specified visibility.
3473 Dump interface declarations for all classes seen in the source file to a
3474 file named @file{@var{sourcename}.decl}.
3476 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3477 @opindex Wassign-intercept
3478 @opindex Wno-assign-intercept
3479 Warn whenever an Objective-C assignment is being intercepted by the
3482 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3483 @opindex Wno-protocol
3485 If a class is declared to implement a protocol, a warning is issued for
3486 every method in the protocol that is not implemented by the class. The
3487 default behavior is to issue a warning for every method not explicitly
3488 implemented in the class, even if a method implementation is inherited
3489 from the superclass. If you use the @option{-Wno-protocol} option, then
3490 methods inherited from the superclass are considered to be implemented,
3491 and no warning is issued for them.
3493 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3495 @opindex Wno-selector
3496 Warn if multiple methods of different types for the same selector are
3497 found during compilation. The check is performed on the list of methods
3498 in the final stage of compilation. Additionally, a check is performed
3499 for each selector appearing in a @code{@@selector(@dots{})}
3500 expression, and a corresponding method for that selector has been found
3501 during compilation. Because these checks scan the method table only at
3502 the end of compilation, these warnings are not produced if the final
3503 stage of compilation is not reached, for example because an error is
3504 found during compilation, or because the @option{-fsyntax-only} option is
3507 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3508 @opindex Wstrict-selector-match
3509 @opindex Wno-strict-selector-match
3510 Warn if multiple methods with differing argument and/or return types are
3511 found for a given selector when attempting to send a message using this
3512 selector to a receiver of type @code{id} or @code{Class}. When this flag
3513 is off (which is the default behavior), the compiler omits such warnings
3514 if any differences found are confined to types that share the same size
3517 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3518 @opindex Wundeclared-selector
3519 @opindex Wno-undeclared-selector
3520 Warn if a @code{@@selector(@dots{})} expression referring to an
3521 undeclared selector is found. A selector is considered undeclared if no
3522 method with that name has been declared before the
3523 @code{@@selector(@dots{})} expression, either explicitly in an
3524 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3525 an @code{@@implementation} section. This option always performs its
3526 checks as soon as a @code{@@selector(@dots{})} expression is found,
3527 while @option{-Wselector} only performs its checks in the final stage of
3528 compilation. This also enforces the coding style convention
3529 that methods and selectors must be declared before being used.
3531 @item -print-objc-runtime-info
3532 @opindex print-objc-runtime-info
3533 Generate C header describing the largest structure that is passed by
3538 @node Diagnostic Message Formatting Options
3539 @section Options to Control Diagnostic Messages Formatting
3540 @cindex options to control diagnostics formatting
3541 @cindex diagnostic messages
3542 @cindex message formatting
3544 Traditionally, diagnostic messages have been formatted irrespective of
3545 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3546 options described below
3547 to control the formatting algorithm for diagnostic messages,
3548 e.g.@: how many characters per line, how often source location
3549 information should be reported. Note that some language front ends may not
3550 honor these options.
3553 @item -fmessage-length=@var{n}
3554 @opindex fmessage-length
3555 Try to format error messages so that they fit on lines of about
3556 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3557 done; each error message appears on a single line. This is the
3558 default for all front ends.
3560 Note - this option also affects the display of the @samp{#error} and
3561 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3562 function/type/variable attribute. It does not however affect the
3563 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3565 @item -fdiagnostics-show-location=once
3566 @opindex fdiagnostics-show-location
3567 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3568 reporter to emit source location information @emph{once}; that is, in
3569 case the message is too long to fit on a single physical line and has to
3570 be wrapped, the source location won't be emitted (as prefix) again,
3571 over and over, in subsequent continuation lines. This is the default
3574 @item -fdiagnostics-show-location=every-line
3575 Only meaningful in line-wrapping mode. Instructs the diagnostic
3576 messages reporter to emit the same source location information (as
3577 prefix) for physical lines that result from the process of breaking
3578 a message which is too long to fit on a single line.
3580 @item -fdiagnostics-color[=@var{WHEN}]
3581 @itemx -fno-diagnostics-color
3582 @opindex fdiagnostics-color
3583 @cindex highlight, color
3584 @vindex GCC_COLORS @r{environment variable}
3585 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3586 or @samp{auto}. The default depends on how the compiler has been configured,
3587 it can be any of the above @var{WHEN} options or also @samp{never}
3588 if @env{GCC_COLORS} environment variable isn't present in the environment,
3589 and @samp{auto} otherwise.
3590 @samp{auto} means to use color only when the standard error is a terminal.
3591 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3592 aliases for @option{-fdiagnostics-color=always} and
3593 @option{-fdiagnostics-color=never}, respectively.
3595 The colors are defined by the environment variable @env{GCC_COLORS}.
3596 Its value is a colon-separated list of capabilities and Select Graphic
3597 Rendition (SGR) substrings. SGR commands are interpreted by the
3598 terminal or terminal emulator. (See the section in the documentation
3599 of your text terminal for permitted values and their meanings as
3600 character attributes.) These substring values are integers in decimal
3601 representation and can be concatenated with semicolons.
3602 Common values to concatenate include
3604 @samp{4} for underline,
3606 @samp{7} for inverse,
3607 @samp{39} for default foreground color,
3608 @samp{30} to @samp{37} for foreground colors,
3609 @samp{90} to @samp{97} for 16-color mode foreground colors,
3610 @samp{38;5;0} to @samp{38;5;255}
3611 for 88-color and 256-color modes foreground colors,
3612 @samp{49} for default background color,
3613 @samp{40} to @samp{47} for background colors,
3614 @samp{100} to @samp{107} for 16-color mode background colors,
3615 and @samp{48;5;0} to @samp{48;5;255}
3616 for 88-color and 256-color modes background colors.
3618 The default @env{GCC_COLORS} is
3620 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3621 quote=01:fixit-insert=32:fixit-delete=31:\
3622 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3626 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3627 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3628 @samp{01} is bold, and @samp{31} is red.
3629 Setting @env{GCC_COLORS} to the empty string disables colors.
3630 Supported capabilities are as follows.
3634 @vindex error GCC_COLORS @r{capability}
3635 SGR substring for error: markers.
3638 @vindex warning GCC_COLORS @r{capability}
3639 SGR substring for warning: markers.
3642 @vindex note GCC_COLORS @r{capability}
3643 SGR substring for note: markers.
3646 @vindex range1 GCC_COLORS @r{capability}
3647 SGR substring for first additional range.
3650 @vindex range2 GCC_COLORS @r{capability}
3651 SGR substring for second additional range.
3654 @vindex locus GCC_COLORS @r{capability}
3655 SGR substring for location information, @samp{file:line} or
3656 @samp{file:line:column} etc.
3659 @vindex quote GCC_COLORS @r{capability}
3660 SGR substring for information printed within quotes.
3663 @vindex fixit-insert GCC_COLORS @r{capability}
3664 SGR substring for fix-it hints suggesting text to
3665 be inserted or replaced.
3668 @vindex fixit-delete GCC_COLORS @r{capability}
3669 SGR substring for fix-it hints suggesting text to
3672 @item diff-filename=
3673 @vindex diff-filename GCC_COLORS @r{capability}
3674 SGR substring for filename headers within generated patches.
3677 @vindex diff-hunk GCC_COLORS @r{capability}
3678 SGR substring for the starts of hunks within generated patches.
3681 @vindex diff-delete GCC_COLORS @r{capability}
3682 SGR substring for deleted lines within generated patches.
3685 @vindex diff-insert GCC_COLORS @r{capability}
3686 SGR substring for inserted lines within generated patches.
3689 @vindex type-diff GCC_COLORS @r{capability}
3690 SGR substring for highlighting mismatching types within template
3691 arguments in the C++ frontend.
3694 @item -fno-diagnostics-show-option
3695 @opindex fno-diagnostics-show-option
3696 @opindex fdiagnostics-show-option
3697 By default, each diagnostic emitted includes text indicating the
3698 command-line option that directly controls the diagnostic (if such an
3699 option is known to the diagnostic machinery). Specifying the
3700 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3702 @item -fno-diagnostics-show-caret
3703 @opindex fno-diagnostics-show-caret
3704 @opindex fdiagnostics-show-caret
3705 By default, each diagnostic emitted includes the original source line
3706 and a caret @samp{^} indicating the column. This option suppresses this
3707 information. The source line is truncated to @var{n} characters, if
3708 the @option{-fmessage-length=n} option is given. When the output is done
3709 to the terminal, the width is limited to the width given by the
3710 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3712 @item -fdiagnostics-parseable-fixits
3713 @opindex fdiagnostics-parseable-fixits
3714 Emit fix-it hints in a machine-parseable format, suitable for consumption
3715 by IDEs. For each fix-it, a line will be printed after the relevant
3716 diagnostic, starting with the string ``fix-it:''. For example:
3719 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3722 The location is expressed as a half-open range, expressed as a count of
3723 bytes, starting at byte 1 for the initial column. In the above example,
3724 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3728 00000000011111111112222222222
3729 12345678901234567890123456789
3730 gtk_widget_showall (dlg);
3735 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3736 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3737 (e.g. vertical tab as ``\013'').
3739 An empty replacement string indicates that the given range is to be removed.
3740 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3741 be inserted at the given position.
3743 @item -fdiagnostics-generate-patch
3744 @opindex fdiagnostics-generate-patch
3745 Print fix-it hints to stderr in unified diff format, after any diagnostics
3746 are printed. For example:
3753 void show_cb(GtkDialog *dlg)
3755 - gtk_widget_showall(dlg);
3756 + gtk_widget_show_all(dlg);
3761 The diff may or may not be colorized, following the same rules
3762 as for diagnostics (see @option{-fdiagnostics-color}).
3764 @item -fdiagnostics-show-template-tree
3765 @opindex fdiagnostics-show-template-tree
3767 In the C++ frontend, when printing diagnostics showing mismatching
3768 template types, such as:
3771 could not convert 'std::map<int, std::vector<double> >()'
3772 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3775 the @option{-fdiagnostics-show-template-tree} flag enables printing a
3776 tree-like structure showing the common and differing parts of the types,
3786 The parts that differ are highlighted with color (``double'' and
3787 ``float'' in this case).
3789 @item -fno-elide-type
3790 @opindex fno-elide-type
3791 @opindex felide-type
3792 By default when the C++ frontend prints diagnostics showing mismatching
3793 template types, common parts of the types are printed as ``[...]'' to
3794 simplify the error message. For example:
3797 could not convert 'std::map<int, std::vector<double> >()'
3798 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3801 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
3802 This flag also affects the output of the
3803 @option{-fdiagnostics-show-template-tree} flag.
3805 @item -fno-show-column
3806 @opindex fno-show-column
3807 Do not print column numbers in diagnostics. This may be necessary if
3808 diagnostics are being scanned by a program that does not understand the
3809 column numbers, such as @command{dejagnu}.
3813 @node Warning Options
3814 @section Options to Request or Suppress Warnings
3815 @cindex options to control warnings
3816 @cindex warning messages
3817 @cindex messages, warning
3818 @cindex suppressing warnings
3820 Warnings are diagnostic messages that report constructions that
3821 are not inherently erroneous but that are risky or suggest there
3822 may have been an error.
3824 The following language-independent options do not enable specific
3825 warnings but control the kinds of diagnostics produced by GCC@.
3828 @cindex syntax checking
3830 @opindex fsyntax-only
3831 Check the code for syntax errors, but don't do anything beyond that.
3833 @item -fmax-errors=@var{n}
3834 @opindex fmax-errors
3835 Limits the maximum number of error messages to @var{n}, at which point
3836 GCC bails out rather than attempting to continue processing the source
3837 code. If @var{n} is 0 (the default), there is no limit on the number
3838 of error messages produced. If @option{-Wfatal-errors} is also
3839 specified, then @option{-Wfatal-errors} takes precedence over this
3844 Inhibit all warning messages.
3849 Make all warnings into errors.
3854 Make the specified warning into an error. The specifier for a warning
3855 is appended; for example @option{-Werror=switch} turns the warnings
3856 controlled by @option{-Wswitch} into errors. This switch takes a
3857 negative form, to be used to negate @option{-Werror} for specific
3858 warnings; for example @option{-Wno-error=switch} makes
3859 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3862 The warning message for each controllable warning includes the
3863 option that controls the warning. That option can then be used with
3864 @option{-Werror=} and @option{-Wno-error=} as described above.
3865 (Printing of the option in the warning message can be disabled using the
3866 @option{-fno-diagnostics-show-option} flag.)
3868 Note that specifying @option{-Werror=}@var{foo} automatically implies
3869 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3872 @item -Wfatal-errors
3873 @opindex Wfatal-errors
3874 @opindex Wno-fatal-errors
3875 This option causes the compiler to abort compilation on the first error
3876 occurred rather than trying to keep going and printing further error
3881 You can request many specific warnings with options beginning with
3882 @samp{-W}, for example @option{-Wimplicit} to request warnings on
3883 implicit declarations. Each of these specific warning options also
3884 has a negative form beginning @samp{-Wno-} to turn off warnings; for
3885 example, @option{-Wno-implicit}. This manual lists only one of the
3886 two forms, whichever is not the default. For further
3887 language-specific options also refer to @ref{C++ Dialect Options} and
3888 @ref{Objective-C and Objective-C++ Dialect Options}.
3890 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
3891 options, such as @option{-Wunused}, which may turn on further options,
3892 such as @option{-Wunused-value}. The combined effect of positive and
3893 negative forms is that more specific options have priority over less
3894 specific ones, independently of their position in the command-line. For
3895 options of the same specificity, the last one takes effect. Options
3896 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
3897 as if they appeared at the end of the command-line.
3899 When an unrecognized warning option is requested (e.g.,
3900 @option{-Wunknown-warning}), GCC emits a diagnostic stating
3901 that the option is not recognized. However, if the @option{-Wno-} form
3902 is used, the behavior is slightly different: no diagnostic is
3903 produced for @option{-Wno-unknown-warning} unless other diagnostics
3904 are being produced. This allows the use of new @option{-Wno-} options
3905 with old compilers, but if something goes wrong, the compiler
3906 warns that an unrecognized option is present.
3913 @opindex Wno-pedantic
3914 Issue all the warnings demanded by strict ISO C and ISO C++;
3915 reject all programs that use forbidden extensions, and some other
3916 programs that do not follow ISO C and ISO C++. For ISO C, follows the
3917 version of the ISO C standard specified by any @option{-std} option used.
3919 Valid ISO C and ISO C++ programs should compile properly with or without
3920 this option (though a rare few require @option{-ansi} or a
3921 @option{-std} option specifying the required version of ISO C)@. However,
3922 without this option, certain GNU extensions and traditional C and C++
3923 features are supported as well. With this option, they are rejected.
3925 @option{-Wpedantic} does not cause warning messages for use of the
3926 alternate keywords whose names begin and end with @samp{__}. Pedantic
3927 warnings are also disabled in the expression that follows
3928 @code{__extension__}. However, only system header files should use
3929 these escape routes; application programs should avoid them.
3930 @xref{Alternate Keywords}.
3932 Some users try to use @option{-Wpedantic} to check programs for strict ISO
3933 C conformance. They soon find that it does not do quite what they want:
3934 it finds some non-ISO practices, but not all---only those for which
3935 ISO C @emph{requires} a diagnostic, and some others for which
3936 diagnostics have been added.
3938 A feature to report any failure to conform to ISO C might be useful in
3939 some instances, but would require considerable additional work and would
3940 be quite different from @option{-Wpedantic}. We don't have plans to
3941 support such a feature in the near future.
3943 Where the standard specified with @option{-std} represents a GNU
3944 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3945 corresponding @dfn{base standard}, the version of ISO C on which the GNU
3946 extended dialect is based. Warnings from @option{-Wpedantic} are given
3947 where they are required by the base standard. (It does not make sense
3948 for such warnings to be given only for features not in the specified GNU
3949 C dialect, since by definition the GNU dialects of C include all
3950 features the compiler supports with the given option, and there would be
3951 nothing to warn about.)
3953 @item -pedantic-errors
3954 @opindex pedantic-errors
3955 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
3956 requires a diagnostic, in some cases where there is undefined behavior
3957 at compile-time and in some other cases that do not prevent compilation
3958 of programs that are valid according to the standard. This is not
3959 equivalent to @option{-Werror=pedantic}, since there are errors enabled
3960 by this option and not enabled by the latter and vice versa.
3965 This enables all the warnings about constructions that some users
3966 consider questionable, and that are easy to avoid (or modify to
3967 prevent the warning), even in conjunction with macros. This also
3968 enables some language-specific warnings described in @ref{C++ Dialect
3969 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3971 @option{-Wall} turns on the following warning flags:
3973 @gccoptlist{-Waddress @gol
3974 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
3976 -Wbool-operation @gol
3977 -Wc++11-compat -Wc++14-compat @gol
3978 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
3979 -Wchar-subscripts @gol
3981 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
3982 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3984 -Wint-in-bool-context @gol
3985 -Wimplicit @r{(C and Objective-C only)} @gol
3986 -Wimplicit-int @r{(C and Objective-C only)} @gol
3987 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3988 -Winit-self @r{(only for C++)} @gol
3989 -Wlogical-not-parentheses @gol
3990 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3991 -Wmaybe-uninitialized @gol
3992 -Wmemset-elt-size @gol
3993 -Wmemset-transposed-args @gol
3994 -Wmisleading-indentation @r{(only for C/C++)} @gol
3995 -Wmissing-attributes @gol
3996 -Wmissing-braces @r{(only for C/ObjC)} @gol
3997 -Wmultistatement-macros @gol
3998 -Wnarrowing @r{(only for C++)} @gol
4000 -Wnonnull-compare @gol
4007 -Wsequence-point @gol
4008 -Wsign-compare @r{(only in C++)} @gol
4009 -Wsizeof-pointer-div @gol
4010 -Wsizeof-pointer-memaccess @gol
4011 -Wstrict-aliasing @gol
4012 -Wstrict-overflow=1 @gol
4014 -Wtautological-compare @gol
4016 -Wuninitialized @gol
4017 -Wunknown-pragmas @gol
4018 -Wunused-function @gol
4021 -Wunused-variable @gol
4022 -Wvolatile-register-var @gol
4025 Note that some warning flags are not implied by @option{-Wall}. Some of
4026 them warn about constructions that users generally do not consider
4027 questionable, but which occasionally you might wish to check for;
4028 others warn about constructions that are necessary or hard to avoid in
4029 some cases, and there is no simple way to modify the code to suppress
4030 the warning. Some of them are enabled by @option{-Wextra} but many of
4031 them must be enabled individually.
4037 This enables some extra warning flags that are not enabled by
4038 @option{-Wall}. (This option used to be called @option{-W}. The older
4039 name is still supported, but the newer name is more descriptive.)
4041 @gccoptlist{-Wclobbered @gol
4042 -Wcast-function-type @gol
4044 -Wignored-qualifiers @gol
4045 -Wimplicit-fallthrough=3 @gol
4046 -Wmissing-field-initializers @gol
4047 -Wmissing-parameter-type @r{(C only)} @gol
4048 -Wold-style-declaration @r{(C only)} @gol
4049 -Woverride-init @gol
4050 -Wsign-compare @r{(C only)} @gol
4052 -Wuninitialized @gol
4053 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4054 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4055 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4058 The option @option{-Wextra} also prints warning messages for the
4064 A pointer is compared against integer zero with @code{<}, @code{<=},
4065 @code{>}, or @code{>=}.
4068 (C++ only) An enumerator and a non-enumerator both appear in a
4069 conditional expression.
4072 (C++ only) Ambiguous virtual bases.
4075 (C++ only) Subscripting an array that has been declared @code{register}.
4078 (C++ only) Taking the address of a variable that has been declared
4082 (C++ only) A base class is not initialized in the copy constructor
4087 @item -Wchar-subscripts
4088 @opindex Wchar-subscripts
4089 @opindex Wno-char-subscripts
4090 Warn if an array subscript has type @code{char}. This is a common cause
4091 of error, as programmers often forget that this type is signed on some
4093 This warning is enabled by @option{-Wall}.
4098 Warn about an invalid memory access that is found by Pointer Bounds Checker
4099 (@option{-fcheck-pointer-bounds}).
4101 @item -Wno-coverage-mismatch
4102 @opindex Wno-coverage-mismatch
4103 @opindex Wcoverage-mismatch
4104 Warn if feedback profiles do not match when using the
4105 @option{-fprofile-use} option.
4106 If a source file is changed between compiling with @option{-fprofile-gen} and
4107 with @option{-fprofile-use}, the files with the profile feedback can fail
4108 to match the source file and GCC cannot use the profile feedback
4109 information. By default, this warning is enabled and is treated as an
4110 error. @option{-Wno-coverage-mismatch} can be used to disable the
4111 warning or @option{-Wno-error=coverage-mismatch} can be used to
4112 disable the error. Disabling the error for this warning can result in
4113 poorly optimized code and is useful only in the
4114 case of very minor changes such as bug fixes to an existing code-base.
4115 Completely disabling the warning is not recommended.
4118 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4120 Suppress warning messages emitted by @code{#warning} directives.
4122 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4123 @opindex Wdouble-promotion
4124 @opindex Wno-double-promotion
4125 Give a warning when a value of type @code{float} is implicitly
4126 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4127 floating-point unit implement @code{float} in hardware, but emulate
4128 @code{double} in software. On such a machine, doing computations
4129 using @code{double} values is much more expensive because of the
4130 overhead required for software emulation.
4132 It is easy to accidentally do computations with @code{double} because
4133 floating-point literals are implicitly of type @code{double}. For
4137 float area(float radius)
4139 return 3.14159 * radius * radius;
4143 the compiler performs the entire computation with @code{double}
4144 because the floating-point literal is a @code{double}.
4146 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4147 @opindex Wduplicate-decl-specifier
4148 @opindex Wno-duplicate-decl-specifier
4149 Warn if a declaration has duplicate @code{const}, @code{volatile},
4150 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4154 @itemx -Wformat=@var{n}
4157 @opindex ffreestanding
4158 @opindex fno-builtin
4160 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4161 the arguments supplied have types appropriate to the format string
4162 specified, and that the conversions specified in the format string make
4163 sense. This includes standard functions, and others specified by format
4164 attributes (@pxref{Function Attributes}), in the @code{printf},
4165 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4166 not in the C standard) families (or other target-specific families).
4167 Which functions are checked without format attributes having been
4168 specified depends on the standard version selected, and such checks of
4169 functions without the attribute specified are disabled by
4170 @option{-ffreestanding} or @option{-fno-builtin}.
4172 The formats are checked against the format features supported by GNU
4173 libc version 2.2. These include all ISO C90 and C99 features, as well
4174 as features from the Single Unix Specification and some BSD and GNU
4175 extensions. Other library implementations may not support all these
4176 features; GCC does not support warning about features that go beyond a
4177 particular library's limitations. However, if @option{-Wpedantic} is used
4178 with @option{-Wformat}, warnings are given about format features not
4179 in the selected standard version (but not for @code{strfmon} formats,
4180 since those are not in any version of the C standard). @xref{C Dialect
4181 Options,,Options Controlling C Dialect}.
4188 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4189 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4190 @option{-Wformat} also checks for null format arguments for several
4191 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4192 aspects of this level of format checking can be disabled by the
4193 options: @option{-Wno-format-contains-nul},
4194 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4195 @option{-Wformat} is enabled by @option{-Wall}.
4197 @item -Wno-format-contains-nul
4198 @opindex Wno-format-contains-nul
4199 @opindex Wformat-contains-nul
4200 If @option{-Wformat} is specified, do not warn about format strings that
4203 @item -Wno-format-extra-args
4204 @opindex Wno-format-extra-args
4205 @opindex Wformat-extra-args
4206 If @option{-Wformat} is specified, do not warn about excess arguments to a
4207 @code{printf} or @code{scanf} format function. The C standard specifies
4208 that such arguments are ignored.
4210 Where the unused arguments lie between used arguments that are
4211 specified with @samp{$} operand number specifications, normally
4212 warnings are still given, since the implementation could not know what
4213 type to pass to @code{va_arg} to skip the unused arguments. However,
4214 in the case of @code{scanf} formats, this option suppresses the
4215 warning if the unused arguments are all pointers, since the Single
4216 Unix Specification says that such unused arguments are allowed.
4218 @item -Wformat-overflow
4219 @itemx -Wformat-overflow=@var{level}
4220 @opindex Wformat-overflow
4221 @opindex Wno-format-overflow
4222 Warn about calls to formatted input/output functions such as @code{sprintf}
4223 and @code{vsprintf} that might overflow the destination buffer. When the
4224 exact number of bytes written by a format directive cannot be determined
4225 at compile-time it is estimated based on heuristics that depend on the
4226 @var{level} argument and on optimization. While enabling optimization
4227 will in most cases improve the accuracy of the warning, it may also
4228 result in false positives.
4231 @item -Wformat-overflow
4232 @itemx -Wformat-overflow=1
4233 @opindex Wformat-overflow
4234 @opindex Wno-format-overflow
4235 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4236 employs a conservative approach that warns only about calls that most
4237 likely overflow the buffer. At this level, numeric arguments to format
4238 directives with unknown values are assumed to have the value of one, and
4239 strings of unknown length to be empty. Numeric arguments that are known
4240 to be bounded to a subrange of their type, or string arguments whose output
4241 is bounded either by their directive's precision or by a finite set of
4242 string literals, are assumed to take on the value within the range that
4243 results in the most bytes on output. For example, the call to @code{sprintf}
4244 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4245 the terminating NUL character (@code{'\0'}) appended by the function
4246 to the destination buffer will be written past its end. Increasing
4247 the size of the buffer by a single byte is sufficient to avoid the
4248 warning, though it may not be sufficient to avoid the overflow.
4251 void f (int a, int b)
4254 sprintf (buf, "a = %i, b = %i\n", a, b);
4258 @item -Wformat-overflow=2
4259 Level @var{2} warns also about calls that might overflow the destination
4260 buffer given an argument of sufficient length or magnitude. At level
4261 @var{2}, unknown numeric arguments are assumed to have the minimum
4262 representable value for signed types with a precision greater than 1, and
4263 the maximum representable value otherwise. Unknown string arguments whose
4264 length cannot be assumed to be bounded either by the directive's precision,
4265 or by a finite set of string literals they may evaluate to, or the character
4266 array they may point to, are assumed to be 1 character long.
4268 At level @var{2}, the call in the example above is again diagnosed, but
4269 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4270 @code{%i} directive will write some of its digits beyond the end of
4271 the destination buffer. To make the call safe regardless of the values
4272 of the two variables, the size of the destination buffer must be increased
4273 to at least 34 bytes. GCC includes the minimum size of the buffer in
4274 an informational note following the warning.
4276 An alternative to increasing the size of the destination buffer is to
4277 constrain the range of formatted values. The maximum length of string
4278 arguments can be bounded by specifying the precision in the format
4279 directive. When numeric arguments of format directives can be assumed
4280 to be bounded by less than the precision of their type, choosing
4281 an appropriate length modifier to the format specifier will reduce
4282 the required buffer size. For example, if @var{a} and @var{b} in the
4283 example above can be assumed to be within the precision of
4284 the @code{short int} type then using either the @code{%hi} format
4285 directive or casting the argument to @code{short} reduces the maximum
4286 required size of the buffer to 24 bytes.
4289 void f (int a, int b)
4292 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4297 @item -Wno-format-zero-length
4298 @opindex Wno-format-zero-length
4299 @opindex Wformat-zero-length
4300 If @option{-Wformat} is specified, do not warn about zero-length formats.
4301 The C standard specifies that zero-length formats are allowed.
4306 Enable @option{-Wformat} plus additional format checks. Currently
4307 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4310 @item -Wformat-nonliteral
4311 @opindex Wformat-nonliteral
4312 @opindex Wno-format-nonliteral
4313 If @option{-Wformat} is specified, also warn if the format string is not a
4314 string literal and so cannot be checked, unless the format function
4315 takes its format arguments as a @code{va_list}.
4317 @item -Wformat-security
4318 @opindex Wformat-security
4319 @opindex Wno-format-security
4320 If @option{-Wformat} is specified, also warn about uses of format
4321 functions that represent possible security problems. At present, this
4322 warns about calls to @code{printf} and @code{scanf} functions where the
4323 format string is not a string literal and there are no format arguments,
4324 as in @code{printf (foo);}. This may be a security hole if the format
4325 string came from untrusted input and contains @samp{%n}. (This is
4326 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4327 in future warnings may be added to @option{-Wformat-security} that are not
4328 included in @option{-Wformat-nonliteral}.)
4330 @item -Wformat-signedness
4331 @opindex Wformat-signedness
4332 @opindex Wno-format-signedness
4333 If @option{-Wformat} is specified, also warn if the format string
4334 requires an unsigned argument and the argument is signed and vice versa.
4336 @item -Wformat-truncation
4337 @itemx -Wformat-truncation=@var{level}
4338 @opindex Wformat-truncation
4339 @opindex Wno-format-truncation
4340 Warn about calls to formatted input/output functions such as @code{snprintf}
4341 and @code{vsnprintf} that might result in output truncation. When the exact
4342 number of bytes written by a format directive cannot be determined at
4343 compile-time it is estimated based on heuristics that depend on
4344 the @var{level} argument and on optimization. While enabling optimization
4345 will in most cases improve the accuracy of the warning, it may also result
4346 in false positives. Except as noted otherwise, the option uses the same
4347 logic @option{-Wformat-overflow}.
4350 @item -Wformat-truncation
4351 @itemx -Wformat-truncation=1
4352 @opindex Wformat-truncation
4353 @opindex Wno-format-truncation
4354 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4355 employs a conservative approach that warns only about calls to bounded
4356 functions whose return value is unused and that will most likely result
4357 in output truncation.
4359 @item -Wformat-truncation=2
4360 Level @var{2} warns also about calls to bounded functions whose return
4361 value is used and that might result in truncation given an argument of
4362 sufficient length or magnitude.
4366 @opindex Wformat-y2k
4367 @opindex Wno-format-y2k
4368 If @option{-Wformat} is specified, also warn about @code{strftime}
4369 formats that may yield only a two-digit year.
4374 @opindex Wno-nonnull
4375 Warn about passing a null pointer for arguments marked as
4376 requiring a non-null value by the @code{nonnull} function attribute.
4378 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4379 can be disabled with the @option{-Wno-nonnull} option.
4381 @item -Wnonnull-compare
4382 @opindex Wnonnull-compare
4383 @opindex Wno-nonnull-compare
4384 Warn when comparing an argument marked with the @code{nonnull}
4385 function attribute against null inside the function.
4387 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4388 can be disabled with the @option{-Wno-nonnull-compare} option.
4390 @item -Wnull-dereference
4391 @opindex Wnull-dereference
4392 @opindex Wno-null-dereference
4393 Warn if the compiler detects paths that trigger erroneous or
4394 undefined behavior due to dereferencing a null pointer. This option
4395 is only active when @option{-fdelete-null-pointer-checks} is active,
4396 which is enabled by optimizations in most targets. The precision of
4397 the warnings depends on the optimization options used.
4399 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4401 @opindex Wno-init-self
4402 Warn about uninitialized variables that are initialized with themselves.
4403 Note this option can only be used with the @option{-Wuninitialized} option.
4405 For example, GCC warns about @code{i} being uninitialized in the
4406 following snippet only when @option{-Winit-self} has been specified:
4417 This warning is enabled by @option{-Wall} in C++.
4419 @item -Wimplicit-int @r{(C and Objective-C only)}
4420 @opindex Wimplicit-int
4421 @opindex Wno-implicit-int
4422 Warn when a declaration does not specify a type.
4423 This warning is enabled by @option{-Wall}.
4425 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4426 @opindex Wimplicit-function-declaration
4427 @opindex Wno-implicit-function-declaration
4428 Give a warning whenever a function is used before being declared. In
4429 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4430 enabled by default and it is made into an error by
4431 @option{-pedantic-errors}. This warning is also enabled by
4434 @item -Wimplicit @r{(C and Objective-C only)}
4436 @opindex Wno-implicit
4437 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4438 This warning is enabled by @option{-Wall}.
4440 @item -Wimplicit-fallthrough
4441 @opindex Wimplicit-fallthrough
4442 @opindex Wno-implicit-fallthrough
4443 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4444 and @option{-Wno-implicit-fallthrough} is the same as
4445 @option{-Wimplicit-fallthrough=0}.
4447 @item -Wimplicit-fallthrough=@var{n}
4448 @opindex Wimplicit-fallthrough=
4449 Warn when a switch case falls through. For example:
4467 This warning does not warn when the last statement of a case cannot
4468 fall through, e.g. when there is a return statement or a call to function
4469 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4470 also takes into account control flow statements, such as ifs, and only
4471 warns when appropriate. E.g.@:
4481 @} else if (i < 1) @{
4491 Since there are occasions where a switch case fall through is desirable,
4492 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4493 to be used along with a null statement to suppress this warning that
4494 would normally occur:
4502 __attribute__ ((fallthrough));
4509 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4510 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4511 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4512 Instead of these attributes, it is also possible to add a fallthrough comment
4513 to silence the warning. The whole body of the C or C++ style comment should
4514 match the given regular expressions listed below. The option argument @var{n}
4515 specifies what kind of comments are accepted:
4519 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4521 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4522 expression, any comment is used as fallthrough comment.
4524 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4525 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4527 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4528 following regular expressions:
4532 @item @code{-fallthrough}
4534 @item @code{@@fallthrough@@}
4536 @item @code{lint -fallthrough[ \t]*}
4538 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4540 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4542 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4546 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4547 following regular expressions:
4551 @item @code{-fallthrough}
4553 @item @code{@@fallthrough@@}
4555 @item @code{lint -fallthrough[ \t]*}
4557 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4561 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
4562 fallthrough comments, only attributes disable the warning.
4566 The comment needs to be followed after optional whitespace and other comments
4567 by @code{case} or @code{default} keywords or by a user label that precedes some
4568 @code{case} or @code{default} label.
4583 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
4585 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
4586 @opindex Wif-not-aligned
4587 @opindex Wno-if-not-aligned
4588 Control if warning triggered by the @code{warn_if_not_aligned} attribute
4589 should be issued. This is is enabled by default.
4590 Use @option{-Wno-if-not-aligned} to disable it.
4592 @item -Wignored-qualifiers @r{(C and C++ only)}
4593 @opindex Wignored-qualifiers
4594 @opindex Wno-ignored-qualifiers
4595 Warn if the return type of a function has a type qualifier
4596 such as @code{const}. For ISO C such a type qualifier has no effect,
4597 since the value returned by a function is not an lvalue.
4598 For C++, the warning is only emitted for scalar types or @code{void}.
4599 ISO C prohibits qualified @code{void} return types on function
4600 definitions, so such return types always receive a warning
4601 even without this option.
4603 This warning is also enabled by @option{-Wextra}.
4605 @item -Wignored-attributes @r{(C and C++ only)}
4606 @opindex Wignored-attributes
4607 @opindex Wno-ignored-attributes
4608 Warn when an attribute is ignored. This is different from the
4609 @option{-Wattributes} option in that it warns whenever the compiler decides
4610 to drop an attribute, not that the attribute is either unknown, used in a
4611 wrong place, etc. This warning is enabled by default.
4616 Warn if the type of @code{main} is suspicious. @code{main} should be
4617 a function with external linkage, returning int, taking either zero
4618 arguments, two, or three arguments of appropriate types. This warning
4619 is enabled by default in C++ and is enabled by either @option{-Wall}
4620 or @option{-Wpedantic}.
4622 @item -Wmisleading-indentation @r{(C and C++ only)}
4623 @opindex Wmisleading-indentation
4624 @opindex Wno-misleading-indentation
4625 Warn when the indentation of the code does not reflect the block structure.
4626 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
4627 @code{for} clauses with a guarded statement that does not use braces,
4628 followed by an unguarded statement with the same indentation.
4630 In the following example, the call to ``bar'' is misleadingly indented as
4631 if it were guarded by the ``if'' conditional.
4634 if (some_condition ())
4636 bar (); /* Gotcha: this is not guarded by the "if". */
4639 In the case of mixed tabs and spaces, the warning uses the
4640 @option{-ftabstop=} option to determine if the statements line up
4643 The warning is not issued for code involving multiline preprocessor logic
4644 such as the following example.
4649 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
4655 The warning is not issued after a @code{#line} directive, since this
4656 typically indicates autogenerated code, and no assumptions can be made
4657 about the layout of the file that the directive references.
4659 This warning is enabled by @option{-Wall} in C and C++.
4661 @item -Wmissing-attributes
4662 @opindex Wmissing-attributes
4663 @opindex Wno-missing-attributes
4664 Warn when a declaration of a function is missing one or more attributes
4665 that a related function is declared with and whose absence may adversely
4666 affect the correctness or efficiency of generated code. For example, in
4667 C++, the warning is issued when an explicit specialization of a primary
4668 template declared with attribute @code{alloc_align}, @code{alloc_size},
4669 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
4670 or @code{nonnull} is declared without it. Attributes @code{deprecated},
4671 @code{error}, and @code{warning} suppress the warning.
4672 (@pxref{Function Attributes}).
4674 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
4676 For example, since the declaration of the primary function template
4677 below makes use of both attribute @code{malloc} and @code{alloc_size}
4678 the declaration of the explicit specialization of the template is
4679 diagnosed because it is missing one of the attributes.
4683 T* __attribute__ ((malloc, alloc_size (1)))
4687 void* __attribute__ ((malloc)) // missing alloc_size
4688 allocate<void> (size_t);
4691 @item -Wmissing-braces
4692 @opindex Wmissing-braces
4693 @opindex Wno-missing-braces
4694 Warn if an aggregate or union initializer is not fully bracketed. In
4695 the following example, the initializer for @code{a} is not fully
4696 bracketed, but that for @code{b} is fully bracketed. This warning is
4697 enabled by @option{-Wall} in C.
4700 int a[2][2] = @{ 0, 1, 2, 3 @};
4701 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
4704 This warning is enabled by @option{-Wall}.
4706 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
4707 @opindex Wmissing-include-dirs
4708 @opindex Wno-missing-include-dirs
4709 Warn if a user-supplied include directory does not exist.
4711 @item -Wmultistatement-macros
4712 @opindex Wmultistatement-macros
4713 @opindex Wno-multistatement-macros
4714 Warn about unsafe multiple statement macros that appear to be guarded
4715 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
4716 @code{while}, in which only the first statement is actually guarded after
4717 the macro is expanded.
4722 #define DOIT x++; y++
4727 will increment @code{y} unconditionally, not just when @code{c} holds.
4728 The can usually be fixed by wrapping the macro in a do-while loop:
4730 #define DOIT do @{ x++; y++; @} while (0)
4735 This warning is enabled by @option{-Wall} in C and C++.
4738 @opindex Wparentheses
4739 @opindex Wno-parentheses
4740 Warn if parentheses are omitted in certain contexts, such
4741 as when there is an assignment in a context where a truth value
4742 is expected, or when operators are nested whose precedence people
4743 often get confused about.
4745 Also warn if a comparison like @code{x<=y<=z} appears; this is
4746 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
4747 interpretation from that of ordinary mathematical notation.
4749 Also warn for dangerous uses of the GNU extension to
4750 @code{?:} with omitted middle operand. When the condition
4751 in the @code{?}: operator is a boolean expression, the omitted value is
4752 always 1. Often programmers expect it to be a value computed
4753 inside the conditional expression instead.
4755 For C++ this also warns for some cases of unnecessary parentheses in
4756 declarations, which can indicate an attempt at a function call instead
4760 // Declares a local variable called mymutex.
4761 std::unique_lock<std::mutex> (mymutex);
4762 // User meant std::unique_lock<std::mutex> lock (mymutex);
4766 This warning is enabled by @option{-Wall}.
4768 @item -Wsequence-point
4769 @opindex Wsequence-point
4770 @opindex Wno-sequence-point
4771 Warn about code that may have undefined semantics because of violations
4772 of sequence point rules in the C and C++ standards.
4774 The C and C++ standards define the order in which expressions in a C/C++
4775 program are evaluated in terms of @dfn{sequence points}, which represent
4776 a partial ordering between the execution of parts of the program: those
4777 executed before the sequence point, and those executed after it. These
4778 occur after the evaluation of a full expression (one which is not part
4779 of a larger expression), after the evaluation of the first operand of a
4780 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
4781 function is called (but after the evaluation of its arguments and the
4782 expression denoting the called function), and in certain other places.
4783 Other than as expressed by the sequence point rules, the order of
4784 evaluation of subexpressions of an expression is not specified. All
4785 these rules describe only a partial order rather than a total order,
4786 since, for example, if two functions are called within one expression
4787 with no sequence point between them, the order in which the functions
4788 are called is not specified. However, the standards committee have
4789 ruled that function calls do not overlap.
4791 It is not specified when between sequence points modifications to the
4792 values of objects take effect. Programs whose behavior depends on this
4793 have undefined behavior; the C and C++ standards specify that ``Between
4794 the previous and next sequence point an object shall have its stored
4795 value modified at most once by the evaluation of an expression.
4796 Furthermore, the prior value shall be read only to determine the value
4797 to be stored.''. If a program breaks these rules, the results on any
4798 particular implementation are entirely unpredictable.
4800 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
4801 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
4802 diagnosed by this option, and it may give an occasional false positive
4803 result, but in general it has been found fairly effective at detecting
4804 this sort of problem in programs.
4806 The C++17 standard will define the order of evaluation of operands in
4807 more cases: in particular it requires that the right-hand side of an
4808 assignment be evaluated before the left-hand side, so the above
4809 examples are no longer undefined. But this warning will still warn
4810 about them, to help people avoid writing code that is undefined in C
4811 and earlier revisions of C++.
4813 The standard is worded confusingly, therefore there is some debate
4814 over the precise meaning of the sequence point rules in subtle cases.
4815 Links to discussions of the problem, including proposed formal
4816 definitions, may be found on the GCC readings page, at
4817 @uref{http://gcc.gnu.org/@/readings.html}.
4819 This warning is enabled by @option{-Wall} for C and C++.
4821 @item -Wno-return-local-addr
4822 @opindex Wno-return-local-addr
4823 @opindex Wreturn-local-addr
4824 Do not warn about returning a pointer (or in C++, a reference) to a
4825 variable that goes out of scope after the function returns.
4828 @opindex Wreturn-type
4829 @opindex Wno-return-type
4830 Warn whenever a function is defined with a return type that defaults
4831 to @code{int}. Also warn about any @code{return} statement with no
4832 return value in a function whose return type is not @code{void}
4833 (falling off the end of the function body is considered returning
4836 For C only, warn about a @code{return} statement with an expression in a
4837 function whose return type is @code{void}, unless the expression type is
4838 also @code{void}. As a GNU extension, the latter case is accepted
4839 without a warning unless @option{-Wpedantic} is used.
4841 For C++, a function without return type always produces a diagnostic
4842 message, even when @option{-Wno-return-type} is specified. The only
4843 exceptions are @code{main} and functions defined in system headers.
4845 This warning is enabled by default for C++ and is enabled by @option{-Wall}.
4847 @item -Wshift-count-negative
4848 @opindex Wshift-count-negative
4849 @opindex Wno-shift-count-negative
4850 Warn if shift count is negative. This warning is enabled by default.
4852 @item -Wshift-count-overflow
4853 @opindex Wshift-count-overflow
4854 @opindex Wno-shift-count-overflow
4855 Warn if shift count >= width of type. This warning is enabled by default.
4857 @item -Wshift-negative-value
4858 @opindex Wshift-negative-value
4859 @opindex Wno-shift-negative-value
4860 Warn if left shifting a negative value. This warning is enabled by
4861 @option{-Wextra} in C99 and C++11 modes (and newer).
4863 @item -Wshift-overflow
4864 @itemx -Wshift-overflow=@var{n}
4865 @opindex Wshift-overflow
4866 @opindex Wno-shift-overflow
4867 Warn about left shift overflows. This warning is enabled by
4868 default in C99 and C++11 modes (and newer).
4871 @item -Wshift-overflow=1
4872 This is the warning level of @option{-Wshift-overflow} and is enabled
4873 by default in C99 and C++11 modes (and newer). This warning level does
4874 not warn about left-shifting 1 into the sign bit. (However, in C, such
4875 an overflow is still rejected in contexts where an integer constant expression
4878 @item -Wshift-overflow=2
4879 This warning level also warns about left-shifting 1 into the sign bit,
4880 unless C++14 mode is active.
4886 Warn whenever a @code{switch} statement has an index of enumerated type
4887 and lacks a @code{case} for one or more of the named codes of that
4888 enumeration. (The presence of a @code{default} label prevents this
4889 warning.) @code{case} labels outside the enumeration range also
4890 provoke warnings when this option is used (even if there is a
4891 @code{default} label).
4892 This warning is enabled by @option{-Wall}.
4894 @item -Wswitch-default
4895 @opindex Wswitch-default
4896 @opindex Wno-switch-default
4897 Warn whenever a @code{switch} statement does not have a @code{default}
4901 @opindex Wswitch-enum
4902 @opindex Wno-switch-enum
4903 Warn whenever a @code{switch} statement has an index of enumerated type
4904 and lacks a @code{case} for one or more of the named codes of that
4905 enumeration. @code{case} labels outside the enumeration range also
4906 provoke warnings when this option is used. The only difference
4907 between @option{-Wswitch} and this option is that this option gives a
4908 warning about an omitted enumeration code even if there is a
4909 @code{default} label.
4912 @opindex Wswitch-bool
4913 @opindex Wno-switch-bool
4914 Warn whenever a @code{switch} statement has an index of boolean type
4915 and the case values are outside the range of a boolean type.
4916 It is possible to suppress this warning by casting the controlling
4917 expression to a type other than @code{bool}. For example:
4920 switch ((int) (a == 4))
4926 This warning is enabled by default for C and C++ programs.
4928 @item -Wswitch-unreachable
4929 @opindex Wswitch-unreachable
4930 @opindex Wno-switch-unreachable
4931 Warn whenever a @code{switch} statement contains statements between the
4932 controlling expression and the first case label, which will never be
4933 executed. For example:
4945 @option{-Wswitch-unreachable} does not warn if the statement between the
4946 controlling expression and the first case label is just a declaration:
4959 This warning is enabled by default for C and C++ programs.
4961 @item -Wsync-nand @r{(C and C++ only)}
4963 @opindex Wno-sync-nand
4964 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
4965 built-in functions are used. These functions changed semantics in GCC 4.4.
4967 @item -Wunused-but-set-parameter
4968 @opindex Wunused-but-set-parameter
4969 @opindex Wno-unused-but-set-parameter
4970 Warn whenever a function parameter is assigned to, but otherwise unused
4971 (aside from its declaration).
4973 To suppress this warning use the @code{unused} attribute
4974 (@pxref{Variable Attributes}).
4976 This warning is also enabled by @option{-Wunused} together with
4979 @item -Wunused-but-set-variable
4980 @opindex Wunused-but-set-variable
4981 @opindex Wno-unused-but-set-variable
4982 Warn whenever a local variable is assigned to, but otherwise unused
4983 (aside from its declaration).
4984 This warning is enabled by @option{-Wall}.
4986 To suppress this warning use the @code{unused} attribute
4987 (@pxref{Variable Attributes}).
4989 This warning is also enabled by @option{-Wunused}, which is enabled
4992 @item -Wunused-function
4993 @opindex Wunused-function
4994 @opindex Wno-unused-function
4995 Warn whenever a static function is declared but not defined or a
4996 non-inline static function is unused.
4997 This warning is enabled by @option{-Wall}.
4999 @item -Wunused-label
5000 @opindex Wunused-label
5001 @opindex Wno-unused-label
5002 Warn whenever a label is declared but not used.
5003 This warning is enabled by @option{-Wall}.
5005 To suppress this warning use the @code{unused} attribute
5006 (@pxref{Variable Attributes}).
5008 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5009 @opindex Wunused-local-typedefs
5010 @opindex Wno-unused-local-typedefs
5011 Warn when a typedef locally defined in a function is not used.
5012 This warning is enabled by @option{-Wall}.
5014 @item -Wunused-parameter
5015 @opindex Wunused-parameter
5016 @opindex Wno-unused-parameter
5017 Warn whenever a function parameter is unused aside from its declaration.
5019 To suppress this warning use the @code{unused} attribute
5020 (@pxref{Variable Attributes}).
5022 @item -Wno-unused-result
5023 @opindex Wunused-result
5024 @opindex Wno-unused-result
5025 Do not warn if a caller of a function marked with attribute
5026 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5027 its return value. The default is @option{-Wunused-result}.
5029 @item -Wunused-variable
5030 @opindex Wunused-variable
5031 @opindex Wno-unused-variable
5032 Warn whenever a local or static variable is unused aside from its
5033 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5034 but not for C++. This warning is enabled by @option{-Wall}.
5036 To suppress this warning use the @code{unused} attribute
5037 (@pxref{Variable Attributes}).
5039 @item -Wunused-const-variable
5040 @itemx -Wunused-const-variable=@var{n}
5041 @opindex Wunused-const-variable
5042 @opindex Wno-unused-const-variable
5043 Warn whenever a constant static variable is unused aside from its declaration.
5044 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5045 for C, but not for C++. In C this declares variable storage, but in C++ this
5046 is not an error since const variables take the place of @code{#define}s.
5048 To suppress this warning use the @code{unused} attribute
5049 (@pxref{Variable Attributes}).
5052 @item -Wunused-const-variable=1
5053 This is the warning level that is enabled by @option{-Wunused-variable} for
5054 C. It warns only about unused static const variables defined in the main
5055 compilation unit, but not about static const variables declared in any
5058 @item -Wunused-const-variable=2
5059 This warning level also warns for unused constant static variables in
5060 headers (excluding system headers). This is the warning level of
5061 @option{-Wunused-const-variable} and must be explicitly requested since
5062 in C++ this isn't an error and in C it might be harder to clean up all
5066 @item -Wunused-value
5067 @opindex Wunused-value
5068 @opindex Wno-unused-value
5069 Warn whenever a statement computes a result that is explicitly not
5070 used. To suppress this warning cast the unused expression to
5071 @code{void}. This includes an expression-statement or the left-hand
5072 side of a comma expression that contains no side effects. For example,
5073 an expression such as @code{x[i,j]} causes a warning, while
5074 @code{x[(void)i,j]} does not.
5076 This warning is enabled by @option{-Wall}.
5081 All the above @option{-Wunused} options combined.
5083 In order to get a warning about an unused function parameter, you must
5084 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5085 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5087 @item -Wuninitialized
5088 @opindex Wuninitialized
5089 @opindex Wno-uninitialized
5090 Warn if an automatic variable is used without first being initialized
5091 or if a variable may be clobbered by a @code{setjmp} call. In C++,
5092 warn if a non-static reference or non-static @code{const} member
5093 appears in a class without constructors.
5095 If you want to warn about code that uses the uninitialized value of the
5096 variable in its own initializer, use the @option{-Winit-self} option.
5098 These warnings occur for individual uninitialized or clobbered
5099 elements of structure, union or array variables as well as for
5100 variables that are uninitialized or clobbered as a whole. They do
5101 not occur for variables or elements declared @code{volatile}. Because
5102 these warnings depend on optimization, the exact variables or elements
5103 for which there are warnings depends on the precise optimization
5104 options and version of GCC used.
5106 Note that there may be no warning about a variable that is used only
5107 to compute a value that itself is never used, because such
5108 computations may be deleted by data flow analysis before the warnings
5111 @item -Winvalid-memory-model
5112 @opindex Winvalid-memory-model
5113 @opindex Wno-invalid-memory-model
5114 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5115 and the C11 atomic generic functions with a memory consistency argument
5116 that is either invalid for the operation or outside the range of values
5117 of the @code{memory_order} enumeration. For example, since the
5118 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5119 defined for the relaxed, release, and sequentially consistent memory
5120 orders the following code is diagnosed:
5125 __atomic_store_n (i, 0, memory_order_consume);
5129 @option{-Winvalid-memory-model} is enabled by default.
5131 @item -Wmaybe-uninitialized
5132 @opindex Wmaybe-uninitialized
5133 @opindex Wno-maybe-uninitialized
5134 For an automatic (i.e.@ local) variable, if there exists a path from the
5135 function entry to a use of the variable that is initialized, but there exist
5136 some other paths for which the variable is not initialized, the compiler
5137 emits a warning if it cannot prove the uninitialized paths are not
5138 executed at run time.
5140 These warnings are only possible in optimizing compilation, because otherwise
5141 GCC does not keep track of the state of variables.
5143 These warnings are made optional because GCC may not be able to determine when
5144 the code is correct in spite of appearing to have an error. Here is one
5145 example of how this can happen:
5165 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5166 always initialized, but GCC doesn't know this. To suppress the
5167 warning, you need to provide a default case with assert(0) or
5170 @cindex @code{longjmp} warnings
5171 This option also warns when a non-volatile automatic variable might be
5172 changed by a call to @code{longjmp}.
5173 The compiler sees only the calls to @code{setjmp}. It cannot know
5174 where @code{longjmp} will be called; in fact, a signal handler could
5175 call it at any point in the code. As a result, you may get a warning
5176 even when there is in fact no problem because @code{longjmp} cannot
5177 in fact be called at the place that would cause a problem.
5179 Some spurious warnings can be avoided if you declare all the functions
5180 you use that never return as @code{noreturn}. @xref{Function
5183 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5185 @item -Wunknown-pragmas
5186 @opindex Wunknown-pragmas
5187 @opindex Wno-unknown-pragmas
5188 @cindex warning for unknown pragmas
5189 @cindex unknown pragmas, warning
5190 @cindex pragmas, warning of unknown
5191 Warn when a @code{#pragma} directive is encountered that is not understood by
5192 GCC@. If this command-line option is used, warnings are even issued
5193 for unknown pragmas in system header files. This is not the case if
5194 the warnings are only enabled by the @option{-Wall} command-line option.
5197 @opindex Wno-pragmas
5199 Do not warn about misuses of pragmas, such as incorrect parameters,
5200 invalid syntax, or conflicts between pragmas. See also
5201 @option{-Wunknown-pragmas}.
5203 @item -Wstrict-aliasing
5204 @opindex Wstrict-aliasing
5205 @opindex Wno-strict-aliasing
5206 This option is only active when @option{-fstrict-aliasing} is active.
5207 It warns about code that might break the strict aliasing rules that the
5208 compiler is using for optimization. The warning does not catch all
5209 cases, but does attempt to catch the more common pitfalls. It is
5210 included in @option{-Wall}.
5211 It is equivalent to @option{-Wstrict-aliasing=3}
5213 @item -Wstrict-aliasing=n
5214 @opindex Wstrict-aliasing=n
5215 This option is only active when @option{-fstrict-aliasing} is active.
5216 It warns about code that might break the strict aliasing rules that the
5217 compiler is using for optimization.
5218 Higher levels correspond to higher accuracy (fewer false positives).
5219 Higher levels also correspond to more effort, similar to the way @option{-O}
5221 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5223 Level 1: Most aggressive, quick, least accurate.
5224 Possibly useful when higher levels
5225 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5226 false negatives. However, it has many false positives.
5227 Warns for all pointer conversions between possibly incompatible types,
5228 even if never dereferenced. Runs in the front end only.
5230 Level 2: Aggressive, quick, not too precise.
5231 May still have many false positives (not as many as level 1 though),
5232 and few false negatives (but possibly more than level 1).
5233 Unlike level 1, it only warns when an address is taken. Warns about
5234 incomplete types. Runs in the front end only.
5236 Level 3 (default for @option{-Wstrict-aliasing}):
5237 Should have very few false positives and few false
5238 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5239 Takes care of the common pun+dereference pattern in the front end:
5240 @code{*(int*)&some_float}.
5241 If optimization is enabled, it also runs in the back end, where it deals
5242 with multiple statement cases using flow-sensitive points-to information.
5243 Only warns when the converted pointer is dereferenced.
5244 Does not warn about incomplete types.
5246 @item -Wstrict-overflow
5247 @itemx -Wstrict-overflow=@var{n}
5248 @opindex Wstrict-overflow
5249 @opindex Wno-strict-overflow
5250 This option is only active when signed overflow is undefined.
5251 It warns about cases where the compiler optimizes based on the
5252 assumption that signed overflow does not occur. Note that it does not
5253 warn about all cases where the code might overflow: it only warns
5254 about cases where the compiler implements some optimization. Thus
5255 this warning depends on the optimization level.
5257 An optimization that assumes that signed overflow does not occur is
5258 perfectly safe if the values of the variables involved are such that
5259 overflow never does, in fact, occur. Therefore this warning can
5260 easily give a false positive: a warning about code that is not
5261 actually a problem. To help focus on important issues, several
5262 warning levels are defined. No warnings are issued for the use of
5263 undefined signed overflow when estimating how many iterations a loop
5264 requires, in particular when determining whether a loop will be
5268 @item -Wstrict-overflow=1
5269 Warn about cases that are both questionable and easy to avoid. For
5270 example the compiler simplifies
5271 @code{x + 1 > x} to @code{1}. This level of
5272 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5273 are not, and must be explicitly requested.
5275 @item -Wstrict-overflow=2
5276 Also warn about other cases where a comparison is simplified to a
5277 constant. For example: @code{abs (x) >= 0}. This can only be
5278 simplified when signed integer overflow is undefined, because
5279 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5280 zero. @option{-Wstrict-overflow} (with no level) is the same as
5281 @option{-Wstrict-overflow=2}.
5283 @item -Wstrict-overflow=3
5284 Also warn about other cases where a comparison is simplified. For
5285 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5287 @item -Wstrict-overflow=4
5288 Also warn about other simplifications not covered by the above cases.
5289 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5291 @item -Wstrict-overflow=5
5292 Also warn about cases where the compiler reduces the magnitude of a
5293 constant involved in a comparison. For example: @code{x + 2 > y} is
5294 simplified to @code{x + 1 >= y}. This is reported only at the
5295 highest warning level because this simplification applies to many
5296 comparisons, so this warning level gives a very large number of
5300 @item -Wstringop-overflow
5301 @itemx -Wstringop-overflow=@var{type}
5302 @opindex Wstringop-overflow
5303 @opindex Wno-stringop-overflow
5304 Warn for calls to string manipulation functions such as @code{memcpy} and
5305 @code{strcpy} that are determined to overflow the destination buffer. The
5306 optional argument is one greater than the type of Object Size Checking to
5307 perform to determine the size of the destination. @xref{Object Size Checking}.
5308 The argument is meaningful only for functions that operate on character arrays
5309 but not for raw memory functions like @code{memcpy} which always make use
5310 of Object Size type-0. The option also warns for calls that specify a size
5311 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5312 The option produces the best results with optimization enabled but can detect
5313 a small subset of simple buffer overflows even without optimization in
5314 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5315 correspond to the standard functions. In any case, the option warns about
5316 just a subset of buffer overflows detected by the corresponding overflow
5317 checking built-ins. For example, the option will issue a warning for
5318 the @code{strcpy} call below because it copies at least 5 characters
5319 (the string @code{"blue"} including the terminating NUL) into the buffer
5323 enum Color @{ blue, purple, yellow @};
5324 const char* f (enum Color clr)
5326 static char buf [4];
5330 case blue: str = "blue"; break;
5331 case purple: str = "purple"; break;
5332 case yellow: str = "yellow"; break;
5335 return strcpy (buf, str); // warning here
5339 Option @option{-Wstringop-overflow=2} is enabled by default.
5342 @item -Wstringop-overflow
5343 @itemx -Wstringop-overflow=1
5344 @opindex Wstringop-overflow
5345 @opindex Wno-stringop-overflow
5346 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5347 to determine the sizes of destination objects. This is the default setting
5348 of the option. At this setting the option will not warn for writes past
5349 the end of subobjects of larger objects accessed by pointers unless the
5350 size of the largest surrounding object is known. When the destination may
5351 be one of several objects it is assumed to be the largest one of them. On
5352 Linux systems, when optimization is enabled at this setting the option warns
5353 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5356 @item -Wstringop-overflow=2
5357 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5358 to determine the sizes of destination objects. At this setting the option
5359 will warn about overflows when writing to members of the largest complete
5360 objects whose exact size is known. It will, however, not warn for excessive
5361 writes to the same members of unknown objects referenced by pointers since
5362 they may point to arrays containing unknown numbers of elements.
5364 @item -Wstringop-overflow=3
5365 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5366 to determine the sizes of destination objects. At this setting the option
5367 warns about overflowing the smallest object or data member. This is the
5368 most restrictive setting of the option that may result in warnings for safe
5371 @item -Wstringop-overflow=4
5372 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5373 to determine the sizes of destination objects. At this setting the option
5374 will warn about overflowing any data members, and when the destination is
5375 one of several objects it uses the size of the largest of them to decide
5376 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5377 setting of the option may result in warnings for benign code.
5380 @item -Wstringop-truncation
5381 @opindex Wstringop-truncation
5382 @opindex Wno-stringop-truncation
5383 Warn for calls to bounded string manipulation functions such as @code{strncat},
5384 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5385 or leave the destination unchanged.
5387 In the following example, the call to @code{strncat} specifies a bound that
5388 is less than the length of the source string. As a result, the copy of
5389 the source will be truncated and so the call is diagnosed. To avoid the
5390 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5393 void append (char *buf, size_t bufsize)
5395 strncat (buf, ".txt", 3);
5399 As another example, the following call to @code{strncpy} results in copying
5400 to @code{d} just the characters preceding the terminating NUL, without
5401 appending the NUL to the end. Assuming the result of @code{strncpy} is
5402 necessarily a NUL-terminated string is a common mistake, and so the call
5403 is diagnosed. To avoid the warning when the result is not expected to be
5404 NUL-terminated, call @code{memcpy} instead.
5407 void copy (char *d, const char *s)
5409 strncpy (d, s, strlen (s));
5413 In the following example, the call to @code{strncpy} specifies the size
5414 of the destination buffer as the bound. If the length of the source
5415 string is equal to or greater than this size the result of the copy will
5416 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5417 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5418 element of the buffer to @code{NUL}.
5421 void copy (const char *s)
5424 strncpy (buf, s, sizeof buf);
5429 In situations where a character array is intended to store a sequence
5430 of bytes with no terminating @code{NUL} such an array may be annotated
5431 with attribute @code{nonstring} to avoid this warning. Such arrays,
5432 however, are not suitable arguments to functions that expect
5433 @code{NUL}-terminated strings. To help detect accidental misuses of
5434 such arrays GCC issues warnings unless it can prove that the use is
5435 safe. @xref{Common Variable Attributes}.
5437 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5438 @opindex Wsuggest-attribute=
5439 @opindex Wno-suggest-attribute=
5440 Warn for cases where adding an attribute may be beneficial. The
5441 attributes currently supported are listed below.
5444 @item -Wsuggest-attribute=pure
5445 @itemx -Wsuggest-attribute=const
5446 @itemx -Wsuggest-attribute=noreturn
5447 @itemx -Wsuggest-attribute=malloc
5448 @opindex Wsuggest-attribute=pure
5449 @opindex Wno-suggest-attribute=pure
5450 @opindex Wsuggest-attribute=const
5451 @opindex Wno-suggest-attribute=const
5452 @opindex Wsuggest-attribute=noreturn
5453 @opindex Wno-suggest-attribute=noreturn
5454 @opindex Wsuggest-attribute=malloc
5455 @opindex Wno-suggest-attribute=malloc
5457 Warn about functions that might be candidates for attributes
5458 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5459 only warns for functions visible in other compilation units or (in the case of
5460 @code{pure} and @code{const}) if it cannot prove that the function returns
5461 normally. A function returns normally if it doesn't contain an infinite loop or
5462 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5463 requires option @option{-fipa-pure-const}, which is enabled by default at
5464 @option{-O} and higher. Higher optimization levels improve the accuracy
5467 @item -Wsuggest-attribute=format
5468 @itemx -Wmissing-format-attribute
5469 @opindex Wsuggest-attribute=format
5470 @opindex Wmissing-format-attribute
5471 @opindex Wno-suggest-attribute=format
5472 @opindex Wno-missing-format-attribute
5476 Warn about function pointers that might be candidates for @code{format}
5477 attributes. Note these are only possible candidates, not absolute ones.
5478 GCC guesses that function pointers with @code{format} attributes that
5479 are used in assignment, initialization, parameter passing or return
5480 statements should have a corresponding @code{format} attribute in the
5481 resulting type. I.e.@: the left-hand side of the assignment or
5482 initialization, the type of the parameter variable, or the return type
5483 of the containing function respectively should also have a @code{format}
5484 attribute to avoid the warning.
5486 GCC also warns about function definitions that might be
5487 candidates for @code{format} attributes. Again, these are only
5488 possible candidates. GCC guesses that @code{format} attributes
5489 might be appropriate for any function that calls a function like
5490 @code{vprintf} or @code{vscanf}, but this might not always be the
5491 case, and some functions for which @code{format} attributes are
5492 appropriate may not be detected.
5494 @item -Wsuggest-attribute=cold
5495 @opindex Wsuggest-attribute=cold
5496 @opindex Wno-suggest-attribute=cold
5498 Warn about functions that might be candidates for @code{cold} attribute. This
5499 is based on static detection and generally will only warn about functions which
5500 always leads to a call to another @code{cold} function such as wrappers of
5501 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
5504 @item -Wsuggest-final-types
5505 @opindex Wno-suggest-final-types
5506 @opindex Wsuggest-final-types
5507 Warn about types with virtual methods where code quality would be improved
5508 if the type were declared with the C++11 @code{final} specifier,
5510 declared in an anonymous namespace. This allows GCC to more aggressively
5511 devirtualize the polymorphic calls. This warning is more effective with link
5512 time optimization, where the information about the class hierarchy graph is
5515 @item -Wsuggest-final-methods
5516 @opindex Wno-suggest-final-methods
5517 @opindex Wsuggest-final-methods
5518 Warn about virtual methods where code quality would be improved if the method
5519 were declared with the C++11 @code{final} specifier,
5520 or, if possible, its type were
5521 declared in an anonymous namespace or with the @code{final} specifier.
5523 more effective with link-time optimization, where the information about the
5524 class hierarchy graph is more complete. It is recommended to first consider
5525 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
5528 @item -Wsuggest-override
5529 Warn about overriding virtual functions that are not marked with the override
5533 @opindex Wno-alloc-zero
5534 @opindex Walloc-zero
5535 Warn about calls to allocation functions decorated with attribute
5536 @code{alloc_size} that specify zero bytes, including those to the built-in
5537 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
5538 @code{malloc}, and @code{realloc}. Because the behavior of these functions
5539 when called with a zero size differs among implementations (and in the case
5540 of @code{realloc} has been deprecated) relying on it may result in subtle
5541 portability bugs and should be avoided.
5543 @item -Walloc-size-larger-than=@var{byte-size}
5544 @opindex Walloc-size-larger-than=
5545 @opindex Wno-alloc-size-larger-than
5546 Warn about calls to functions decorated with attribute @code{alloc_size}
5547 that attempt to allocate objects larger than the specified number of bytes,
5548 or where the result of the size computation in an integer type with infinite
5549 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
5550 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
5551 Warnings controlled by the option can be disabled either by specifying
5552 @var{byte-size} of @samp{SIZE_MAX} or more or by
5553 @option{-Wno-alloc-size-larger-than}.
5554 @xref{Function Attributes}.
5556 @item -Wno-alloc-size-larger-than
5557 @opindex Wno-alloc-size-larger-than
5558 Disable @option{-Walloc-size-larger-than=} warnings. The option is
5559 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
5565 This option warns on all uses of @code{alloca} in the source.
5567 @item -Walloca-larger-than=@var{byte-size}
5568 @opindex -Walloca-larger-than=
5569 @opindex -Wno-alloca-larger-than
5570 This option warns on calls to @code{alloca} with an integer argument whose
5571 value is either zero, or that is not bounded by a controlling predicate
5572 that limits its value to at most @var{byte-size}. It also warns for calls
5573 to @code{alloca} where the bound value is unknown. Arguments of non-integer
5574 types are considered unbounded even if they appear to be constrained to
5577 For example, a bounded case of @code{alloca} could be:
5580 void func (size_t n)
5591 In the above example, passing @code{-Walloca-larger-than=1000} would not
5592 issue a warning because the call to @code{alloca} is known to be at most
5593 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
5594 the compiler would emit a warning.
5596 Unbounded uses, on the other hand, are uses of @code{alloca} with no
5597 controlling predicate constraining its integer argument. For example:
5602 void *p = alloca (n);
5607 If @code{-Walloca-larger-than=500} were passed, the above would trigger
5608 a warning, but this time because of the lack of bounds checking.
5610 Note, that even seemingly correct code involving signed integers could
5614 void func (signed int n)
5624 In the above example, @var{n} could be negative, causing a larger than
5625 expected argument to be implicitly cast into the @code{alloca} call.
5627 This option also warns when @code{alloca} is used in a loop.
5629 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
5630 but is usually only effective when @option{-ftree-vrp} is active (default
5631 for @option{-O2} and above).
5633 See also @option{-Wvla-larger-than=}@samp{byte-size}.
5635 @item -Wno-alloca-larger-than
5636 @opindex Wno-alloca-larger-than
5637 Disable @option{-Walloca-larger-than=} warnings. The option is
5638 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
5640 @item -Warray-bounds
5641 @itemx -Warray-bounds=@var{n}
5642 @opindex Wno-array-bounds
5643 @opindex Warray-bounds
5644 This option is only active when @option{-ftree-vrp} is active
5645 (default for @option{-O2} and above). It warns about subscripts to arrays
5646 that are always out of bounds. This warning is enabled by @option{-Wall}.
5649 @item -Warray-bounds=1
5650 This is the warning level of @option{-Warray-bounds} and is enabled
5651 by @option{-Wall}; higher levels are not, and must be explicitly requested.
5653 @item -Warray-bounds=2
5654 This warning level also warns about out of bounds access for
5655 arrays at the end of a struct and for arrays accessed through
5656 pointers. This warning level may give a larger number of
5657 false positives and is deactivated by default.
5660 @item -Wattribute-alias
5661 Warn about declarations using the @code{alias} and similar attributes whose
5662 target is incompatible with the type of the alias. @xref{Function Attributes,
5663 ,Declaring Attributes of Functions}.
5665 @item -Wbool-compare
5666 @opindex Wno-bool-compare
5667 @opindex Wbool-compare
5668 Warn about boolean expression compared with an integer value different from
5669 @code{true}/@code{false}. For instance, the following comparison is
5674 if ((n > 1) == 2) @{ @dots{} @}
5676 This warning is enabled by @option{-Wall}.
5678 @item -Wbool-operation
5679 @opindex Wno-bool-operation
5680 @opindex Wbool-operation
5681 Warn about suspicious operations on expressions of a boolean type. For
5682 instance, bitwise negation of a boolean is very likely a bug in the program.
5683 For C, this warning also warns about incrementing or decrementing a boolean,
5684 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
5685 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
5687 This warning is enabled by @option{-Wall}.
5689 @item -Wduplicated-branches
5690 @opindex Wno-duplicated-branches
5691 @opindex Wduplicated-branches
5692 Warn when an if-else has identical branches. This warning detects cases like
5699 It doesn't warn when both branches contain just a null statement. This warning
5700 also warn for conditional operators:
5702 int i = x ? *p : *p;
5705 @item -Wduplicated-cond
5706 @opindex Wno-duplicated-cond
5707 @opindex Wduplicated-cond
5708 Warn about duplicated conditions in an if-else-if chain. For instance,
5709 warn for the following code:
5711 if (p->q != NULL) @{ @dots{} @}
5712 else if (p->q != NULL) @{ @dots{} @}
5715 @item -Wframe-address
5716 @opindex Wno-frame-address
5717 @opindex Wframe-address
5718 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
5719 is called with an argument greater than 0. Such calls may return indeterminate
5720 values or crash the program. The warning is included in @option{-Wall}.
5722 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
5723 @opindex Wno-discarded-qualifiers
5724 @opindex Wdiscarded-qualifiers
5725 Do not warn if type qualifiers on pointers are being discarded.
5726 Typically, the compiler warns if a @code{const char *} variable is
5727 passed to a function that takes a @code{char *} parameter. This option
5728 can be used to suppress such a warning.
5730 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
5731 @opindex Wno-discarded-array-qualifiers
5732 @opindex Wdiscarded-array-qualifiers
5733 Do not warn if type qualifiers on arrays which are pointer targets
5734 are being discarded. Typically, the compiler warns if a
5735 @code{const int (*)[]} variable is passed to a function that
5736 takes a @code{int (*)[]} parameter. This option can be used to
5737 suppress such a warning.
5739 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
5740 @opindex Wno-incompatible-pointer-types
5741 @opindex Wincompatible-pointer-types
5742 Do not warn when there is a conversion between pointers that have incompatible
5743 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
5744 which warns for pointer argument passing or assignment with different
5747 @item -Wno-int-conversion @r{(C and Objective-C only)}
5748 @opindex Wno-int-conversion
5749 @opindex Wint-conversion
5750 Do not warn about incompatible integer to pointer and pointer to integer
5751 conversions. This warning is about implicit conversions; for explicit
5752 conversions the warnings @option{-Wno-int-to-pointer-cast} and
5753 @option{-Wno-pointer-to-int-cast} may be used.
5755 @item -Wno-div-by-zero
5756 @opindex Wno-div-by-zero
5757 @opindex Wdiv-by-zero
5758 Do not warn about compile-time integer division by zero. Floating-point
5759 division by zero is not warned about, as it can be a legitimate way of
5760 obtaining infinities and NaNs.
5762 @item -Wsystem-headers
5763 @opindex Wsystem-headers
5764 @opindex Wno-system-headers
5765 @cindex warnings from system headers
5766 @cindex system headers, warnings from
5767 Print warning messages for constructs found in system header files.
5768 Warnings from system headers are normally suppressed, on the assumption
5769 that they usually do not indicate real problems and would only make the
5770 compiler output harder to read. Using this command-line option tells
5771 GCC to emit warnings from system headers as if they occurred in user
5772 code. However, note that using @option{-Wall} in conjunction with this
5773 option does @emph{not} warn about unknown pragmas in system
5774 headers---for that, @option{-Wunknown-pragmas} must also be used.
5776 @item -Wtautological-compare
5777 @opindex Wtautological-compare
5778 @opindex Wno-tautological-compare
5779 Warn if a self-comparison always evaluates to true or false. This
5780 warning detects various mistakes such as:
5784 if (i > i) @{ @dots{} @}
5787 This warning also warns about bitwise comparisons that always evaluate
5788 to true or false, for instance:
5790 if ((a & 16) == 10) @{ @dots{} @}
5792 will always be false.
5794 This warning is enabled by @option{-Wall}.
5797 @opindex Wtrampolines
5798 @opindex Wno-trampolines
5799 Warn about trampolines generated for pointers to nested functions.
5800 A trampoline is a small piece of data or code that is created at run
5801 time on the stack when the address of a nested function is taken, and is
5802 used to call the nested function indirectly. For some targets, it is
5803 made up of data only and thus requires no special treatment. But, for
5804 most targets, it is made up of code and thus requires the stack to be
5805 made executable in order for the program to work properly.
5808 @opindex Wfloat-equal
5809 @opindex Wno-float-equal
5810 Warn if floating-point values are used in equality comparisons.
5812 The idea behind this is that sometimes it is convenient (for the
5813 programmer) to consider floating-point values as approximations to
5814 infinitely precise real numbers. If you are doing this, then you need
5815 to compute (by analyzing the code, or in some other way) the maximum or
5816 likely maximum error that the computation introduces, and allow for it
5817 when performing comparisons (and when producing output, but that's a
5818 different problem). In particular, instead of testing for equality, you
5819 should check to see whether the two values have ranges that overlap; and
5820 this is done with the relational operators, so equality comparisons are
5823 @item -Wtraditional @r{(C and Objective-C only)}
5824 @opindex Wtraditional
5825 @opindex Wno-traditional
5826 Warn about certain constructs that behave differently in traditional and
5827 ISO C@. Also warn about ISO C constructs that have no traditional C
5828 equivalent, and/or problematic constructs that should be avoided.
5832 Macro parameters that appear within string literals in the macro body.
5833 In traditional C macro replacement takes place within string literals,
5834 but in ISO C it does not.
5837 In traditional C, some preprocessor directives did not exist.
5838 Traditional preprocessors only considered a line to be a directive
5839 if the @samp{#} appeared in column 1 on the line. Therefore
5840 @option{-Wtraditional} warns about directives that traditional C
5841 understands but ignores because the @samp{#} does not appear as the
5842 first character on the line. It also suggests you hide directives like
5843 @code{#pragma} not understood by traditional C by indenting them. Some
5844 traditional implementations do not recognize @code{#elif}, so this option
5845 suggests avoiding it altogether.
5848 A function-like macro that appears without arguments.
5851 The unary plus operator.
5854 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
5855 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
5856 constants.) Note, these suffixes appear in macros defined in the system
5857 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
5858 Use of these macros in user code might normally lead to spurious
5859 warnings, however GCC's integrated preprocessor has enough context to
5860 avoid warning in these cases.
5863 A function declared external in one block and then used after the end of
5867 A @code{switch} statement has an operand of type @code{long}.
5870 A non-@code{static} function declaration follows a @code{static} one.
5871 This construct is not accepted by some traditional C compilers.
5874 The ISO type of an integer constant has a different width or
5875 signedness from its traditional type. This warning is only issued if
5876 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
5877 typically represent bit patterns, are not warned about.
5880 Usage of ISO string concatenation is detected.
5883 Initialization of automatic aggregates.
5886 Identifier conflicts with labels. Traditional C lacks a separate
5887 namespace for labels.
5890 Initialization of unions. If the initializer is zero, the warning is
5891 omitted. This is done under the assumption that the zero initializer in
5892 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
5893 initializer warnings and relies on default initialization to zero in the
5897 Conversions by prototypes between fixed/floating-point values and vice
5898 versa. The absence of these prototypes when compiling with traditional
5899 C causes serious problems. This is a subset of the possible
5900 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
5903 Use of ISO C style function definitions. This warning intentionally is
5904 @emph{not} issued for prototype declarations or variadic functions
5905 because these ISO C features appear in your code when using
5906 libiberty's traditional C compatibility macros, @code{PARAMS} and
5907 @code{VPARAMS}. This warning is also bypassed for nested functions
5908 because that feature is already a GCC extension and thus not relevant to
5909 traditional C compatibility.
5912 @item -Wtraditional-conversion @r{(C and Objective-C only)}
5913 @opindex Wtraditional-conversion
5914 @opindex Wno-traditional-conversion
5915 Warn if a prototype causes a type conversion that is different from what
5916 would happen to the same argument in the absence of a prototype. This
5917 includes conversions of fixed point to floating and vice versa, and
5918 conversions changing the width or signedness of a fixed-point argument
5919 except when the same as the default promotion.
5921 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
5922 @opindex Wdeclaration-after-statement
5923 @opindex Wno-declaration-after-statement
5924 Warn when a declaration is found after a statement in a block. This
5925 construct, known from C++, was introduced with ISO C99 and is by default
5926 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
5931 Warn whenever a local variable or type declaration shadows another
5932 variable, parameter, type, class member (in C++), or instance variable
5933 (in Objective-C) or whenever a built-in function is shadowed. Note
5934 that in C++, the compiler warns if a local variable shadows an
5935 explicit typedef, but not if it shadows a struct/class/enum.
5936 Same as @option{-Wshadow=global}.
5938 @item -Wno-shadow-ivar @r{(Objective-C only)}
5939 @opindex Wno-shadow-ivar
5940 @opindex Wshadow-ivar
5941 Do not warn whenever a local variable shadows an instance variable in an
5944 @item -Wshadow=global
5945 @opindex Wshadow=local
5946 The default for @option{-Wshadow}. Warns for any (global) shadowing.
5948 @item -Wshadow=local
5949 @opindex Wshadow=local
5950 Warn when a local variable shadows another local variable or parameter.
5951 This warning is enabled by @option{-Wshadow=global}.
5953 @item -Wshadow=compatible-local
5954 @opindex Wshadow=compatible-local
5955 Warn when a local variable shadows another local variable or parameter
5956 whose type is compatible with that of the shadowing variable. In C++,
5957 type compatibility here means the type of the shadowing variable can be
5958 converted to that of the shadowed variable. The creation of this flag
5959 (in addition to @option{-Wshadow=local}) is based on the idea that when
5960 a local variable shadows another one of incompatible type, it is most
5961 likely intentional, not a bug or typo, as shown in the following example:
5965 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
5967 for (int i = 0; i < N; ++i)
5976 Since the two variable @code{i} in the example above have incompatible types,
5977 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
5978 Because their types are incompatible, if a programmer accidentally uses one
5979 in place of the other, type checking will catch that and emit an error or
5980 warning. So not warning (about shadowing) in this case will not lead to
5981 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
5982 possibly reduce the number of warnings triggered by intentional shadowing.
5984 This warning is enabled by @option{-Wshadow=local}.
5986 @item -Wlarger-than=@var{byte-size}
5987 @opindex Wlarger-than=
5988 @opindex Wlarger-than-@var{byte-size}
5989 Warn whenever an object is defined whose size exceeds @var{byte-size}.
5990 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
5991 Warnings controlled by the option can be disabled either by specifying
5992 @var{byte-size} of @samp{SIZE_MAX} or more or by
5993 @option{-Wno-larger-than}.
5995 @item -Wno-larger-than
5996 @opindex Wno-larger-than
5997 Disable @option{-Wlarger-than=} warnings. The option is equivalent
5998 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6000 @item -Wframe-larger-than=@var{byte-size}
6001 @opindex Wframe-larger-than=
6002 @opindex Wno-frame-larger-than
6003 Warn if the size of a function frame exceeds @var{byte-size}.
6004 The computation done to determine the stack frame size is approximate
6005 and not conservative.
6006 The actual requirements may be somewhat greater than @var{byte-size}
6007 even if you do not get a warning. In addition, any space allocated
6008 via @code{alloca}, variable-length arrays, or related constructs
6009 is not included by the compiler when determining
6010 whether or not to issue a warning.
6011 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6012 Warnings controlled by the option can be disabled either by specifying
6013 @var{byte-size} of @samp{SIZE_MAX} or more or by
6014 @option{-Wno-frame-larger-than}.
6016 @item -Wno-frame-larger-than
6017 @opindex Wno-frame-larger-than
6018 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6019 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6021 @item -Wno-free-nonheap-object
6022 @opindex Wno-free-nonheap-object
6023 @opindex Wfree-nonheap-object
6024 Do not warn when attempting to free an object that was not allocated
6027 @item -Wstack-usage=@var{byte-size}
6028 @opindex Wstack-usage
6029 @opindex Wno-stack-usage
6030 Warn if the stack usage of a function might exceed @var{byte-size}.
6031 The computation done to determine the stack usage is conservative.
6032 Any space allocated via @code{alloca}, variable-length arrays, or related
6033 constructs is included by the compiler when determining whether or not to
6036 The message is in keeping with the output of @option{-fstack-usage}.
6040 If the stack usage is fully static but exceeds the specified amount, it's:
6043 warning: stack usage is 1120 bytes
6046 If the stack usage is (partly) dynamic but bounded, it's:
6049 warning: stack usage might be 1648 bytes
6052 If the stack usage is (partly) dynamic and not bounded, it's:
6055 warning: stack usage might be unbounded
6059 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6060 Warnings controlled by the option can be disabled either by specifying
6061 @var{byte-size} of @samp{SIZE_MAX} or more or by
6062 @option{-Wno-stack-usage}.
6064 @item -Wno-stack-usage
6065 @opindex Wno-stack-usage
6066 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6067 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6069 @item -Wunsafe-loop-optimizations
6070 @opindex Wunsafe-loop-optimizations
6071 @opindex Wno-unsafe-loop-optimizations
6072 Warn if the loop cannot be optimized because the compiler cannot
6073 assume anything on the bounds of the loop indices. With
6074 @option{-funsafe-loop-optimizations} warn if the compiler makes
6077 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6078 @opindex Wno-pedantic-ms-format
6079 @opindex Wpedantic-ms-format
6080 When used in combination with @option{-Wformat}
6081 and @option{-pedantic} without GNU extensions, this option
6082 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6083 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6084 which depend on the MS runtime.
6087 @opindex Waligned-new
6088 @opindex Wno-aligned-new
6089 Warn about a new-expression of a type that requires greater alignment
6090 than the @code{alignof(std::max_align_t)} but uses an allocation
6091 function without an explicit alignment parameter. This option is
6092 enabled by @option{-Wall}.
6094 Normally this only warns about global allocation functions, but
6095 @option{-Waligned-new=all} also warns about class member allocation
6098 @item -Wplacement-new
6099 @itemx -Wplacement-new=@var{n}
6100 @opindex Wplacement-new
6101 @opindex Wno-placement-new
6102 Warn about placement new expressions with undefined behavior, such as
6103 constructing an object in a buffer that is smaller than the type of
6104 the object. For example, the placement new expression below is diagnosed
6105 because it attempts to construct an array of 64 integers in a buffer only
6111 This warning is enabled by default.
6114 @item -Wplacement-new=1
6115 This is the default warning level of @option{-Wplacement-new}. At this
6116 level the warning is not issued for some strictly undefined constructs that
6117 GCC allows as extensions for compatibility with legacy code. For example,
6118 the following @code{new} expression is not diagnosed at this level even
6119 though it has undefined behavior according to the C++ standard because
6120 it writes past the end of the one-element array.
6122 struct S @{ int n, a[1]; @};
6123 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6124 new (s->a)int [32]();
6127 @item -Wplacement-new=2
6128 At this level, in addition to diagnosing all the same constructs as at level
6129 1, a diagnostic is also issued for placement new expressions that construct
6130 an object in the last member of structure whose type is an array of a single
6131 element and whose size is less than the size of the object being constructed.
6132 While the previous example would be diagnosed, the following construct makes
6133 use of the flexible member array extension to avoid the warning at level 2.
6135 struct S @{ int n, a[]; @};
6136 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6137 new (s->a)int [32]();
6142 @item -Wpointer-arith
6143 @opindex Wpointer-arith
6144 @opindex Wno-pointer-arith
6145 Warn about anything that depends on the ``size of'' a function type or
6146 of @code{void}. GNU C assigns these types a size of 1, for
6147 convenience in calculations with @code{void *} pointers and pointers
6148 to functions. In C++, warn also when an arithmetic operation involves
6149 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6151 @item -Wpointer-compare
6152 @opindex Wpointer-compare
6153 @opindex Wno-pointer-compare
6154 Warn if a pointer is compared with a zero character constant. This usually
6155 means that the pointer was meant to be dereferenced. For example:
6158 const char *p = foo ();
6163 Note that the code above is invalid in C++11.
6165 This warning is enabled by default.
6168 @opindex Wtype-limits
6169 @opindex Wno-type-limits
6170 Warn if a comparison is always true or always false due to the limited
6171 range of the data type, but do not warn for constant expressions. For
6172 example, warn if an unsigned variable is compared against zero with
6173 @code{<} or @code{>=}. This warning is also enabled by
6176 @include cppwarnopts.texi
6178 @item -Wbad-function-cast @r{(C and Objective-C only)}
6179 @opindex Wbad-function-cast
6180 @opindex Wno-bad-function-cast
6181 Warn when a function call is cast to a non-matching type.
6182 For example, warn if a call to a function returning an integer type
6183 is cast to a pointer type.
6185 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6186 @opindex Wc90-c99-compat
6187 @opindex Wno-c90-c99-compat
6188 Warn about features not present in ISO C90, but present in ISO C99.
6189 For instance, warn about use of variable length arrays, @code{long long}
6190 type, @code{bool} type, compound literals, designated initializers, and so
6191 on. This option is independent of the standards mode. Warnings are disabled
6192 in the expression that follows @code{__extension__}.
6194 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6195 @opindex Wc99-c11-compat
6196 @opindex Wno-c99-c11-compat
6197 Warn about features not present in ISO C99, but present in ISO C11.
6198 For instance, warn about use of anonymous structures and unions,
6199 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6200 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6201 and so on. This option is independent of the standards mode. Warnings are
6202 disabled in the expression that follows @code{__extension__}.
6204 @item -Wc++-compat @r{(C and Objective-C only)}
6205 @opindex Wc++-compat
6206 @opindex Wno-c++-compat
6207 Warn about ISO C constructs that are outside of the common subset of
6208 ISO C and ISO C++, e.g.@: request for implicit conversion from
6209 @code{void *} to a pointer to non-@code{void} type.
6211 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6212 @opindex Wc++11-compat
6213 @opindex Wno-c++11-compat
6214 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6215 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6216 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6217 enabled by @option{-Wall}.
6219 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6220 @opindex Wc++14-compat
6221 @opindex Wno-c++14-compat
6222 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6223 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6225 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6226 @opindex Wc++17-compat
6227 @opindex Wno-c++17-compat
6228 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6229 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6233 @opindex Wno-cast-qual
6234 Warn whenever a pointer is cast so as to remove a type qualifier from
6235 the target type. For example, warn if a @code{const char *} is cast
6236 to an ordinary @code{char *}.
6238 Also warn when making a cast that introduces a type qualifier in an
6239 unsafe way. For example, casting @code{char **} to @code{const char **}
6240 is unsafe, as in this example:
6243 /* p is char ** value. */
6244 const char **q = (const char **) p;
6245 /* Assignment of readonly string to const char * is OK. */
6247 /* Now char** pointer points to read-only memory. */
6252 @opindex Wcast-align
6253 @opindex Wno-cast-align
6254 Warn whenever a pointer is cast such that the required alignment of the
6255 target is increased. For example, warn if a @code{char *} is cast to
6256 an @code{int *} on machines where integers can only be accessed at
6257 two- or four-byte boundaries.
6259 @item -Wcast-align=strict
6260 @opindex Wcast-align=strict
6261 Warn whenever a pointer is cast such that the required alignment of the
6262 target is increased. For example, warn if a @code{char *} is cast to
6263 an @code{int *} regardless of the target machine.
6265 @item -Wcast-function-type
6266 @opindex Wcast-function-type
6267 @opindex Wno-cast-function-type
6268 Warn when a function pointer is cast to an incompatible function pointer.
6269 In a cast involving function types with a variable argument list only
6270 the types of initial arguments that are provided are considered.
6271 Any parameter of pointer-type matches any other pointer-type. Any benign
6272 differences in integral types are ignored, like @code{int} vs. @code{long}
6273 on ILP32 targets. Likewise type qualifiers are ignored. The function
6274 type @code{void (*) (void)} is special and matches everything, which can
6275 be used to suppress this warning.
6276 In a cast involving pointer to member types this warning warns whenever
6277 the type cast is changing the pointer to member type.
6278 This warning is enabled by @option{-Wextra}.
6280 @item -Wwrite-strings
6281 @opindex Wwrite-strings
6282 @opindex Wno-write-strings
6283 When compiling C, give string constants the type @code{const
6284 char[@var{length}]} so that copying the address of one into a
6285 non-@code{const} @code{char *} pointer produces a warning. These
6286 warnings help you find at compile time code that can try to write
6287 into a string constant, but only if you have been very careful about
6288 using @code{const} in declarations and prototypes. Otherwise, it is
6289 just a nuisance. This is why we did not make @option{-Wall} request
6292 When compiling C++, warn about the deprecated conversion from string
6293 literals to @code{char *}. This warning is enabled by default for C++
6297 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6298 @opindex Wcatch-value
6299 @opindex Wno-catch-value
6300 Warn about catch handlers that do not catch via reference.
6301 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6302 warn about polymorphic class types that are caught by value.
6303 With @option{-Wcatch-value=2} warn about all class types that are caught
6304 by value. With @option{-Wcatch-value=3} warn about all types that are
6305 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6309 @opindex Wno-clobbered
6310 Warn for variables that might be changed by @code{longjmp} or
6311 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6313 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6314 @opindex Wconditionally-supported
6315 @opindex Wno-conditionally-supported
6316 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6319 @opindex Wconversion
6320 @opindex Wno-conversion
6321 Warn for implicit conversions that may alter a value. This includes
6322 conversions between real and integer, like @code{abs (x)} when
6323 @code{x} is @code{double}; conversions between signed and unsigned,
6324 like @code{unsigned ui = -1}; and conversions to smaller types, like
6325 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6326 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6327 changed by the conversion like in @code{abs (2.0)}. Warnings about
6328 conversions between signed and unsigned integers can be disabled by
6329 using @option{-Wno-sign-conversion}.
6331 For C++, also warn for confusing overload resolution for user-defined
6332 conversions; and conversions that never use a type conversion
6333 operator: conversions to @code{void}, the same type, a base class or a
6334 reference to them. Warnings about conversions between signed and
6335 unsigned integers are disabled by default in C++ unless
6336 @option{-Wsign-conversion} is explicitly enabled.
6338 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6339 @opindex Wconversion-null
6340 @opindex Wno-conversion-null
6341 Do not warn for conversions between @code{NULL} and non-pointer
6342 types. @option{-Wconversion-null} is enabled by default.
6344 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6345 @opindex Wzero-as-null-pointer-constant
6346 @opindex Wno-zero-as-null-pointer-constant
6347 Warn when a literal @samp{0} is used as null pointer constant. This can
6348 be useful to facilitate the conversion to @code{nullptr} in C++11.
6350 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6351 @opindex Wsubobject-linkage
6352 @opindex Wno-subobject-linkage
6353 Warn if a class type has a base or a field whose type uses the anonymous
6354 namespace or depends on a type with no linkage. If a type A depends on
6355 a type B with no or internal linkage, defining it in multiple
6356 translation units would be an ODR violation because the meaning of B
6357 is different in each translation unit. If A only appears in a single
6358 translation unit, the best way to silence the warning is to give it
6359 internal linkage by putting it in an anonymous namespace as well. The
6360 compiler doesn't give this warning for types defined in the main .C
6361 file, as those are unlikely to have multiple definitions.
6362 @option{-Wsubobject-linkage} is enabled by default.
6364 @item -Wdangling-else
6365 @opindex Wdangling-else
6366 @opindex Wno-dangling-else
6367 Warn about constructions where there may be confusion to which
6368 @code{if} statement an @code{else} branch belongs. Here is an example of
6383 In C/C++, every @code{else} branch belongs to the innermost possible
6384 @code{if} statement, which in this example is @code{if (b)}. This is
6385 often not what the programmer expected, as illustrated in the above
6386 example by indentation the programmer chose. When there is the
6387 potential for this confusion, GCC issues a warning when this flag
6388 is specified. To eliminate the warning, add explicit braces around
6389 the innermost @code{if} statement so there is no way the @code{else}
6390 can belong to the enclosing @code{if}. The resulting code
6407 This warning is enabled by @option{-Wparentheses}.
6411 @opindex Wno-date-time
6412 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6413 are encountered as they might prevent bit-wise-identical reproducible
6416 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6417 @opindex Wdelete-incomplete
6418 @opindex Wno-delete-incomplete
6419 Warn when deleting a pointer to incomplete type, which may cause
6420 undefined behavior at runtime. This warning is enabled by default.
6422 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6423 @opindex Wuseless-cast
6424 @opindex Wno-useless-cast
6425 Warn when an expression is casted to its own type.
6428 @opindex Wempty-body
6429 @opindex Wno-empty-body
6430 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6431 while} statement. This warning is also enabled by @option{-Wextra}.
6433 @item -Wenum-compare
6434 @opindex Wenum-compare
6435 @opindex Wno-enum-compare
6436 Warn about a comparison between values of different enumerated types.
6437 In C++ enumerated type mismatches in conditional expressions are also
6438 diagnosed and the warning is enabled by default. In C this warning is
6439 enabled by @option{-Wall}.
6441 @item -Wextra-semi @r{(C++, Objective-C++ only)}
6442 @opindex Wextra-semi
6443 @opindex Wno-extra-semi
6444 Warn about redundant semicolon after in-class function definition.
6446 @item -Wjump-misses-init @r{(C, Objective-C only)}
6447 @opindex Wjump-misses-init
6448 @opindex Wno-jump-misses-init
6449 Warn if a @code{goto} statement or a @code{switch} statement jumps
6450 forward across the initialization of a variable, or jumps backward to a
6451 label after the variable has been initialized. This only warns about
6452 variables that are initialized when they are declared. This warning is
6453 only supported for C and Objective-C; in C++ this sort of branch is an
6456 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
6457 can be disabled with the @option{-Wno-jump-misses-init} option.
6459 @item -Wsign-compare
6460 @opindex Wsign-compare
6461 @opindex Wno-sign-compare
6462 @cindex warning for comparison of signed and unsigned values
6463 @cindex comparison of signed and unsigned values, warning
6464 @cindex signed and unsigned values, comparison warning
6465 Warn when a comparison between signed and unsigned values could produce
6466 an incorrect result when the signed value is converted to unsigned.
6467 In C++, this warning is also enabled by @option{-Wall}. In C, it is
6468 also enabled by @option{-Wextra}.
6470 @item -Wsign-conversion
6471 @opindex Wsign-conversion
6472 @opindex Wno-sign-conversion
6473 Warn for implicit conversions that may change the sign of an integer
6474 value, like assigning a signed integer expression to an unsigned
6475 integer variable. An explicit cast silences the warning. In C, this
6476 option is enabled also by @option{-Wconversion}.
6478 @item -Wfloat-conversion
6479 @opindex Wfloat-conversion
6480 @opindex Wno-float-conversion
6481 Warn for implicit conversions that reduce the precision of a real value.
6482 This includes conversions from real to integer, and from higher precision
6483 real to lower precision real values. This option is also enabled by
6484 @option{-Wconversion}.
6486 @item -Wno-scalar-storage-order
6487 @opindex -Wno-scalar-storage-order
6488 @opindex -Wscalar-storage-order
6489 Do not warn on suspicious constructs involving reverse scalar storage order.
6491 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
6492 @opindex Wsized-deallocation
6493 @opindex Wno-sized-deallocation
6494 Warn about a definition of an unsized deallocation function
6496 void operator delete (void *) noexcept;
6497 void operator delete[] (void *) noexcept;
6499 without a definition of the corresponding sized deallocation function
6501 void operator delete (void *, std::size_t) noexcept;
6502 void operator delete[] (void *, std::size_t) noexcept;
6504 or vice versa. Enabled by @option{-Wextra} along with
6505 @option{-fsized-deallocation}.
6507 @item -Wsizeof-pointer-div
6508 @opindex Wsizeof-pointer-div
6509 @opindex Wno-sizeof-pointer-div
6510 Warn for suspicious divisions of two sizeof expressions that divide
6511 the pointer size by the element size, which is the usual way to compute
6512 the array size but won't work out correctly with pointers. This warning
6513 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
6514 not an array, but a pointer. This warning is enabled by @option{-Wall}.
6516 @item -Wsizeof-pointer-memaccess
6517 @opindex Wsizeof-pointer-memaccess
6518 @opindex Wno-sizeof-pointer-memaccess
6519 Warn for suspicious length parameters to certain string and memory built-in
6520 functions if the argument uses @code{sizeof}. This warning triggers for
6521 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
6522 an array, but a pointer, and suggests a possible fix, or about
6523 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
6524 also warns about calls to bounded string copy functions like @code{strncat}
6525 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
6526 the source array. For example, in the following function the call to
6527 @code{strncat} specifies the size of the source string as the bound. That
6528 is almost certainly a mistake and so the call is diagnosed.
6530 void make_file (const char *name)
6532 char path[PATH_MAX];
6533 strncpy (path, name, sizeof path - 1);
6534 strncat (path, ".text", sizeof ".text");
6539 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
6541 @item -Wsizeof-array-argument
6542 @opindex Wsizeof-array-argument
6543 @opindex Wno-sizeof-array-argument
6544 Warn when the @code{sizeof} operator is applied to a parameter that is
6545 declared as an array in a function definition. This warning is enabled by
6546 default for C and C++ programs.
6548 @item -Wmemset-elt-size
6549 @opindex Wmemset-elt-size
6550 @opindex Wno-memset-elt-size
6551 Warn for suspicious calls to the @code{memset} built-in function, if the
6552 first argument references an array, and the third argument is a number
6553 equal to the number of elements, but not equal to the size of the array
6554 in memory. This indicates that the user has omitted a multiplication by
6555 the element size. This warning is enabled by @option{-Wall}.
6557 @item -Wmemset-transposed-args
6558 @opindex Wmemset-transposed-args
6559 @opindex Wno-memset-transposed-args
6560 Warn for suspicious calls to the @code{memset} built-in function, if the
6561 second argument is not zero and the third argument is zero. This warns e.g.@
6562 about @code{memset (buf, sizeof buf, 0)} where most probably
6563 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
6564 is only emitted if the third argument is literal zero. If it is some
6565 expression that is folded to zero, a cast of zero to some type, etc.,
6566 it is far less likely that the user has mistakenly exchanged the arguments
6567 and no warning is emitted. This warning is enabled by @option{-Wall}.
6571 @opindex Wno-address
6572 Warn about suspicious uses of memory addresses. These include using
6573 the address of a function in a conditional expression, such as
6574 @code{void func(void); if (func)}, and comparisons against the memory
6575 address of a string literal, such as @code{if (x == "abc")}. Such
6576 uses typically indicate a programmer error: the address of a function
6577 always evaluates to true, so their use in a conditional usually
6578 indicate that the programmer forgot the parentheses in a function
6579 call; and comparisons against string literals result in unspecified
6580 behavior and are not portable in C, so they usually indicate that the
6581 programmer intended to use @code{strcmp}. This warning is enabled by
6585 @opindex Wlogical-op
6586 @opindex Wno-logical-op
6587 Warn about suspicious uses of logical operators in expressions.
6588 This includes using logical operators in contexts where a
6589 bit-wise operator is likely to be expected. Also warns when
6590 the operands of a logical operator are the same:
6593 if (a < 0 && a < 0) @{ @dots{} @}
6596 @item -Wlogical-not-parentheses
6597 @opindex Wlogical-not-parentheses
6598 @opindex Wno-logical-not-parentheses
6599 Warn about logical not used on the left hand side operand of a comparison.
6600 This option does not warn if the right operand is considered to be a boolean
6601 expression. Its purpose is to detect suspicious code like the following:
6605 if (!a > 1) @{ @dots{} @}
6608 It is possible to suppress the warning by wrapping the LHS into
6611 if ((!a) > 1) @{ @dots{} @}
6614 This warning is enabled by @option{-Wall}.
6616 @item -Waggregate-return
6617 @opindex Waggregate-return
6618 @opindex Wno-aggregate-return
6619 Warn if any functions that return structures or unions are defined or
6620 called. (In languages where you can return an array, this also elicits
6623 @item -Wno-aggressive-loop-optimizations
6624 @opindex Wno-aggressive-loop-optimizations
6625 @opindex Waggressive-loop-optimizations
6626 Warn if in a loop with constant number of iterations the compiler detects
6627 undefined behavior in some statement during one or more of the iterations.
6629 @item -Wno-attributes
6630 @opindex Wno-attributes
6631 @opindex Wattributes
6632 Do not warn if an unexpected @code{__attribute__} is used, such as
6633 unrecognized attributes, function attributes applied to variables,
6634 etc. This does not stop errors for incorrect use of supported
6637 @item -Wno-builtin-declaration-mismatch
6638 @opindex Wno-builtin-declaration-mismatch
6639 @opindex Wbuiltin-declaration-mismatch
6640 Warn if a built-in function is declared with the wrong signature or
6642 This warning is enabled by default.
6644 @item -Wno-builtin-macro-redefined
6645 @opindex Wno-builtin-macro-redefined
6646 @opindex Wbuiltin-macro-redefined
6647 Do not warn if certain built-in macros are redefined. This suppresses
6648 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
6649 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
6651 @item -Wstrict-prototypes @r{(C and Objective-C only)}
6652 @opindex Wstrict-prototypes
6653 @opindex Wno-strict-prototypes
6654 Warn if a function is declared or defined without specifying the
6655 argument types. (An old-style function definition is permitted without
6656 a warning if preceded by a declaration that specifies the argument
6659 @item -Wold-style-declaration @r{(C and Objective-C only)}
6660 @opindex Wold-style-declaration
6661 @opindex Wno-old-style-declaration
6662 Warn for obsolescent usages, according to the C Standard, in a
6663 declaration. For example, warn if storage-class specifiers like
6664 @code{static} are not the first things in a declaration. This warning
6665 is also enabled by @option{-Wextra}.
6667 @item -Wold-style-definition @r{(C and Objective-C only)}
6668 @opindex Wold-style-definition
6669 @opindex Wno-old-style-definition
6670 Warn if an old-style function definition is used. A warning is given
6671 even if there is a previous prototype.
6673 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
6674 @opindex Wmissing-parameter-type
6675 @opindex Wno-missing-parameter-type
6676 A function parameter is declared without a type specifier in K&R-style
6683 This warning is also enabled by @option{-Wextra}.
6685 @item -Wmissing-prototypes @r{(C and Objective-C only)}
6686 @opindex Wmissing-prototypes
6687 @opindex Wno-missing-prototypes
6688 Warn if a global function is defined without a previous prototype
6689 declaration. This warning is issued even if the definition itself
6690 provides a prototype. Use this option to detect global functions
6691 that do not have a matching prototype declaration in a header file.
6692 This option is not valid for C++ because all function declarations
6693 provide prototypes and a non-matching declaration declares an
6694 overload rather than conflict with an earlier declaration.
6695 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
6697 @item -Wmissing-declarations
6698 @opindex Wmissing-declarations
6699 @opindex Wno-missing-declarations
6700 Warn if a global function is defined without a previous declaration.
6701 Do so even if the definition itself provides a prototype.
6702 Use this option to detect global functions that are not declared in
6703 header files. In C, no warnings are issued for functions with previous
6704 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
6705 missing prototypes. In C++, no warnings are issued for function templates,
6706 or for inline functions, or for functions in anonymous namespaces.
6708 @item -Wmissing-field-initializers
6709 @opindex Wmissing-field-initializers
6710 @opindex Wno-missing-field-initializers
6714 Warn if a structure's initializer has some fields missing. For
6715 example, the following code causes such a warning, because
6716 @code{x.h} is implicitly zero:
6719 struct s @{ int f, g, h; @};
6720 struct s x = @{ 3, 4 @};
6723 This option does not warn about designated initializers, so the following
6724 modification does not trigger a warning:
6727 struct s @{ int f, g, h; @};
6728 struct s x = @{ .f = 3, .g = 4 @};
6731 In C this option does not warn about the universal zero initializer
6735 struct s @{ int f, g, h; @};
6736 struct s x = @{ 0 @};
6739 Likewise, in C++ this option does not warn about the empty @{ @}
6740 initializer, for example:
6743 struct s @{ int f, g, h; @};
6747 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
6748 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
6750 @item -Wno-multichar
6751 @opindex Wno-multichar
6753 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
6754 Usually they indicate a typo in the user's code, as they have
6755 implementation-defined values, and should not be used in portable code.
6757 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
6758 @opindex Wnormalized=
6759 @opindex Wnormalized
6760 @opindex Wno-normalized
6763 @cindex character set, input normalization
6764 In ISO C and ISO C++, two identifiers are different if they are
6765 different sequences of characters. However, sometimes when characters
6766 outside the basic ASCII character set are used, you can have two
6767 different character sequences that look the same. To avoid confusion,
6768 the ISO 10646 standard sets out some @dfn{normalization rules} which
6769 when applied ensure that two sequences that look the same are turned into
6770 the same sequence. GCC can warn you if you are using identifiers that
6771 have not been normalized; this option controls that warning.
6773 There are four levels of warning supported by GCC@. The default is
6774 @option{-Wnormalized=nfc}, which warns about any identifier that is
6775 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
6776 recommended form for most uses. It is equivalent to
6777 @option{-Wnormalized}.
6779 Unfortunately, there are some characters allowed in identifiers by
6780 ISO C and ISO C++ that, when turned into NFC, are not allowed in
6781 identifiers. That is, there's no way to use these symbols in portable
6782 ISO C or C++ and have all your identifiers in NFC@.
6783 @option{-Wnormalized=id} suppresses the warning for these characters.
6784 It is hoped that future versions of the standards involved will correct
6785 this, which is why this option is not the default.
6787 You can switch the warning off for all characters by writing
6788 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
6789 only do this if you are using some other normalization scheme (like
6790 ``D''), because otherwise you can easily create bugs that are
6791 literally impossible to see.
6793 Some characters in ISO 10646 have distinct meanings but look identical
6794 in some fonts or display methodologies, especially once formatting has
6795 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
6796 LETTER N'', displays just like a regular @code{n} that has been
6797 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
6798 normalization scheme to convert all these into a standard form as
6799 well, and GCC warns if your code is not in NFKC if you use
6800 @option{-Wnormalized=nfkc}. This warning is comparable to warning
6801 about every identifier that contains the letter O because it might be
6802 confused with the digit 0, and so is not the default, but may be
6803 useful as a local coding convention if the programming environment
6804 cannot be fixed to display these characters distinctly.
6806 @item -Wno-deprecated
6807 @opindex Wno-deprecated
6808 @opindex Wdeprecated
6809 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
6811 @item -Wno-deprecated-declarations
6812 @opindex Wno-deprecated-declarations
6813 @opindex Wdeprecated-declarations
6814 Do not warn about uses of functions (@pxref{Function Attributes}),
6815 variables (@pxref{Variable Attributes}), and types (@pxref{Type
6816 Attributes}) marked as deprecated by using the @code{deprecated}
6820 @opindex Wno-overflow
6822 Do not warn about compile-time overflow in constant expressions.
6827 Warn about One Definition Rule violations during link-time optimization.
6828 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
6831 @opindex Wopenmp-simd
6832 @opindex Wno-openmp-simd
6833 Warn if the vectorizer cost model overrides the OpenMP
6834 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
6835 option can be used to relax the cost model.
6837 @item -Woverride-init @r{(C and Objective-C only)}
6838 @opindex Woverride-init
6839 @opindex Wno-override-init
6843 Warn if an initialized field without side effects is overridden when
6844 using designated initializers (@pxref{Designated Inits, , Designated
6847 This warning is included in @option{-Wextra}. To get other
6848 @option{-Wextra} warnings without this one, use @option{-Wextra
6849 -Wno-override-init}.
6851 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
6852 @opindex Woverride-init-side-effects
6853 @opindex Wno-override-init-side-effects
6854 Warn if an initialized field with side effects is overridden when
6855 using designated initializers (@pxref{Designated Inits, , Designated
6856 Initializers}). This warning is enabled by default.
6861 Warn if a structure is given the packed attribute, but the packed
6862 attribute has no effect on the layout or size of the structure.
6863 Such structures may be mis-aligned for little benefit. For
6864 instance, in this code, the variable @code{f.x} in @code{struct bar}
6865 is misaligned even though @code{struct bar} does not itself
6866 have the packed attribute:
6873 @} __attribute__((packed));
6881 @item -Wpacked-bitfield-compat
6882 @opindex Wpacked-bitfield-compat
6883 @opindex Wno-packed-bitfield-compat
6884 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
6885 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
6886 the change can lead to differences in the structure layout. GCC
6887 informs you when the offset of such a field has changed in GCC 4.4.
6888 For example there is no longer a 4-bit padding between field @code{a}
6889 and @code{b} in this structure:
6896 @} __attribute__ ((packed));
6899 This warning is enabled by default. Use
6900 @option{-Wno-packed-bitfield-compat} to disable this warning.
6902 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
6903 @opindex Wpacked-not-aligned
6904 @opindex Wno-packed-not-aligned
6905 Warn if a structure field with explicitly specified alignment in a
6906 packed struct or union is misaligned. For example, a warning will
6907 be issued on @code{struct S}, like, @code{warning: alignment 1 of
6908 'struct S' is less than 8}, in this code:
6912 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
6913 struct __attribute__ ((packed)) S @{
6919 This warning is enabled by @option{-Wall}.
6924 Warn if padding is included in a structure, either to align an element
6925 of the structure or to align the whole structure. Sometimes when this
6926 happens it is possible to rearrange the fields of the structure to
6927 reduce the padding and so make the structure smaller.
6929 @item -Wredundant-decls
6930 @opindex Wredundant-decls
6931 @opindex Wno-redundant-decls
6932 Warn if anything is declared more than once in the same scope, even in
6933 cases where multiple declaration is valid and changes nothing.
6937 @opindex Wno-restrict
6938 Warn when an object referenced by a @code{restrict}-qualified parameter
6939 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
6940 argument, or when copies between such objects overlap. For example,
6941 the call to the @code{strcpy} function below attempts to truncate the string
6942 by replacing its initial characters with the last four. However, because
6943 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
6944 the call is diagnosed.
6949 char a[] = "abcd1234";
6954 The @option{-Wrestrict} option detects some instances of simple overlap
6955 even without optimization but works best at @option{-O2} and above. It
6956 is included in @option{-Wall}.
6958 @item -Wnested-externs @r{(C and Objective-C only)}
6959 @opindex Wnested-externs
6960 @opindex Wno-nested-externs
6961 Warn if an @code{extern} declaration is encountered within a function.
6963 @item -Wno-inherited-variadic-ctor
6964 @opindex Winherited-variadic-ctor
6965 @opindex Wno-inherited-variadic-ctor
6966 Suppress warnings about use of C++11 inheriting constructors when the
6967 base class inherited from has a C variadic constructor; the warning is
6968 on by default because the ellipsis is not inherited.
6973 Warn if a function that is declared as inline cannot be inlined.
6974 Even with this option, the compiler does not warn about failures to
6975 inline functions declared in system headers.
6977 The compiler uses a variety of heuristics to determine whether or not
6978 to inline a function. For example, the compiler takes into account
6979 the size of the function being inlined and the amount of inlining
6980 that has already been done in the current function. Therefore,
6981 seemingly insignificant changes in the source program can cause the
6982 warnings produced by @option{-Winline} to appear or disappear.
6984 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
6985 @opindex Wno-invalid-offsetof
6986 @opindex Winvalid-offsetof
6987 Suppress warnings from applying the @code{offsetof} macro to a non-POD
6988 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
6989 to a non-standard-layout type is undefined. In existing C++ implementations,
6990 however, @code{offsetof} typically gives meaningful results.
6991 This flag is for users who are aware that they are
6992 writing nonportable code and who have deliberately chosen to ignore the
6995 The restrictions on @code{offsetof} may be relaxed in a future version
6996 of the C++ standard.
6998 @item -Wint-in-bool-context
6999 @opindex Wint-in-bool-context
7000 @opindex Wno-int-in-bool-context
7001 Warn for suspicious use of integer values where boolean values are expected,
7002 such as conditional expressions (?:) using non-boolean integer constants in
7003 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7004 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7005 for all kinds of multiplications regardless of the data type.
7006 This warning is enabled by @option{-Wall}.
7008 @item -Wno-int-to-pointer-cast
7009 @opindex Wno-int-to-pointer-cast
7010 @opindex Wint-to-pointer-cast
7011 Suppress warnings from casts to pointer type of an integer of a
7012 different size. In C++, casting to a pointer type of smaller size is
7013 an error. @option{Wint-to-pointer-cast} is enabled by default.
7016 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7017 @opindex Wno-pointer-to-int-cast
7018 @opindex Wpointer-to-int-cast
7019 Suppress warnings from casts from a pointer to an integer type of a
7023 @opindex Winvalid-pch
7024 @opindex Wno-invalid-pch
7025 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7026 the search path but cannot be used.
7030 @opindex Wno-long-long
7031 Warn if @code{long long} type is used. This is enabled by either
7032 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7033 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7035 @item -Wvariadic-macros
7036 @opindex Wvariadic-macros
7037 @opindex Wno-variadic-macros
7038 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7039 alternate syntax is used in ISO C99 mode. This is enabled by either
7040 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7041 messages, use @option{-Wno-variadic-macros}.
7045 @opindex Wno-varargs
7046 Warn upon questionable usage of the macros used to handle variable
7047 arguments like @code{va_start}. This is default. To inhibit the
7048 warning messages, use @option{-Wno-varargs}.
7050 @item -Wvector-operation-performance
7051 @opindex Wvector-operation-performance
7052 @opindex Wno-vector-operation-performance
7053 Warn if vector operation is not implemented via SIMD capabilities of the
7054 architecture. Mainly useful for the performance tuning.
7055 Vector operation can be implemented @code{piecewise}, which means that the
7056 scalar operation is performed on every vector element;
7057 @code{in parallel}, which means that the vector operation is implemented
7058 using scalars of wider type, which normally is more performance efficient;
7059 and @code{as a single scalar}, which means that vector fits into a
7062 @item -Wno-virtual-move-assign
7063 @opindex Wvirtual-move-assign
7064 @opindex Wno-virtual-move-assign
7065 Suppress warnings about inheriting from a virtual base with a
7066 non-trivial C++11 move assignment operator. This is dangerous because
7067 if the virtual base is reachable along more than one path, it is
7068 moved multiple times, which can mean both objects end up in the
7069 moved-from state. If the move assignment operator is written to avoid
7070 moving from a moved-from object, this warning can be disabled.
7075 Warn if a variable-length array is used in the code.
7076 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7077 the variable-length array.
7079 @item -Wvla-larger-than=@var{byte-size}
7080 @opindex -Wvla-larger-than=
7081 @opindex -Wno-vla-larger-than
7082 If this option is used, the compiler will warn for declarations of
7083 variable-length arrays whose size is either unbounded, or bounded
7084 by an argument that allows the array size to exceed @var{byte-size}
7085 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7086 works, but with variable-length arrays.
7088 Note that GCC may optimize small variable-length arrays of a known
7089 value into plain arrays, so this warning may not get triggered for
7092 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7093 is typically only effective when @option{-ftree-vrp} is active (default
7094 for @option{-O2} and above).
7096 See also @option{-Walloca-larger-than=@var{byte-size}}.
7098 @item -Wno-vla-larger-than
7099 @opindex Wno-vla-larger-than
7100 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7101 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7103 @item -Wvolatile-register-var
7104 @opindex Wvolatile-register-var
7105 @opindex Wno-volatile-register-var
7106 Warn if a register variable is declared volatile. The volatile
7107 modifier does not inhibit all optimizations that may eliminate reads
7108 and/or writes to register variables. This warning is enabled by
7111 @item -Wdisabled-optimization
7112 @opindex Wdisabled-optimization
7113 @opindex Wno-disabled-optimization
7114 Warn if a requested optimization pass is disabled. This warning does
7115 not generally indicate that there is anything wrong with your code; it
7116 merely indicates that GCC's optimizers are unable to handle the code
7117 effectively. Often, the problem is that your code is too big or too
7118 complex; GCC refuses to optimize programs when the optimization
7119 itself is likely to take inordinate amounts of time.
7121 @item -Wpointer-sign @r{(C and Objective-C only)}
7122 @opindex Wpointer-sign
7123 @opindex Wno-pointer-sign
7124 Warn for pointer argument passing or assignment with different signedness.
7125 This option is only supported for C and Objective-C@. It is implied by
7126 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7127 @option{-Wno-pointer-sign}.
7129 @item -Wstack-protector
7130 @opindex Wstack-protector
7131 @opindex Wno-stack-protector
7132 This option is only active when @option{-fstack-protector} is active. It
7133 warns about functions that are not protected against stack smashing.
7135 @item -Woverlength-strings
7136 @opindex Woverlength-strings
7137 @opindex Wno-overlength-strings
7138 Warn about string constants that are longer than the ``minimum
7139 maximum'' length specified in the C standard. Modern compilers
7140 generally allow string constants that are much longer than the
7141 standard's minimum limit, but very portable programs should avoid
7142 using longer strings.
7144 The limit applies @emph{after} string constant concatenation, and does
7145 not count the trailing NUL@. In C90, the limit was 509 characters; in
7146 C99, it was raised to 4095. C++98 does not specify a normative
7147 minimum maximum, so we do not diagnose overlength strings in C++@.
7149 This option is implied by @option{-Wpedantic}, and can be disabled with
7150 @option{-Wno-overlength-strings}.
7152 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7153 @opindex Wunsuffixed-float-constants
7154 @opindex Wno-unsuffixed-float-constants
7156 Issue a warning for any floating constant that does not have
7157 a suffix. When used together with @option{-Wsystem-headers} it
7158 warns about such constants in system header files. This can be useful
7159 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7160 from the decimal floating-point extension to C99.
7162 @item -Wno-designated-init @r{(C and Objective-C only)}
7163 Suppress warnings when a positional initializer is used to initialize
7164 a structure that has been marked with the @code{designated_init}
7168 Issue a warning when HSAIL cannot be emitted for the compiled function or
7173 @node Debugging Options
7174 @section Options for Debugging Your Program
7175 @cindex options, debugging
7176 @cindex debugging information options
7178 To tell GCC to emit extra information for use by a debugger, in almost
7179 all cases you need only to add @option{-g} to your other options.
7181 GCC allows you to use @option{-g} with
7182 @option{-O}. The shortcuts taken by optimized code may occasionally
7183 be surprising: some variables you declared may not exist
7184 at all; flow of control may briefly move where you did not expect it;
7185 some statements may not be executed because they compute constant
7186 results or their values are already at hand; some statements may
7187 execute in different places because they have been moved out of loops.
7188 Nevertheless it is possible to debug optimized output. This makes
7189 it reasonable to use the optimizer for programs that might have bugs.
7191 If you are not using some other optimization option, consider
7192 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7193 With no @option{-O} option at all, some compiler passes that collect
7194 information useful for debugging do not run at all, so that
7195 @option{-Og} may result in a better debugging experience.
7200 Produce debugging information in the operating system's native format
7201 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7204 On most systems that use stabs format, @option{-g} enables use of extra
7205 debugging information that only GDB can use; this extra information
7206 makes debugging work better in GDB but probably makes other debuggers
7208 refuse to read the program. If you want to control for certain whether
7209 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7210 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7214 Produce debugging information for use by GDB@. This means to use the
7215 most expressive format available (DWARF, stabs, or the native format
7216 if neither of those are supported), including GDB extensions if at all
7220 @itemx -gdwarf-@var{version}
7222 Produce debugging information in DWARF format (if that is supported).
7223 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7224 for most targets is 4. DWARF Version 5 is only experimental.
7226 Note that with DWARF Version 2, some ports require and always
7227 use some non-conflicting DWARF 3 extensions in the unwind tables.
7229 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7230 for maximum benefit.
7232 GCC no longer supports DWARF Version 1, which is substantially
7233 different than Version 2 and later. For historical reasons, some
7234 other DWARF-related options such as
7235 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7236 in their names, but apply to all currently-supported versions of DWARF.
7240 Produce debugging information in stabs format (if that is supported),
7241 without GDB extensions. This is the format used by DBX on most BSD
7242 systems. On MIPS, Alpha and System V Release 4 systems this option
7243 produces stabs debugging output that is not understood by DBX@.
7244 On System V Release 4 systems this option requires the GNU assembler.
7248 Produce debugging information in stabs format (if that is supported),
7249 using GNU extensions understood only by the GNU debugger (GDB)@. The
7250 use of these extensions is likely to make other debuggers crash or
7251 refuse to read the program.
7255 Produce debugging information in XCOFF format (if that is supported).
7256 This is the format used by the DBX debugger on IBM RS/6000 systems.
7260 Produce debugging information in XCOFF format (if that is supported),
7261 using GNU extensions understood only by the GNU debugger (GDB)@. The
7262 use of these extensions is likely to make other debuggers crash or
7263 refuse to read the program, and may cause assemblers other than the GNU
7264 assembler (GAS) to fail with an error.
7268 Produce debugging information in Alpha/VMS debug format (if that is
7269 supported). This is the format used by DEBUG on Alpha/VMS systems.
7272 @itemx -ggdb@var{level}
7273 @itemx -gstabs@var{level}
7274 @itemx -gxcoff@var{level}
7275 @itemx -gvms@var{level}
7276 Request debugging information and also use @var{level} to specify how
7277 much information. The default level is 2.
7279 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7282 Level 1 produces minimal information, enough for making backtraces in
7283 parts of the program that you don't plan to debug. This includes
7284 descriptions of functions and external variables, and line number
7285 tables, but no information about local variables.
7287 Level 3 includes extra information, such as all the macro definitions
7288 present in the program. Some debuggers support macro expansion when
7289 you use @option{-g3}.
7291 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7292 confusion with @option{-gdwarf-@var{level}}.
7293 Instead use an additional @option{-g@var{level}} option to change the
7294 debug level for DWARF.
7296 @item -feliminate-unused-debug-symbols
7297 @opindex feliminate-unused-debug-symbols
7298 Produce debugging information in stabs format (if that is supported),
7299 for only symbols that are actually used.
7301 @item -femit-class-debug-always
7302 @opindex femit-class-debug-always
7303 Instead of emitting debugging information for a C++ class in only one
7304 object file, emit it in all object files using the class. This option
7305 should be used only with debuggers that are unable to handle the way GCC
7306 normally emits debugging information for classes because using this
7307 option increases the size of debugging information by as much as a
7310 @item -fno-merge-debug-strings
7311 @opindex fmerge-debug-strings
7312 @opindex fno-merge-debug-strings
7313 Direct the linker to not merge together strings in the debugging
7314 information that are identical in different object files. Merging is
7315 not supported by all assemblers or linkers. Merging decreases the size
7316 of the debug information in the output file at the cost of increasing
7317 link processing time. Merging is enabled by default.
7319 @item -fdebug-prefix-map=@var{old}=@var{new}
7320 @opindex fdebug-prefix-map
7321 When compiling files residing in directory @file{@var{old}}, record
7322 debugging information describing them as if the files resided in
7323 directory @file{@var{new}} instead. This can be used to replace a
7324 build-time path with an install-time path in the debug info. It can
7325 also be used to change an absolute path to a relative path by using
7326 @file{.} for @var{new}. This can give more reproducible builds, which
7327 are location independent, but may require an extra command to tell GDB
7328 where to find the source files. See also @option{-ffile-prefix-map}.
7330 @item -fvar-tracking
7331 @opindex fvar-tracking
7332 Run variable tracking pass. It computes where variables are stored at each
7333 position in code. Better debugging information is then generated
7334 (if the debugging information format supports this information).
7336 It is enabled by default when compiling with optimization (@option{-Os},
7337 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7338 the debug info format supports it.
7340 @item -fvar-tracking-assignments
7341 @opindex fvar-tracking-assignments
7342 @opindex fno-var-tracking-assignments
7343 Annotate assignments to user variables early in the compilation and
7344 attempt to carry the annotations over throughout the compilation all the
7345 way to the end, in an attempt to improve debug information while
7346 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7348 It can be enabled even if var-tracking is disabled, in which case
7349 annotations are created and maintained, but discarded at the end.
7350 By default, this flag is enabled together with @option{-fvar-tracking},
7351 except when selective scheduling is enabled.
7354 @opindex gsplit-dwarf
7355 Separate as much DWARF debugging information as possible into a
7356 separate output file with the extension @file{.dwo}. This option allows
7357 the build system to avoid linking files with debug information. To
7358 be useful, this option requires a debugger capable of reading @file{.dwo}
7363 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7365 @item -ggnu-pubnames
7366 @opindex ggnu-pubnames
7367 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7368 suitable for conversion into a GDB@ index. This option is only useful
7369 with a linker that can produce GDB@ index version 7.
7371 @item -fdebug-types-section
7372 @opindex fdebug-types-section
7373 @opindex fno-debug-types-section
7374 When using DWARF Version 4 or higher, type DIEs can be put into
7375 their own @code{.debug_types} section instead of making them part of the
7376 @code{.debug_info} section. It is more efficient to put them in a separate
7377 comdat section since the linker can then remove duplicates.
7378 But not all DWARF consumers support @code{.debug_types} sections yet
7379 and on some objects @code{.debug_types} produces larger instead of smaller
7380 debugging information.
7382 @item -grecord-gcc-switches
7383 @itemx -gno-record-gcc-switches
7384 @opindex grecord-gcc-switches
7385 @opindex gno-record-gcc-switches
7386 This switch causes the command-line options used to invoke the
7387 compiler that may affect code generation to be appended to the
7388 DW_AT_producer attribute in DWARF debugging information. The options
7389 are concatenated with spaces separating them from each other and from
7390 the compiler version.
7391 It is enabled by default.
7392 See also @option{-frecord-gcc-switches} for another
7393 way of storing compiler options into the object file.
7395 @item -gstrict-dwarf
7396 @opindex gstrict-dwarf
7397 Disallow using extensions of later DWARF standard version than selected
7398 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
7399 DWARF extensions from later standard versions is allowed.
7401 @item -gno-strict-dwarf
7402 @opindex gno-strict-dwarf
7403 Allow using extensions of later DWARF standard version than selected with
7404 @option{-gdwarf-@var{version}}.
7406 @item -gas-loc-support
7407 @opindex gas-loc-support
7408 Inform the compiler that the assembler supports @code{.loc} directives.
7409 It may then use them for the assembler to generate DWARF2+ line number
7412 This is generally desirable, because assembler-generated line-number
7413 tables are a lot more compact than those the compiler can generate
7416 This option will be enabled by default if, at GCC configure time, the
7417 assembler was found to support such directives.
7419 @item -gno-as-loc-support
7420 @opindex gno-as-loc-support
7421 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
7422 line number tables are to be generated.
7424 @item gas-locview-support
7425 @opindex gas-locview-support
7426 Inform the compiler that the assembler supports @code{view} assignment
7427 and reset assertion checking in @code{.loc} directives.
7429 This option will be enabled by default if, at GCC configure time, the
7430 assembler was found to support them.
7432 @item gno-as-locview-support
7433 Force GCC to assign view numbers internally, if
7434 @option{-gvariable-location-views} are explicitly requested.
7437 @itemx -gno-column-info
7438 @opindex gcolumn-info
7439 @opindex gno-column-info
7440 Emit location column information into DWARF debugging information, rather
7441 than just file and line.
7442 This option is enabled by default.
7444 @item -gstatement-frontiers
7445 @itemx -gno-statement-frontiers
7446 @opindex gstatement-frontiers
7447 @opindex gno-statement-frontiers
7448 This option causes GCC to create markers in the internal representation
7449 at the beginning of statements, and to keep them roughly in place
7450 throughout compilation, using them to guide the output of @code{is_stmt}
7451 markers in the line number table. This is enabled by default when
7452 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
7453 @dots{}), and outputting DWARF 2 debug information at the normal level.
7455 @item -gvariable-location-views
7456 @itemx -gvariable-location-views=incompat5
7457 @itemx -gno-variable-location-views
7458 @opindex gvariable-location-views
7459 @opindex gvariable-location-views=incompat5
7460 @opindex gno-variable-location-views
7461 Augment variable location lists with progressive view numbers implied
7462 from the line number table. This enables debug information consumers to
7463 inspect state at certain points of the program, even if no instructions
7464 associated with the corresponding source locations are present at that
7465 point. If the assembler lacks support for view numbers in line number
7466 tables, this will cause the compiler to emit the line number table,
7467 which generally makes them somewhat less compact. The augmented line
7468 number tables and location lists are fully backward-compatible, so they
7469 can be consumed by debug information consumers that are not aware of
7470 these augmentations, but they won't derive any benefit from them either.
7472 This is enabled by default when outputting DWARF 2 debug information at
7473 the normal level, as long as there is assembler support,
7474 @option{-fvar-tracking-assignments} is enabled and
7475 @option{-gstrict-dwarf} is not. When assembler support is not
7476 available, this may still be enabled, but it will force GCC to output
7477 internal line number tables, and if
7478 @option{-ginternal-reset-location-views} is not enabled, that will most
7479 certainly lead to silently mismatching location views.
7481 There is a proposed representation for view numbers that is not backward
7482 compatible with the location list format introduced in DWARF 5, that can
7483 be enabled with @option{-gvariable-location-views=incompat5}. This
7484 option may be removed in the future, is only provided as a reference
7485 implementation of the proposed representation. Debug information
7486 consumers are not expected to support this extended format, and they
7487 would be rendered unable to decode location lists using it.
7489 @item -ginternal-reset-location-views
7490 @itemx -gnointernal-reset-location-views
7491 @opindex ginternal-reset-location-views
7492 @opindex gno-internal-reset-location-views
7493 Attempt to determine location views that can be omitted from location
7494 view lists. This requires the compiler to have very accurate insn
7495 length estimates, which isn't always the case, and it may cause
7496 incorrect view lists to be generated silently when using an assembler
7497 that does not support location view lists. The GNU assembler will flag
7498 any such error as a @code{view number mismatch}. This is only enabled
7499 on ports that define a reliable estimation function.
7501 @item -ginline-points
7502 @itemx -gno-inline-points
7503 @opindex ginline-points
7504 @opindex gno-inline-points
7505 Generate extended debug information for inlined functions. Location
7506 view tracking markers are inserted at inlined entry points, so that
7507 address and view numbers can be computed and output in debug
7508 information. This can be enabled independently of location views, in
7509 which case the view numbers won't be output, but it can only be enabled
7510 along with statement frontiers, and it is only enabled by default if
7511 location views are enabled.
7513 @item -gz@r{[}=@var{type}@r{]}
7515 Produce compressed debug sections in DWARF format, if that is supported.
7516 If @var{type} is not given, the default type depends on the capabilities
7517 of the assembler and linker used. @var{type} may be one of
7518 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
7519 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
7520 compression in traditional GNU format). If the linker doesn't support
7521 writing compressed debug sections, the option is rejected. Otherwise,
7522 if the assembler does not support them, @option{-gz} is silently ignored
7523 when producing object files.
7525 @item -femit-struct-debug-baseonly
7526 @opindex femit-struct-debug-baseonly
7527 Emit debug information for struct-like types
7528 only when the base name of the compilation source file
7529 matches the base name of file in which the struct is defined.
7531 This option substantially reduces the size of debugging information,
7532 but at significant potential loss in type information to the debugger.
7533 See @option{-femit-struct-debug-reduced} for a less aggressive option.
7534 See @option{-femit-struct-debug-detailed} for more detailed control.
7536 This option works only with DWARF debug output.
7538 @item -femit-struct-debug-reduced
7539 @opindex femit-struct-debug-reduced
7540 Emit debug information for struct-like types
7541 only when the base name of the compilation source file
7542 matches the base name of file in which the type is defined,
7543 unless the struct is a template or defined in a system header.
7545 This option significantly reduces the size of debugging information,
7546 with some potential loss in type information to the debugger.
7547 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
7548 See @option{-femit-struct-debug-detailed} for more detailed control.
7550 This option works only with DWARF debug output.
7552 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
7553 @opindex femit-struct-debug-detailed
7554 Specify the struct-like types
7555 for which the compiler generates debug information.
7556 The intent is to reduce duplicate struct debug information
7557 between different object files within the same program.
7559 This option is a detailed version of
7560 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
7561 which serves for most needs.
7563 A specification has the syntax@*
7564 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
7566 The optional first word limits the specification to
7567 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
7568 A struct type is used directly when it is the type of a variable, member.
7569 Indirect uses arise through pointers to structs.
7570 That is, when use of an incomplete struct is valid, the use is indirect.
7572 @samp{struct one direct; struct two * indirect;}.
7574 The optional second word limits the specification to
7575 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
7576 Generic structs are a bit complicated to explain.
7577 For C++, these are non-explicit specializations of template classes,
7578 or non-template classes within the above.
7579 Other programming languages have generics,
7580 but @option{-femit-struct-debug-detailed} does not yet implement them.
7582 The third word specifies the source files for those
7583 structs for which the compiler should emit debug information.
7584 The values @samp{none} and @samp{any} have the normal meaning.
7585 The value @samp{base} means that
7586 the base of name of the file in which the type declaration appears
7587 must match the base of the name of the main compilation file.
7588 In practice, this means that when compiling @file{foo.c}, debug information
7589 is generated for types declared in that file and @file{foo.h},
7590 but not other header files.
7591 The value @samp{sys} means those types satisfying @samp{base}
7592 or declared in system or compiler headers.
7594 You may need to experiment to determine the best settings for your application.
7596 The default is @option{-femit-struct-debug-detailed=all}.
7598 This option works only with DWARF debug output.
7600 @item -fno-dwarf2-cfi-asm
7601 @opindex fdwarf2-cfi-asm
7602 @opindex fno-dwarf2-cfi-asm
7603 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
7604 instead of using GAS @code{.cfi_*} directives.
7606 @item -fno-eliminate-unused-debug-types
7607 @opindex feliminate-unused-debug-types
7608 @opindex fno-eliminate-unused-debug-types
7609 Normally, when producing DWARF output, GCC avoids producing debug symbol
7610 output for types that are nowhere used in the source file being compiled.
7611 Sometimes it is useful to have GCC emit debugging
7612 information for all types declared in a compilation
7613 unit, regardless of whether or not they are actually used
7614 in that compilation unit, for example
7615 if, in the debugger, you want to cast a value to a type that is
7616 not actually used in your program (but is declared). More often,
7617 however, this results in a significant amount of wasted space.
7620 @node Optimize Options
7621 @section Options That Control Optimization
7622 @cindex optimize options
7623 @cindex options, optimization
7625 These options control various sorts of optimizations.
7627 Without any optimization option, the compiler's goal is to reduce the
7628 cost of compilation and to make debugging produce the expected
7629 results. Statements are independent: if you stop the program with a
7630 breakpoint between statements, you can then assign a new value to any
7631 variable or change the program counter to any other statement in the
7632 function and get exactly the results you expect from the source
7635 Turning on optimization flags makes the compiler attempt to improve
7636 the performance and/or code size at the expense of compilation time
7637 and possibly the ability to debug the program.
7639 The compiler performs optimization based on the knowledge it has of the
7640 program. Compiling multiple files at once to a single output file mode allows
7641 the compiler to use information gained from all of the files when compiling
7644 Not all optimizations are controlled directly by a flag. Only
7645 optimizations that have a flag are listed in this section.
7647 Most optimizations are only enabled if an @option{-O} level is set on
7648 the command line. Otherwise they are disabled, even if individual
7649 optimization flags are specified.
7651 Depending on the target and how GCC was configured, a slightly different
7652 set of optimizations may be enabled at each @option{-O} level than
7653 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
7654 to find out the exact set of optimizations that are enabled at each level.
7655 @xref{Overall Options}, for examples.
7662 Optimize. Optimizing compilation takes somewhat more time, and a lot
7663 more memory for a large function.
7665 With @option{-O}, the compiler tries to reduce code size and execution
7666 time, without performing any optimizations that take a great deal of
7669 @option{-O} turns on the following optimization flags:
7672 -fbranch-count-reg @gol
7673 -fcombine-stack-adjustments @gol
7675 -fcprop-registers @gol
7678 -fdelayed-branch @gol
7680 -fforward-propagate @gol
7681 -fguess-branch-probability @gol
7682 -fif-conversion2 @gol
7683 -fif-conversion @gol
7684 -finline-functions-called-once @gol
7685 -fipa-pure-const @gol
7687 -fipa-reference @gol
7688 -fmerge-constants @gol
7689 -fmove-loop-invariants @gol
7690 -fomit-frame-pointer @gol
7691 -freorder-blocks @gol
7693 -fshrink-wrap-separate @gol
7694 -fsplit-wide-types @gol
7700 -ftree-coalesce-vars @gol
7701 -ftree-copy-prop @gol
7703 -ftree-dominator-opts @gol
7705 -ftree-forwprop @gol
7717 Optimize even more. GCC performs nearly all supported optimizations
7718 that do not involve a space-speed tradeoff.
7719 As compared to @option{-O}, this option increases both compilation time
7720 and the performance of the generated code.
7722 @option{-O2} turns on all optimization flags specified by @option{-O}. It
7723 also turns on the following optimization flags:
7724 @gccoptlist{-fthread-jumps @gol
7725 -falign-functions -falign-jumps @gol
7726 -falign-loops -falign-labels @gol
7729 -fcse-follow-jumps -fcse-skip-blocks @gol
7730 -fdelete-null-pointer-checks @gol
7731 -fdevirtualize -fdevirtualize-speculatively @gol
7732 -fexpensive-optimizations @gol
7733 -fgcse -fgcse-lm @gol
7734 -fhoist-adjacent-loads @gol
7735 -finline-small-functions @gol
7736 -findirect-inlining @gol
7742 -fisolate-erroneous-paths-dereference @gol
7744 -foptimize-sibling-calls @gol
7745 -foptimize-strlen @gol
7746 -fpartial-inlining @gol
7748 -freorder-blocks-algorithm=stc @gol
7749 -freorder-blocks-and-partition -freorder-functions @gol
7750 -frerun-cse-after-loop @gol
7751 -fsched-interblock -fsched-spec @gol
7752 -fschedule-insns -fschedule-insns2 @gol
7753 -fstore-merging @gol
7754 -fstrict-aliasing @gol
7755 -ftree-builtin-call-dce @gol
7756 -ftree-switch-conversion -ftree-tail-merge @gol
7757 -fcode-hoisting @gol
7762 Please note the warning under @option{-fgcse} about
7763 invoking @option{-O2} on programs that use computed gotos.
7767 Optimize yet more. @option{-O3} turns on all optimizations specified
7768 by @option{-O2} and also turns on the following optimization flags:
7769 @gccoptlist{-finline-functions @gol
7770 -funswitch-loops @gol
7771 -fpredictive-commoning @gol
7772 -fgcse-after-reload @gol
7773 -ftree-loop-vectorize @gol
7774 -ftree-loop-distribution @gol
7775 -ftree-loop-distribute-patterns @gol
7776 -floop-interchange @gol
7777 -floop-unroll-and-jam @gol
7779 -ftree-slp-vectorize @gol
7780 -fvect-cost-model @gol
7781 -ftree-partial-pre @gol
7787 Reduce compilation time and make debugging produce the expected
7788 results. This is the default.
7792 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
7793 do not typically increase code size. It also performs further
7794 optimizations designed to reduce code size.
7796 @option{-Os} disables the following optimization flags:
7797 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
7798 -falign-labels -freorder-blocks -freorder-blocks-algorithm=stc @gol
7799 -freorder-blocks-and-partition -fprefetch-loop-arrays}
7803 Disregard strict standards compliance. @option{-Ofast} enables all
7804 @option{-O3} optimizations. It also enables optimizations that are not
7805 valid for all standard-compliant programs.
7806 It turns on @option{-ffast-math} and the Fortran-specific
7807 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
7808 specified, and @option{-fno-protect-parens}.
7812 Optimize debugging experience. @option{-Og} enables optimizations
7813 that do not interfere with debugging. It should be the optimization
7814 level of choice for the standard edit-compile-debug cycle, offering
7815 a reasonable level of optimization while maintaining fast compilation
7816 and a good debugging experience.
7819 If you use multiple @option{-O} options, with or without level numbers,
7820 the last such option is the one that is effective.
7822 Options of the form @option{-f@var{flag}} specify machine-independent
7823 flags. Most flags have both positive and negative forms; the negative
7824 form of @option{-ffoo} is @option{-fno-foo}. In the table
7825 below, only one of the forms is listed---the one you typically
7826 use. You can figure out the other form by either removing @samp{no-}
7829 The following options control specific optimizations. They are either
7830 activated by @option{-O} options or are related to ones that are. You
7831 can use the following flags in the rare cases when ``fine-tuning'' of
7832 optimizations to be performed is desired.
7835 @item -fno-defer-pop
7836 @opindex fno-defer-pop
7837 Always pop the arguments to each function call as soon as that function
7838 returns. For machines that must pop arguments after a function call,
7839 the compiler normally lets arguments accumulate on the stack for several
7840 function calls and pops them all at once.
7842 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7844 @item -fforward-propagate
7845 @opindex fforward-propagate
7846 Perform a forward propagation pass on RTL@. The pass tries to combine two
7847 instructions and checks if the result can be simplified. If loop unrolling
7848 is active, two passes are performed and the second is scheduled after
7851 This option is enabled by default at optimization levels @option{-O},
7852 @option{-O2}, @option{-O3}, @option{-Os}.
7854 @item -ffp-contract=@var{style}
7855 @opindex ffp-contract
7856 @option{-ffp-contract=off} disables floating-point expression contraction.
7857 @option{-ffp-contract=fast} enables floating-point expression contraction
7858 such as forming of fused multiply-add operations if the target has
7859 native support for them.
7860 @option{-ffp-contract=on} enables floating-point expression contraction
7861 if allowed by the language standard. This is currently not implemented
7862 and treated equal to @option{-ffp-contract=off}.
7864 The default is @option{-ffp-contract=fast}.
7866 @item -fomit-frame-pointer
7867 @opindex fomit-frame-pointer
7868 Omit the frame pointer in functions that don't need one. This avoids the
7869 instructions to save, set up and restore the frame pointer; on many targets
7870 it also makes an extra register available.
7872 On some targets this flag has no effect because the standard calling sequence
7873 always uses a frame pointer, so it cannot be omitted.
7875 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
7876 is used in all functions. Several targets always omit the frame pointer in
7879 Enabled by default at @option{-O} and higher.
7881 @item -foptimize-sibling-calls
7882 @opindex foptimize-sibling-calls
7883 Optimize sibling and tail recursive calls.
7885 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7887 @item -foptimize-strlen
7888 @opindex foptimize-strlen
7889 Optimize various standard C string functions (e.g. @code{strlen},
7890 @code{strchr} or @code{strcpy}) and
7891 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
7893 Enabled at levels @option{-O2}, @option{-O3}.
7897 Do not expand any functions inline apart from those marked with
7898 the @code{always_inline} attribute. This is the default when not
7901 Single functions can be exempted from inlining by marking them
7902 with the @code{noinline} attribute.
7904 @item -finline-small-functions
7905 @opindex finline-small-functions
7906 Integrate functions into their callers when their body is smaller than expected
7907 function call code (so overall size of program gets smaller). The compiler
7908 heuristically decides which functions are simple enough to be worth integrating
7909 in this way. This inlining applies to all functions, even those not declared
7912 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7914 @item -findirect-inlining
7915 @opindex findirect-inlining
7916 Inline also indirect calls that are discovered to be known at compile
7917 time thanks to previous inlining. This option has any effect only
7918 when inlining itself is turned on by the @option{-finline-functions}
7919 or @option{-finline-small-functions} options.
7921 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7923 @item -finline-functions
7924 @opindex finline-functions
7925 Consider all functions for inlining, even if they are not declared inline.
7926 The compiler heuristically decides which functions are worth integrating
7929 If all calls to a given function are integrated, and the function is
7930 declared @code{static}, then the function is normally not output as
7931 assembler code in its own right.
7933 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7935 @item -finline-functions-called-once
7936 @opindex finline-functions-called-once
7937 Consider all @code{static} functions called once for inlining into their
7938 caller even if they are not marked @code{inline}. If a call to a given
7939 function is integrated, then the function is not output as assembler code
7942 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
7944 @item -fearly-inlining
7945 @opindex fearly-inlining
7946 Inline functions marked by @code{always_inline} and functions whose body seems
7947 smaller than the function call overhead early before doing
7948 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
7949 makes profiling significantly cheaper and usually inlining faster on programs
7950 having large chains of nested wrapper functions.
7956 Perform interprocedural scalar replacement of aggregates, removal of
7957 unused parameters and replacement of parameters passed by reference
7958 by parameters passed by value.
7960 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
7962 @item -finline-limit=@var{n}
7963 @opindex finline-limit
7964 By default, GCC limits the size of functions that can be inlined. This flag
7965 allows coarse control of this limit. @var{n} is the size of functions that
7966 can be inlined in number of pseudo instructions.
7968 Inlining is actually controlled by a number of parameters, which may be
7969 specified individually by using @option{--param @var{name}=@var{value}}.
7970 The @option{-finline-limit=@var{n}} option sets some of these parameters
7974 @item max-inline-insns-single
7975 is set to @var{n}/2.
7976 @item max-inline-insns-auto
7977 is set to @var{n}/2.
7980 See below for a documentation of the individual
7981 parameters controlling inlining and for the defaults of these parameters.
7983 @emph{Note:} there may be no value to @option{-finline-limit} that results
7984 in default behavior.
7986 @emph{Note:} pseudo instruction represents, in this particular context, an
7987 abstract measurement of function's size. In no way does it represent a count
7988 of assembly instructions and as such its exact meaning might change from one
7989 release to an another.
7991 @item -fno-keep-inline-dllexport
7992 @opindex fno-keep-inline-dllexport
7993 This is a more fine-grained version of @option{-fkeep-inline-functions},
7994 which applies only to functions that are declared using the @code{dllexport}
7995 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
7998 @item -fkeep-inline-functions
7999 @opindex fkeep-inline-functions
8000 In C, emit @code{static} functions that are declared @code{inline}
8001 into the object file, even if the function has been inlined into all
8002 of its callers. This switch does not affect functions using the
8003 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8004 inline functions into the object file.
8006 @item -fkeep-static-functions
8007 @opindex fkeep-static-functions
8008 Emit @code{static} functions into the object file, even if the function
8011 @item -fkeep-static-consts
8012 @opindex fkeep-static-consts
8013 Emit variables declared @code{static const} when optimization isn't turned
8014 on, even if the variables aren't referenced.
8016 GCC enables this option by default. If you want to force the compiler to
8017 check if a variable is referenced, regardless of whether or not
8018 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8020 @item -fmerge-constants
8021 @opindex fmerge-constants
8022 Attempt to merge identical constants (string constants and floating-point
8023 constants) across compilation units.
8025 This option is the default for optimized compilation if the assembler and
8026 linker support it. Use @option{-fno-merge-constants} to inhibit this
8029 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8031 @item -fmerge-all-constants
8032 @opindex fmerge-all-constants
8033 Attempt to merge identical constants and identical variables.
8035 This option implies @option{-fmerge-constants}. In addition to
8036 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8037 arrays or initialized constant variables with integral or floating-point
8038 types. Languages like C or C++ require each variable, including multiple
8039 instances of the same variable in recursive calls, to have distinct locations,
8040 so using this option results in non-conforming
8043 @item -fmodulo-sched
8044 @opindex fmodulo-sched
8045 Perform swing modulo scheduling immediately before the first scheduling
8046 pass. This pass looks at innermost loops and reorders their
8047 instructions by overlapping different iterations.
8049 @item -fmodulo-sched-allow-regmoves
8050 @opindex fmodulo-sched-allow-regmoves
8051 Perform more aggressive SMS-based modulo scheduling with register moves
8052 allowed. By setting this flag certain anti-dependences edges are
8053 deleted, which triggers the generation of reg-moves based on the
8054 life-range analysis. This option is effective only with
8055 @option{-fmodulo-sched} enabled.
8057 @item -fno-branch-count-reg
8058 @opindex fno-branch-count-reg
8059 Avoid running a pass scanning for opportunities to use ``decrement and
8060 branch'' instructions on a count register instead of generating sequences
8061 of instructions that decrement a register, compare it against zero, and
8062 then branch based upon the result. This option is only meaningful on
8063 architectures that support such instructions, which include x86, PowerPC,
8064 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8065 doesn't remove the decrement and branch instructions from the generated
8066 instruction stream introduced by other optimization passes.
8068 Enabled by default at @option{-O1} and higher.
8070 The default is @option{-fbranch-count-reg}.
8072 @item -fno-function-cse
8073 @opindex fno-function-cse
8074 Do not put function addresses in registers; make each instruction that
8075 calls a constant function contain the function's address explicitly.
8077 This option results in less efficient code, but some strange hacks
8078 that alter the assembler output may be confused by the optimizations
8079 performed when this option is not used.
8081 The default is @option{-ffunction-cse}
8083 @item -fno-zero-initialized-in-bss
8084 @opindex fno-zero-initialized-in-bss
8085 If the target supports a BSS section, GCC by default puts variables that
8086 are initialized to zero into BSS@. This can save space in the resulting
8089 This option turns off this behavior because some programs explicitly
8090 rely on variables going to the data section---e.g., so that the
8091 resulting executable can find the beginning of that section and/or make
8092 assumptions based on that.
8094 The default is @option{-fzero-initialized-in-bss}.
8096 @item -fthread-jumps
8097 @opindex fthread-jumps
8098 Perform optimizations that check to see if a jump branches to a
8099 location where another comparison subsumed by the first is found. If
8100 so, the first branch is redirected to either the destination of the
8101 second branch or a point immediately following it, depending on whether
8102 the condition is known to be true or false.
8104 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8106 @item -fsplit-wide-types
8107 @opindex fsplit-wide-types
8108 When using a type that occupies multiple registers, such as @code{long
8109 long} on a 32-bit system, split the registers apart and allocate them
8110 independently. This normally generates better code for those types,
8111 but may make debugging more difficult.
8113 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8116 @item -fcse-follow-jumps
8117 @opindex fcse-follow-jumps
8118 In common subexpression elimination (CSE), scan through jump instructions
8119 when the target of the jump is not reached by any other path. For
8120 example, when CSE encounters an @code{if} statement with an
8121 @code{else} clause, CSE follows the jump when the condition
8124 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8126 @item -fcse-skip-blocks
8127 @opindex fcse-skip-blocks
8128 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8129 follow jumps that conditionally skip over blocks. When CSE
8130 encounters a simple @code{if} statement with no else clause,
8131 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8132 body of the @code{if}.
8134 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8136 @item -frerun-cse-after-loop
8137 @opindex frerun-cse-after-loop
8138 Re-run common subexpression elimination after loop optimizations are
8141 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8145 Perform a global common subexpression elimination pass.
8146 This pass also performs global constant and copy propagation.
8148 @emph{Note:} When compiling a program using computed gotos, a GCC
8149 extension, you may get better run-time performance if you disable
8150 the global common subexpression elimination pass by adding
8151 @option{-fno-gcse} to the command line.
8153 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8157 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8158 attempts to move loads that are only killed by stores into themselves. This
8159 allows a loop containing a load/store sequence to be changed to a load outside
8160 the loop, and a copy/store within the loop.
8162 Enabled by default when @option{-fgcse} is enabled.
8166 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8167 global common subexpression elimination. This pass attempts to move
8168 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8169 loops containing a load/store sequence can be changed to a load before
8170 the loop and a store after the loop.
8172 Not enabled at any optimization level.
8176 When @option{-fgcse-las} is enabled, the global common subexpression
8177 elimination pass eliminates redundant loads that come after stores to the
8178 same memory location (both partial and full redundancies).
8180 Not enabled at any optimization level.
8182 @item -fgcse-after-reload
8183 @opindex fgcse-after-reload
8184 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8185 pass is performed after reload. The purpose of this pass is to clean up
8188 @item -faggressive-loop-optimizations
8189 @opindex faggressive-loop-optimizations
8190 This option tells the loop optimizer to use language constraints to
8191 derive bounds for the number of iterations of a loop. This assumes that
8192 loop code does not invoke undefined behavior by for example causing signed
8193 integer overflows or out-of-bound array accesses. The bounds for the
8194 number of iterations of a loop are used to guide loop unrolling and peeling
8195 and loop exit test optimizations.
8196 This option is enabled by default.
8198 @item -funconstrained-commons
8199 @opindex funconstrained-commons
8200 This option tells the compiler that variables declared in common blocks
8201 (e.g. Fortran) may later be overridden with longer trailing arrays. This
8202 prevents certain optimizations that depend on knowing the array bounds.
8204 @item -fcrossjumping
8205 @opindex fcrossjumping
8206 Perform cross-jumping transformation.
8207 This transformation unifies equivalent code and saves code size. The
8208 resulting code may or may not perform better than without cross-jumping.
8210 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8212 @item -fauto-inc-dec
8213 @opindex fauto-inc-dec
8214 Combine increments or decrements of addresses with memory accesses.
8215 This pass is always skipped on architectures that do not have
8216 instructions to support this. Enabled by default at @option{-O} and
8217 higher on architectures that support this.
8221 Perform dead code elimination (DCE) on RTL@.
8222 Enabled by default at @option{-O} and higher.
8226 Perform dead store elimination (DSE) on RTL@.
8227 Enabled by default at @option{-O} and higher.
8229 @item -fif-conversion
8230 @opindex fif-conversion
8231 Attempt to transform conditional jumps into branch-less equivalents. This
8232 includes use of conditional moves, min, max, set flags and abs instructions, and
8233 some tricks doable by standard arithmetics. The use of conditional execution
8234 on chips where it is available is controlled by @option{-fif-conversion2}.
8236 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8238 @item -fif-conversion2
8239 @opindex fif-conversion2
8240 Use conditional execution (where available) to transform conditional jumps into
8241 branch-less equivalents.
8243 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8245 @item -fdeclone-ctor-dtor
8246 @opindex fdeclone-ctor-dtor
8247 The C++ ABI requires multiple entry points for constructors and
8248 destructors: one for a base subobject, one for a complete object, and
8249 one for a virtual destructor that calls operator delete afterwards.
8250 For a hierarchy with virtual bases, the base and complete variants are
8251 clones, which means two copies of the function. With this option, the
8252 base and complete variants are changed to be thunks that call a common
8255 Enabled by @option{-Os}.
8257 @item -fdelete-null-pointer-checks
8258 @opindex fdelete-null-pointer-checks
8259 Assume that programs cannot safely dereference null pointers, and that
8260 no code or data element resides at address zero.
8261 This option enables simple constant
8262 folding optimizations at all optimization levels. In addition, other
8263 optimization passes in GCC use this flag to control global dataflow
8264 analyses that eliminate useless checks for null pointers; these assume
8265 that a memory access to address zero always results in a trap, so
8266 that if a pointer is checked after it has already been dereferenced,
8269 Note however that in some environments this assumption is not true.
8270 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8271 for programs that depend on that behavior.
8273 This option is enabled by default on most targets. On Nios II ELF, it
8274 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8276 Passes that use the dataflow information
8277 are enabled independently at different optimization levels.
8279 @item -fdevirtualize
8280 @opindex fdevirtualize
8281 Attempt to convert calls to virtual functions to direct calls. This
8282 is done both within a procedure and interprocedurally as part of
8283 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8284 propagation (@option{-fipa-cp}).
8285 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8287 @item -fdevirtualize-speculatively
8288 @opindex fdevirtualize-speculatively
8289 Attempt to convert calls to virtual functions to speculative direct calls.
8290 Based on the analysis of the type inheritance graph, determine for a given call
8291 the set of likely targets. If the set is small, preferably of size 1, change
8292 the call into a conditional deciding between direct and indirect calls. The
8293 speculative calls enable more optimizations, such as inlining. When they seem
8294 useless after further optimization, they are converted back into original form.
8296 @item -fdevirtualize-at-ltrans
8297 @opindex fdevirtualize-at-ltrans
8298 Stream extra information needed for aggressive devirtualization when running
8299 the link-time optimizer in local transformation mode.
8300 This option enables more devirtualization but
8301 significantly increases the size of streamed data. For this reason it is
8302 disabled by default.
8304 @item -fexpensive-optimizations
8305 @opindex fexpensive-optimizations
8306 Perform a number of minor optimizations that are relatively expensive.
8308 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8312 Attempt to remove redundant extension instructions. This is especially
8313 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8314 registers after writing to their lower 32-bit half.
8316 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8317 @option{-O3}, @option{-Os}.
8319 @item -fno-lifetime-dse
8320 @opindex fno-lifetime-dse
8321 In C++ the value of an object is only affected by changes within its
8322 lifetime: when the constructor begins, the object has an indeterminate
8323 value, and any changes during the lifetime of the object are dead when
8324 the object is destroyed. Normally dead store elimination will take
8325 advantage of this; if your code relies on the value of the object
8326 storage persisting beyond the lifetime of the object, you can use this
8327 flag to disable this optimization. To preserve stores before the
8328 constructor starts (e.g. because your operator new clears the object
8329 storage) but still treat the object as dead after the destructor you,
8330 can use @option{-flifetime-dse=1}. The default behavior can be
8331 explicitly selected with @option{-flifetime-dse=2}.
8332 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8334 @item -flive-range-shrinkage
8335 @opindex flive-range-shrinkage
8336 Attempt to decrease register pressure through register live range
8337 shrinkage. This is helpful for fast processors with small or moderate
8340 @item -fira-algorithm=@var{algorithm}
8341 @opindex fira-algorithm
8342 Use the specified coloring algorithm for the integrated register
8343 allocator. The @var{algorithm} argument can be @samp{priority}, which
8344 specifies Chow's priority coloring, or @samp{CB}, which specifies
8345 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8346 for all architectures, but for those targets that do support it, it is
8347 the default because it generates better code.
8349 @item -fira-region=@var{region}
8350 @opindex fira-region
8351 Use specified regions for the integrated register allocator. The
8352 @var{region} argument should be one of the following:
8357 Use all loops as register allocation regions.
8358 This can give the best results for machines with a small and/or
8359 irregular register set.
8362 Use all loops except for loops with small register pressure
8363 as the regions. This value usually gives
8364 the best results in most cases and for most architectures,
8365 and is enabled by default when compiling with optimization for speed
8366 (@option{-O}, @option{-O2}, @dots{}).
8369 Use all functions as a single region.
8370 This typically results in the smallest code size, and is enabled by default for
8371 @option{-Os} or @option{-O0}.
8375 @item -fira-hoist-pressure
8376 @opindex fira-hoist-pressure
8377 Use IRA to evaluate register pressure in the code hoisting pass for
8378 decisions to hoist expressions. This option usually results in smaller
8379 code, but it can slow the compiler down.
8381 This option is enabled at level @option{-Os} for all targets.
8383 @item -fira-loop-pressure
8384 @opindex fira-loop-pressure
8385 Use IRA to evaluate register pressure in loops for decisions to move
8386 loop invariants. This option usually results in generation
8387 of faster and smaller code on machines with large register files (>= 32
8388 registers), but it can slow the compiler down.
8390 This option is enabled at level @option{-O3} for some targets.
8392 @item -fno-ira-share-save-slots
8393 @opindex fno-ira-share-save-slots
8394 Disable sharing of stack slots used for saving call-used hard
8395 registers living through a call. Each hard register gets a
8396 separate stack slot, and as a result function stack frames are
8399 @item -fno-ira-share-spill-slots
8400 @opindex fno-ira-share-spill-slots
8401 Disable sharing of stack slots allocated for pseudo-registers. Each
8402 pseudo-register that does not get a hard register gets a separate
8403 stack slot, and as a result function stack frames are larger.
8407 Enable CFG-sensitive rematerialization in LRA. Instead of loading
8408 values of spilled pseudos, LRA tries to rematerialize (recalculate)
8409 values if it is profitable.
8411 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8413 @item -fdelayed-branch
8414 @opindex fdelayed-branch
8415 If supported for the target machine, attempt to reorder instructions
8416 to exploit instruction slots available after delayed branch
8419 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8421 @item -fschedule-insns
8422 @opindex fschedule-insns
8423 If supported for the target machine, attempt to reorder instructions to
8424 eliminate execution stalls due to required data being unavailable. This
8425 helps machines that have slow floating point or memory load instructions
8426 by allowing other instructions to be issued until the result of the load
8427 or floating-point instruction is required.
8429 Enabled at levels @option{-O2}, @option{-O3}.
8431 @item -fschedule-insns2
8432 @opindex fschedule-insns2
8433 Similar to @option{-fschedule-insns}, but requests an additional pass of
8434 instruction scheduling after register allocation has been done. This is
8435 especially useful on machines with a relatively small number of
8436 registers and where memory load instructions take more than one cycle.
8438 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8440 @item -fno-sched-interblock
8441 @opindex fno-sched-interblock
8442 Don't schedule instructions across basic blocks. This is normally
8443 enabled by default when scheduling before register allocation, i.e.@:
8444 with @option{-fschedule-insns} or at @option{-O2} or higher.
8446 @item -fno-sched-spec
8447 @opindex fno-sched-spec
8448 Don't allow speculative motion of non-load instructions. This is normally
8449 enabled by default when scheduling before register allocation, i.e.@:
8450 with @option{-fschedule-insns} or at @option{-O2} or higher.
8452 @item -fsched-pressure
8453 @opindex fsched-pressure
8454 Enable register pressure sensitive insn scheduling before register
8455 allocation. This only makes sense when scheduling before register
8456 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
8457 @option{-O2} or higher. Usage of this option can improve the
8458 generated code and decrease its size by preventing register pressure
8459 increase above the number of available hard registers and subsequent
8460 spills in register allocation.
8462 @item -fsched-spec-load
8463 @opindex fsched-spec-load
8464 Allow speculative motion of some load instructions. This only makes
8465 sense when scheduling before register allocation, i.e.@: with
8466 @option{-fschedule-insns} or at @option{-O2} or higher.
8468 @item -fsched-spec-load-dangerous
8469 @opindex fsched-spec-load-dangerous
8470 Allow speculative motion of more load instructions. This only makes
8471 sense when scheduling before register allocation, i.e.@: with
8472 @option{-fschedule-insns} or at @option{-O2} or higher.
8474 @item -fsched-stalled-insns
8475 @itemx -fsched-stalled-insns=@var{n}
8476 @opindex fsched-stalled-insns
8477 Define how many insns (if any) can be moved prematurely from the queue
8478 of stalled insns into the ready list during the second scheduling pass.
8479 @option{-fno-sched-stalled-insns} means that no insns are moved
8480 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
8481 on how many queued insns can be moved prematurely.
8482 @option{-fsched-stalled-insns} without a value is equivalent to
8483 @option{-fsched-stalled-insns=1}.
8485 @item -fsched-stalled-insns-dep
8486 @itemx -fsched-stalled-insns-dep=@var{n}
8487 @opindex fsched-stalled-insns-dep
8488 Define how many insn groups (cycles) are examined for a dependency
8489 on a stalled insn that is a candidate for premature removal from the queue
8490 of stalled insns. This has an effect only during the second scheduling pass,
8491 and only if @option{-fsched-stalled-insns} is used.
8492 @option{-fno-sched-stalled-insns-dep} is equivalent to
8493 @option{-fsched-stalled-insns-dep=0}.
8494 @option{-fsched-stalled-insns-dep} without a value is equivalent to
8495 @option{-fsched-stalled-insns-dep=1}.
8497 @item -fsched2-use-superblocks
8498 @opindex fsched2-use-superblocks
8499 When scheduling after register allocation, use superblock scheduling.
8500 This allows motion across basic block boundaries,
8501 resulting in faster schedules. This option is experimental, as not all machine
8502 descriptions used by GCC model the CPU closely enough to avoid unreliable
8503 results from the algorithm.
8505 This only makes sense when scheduling after register allocation, i.e.@: with
8506 @option{-fschedule-insns2} or at @option{-O2} or higher.
8508 @item -fsched-group-heuristic
8509 @opindex fsched-group-heuristic
8510 Enable the group heuristic in the scheduler. This heuristic favors
8511 the instruction that belongs to a schedule group. This is enabled
8512 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8513 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8515 @item -fsched-critical-path-heuristic
8516 @opindex fsched-critical-path-heuristic
8517 Enable the critical-path heuristic in the scheduler. This heuristic favors
8518 instructions on the critical path. This is enabled by default when
8519 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8520 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8522 @item -fsched-spec-insn-heuristic
8523 @opindex fsched-spec-insn-heuristic
8524 Enable the speculative instruction heuristic in the scheduler. This
8525 heuristic favors speculative instructions with greater dependency weakness.
8526 This is enabled by default when scheduling is enabled, i.e.@:
8527 with @option{-fschedule-insns} or @option{-fschedule-insns2}
8528 or at @option{-O2} or higher.
8530 @item -fsched-rank-heuristic
8531 @opindex fsched-rank-heuristic
8532 Enable the rank heuristic in the scheduler. This heuristic favors
8533 the instruction belonging to a basic block with greater size or frequency.
8534 This is enabled by default when scheduling is enabled, i.e.@:
8535 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8536 at @option{-O2} or higher.
8538 @item -fsched-last-insn-heuristic
8539 @opindex fsched-last-insn-heuristic
8540 Enable the last-instruction heuristic in the scheduler. This heuristic
8541 favors the instruction that is less dependent on the last instruction
8542 scheduled. This is enabled by default when scheduling is enabled,
8543 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8544 at @option{-O2} or higher.
8546 @item -fsched-dep-count-heuristic
8547 @opindex fsched-dep-count-heuristic
8548 Enable the dependent-count heuristic in the scheduler. This heuristic
8549 favors the instruction that has more instructions depending on it.
8550 This is enabled by default when scheduling is enabled, i.e.@:
8551 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8552 at @option{-O2} or higher.
8554 @item -freschedule-modulo-scheduled-loops
8555 @opindex freschedule-modulo-scheduled-loops
8556 Modulo scheduling is performed before traditional scheduling. If a loop
8557 is modulo scheduled, later scheduling passes may change its schedule.
8558 Use this option to control that behavior.
8560 @item -fselective-scheduling
8561 @opindex fselective-scheduling
8562 Schedule instructions using selective scheduling algorithm. Selective
8563 scheduling runs instead of the first scheduler pass.
8565 @item -fselective-scheduling2
8566 @opindex fselective-scheduling2
8567 Schedule instructions using selective scheduling algorithm. Selective
8568 scheduling runs instead of the second scheduler pass.
8570 @item -fsel-sched-pipelining
8571 @opindex fsel-sched-pipelining
8572 Enable software pipelining of innermost loops during selective scheduling.
8573 This option has no effect unless one of @option{-fselective-scheduling} or
8574 @option{-fselective-scheduling2} is turned on.
8576 @item -fsel-sched-pipelining-outer-loops
8577 @opindex fsel-sched-pipelining-outer-loops
8578 When pipelining loops during selective scheduling, also pipeline outer loops.
8579 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
8581 @item -fsemantic-interposition
8582 @opindex fsemantic-interposition
8583 Some object formats, like ELF, allow interposing of symbols by the
8585 This means that for symbols exported from the DSO, the compiler cannot perform
8586 interprocedural propagation, inlining and other optimizations in anticipation
8587 that the function or variable in question may change. While this feature is
8588 useful, for example, to rewrite memory allocation functions by a debugging
8589 implementation, it is expensive in the terms of code quality.
8590 With @option{-fno-semantic-interposition} the compiler assumes that
8591 if interposition happens for functions the overwriting function will have
8592 precisely the same semantics (and side effects).
8593 Similarly if interposition happens
8594 for variables, the constructor of the variable will be the same. The flag
8595 has no effect for functions explicitly declared inline
8596 (where it is never allowed for interposition to change semantics)
8597 and for symbols explicitly declared weak.
8600 @opindex fshrink-wrap
8601 Emit function prologues only before parts of the function that need it,
8602 rather than at the top of the function. This flag is enabled by default at
8603 @option{-O} and higher.
8605 @item -fshrink-wrap-separate
8606 @opindex fshrink-wrap-separate
8607 Shrink-wrap separate parts of the prologue and epilogue separately, so that
8608 those parts are only executed when needed.
8609 This option is on by default, but has no effect unless @option{-fshrink-wrap}
8610 is also turned on and the target supports this.
8612 @item -fcaller-saves
8613 @opindex fcaller-saves
8614 Enable allocation of values to registers that are clobbered by
8615 function calls, by emitting extra instructions to save and restore the
8616 registers around such calls. Such allocation is done only when it
8617 seems to result in better code.
8619 This option is always enabled by default on certain machines, usually
8620 those which have no call-preserved registers to use instead.
8622 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8624 @item -fcombine-stack-adjustments
8625 @opindex fcombine-stack-adjustments
8626 Tracks stack adjustments (pushes and pops) and stack memory references
8627 and then tries to find ways to combine them.
8629 Enabled by default at @option{-O1} and higher.
8633 Use caller save registers for allocation if those registers are not used by
8634 any called function. In that case it is not necessary to save and restore
8635 them around calls. This is only possible if called functions are part of
8636 same compilation unit as current function and they are compiled before it.
8638 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
8639 is disabled if generated code will be instrumented for profiling
8640 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
8641 exactly (this happens on targets that do not expose prologues
8642 and epilogues in RTL).
8644 @item -fconserve-stack
8645 @opindex fconserve-stack
8646 Attempt to minimize stack usage. The compiler attempts to use less
8647 stack space, even if that makes the program slower. This option
8648 implies setting the @option{large-stack-frame} parameter to 100
8649 and the @option{large-stack-frame-growth} parameter to 400.
8651 @item -ftree-reassoc
8652 @opindex ftree-reassoc
8653 Perform reassociation on trees. This flag is enabled by default
8654 at @option{-O} and higher.
8656 @item -fcode-hoisting
8657 @opindex fcode-hoisting
8658 Perform code hoisting. Code hoisting tries to move the
8659 evaluation of expressions executed on all paths to the function exit
8660 as early as possible. This is especially useful as a code size
8661 optimization, but it often helps for code speed as well.
8662 This flag is enabled by default at @option{-O2} and higher.
8666 Perform partial redundancy elimination (PRE) on trees. This flag is
8667 enabled by default at @option{-O2} and @option{-O3}.
8669 @item -ftree-partial-pre
8670 @opindex ftree-partial-pre
8671 Make partial redundancy elimination (PRE) more aggressive. This flag is
8672 enabled by default at @option{-O3}.
8674 @item -ftree-forwprop
8675 @opindex ftree-forwprop
8676 Perform forward propagation on trees. This flag is enabled by default
8677 at @option{-O} and higher.
8681 Perform full redundancy elimination (FRE) on trees. The difference
8682 between FRE and PRE is that FRE only considers expressions
8683 that are computed on all paths leading to the redundant computation.
8684 This analysis is faster than PRE, though it exposes fewer redundancies.
8685 This flag is enabled by default at @option{-O} and higher.
8687 @item -ftree-phiprop
8688 @opindex ftree-phiprop
8689 Perform hoisting of loads from conditional pointers on trees. This
8690 pass is enabled by default at @option{-O} and higher.
8692 @item -fhoist-adjacent-loads
8693 @opindex fhoist-adjacent-loads
8694 Speculatively hoist loads from both branches of an if-then-else if the
8695 loads are from adjacent locations in the same structure and the target
8696 architecture has a conditional move instruction. This flag is enabled
8697 by default at @option{-O2} and higher.
8699 @item -ftree-copy-prop
8700 @opindex ftree-copy-prop
8701 Perform copy propagation on trees. This pass eliminates unnecessary
8702 copy operations. This flag is enabled by default at @option{-O} and
8705 @item -fipa-pure-const
8706 @opindex fipa-pure-const
8707 Discover which functions are pure or constant.
8708 Enabled by default at @option{-O} and higher.
8710 @item -fipa-reference
8711 @opindex fipa-reference
8712 Discover which static variables do not escape the
8714 Enabled by default at @option{-O} and higher.
8718 Perform interprocedural pointer analysis and interprocedural modification
8719 and reference analysis. This option can cause excessive memory and
8720 compile-time usage on large compilation units. It is not enabled by
8721 default at any optimization level.
8724 @opindex fipa-profile
8725 Perform interprocedural profile propagation. The functions called only from
8726 cold functions are marked as cold. Also functions executed once (such as
8727 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
8728 functions and loop less parts of functions executed once are then optimized for
8730 Enabled by default at @option{-O} and higher.
8734 Perform interprocedural constant propagation.
8735 This optimization analyzes the program to determine when values passed
8736 to functions are constants and then optimizes accordingly.
8737 This optimization can substantially increase performance
8738 if the application has constants passed to functions.
8739 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
8741 @item -fipa-cp-clone
8742 @opindex fipa-cp-clone
8743 Perform function cloning to make interprocedural constant propagation stronger.
8744 When enabled, interprocedural constant propagation performs function cloning
8745 when externally visible function can be called with constant arguments.
8746 Because this optimization can create multiple copies of functions,
8747 it may significantly increase code size
8748 (see @option{--param ipcp-unit-growth=@var{value}}).
8749 This flag is enabled by default at @option{-O3}.
8752 @opindex -fipa-bit-cp
8753 When enabled, perform interprocedural bitwise constant
8754 propagation. This flag is enabled by default at @option{-O2}. It
8755 requires that @option{-fipa-cp} is enabled.
8759 When enabled, perform interprocedural propagation of value
8760 ranges. This flag is enabled by default at @option{-O2}. It requires
8761 that @option{-fipa-cp} is enabled.
8765 Perform Identical Code Folding for functions and read-only variables.
8766 The optimization reduces code size and may disturb unwind stacks by replacing
8767 a function by equivalent one with a different name. The optimization works
8768 more effectively with link-time optimization enabled.
8770 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
8771 works on different levels and thus the optimizations are not same - there are
8772 equivalences that are found only by GCC and equivalences found only by Gold.
8774 This flag is enabled by default at @option{-O2} and @option{-Os}.
8776 @item -fisolate-erroneous-paths-dereference
8777 @opindex fisolate-erroneous-paths-dereference
8778 Detect paths that trigger erroneous or undefined behavior due to
8779 dereferencing a null pointer. Isolate those paths from the main control
8780 flow and turn the statement with erroneous or undefined behavior into a trap.
8781 This flag is enabled by default at @option{-O2} and higher and depends on
8782 @option{-fdelete-null-pointer-checks} also being enabled.
8784 @item -fisolate-erroneous-paths-attribute
8785 @opindex fisolate-erroneous-paths-attribute
8786 Detect paths that trigger erroneous or undefined behavior due to a null value
8787 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
8788 attribute. Isolate those paths from the main control flow and turn the
8789 statement with erroneous or undefined behavior into a trap. This is not
8790 currently enabled, but may be enabled by @option{-O2} in the future.
8794 Perform forward store motion on trees. This flag is
8795 enabled by default at @option{-O} and higher.
8797 @item -ftree-bit-ccp
8798 @opindex ftree-bit-ccp
8799 Perform sparse conditional bit constant propagation on trees and propagate
8800 pointer alignment information.
8801 This pass only operates on local scalar variables and is enabled by default
8802 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
8806 Perform sparse conditional constant propagation (CCP) on trees. This
8807 pass only operates on local scalar variables and is enabled by default
8808 at @option{-O} and higher.
8810 @item -fssa-backprop
8811 @opindex fssa-backprop
8812 Propagate information about uses of a value up the definition chain
8813 in order to simplify the definitions. For example, this pass strips
8814 sign operations if the sign of a value never matters. The flag is
8815 enabled by default at @option{-O} and higher.
8818 @opindex fssa-phiopt
8819 Perform pattern matching on SSA PHI nodes to optimize conditional
8820 code. This pass is enabled by default at @option{-O} and higher.
8822 @item -ftree-switch-conversion
8823 @opindex ftree-switch-conversion
8824 Perform conversion of simple initializations in a switch to
8825 initializations from a scalar array. This flag is enabled by default
8826 at @option{-O2} and higher.
8828 @item -ftree-tail-merge
8829 @opindex ftree-tail-merge
8830 Look for identical code sequences. When found, replace one with a jump to the
8831 other. This optimization is known as tail merging or cross jumping. This flag
8832 is enabled by default at @option{-O2} and higher. The compilation time
8834 be limited using @option{max-tail-merge-comparisons} parameter and
8835 @option{max-tail-merge-iterations} parameter.
8839 Perform dead code elimination (DCE) on trees. This flag is enabled by
8840 default at @option{-O} and higher.
8842 @item -ftree-builtin-call-dce
8843 @opindex ftree-builtin-call-dce
8844 Perform conditional dead code elimination (DCE) for calls to built-in functions
8845 that may set @code{errno} but are otherwise free of side effects. This flag is
8846 enabled by default at @option{-O2} and higher if @option{-Os} is not also
8849 @item -ftree-dominator-opts
8850 @opindex ftree-dominator-opts
8851 Perform a variety of simple scalar cleanups (constant/copy
8852 propagation, redundancy elimination, range propagation and expression
8853 simplification) based on a dominator tree traversal. This also
8854 performs jump threading (to reduce jumps to jumps). This flag is
8855 enabled by default at @option{-O} and higher.
8859 Perform dead store elimination (DSE) on trees. A dead store is a store into
8860 a memory location that is later overwritten by another store without
8861 any intervening loads. In this case the earlier store can be deleted. This
8862 flag is enabled by default at @option{-O} and higher.
8866 Perform loop header copying on trees. This is beneficial since it increases
8867 effectiveness of code motion optimizations. It also saves one jump. This flag
8868 is enabled by default at @option{-O} and higher. It is not enabled
8869 for @option{-Os}, since it usually increases code size.
8871 @item -ftree-loop-optimize
8872 @opindex ftree-loop-optimize
8873 Perform loop optimizations on trees. This flag is enabled by default
8874 at @option{-O} and higher.
8876 @item -ftree-loop-linear
8877 @itemx -floop-strip-mine
8879 @opindex ftree-loop-linear
8880 @opindex floop-strip-mine
8881 @opindex floop-block
8882 Perform loop nest optimizations. Same as
8883 @option{-floop-nest-optimize}. To use this code transformation, GCC has
8884 to be configured with @option{--with-isl} to enable the Graphite loop
8885 transformation infrastructure.
8887 @item -fgraphite-identity
8888 @opindex fgraphite-identity
8889 Enable the identity transformation for graphite. For every SCoP we generate
8890 the polyhedral representation and transform it back to gimple. Using
8891 @option{-fgraphite-identity} we can check the costs or benefits of the
8892 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
8893 are also performed by the code generator isl, like index splitting and
8894 dead code elimination in loops.
8896 @item -floop-nest-optimize
8897 @opindex floop-nest-optimize
8898 Enable the isl based loop nest optimizer. This is a generic loop nest
8899 optimizer based on the Pluto optimization algorithms. It calculates a loop
8900 structure optimized for data-locality and parallelism. This option
8903 @item -floop-parallelize-all
8904 @opindex floop-parallelize-all
8905 Use the Graphite data dependence analysis to identify loops that can
8906 be parallelized. Parallelize all the loops that can be analyzed to
8907 not contain loop carried dependences without checking that it is
8908 profitable to parallelize the loops.
8910 @item -ftree-coalesce-vars
8911 @opindex ftree-coalesce-vars
8912 While transforming the program out of the SSA representation, attempt to
8913 reduce copying by coalescing versions of different user-defined
8914 variables, instead of just compiler temporaries. This may severely
8915 limit the ability to debug an optimized program compiled with
8916 @option{-fno-var-tracking-assignments}. In the negated form, this flag
8917 prevents SSA coalescing of user variables. This option is enabled by
8918 default if optimization is enabled, and it does very little otherwise.
8920 @item -ftree-loop-if-convert
8921 @opindex ftree-loop-if-convert
8922 Attempt to transform conditional jumps in the innermost loops to
8923 branch-less equivalents. The intent is to remove control-flow from
8924 the innermost loops in order to improve the ability of the
8925 vectorization pass to handle these loops. This is enabled by default
8926 if vectorization is enabled.
8928 @item -ftree-loop-distribution
8929 @opindex ftree-loop-distribution
8930 Perform loop distribution. This flag can improve cache performance on
8931 big loop bodies and allow further loop optimizations, like
8932 parallelization or vectorization, to take place. For example, the loop
8949 @item -ftree-loop-distribute-patterns
8950 @opindex ftree-loop-distribute-patterns
8951 Perform loop distribution of patterns that can be code generated with
8952 calls to a library. This flag is enabled by default at @option{-O3}.
8954 This pass distributes the initialization loops and generates a call to
8955 memset zero. For example, the loop
8971 and the initialization loop is transformed into a call to memset zero.
8973 @item -floop-interchange
8974 @opindex floop-interchange
8975 Perform loop interchange outside of graphite. This flag can improve cache
8976 performance on loop nest and allow further loop optimizations, like
8977 vectorization, to take place. For example, the loop
8979 for (int i = 0; i < N; i++)
8980 for (int j = 0; j < N; j++)
8981 for (int k = 0; k < N; k++)
8982 c[i][j] = c[i][j] + a[i][k]*b[k][j];
8986 for (int i = 0; i < N; i++)
8987 for (int k = 0; k < N; k++)
8988 for (int j = 0; j < N; j++)
8989 c[i][j] = c[i][j] + a[i][k]*b[k][j];
8991 This flag is enabled by default at @option{-O3}.
8993 @item -floop-unroll-and-jam
8994 @opindex floop-unroll-and-jam
8995 Apply unroll and jam transformations on feasible loops. In a loop
8996 nest this unrolls the outer loop by some factor and fuses the resulting
8997 multiple inner loops. This flag is enabled by default at @option{-O3}.
8999 @item -ftree-loop-im
9000 @opindex ftree-loop-im
9001 Perform loop invariant motion on trees. This pass moves only invariants that
9002 are hard to handle at RTL level (function calls, operations that expand to
9003 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9004 operands of conditions that are invariant out of the loop, so that we can use
9005 just trivial invariantness analysis in loop unswitching. The pass also includes
9008 @item -ftree-loop-ivcanon
9009 @opindex ftree-loop-ivcanon
9010 Create a canonical counter for number of iterations in loops for which
9011 determining number of iterations requires complicated analysis. Later
9012 optimizations then may determine the number easily. Useful especially
9013 in connection with unrolling.
9017 Perform induction variable optimizations (strength reduction, induction
9018 variable merging and induction variable elimination) on trees.
9020 @item -ftree-parallelize-loops=n
9021 @opindex ftree-parallelize-loops
9022 Parallelize loops, i.e., split their iteration space to run in n threads.
9023 This is only possible for loops whose iterations are independent
9024 and can be arbitrarily reordered. The optimization is only
9025 profitable on multiprocessor machines, for loops that are CPU-intensive,
9026 rather than constrained e.g.@: by memory bandwidth. This option
9027 implies @option{-pthread}, and thus is only supported on targets
9028 that have support for @option{-pthread}.
9032 Perform function-local points-to analysis on trees. This flag is
9033 enabled by default at @option{-O} and higher.
9037 Perform scalar replacement of aggregates. This pass replaces structure
9038 references with scalars to prevent committing structures to memory too
9039 early. This flag is enabled by default at @option{-O} and higher.
9041 @item -fstore-merging
9042 @opindex fstore-merging
9043 Perform merging of narrow stores to consecutive memory addresses. This pass
9044 merges contiguous stores of immediate values narrower than a word into fewer
9045 wider stores to reduce the number of instructions. This is enabled by default
9046 at @option{-O2} and higher as well as @option{-Os}.
9050 Perform temporary expression replacement during the SSA->normal phase. Single
9051 use/single def temporaries are replaced at their use location with their
9052 defining expression. This results in non-GIMPLE code, but gives the expanders
9053 much more complex trees to work on resulting in better RTL generation. This is
9054 enabled by default at @option{-O} and higher.
9058 Perform straight-line strength reduction on trees. This recognizes related
9059 expressions involving multiplications and replaces them by less expensive
9060 calculations when possible. This is enabled by default at @option{-O} and
9063 @item -ftree-vectorize
9064 @opindex ftree-vectorize
9065 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9066 and @option{-ftree-slp-vectorize} if not explicitly specified.
9068 @item -ftree-loop-vectorize
9069 @opindex ftree-loop-vectorize
9070 Perform loop vectorization on trees. This flag is enabled by default at
9071 @option{-O3} and when @option{-ftree-vectorize} is enabled.
9073 @item -ftree-slp-vectorize
9074 @opindex ftree-slp-vectorize
9075 Perform basic block vectorization on trees. This flag is enabled by default at
9076 @option{-O3} and when @option{-ftree-vectorize} is enabled.
9078 @item -fvect-cost-model=@var{model}
9079 @opindex fvect-cost-model
9080 Alter the cost model used for vectorization. The @var{model} argument
9081 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9082 With the @samp{unlimited} model the vectorized code-path is assumed
9083 to be profitable while with the @samp{dynamic} model a runtime check
9084 guards the vectorized code-path to enable it only for iteration
9085 counts that will likely execute faster than when executing the original
9086 scalar loop. The @samp{cheap} model disables vectorization of
9087 loops where doing so would be cost prohibitive for example due to
9088 required runtime checks for data dependence or alignment but otherwise
9089 is equal to the @samp{dynamic} model.
9090 The default cost model depends on other optimization flags and is
9091 either @samp{dynamic} or @samp{cheap}.
9093 @item -fsimd-cost-model=@var{model}
9094 @opindex fsimd-cost-model
9095 Alter the cost model used for vectorization of loops marked with the OpenMP
9096 simd directive. The @var{model} argument should be one of
9097 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9098 have the same meaning as described in @option{-fvect-cost-model} and by
9099 default a cost model defined with @option{-fvect-cost-model} is used.
9103 Perform Value Range Propagation on trees. This is similar to the
9104 constant propagation pass, but instead of values, ranges of values are
9105 propagated. This allows the optimizers to remove unnecessary range
9106 checks like array bound checks and null pointer checks. This is
9107 enabled by default at @option{-O2} and higher. Null pointer check
9108 elimination is only done if @option{-fdelete-null-pointer-checks} is
9112 @opindex fsplit-paths
9113 Split paths leading to loop backedges. This can improve dead code
9114 elimination and common subexpression elimination. This is enabled by
9115 default at @option{-O2} and above.
9117 @item -fsplit-ivs-in-unroller
9118 @opindex fsplit-ivs-in-unroller
9119 Enables expression of values of induction variables in later iterations
9120 of the unrolled loop using the value in the first iteration. This breaks
9121 long dependency chains, thus improving efficiency of the scheduling passes.
9123 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9124 same effect. However, that is not reliable in cases where the loop body
9125 is more complicated than a single basic block. It also does not work at all
9126 on some architectures due to restrictions in the CSE pass.
9128 This optimization is enabled by default.
9130 @item -fvariable-expansion-in-unroller
9131 @opindex fvariable-expansion-in-unroller
9132 With this option, the compiler creates multiple copies of some
9133 local variables when unrolling a loop, which can result in superior code.
9135 @item -fpartial-inlining
9136 @opindex fpartial-inlining
9137 Inline parts of functions. This option has any effect only
9138 when inlining itself is turned on by the @option{-finline-functions}
9139 or @option{-finline-small-functions} options.
9141 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9143 @item -fpredictive-commoning
9144 @opindex fpredictive-commoning
9145 Perform predictive commoning optimization, i.e., reusing computations
9146 (especially memory loads and stores) performed in previous
9147 iterations of loops.
9149 This option is enabled at level @option{-O3}.
9151 @item -fprefetch-loop-arrays
9152 @opindex fprefetch-loop-arrays
9153 If supported by the target machine, generate instructions to prefetch
9154 memory to improve the performance of loops that access large arrays.
9156 This option may generate better or worse code; results are highly
9157 dependent on the structure of loops within the source code.
9159 Disabled at level @option{-Os}.
9161 @item -fno-printf-return-value
9162 @opindex fno-printf-return-value
9163 Do not substitute constants for known return value of formatted output
9164 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9165 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9166 transformation allows GCC to optimize or even eliminate branches based
9167 on the known return value of these functions called with arguments that
9168 are either constant, or whose values are known to be in a range that
9169 makes determining the exact return value possible. For example, when
9170 @option{-fprintf-return-value} is in effect, both the branch and the
9171 body of the @code{if} statement (but not the call to @code{snprint})
9172 can be optimized away when @code{i} is a 32-bit or smaller integer
9173 because the return value is guaranteed to be at most 8.
9177 if (snprintf (buf, "%08x", i) >= sizeof buf)
9181 The @option{-fprintf-return-value} option relies on other optimizations
9182 and yields best results with @option{-O2} and above. It works in tandem
9183 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9184 options. The @option{-fprintf-return-value} option is enabled by default.
9187 @itemx -fno-peephole2
9188 @opindex fno-peephole
9189 @opindex fno-peephole2
9190 Disable any machine-specific peephole optimizations. The difference
9191 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9192 are implemented in the compiler; some targets use one, some use the
9193 other, a few use both.
9195 @option{-fpeephole} is enabled by default.
9196 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9198 @item -fno-guess-branch-probability
9199 @opindex fno-guess-branch-probability
9200 Do not guess branch probabilities using heuristics.
9202 GCC uses heuristics to guess branch probabilities if they are
9203 not provided by profiling feedback (@option{-fprofile-arcs}). These
9204 heuristics are based on the control flow graph. If some branch probabilities
9205 are specified by @code{__builtin_expect}, then the heuristics are
9206 used to guess branch probabilities for the rest of the control flow graph,
9207 taking the @code{__builtin_expect} info into account. The interactions
9208 between the heuristics and @code{__builtin_expect} can be complex, and in
9209 some cases, it may be useful to disable the heuristics so that the effects
9210 of @code{__builtin_expect} are easier to understand.
9212 The default is @option{-fguess-branch-probability} at levels
9213 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9215 @item -freorder-blocks
9216 @opindex freorder-blocks
9217 Reorder basic blocks in the compiled function in order to reduce number of
9218 taken branches and improve code locality.
9220 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9222 @item -freorder-blocks-algorithm=@var{algorithm}
9223 @opindex freorder-blocks-algorithm
9224 Use the specified algorithm for basic block reordering. The
9225 @var{algorithm} argument can be @samp{simple}, which does not increase
9226 code size (except sometimes due to secondary effects like alignment),
9227 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9228 put all often executed code together, minimizing the number of branches
9229 executed by making extra copies of code.
9231 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9232 @samp{stc} at levels @option{-O2}, @option{-O3}.
9234 @item -freorder-blocks-and-partition
9235 @opindex freorder-blocks-and-partition
9236 In addition to reordering basic blocks in the compiled function, in order
9237 to reduce number of taken branches, partitions hot and cold basic blocks
9238 into separate sections of the assembly and @file{.o} files, to improve
9239 paging and cache locality performance.
9241 This optimization is automatically turned off in the presence of
9242 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
9243 section attribute and on any architecture that does not support named
9244 sections. When @option{-fsplit-stack} is used this option is not
9245 enabled by default (to avoid linker errors), but may be enabled
9246 explicitly (if using a working linker).
9248 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
9250 @item -freorder-functions
9251 @opindex freorder-functions
9252 Reorder functions in the object file in order to
9253 improve code locality. This is implemented by using special
9254 subsections @code{.text.hot} for most frequently executed functions and
9255 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
9256 the linker so object file format must support named sections and linker must
9257 place them in a reasonable way.
9259 Also profile feedback must be available to make this option effective. See
9260 @option{-fprofile-arcs} for details.
9262 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9264 @item -fstrict-aliasing
9265 @opindex fstrict-aliasing
9266 Allow the compiler to assume the strictest aliasing rules applicable to
9267 the language being compiled. For C (and C++), this activates
9268 optimizations based on the type of expressions. In particular, an
9269 object of one type is assumed never to reside at the same address as an
9270 object of a different type, unless the types are almost the same. For
9271 example, an @code{unsigned int} can alias an @code{int}, but not a
9272 @code{void*} or a @code{double}. A character type may alias any other
9275 @anchor{Type-punning}Pay special attention to code like this:
9288 The practice of reading from a different union member than the one most
9289 recently written to (called ``type-punning'') is common. Even with
9290 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
9291 is accessed through the union type. So, the code above works as
9292 expected. @xref{Structures unions enumerations and bit-fields
9293 implementation}. However, this code might not:
9304 Similarly, access by taking the address, casting the resulting pointer
9305 and dereferencing the result has undefined behavior, even if the cast
9306 uses a union type, e.g.:
9310 return ((union a_union *) &d)->i;
9314 The @option{-fstrict-aliasing} option is enabled at levels
9315 @option{-O2}, @option{-O3}, @option{-Os}.
9317 @item -falign-functions
9318 @itemx -falign-functions=@var{n}
9319 @itemx -falign-functions=@var{n}:@var{m}
9320 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
9321 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
9322 @opindex falign-functions
9323 Align the start of functions to the next power-of-two greater than
9324 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
9325 the first @var{m} bytes of the function can be fetched by the CPU
9326 without crossing an @var{n}-byte alignment boundary.
9328 If @var{m} is not specified, it defaults to @var{n}.
9330 Examples: @option{-falign-functions=32} aligns functions to the next
9331 32-byte boundary, @option{-falign-functions=24} aligns to the next
9332 32-byte boundary only if this can be done by skipping 23 bytes or less,
9333 @option{-falign-functions=32:7} aligns to the next
9334 32-byte boundary only if this can be done by skipping 6 bytes or less.
9336 The second pair of @var{n2}:@var{m2} values allows you to specify
9337 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
9338 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
9339 otherwise aligns to the next 32-byte boundary if this can be done
9340 by skipping 2 bytes or less.
9341 If @var{m2} is not specified, it defaults to @var{n2}.
9343 Some assemblers only support this flag when @var{n} is a power of two;
9344 in that case, it is rounded up.
9346 @option{-fno-align-functions} and @option{-falign-functions=1} are
9347 equivalent and mean that functions are not aligned.
9349 If @var{n} is not specified or is zero, use a machine-dependent default.
9350 The maximum allowed @var{n} option value is 65536.
9352 Enabled at levels @option{-O2}, @option{-O3}.
9354 @item -flimit-function-alignment
9355 If this option is enabled, the compiler tries to avoid unnecessarily
9356 overaligning functions. It attempts to instruct the assembler to align
9357 by the amount specified by @option{-falign-functions}, but not to
9358 skip more bytes than the size of the function.
9360 @item -falign-labels
9361 @itemx -falign-labels=@var{n}
9362 @itemx -falign-labels=@var{n}:@var{m}
9363 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
9364 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
9365 @opindex falign-labels
9366 Align all branch targets to a power-of-two boundary.
9368 Parameters of this option are analogous to the @option{-falign-functions} option.
9369 @option{-fno-align-labels} and @option{-falign-labels=1} are
9370 equivalent and mean that labels are not aligned.
9372 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
9373 are greater than this value, then their values are used instead.
9375 If @var{n} is not specified or is zero, use a machine-dependent default
9376 which is very likely to be @samp{1}, meaning no alignment.
9377 The maximum allowed @var{n} option value is 65536.
9379 Enabled at levels @option{-O2}, @option{-O3}.
9382 @itemx -falign-loops=@var{n}
9383 @itemx -falign-loops=@var{n}:@var{m}
9384 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
9385 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
9386 @opindex falign-loops
9387 Align loops to a power-of-two boundary. If the loops are executed
9388 many times, this makes up for any execution of the dummy padding
9391 Parameters of this option are analogous to the @option{-falign-functions} option.
9392 @option{-fno-align-loops} and @option{-falign-loops=1} are
9393 equivalent and mean that loops are not aligned.
9394 The maximum allowed @var{n} option value is 65536.
9396 If @var{n} is not specified or is zero, use a machine-dependent default.
9398 Enabled at levels @option{-O2}, @option{-O3}.
9401 @itemx -falign-jumps=@var{n}
9402 @itemx -falign-jumps=@var{n}:@var{m}
9403 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
9404 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
9405 @opindex falign-jumps
9406 Align branch targets to a power-of-two boundary, for branch targets
9407 where the targets can only be reached by jumping. In this case,
9408 no dummy operations need be executed.
9410 Parameters of this option are analogous to the @option{-falign-functions} option.
9411 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
9412 equivalent and mean that loops are not aligned.
9414 If @var{n} is not specified or is zero, use a machine-dependent default.
9415 The maximum allowed @var{n} option value is 65536.
9417 Enabled at levels @option{-O2}, @option{-O3}.
9419 @item -funit-at-a-time
9420 @opindex funit-at-a-time
9421 This option is left for compatibility reasons. @option{-funit-at-a-time}
9422 has no effect, while @option{-fno-unit-at-a-time} implies
9423 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
9427 @item -fno-toplevel-reorder
9428 @opindex fno-toplevel-reorder
9429 Do not reorder top-level functions, variables, and @code{asm}
9430 statements. Output them in the same order that they appear in the
9431 input file. When this option is used, unreferenced static variables
9432 are not removed. This option is intended to support existing code
9433 that relies on a particular ordering. For new code, it is better to
9434 use attributes when possible.
9436 Enabled at level @option{-O0}. When disabled explicitly, it also implies
9437 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
9442 Constructs webs as commonly used for register allocation purposes and assign
9443 each web individual pseudo register. This allows the register allocation pass
9444 to operate on pseudos directly, but also strengthens several other optimization
9445 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
9446 however, make debugging impossible, since variables no longer stay in a
9449 Enabled by default with @option{-funroll-loops}.
9451 @item -fwhole-program
9452 @opindex fwhole-program
9453 Assume that the current compilation unit represents the whole program being
9454 compiled. All public functions and variables with the exception of @code{main}
9455 and those merged by attribute @code{externally_visible} become static functions
9456 and in effect are optimized more aggressively by interprocedural optimizers.
9458 This option should not be used in combination with @option{-flto}.
9459 Instead relying on a linker plugin should provide safer and more precise
9462 @item -flto[=@var{n}]
9464 This option runs the standard link-time optimizer. When invoked
9465 with source code, it generates GIMPLE (one of GCC's internal
9466 representations) and writes it to special ELF sections in the object
9467 file. When the object files are linked together, all the function
9468 bodies are read from these ELF sections and instantiated as if they
9469 had been part of the same translation unit.
9471 To use the link-time optimizer, @option{-flto} and optimization
9472 options should be specified at compile time and during the final link.
9473 It is recommended that you compile all the files participating in the
9474 same link with the same options and also specify those options at
9479 gcc -c -O2 -flto foo.c
9480 gcc -c -O2 -flto bar.c
9481 gcc -o myprog -flto -O2 foo.o bar.o
9484 The first two invocations to GCC save a bytecode representation
9485 of GIMPLE into special ELF sections inside @file{foo.o} and
9486 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
9487 @file{foo.o} and @file{bar.o}, merges the two files into a single
9488 internal image, and compiles the result as usual. Since both
9489 @file{foo.o} and @file{bar.o} are merged into a single image, this
9490 causes all the interprocedural analyses and optimizations in GCC to
9491 work across the two files as if they were a single one. This means,
9492 for example, that the inliner is able to inline functions in
9493 @file{bar.o} into functions in @file{foo.o} and vice-versa.
9495 Another (simpler) way to enable link-time optimization is:
9498 gcc -o myprog -flto -O2 foo.c bar.c
9501 The above generates bytecode for @file{foo.c} and @file{bar.c},
9502 merges them together into a single GIMPLE representation and optimizes
9503 them as usual to produce @file{myprog}.
9505 The only important thing to keep in mind is that to enable link-time
9506 optimizations you need to use the GCC driver to perform the link step.
9507 GCC then automatically performs link-time optimization if any of the
9508 objects involved were compiled with the @option{-flto} command-line option.
9510 should specify the optimization options to be used for link-time
9511 optimization though GCC tries to be clever at guessing an
9512 optimization level to use from the options used at compile time
9513 if you fail to specify one at link time. You can always override
9514 the automatic decision to do link-time optimization
9515 by passing @option{-fno-lto} to the link command.
9517 To make whole program optimization effective, it is necessary to make
9518 certain whole program assumptions. The compiler needs to know
9519 what functions and variables can be accessed by libraries and runtime
9520 outside of the link-time optimized unit. When supported by the linker,
9521 the linker plugin (see @option{-fuse-linker-plugin}) passes information
9522 to the compiler about used and externally visible symbols. When
9523 the linker plugin is not available, @option{-fwhole-program} should be
9524 used to allow the compiler to make these assumptions, which leads
9525 to more aggressive optimization decisions.
9527 When @option{-fuse-linker-plugin} is not enabled, when a file is
9528 compiled with @option{-flto}, the generated object file is larger than
9529 a regular object file because it contains GIMPLE bytecodes and the usual
9530 final code (see @option{-ffat-lto-objects}. This means that
9531 object files with LTO information can be linked as normal object
9532 files; if @option{-fno-lto} is passed to the linker, no
9533 interprocedural optimizations are applied. Note that when
9534 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
9535 but you cannot perform a regular, non-LTO link on them.
9537 Additionally, the optimization flags used to compile individual files
9538 are not necessarily related to those used at link time. For instance,
9541 gcc -c -O0 -ffat-lto-objects -flto foo.c
9542 gcc -c -O0 -ffat-lto-objects -flto bar.c
9543 gcc -o myprog -O3 foo.o bar.o
9546 This produces individual object files with unoptimized assembler
9547 code, but the resulting binary @file{myprog} is optimized at
9548 @option{-O3}. If, instead, the final binary is generated with
9549 @option{-fno-lto}, then @file{myprog} is not optimized.
9551 When producing the final binary, GCC only
9552 applies link-time optimizations to those files that contain bytecode.
9553 Therefore, you can mix and match object files and libraries with
9554 GIMPLE bytecodes and final object code. GCC automatically selects
9555 which files to optimize in LTO mode and which files to link without
9558 There are some code generation flags preserved by GCC when
9559 generating bytecodes, as they need to be used during the final link
9560 stage. Generally options specified at link time override those
9561 specified at compile time.
9563 If you do not specify an optimization level option @option{-O} at
9564 link time, then GCC uses the highest optimization level
9565 used when compiling the object files.
9567 Currently, the following options and their settings are taken from
9568 the first object file that explicitly specifies them:
9569 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
9570 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
9571 and all the @option{-m} target flags.
9573 Certain ABI-changing flags are required to match in all compilation units,
9574 and trying to override this at link time with a conflicting value
9575 is ignored. This includes options such as @option{-freg-struct-return}
9576 and @option{-fpcc-struct-return}.
9578 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
9579 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
9580 are passed through to the link stage and merged conservatively for
9581 conflicting translation units. Specifically
9582 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
9583 precedence; and for example @option{-ffp-contract=off} takes precedence
9584 over @option{-ffp-contract=fast}. You can override them at link time.
9586 If LTO encounters objects with C linkage declared with incompatible
9587 types in separate translation units to be linked together (undefined
9588 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
9589 issued. The behavior is still undefined at run time. Similar
9590 diagnostics may be raised for other languages.
9592 Another feature of LTO is that it is possible to apply interprocedural
9593 optimizations on files written in different languages:
9598 gfortran -c -flto baz.f90
9599 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
9602 Notice that the final link is done with @command{g++} to get the C++
9603 runtime libraries and @option{-lgfortran} is added to get the Fortran
9604 runtime libraries. In general, when mixing languages in LTO mode, you
9605 should use the same link command options as when mixing languages in a
9606 regular (non-LTO) compilation.
9608 If object files containing GIMPLE bytecode are stored in a library archive, say
9609 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
9610 are using a linker with plugin support. To create static libraries suitable
9611 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
9612 and @command{ranlib};
9613 to show the symbols of object files with GIMPLE bytecode, use
9614 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
9615 and @command{nm} have been compiled with plugin support. At link time, use the the
9616 flag @option{-fuse-linker-plugin} to ensure that the library participates in
9617 the LTO optimization process:
9620 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
9623 With the linker plugin enabled, the linker extracts the needed
9624 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
9625 to make them part of the aggregated GIMPLE image to be optimized.
9627 If you are not using a linker with plugin support and/or do not
9628 enable the linker plugin, then the objects inside @file{libfoo.a}
9629 are extracted and linked as usual, but they do not participate
9630 in the LTO optimization process. In order to make a static library suitable
9631 for both LTO optimization and usual linkage, compile its object files with
9632 @option{-flto} @option{-ffat-lto-objects}.
9634 Link-time optimizations do not require the presence of the whole program to
9635 operate. If the program does not require any symbols to be exported, it is
9636 possible to combine @option{-flto} and @option{-fwhole-program} to allow
9637 the interprocedural optimizers to use more aggressive assumptions which may
9638 lead to improved optimization opportunities.
9639 Use of @option{-fwhole-program} is not needed when linker plugin is
9640 active (see @option{-fuse-linker-plugin}).
9642 The current implementation of LTO makes no
9643 attempt to generate bytecode that is portable between different
9644 types of hosts. The bytecode files are versioned and there is a
9645 strict version check, so bytecode files generated in one version of
9646 GCC do not work with an older or newer version of GCC.
9648 Link-time optimization does not work well with generation of debugging
9649 information on systems other than those using a combination of ELF and
9652 If you specify the optional @var{n}, the optimization and code
9653 generation done at link time is executed in parallel using @var{n}
9654 parallel jobs by utilizing an installed @command{make} program. The
9655 environment variable @env{MAKE} may be used to override the program
9656 used. The default value for @var{n} is 1.
9658 You can also specify @option{-flto=jobserver} to use GNU make's
9659 job server mode to determine the number of parallel jobs. This
9660 is useful when the Makefile calling GCC is already executing in parallel.
9661 You must prepend a @samp{+} to the command recipe in the parent Makefile
9662 for this to work. This option likely only works if @env{MAKE} is
9665 @item -flto-partition=@var{alg}
9666 @opindex flto-partition
9667 Specify the partitioning algorithm used by the link-time optimizer.
9668 The value is either @samp{1to1} to specify a partitioning mirroring
9669 the original source files or @samp{balanced} to specify partitioning
9670 into equally sized chunks (whenever possible) or @samp{max} to create
9671 new partition for every symbol where possible. Specifying @samp{none}
9672 as an algorithm disables partitioning and streaming completely.
9673 The default value is @samp{balanced}. While @samp{1to1} can be used
9674 as an workaround for various code ordering issues, the @samp{max}
9675 partitioning is intended for internal testing only.
9676 The value @samp{one} specifies that exactly one partition should be
9677 used while the value @samp{none} bypasses partitioning and executes
9678 the link-time optimization step directly from the WPA phase.
9680 @item -flto-odr-type-merging
9681 @opindex flto-odr-type-merging
9682 Enable streaming of mangled types names of C++ types and their unification
9683 at link time. This increases size of LTO object files, but enables
9684 diagnostics about One Definition Rule violations.
9686 @item -flto-compression-level=@var{n}
9687 @opindex flto-compression-level
9688 This option specifies the level of compression used for intermediate
9689 language written to LTO object files, and is only meaningful in
9690 conjunction with LTO mode (@option{-flto}). Valid
9691 values are 0 (no compression) to 9 (maximum compression). Values
9692 outside this range are clamped to either 0 or 9. If the option is not
9693 given, a default balanced compression setting is used.
9695 @item -fuse-linker-plugin
9696 @opindex fuse-linker-plugin
9697 Enables the use of a linker plugin during link-time optimization. This
9698 option relies on plugin support in the linker, which is available in gold
9699 or in GNU ld 2.21 or newer.
9701 This option enables the extraction of object files with GIMPLE bytecode out
9702 of library archives. This improves the quality of optimization by exposing
9703 more code to the link-time optimizer. This information specifies what
9704 symbols can be accessed externally (by non-LTO object or during dynamic
9705 linking). Resulting code quality improvements on binaries (and shared
9706 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
9707 See @option{-flto} for a description of the effect of this flag and how to
9710 This option is enabled by default when LTO support in GCC is enabled
9711 and GCC was configured for use with
9712 a linker supporting plugins (GNU ld 2.21 or newer or gold).
9714 @item -ffat-lto-objects
9715 @opindex ffat-lto-objects
9716 Fat LTO objects are object files that contain both the intermediate language
9717 and the object code. This makes them usable for both LTO linking and normal
9718 linking. This option is effective only when compiling with @option{-flto}
9719 and is ignored at link time.
9721 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
9722 requires the complete toolchain to be aware of LTO. It requires a linker with
9723 linker plugin support for basic functionality. Additionally,
9724 @command{nm}, @command{ar} and @command{ranlib}
9725 need to support linker plugins to allow a full-featured build environment
9726 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
9727 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
9728 to these tools. With non fat LTO makefiles need to be modified to use them.
9730 Note that modern binutils provide plugin auto-load mechanism.
9731 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
9732 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
9733 @command{gcc-ranlib}).
9735 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
9738 @item -fcompare-elim
9739 @opindex fcompare-elim
9740 After register allocation and post-register allocation instruction splitting,
9741 identify arithmetic instructions that compute processor flags similar to a
9742 comparison operation based on that arithmetic. If possible, eliminate the
9743 explicit comparison operation.
9745 This pass only applies to certain targets that cannot explicitly represent
9746 the comparison operation before register allocation is complete.
9748 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9750 @item -fcprop-registers
9751 @opindex fcprop-registers
9752 After register allocation and post-register allocation instruction splitting,
9753 perform a copy-propagation pass to try to reduce scheduling dependencies
9754 and occasionally eliminate the copy.
9756 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9758 @item -fprofile-correction
9759 @opindex fprofile-correction
9760 Profiles collected using an instrumented binary for multi-threaded programs may
9761 be inconsistent due to missed counter updates. When this option is specified,
9762 GCC uses heuristics to correct or smooth out such inconsistencies. By
9763 default, GCC emits an error message when an inconsistent profile is detected.
9766 @itemx -fprofile-use=@var{path}
9767 @opindex fprofile-use
9768 Enable profile feedback-directed optimizations,
9769 and the following optimizations
9770 which are generally profitable only with profile feedback available:
9771 @option{-fbranch-probabilities}, @option{-fvpt},
9772 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9773 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
9775 Before you can use this option, you must first generate profiling information.
9776 @xref{Instrumentation Options}, for information about the
9777 @option{-fprofile-generate} option.
9779 By default, GCC emits an error message if the feedback profiles do not
9780 match the source code. This error can be turned into a warning by using
9781 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
9784 If @var{path} is specified, GCC looks at the @var{path} to find
9785 the profile feedback data files. See @option{-fprofile-dir}.
9787 @item -fauto-profile
9788 @itemx -fauto-profile=@var{path}
9789 @opindex fauto-profile
9790 Enable sampling-based feedback-directed optimizations,
9791 and the following optimizations
9792 which are generally profitable only with profile feedback available:
9793 @option{-fbranch-probabilities}, @option{-fvpt},
9794 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9795 @option{-ftree-vectorize},
9796 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
9797 @option{-fpredictive-commoning}, @option{-funswitch-loops},
9798 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
9800 @var{path} is the name of a file containing AutoFDO profile information.
9801 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
9803 Producing an AutoFDO profile data file requires running your program
9804 with the @command{perf} utility on a supported GNU/Linux target system.
9805 For more information, see @uref{https://perf.wiki.kernel.org/}.
9809 perf record -e br_inst_retired:near_taken -b -o perf.data \
9813 Then use the @command{create_gcov} tool to convert the raw profile data
9814 to a format that can be used by GCC.@ You must also supply the
9815 unstripped binary for your program to this tool.
9816 See @uref{https://github.com/google/autofdo}.
9820 create_gcov --binary=your_program.unstripped --profile=perf.data \
9825 The following options control compiler behavior regarding floating-point
9826 arithmetic. These options trade off between speed and
9827 correctness. All must be specifically enabled.
9831 @opindex ffloat-store
9832 Do not store floating-point variables in registers, and inhibit other
9833 options that might change whether a floating-point value is taken from a
9836 @cindex floating-point precision
9837 This option prevents undesirable excess precision on machines such as
9838 the 68000 where the floating registers (of the 68881) keep more
9839 precision than a @code{double} is supposed to have. Similarly for the
9840 x86 architecture. For most programs, the excess precision does only
9841 good, but a few programs rely on the precise definition of IEEE floating
9842 point. Use @option{-ffloat-store} for such programs, after modifying
9843 them to store all pertinent intermediate computations into variables.
9845 @item -fexcess-precision=@var{style}
9846 @opindex fexcess-precision
9847 This option allows further control over excess precision on machines
9848 where floating-point operations occur in a format with more precision or
9849 range than the IEEE standard and interchange floating-point types. By
9850 default, @option{-fexcess-precision=fast} is in effect; this means that
9851 operations may be carried out in a wider precision than the types specified
9852 in the source if that would result in faster code, and it is unpredictable
9853 when rounding to the types specified in the source code takes place.
9854 When compiling C, if @option{-fexcess-precision=standard} is specified then
9855 excess precision follows the rules specified in ISO C99; in particular,
9856 both casts and assignments cause values to be rounded to their
9857 semantic types (whereas @option{-ffloat-store} only affects
9858 assignments). This option is enabled by default for C if a strict
9859 conformance option such as @option{-std=c99} is used.
9860 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
9861 regardless of whether a strict conformance option is used.
9864 @option{-fexcess-precision=standard} is not implemented for languages
9865 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
9866 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
9867 semantics apply without excess precision, and in the latter, rounding
9872 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
9873 @option{-ffinite-math-only}, @option{-fno-rounding-math},
9874 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
9875 @option{-fexcess-precision=fast}.
9877 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
9879 This option is not turned on by any @option{-O} option besides
9880 @option{-Ofast} since it can result in incorrect output for programs
9881 that depend on an exact implementation of IEEE or ISO rules/specifications
9882 for math functions. It may, however, yield faster code for programs
9883 that do not require the guarantees of these specifications.
9885 @item -fno-math-errno
9886 @opindex fno-math-errno
9887 Do not set @code{errno} after calling math functions that are executed
9888 with a single instruction, e.g., @code{sqrt}. A program that relies on
9889 IEEE exceptions for math error handling may want to use this flag
9890 for speed while maintaining IEEE arithmetic compatibility.
9892 This option is not turned on by any @option{-O} option since
9893 it can result in incorrect output for programs that depend on
9894 an exact implementation of IEEE or ISO rules/specifications for
9895 math functions. It may, however, yield faster code for programs
9896 that do not require the guarantees of these specifications.
9898 The default is @option{-fmath-errno}.
9900 On Darwin systems, the math library never sets @code{errno}. There is
9901 therefore no reason for the compiler to consider the possibility that
9902 it might, and @option{-fno-math-errno} is the default.
9904 @item -funsafe-math-optimizations
9905 @opindex funsafe-math-optimizations
9907 Allow optimizations for floating-point arithmetic that (a) assume
9908 that arguments and results are valid and (b) may violate IEEE or
9909 ANSI standards. When used at link time, it may include libraries
9910 or startup files that change the default FPU control word or other
9911 similar optimizations.
9913 This option is not turned on by any @option{-O} option since
9914 it can result in incorrect output for programs that depend on
9915 an exact implementation of IEEE or ISO rules/specifications for
9916 math functions. It may, however, yield faster code for programs
9917 that do not require the guarantees of these specifications.
9918 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
9919 @option{-fassociative-math} and @option{-freciprocal-math}.
9921 The default is @option{-fno-unsafe-math-optimizations}.
9923 @item -fassociative-math
9924 @opindex fassociative-math
9926 Allow re-association of operands in series of floating-point operations.
9927 This violates the ISO C and C++ language standard by possibly changing
9928 computation result. NOTE: re-ordering may change the sign of zero as
9929 well as ignore NaNs and inhibit or create underflow or overflow (and
9930 thus cannot be used on code that relies on rounding behavior like
9931 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
9932 and thus may not be used when ordered comparisons are required.
9933 This option requires that both @option{-fno-signed-zeros} and
9934 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
9935 much sense with @option{-frounding-math}. For Fortran the option
9936 is automatically enabled when both @option{-fno-signed-zeros} and
9937 @option{-fno-trapping-math} are in effect.
9939 The default is @option{-fno-associative-math}.
9941 @item -freciprocal-math
9942 @opindex freciprocal-math
9944 Allow the reciprocal of a value to be used instead of dividing by
9945 the value if this enables optimizations. For example @code{x / y}
9946 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
9947 is subject to common subexpression elimination. Note that this loses
9948 precision and increases the number of flops operating on the value.
9950 The default is @option{-fno-reciprocal-math}.
9952 @item -ffinite-math-only
9953 @opindex ffinite-math-only
9954 Allow optimizations for floating-point arithmetic that assume
9955 that arguments and results are not NaNs or +-Infs.
9957 This option is not turned on by any @option{-O} option since
9958 it can result in incorrect output for programs that depend on
9959 an exact implementation of IEEE or ISO rules/specifications for
9960 math functions. It may, however, yield faster code for programs
9961 that do not require the guarantees of these specifications.
9963 The default is @option{-fno-finite-math-only}.
9965 @item -fno-signed-zeros
9966 @opindex fno-signed-zeros
9967 Allow optimizations for floating-point arithmetic that ignore the
9968 signedness of zero. IEEE arithmetic specifies the behavior of
9969 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
9970 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
9971 This option implies that the sign of a zero result isn't significant.
9973 The default is @option{-fsigned-zeros}.
9975 @item -fno-trapping-math
9976 @opindex fno-trapping-math
9977 Compile code assuming that floating-point operations cannot generate
9978 user-visible traps. These traps include division by zero, overflow,
9979 underflow, inexact result and invalid operation. This option requires
9980 that @option{-fno-signaling-nans} be in effect. Setting this option may
9981 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
9983 This option should never be turned on by any @option{-O} option since
9984 it can result in incorrect output for programs that depend on
9985 an exact implementation of IEEE or ISO rules/specifications for
9988 The default is @option{-ftrapping-math}.
9990 @item -frounding-math
9991 @opindex frounding-math
9992 Disable transformations and optimizations that assume default floating-point
9993 rounding behavior. This is round-to-zero for all floating point
9994 to integer conversions, and round-to-nearest for all other arithmetic
9995 truncations. This option should be specified for programs that change
9996 the FP rounding mode dynamically, or that may be executed with a
9997 non-default rounding mode. This option disables constant folding of
9998 floating-point expressions at compile time (which may be affected by
9999 rounding mode) and arithmetic transformations that are unsafe in the
10000 presence of sign-dependent rounding modes.
10002 The default is @option{-fno-rounding-math}.
10004 This option is experimental and does not currently guarantee to
10005 disable all GCC optimizations that are affected by rounding mode.
10006 Future versions of GCC may provide finer control of this setting
10007 using C99's @code{FENV_ACCESS} pragma. This command-line option
10008 will be used to specify the default state for @code{FENV_ACCESS}.
10010 @item -fsignaling-nans
10011 @opindex fsignaling-nans
10012 Compile code assuming that IEEE signaling NaNs may generate user-visible
10013 traps during floating-point operations. Setting this option disables
10014 optimizations that may change the number of exceptions visible with
10015 signaling NaNs. This option implies @option{-ftrapping-math}.
10017 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10020 The default is @option{-fno-signaling-nans}.
10022 This option is experimental and does not currently guarantee to
10023 disable all GCC optimizations that affect signaling NaN behavior.
10025 @item -fno-fp-int-builtin-inexact
10026 @opindex fno-fp-int-builtin-inexact
10027 Do not allow the built-in functions @code{ceil}, @code{floor},
10028 @code{round} and @code{trunc}, and their @code{float} and @code{long
10029 double} variants, to generate code that raises the ``inexact''
10030 floating-point exception for noninteger arguments. ISO C99 and C11
10031 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10032 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
10033 functions to do so.
10035 The default is @option{-ffp-int-builtin-inexact}, allowing the
10036 exception to be raised. This option does nothing unless
10037 @option{-ftrapping-math} is in effect.
10039 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10040 generate a call to a library function then the ``inexact'' exception
10041 may be raised if the library implementation does not follow TS 18661.
10043 @item -fsingle-precision-constant
10044 @opindex fsingle-precision-constant
10045 Treat floating-point constants as single precision instead of
10046 implicitly converting them to double-precision constants.
10048 @item -fcx-limited-range
10049 @opindex fcx-limited-range
10050 When enabled, this option states that a range reduction step is not
10051 needed when performing complex division. Also, there is no checking
10052 whether the result of a complex multiplication or division is @code{NaN
10053 + I*NaN}, with an attempt to rescue the situation in that case. The
10054 default is @option{-fno-cx-limited-range}, but is enabled by
10055 @option{-ffast-math}.
10057 This option controls the default setting of the ISO C99
10058 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10061 @item -fcx-fortran-rules
10062 @opindex fcx-fortran-rules
10063 Complex multiplication and division follow Fortran rules. Range
10064 reduction is done as part of complex division, but there is no checking
10065 whether the result of a complex multiplication or division is @code{NaN
10066 + I*NaN}, with an attempt to rescue the situation in that case.
10068 The default is @option{-fno-cx-fortran-rules}.
10072 The following options control optimizations that may improve
10073 performance, but are not enabled by any @option{-O} options. This
10074 section includes experimental options that may produce broken code.
10077 @item -fbranch-probabilities
10078 @opindex fbranch-probabilities
10079 After running a program compiled with @option{-fprofile-arcs}
10080 (@pxref{Instrumentation Options}),
10081 you can compile it a second time using
10082 @option{-fbranch-probabilities}, to improve optimizations based on
10083 the number of times each branch was taken. When a program
10084 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10085 counts to a file called @file{@var{sourcename}.gcda} for each source
10086 file. The information in this data file is very dependent on the
10087 structure of the generated code, so you must use the same source code
10088 and the same optimization options for both compilations.
10090 With @option{-fbranch-probabilities}, GCC puts a
10091 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10092 These can be used to improve optimization. Currently, they are only
10093 used in one place: in @file{reorg.c}, instead of guessing which path a
10094 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10095 exactly determine which path is taken more often.
10097 @item -fprofile-values
10098 @opindex fprofile-values
10099 If combined with @option{-fprofile-arcs}, it adds code so that some
10100 data about values of expressions in the program is gathered.
10102 With @option{-fbranch-probabilities}, it reads back the data gathered
10103 from profiling values of expressions for usage in optimizations.
10105 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
10107 @item -fprofile-reorder-functions
10108 @opindex fprofile-reorder-functions
10109 Function reordering based on profile instrumentation collects
10110 first time of execution of a function and orders these functions
10111 in ascending order.
10113 Enabled with @option{-fprofile-use}.
10117 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10118 to add code to gather information about values of expressions.
10120 With @option{-fbranch-probabilities}, it reads back the data gathered
10121 and actually performs the optimizations based on them.
10122 Currently the optimizations include specialization of division operations
10123 using the knowledge about the value of the denominator.
10125 @item -frename-registers
10126 @opindex frename-registers
10127 Attempt to avoid false dependencies in scheduled code by making use
10128 of registers left over after register allocation. This optimization
10129 most benefits processors with lots of registers. Depending on the
10130 debug information format adopted by the target, however, it can
10131 make debugging impossible, since variables no longer stay in
10132 a ``home register''.
10134 Enabled by default with @option{-funroll-loops}.
10136 @item -fschedule-fusion
10137 @opindex fschedule-fusion
10138 Performs a target dependent pass over the instruction stream to schedule
10139 instructions of same type together because target machine can execute them
10140 more efficiently if they are adjacent to each other in the instruction flow.
10142 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10146 Perform tail duplication to enlarge superblock size. This transformation
10147 simplifies the control flow of the function allowing other optimizations to do
10150 Enabled with @option{-fprofile-use}.
10152 @item -funroll-loops
10153 @opindex funroll-loops
10154 Unroll loops whose number of iterations can be determined at compile time or
10155 upon entry to the loop. @option{-funroll-loops} implies
10156 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10157 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10158 a small constant number of iterations). This option makes code larger, and may
10159 or may not make it run faster.
10161 Enabled with @option{-fprofile-use}.
10163 @item -funroll-all-loops
10164 @opindex funroll-all-loops
10165 Unroll all loops, even if their number of iterations is uncertain when
10166 the loop is entered. This usually makes programs run more slowly.
10167 @option{-funroll-all-loops} implies the same options as
10168 @option{-funroll-loops}.
10171 @opindex fpeel-loops
10172 Peels loops for which there is enough information that they do not
10173 roll much (from profile feedback or static analysis). It also turns on
10174 complete loop peeling (i.e.@: complete removal of loops with small constant
10175 number of iterations).
10177 Enabled with @option{-O3} and/or @option{-fprofile-use}.
10179 @item -fmove-loop-invariants
10180 @opindex fmove-loop-invariants
10181 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10182 at level @option{-O1}
10184 @item -fsplit-loops
10185 @opindex fsplit-loops
10186 Split a loop into two if it contains a condition that's always true
10187 for one side of the iteration space and false for the other.
10189 @item -funswitch-loops
10190 @opindex funswitch-loops
10191 Move branches with loop invariant conditions out of the loop, with duplicates
10192 of the loop on both branches (modified according to result of the condition).
10194 @item -ffunction-sections
10195 @itemx -fdata-sections
10196 @opindex ffunction-sections
10197 @opindex fdata-sections
10198 Place each function or data item into its own section in the output
10199 file if the target supports arbitrary sections. The name of the
10200 function or the name of the data item determines the section's name
10201 in the output file.
10203 Use these options on systems where the linker can perform optimizations to
10204 improve locality of reference in the instruction space. Most systems using the
10205 ELF object format have linkers with such optimizations. On AIX, the linker
10206 rearranges sections (CSECTs) based on the call graph. The performance impact
10209 Together with a linker garbage collection (linker @option{--gc-sections}
10210 option) these options may lead to smaller statically-linked executables (after
10213 On ELF/DWARF systems these options do not degenerate the quality of the debug
10214 information. There could be issues with other object files/debug info formats.
10216 Only use these options when there are significant benefits from doing so. When
10217 you specify these options, the assembler and linker create larger object and
10218 executable files and are also slower. These options affect code generation.
10219 They prevent optimizations by the compiler and assembler using relative
10220 locations inside a translation unit since the locations are unknown until
10221 link time. An example of such an optimization is relaxing calls to short call
10224 @item -fbranch-target-load-optimize
10225 @opindex fbranch-target-load-optimize
10226 Perform branch target register load optimization before prologue / epilogue
10228 The use of target registers can typically be exposed only during reload,
10229 thus hoisting loads out of loops and doing inter-block scheduling needs
10230 a separate optimization pass.
10232 @item -fbranch-target-load-optimize2
10233 @opindex fbranch-target-load-optimize2
10234 Perform branch target register load optimization after prologue / epilogue
10237 @item -fbtr-bb-exclusive
10238 @opindex fbtr-bb-exclusive
10239 When performing branch target register load optimization, don't reuse
10240 branch target registers within any basic block.
10243 @opindex fstdarg-opt
10244 Optimize the prologue of variadic argument functions with respect to usage of
10247 @item -fsection-anchors
10248 @opindex fsection-anchors
10249 Try to reduce the number of symbolic address calculations by using
10250 shared ``anchor'' symbols to address nearby objects. This transformation
10251 can help to reduce the number of GOT entries and GOT accesses on some
10254 For example, the implementation of the following function @code{foo}:
10257 static int a, b, c;
10258 int foo (void) @{ return a + b + c; @}
10262 usually calculates the addresses of all three variables, but if you
10263 compile it with @option{-fsection-anchors}, it accesses the variables
10264 from a common anchor point instead. The effect is similar to the
10265 following pseudocode (which isn't valid C):
10270 register int *xr = &x;
10271 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
10275 Not all targets support this option.
10277 @item --param @var{name}=@var{value}
10279 In some places, GCC uses various constants to control the amount of
10280 optimization that is done. For example, GCC does not inline functions
10281 that contain more than a certain number of instructions. You can
10282 control some of these constants on the command line using the
10283 @option{--param} option.
10285 The names of specific parameters, and the meaning of the values, are
10286 tied to the internals of the compiler, and are subject to change
10287 without notice in future releases.
10289 In each case, the @var{value} is an integer. The allowable choices for
10293 @item predictable-branch-outcome
10294 When branch is predicted to be taken with probability lower than this threshold
10295 (in percent), then it is considered well predictable. The default is 10.
10297 @item max-rtl-if-conversion-insns
10298 RTL if-conversion tries to remove conditional branches around a block and
10299 replace them with conditionally executed instructions. This parameter
10300 gives the maximum number of instructions in a block which should be
10301 considered for if-conversion. The default is 10, though the compiler will
10302 also use other heuristics to decide whether if-conversion is likely to be
10305 @item max-rtl-if-conversion-predictable-cost
10306 @itemx max-rtl-if-conversion-unpredictable-cost
10307 RTL if-conversion will try to remove conditional branches around a block
10308 and replace them with conditionally executed instructions. These parameters
10309 give the maximum permissible cost for the sequence that would be generated
10310 by if-conversion depending on whether the branch is statically determined
10311 to be predictable or not. The units for this parameter are the same as
10312 those for the GCC internal seq_cost metric. The compiler will try to
10313 provide a reasonable default for this parameter using the BRANCH_COST
10316 @item max-crossjump-edges
10317 The maximum number of incoming edges to consider for cross-jumping.
10318 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
10319 the number of edges incoming to each block. Increasing values mean
10320 more aggressive optimization, making the compilation time increase with
10321 probably small improvement in executable size.
10323 @item min-crossjump-insns
10324 The minimum number of instructions that must be matched at the end
10325 of two blocks before cross-jumping is performed on them. This
10326 value is ignored in the case where all instructions in the block being
10327 cross-jumped from are matched. The default value is 5.
10329 @item max-grow-copy-bb-insns
10330 The maximum code size expansion factor when copying basic blocks
10331 instead of jumping. The expansion is relative to a jump instruction.
10332 The default value is 8.
10334 @item max-goto-duplication-insns
10335 The maximum number of instructions to duplicate to a block that jumps
10336 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
10337 passes, GCC factors computed gotos early in the compilation process,
10338 and unfactors them as late as possible. Only computed jumps at the
10339 end of a basic blocks with no more than max-goto-duplication-insns are
10340 unfactored. The default value is 8.
10342 @item max-delay-slot-insn-search
10343 The maximum number of instructions to consider when looking for an
10344 instruction to fill a delay slot. If more than this arbitrary number of
10345 instructions are searched, the time savings from filling the delay slot
10346 are minimal, so stop searching. Increasing values mean more
10347 aggressive optimization, making the compilation time increase with probably
10348 small improvement in execution time.
10350 @item max-delay-slot-live-search
10351 When trying to fill delay slots, the maximum number of instructions to
10352 consider when searching for a block with valid live register
10353 information. Increasing this arbitrarily chosen value means more
10354 aggressive optimization, increasing the compilation time. This parameter
10355 should be removed when the delay slot code is rewritten to maintain the
10356 control-flow graph.
10358 @item max-gcse-memory
10359 The approximate maximum amount of memory that can be allocated in
10360 order to perform the global common subexpression elimination
10361 optimization. If more memory than specified is required, the
10362 optimization is not done.
10364 @item max-gcse-insertion-ratio
10365 If the ratio of expression insertions to deletions is larger than this value
10366 for any expression, then RTL PRE inserts or removes the expression and thus
10367 leaves partially redundant computations in the instruction stream. The default value is 20.
10369 @item max-pending-list-length
10370 The maximum number of pending dependencies scheduling allows
10371 before flushing the current state and starting over. Large functions
10372 with few branches or calls can create excessively large lists which
10373 needlessly consume memory and resources.
10375 @item max-modulo-backtrack-attempts
10376 The maximum number of backtrack attempts the scheduler should make
10377 when modulo scheduling a loop. Larger values can exponentially increase
10380 @item max-inline-insns-single
10381 Several parameters control the tree inliner used in GCC@.
10382 This number sets the maximum number of instructions (counted in GCC's
10383 internal representation) in a single function that the tree inliner
10384 considers for inlining. This only affects functions declared
10385 inline and methods implemented in a class declaration (C++).
10386 The default value is 400.
10388 @item max-inline-insns-auto
10389 When you use @option{-finline-functions} (included in @option{-O3}),
10390 a lot of functions that would otherwise not be considered for inlining
10391 by the compiler are investigated. To those functions, a different
10392 (more restrictive) limit compared to functions declared inline can
10394 The default value is 30.
10396 @item inline-min-speedup
10397 When estimated performance improvement of caller + callee runtime exceeds this
10398 threshold (in percent), the function can be inlined regardless of the limit on
10399 @option{--param max-inline-insns-single} and @option{--param
10400 max-inline-insns-auto}.
10401 The default value is 15.
10403 @item large-function-insns
10404 The limit specifying really large functions. For functions larger than this
10405 limit after inlining, inlining is constrained by
10406 @option{--param large-function-growth}. This parameter is useful primarily
10407 to avoid extreme compilation time caused by non-linear algorithms used by the
10409 The default value is 2700.
10411 @item large-function-growth
10412 Specifies maximal growth of large function caused by inlining in percents.
10413 The default value is 100 which limits large function growth to 2.0 times
10416 @item large-unit-insns
10417 The limit specifying large translation unit. Growth caused by inlining of
10418 units larger than this limit is limited by @option{--param inline-unit-growth}.
10419 For small units this might be too tight.
10420 For example, consider a unit consisting of function A
10421 that is inline and B that just calls A three times. If B is small relative to
10422 A, the growth of unit is 300\% and yet such inlining is very sane. For very
10423 large units consisting of small inlineable functions, however, the overall unit
10424 growth limit is needed to avoid exponential explosion of code size. Thus for
10425 smaller units, the size is increased to @option{--param large-unit-insns}
10426 before applying @option{--param inline-unit-growth}. The default is 10000.
10428 @item inline-unit-growth
10429 Specifies maximal overall growth of the compilation unit caused by inlining.
10430 The default value is 20 which limits unit growth to 1.2 times the original
10431 size. Cold functions (either marked cold via an attribute or by profile
10432 feedback) are not accounted into the unit size.
10434 @item ipcp-unit-growth
10435 Specifies maximal overall growth of the compilation unit caused by
10436 interprocedural constant propagation. The default value is 10 which limits
10437 unit growth to 1.1 times the original size.
10439 @item large-stack-frame
10440 The limit specifying large stack frames. While inlining the algorithm is trying
10441 to not grow past this limit too much. The default value is 256 bytes.
10443 @item large-stack-frame-growth
10444 Specifies maximal growth of large stack frames caused by inlining in percents.
10445 The default value is 1000 which limits large stack frame growth to 11 times
10448 @item max-inline-insns-recursive
10449 @itemx max-inline-insns-recursive-auto
10450 Specifies the maximum number of instructions an out-of-line copy of a
10451 self-recursive inline
10452 function can grow into by performing recursive inlining.
10454 @option{--param max-inline-insns-recursive} applies to functions
10456 For functions not declared inline, recursive inlining
10457 happens only when @option{-finline-functions} (included in @option{-O3}) is
10458 enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The
10459 default value is 450.
10461 @item max-inline-recursive-depth
10462 @itemx max-inline-recursive-depth-auto
10463 Specifies the maximum recursion depth used for recursive inlining.
10465 @option{--param max-inline-recursive-depth} applies to functions
10466 declared inline. For functions not declared inline, recursive inlining
10467 happens only when @option{-finline-functions} (included in @option{-O3}) is
10468 enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The
10469 default value is 8.
10471 @item min-inline-recursive-probability
10472 Recursive inlining is profitable only for function having deep recursion
10473 in average and can hurt for function having little recursion depth by
10474 increasing the prologue size or complexity of function body to other
10477 When profile feedback is available (see @option{-fprofile-generate}) the actual
10478 recursion depth can be guessed from the probability that function recurses
10479 via a given call expression. This parameter limits inlining only to call
10480 expressions whose probability exceeds the given threshold (in percents).
10481 The default value is 10.
10483 @item early-inlining-insns
10484 Specify growth that the early inliner can make. In effect it increases
10485 the amount of inlining for code having a large abstraction penalty.
10486 The default value is 14.
10488 @item max-early-inliner-iterations
10489 Limit of iterations of the early inliner. This basically bounds
10490 the number of nested indirect calls the early inliner can resolve.
10491 Deeper chains are still handled by late inlining.
10493 @item comdat-sharing-probability
10494 Probability (in percent) that C++ inline function with comdat visibility
10495 are shared across multiple compilation units. The default value is 20.
10497 @item profile-func-internal-id
10498 A parameter to control whether to use function internal id in profile
10499 database lookup. If the value is 0, the compiler uses an id that
10500 is based on function assembler name and filename, which makes old profile
10501 data more tolerant to source changes such as function reordering etc.
10502 The default value is 0.
10504 @item min-vect-loop-bound
10505 The minimum number of iterations under which loops are not vectorized
10506 when @option{-ftree-vectorize} is used. The number of iterations after
10507 vectorization needs to be greater than the value specified by this option
10508 to allow vectorization. The default value is 0.
10510 @item gcse-cost-distance-ratio
10511 Scaling factor in calculation of maximum distance an expression
10512 can be moved by GCSE optimizations. This is currently supported only in the
10513 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
10514 is with simple expressions, i.e., the expressions that have cost
10515 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
10516 hoisting of simple expressions. The default value is 10.
10518 @item gcse-unrestricted-cost
10519 Cost, roughly measured as the cost of a single typical machine
10520 instruction, at which GCSE optimizations do not constrain
10521 the distance an expression can travel. This is currently
10522 supported only in the code hoisting pass. The lesser the cost,
10523 the more aggressive code hoisting is. Specifying 0
10524 allows all expressions to travel unrestricted distances.
10525 The default value is 3.
10527 @item max-hoist-depth
10528 The depth of search in the dominator tree for expressions to hoist.
10529 This is used to avoid quadratic behavior in hoisting algorithm.
10530 The value of 0 does not limit on the search, but may slow down compilation
10531 of huge functions. The default value is 30.
10533 @item max-tail-merge-comparisons
10534 The maximum amount of similar bbs to compare a bb with. This is used to
10535 avoid quadratic behavior in tree tail merging. The default value is 10.
10537 @item max-tail-merge-iterations
10538 The maximum amount of iterations of the pass over the function. This is used to
10539 limit compilation time in tree tail merging. The default value is 2.
10541 @item store-merging-allow-unaligned
10542 Allow the store merging pass to introduce unaligned stores if it is legal to
10543 do so. The default value is 1.
10545 @item max-stores-to-merge
10546 The maximum number of stores to attempt to merge into wider stores in the store
10547 merging pass. The minimum value is 2 and the default is 64.
10549 @item max-unrolled-insns
10550 The maximum number of instructions that a loop may have to be unrolled.
10551 If a loop is unrolled, this parameter also determines how many times
10552 the loop code is unrolled.
10554 @item max-average-unrolled-insns
10555 The maximum number of instructions biased by probabilities of their execution
10556 that a loop may have to be unrolled. If a loop is unrolled,
10557 this parameter also determines how many times the loop code is unrolled.
10559 @item max-unroll-times
10560 The maximum number of unrollings of a single loop.
10562 @item max-peeled-insns
10563 The maximum number of instructions that a loop may have to be peeled.
10564 If a loop is peeled, this parameter also determines how many times
10565 the loop code is peeled.
10567 @item max-peel-times
10568 The maximum number of peelings of a single loop.
10570 @item max-peel-branches
10571 The maximum number of branches on the hot path through the peeled sequence.
10573 @item max-completely-peeled-insns
10574 The maximum number of insns of a completely peeled loop.
10576 @item max-completely-peel-times
10577 The maximum number of iterations of a loop to be suitable for complete peeling.
10579 @item max-completely-peel-loop-nest-depth
10580 The maximum depth of a loop nest suitable for complete peeling.
10582 @item max-unswitch-insns
10583 The maximum number of insns of an unswitched loop.
10585 @item max-unswitch-level
10586 The maximum number of branches unswitched in a single loop.
10588 @item max-loop-headers-insns
10589 The maximum number of insns in loop header duplicated by the copy loop headers
10592 @item lim-expensive
10593 The minimum cost of an expensive expression in the loop invariant motion.
10595 @item iv-consider-all-candidates-bound
10596 Bound on number of candidates for induction variables, below which
10597 all candidates are considered for each use in induction variable
10598 optimizations. If there are more candidates than this,
10599 only the most relevant ones are considered to avoid quadratic time complexity.
10601 @item iv-max-considered-uses
10602 The induction variable optimizations give up on loops that contain more
10603 induction variable uses.
10605 @item iv-always-prune-cand-set-bound
10606 If the number of candidates in the set is smaller than this value,
10607 always try to remove unnecessary ivs from the set
10608 when adding a new one.
10610 @item avg-loop-niter
10611 Average number of iterations of a loop.
10613 @item dse-max-object-size
10614 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
10615 Larger values may result in larger compilation times.
10617 @item dse-max-alias-queries-per-store
10618 Maximum number of queries into the alias oracle per store.
10619 Larger values result in larger compilation times and may result in more
10620 removed dead stores.
10622 @item scev-max-expr-size
10623 Bound on size of expressions used in the scalar evolutions analyzer.
10624 Large expressions slow the analyzer.
10626 @item scev-max-expr-complexity
10627 Bound on the complexity of the expressions in the scalar evolutions analyzer.
10628 Complex expressions slow the analyzer.
10630 @item max-tree-if-conversion-phi-args
10631 Maximum number of arguments in a PHI supported by TREE if conversion
10632 unless the loop is marked with simd pragma.
10634 @item vect-max-version-for-alignment-checks
10635 The maximum number of run-time checks that can be performed when
10636 doing loop versioning for alignment in the vectorizer.
10638 @item vect-max-version-for-alias-checks
10639 The maximum number of run-time checks that can be performed when
10640 doing loop versioning for alias in the vectorizer.
10642 @item vect-max-peeling-for-alignment
10643 The maximum number of loop peels to enhance access alignment
10644 for vectorizer. Value -1 means no limit.
10646 @item max-iterations-to-track
10647 The maximum number of iterations of a loop the brute-force algorithm
10648 for analysis of the number of iterations of the loop tries to evaluate.
10650 @item hot-bb-count-ws-permille
10651 A basic block profile count is considered hot if it contributes to
10652 the given permillage (i.e. 0...1000) of the entire profiled execution.
10654 @item hot-bb-frequency-fraction
10655 Select fraction of the entry block frequency of executions of basic block in
10656 function given basic block needs to have to be considered hot.
10658 @item max-predicted-iterations
10659 The maximum number of loop iterations we predict statically. This is useful
10660 in cases where a function contains a single loop with known bound and
10661 another loop with unknown bound.
10662 The known number of iterations is predicted correctly, while
10663 the unknown number of iterations average to roughly 10. This means that the
10664 loop without bounds appears artificially cold relative to the other one.
10666 @item builtin-expect-probability
10667 Control the probability of the expression having the specified value. This
10668 parameter takes a percentage (i.e. 0 ... 100) as input.
10669 The default probability of 90 is obtained empirically.
10671 @item builtin-string-cmp-inline-length
10672 The maximum length of a constant string for a builtin string cmp call
10673 eligible for inlining.
10674 The default value is 3.
10676 @item align-threshold
10678 Select fraction of the maximal frequency of executions of a basic block in
10679 a function to align the basic block.
10681 @item align-loop-iterations
10683 A loop expected to iterate at least the selected number of iterations is
10686 @item tracer-dynamic-coverage
10687 @itemx tracer-dynamic-coverage-feedback
10689 This value is used to limit superblock formation once the given percentage of
10690 executed instructions is covered. This limits unnecessary code size
10693 The @option{tracer-dynamic-coverage-feedback} parameter
10694 is used only when profile
10695 feedback is available. The real profiles (as opposed to statically estimated
10696 ones) are much less balanced allowing the threshold to be larger value.
10698 @item tracer-max-code-growth
10699 Stop tail duplication once code growth has reached given percentage. This is
10700 a rather artificial limit, as most of the duplicates are eliminated later in
10701 cross jumping, so it may be set to much higher values than is the desired code
10704 @item tracer-min-branch-ratio
10706 Stop reverse growth when the reverse probability of best edge is less than this
10707 threshold (in percent).
10709 @item tracer-min-branch-probability
10710 @itemx tracer-min-branch-probability-feedback
10712 Stop forward growth if the best edge has probability lower than this
10715 Similarly to @option{tracer-dynamic-coverage} two parameters are
10716 provided. @option{tracer-min-branch-probability-feedback} is used for
10717 compilation with profile feedback and @option{tracer-min-branch-probability}
10718 compilation without. The value for compilation with profile feedback
10719 needs to be more conservative (higher) in order to make tracer
10722 @item stack-clash-protection-guard-size
10723 Specify the size of the operating system provided stack guard as
10724 2 raised to @var{num} bytes. The default value is 12 (4096 bytes).
10725 Acceptable values are between 12 and 30. Higher values may reduce the
10726 number of explicit probes, but a value larger than the operating system
10727 provided guard will leave code vulnerable to stack clash style attacks.
10729 @item stack-clash-protection-probe-interval
10730 Stack clash protection involves probing stack space as it is allocated. This
10731 param controls the maximum distance between probes into the stack as 2 raised
10732 to @var{num} bytes. Acceptable values are between 10 and 16 and defaults to
10733 12. Higher values may reduce the number of explicit probes, but a value
10734 larger than the operating system provided guard will leave code vulnerable to
10735 stack clash style attacks.
10737 @item max-cse-path-length
10739 The maximum number of basic blocks on path that CSE considers.
10742 @item max-cse-insns
10743 The maximum number of instructions CSE processes before flushing.
10744 The default is 1000.
10746 @item ggc-min-expand
10748 GCC uses a garbage collector to manage its own memory allocation. This
10749 parameter specifies the minimum percentage by which the garbage
10750 collector's heap should be allowed to expand between collections.
10751 Tuning this may improve compilation speed; it has no effect on code
10754 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
10755 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
10756 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
10757 GCC is not able to calculate RAM on a particular platform, the lower
10758 bound of 30% is used. Setting this parameter and
10759 @option{ggc-min-heapsize} to zero causes a full collection to occur at
10760 every opportunity. This is extremely slow, but can be useful for
10763 @item ggc-min-heapsize
10765 Minimum size of the garbage collector's heap before it begins bothering
10766 to collect garbage. The first collection occurs after the heap expands
10767 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
10768 tuning this may improve compilation speed, and has no effect on code
10771 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
10772 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
10773 with a lower bound of 4096 (four megabytes) and an upper bound of
10774 131072 (128 megabytes). If GCC is not able to calculate RAM on a
10775 particular platform, the lower bound is used. Setting this parameter
10776 very large effectively disables garbage collection. Setting this
10777 parameter and @option{ggc-min-expand} to zero causes a full collection
10778 to occur at every opportunity.
10780 @item max-reload-search-insns
10781 The maximum number of instruction reload should look backward for equivalent
10782 register. Increasing values mean more aggressive optimization, making the
10783 compilation time increase with probably slightly better performance.
10784 The default value is 100.
10786 @item max-cselib-memory-locations
10787 The maximum number of memory locations cselib should take into account.
10788 Increasing values mean more aggressive optimization, making the compilation time
10789 increase with probably slightly better performance. The default value is 500.
10791 @item max-sched-ready-insns
10792 The maximum number of instructions ready to be issued the scheduler should
10793 consider at any given time during the first scheduling pass. Increasing
10794 values mean more thorough searches, making the compilation time increase
10795 with probably little benefit. The default value is 100.
10797 @item max-sched-region-blocks
10798 The maximum number of blocks in a region to be considered for
10799 interblock scheduling. The default value is 10.
10801 @item max-pipeline-region-blocks
10802 The maximum number of blocks in a region to be considered for
10803 pipelining in the selective scheduler. The default value is 15.
10805 @item max-sched-region-insns
10806 The maximum number of insns in a region to be considered for
10807 interblock scheduling. The default value is 100.
10809 @item max-pipeline-region-insns
10810 The maximum number of insns in a region to be considered for
10811 pipelining in the selective scheduler. The default value is 200.
10813 @item min-spec-prob
10814 The minimum probability (in percents) of reaching a source block
10815 for interblock speculative scheduling. The default value is 40.
10817 @item max-sched-extend-regions-iters
10818 The maximum number of iterations through CFG to extend regions.
10819 A value of 0 (the default) disables region extensions.
10821 @item max-sched-insn-conflict-delay
10822 The maximum conflict delay for an insn to be considered for speculative motion.
10823 The default value is 3.
10825 @item sched-spec-prob-cutoff
10826 The minimal probability of speculation success (in percents), so that
10827 speculative insns are scheduled.
10828 The default value is 40.
10830 @item sched-state-edge-prob-cutoff
10831 The minimum probability an edge must have for the scheduler to save its
10833 The default value is 10.
10835 @item sched-mem-true-dep-cost
10836 Minimal distance (in CPU cycles) between store and load targeting same
10837 memory locations. The default value is 1.
10839 @item selsched-max-lookahead
10840 The maximum size of the lookahead window of selective scheduling. It is a
10841 depth of search for available instructions.
10842 The default value is 50.
10844 @item selsched-max-sched-times
10845 The maximum number of times that an instruction is scheduled during
10846 selective scheduling. This is the limit on the number of iterations
10847 through which the instruction may be pipelined. The default value is 2.
10849 @item selsched-insns-to-rename
10850 The maximum number of best instructions in the ready list that are considered
10851 for renaming in the selective scheduler. The default value is 2.
10854 The minimum value of stage count that swing modulo scheduler
10855 generates. The default value is 2.
10857 @item max-last-value-rtl
10858 The maximum size measured as number of RTLs that can be recorded in an expression
10859 in combiner for a pseudo register as last known value of that register. The default
10862 @item max-combine-insns
10863 The maximum number of instructions the RTL combiner tries to combine.
10864 The default value is 2 at @option{-Og} and 4 otherwise.
10866 @item integer-share-limit
10867 Small integer constants can use a shared data structure, reducing the
10868 compiler's memory usage and increasing its speed. This sets the maximum
10869 value of a shared integer constant. The default value is 256.
10871 @item ssp-buffer-size
10872 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
10873 protection when @option{-fstack-protection} is used.
10875 @item min-size-for-stack-sharing
10876 The minimum size of variables taking part in stack slot sharing when not
10877 optimizing. The default value is 32.
10879 @item max-jump-thread-duplication-stmts
10880 Maximum number of statements allowed in a block that needs to be
10881 duplicated when threading jumps.
10883 @item max-fields-for-field-sensitive
10884 Maximum number of fields in a structure treated in
10885 a field sensitive manner during pointer analysis. The default is zero
10886 for @option{-O0} and @option{-O1},
10887 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
10889 @item prefetch-latency
10890 Estimate on average number of instructions that are executed before
10891 prefetch finishes. The distance prefetched ahead is proportional
10892 to this constant. Increasing this number may also lead to less
10893 streams being prefetched (see @option{simultaneous-prefetches}).
10895 @item simultaneous-prefetches
10896 Maximum number of prefetches that can run at the same time.
10898 @item l1-cache-line-size
10899 The size of cache line in L1 cache, in bytes.
10901 @item l1-cache-size
10902 The size of L1 cache, in kilobytes.
10904 @item l2-cache-size
10905 The size of L2 cache, in kilobytes.
10907 @item prefetch-dynamic-strides
10908 Whether the loop array prefetch pass should issue software prefetch hints
10909 for strides that are non-constant. In some cases this may be
10910 beneficial, though the fact the stride is non-constant may make it
10911 hard to predict when there is clear benefit to issuing these hints.
10913 Set to 1, the default, if the prefetch hints should be issued for non-constant
10914 strides. Set to 0 if prefetch hints should be issued only for strides that
10915 are known to be constant and below @option{prefetch-minimum-stride}.
10917 @item prefetch-minimum-stride
10918 Minimum constant stride, in bytes, to start using prefetch hints for. If
10919 the stride is less than this threshold, prefetch hints will not be issued.
10921 This setting is useful for processors that have hardware prefetchers, in
10922 which case there may be conflicts between the hardware prefetchers and
10923 the software prefetchers. If the hardware prefetchers have a maximum
10924 stride they can handle, it should be used here to improve the use of
10925 software prefetchers.
10927 A value of -1, the default, means we don't have a threshold and therefore
10928 prefetch hints can be issued for any constant stride.
10930 This setting is only useful for strides that are known and constant.
10932 @item loop-interchange-max-num-stmts
10933 The maximum number of stmts in a loop to be interchanged.
10935 @item loop-interchange-stride-ratio
10936 The minimum ratio between stride of two loops for interchange to be profitable.
10938 @item min-insn-to-prefetch-ratio
10939 The minimum ratio between the number of instructions and the
10940 number of prefetches to enable prefetching in a loop.
10942 @item prefetch-min-insn-to-mem-ratio
10943 The minimum ratio between the number of instructions and the
10944 number of memory references to enable prefetching in a loop.
10946 @item use-canonical-types
10947 Whether the compiler should use the ``canonical'' type system. By
10948 default, this should always be 1, which uses a more efficient internal
10949 mechanism for comparing types in C++ and Objective-C++. However, if
10950 bugs in the canonical type system are causing compilation failures,
10951 set this value to 0 to disable canonical types.
10953 @item switch-conversion-max-branch-ratio
10954 Switch initialization conversion refuses to create arrays that are
10955 bigger than @option{switch-conversion-max-branch-ratio} times the number of
10956 branches in the switch.
10958 @item max-partial-antic-length
10959 Maximum length of the partial antic set computed during the tree
10960 partial redundancy elimination optimization (@option{-ftree-pre}) when
10961 optimizing at @option{-O3} and above. For some sorts of source code
10962 the enhanced partial redundancy elimination optimization can run away,
10963 consuming all of the memory available on the host machine. This
10964 parameter sets a limit on the length of the sets that are computed,
10965 which prevents the runaway behavior. Setting a value of 0 for
10966 this parameter allows an unlimited set length.
10968 @item sccvn-max-scc-size
10969 Maximum size of a strongly connected component (SCC) during SCCVN
10970 processing. If this limit is hit, SCCVN processing for the whole
10971 function is not done and optimizations depending on it are
10972 disabled. The default maximum SCC size is 10000.
10974 @item sccvn-max-alias-queries-per-access
10975 Maximum number of alias-oracle queries we perform when looking for
10976 redundancies for loads and stores. If this limit is hit the search
10977 is aborted and the load or store is not considered redundant. The
10978 number of queries is algorithmically limited to the number of
10979 stores on all paths from the load to the function entry.
10980 The default maximum number of queries is 1000.
10982 @item ira-max-loops-num
10983 IRA uses regional register allocation by default. If a function
10984 contains more loops than the number given by this parameter, only at most
10985 the given number of the most frequently-executed loops form regions
10986 for regional register allocation. The default value of the
10989 @item ira-max-conflict-table-size
10990 Although IRA uses a sophisticated algorithm to compress the conflict
10991 table, the table can still require excessive amounts of memory for
10992 huge functions. If the conflict table for a function could be more
10993 than the size in MB given by this parameter, the register allocator
10994 instead uses a faster, simpler, and lower-quality
10995 algorithm that does not require building a pseudo-register conflict table.
10996 The default value of the parameter is 2000.
10998 @item ira-loop-reserved-regs
10999 IRA can be used to evaluate more accurate register pressure in loops
11000 for decisions to move loop invariants (see @option{-O3}). The number
11001 of available registers reserved for some other purposes is given
11002 by this parameter. The default value of the parameter is 2, which is
11003 the minimal number of registers needed by typical instructions.
11004 This value is the best found from numerous experiments.
11006 @item lra-inheritance-ebb-probability-cutoff
11007 LRA tries to reuse values reloaded in registers in subsequent insns.
11008 This optimization is called inheritance. EBB is used as a region to
11009 do this optimization. The parameter defines a minimal fall-through
11010 edge probability in percentage used to add BB to inheritance EBB in
11011 LRA. The default value of the parameter is 40. The value was chosen
11012 from numerous runs of SPEC2000 on x86-64.
11014 @item loop-invariant-max-bbs-in-loop
11015 Loop invariant motion can be very expensive, both in compilation time and
11016 in amount of needed compile-time memory, with very large loops. Loops
11017 with more basic blocks than this parameter won't have loop invariant
11018 motion optimization performed on them. The default value of the
11019 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
11021 @item loop-max-datarefs-for-datadeps
11022 Building data dependencies is expensive for very large loops. This
11023 parameter limits the number of data references in loops that are
11024 considered for data dependence analysis. These large loops are no
11025 handled by the optimizations using loop data dependencies.
11026 The default value is 1000.
11028 @item max-vartrack-size
11029 Sets a maximum number of hash table slots to use during variable
11030 tracking dataflow analysis of any function. If this limit is exceeded
11031 with variable tracking at assignments enabled, analysis for that
11032 function is retried without it, after removing all debug insns from
11033 the function. If the limit is exceeded even without debug insns, var
11034 tracking analysis is completely disabled for the function. Setting
11035 the parameter to zero makes it unlimited.
11037 @item max-vartrack-expr-depth
11038 Sets a maximum number of recursion levels when attempting to map
11039 variable names or debug temporaries to value expressions. This trades
11040 compilation time for more complete debug information. If this is set too
11041 low, value expressions that are available and could be represented in
11042 debug information may end up not being used; setting this higher may
11043 enable the compiler to find more complex debug expressions, but compile
11044 time and memory use may grow. The default is 12.
11046 @item max-debug-marker-count
11047 Sets a threshold on the number of debug markers (e.g. begin stmt
11048 markers) to avoid complexity explosion at inlining or expanding to RTL.
11049 If a function has more such gimple stmts than the set limit, such stmts
11050 will be dropped from the inlined copy of a function, and from its RTL
11051 expansion. The default is 100000.
11053 @item min-nondebug-insn-uid
11054 Use uids starting at this parameter for nondebug insns. The range below
11055 the parameter is reserved exclusively for debug insns created by
11056 @option{-fvar-tracking-assignments}, but debug insns may get
11057 (non-overlapping) uids above it if the reserved range is exhausted.
11059 @item ipa-sra-ptr-growth-factor
11060 IPA-SRA replaces a pointer to an aggregate with one or more new
11061 parameters only when their cumulative size is less or equal to
11062 @option{ipa-sra-ptr-growth-factor} times the size of the original
11065 @item sra-max-scalarization-size-Ospeed
11066 @itemx sra-max-scalarization-size-Osize
11067 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11068 replace scalar parts of aggregates with uses of independent scalar
11069 variables. These parameters control the maximum size, in storage units,
11070 of aggregate which is considered for replacement when compiling for
11072 (@option{sra-max-scalarization-size-Ospeed}) or size
11073 (@option{sra-max-scalarization-size-Osize}) respectively.
11075 @item tm-max-aggregate-size
11076 When making copies of thread-local variables in a transaction, this
11077 parameter specifies the size in bytes after which variables are
11078 saved with the logging functions as opposed to save/restore code
11079 sequence pairs. This option only applies when using
11082 @item graphite-max-nb-scop-params
11083 To avoid exponential effects in the Graphite loop transforms, the
11084 number of parameters in a Static Control Part (SCoP) is bounded. The
11085 default value is 10 parameters, a value of zero can be used to lift
11086 the bound. A variable whose value is unknown at compilation time and
11087 defined outside a SCoP is a parameter of the SCoP.
11089 @item loop-block-tile-size
11090 Loop blocking or strip mining transforms, enabled with
11091 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11092 loop in the loop nest by a given number of iterations. The strip
11093 length can be changed using the @option{loop-block-tile-size}
11094 parameter. The default value is 51 iterations.
11096 @item loop-unroll-jam-size
11097 Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The
11098 default value is 4.
11100 @item loop-unroll-jam-depth
11101 Specify the dimension to be unrolled (counting from the most inner loop)
11102 for the @option{-floop-unroll-and-jam}. The default value is 2.
11104 @item ipa-cp-value-list-size
11105 IPA-CP attempts to track all possible values and types passed to a function's
11106 parameter in order to propagate them and perform devirtualization.
11107 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11108 stores per one formal parameter of a function.
11110 @item ipa-cp-eval-threshold
11111 IPA-CP calculates its own score of cloning profitability heuristics
11112 and performs those cloning opportunities with scores that exceed
11113 @option{ipa-cp-eval-threshold}.
11115 @item ipa-cp-recursion-penalty
11116 Percentage penalty the recursive functions will receive when they
11117 are evaluated for cloning.
11119 @item ipa-cp-single-call-penalty
11120 Percentage penalty functions containing a single call to another
11121 function will receive when they are evaluated for cloning.
11124 @item ipa-max-agg-items
11125 IPA-CP is also capable to propagate a number of scalar values passed
11126 in an aggregate. @option{ipa-max-agg-items} controls the maximum
11127 number of such values per one parameter.
11129 @item ipa-cp-loop-hint-bonus
11130 When IPA-CP determines that a cloning candidate would make the number
11131 of iterations of a loop known, it adds a bonus of
11132 @option{ipa-cp-loop-hint-bonus} to the profitability score of
11135 @item ipa-cp-array-index-hint-bonus
11136 When IPA-CP determines that a cloning candidate would make the index of
11137 an array access known, it adds a bonus of
11138 @option{ipa-cp-array-index-hint-bonus} to the profitability
11139 score of the candidate.
11141 @item ipa-max-aa-steps
11142 During its analysis of function bodies, IPA-CP employs alias analysis
11143 in order to track values pointed to by function parameters. In order
11144 not spend too much time analyzing huge functions, it gives up and
11145 consider all memory clobbered after examining
11146 @option{ipa-max-aa-steps} statements modifying memory.
11148 @item lto-partitions
11149 Specify desired number of partitions produced during WHOPR compilation.
11150 The number of partitions should exceed the number of CPUs used for compilation.
11151 The default value is 32.
11153 @item lto-min-partition
11154 Size of minimal partition for WHOPR (in estimated instructions).
11155 This prevents expenses of splitting very small programs into too many
11158 @item lto-max-partition
11159 Size of max partition for WHOPR (in estimated instructions).
11160 to provide an upper bound for individual size of partition.
11161 Meant to be used only with balanced partitioning.
11163 @item cxx-max-namespaces-for-diagnostic-help
11164 The maximum number of namespaces to consult for suggestions when C++
11165 name lookup fails for an identifier. The default is 1000.
11167 @item sink-frequency-threshold
11168 The maximum relative execution frequency (in percents) of the target block
11169 relative to a statement's original block to allow statement sinking of a
11170 statement. Larger numbers result in more aggressive statement sinking.
11171 The default value is 75. A small positive adjustment is applied for
11172 statements with memory operands as those are even more profitable so sink.
11174 @item max-stores-to-sink
11175 The maximum number of conditional store pairs that can be sunk. Set to 0
11176 if either vectorization (@option{-ftree-vectorize}) or if-conversion
11177 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
11179 @item allow-store-data-races
11180 Allow optimizers to introduce new data races on stores.
11181 Set to 1 to allow, otherwise to 0. This option is enabled by default
11182 at optimization level @option{-Ofast}.
11184 @item case-values-threshold
11185 The smallest number of different values for which it is best to use a
11186 jump-table instead of a tree of conditional branches. If the value is
11187 0, use the default for the machine. The default is 0.
11189 @item tree-reassoc-width
11190 Set the maximum number of instructions executed in parallel in
11191 reassociated tree. This parameter overrides target dependent
11192 heuristics used by default if has non zero value.
11194 @item sched-pressure-algorithm
11195 Choose between the two available implementations of
11196 @option{-fsched-pressure}. Algorithm 1 is the original implementation
11197 and is the more likely to prevent instructions from being reordered.
11198 Algorithm 2 was designed to be a compromise between the relatively
11199 conservative approach taken by algorithm 1 and the rather aggressive
11200 approach taken by the default scheduler. It relies more heavily on
11201 having a regular register file and accurate register pressure classes.
11202 See @file{haifa-sched.c} in the GCC sources for more details.
11204 The default choice depends on the target.
11206 @item max-slsr-cand-scan
11207 Set the maximum number of existing candidates that are considered when
11208 seeking a basis for a new straight-line strength reduction candidate.
11211 Enable buffer overflow detection for global objects. This kind
11212 of protection is enabled by default if you are using
11213 @option{-fsanitize=address} option.
11214 To disable global objects protection use @option{--param asan-globals=0}.
11217 Enable buffer overflow detection for stack objects. This kind of
11218 protection is enabled by default when using @option{-fsanitize=address}.
11219 To disable stack protection use @option{--param asan-stack=0} option.
11221 @item asan-instrument-reads
11222 Enable buffer overflow detection for memory reads. This kind of
11223 protection is enabled by default when using @option{-fsanitize=address}.
11224 To disable memory reads protection use
11225 @option{--param asan-instrument-reads=0}.
11227 @item asan-instrument-writes
11228 Enable buffer overflow detection for memory writes. This kind of
11229 protection is enabled by default when using @option{-fsanitize=address}.
11230 To disable memory writes protection use
11231 @option{--param asan-instrument-writes=0} option.
11233 @item asan-memintrin
11234 Enable detection for built-in functions. This kind of protection
11235 is enabled by default when using @option{-fsanitize=address}.
11236 To disable built-in functions protection use
11237 @option{--param asan-memintrin=0}.
11239 @item asan-use-after-return
11240 Enable detection of use-after-return. This kind of protection
11241 is enabled by default when using the @option{-fsanitize=address} option.
11242 To disable it use @option{--param asan-use-after-return=0}.
11244 Note: By default the check is disabled at run time. To enable it,
11245 add @code{detect_stack_use_after_return=1} to the environment variable
11246 @env{ASAN_OPTIONS}.
11248 @item asan-instrumentation-with-call-threshold
11249 If number of memory accesses in function being instrumented
11250 is greater or equal to this number, use callbacks instead of inline checks.
11251 E.g. to disable inline code use
11252 @option{--param asan-instrumentation-with-call-threshold=0}.
11254 @item use-after-scope-direct-emission-threshold
11255 If the size of a local variable in bytes is smaller or equal to this
11256 number, directly poison (or unpoison) shadow memory instead of using
11257 run-time callbacks. The default value is 256.
11259 @item max-fsm-thread-path-insns
11260 Maximum number of instructions to copy when duplicating blocks on a
11261 finite state automaton jump thread path. The default is 100.
11263 @item max-fsm-thread-length
11264 Maximum number of basic blocks on a finite state automaton jump thread
11265 path. The default is 10.
11267 @item max-fsm-thread-paths
11268 Maximum number of new jump thread paths to create for a finite state
11269 automaton. The default is 50.
11271 @item parloops-chunk-size
11272 Chunk size of omp schedule for loops parallelized by parloops. The default
11275 @item parloops-schedule
11276 Schedule type of omp schedule for loops parallelized by parloops (static,
11277 dynamic, guided, auto, runtime). The default is static.
11279 @item parloops-min-per-thread
11280 The minimum number of iterations per thread of an innermost parallelized
11281 loop for which the parallelized variant is prefered over the single threaded
11282 one. The default is 100. Note that for a parallelized loop nest the
11283 minimum number of iterations of the outermost loop per thread is two.
11285 @item max-ssa-name-query-depth
11286 Maximum depth of recursion when querying properties of SSA names in things
11287 like fold routines. One level of recursion corresponds to following a
11290 @item hsa-gen-debug-stores
11291 Enable emission of special debug stores within HSA kernels which are
11292 then read and reported by libgomp plugin. Generation of these stores
11293 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
11296 @item max-speculative-devirt-maydefs
11297 The maximum number of may-defs we analyze when looking for a must-def
11298 specifying the dynamic type of an object that invokes a virtual call
11299 we may be able to devirtualize speculatively.
11301 @item max-vrp-switch-assertions
11302 The maximum number of assertions to add along the default edge of a switch
11303 statement during VRP. The default is 10.
11305 @item unroll-jam-min-percent
11306 The minimum percentage of memory references that must be optimized
11307 away for the unroll-and-jam transformation to be considered profitable.
11309 @item unroll-jam-max-unroll
11310 The maximum number of times the outer loop should be unrolled by
11311 the unroll-and-jam transformation.
11315 @node Instrumentation Options
11316 @section Program Instrumentation Options
11317 @cindex instrumentation options
11318 @cindex program instrumentation options
11319 @cindex run-time error checking options
11320 @cindex profiling options
11321 @cindex options, program instrumentation
11322 @cindex options, run-time error checking
11323 @cindex options, profiling
11325 GCC supports a number of command-line options that control adding
11326 run-time instrumentation to the code it normally generates.
11327 For example, one purpose of instrumentation is collect profiling
11328 statistics for use in finding program hot spots, code coverage
11329 analysis, or profile-guided optimizations.
11330 Another class of program instrumentation is adding run-time checking
11331 to detect programming errors like invalid pointer
11332 dereferences or out-of-bounds array accesses, as well as deliberately
11333 hostile attacks such as stack smashing or C++ vtable hijacking.
11334 There is also a general hook which can be used to implement other
11335 forms of tracing or function-level instrumentation for debug or
11336 program analysis purposes.
11339 @cindex @command{prof}
11342 Generate extra code to write profile information suitable for the
11343 analysis program @command{prof}. You must use this option when compiling
11344 the source files you want data about, and you must also use it when
11347 @cindex @command{gprof}
11350 Generate extra code to write profile information suitable for the
11351 analysis program @command{gprof}. You must use this option when compiling
11352 the source files you want data about, and you must also use it when
11355 @item -fprofile-arcs
11356 @opindex fprofile-arcs
11357 Add code so that program flow @dfn{arcs} are instrumented. During
11358 execution the program records how many times each branch and call is
11359 executed and how many times it is taken or returns. On targets that support
11360 constructors with priority support, profiling properly handles constructors,
11361 destructors and C++ constructors (and destructors) of classes which are used
11362 as a type of a global variable.
11365 program exits it saves this data to a file called
11366 @file{@var{auxname}.gcda} for each source file. The data may be used for
11367 profile-directed optimizations (@option{-fbranch-probabilities}), or for
11368 test coverage analysis (@option{-ftest-coverage}). Each object file's
11369 @var{auxname} is generated from the name of the output file, if
11370 explicitly specified and it is not the final executable, otherwise it is
11371 the basename of the source file. In both cases any suffix is removed
11372 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
11373 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
11374 @xref{Cross-profiling}.
11376 @cindex @command{gcov}
11380 This option is used to compile and link code instrumented for coverage
11381 analysis. The option is a synonym for @option{-fprofile-arcs}
11382 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
11383 linking). See the documentation for those options for more details.
11388 Compile the source files with @option{-fprofile-arcs} plus optimization
11389 and code generation options. For test coverage analysis, use the
11390 additional @option{-ftest-coverage} option. You do not need to profile
11391 every source file in a program.
11394 Compile the source files additionally with @option{-fprofile-abs-path}
11395 to create absolute path names in the @file{.gcno} files. This allows
11396 @command{gcov} to find the correct sources in projects where compilations
11397 occur with different working directories.
11400 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
11401 (the latter implies the former).
11404 Run the program on a representative workload to generate the arc profile
11405 information. This may be repeated any number of times. You can run
11406 concurrent instances of your program, and provided that the file system
11407 supports locking, the data files will be correctly updated. Unless
11408 a strict ISO C dialect option is in effect, @code{fork} calls are
11409 detected and correctly handled without double counting.
11412 For profile-directed optimizations, compile the source files again with
11413 the same optimization and code generation options plus
11414 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
11415 Control Optimization}).
11418 For test coverage analysis, use @command{gcov} to produce human readable
11419 information from the @file{.gcno} and @file{.gcda} files. Refer to the
11420 @command{gcov} documentation for further information.
11424 With @option{-fprofile-arcs}, for each function of your program GCC
11425 creates a program flow graph, then finds a spanning tree for the graph.
11426 Only arcs that are not on the spanning tree have to be instrumented: the
11427 compiler adds code to count the number of times that these arcs are
11428 executed. When an arc is the only exit or only entrance to a block, the
11429 instrumentation code can be added to the block; otherwise, a new basic
11430 block must be created to hold the instrumentation code.
11433 @item -ftest-coverage
11434 @opindex ftest-coverage
11435 Produce a notes file that the @command{gcov} code-coverage utility
11436 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
11437 show program coverage. Each source file's note file is called
11438 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
11439 above for a description of @var{auxname} and instructions on how to
11440 generate test coverage data. Coverage data matches the source files
11441 more closely if you do not optimize.
11443 @item -fprofile-abs-path
11444 @opindex fprofile-abs-path
11445 Automatically convert relative source file names to absolute path names
11446 in the @file{.gcno} files. This allows @command{gcov} to find the correct
11447 sources in projects where compilations occur with different working
11450 @item -fprofile-dir=@var{path}
11451 @opindex fprofile-dir
11453 Set the directory to search for the profile data files in to @var{path}.
11454 This option affects only the profile data generated by
11455 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
11456 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
11457 and its related options. Both absolute and relative paths can be used.
11458 By default, GCC uses the current directory as @var{path}, thus the
11459 profile data file appears in the same directory as the object file.
11460 In order to prevent the file name clashing, if the object file name is
11461 not an absolute path, we mangle the absolute path of the
11462 @file{@var{sourcename}.gcda} file and use it as the file name of a
11465 When an executable is run in a massive parallel environment, it is recommended
11466 to save profile to different folders. That can be done with variables
11467 in @var{path} that are exported during run-time:
11475 value of environment variable @var{VAR}
11479 @item -fprofile-generate
11480 @itemx -fprofile-generate=@var{path}
11481 @opindex fprofile-generate
11483 Enable options usually used for instrumenting application to produce
11484 profile useful for later recompilation with profile feedback based
11485 optimization. You must use @option{-fprofile-generate} both when
11486 compiling and when linking your program.
11488 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
11490 If @var{path} is specified, GCC looks at the @var{path} to find
11491 the profile feedback data files. See @option{-fprofile-dir}.
11493 To optimize the program based on the collected profile information, use
11494 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
11496 @item -fprofile-update=@var{method}
11497 @opindex fprofile-update
11499 Alter the update method for an application instrumented for profile
11500 feedback based optimization. The @var{method} argument should be one of
11501 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
11502 The first one is useful for single-threaded applications,
11503 while the second one prevents profile corruption by emitting thread-safe code.
11505 @strong{Warning:} When an application does not properly join all threads
11506 (or creates an detached thread), a profile file can be still corrupted.
11508 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
11509 when supported by a target, or to @samp{single} otherwise. The GCC driver
11510 automatically selects @samp{prefer-atomic} when @option{-pthread}
11511 is present in the command line.
11513 @item -fsanitize=address
11514 @opindex fsanitize=address
11515 Enable AddressSanitizer, a fast memory error detector.
11516 Memory access instructions are instrumented to detect
11517 out-of-bounds and use-after-free bugs.
11518 The option enables @option{-fsanitize-address-use-after-scope}.
11519 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
11520 more details. The run-time behavior can be influenced using the
11521 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
11522 the available options are shown at startup of the instrumented program. See
11523 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
11524 for a list of supported options.
11525 The option cannot be combined with @option{-fsanitize=thread}.
11527 @item -fsanitize=kernel-address
11528 @opindex fsanitize=kernel-address
11529 Enable AddressSanitizer for Linux kernel.
11530 See @uref{https://github.com/google/kasan/wiki} for more details.
11532 @item -fsanitize=pointer-compare
11533 @opindex fsanitize=pointer-compare
11534 Instrument comparison operation (<, <=, >, >=) with pointer operands.
11535 The option must be combined with either @option{-fsanitize=kernel-address} or
11536 @option{-fsanitize=address}
11537 The option cannot be combined with @option{-fsanitize=thread}.
11538 Note: By default the check is disabled at run time. To enable it,
11539 add @code{detect_invalid_pointer_pairs=2} to the environment variable
11540 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
11541 invalid operation only when both pointers are non-null.
11543 @item -fsanitize=pointer-subtract
11544 @opindex fsanitize=pointer-subtract
11545 Instrument subtraction with pointer operands.
11546 The option must be combined with either @option{-fsanitize=kernel-address} or
11547 @option{-fsanitize=address}
11548 The option cannot be combined with @option{-fsanitize=thread}.
11549 Note: By default the check is disabled at run time. To enable it,
11550 add @code{detect_invalid_pointer_pairs=2} to the environment variable
11551 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
11552 invalid operation only when both pointers are non-null.
11554 @item -fsanitize=thread
11555 @opindex fsanitize=thread
11556 Enable ThreadSanitizer, a fast data race detector.
11557 Memory access instructions are instrumented to detect
11558 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
11559 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
11560 environment variable; see
11561 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
11563 The option cannot be combined with @option{-fsanitize=address},
11564 @option{-fsanitize=leak}.
11566 Note that sanitized atomic builtins cannot throw exceptions when
11567 operating on invalid memory addresses with non-call exceptions
11568 (@option{-fnon-call-exceptions}).
11570 @item -fsanitize=leak
11571 @opindex fsanitize=leak
11572 Enable LeakSanitizer, a memory leak detector.
11573 This option only matters for linking of executables and
11574 the executable is linked against a library that overrides @code{malloc}
11575 and other allocator functions. See
11576 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
11577 details. The run-time behavior can be influenced using the
11578 @env{LSAN_OPTIONS} environment variable.
11579 The option cannot be combined with @option{-fsanitize=thread}.
11581 @item -fsanitize=undefined
11582 @opindex fsanitize=undefined
11583 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
11584 Various computations are instrumented to detect undefined behavior
11585 at runtime. Current suboptions are:
11589 @item -fsanitize=shift
11590 @opindex fsanitize=shift
11591 This option enables checking that the result of a shift operation is
11592 not undefined. Note that what exactly is considered undefined differs
11593 slightly between C and C++, as well as between ISO C90 and C99, etc.
11594 This option has two suboptions, @option{-fsanitize=shift-base} and
11595 @option{-fsanitize=shift-exponent}.
11597 @item -fsanitize=shift-exponent
11598 @opindex fsanitize=shift-exponent
11599 This option enables checking that the second argument of a shift operation
11600 is not negative and is smaller than the precision of the promoted first
11603 @item -fsanitize=shift-base
11604 @opindex fsanitize=shift-base
11605 If the second argument of a shift operation is within range, check that the
11606 result of a shift operation is not undefined. Note that what exactly is
11607 considered undefined differs slightly between C and C++, as well as between
11608 ISO C90 and C99, etc.
11610 @item -fsanitize=integer-divide-by-zero
11611 @opindex fsanitize=integer-divide-by-zero
11612 Detect integer division by zero as well as @code{INT_MIN / -1} division.
11614 @item -fsanitize=unreachable
11615 @opindex fsanitize=unreachable
11616 With this option, the compiler turns the @code{__builtin_unreachable}
11617 call into a diagnostics message call instead. When reaching the
11618 @code{__builtin_unreachable} call, the behavior is undefined.
11620 @item -fsanitize=vla-bound
11621 @opindex fsanitize=vla-bound
11622 This option instructs the compiler to check that the size of a variable
11623 length array is positive.
11625 @item -fsanitize=null
11626 @opindex fsanitize=null
11627 This option enables pointer checking. Particularly, the application
11628 built with this option turned on will issue an error message when it
11629 tries to dereference a NULL pointer, or if a reference (possibly an
11630 rvalue reference) is bound to a NULL pointer, or if a method is invoked
11631 on an object pointed by a NULL pointer.
11633 @item -fsanitize=return
11634 @opindex fsanitize=return
11635 This option enables return statement checking. Programs
11636 built with this option turned on will issue an error message
11637 when the end of a non-void function is reached without actually
11638 returning a value. This option works in C++ only.
11640 @item -fsanitize=signed-integer-overflow
11641 @opindex fsanitize=signed-integer-overflow
11642 This option enables signed integer overflow checking. We check that
11643 the result of @code{+}, @code{*}, and both unary and binary @code{-}
11644 does not overflow in the signed arithmetics. Note, integer promotion
11645 rules must be taken into account. That is, the following is not an
11648 signed char a = SCHAR_MAX;
11652 @item -fsanitize=bounds
11653 @opindex fsanitize=bounds
11654 This option enables instrumentation of array bounds. Various out of bounds
11655 accesses are detected. Flexible array members, flexible array member-like
11656 arrays, and initializers of variables with static storage are not instrumented.
11658 @item -fsanitize=bounds-strict
11659 @opindex fsanitize=bounds-strict
11660 This option enables strict instrumentation of array bounds. Most out of bounds
11661 accesses are detected, including flexible array members and flexible array
11662 member-like arrays. Initializers of variables with static storage are not
11665 @item -fsanitize=alignment
11666 @opindex fsanitize=alignment
11668 This option enables checking of alignment of pointers when they are
11669 dereferenced, or when a reference is bound to insufficiently aligned target,
11670 or when a method or constructor is invoked on insufficiently aligned object.
11672 @item -fsanitize=object-size
11673 @opindex fsanitize=object-size
11674 This option enables instrumentation of memory references using the
11675 @code{__builtin_object_size} function. Various out of bounds pointer
11676 accesses are detected.
11678 @item -fsanitize=float-divide-by-zero
11679 @opindex fsanitize=float-divide-by-zero
11680 Detect floating-point division by zero. Unlike other similar options,
11681 @option{-fsanitize=float-divide-by-zero} is not enabled by
11682 @option{-fsanitize=undefined}, since floating-point division by zero can
11683 be a legitimate way of obtaining infinities and NaNs.
11685 @item -fsanitize=float-cast-overflow
11686 @opindex fsanitize=float-cast-overflow
11687 This option enables floating-point type to integer conversion checking.
11688 We check that the result of the conversion does not overflow.
11689 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
11690 not enabled by @option{-fsanitize=undefined}.
11691 This option does not work well with @code{FE_INVALID} exceptions enabled.
11693 @item -fsanitize=nonnull-attribute
11694 @opindex fsanitize=nonnull-attribute
11696 This option enables instrumentation of calls, checking whether null values
11697 are not passed to arguments marked as requiring a non-null value by the
11698 @code{nonnull} function attribute.
11700 @item -fsanitize=returns-nonnull-attribute
11701 @opindex fsanitize=returns-nonnull-attribute
11703 This option enables instrumentation of return statements in functions
11704 marked with @code{returns_nonnull} function attribute, to detect returning
11705 of null values from such functions.
11707 @item -fsanitize=bool
11708 @opindex fsanitize=bool
11710 This option enables instrumentation of loads from bool. If a value other
11711 than 0/1 is loaded, a run-time error is issued.
11713 @item -fsanitize=enum
11714 @opindex fsanitize=enum
11716 This option enables instrumentation of loads from an enum type. If
11717 a value outside the range of values for the enum type is loaded,
11718 a run-time error is issued.
11720 @item -fsanitize=vptr
11721 @opindex fsanitize=vptr
11723 This option enables instrumentation of C++ member function calls, member
11724 accesses and some conversions between pointers to base and derived classes,
11725 to verify the referenced object has the correct dynamic type.
11727 @item -fsanitize=pointer-overflow
11728 @opindex fsanitize=pointer-overflow
11730 This option enables instrumentation of pointer arithmetics. If the pointer
11731 arithmetics overflows, a run-time error is issued.
11733 @item -fsanitize=builtin
11734 @opindex fsanitize=builtin
11736 This option enables instrumentation of arguments to selected builtin
11737 functions. If an invalid value is passed to such arguments, a run-time
11738 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
11739 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
11744 While @option{-ftrapv} causes traps for signed overflows to be emitted,
11745 @option{-fsanitize=undefined} gives a diagnostic message.
11746 This currently works only for the C family of languages.
11748 @item -fno-sanitize=all
11749 @opindex fno-sanitize=all
11751 This option disables all previously enabled sanitizers.
11752 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
11755 @item -fasan-shadow-offset=@var{number}
11756 @opindex fasan-shadow-offset
11757 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
11758 It is useful for experimenting with different shadow memory layouts in
11759 Kernel AddressSanitizer.
11761 @item -fsanitize-sections=@var{s1},@var{s2},...
11762 @opindex fsanitize-sections
11763 Sanitize global variables in selected user-defined sections. @var{si} may
11766 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
11767 @opindex fsanitize-recover
11768 @opindex fno-sanitize-recover
11769 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
11770 mentioned in comma-separated list of @var{opts}. Enabling this option
11771 for a sanitizer component causes it to attempt to continue
11772 running the program as if no error happened. This means multiple
11773 runtime errors can be reported in a single program run, and the exit
11774 code of the program may indicate success even when errors
11775 have been reported. The @option{-fno-sanitize-recover=} option
11776 can be used to alter
11777 this behavior: only the first detected error is reported
11778 and program then exits with a non-zero exit code.
11780 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
11781 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
11782 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
11783 @option{-fsanitize=bounds-strict},
11784 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
11785 For these sanitizers error recovery is turned on by default,
11786 except @option{-fsanitize=address}, for which this feature is experimental.
11787 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
11788 accepted, the former enables recovery for all sanitizers that support it,
11789 the latter disables recovery for all sanitizers that support it.
11791 Even if a recovery mode is turned on the compiler side, it needs to be also
11792 enabled on the runtime library side, otherwise the failures are still fatal.
11793 The runtime library defaults to @code{halt_on_error=0} for
11794 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
11795 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
11796 setting the @code{halt_on_error} flag in the corresponding environment variable.
11798 Syntax without an explicit @var{opts} parameter is deprecated. It is
11799 equivalent to specifying an @var{opts} list of:
11802 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
11805 @item -fsanitize-address-use-after-scope
11806 @opindex fsanitize-address-use-after-scope
11807 Enable sanitization of local variables to detect use-after-scope bugs.
11808 The option sets @option{-fstack-reuse} to @samp{none}.
11810 @item -fsanitize-undefined-trap-on-error
11811 @opindex fsanitize-undefined-trap-on-error
11812 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
11813 report undefined behavior using @code{__builtin_trap} rather than
11814 a @code{libubsan} library routine. The advantage of this is that the
11815 @code{libubsan} library is not needed and is not linked in, so this
11816 is usable even in freestanding environments.
11818 @item -fsanitize-coverage=trace-pc
11819 @opindex fsanitize-coverage=trace-pc
11820 Enable coverage-guided fuzzing code instrumentation.
11821 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
11823 @item -fsanitize-coverage=trace-cmp
11824 @opindex fsanitize-coverage=trace-cmp
11825 Enable dataflow guided fuzzing code instrumentation.
11826 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
11827 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
11828 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
11829 variable or @code{__sanitizer_cov_trace_const_cmp1},
11830 @code{__sanitizer_cov_trace_const_cmp2},
11831 @code{__sanitizer_cov_trace_const_cmp4} or
11832 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
11833 operand constant, @code{__sanitizer_cov_trace_cmpf} or
11834 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
11835 @code{__sanitizer_cov_trace_switch} for switch statements.
11837 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
11838 @opindex fcf-protection
11839 Enable code instrumentation of control-flow transfers to increase
11840 program security by checking that target addresses of control-flow
11841 transfer instructions (such as indirect function call, function return,
11842 indirect jump) are valid. This prevents diverting the flow of control
11843 to an unexpected target. This is intended to protect against such
11844 threats as Return-oriented Programming (ROP), and similarly
11845 call/jmp-oriented programming (COP/JOP).
11847 The value @code{branch} tells the compiler to implement checking of
11848 validity of control-flow transfer at the point of indirect branch
11849 instructions, i.e. call/jmp instructions. The value @code{return}
11850 implements checking of validity at the point of returning from a
11851 function. The value @code{full} is an alias for specifying both
11852 @code{branch} and @code{return}. The value @code{none} turns off
11855 The macro @code{__CET__} is defined when @option{-fcf-protection} is
11856 used. The first bit of @code{__CET__} is set to 1 for the value
11857 @code{branch} and the second bit of @code{__CET__} is set to 1 for
11860 You can also use the @code{nocf_check} attribute to identify
11861 which functions and calls should be skipped from instrumentation
11862 (@pxref{Function Attributes}).
11864 Currently the x86 GNU/Linux target provides an implementation based
11865 on Intel Control-flow Enforcement Technology (CET).
11867 @item -fstack-protector
11868 @opindex fstack-protector
11869 Emit extra code to check for buffer overflows, such as stack smashing
11870 attacks. This is done by adding a guard variable to functions with
11871 vulnerable objects. This includes functions that call @code{alloca}, and
11872 functions with buffers larger than 8 bytes. The guards are initialized
11873 when a function is entered and then checked when the function exits.
11874 If a guard check fails, an error message is printed and the program exits.
11876 @item -fstack-protector-all
11877 @opindex fstack-protector-all
11878 Like @option{-fstack-protector} except that all functions are protected.
11880 @item -fstack-protector-strong
11881 @opindex fstack-protector-strong
11882 Like @option{-fstack-protector} but includes additional functions to
11883 be protected --- those that have local array definitions, or have
11884 references to local frame addresses.
11886 @item -fstack-protector-explicit
11887 @opindex fstack-protector-explicit
11888 Like @option{-fstack-protector} but only protects those functions which
11889 have the @code{stack_protect} attribute.
11891 @item -fstack-check
11892 @opindex fstack-check
11893 Generate code to verify that you do not go beyond the boundary of the
11894 stack. You should specify this flag if you are running in an
11895 environment with multiple threads, but you only rarely need to specify it in
11896 a single-threaded environment since stack overflow is automatically
11897 detected on nearly all systems if there is only one stack.
11899 Note that this switch does not actually cause checking to be done; the
11900 operating system or the language runtime must do that. The switch causes
11901 generation of code to ensure that they see the stack being extended.
11903 You can additionally specify a string parameter: @samp{no} means no
11904 checking, @samp{generic} means force the use of old-style checking,
11905 @samp{specific} means use the best checking method and is equivalent
11906 to bare @option{-fstack-check}.
11908 Old-style checking is a generic mechanism that requires no specific
11909 target support in the compiler but comes with the following drawbacks:
11913 Modified allocation strategy for large objects: they are always
11914 allocated dynamically if their size exceeds a fixed threshold. Note this
11915 may change the semantics of some code.
11918 Fixed limit on the size of the static frame of functions: when it is
11919 topped by a particular function, stack checking is not reliable and
11920 a warning is issued by the compiler.
11923 Inefficiency: because of both the modified allocation strategy and the
11924 generic implementation, code performance is hampered.
11927 Note that old-style stack checking is also the fallback method for
11928 @samp{specific} if no target support has been added in the compiler.
11930 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
11931 and stack overflows. @samp{specific} is an excellent choice when compiling
11932 Ada code. It is not generally sufficient to protect against stack-clash
11933 attacks. To protect against those you want @samp{-fstack-clash-protection}.
11935 @item -fstack-clash-protection
11936 @opindex fstack-clash-protection
11937 Generate code to prevent stack clash style attacks. When this option is
11938 enabled, the compiler will only allocate one page of stack space at a time
11939 and each page is accessed immediately after allocation. Thus, it prevents
11940 allocations from jumping over any stack guard page provided by the
11943 Most targets do not fully support stack clash protection. However, on
11944 those targets @option{-fstack-clash-protection} will protect dynamic stack
11945 allocations. @option{-fstack-clash-protection} may also provide limited
11946 protection for static stack allocations if the target supports
11947 @option{-fstack-check=specific}.
11949 @item -fstack-limit-register=@var{reg}
11950 @itemx -fstack-limit-symbol=@var{sym}
11951 @itemx -fno-stack-limit
11952 @opindex fstack-limit-register
11953 @opindex fstack-limit-symbol
11954 @opindex fno-stack-limit
11955 Generate code to ensure that the stack does not grow beyond a certain value,
11956 either the value of a register or the address of a symbol. If a larger
11957 stack is required, a signal is raised at run time. For most targets,
11958 the signal is raised before the stack overruns the boundary, so
11959 it is possible to catch the signal without taking special precautions.
11961 For instance, if the stack starts at absolute address @samp{0x80000000}
11962 and grows downwards, you can use the flags
11963 @option{-fstack-limit-symbol=__stack_limit} and
11964 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
11965 of 128KB@. Note that this may only work with the GNU linker.
11967 You can locally override stack limit checking by using the
11968 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
11970 @item -fsplit-stack
11971 @opindex fsplit-stack
11972 Generate code to automatically split the stack before it overflows.
11973 The resulting program has a discontiguous stack which can only
11974 overflow if the program is unable to allocate any more memory. This
11975 is most useful when running threaded programs, as it is no longer
11976 necessary to calculate a good stack size to use for each thread. This
11977 is currently only implemented for the x86 targets running
11980 When code compiled with @option{-fsplit-stack} calls code compiled
11981 without @option{-fsplit-stack}, there may not be much stack space
11982 available for the latter code to run. If compiling all code,
11983 including library code, with @option{-fsplit-stack} is not an option,
11984 then the linker can fix up these calls so that the code compiled
11985 without @option{-fsplit-stack} always has a large stack. Support for
11986 this is implemented in the gold linker in GNU binutils release 2.21
11989 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
11990 @opindex fvtable-verify
11991 This option is only available when compiling C++ code.
11992 It turns on (or off, if using @option{-fvtable-verify=none}) the security
11993 feature that verifies at run time, for every virtual call, that
11994 the vtable pointer through which the call is made is valid for the type of
11995 the object, and has not been corrupted or overwritten. If an invalid vtable
11996 pointer is detected at run time, an error is reported and execution of the
11997 program is immediately halted.
11999 This option causes run-time data structures to be built at program startup,
12000 which are used for verifying the vtable pointers.
12001 The options @samp{std} and @samp{preinit}
12002 control the timing of when these data structures are built. In both cases the
12003 data structures are built before execution reaches @code{main}. Using
12004 @option{-fvtable-verify=std} causes the data structures to be built after
12005 shared libraries have been loaded and initialized.
12006 @option{-fvtable-verify=preinit} causes them to be built before shared
12007 libraries have been loaded and initialized.
12009 If this option appears multiple times in the command line with different
12010 values specified, @samp{none} takes highest priority over both @samp{std} and
12011 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
12014 @opindex fvtv-debug
12015 When used in conjunction with @option{-fvtable-verify=std} or
12016 @option{-fvtable-verify=preinit}, causes debug versions of the
12017 runtime functions for the vtable verification feature to be called.
12018 This flag also causes the compiler to log information about which
12019 vtable pointers it finds for each class.
12020 This information is written to a file named @file{vtv_set_ptr_data.log}
12021 in the directory named by the environment variable @env{VTV_LOGS_DIR}
12022 if that is defined or the current working directory otherwise.
12024 Note: This feature @emph{appends} data to the log file. If you want a fresh log
12025 file, be sure to delete any existing one.
12028 @opindex fvtv-counts
12029 This is a debugging flag. When used in conjunction with
12030 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
12031 causes the compiler to keep track of the total number of virtual calls
12032 it encounters and the number of verifications it inserts. It also
12033 counts the number of calls to certain run-time library functions
12034 that it inserts and logs this information for each compilation unit.
12035 The compiler writes this information to a file named
12036 @file{vtv_count_data.log} in the directory named by the environment
12037 variable @env{VTV_LOGS_DIR} if that is defined or the current working
12038 directory otherwise. It also counts the size of the vtable pointer sets
12039 for each class, and writes this information to @file{vtv_class_set_sizes.log}
12040 in the same directory.
12042 Note: This feature @emph{appends} data to the log files. To get fresh log
12043 files, be sure to delete any existing ones.
12045 @item -finstrument-functions
12046 @opindex finstrument-functions
12047 Generate instrumentation calls for entry and exit to functions. Just
12048 after function entry and just before function exit, the following
12049 profiling functions are called with the address of the current
12050 function and its call site. (On some platforms,
12051 @code{__builtin_return_address} does not work beyond the current
12052 function, so the call site information may not be available to the
12053 profiling functions otherwise.)
12056 void __cyg_profile_func_enter (void *this_fn,
12058 void __cyg_profile_func_exit (void *this_fn,
12062 The first argument is the address of the start of the current function,
12063 which may be looked up exactly in the symbol table.
12065 This instrumentation is also done for functions expanded inline in other
12066 functions. The profiling calls indicate where, conceptually, the
12067 inline function is entered and exited. This means that addressable
12068 versions of such functions must be available. If all your uses of a
12069 function are expanded inline, this may mean an additional expansion of
12070 code size. If you use @code{extern inline} in your C code, an
12071 addressable version of such functions must be provided. (This is
12072 normally the case anyway, but if you get lucky and the optimizer always
12073 expands the functions inline, you might have gotten away without
12074 providing static copies.)
12076 A function may be given the attribute @code{no_instrument_function}, in
12077 which case this instrumentation is not done. This can be used, for
12078 example, for the profiling functions listed above, high-priority
12079 interrupt routines, and any functions from which the profiling functions
12080 cannot safely be called (perhaps signal handlers, if the profiling
12081 routines generate output or allocate memory).
12083 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
12084 @opindex finstrument-functions-exclude-file-list
12086 Set the list of functions that are excluded from instrumentation (see
12087 the description of @option{-finstrument-functions}). If the file that
12088 contains a function definition matches with one of @var{file}, then
12089 that function is not instrumented. The match is done on substrings:
12090 if the @var{file} parameter is a substring of the file name, it is
12091 considered to be a match.
12096 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
12100 excludes any inline function defined in files whose pathnames
12101 contain @file{/bits/stl} or @file{include/sys}.
12103 If, for some reason, you want to include letter @samp{,} in one of
12104 @var{sym}, write @samp{\,}. For example,
12105 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
12106 (note the single quote surrounding the option).
12108 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
12109 @opindex finstrument-functions-exclude-function-list
12111 This is similar to @option{-finstrument-functions-exclude-file-list},
12112 but this option sets the list of function names to be excluded from
12113 instrumentation. The function name to be matched is its user-visible
12114 name, such as @code{vector<int> blah(const vector<int> &)}, not the
12115 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
12116 match is done on substrings: if the @var{sym} parameter is a substring
12117 of the function name, it is considered to be a match. For C99 and C++
12118 extended identifiers, the function name must be given in UTF-8, not
12119 using universal character names.
12121 @item -fpatchable-function-entry=@var{N}[,@var{M}]
12122 @opindex fpatchable-function-entry
12123 Generate @var{N} NOPs right at the beginning
12124 of each function, with the function entry point before the @var{M}th NOP.
12125 If @var{M} is omitted, it defaults to @code{0} so the
12126 function entry points to the address just at the first NOP.
12127 The NOP instructions reserve extra space which can be used to patch in
12128 any desired instrumentation at run time, provided that the code segment
12129 is writable. The amount of space is controllable indirectly via
12130 the number of NOPs; the NOP instruction used corresponds to the instruction
12131 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
12132 is target-specific and may also depend on the architecture variant and/or
12133 other compilation options.
12135 For run-time identification, the starting addresses of these areas,
12136 which correspond to their respective function entries minus @var{M},
12137 are additionally collected in the @code{__patchable_function_entries}
12138 section of the resulting binary.
12140 Note that the value of @code{__attribute__ ((patchable_function_entry
12141 (N,M)))} takes precedence over command-line option
12142 @option{-fpatchable-function-entry=N,M}. This can be used to increase
12143 the area size or to remove it completely on a single function.
12144 If @code{N=0}, no pad location is recorded.
12146 The NOP instructions are inserted at---and maybe before, depending on
12147 @var{M}---the function entry address, even before the prologue.
12152 @node Preprocessor Options
12153 @section Options Controlling the Preprocessor
12154 @cindex preprocessor options
12155 @cindex options, preprocessor
12157 These options control the C preprocessor, which is run on each C source
12158 file before actual compilation.
12160 If you use the @option{-E} option, nothing is done except preprocessing.
12161 Some of these options make sense only together with @option{-E} because
12162 they cause the preprocessor output to be unsuitable for actual
12165 In addition to the options listed here, there are a number of options
12166 to control search paths for include files documented in
12167 @ref{Directory Options}.
12168 Options to control preprocessor diagnostics are listed in
12169 @ref{Warning Options}.
12172 @include cppopts.texi
12174 @item -Wp,@var{option}
12176 You can use @option{-Wp,@var{option}} to bypass the compiler driver
12177 and pass @var{option} directly through to the preprocessor. If
12178 @var{option} contains commas, it is split into multiple options at the
12179 commas. However, many options are modified, translated or interpreted
12180 by the compiler driver before being passed to the preprocessor, and
12181 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
12182 interface is undocumented and subject to change, so whenever possible
12183 you should avoid using @option{-Wp} and let the driver handle the
12186 @item -Xpreprocessor @var{option}
12187 @opindex Xpreprocessor
12188 Pass @var{option} as an option to the preprocessor. You can use this to
12189 supply system-specific preprocessor options that GCC does not
12192 If you want to pass an option that takes an argument, you must use
12193 @option{-Xpreprocessor} twice, once for the option and once for the argument.
12195 @item -no-integrated-cpp
12196 @opindex no-integrated-cpp
12197 Perform preprocessing as a separate pass before compilation.
12198 By default, GCC performs preprocessing as an integrated part of
12199 input tokenization and parsing.
12200 If this option is provided, the appropriate language front end
12201 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
12202 and Objective-C, respectively) is instead invoked twice,
12203 once for preprocessing only and once for actual compilation
12204 of the preprocessed input.
12205 This option may be useful in conjunction with the @option{-B} or
12206 @option{-wrapper} options to specify an alternate preprocessor or
12207 perform additional processing of the program source between
12208 normal preprocessing and compilation.
12212 @node Assembler Options
12213 @section Passing Options to the Assembler
12215 @c prevent bad page break with this line
12216 You can pass options to the assembler.
12219 @item -Wa,@var{option}
12221 Pass @var{option} as an option to the assembler. If @var{option}
12222 contains commas, it is split into multiple options at the commas.
12224 @item -Xassembler @var{option}
12225 @opindex Xassembler
12226 Pass @var{option} as an option to the assembler. You can use this to
12227 supply system-specific assembler options that GCC does not
12230 If you want to pass an option that takes an argument, you must use
12231 @option{-Xassembler} twice, once for the option and once for the argument.
12236 @section Options for Linking
12237 @cindex link options
12238 @cindex options, linking
12240 These options come into play when the compiler links object files into
12241 an executable output file. They are meaningless if the compiler is
12242 not doing a link step.
12246 @item @var{object-file-name}
12247 A file name that does not end in a special recognized suffix is
12248 considered to name an object file or library. (Object files are
12249 distinguished from libraries by the linker according to the file
12250 contents.) If linking is done, these object files are used as input
12259 If any of these options is used, then the linker is not run, and
12260 object file names should not be used as arguments. @xref{Overall
12263 @item -flinker-output=@var{type}
12264 @opindex -flinker-output
12265 This option controls the code generation of the link time optimizer. By
12266 default the linker output is determined by the linker plugin automatically. For
12267 debugging the compiler and in the case of incremental linking to non-lto object
12268 file is desired, it may be useful to control the type manually.
12270 If @var{type} is @samp{exec} the code generation is configured to produce static
12271 binary. In this case @option{-fpic} and @option{-fpie} are both disabled.
12273 If @var{type} is @samp{dyn} the code generation is configured to produce shared
12274 library. In this case @option{-fpic} or @option{-fPIC} is preserved, but not
12275 enabled automatically. This makes it possible to build shared libraries without
12276 position independent code on architectures this is possible, i.e. on x86.
12278 If @var{type} is @samp{pie} the code generation is configured to produce
12279 @option{-fpie} executable. This result in similar optimizations as @samp{exec}
12280 except that @option{-fpie} is not disabled if specified at compilation time.
12282 If @var{type} is @samp{rel} the compiler assumes that incremental linking is
12283 done. The sections containing intermediate code for link-time optimization are
12284 merged, pre-optimized, and output to the resulting object file. In addition, if
12285 @option{-ffat-lto-objects} is specified the binary code is produced for future
12286 non-lto linking. The object file produced by incremental linking will be smaller
12287 than a static library produced from the same object files. At link-time the
12288 result of incremental linking will also load faster to compiler than a static
12289 library assuming that majority of objects in the library are used.
12291 Finally @samp{nolto-rel} configure compiler to for incremental linking where
12292 code generation is forced, final binary is produced and the intermediate code
12293 for later link-time optimization is stripped. When multiple object files are
12294 linked together the resulting code will be optimized better than with link time
12295 optimizations disabled (for example, the cross-module inlining will happen),
12296 most of benefits of whole program optimizations are however lost.
12298 During the incremental link (by @option{-r}) the linker plugin will default to
12299 @option{rel}. With current interfaces to GNU Binutils it is however not
12300 possible to link incrementally LTO objects and non-LTO objects into a single
12301 mixed object file. In the case any of object files in incremental link can not
12302 be used for link-time optimization the linker plugin will output warning and
12303 use @samp{nolto-rel}. To maintain the whole program optimization it is
12304 recommended to link such objects into static library instead. Alternatively it
12305 is possible to use H.J. Lu's binutils with support for mixed objects.
12308 @opindex fuse-ld=bfd
12309 Use the @command{bfd} linker instead of the default linker.
12311 @item -fuse-ld=gold
12312 @opindex fuse-ld=gold
12313 Use the @command{gold} linker instead of the default linker.
12316 @item -l@var{library}
12317 @itemx -l @var{library}
12319 Search the library named @var{library} when linking. (The second
12320 alternative with the library as a separate argument is only for
12321 POSIX compliance and is not recommended.)
12323 It makes a difference where in the command you write this option; the
12324 linker searches and processes libraries and object files in the order they
12325 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
12326 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
12327 to functions in @samp{z}, those functions may not be loaded.
12329 The linker searches a standard list of directories for the library,
12330 which is actually a file named @file{lib@var{library}.a}. The linker
12331 then uses this file as if it had been specified precisely by name.
12333 The directories searched include several standard system directories
12334 plus any that you specify with @option{-L}.
12336 Normally the files found this way are library files---archive files
12337 whose members are object files. The linker handles an archive file by
12338 scanning through it for members which define symbols that have so far
12339 been referenced but not defined. But if the file that is found is an
12340 ordinary object file, it is linked in the usual fashion. The only
12341 difference between using an @option{-l} option and specifying a file name
12342 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
12343 and searches several directories.
12347 You need this special case of the @option{-l} option in order to
12348 link an Objective-C or Objective-C++ program.
12350 @item -nostartfiles
12351 @opindex nostartfiles
12352 Do not use the standard system startup files when linking.
12353 The standard system libraries are used normally, unless @option{-nostdlib}
12354 or @option{-nodefaultlibs} is used.
12356 @item -nodefaultlibs
12357 @opindex nodefaultlibs
12358 Do not use the standard system libraries when linking.
12359 Only the libraries you specify are passed to the linker, and options
12360 specifying linkage of the system libraries, such as @option{-static-libgcc}
12361 or @option{-shared-libgcc}, are ignored.
12362 The standard startup files are used normally, unless @option{-nostartfiles}
12365 The compiler may generate calls to @code{memcmp},
12366 @code{memset}, @code{memcpy} and @code{memmove}.
12367 These entries are usually resolved by entries in
12368 libc. These entry points should be supplied through some other
12369 mechanism when this option is specified.
12373 Do not use the standard system startup files or libraries when linking.
12374 No startup files and only the libraries you specify are passed to
12375 the linker, and options specifying linkage of the system libraries, such as
12376 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
12378 The compiler may generate calls to @code{memcmp}, @code{memset},
12379 @code{memcpy} and @code{memmove}.
12380 These entries are usually resolved by entries in
12381 libc. These entry points should be supplied through some other
12382 mechanism when this option is specified.
12384 @cindex @option{-lgcc}, use with @option{-nostdlib}
12385 @cindex @option{-nostdlib} and unresolved references
12386 @cindex unresolved references and @option{-nostdlib}
12387 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
12388 @cindex @option{-nodefaultlibs} and unresolved references
12389 @cindex unresolved references and @option{-nodefaultlibs}
12390 One of the standard libraries bypassed by @option{-nostdlib} and
12391 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
12392 which GCC uses to overcome shortcomings of particular machines, or special
12393 needs for some languages.
12394 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
12395 Collection (GCC) Internals},
12396 for more discussion of @file{libgcc.a}.)
12397 In most cases, you need @file{libgcc.a} even when you want to avoid
12398 other standard libraries. In other words, when you specify @option{-nostdlib}
12399 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
12400 This ensures that you have no unresolved references to internal GCC
12401 library subroutines.
12402 (An example of such an internal subroutine is @code{__main}, used to ensure C++
12403 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
12404 GNU Compiler Collection (GCC) Internals}.)
12408 Produce a dynamically linked position independent executable on targets
12409 that support it. For predictable results, you must also specify the same
12410 set of options used for compilation (@option{-fpie}, @option{-fPIE},
12411 or model suboptions) when you specify this linker option.
12415 Don't produce a dynamically linked position independent executable.
12418 @opindex static-pie
12419 Produce a static position independent executable on targets that support
12420 it. A static position independent executable is similar to a static
12421 executable, but can be loaded at any address without a dynamic linker.
12422 For predictable results, you must also specify the same set of options
12423 used for compilation (@option{-fpie}, @option{-fPIE}, or model
12424 suboptions) when you specify this linker option.
12428 Link with the POSIX threads library. This option is supported on
12429 GNU/Linux targets, most other Unix derivatives, and also on
12430 x86 Cygwin and MinGW targets. On some targets this option also sets
12431 flags for the preprocessor, so it should be used consistently for both
12432 compilation and linking.
12436 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
12437 that support it. This instructs the linker to add all symbols, not
12438 only used ones, to the dynamic symbol table. This option is needed
12439 for some uses of @code{dlopen} or to allow obtaining backtraces
12440 from within a program.
12444 Remove all symbol table and relocation information from the executable.
12448 On systems that support dynamic linking, this overrides @option{-pie}
12449 and prevents linking with the shared libraries. On other systems, this
12450 option has no effect.
12454 Produce a shared object which can then be linked with other objects to
12455 form an executable. Not all systems support this option. For predictable
12456 results, you must also specify the same set of options used for compilation
12457 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
12458 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
12459 needs to build supplementary stub code for constructors to work. On
12460 multi-libbed systems, @samp{gcc -shared} must select the correct support
12461 libraries to link against. Failing to supply the correct flags may lead
12462 to subtle defects. Supplying them in cases where they are not necessary
12465 @item -shared-libgcc
12466 @itemx -static-libgcc
12467 @opindex shared-libgcc
12468 @opindex static-libgcc
12469 On systems that provide @file{libgcc} as a shared library, these options
12470 force the use of either the shared or static version, respectively.
12471 If no shared version of @file{libgcc} was built when the compiler was
12472 configured, these options have no effect.
12474 There are several situations in which an application should use the
12475 shared @file{libgcc} instead of the static version. The most common
12476 of these is when the application wishes to throw and catch exceptions
12477 across different shared libraries. In that case, each of the libraries
12478 as well as the application itself should use the shared @file{libgcc}.
12480 Therefore, the G++ and driver automatically adds @option{-shared-libgcc}
12481 whenever you build a shared library or a main executable, because C++
12482 programs typically use exceptions, so this is the right thing to do.
12484 If, instead, you use the GCC driver to create shared libraries, you may
12485 find that they are not always linked with the shared @file{libgcc}.
12486 If GCC finds, at its configuration time, that you have a non-GNU linker
12487 or a GNU linker that does not support option @option{--eh-frame-hdr},
12488 it links the shared version of @file{libgcc} into shared libraries
12489 by default. Otherwise, it takes advantage of the linker and optimizes
12490 away the linking with the shared version of @file{libgcc}, linking with
12491 the static version of libgcc by default. This allows exceptions to
12492 propagate through such shared libraries, without incurring relocation
12493 costs at library load time.
12495 However, if a library or main executable is supposed to throw or catch
12496 exceptions, you must link it using the G++ driver, as appropriate
12497 for the languages used in the program, or using the option
12498 @option{-shared-libgcc}, such that it is linked with the shared
12501 @item -static-libasan
12502 @opindex static-libasan
12503 When the @option{-fsanitize=address} option is used to link a program,
12504 the GCC driver automatically links against @option{libasan}. If
12505 @file{libasan} is available as a shared library, and the @option{-static}
12506 option is not used, then this links against the shared version of
12507 @file{libasan}. The @option{-static-libasan} option directs the GCC
12508 driver to link @file{libasan} statically, without necessarily linking
12509 other libraries statically.
12511 @item -static-libtsan
12512 @opindex static-libtsan
12513 When the @option{-fsanitize=thread} option is used to link a program,
12514 the GCC driver automatically links against @option{libtsan}. If
12515 @file{libtsan} is available as a shared library, and the @option{-static}
12516 option is not used, then this links against the shared version of
12517 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
12518 driver to link @file{libtsan} statically, without necessarily linking
12519 other libraries statically.
12521 @item -static-liblsan
12522 @opindex static-liblsan
12523 When the @option{-fsanitize=leak} option is used to link a program,
12524 the GCC driver automatically links against @option{liblsan}. If
12525 @file{liblsan} is available as a shared library, and the @option{-static}
12526 option is not used, then this links against the shared version of
12527 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
12528 driver to link @file{liblsan} statically, without necessarily linking
12529 other libraries statically.
12531 @item -static-libubsan
12532 @opindex static-libubsan
12533 When the @option{-fsanitize=undefined} option is used to link a program,
12534 the GCC driver automatically links against @option{libubsan}. If
12535 @file{libubsan} is available as a shared library, and the @option{-static}
12536 option is not used, then this links against the shared version of
12537 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
12538 driver to link @file{libubsan} statically, without necessarily linking
12539 other libraries statically.
12541 @item -static-libstdc++
12542 @opindex static-libstdc++
12543 When the @command{g++} program is used to link a C++ program, it
12544 normally automatically links against @option{libstdc++}. If
12545 @file{libstdc++} is available as a shared library, and the
12546 @option{-static} option is not used, then this links against the
12547 shared version of @file{libstdc++}. That is normally fine. However, it
12548 is sometimes useful to freeze the version of @file{libstdc++} used by
12549 the program without going all the way to a fully static link. The
12550 @option{-static-libstdc++} option directs the @command{g++} driver to
12551 link @file{libstdc++} statically, without necessarily linking other
12552 libraries statically.
12556 Bind references to global symbols when building a shared object. Warn
12557 about any unresolved references (unless overridden by the link editor
12558 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
12561 @item -T @var{script}
12563 @cindex linker script
12564 Use @var{script} as the linker script. This option is supported by most
12565 systems using the GNU linker. On some targets, such as bare-board
12566 targets without an operating system, the @option{-T} option may be required
12567 when linking to avoid references to undefined symbols.
12569 @item -Xlinker @var{option}
12571 Pass @var{option} as an option to the linker. You can use this to
12572 supply system-specific linker options that GCC does not recognize.
12574 If you want to pass an option that takes a separate argument, you must use
12575 @option{-Xlinker} twice, once for the option and once for the argument.
12576 For example, to pass @option{-assert definitions}, you must write
12577 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
12578 @option{-Xlinker "-assert definitions"}, because this passes the entire
12579 string as a single argument, which is not what the linker expects.
12581 When using the GNU linker, it is usually more convenient to pass
12582 arguments to linker options using the @option{@var{option}=@var{value}}
12583 syntax than as separate arguments. For example, you can specify
12584 @option{-Xlinker -Map=output.map} rather than
12585 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
12586 this syntax for command-line options.
12588 @item -Wl,@var{option}
12590 Pass @var{option} as an option to the linker. If @var{option} contains
12591 commas, it is split into multiple options at the commas. You can use this
12592 syntax to pass an argument to the option.
12593 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
12594 linker. When using the GNU linker, you can also get the same effect with
12595 @option{-Wl,-Map=output.map}.
12597 @item -u @var{symbol}
12599 Pretend the symbol @var{symbol} is undefined, to force linking of
12600 library modules to define it. You can use @option{-u} multiple times with
12601 different symbols to force loading of additional library modules.
12603 @item -z @var{keyword}
12605 @option{-z} is passed directly on to the linker along with the keyword
12606 @var{keyword}. See the section in the documentation of your linker for
12607 permitted values and their meanings.
12610 @node Directory Options
12611 @section Options for Directory Search
12612 @cindex directory options
12613 @cindex options, directory search
12614 @cindex search path
12616 These options specify directories to search for header files, for
12617 libraries and for parts of the compiler:
12620 @include cppdiropts.texi
12622 @item -iplugindir=@var{dir}
12623 @opindex iplugindir=
12624 Set the directory to search for plugins that are passed
12625 by @option{-fplugin=@var{name}} instead of
12626 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
12627 to be used by the user, but only passed by the driver.
12631 Add directory @var{dir} to the list of directories to be searched
12634 @item -B@var{prefix}
12636 This option specifies where to find the executables, libraries,
12637 include files, and data files of the compiler itself.
12639 The compiler driver program runs one or more of the subprograms
12640 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
12641 @var{prefix} as a prefix for each program it tries to run, both with and
12642 without @samp{@var{machine}/@var{version}/} for the corresponding target
12643 machine and compiler version.
12645 For each subprogram to be run, the compiler driver first tries the
12646 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
12647 is not specified, the driver tries two standard prefixes,
12648 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
12649 those results in a file name that is found, the unmodified program
12650 name is searched for using the directories specified in your
12651 @env{PATH} environment variable.
12653 The compiler checks to see if the path provided by @option{-B}
12654 refers to a directory, and if necessary it adds a directory
12655 separator character at the end of the path.
12657 @option{-B} prefixes that effectively specify directory names also apply
12658 to libraries in the linker, because the compiler translates these
12659 options into @option{-L} options for the linker. They also apply to
12660 include files in the preprocessor, because the compiler translates these
12661 options into @option{-isystem} options for the preprocessor. In this case,
12662 the compiler appends @samp{include} to the prefix.
12664 The runtime support file @file{libgcc.a} can also be searched for using
12665 the @option{-B} prefix, if needed. If it is not found there, the two
12666 standard prefixes above are tried, and that is all. The file is left
12667 out of the link if it is not found by those means.
12669 Another way to specify a prefix much like the @option{-B} prefix is to use
12670 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
12673 As a special kludge, if the path provided by @option{-B} is
12674 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
12675 9, then it is replaced by @file{[dir/]include}. This is to help
12676 with boot-strapping the compiler.
12678 @item -no-canonical-prefixes
12679 @opindex no-canonical-prefixes
12680 Do not expand any symbolic links, resolve references to @samp{/../}
12681 or @samp{/./}, or make the path absolute when generating a relative
12684 @item --sysroot=@var{dir}
12686 Use @var{dir} as the logical root directory for headers and libraries.
12687 For example, if the compiler normally searches for headers in
12688 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
12689 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
12691 If you use both this option and the @option{-isysroot} option, then
12692 the @option{--sysroot} option applies to libraries, but the
12693 @option{-isysroot} option applies to header files.
12695 The GNU linker (beginning with version 2.16) has the necessary support
12696 for this option. If your linker does not support this option, the
12697 header file aspect of @option{--sysroot} still works, but the
12698 library aspect does not.
12700 @item --no-sysroot-suffix
12701 @opindex no-sysroot-suffix
12702 For some targets, a suffix is added to the root directory specified
12703 with @option{--sysroot}, depending on the other options used, so that
12704 headers may for example be found in
12705 @file{@var{dir}/@var{suffix}/usr/include} instead of
12706 @file{@var{dir}/usr/include}. This option disables the addition of
12711 @node Code Gen Options
12712 @section Options for Code Generation Conventions
12713 @cindex code generation conventions
12714 @cindex options, code generation
12715 @cindex run-time options
12717 These machine-independent options control the interface conventions
12718 used in code generation.
12720 Most of them have both positive and negative forms; the negative form
12721 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
12722 one of the forms is listed---the one that is not the default. You
12723 can figure out the other form by either removing @samp{no-} or adding
12727 @item -fstack-reuse=@var{reuse-level}
12728 @opindex fstack_reuse
12729 This option controls stack space reuse for user declared local/auto variables
12730 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
12731 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
12732 local variables and temporaries, @samp{named_vars} enables the reuse only for
12733 user defined local variables with names, and @samp{none} disables stack reuse
12734 completely. The default value is @samp{all}. The option is needed when the
12735 program extends the lifetime of a scoped local variable or a compiler generated
12736 temporary beyond the end point defined by the language. When a lifetime of
12737 a variable ends, and if the variable lives in memory, the optimizing compiler
12738 has the freedom to reuse its stack space with other temporaries or scoped
12739 local variables whose live range does not overlap with it. Legacy code extending
12740 local lifetime is likely to break with the stack reuse optimization.
12759 if (*p == 10) // out of scope use of local1
12770 A(int k) : i(k), j(k) @{ @}
12777 void foo(const A& ar)
12784 foo(A(10)); // temp object's lifetime ends when foo returns
12790 ap->i+= 10; // ap references out of scope temp whose space
12791 // is reused with a. What is the value of ap->i?
12796 The lifetime of a compiler generated temporary is well defined by the C++
12797 standard. When a lifetime of a temporary ends, and if the temporary lives
12798 in memory, the optimizing compiler has the freedom to reuse its stack
12799 space with other temporaries or scoped local variables whose live range
12800 does not overlap with it. However some of the legacy code relies on
12801 the behavior of older compilers in which temporaries' stack space is
12802 not reused, the aggressive stack reuse can lead to runtime errors. This
12803 option is used to control the temporary stack reuse optimization.
12807 This option generates traps for signed overflow on addition, subtraction,
12808 multiplication operations.
12809 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
12810 @option{-ftrapv} @option{-fwrapv} on the command-line results in
12811 @option{-fwrapv} being effective. Note that only active options override, so
12812 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
12813 results in @option{-ftrapv} being effective.
12817 This option instructs the compiler to assume that signed arithmetic
12818 overflow of addition, subtraction and multiplication wraps around
12819 using twos-complement representation. This flag enables some optimizations
12820 and disables others.
12821 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
12822 @option{-ftrapv} @option{-fwrapv} on the command-line results in
12823 @option{-fwrapv} being effective. Note that only active options override, so
12824 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
12825 results in @option{-ftrapv} being effective.
12827 @item -fwrapv-pointer
12828 @opindex fwrapv-pointer
12829 This option instructs the compiler to assume that pointer arithmetic
12830 overflow on addition and subtraction wraps around using twos-complement
12831 representation. This flag disables some optimizations which assume
12832 pointer overflow is invalid.
12834 @item -fstrict-overflow
12835 @opindex fstrict-overflow
12836 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
12837 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
12840 @opindex fexceptions
12841 Enable exception handling. Generates extra code needed to propagate
12842 exceptions. For some targets, this implies GCC generates frame
12843 unwind information for all functions, which can produce significant data
12844 size overhead, although it does not affect execution. If you do not
12845 specify this option, GCC enables it by default for languages like
12846 C++ that normally require exception handling, and disables it for
12847 languages like C that do not normally require it. However, you may need
12848 to enable this option when compiling C code that needs to interoperate
12849 properly with exception handlers written in C++. You may also wish to
12850 disable this option if you are compiling older C++ programs that don't
12851 use exception handling.
12853 @item -fnon-call-exceptions
12854 @opindex fnon-call-exceptions
12855 Generate code that allows trapping instructions to throw exceptions.
12856 Note that this requires platform-specific runtime support that does
12857 not exist everywhere. Moreover, it only allows @emph{trapping}
12858 instructions to throw exceptions, i.e.@: memory references or floating-point
12859 instructions. It does not allow exceptions to be thrown from
12860 arbitrary signal handlers such as @code{SIGALRM}.
12862 @item -fdelete-dead-exceptions
12863 @opindex fdelete-dead-exceptions
12864 Consider that instructions that may throw exceptions but don't otherwise
12865 contribute to the execution of the program can be optimized away.
12866 This option is enabled by default for the Ada front end, as permitted by
12867 the Ada language specification.
12868 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
12870 @item -funwind-tables
12871 @opindex funwind-tables
12872 Similar to @option{-fexceptions}, except that it just generates any needed
12873 static data, but does not affect the generated code in any other way.
12874 You normally do not need to enable this option; instead, a language processor
12875 that needs this handling enables it on your behalf.
12877 @item -fasynchronous-unwind-tables
12878 @opindex fasynchronous-unwind-tables
12879 Generate unwind table in DWARF format, if supported by target machine. The
12880 table is exact at each instruction boundary, so it can be used for stack
12881 unwinding from asynchronous events (such as debugger or garbage collector).
12883 @item -fno-gnu-unique
12884 @opindex fno-gnu-unique
12885 On systems with recent GNU assembler and C library, the C++ compiler
12886 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
12887 of template static data members and static local variables in inline
12888 functions are unique even in the presence of @code{RTLD_LOCAL}; this
12889 is necessary to avoid problems with a library used by two different
12890 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
12891 therefore disagreeing with the other one about the binding of the
12892 symbol. But this causes @code{dlclose} to be ignored for affected
12893 DSOs; if your program relies on reinitialization of a DSO via
12894 @code{dlclose} and @code{dlopen}, you can use
12895 @option{-fno-gnu-unique}.
12897 @item -fpcc-struct-return
12898 @opindex fpcc-struct-return
12899 Return ``short'' @code{struct} and @code{union} values in memory like
12900 longer ones, rather than in registers. This convention is less
12901 efficient, but it has the advantage of allowing intercallability between
12902 GCC-compiled files and files compiled with other compilers, particularly
12903 the Portable C Compiler (pcc).
12905 The precise convention for returning structures in memory depends
12906 on the target configuration macros.
12908 Short structures and unions are those whose size and alignment match
12909 that of some integer type.
12911 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
12912 switch is not binary compatible with code compiled with the
12913 @option{-freg-struct-return} switch.
12914 Use it to conform to a non-default application binary interface.
12916 @item -freg-struct-return
12917 @opindex freg-struct-return
12918 Return @code{struct} and @code{union} values in registers when possible.
12919 This is more efficient for small structures than
12920 @option{-fpcc-struct-return}.
12922 If you specify neither @option{-fpcc-struct-return} nor
12923 @option{-freg-struct-return}, GCC defaults to whichever convention is
12924 standard for the target. If there is no standard convention, GCC
12925 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
12926 the principal compiler. In those cases, we can choose the standard, and
12927 we chose the more efficient register return alternative.
12929 @strong{Warning:} code compiled with the @option{-freg-struct-return}
12930 switch is not binary compatible with code compiled with the
12931 @option{-fpcc-struct-return} switch.
12932 Use it to conform to a non-default application binary interface.
12934 @item -fshort-enums
12935 @opindex fshort-enums
12936 Allocate to an @code{enum} type only as many bytes as it needs for the
12937 declared range of possible values. Specifically, the @code{enum} type
12938 is equivalent to the smallest integer type that has enough room.
12940 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
12941 code that is not binary compatible with code generated without that switch.
12942 Use it to conform to a non-default application binary interface.
12944 @item -fshort-wchar
12945 @opindex fshort-wchar
12946 Override the underlying type for @code{wchar_t} to be @code{short
12947 unsigned int} instead of the default for the target. This option is
12948 useful for building programs to run under WINE@.
12950 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
12951 code that is not binary compatible with code generated without that switch.
12952 Use it to conform to a non-default application binary interface.
12955 @opindex fno-common
12956 @cindex tentative definitions
12957 In C code, this option controls the placement of global variables
12958 defined without an initializer, known as @dfn{tentative definitions}
12959 in the C standard. Tentative definitions are distinct from declarations
12960 of a variable with the @code{extern} keyword, which do not allocate storage.
12962 Unix C compilers have traditionally allocated storage for
12963 uninitialized global variables in a common block. This allows the
12964 linker to resolve all tentative definitions of the same variable
12965 in different compilation units to the same object, or to a non-tentative
12967 This is the behavior specified by @option{-fcommon}, and is the default for
12968 GCC on most targets.
12969 On the other hand, this behavior is not required by ISO
12970 C, and on some targets may carry a speed or code size penalty on
12971 variable references.
12973 The @option{-fno-common} option specifies that the compiler should instead
12974 place uninitialized global variables in the data section of the object file.
12975 This inhibits the merging of tentative definitions by the linker so
12976 you get a multiple-definition error if the same
12977 variable is defined in more than one compilation unit.
12978 Compiling with @option{-fno-common} is useful on targets for which
12979 it provides better performance, or if you wish to verify that the
12980 program will work on other systems that always treat uninitialized
12981 variable definitions this way.
12985 Ignore the @code{#ident} directive.
12987 @item -finhibit-size-directive
12988 @opindex finhibit-size-directive
12989 Don't output a @code{.size} assembler directive, or anything else that
12990 would cause trouble if the function is split in the middle, and the
12991 two halves are placed at locations far apart in memory. This option is
12992 used when compiling @file{crtstuff.c}; you should not need to use it
12995 @item -fverbose-asm
12996 @opindex fverbose-asm
12997 Put extra commentary information in the generated assembly code to
12998 make it more readable. This option is generally only of use to those
12999 who actually need to read the generated assembly code (perhaps while
13000 debugging the compiler itself).
13002 @option{-fno-verbose-asm}, the default, causes the
13003 extra information to be omitted and is useful when comparing two assembler
13006 The added comments include:
13011 information on the compiler version and command-line options,
13014 the source code lines associated with the assembly instructions,
13015 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
13018 hints on which high-level expressions correspond to
13019 the various assembly instruction operands.
13023 For example, given this C source file:
13031 for (i = 0; i < n; i++)
13038 compiling to (x86_64) assembly via @option{-S} and emitting the result
13039 direct to stdout via @option{-o} @option{-}
13042 gcc -S test.c -fverbose-asm -Os -o -
13045 gives output similar to this:
13049 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
13056 .type test, @@function
13060 # test.c:4: int total = 0;
13061 xorl %eax, %eax # <retval>
13062 # test.c:6: for (i = 0; i < n; i++)
13063 xorl %edx, %edx # i
13065 # test.c:6: for (i = 0; i < n; i++)
13066 cmpl %edi, %edx # n, i
13068 # test.c:7: total += i * i;
13069 movl %edx, %ecx # i, tmp92
13070 imull %edx, %ecx # i, tmp92
13071 # test.c:6: for (i = 0; i < n; i++)
13073 # test.c:7: total += i * i;
13074 addl %ecx, %eax # tmp92, <retval>
13082 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
13083 .section .note.GNU-stack,"",@@progbits
13086 The comments are intended for humans rather than machines and hence the
13087 precise format of the comments is subject to change.
13089 @item -frecord-gcc-switches
13090 @opindex frecord-gcc-switches
13091 This switch causes the command line used to invoke the
13092 compiler to be recorded into the object file that is being created.
13093 This switch is only implemented on some targets and the exact format
13094 of the recording is target and binary file format dependent, but it
13095 usually takes the form of a section containing ASCII text. This
13096 switch is related to the @option{-fverbose-asm} switch, but that
13097 switch only records information in the assembler output file as
13098 comments, so it never reaches the object file.
13099 See also @option{-grecord-gcc-switches} for another
13100 way of storing compiler options into the object file.
13104 @cindex global offset table
13106 Generate position-independent code (PIC) suitable for use in a shared
13107 library, if supported for the target machine. Such code accesses all
13108 constant addresses through a global offset table (GOT)@. The dynamic
13109 loader resolves the GOT entries when the program starts (the dynamic
13110 loader is not part of GCC; it is part of the operating system). If
13111 the GOT size for the linked executable exceeds a machine-specific
13112 maximum size, you get an error message from the linker indicating that
13113 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
13114 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
13115 on the m68k and RS/6000. The x86 has no such limit.)
13117 Position-independent code requires special support, and therefore works
13118 only on certain machines. For the x86, GCC supports PIC for System V
13119 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
13120 position-independent.
13122 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13127 If supported for the target machine, emit position-independent code,
13128 suitable for dynamic linking and avoiding any limit on the size of the
13129 global offset table. This option makes a difference on AArch64, m68k,
13130 PowerPC and SPARC@.
13132 Position-independent code requires special support, and therefore works
13133 only on certain machines.
13135 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13142 These options are similar to @option{-fpic} and @option{-fPIC}, but the
13143 generated position-independent code can be only linked into executables.
13144 Usually these options are used to compile code that will be linked using
13145 the @option{-pie} GCC option.
13147 @option{-fpie} and @option{-fPIE} both define the macros
13148 @code{__pie__} and @code{__PIE__}. The macros have the value 1
13149 for @option{-fpie} and 2 for @option{-fPIE}.
13153 Do not use the PLT for external function calls in position-independent code.
13154 Instead, load the callee address at call sites from the GOT and branch to it.
13155 This leads to more efficient code by eliminating PLT stubs and exposing
13156 GOT loads to optimizations. On architectures such as 32-bit x86 where
13157 PLT stubs expect the GOT pointer in a specific register, this gives more
13158 register allocation freedom to the compiler.
13159 Lazy binding requires use of the PLT;
13160 with @option{-fno-plt} all external symbols are resolved at load time.
13162 Alternatively, the function attribute @code{noplt} can be used to avoid calls
13163 through the PLT for specific external functions.
13165 In position-dependent code, a few targets also convert calls to
13166 functions that are marked to not use the PLT to use the GOT instead.
13168 @item -fno-jump-tables
13169 @opindex fno-jump-tables
13170 Do not use jump tables for switch statements even where it would be
13171 more efficient than other code generation strategies. This option is
13172 of use in conjunction with @option{-fpic} or @option{-fPIC} for
13173 building code that forms part of a dynamic linker and cannot
13174 reference the address of a jump table. On some targets, jump tables
13175 do not require a GOT and this option is not needed.
13177 @item -ffixed-@var{reg}
13179 Treat the register named @var{reg} as a fixed register; generated code
13180 should never refer to it (except perhaps as a stack pointer, frame
13181 pointer or in some other fixed role).
13183 @var{reg} must be the name of a register. The register names accepted
13184 are machine-specific and are defined in the @code{REGISTER_NAMES}
13185 macro in the machine description macro file.
13187 This flag does not have a negative form, because it specifies a
13190 @item -fcall-used-@var{reg}
13191 @opindex fcall-used
13192 Treat the register named @var{reg} as an allocable register that is
13193 clobbered by function calls. It may be allocated for temporaries or
13194 variables that do not live across a call. Functions compiled this way
13195 do not save and restore the register @var{reg}.
13197 It is an error to use this flag with the frame pointer or stack pointer.
13198 Use of this flag for other registers that have fixed pervasive roles in
13199 the machine's execution model produces disastrous results.
13201 This flag does not have a negative form, because it specifies a
13204 @item -fcall-saved-@var{reg}
13205 @opindex fcall-saved
13206 Treat the register named @var{reg} as an allocable register saved by
13207 functions. It may be allocated even for temporaries or variables that
13208 live across a call. Functions compiled this way save and restore
13209 the register @var{reg} if they use it.
13211 It is an error to use this flag with the frame pointer or stack pointer.
13212 Use of this flag for other registers that have fixed pervasive roles in
13213 the machine's execution model produces disastrous results.
13215 A different sort of disaster results from the use of this flag for
13216 a register in which function values may be returned.
13218 This flag does not have a negative form, because it specifies a
13221 @item -fpack-struct[=@var{n}]
13222 @opindex fpack-struct
13223 Without a value specified, pack all structure members together without
13224 holes. When a value is specified (which must be a small power of two), pack
13225 structure members according to this value, representing the maximum
13226 alignment (that is, objects with default alignment requirements larger than
13227 this are output potentially unaligned at the next fitting location.
13229 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
13230 code that is not binary compatible with code generated without that switch.
13231 Additionally, it makes the code suboptimal.
13232 Use it to conform to a non-default application binary interface.
13234 @item -fleading-underscore
13235 @opindex fleading-underscore
13236 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
13237 change the way C symbols are represented in the object file. One use
13238 is to help link with legacy assembly code.
13240 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
13241 generate code that is not binary compatible with code generated without that
13242 switch. Use it to conform to a non-default application binary interface.
13243 Not all targets provide complete support for this switch.
13245 @item -ftls-model=@var{model}
13246 @opindex ftls-model
13247 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
13248 The @var{model} argument should be one of @samp{global-dynamic},
13249 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
13250 Note that the choice is subject to optimization: the compiler may use
13251 a more efficient model for symbols not visible outside of the translation
13252 unit, or if @option{-fpic} is not given on the command line.
13254 The default without @option{-fpic} is @samp{initial-exec}; with
13255 @option{-fpic} the default is @samp{global-dynamic}.
13257 @item -ftrampolines
13258 @opindex ftrampolines
13259 For targets that normally need trampolines for nested functions, always
13260 generate them instead of using descriptors. Otherwise, for targets that
13261 do not need them, like for example HP-PA or IA-64, do nothing.
13263 A trampoline is a small piece of code that is created at run time on the
13264 stack when the address of a nested function is taken, and is used to call
13265 the nested function indirectly. Therefore, it requires the stack to be
13266 made executable in order for the program to work properly.
13268 @option{-fno-trampolines} is enabled by default on a language by language
13269 basis to let the compiler avoid generating them, if it computes that this
13270 is safe, and replace them with descriptors. Descriptors are made up of data
13271 only, but the generated code must be prepared to deal with them. As of this
13272 writing, @option{-fno-trampolines} is enabled by default only for Ada.
13274 Moreover, code compiled with @option{-ftrampolines} and code compiled with
13275 @option{-fno-trampolines} are not binary compatible if nested functions are
13276 present. This option must therefore be used on a program-wide basis and be
13277 manipulated with extreme care.
13279 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
13280 @opindex fvisibility
13281 Set the default ELF image symbol visibility to the specified option---all
13282 symbols are marked with this unless overridden within the code.
13283 Using this feature can very substantially improve linking and
13284 load times of shared object libraries, produce more optimized
13285 code, provide near-perfect API export and prevent symbol clashes.
13286 It is @strong{strongly} recommended that you use this in any shared objects
13289 Despite the nomenclature, @samp{default} always means public; i.e.,
13290 available to be linked against from outside the shared object.
13291 @samp{protected} and @samp{internal} are pretty useless in real-world
13292 usage so the only other commonly used option is @samp{hidden}.
13293 The default if @option{-fvisibility} isn't specified is
13294 @samp{default}, i.e., make every symbol public.
13296 A good explanation of the benefits offered by ensuring ELF
13297 symbols have the correct visibility is given by ``How To Write
13298 Shared Libraries'' by Ulrich Drepper (which can be found at
13299 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
13300 solution made possible by this option to marking things hidden when
13301 the default is public is to make the default hidden and mark things
13302 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
13303 and @code{__attribute__ ((visibility("default")))} instead of
13304 @code{__declspec(dllexport)} you get almost identical semantics with
13305 identical syntax. This is a great boon to those working with
13306 cross-platform projects.
13308 For those adding visibility support to existing code, you may find
13309 @code{#pragma GCC visibility} of use. This works by you enclosing
13310 the declarations you wish to set visibility for with (for example)
13311 @code{#pragma GCC visibility push(hidden)} and
13312 @code{#pragma GCC visibility pop}.
13313 Bear in mind that symbol visibility should be viewed @strong{as
13314 part of the API interface contract} and thus all new code should
13315 always specify visibility when it is not the default; i.e., declarations
13316 only for use within the local DSO should @strong{always} be marked explicitly
13317 as hidden as so to avoid PLT indirection overheads---making this
13318 abundantly clear also aids readability and self-documentation of the code.
13319 Note that due to ISO C++ specification requirements, @code{operator new} and
13320 @code{operator delete} must always be of default visibility.
13322 Be aware that headers from outside your project, in particular system
13323 headers and headers from any other library you use, may not be
13324 expecting to be compiled with visibility other than the default. You
13325 may need to explicitly say @code{#pragma GCC visibility push(default)}
13326 before including any such headers.
13328 @code{extern} declarations are not affected by @option{-fvisibility}, so
13329 a lot of code can be recompiled with @option{-fvisibility=hidden} with
13330 no modifications. However, this means that calls to @code{extern}
13331 functions with no explicit visibility use the PLT, so it is more
13332 effective to use @code{__attribute ((visibility))} and/or
13333 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
13334 declarations should be treated as hidden.
13336 Note that @option{-fvisibility} does affect C++ vague linkage
13337 entities. This means that, for instance, an exception class that is
13338 be thrown between DSOs must be explicitly marked with default
13339 visibility so that the @samp{type_info} nodes are unified between
13342 An overview of these techniques, their benefits and how to use them
13343 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
13345 @item -fstrict-volatile-bitfields
13346 @opindex fstrict-volatile-bitfields
13347 This option should be used if accesses to volatile bit-fields (or other
13348 structure fields, although the compiler usually honors those types
13349 anyway) should use a single access of the width of the
13350 field's type, aligned to a natural alignment if possible. For
13351 example, targets with memory-mapped peripheral registers might require
13352 all such accesses to be 16 bits wide; with this flag you can
13353 declare all peripheral bit-fields as @code{unsigned short} (assuming short
13354 is 16 bits on these targets) to force GCC to use 16-bit accesses
13355 instead of, perhaps, a more efficient 32-bit access.
13357 If this option is disabled, the compiler uses the most efficient
13358 instruction. In the previous example, that might be a 32-bit load
13359 instruction, even though that accesses bytes that do not contain
13360 any portion of the bit-field, or memory-mapped registers unrelated to
13361 the one being updated.
13363 In some cases, such as when the @code{packed} attribute is applied to a
13364 structure field, it may not be possible to access the field with a single
13365 read or write that is correctly aligned for the target machine. In this
13366 case GCC falls back to generating multiple accesses rather than code that
13367 will fault or truncate the result at run time.
13369 Note: Due to restrictions of the C/C++11 memory model, write accesses are
13370 not allowed to touch non bit-field members. It is therefore recommended
13371 to define all bits of the field's type as bit-field members.
13373 The default value of this option is determined by the application binary
13374 interface for the target processor.
13376 @item -fsync-libcalls
13377 @opindex fsync-libcalls
13378 This option controls whether any out-of-line instance of the @code{__sync}
13379 family of functions may be used to implement the C++11 @code{__atomic}
13380 family of functions.
13382 The default value of this option is enabled, thus the only useful form
13383 of the option is @option{-fno-sync-libcalls}. This option is used in
13384 the implementation of the @file{libatomic} runtime library.
13388 @node Developer Options
13389 @section GCC Developer Options
13390 @cindex developer options
13391 @cindex debugging GCC
13392 @cindex debug dump options
13393 @cindex dump options
13394 @cindex compilation statistics
13396 This section describes command-line options that are primarily of
13397 interest to GCC developers, including options to support compiler
13398 testing and investigation of compiler bugs and compile-time
13399 performance problems. This includes options that produce debug dumps
13400 at various points in the compilation; that print statistics such as
13401 memory use and execution time; and that print information about GCC's
13402 configuration, such as where it searches for libraries. You should
13403 rarely need to use any of these options for ordinary compilation and
13406 Many developer options that cause GCC to dump output to a file take an
13407 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
13408 or @samp{-} to dump to standard output, and @samp{stderr} for standard
13411 If @samp{=@var{filename}} is omitted, a default dump file name is
13412 constructed by concatenating the base dump file name, a pass number,
13413 phase letter, and pass name. The base dump file name is the name of
13414 output file produced by the compiler if explicitly specified and not
13415 an executable; otherwise it is the source file name.
13416 The pass number is determined by the order passes are registered with
13417 the compiler's pass manager.
13418 This is generally the same as the order of execution, but passes
13419 registered by plugins, target-specific passes, or passes that are
13420 otherwise registered late are numbered higher than the pass named
13421 @samp{final}, even if they are executed earlier. The phase letter is
13422 one of @samp{i} (inter-procedural analysis), @samp{l}
13423 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
13424 The files are created in the directory of the output file.
13428 @item -d@var{letters}
13429 @itemx -fdump-rtl-@var{pass}
13430 @itemx -fdump-rtl-@var{pass}=@var{filename}
13432 @opindex fdump-rtl-@var{pass}
13433 Says to make debugging dumps during compilation at times specified by
13434 @var{letters}. This is used for debugging the RTL-based passes of the
13437 Some @option{-d@var{letters}} switches have different meaning when
13438 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
13439 for information about preprocessor-specific dump options.
13441 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
13442 @option{-d} option @var{letters}. Here are the possible
13443 letters for use in @var{pass} and @var{letters}, and their meanings:
13447 @item -fdump-rtl-alignments
13448 @opindex fdump-rtl-alignments
13449 Dump after branch alignments have been computed.
13451 @item -fdump-rtl-asmcons
13452 @opindex fdump-rtl-asmcons
13453 Dump after fixing rtl statements that have unsatisfied in/out constraints.
13455 @item -fdump-rtl-auto_inc_dec
13456 @opindex fdump-rtl-auto_inc_dec
13457 Dump after auto-inc-dec discovery. This pass is only run on
13458 architectures that have auto inc or auto dec instructions.
13460 @item -fdump-rtl-barriers
13461 @opindex fdump-rtl-barriers
13462 Dump after cleaning up the barrier instructions.
13464 @item -fdump-rtl-bbpart
13465 @opindex fdump-rtl-bbpart
13466 Dump after partitioning hot and cold basic blocks.
13468 @item -fdump-rtl-bbro
13469 @opindex fdump-rtl-bbro
13470 Dump after block reordering.
13472 @item -fdump-rtl-btl1
13473 @itemx -fdump-rtl-btl2
13474 @opindex fdump-rtl-btl2
13475 @opindex fdump-rtl-btl2
13476 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
13477 after the two branch
13478 target load optimization passes.
13480 @item -fdump-rtl-bypass
13481 @opindex fdump-rtl-bypass
13482 Dump after jump bypassing and control flow optimizations.
13484 @item -fdump-rtl-combine
13485 @opindex fdump-rtl-combine
13486 Dump after the RTL instruction combination pass.
13488 @item -fdump-rtl-compgotos
13489 @opindex fdump-rtl-compgotos
13490 Dump after duplicating the computed gotos.
13492 @item -fdump-rtl-ce1
13493 @itemx -fdump-rtl-ce2
13494 @itemx -fdump-rtl-ce3
13495 @opindex fdump-rtl-ce1
13496 @opindex fdump-rtl-ce2
13497 @opindex fdump-rtl-ce3
13498 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
13499 @option{-fdump-rtl-ce3} enable dumping after the three
13500 if conversion passes.
13502 @item -fdump-rtl-cprop_hardreg
13503 @opindex fdump-rtl-cprop_hardreg
13504 Dump after hard register copy propagation.
13506 @item -fdump-rtl-csa
13507 @opindex fdump-rtl-csa
13508 Dump after combining stack adjustments.
13510 @item -fdump-rtl-cse1
13511 @itemx -fdump-rtl-cse2
13512 @opindex fdump-rtl-cse1
13513 @opindex fdump-rtl-cse2
13514 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
13515 the two common subexpression elimination passes.
13517 @item -fdump-rtl-dce
13518 @opindex fdump-rtl-dce
13519 Dump after the standalone dead code elimination passes.
13521 @item -fdump-rtl-dbr
13522 @opindex fdump-rtl-dbr
13523 Dump after delayed branch scheduling.
13525 @item -fdump-rtl-dce1
13526 @itemx -fdump-rtl-dce2
13527 @opindex fdump-rtl-dce1
13528 @opindex fdump-rtl-dce2
13529 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
13530 the two dead store elimination passes.
13532 @item -fdump-rtl-eh
13533 @opindex fdump-rtl-eh
13534 Dump after finalization of EH handling code.
13536 @item -fdump-rtl-eh_ranges
13537 @opindex fdump-rtl-eh_ranges
13538 Dump after conversion of EH handling range regions.
13540 @item -fdump-rtl-expand
13541 @opindex fdump-rtl-expand
13542 Dump after RTL generation.
13544 @item -fdump-rtl-fwprop1
13545 @itemx -fdump-rtl-fwprop2
13546 @opindex fdump-rtl-fwprop1
13547 @opindex fdump-rtl-fwprop2
13548 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
13549 dumping after the two forward propagation passes.
13551 @item -fdump-rtl-gcse1
13552 @itemx -fdump-rtl-gcse2
13553 @opindex fdump-rtl-gcse1
13554 @opindex fdump-rtl-gcse2
13555 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
13556 after global common subexpression elimination.
13558 @item -fdump-rtl-init-regs
13559 @opindex fdump-rtl-init-regs
13560 Dump after the initialization of the registers.
13562 @item -fdump-rtl-initvals
13563 @opindex fdump-rtl-initvals
13564 Dump after the computation of the initial value sets.
13566 @item -fdump-rtl-into_cfglayout
13567 @opindex fdump-rtl-into_cfglayout
13568 Dump after converting to cfglayout mode.
13570 @item -fdump-rtl-ira
13571 @opindex fdump-rtl-ira
13572 Dump after iterated register allocation.
13574 @item -fdump-rtl-jump
13575 @opindex fdump-rtl-jump
13576 Dump after the second jump optimization.
13578 @item -fdump-rtl-loop2
13579 @opindex fdump-rtl-loop2
13580 @option{-fdump-rtl-loop2} enables dumping after the rtl
13581 loop optimization passes.
13583 @item -fdump-rtl-mach
13584 @opindex fdump-rtl-mach
13585 Dump after performing the machine dependent reorganization pass, if that
13588 @item -fdump-rtl-mode_sw
13589 @opindex fdump-rtl-mode_sw
13590 Dump after removing redundant mode switches.
13592 @item -fdump-rtl-rnreg
13593 @opindex fdump-rtl-rnreg
13594 Dump after register renumbering.
13596 @item -fdump-rtl-outof_cfglayout
13597 @opindex fdump-rtl-outof_cfglayout
13598 Dump after converting from cfglayout mode.
13600 @item -fdump-rtl-peephole2
13601 @opindex fdump-rtl-peephole2
13602 Dump after the peephole pass.
13604 @item -fdump-rtl-postreload
13605 @opindex fdump-rtl-postreload
13606 Dump after post-reload optimizations.
13608 @item -fdump-rtl-pro_and_epilogue
13609 @opindex fdump-rtl-pro_and_epilogue
13610 Dump after generating the function prologues and epilogues.
13612 @item -fdump-rtl-sched1
13613 @itemx -fdump-rtl-sched2
13614 @opindex fdump-rtl-sched1
13615 @opindex fdump-rtl-sched2
13616 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
13617 after the basic block scheduling passes.
13619 @item -fdump-rtl-ree
13620 @opindex fdump-rtl-ree
13621 Dump after sign/zero extension elimination.
13623 @item -fdump-rtl-seqabstr
13624 @opindex fdump-rtl-seqabstr
13625 Dump after common sequence discovery.
13627 @item -fdump-rtl-shorten
13628 @opindex fdump-rtl-shorten
13629 Dump after shortening branches.
13631 @item -fdump-rtl-sibling
13632 @opindex fdump-rtl-sibling
13633 Dump after sibling call optimizations.
13635 @item -fdump-rtl-split1
13636 @itemx -fdump-rtl-split2
13637 @itemx -fdump-rtl-split3
13638 @itemx -fdump-rtl-split4
13639 @itemx -fdump-rtl-split5
13640 @opindex fdump-rtl-split1
13641 @opindex fdump-rtl-split2
13642 @opindex fdump-rtl-split3
13643 @opindex fdump-rtl-split4
13644 @opindex fdump-rtl-split5
13645 These options enable dumping after five rounds of
13646 instruction splitting.
13648 @item -fdump-rtl-sms
13649 @opindex fdump-rtl-sms
13650 Dump after modulo scheduling. This pass is only run on some
13653 @item -fdump-rtl-stack
13654 @opindex fdump-rtl-stack
13655 Dump after conversion from GCC's ``flat register file'' registers to the
13656 x87's stack-like registers. This pass is only run on x86 variants.
13658 @item -fdump-rtl-subreg1
13659 @itemx -fdump-rtl-subreg2
13660 @opindex fdump-rtl-subreg1
13661 @opindex fdump-rtl-subreg2
13662 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
13663 the two subreg expansion passes.
13665 @item -fdump-rtl-unshare
13666 @opindex fdump-rtl-unshare
13667 Dump after all rtl has been unshared.
13669 @item -fdump-rtl-vartrack
13670 @opindex fdump-rtl-vartrack
13671 Dump after variable tracking.
13673 @item -fdump-rtl-vregs
13674 @opindex fdump-rtl-vregs
13675 Dump after converting virtual registers to hard registers.
13677 @item -fdump-rtl-web
13678 @opindex fdump-rtl-web
13679 Dump after live range splitting.
13681 @item -fdump-rtl-regclass
13682 @itemx -fdump-rtl-subregs_of_mode_init
13683 @itemx -fdump-rtl-subregs_of_mode_finish
13684 @itemx -fdump-rtl-dfinit
13685 @itemx -fdump-rtl-dfinish
13686 @opindex fdump-rtl-regclass
13687 @opindex fdump-rtl-subregs_of_mode_init
13688 @opindex fdump-rtl-subregs_of_mode_finish
13689 @opindex fdump-rtl-dfinit
13690 @opindex fdump-rtl-dfinish
13691 These dumps are defined but always produce empty files.
13694 @itemx -fdump-rtl-all
13696 @opindex fdump-rtl-all
13697 Produce all the dumps listed above.
13701 Annotate the assembler output with miscellaneous debugging information.
13705 Dump all macro definitions, at the end of preprocessing, in addition to
13710 Produce a core dump whenever an error occurs.
13714 Annotate the assembler output with a comment indicating which
13715 pattern and alternative is used. The length and cost of each instruction are
13720 Dump the RTL in the assembler output as a comment before each instruction.
13721 Also turns on @option{-dp} annotation.
13725 Just generate RTL for a function instead of compiling it. Usually used
13726 with @option{-fdump-rtl-expand}.
13729 @item -fdump-noaddr
13730 @opindex fdump-noaddr
13731 When doing debugging dumps, suppress address output. This makes it more
13732 feasible to use diff on debugging dumps for compiler invocations with
13733 different compiler binaries and/or different
13734 text / bss / data / heap / stack / dso start locations.
13737 @opindex freport-bug
13738 Collect and dump debug information into a temporary file if an
13739 internal compiler error (ICE) occurs.
13741 @item -fdump-unnumbered
13742 @opindex fdump-unnumbered
13743 When doing debugging dumps, suppress instruction numbers and address output.
13744 This makes it more feasible to use diff on debugging dumps for compiler
13745 invocations with different options, in particular with and without
13748 @item -fdump-unnumbered-links
13749 @opindex fdump-unnumbered-links
13750 When doing debugging dumps (see @option{-d} option above), suppress
13751 instruction numbers for the links to the previous and next instructions
13754 @item -fdump-ipa-@var{switch}
13756 Control the dumping at various stages of inter-procedural analysis
13757 language tree to a file. The file name is generated by appending a
13758 switch specific suffix to the source file name, and the file is created
13759 in the same directory as the output file. The following dumps are
13764 Enables all inter-procedural analysis dumps.
13767 Dumps information about call-graph optimization, unused function removal,
13768 and inlining decisions.
13771 Dump after function inlining.
13775 @item -fdump-lang-all
13776 @itemx -fdump-lang-@var{switch}
13777 @itemx -fdump-lang-@var{switch}-@var{options}
13778 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
13779 @opindex fdump-lang-all
13780 @opindex fdump-lang
13781 Control the dumping of language-specific information. The @var{options}
13782 and @var{filename} portions behave as described in the
13783 @option{-fdump-tree} option. The following @var{switch} values are
13789 Enable all language-specific dumps.
13792 Dump class hierarchy information. Virtual table information is emitted
13793 unless '@option{slim}' is specified. This option is applicable to C++ only.
13796 Dump the raw internal tree data. This option is applicable to C++ only.
13800 @item -fdump-passes
13801 @opindex fdump-passes
13802 Print on @file{stderr} the list of optimization passes that are turned
13803 on and off by the current command-line options.
13805 @item -fdump-statistics-@var{option}
13806 @opindex fdump-statistics
13807 Enable and control dumping of pass statistics in a separate file. The
13808 file name is generated by appending a suffix ending in
13809 @samp{.statistics} to the source file name, and the file is created in
13810 the same directory as the output file. If the @samp{-@var{option}}
13811 form is used, @samp{-stats} causes counters to be summed over the
13812 whole compilation unit while @samp{-details} dumps every event as
13813 the passes generate them. The default with no option is to sum
13814 counters for each function compiled.
13816 @item -fdump-tree-all
13817 @itemx -fdump-tree-@var{switch}
13818 @itemx -fdump-tree-@var{switch}-@var{options}
13819 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
13820 @opindex fdump-tree-all
13821 @opindex fdump-tree
13822 Control the dumping at various stages of processing the intermediate
13823 language tree to a file. If the @samp{-@var{options}}
13824 form is used, @var{options} is a list of @samp{-} separated options
13825 which control the details of the dump. Not all options are applicable
13826 to all dumps; those that are not meaningful are ignored. The
13827 following options are available
13831 Print the address of each node. Usually this is not meaningful as it
13832 changes according to the environment and source file. Its primary use
13833 is for tying up a dump file with a debug environment.
13835 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
13836 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
13837 use working backward from mangled names in the assembly file.
13839 When dumping front-end intermediate representations, inhibit dumping
13840 of members of a scope or body of a function merely because that scope
13841 has been reached. Only dump such items when they are directly reachable
13842 by some other path.
13844 When dumping pretty-printed trees, this option inhibits dumping the
13845 bodies of control structures.
13847 When dumping RTL, print the RTL in slim (condensed) form instead of
13848 the default LISP-like representation.
13850 Print a raw representation of the tree. By default, trees are
13851 pretty-printed into a C-like representation.
13853 Enable more detailed dumps (not honored by every dump option). Also
13854 include information from the optimization passes.
13856 Enable dumping various statistics about the pass (not honored by every dump
13859 Enable showing basic block boundaries (disabled in raw dumps).
13861 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
13862 dump a representation of the control flow graph suitable for viewing with
13863 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
13864 the file is pretty-printed as a subgraph, so that GraphViz can render them
13865 all in a single plot.
13867 This option currently only works for RTL dumps, and the RTL is always
13868 dumped in slim form.
13870 Enable showing virtual operands for every statement.
13872 Enable showing line numbers for statements.
13874 Enable showing the unique ID (@code{DECL_UID}) for each variable.
13876 Enable showing the tree dump for each statement.
13878 Enable showing the EH region number holding each statement.
13880 Enable showing scalar evolution analysis details.
13882 Enable showing optimization information (only available in certain
13885 Enable showing missed optimization information (only available in certain
13888 Enable other detailed optimization information (only available in
13891 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
13892 and @option{lineno}.
13894 Turn on all optimization options, i.e., @option{optimized},
13895 @option{missed}, and @option{note}.
13898 To determine what tree dumps are available or find the dump for a pass
13899 of interest follow the steps below.
13903 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
13904 look for a code that corresponds to the pass you are interested in.
13905 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
13906 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
13907 The number at the end distinguishes distinct invocations of the same pass.
13909 To enable the creation of the dump file, append the pass code to
13910 the @option{-fdump-} option prefix and invoke GCC with it. For example,
13911 to enable the dump from the Early Value Range Propagation pass, invoke
13912 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
13913 specify the name of the dump file. If you don't specify one, GCC
13914 creates as described below.
13916 Find the pass dump in a file whose name is composed of three components
13917 separated by a period: the name of the source file GCC was invoked to
13918 compile, a numeric suffix indicating the pass number followed by the
13919 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
13920 and finally the pass code. For example, the Early VRP pass dump might
13921 be in a file named @file{myfile.c.038t.evrp} in the current working
13922 directory. Note that the numeric codes are not stable and may change
13923 from one version of GCC to another.
13927 @itemx -fopt-info-@var{options}
13928 @itemx -fopt-info-@var{options}=@var{filename}
13930 Controls optimization dumps from various optimization passes. If the
13931 @samp{-@var{options}} form is used, @var{options} is a list of
13932 @samp{-} separated option keywords to select the dump details and
13935 The @var{options} can be divided into two groups: options describing the
13936 verbosity of the dump, and options describing which optimizations
13937 should be included. The options from both the groups can be freely
13938 mixed as they are non-overlapping. However, in case of any conflicts,
13939 the later options override the earlier options on the command
13942 The following options control the dump verbosity:
13946 Print information when an optimization is successfully applied. It is
13947 up to a pass to decide which information is relevant. For example, the
13948 vectorizer passes print the source location of loops which are
13949 successfully vectorized.
13951 Print information about missed optimizations. Individual passes
13952 control which information to include in the output.
13954 Print verbose information about optimizations, such as certain
13955 transformations, more detailed messages about decisions etc.
13957 Print detailed optimization information. This includes
13958 @samp{optimized}, @samp{missed}, and @samp{note}.
13961 One or more of the following option keywords can be used to describe a
13962 group of optimizations:
13966 Enable dumps from all interprocedural optimizations.
13968 Enable dumps from all loop optimizations.
13970 Enable dumps from all inlining optimizations.
13972 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
13974 Enable dumps from all vectorization optimizations.
13976 Enable dumps from all optimizations. This is a superset of
13977 the optimization groups listed above.
13980 If @var{options} is
13981 omitted, it defaults to @samp{optimized-optall}, which means to dump all
13982 info about successful optimizations from all the passes.
13984 If the @var{filename} is provided, then the dumps from all the
13985 applicable optimizations are concatenated into the @var{filename}.
13986 Otherwise the dump is output onto @file{stderr}. Though multiple
13987 @option{-fopt-info} options are accepted, only one of them can include
13988 a @var{filename}. If other filenames are provided then all but the
13989 first such option are ignored.
13991 Note that the output @var{filename} is overwritten
13992 in case of multiple translation units. If a combined output from
13993 multiple translation units is desired, @file{stderr} should be used
13996 In the following example, the optimization info is output to
14005 gcc -O3 -fopt-info-missed=missed.all
14009 outputs missed optimization report from all the passes into
14010 @file{missed.all}, and this one:
14013 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
14017 prints information about missed optimization opportunities from
14018 vectorization passes on @file{stderr}.
14019 Note that @option{-fopt-info-vec-missed} is equivalent to
14020 @option{-fopt-info-missed-vec}. The order of the optimization group
14021 names and message types listed after @option{-fopt-info} does not matter.
14023 As another example,
14025 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
14029 outputs information about missed optimizations as well as
14030 optimized locations from all the inlining passes into
14036 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
14040 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
14041 in conflict since only one output file is allowed. In this case, only
14042 the first option takes effect and the subsequent options are
14043 ignored. Thus only @file{vec.miss} is produced which contains
14044 dumps from the vectorizer about missed opportunities.
14046 @item -fsave-optimization-record
14047 @opindex fsave-optimization-record
14048 Write a SRCFILE.opt-record.json file detailing what optimizations
14049 were performed, for those optimizations that support @option{-fopt-info}.
14051 This option is experimental and the format of the data within the JSON
14052 file is subject to change.
14054 It is roughly equivalent to a machine-readable version of
14055 @option{-fopt-info-all}, as a collection of messages with source file,
14056 line number and column number, with the following additional data for
14062 the execution count of the code being optimized, along with metadata about
14063 whether this was from actual profile data, or just an estimate, allowing
14064 consumers to prioritize messages by code hotness,
14067 the function name of the code being optimized, where applicable,
14070 the ``inlining chain'' for the code being optimized, so that when
14071 a function is inlined into several different places (which might
14072 themselves be inlined), the reader can distinguish between the copies,
14075 objects identifying those parts of the message that refer to expressions,
14076 statements or symbol-table nodes, which of these categories they are, and,
14077 when available, their source code location,
14080 the GCC pass that emitted the message, and
14083 the location in GCC's own code from which the message was emitted
14087 Additionally, some messages are logically nested within other
14088 messages, reflecting implementation details of the optimization
14091 @item -fsched-verbose=@var{n}
14092 @opindex fsched-verbose
14093 On targets that use instruction scheduling, this option controls the
14094 amount of debugging output the scheduler prints to the dump files.
14096 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
14097 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
14098 For @var{n} greater than one, it also output basic block probabilities,
14099 detailed ready list information and unit/insn info. For @var{n} greater
14100 than two, it includes RTL at abort point, control-flow and regions info.
14101 And for @var{n} over four, @option{-fsched-verbose} also includes
14106 @item -fenable-@var{kind}-@var{pass}
14107 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
14111 This is a set of options that are used to explicitly disable/enable
14112 optimization passes. These options are intended for use for debugging GCC.
14113 Compiler users should use regular options for enabling/disabling
14118 @item -fdisable-ipa-@var{pass}
14119 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
14120 statically invoked in the compiler multiple times, the pass name should be
14121 appended with a sequential number starting from 1.
14123 @item -fdisable-rtl-@var{pass}
14124 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
14125 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
14126 statically invoked in the compiler multiple times, the pass name should be
14127 appended with a sequential number starting from 1. @var{range-list} is a
14128 comma-separated list of function ranges or assembler names. Each range is a number
14129 pair separated by a colon. The range is inclusive in both ends. If the range
14130 is trivial, the number pair can be simplified as a single number. If the
14131 function's call graph node's @var{uid} falls within one of the specified ranges,
14132 the @var{pass} is disabled for that function. The @var{uid} is shown in the
14133 function header of a dump file, and the pass names can be dumped by using
14134 option @option{-fdump-passes}.
14136 @item -fdisable-tree-@var{pass}
14137 @itemx -fdisable-tree-@var{pass}=@var{range-list}
14138 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
14141 @item -fenable-ipa-@var{pass}
14142 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
14143 statically invoked in the compiler multiple times, the pass name should be
14144 appended with a sequential number starting from 1.
14146 @item -fenable-rtl-@var{pass}
14147 @itemx -fenable-rtl-@var{pass}=@var{range-list}
14148 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
14149 description and examples.
14151 @item -fenable-tree-@var{pass}
14152 @itemx -fenable-tree-@var{pass}=@var{range-list}
14153 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
14154 of option arguments.
14158 Here are some examples showing uses of these options.
14162 # disable ccp1 for all functions
14163 -fdisable-tree-ccp1
14164 # disable complete unroll for function whose cgraph node uid is 1
14165 -fenable-tree-cunroll=1
14166 # disable gcse2 for functions at the following ranges [1,1],
14167 # [300,400], and [400,1000]
14168 # disable gcse2 for functions foo and foo2
14169 -fdisable-rtl-gcse2=foo,foo2
14170 # disable early inlining
14171 -fdisable-tree-einline
14172 # disable ipa inlining
14173 -fdisable-ipa-inline
14174 # enable tree full unroll
14175 -fenable-tree-unroll
14180 @itemx -fchecking=@var{n}
14182 @opindex fno-checking
14183 Enable internal consistency checking. The default depends on
14184 the compiler configuration. @option{-fchecking=2} enables further
14185 internal consistency checking that might affect code generation.
14187 @item -frandom-seed=@var{string}
14188 @opindex frandom-seed
14189 This option provides a seed that GCC uses in place of
14190 random numbers in generating certain symbol names
14191 that have to be different in every compiled file. It is also used to
14192 place unique stamps in coverage data files and the object files that
14193 produce them. You can use the @option{-frandom-seed} option to produce
14194 reproducibly identical object files.
14196 The @var{string} can either be a number (decimal, octal or hex) or an
14197 arbitrary string (in which case it's converted to a number by
14200 The @var{string} should be different for every file you compile.
14203 @itemx -save-temps=cwd
14204 @opindex save-temps
14205 Store the usual ``temporary'' intermediate files permanently; place them
14206 in the current directory and name them based on the source file. Thus,
14207 compiling @file{foo.c} with @option{-c -save-temps} produces files
14208 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
14209 preprocessed @file{foo.i} output file even though the compiler now
14210 normally uses an integrated preprocessor.
14212 When used in combination with the @option{-x} command-line option,
14213 @option{-save-temps} is sensible enough to avoid over writing an
14214 input source file with the same extension as an intermediate file.
14215 The corresponding intermediate file may be obtained by renaming the
14216 source file before using @option{-save-temps}.
14218 If you invoke GCC in parallel, compiling several different source
14219 files that share a common base name in different subdirectories or the
14220 same source file compiled for multiple output destinations, it is
14221 likely that the different parallel compilers will interfere with each
14222 other, and overwrite the temporary files. For instance:
14225 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
14226 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
14229 may result in @file{foo.i} and @file{foo.o} being written to
14230 simultaneously by both compilers.
14232 @item -save-temps=obj
14233 @opindex save-temps=obj
14234 Store the usual ``temporary'' intermediate files permanently. If the
14235 @option{-o} option is used, the temporary files are based on the
14236 object file. If the @option{-o} option is not used, the
14237 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
14242 gcc -save-temps=obj -c foo.c
14243 gcc -save-temps=obj -c bar.c -o dir/xbar.o
14244 gcc -save-temps=obj foobar.c -o dir2/yfoobar
14248 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
14249 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
14250 @file{dir2/yfoobar.o}.
14252 @item -time@r{[}=@var{file}@r{]}
14254 Report the CPU time taken by each subprocess in the compilation
14255 sequence. For C source files, this is the compiler proper and assembler
14256 (plus the linker if linking is done).
14258 Without the specification of an output file, the output looks like this:
14265 The first number on each line is the ``user time'', that is time spent
14266 executing the program itself. The second number is ``system time'',
14267 time spent executing operating system routines on behalf of the program.
14268 Both numbers are in seconds.
14270 With the specification of an output file, the output is appended to the
14271 named file, and it looks like this:
14274 0.12 0.01 cc1 @var{options}
14275 0.00 0.01 as @var{options}
14278 The ``user time'' and the ``system time'' are moved before the program
14279 name, and the options passed to the program are displayed, so that one
14280 can later tell what file was being compiled, and with which options.
14282 @item -fdump-final-insns@r{[}=@var{file}@r{]}
14283 @opindex fdump-final-insns
14284 Dump the final internal representation (RTL) to @var{file}. If the
14285 optional argument is omitted (or if @var{file} is @code{.}), the name
14286 of the dump file is determined by appending @code{.gkd} to the
14287 compilation output file name.
14289 @item -fcompare-debug@r{[}=@var{opts}@r{]}
14290 @opindex fcompare-debug
14291 @opindex fno-compare-debug
14292 If no error occurs during compilation, run the compiler a second time,
14293 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
14294 passed to the second compilation. Dump the final internal
14295 representation in both compilations, and print an error if they differ.
14297 If the equal sign is omitted, the default @option{-gtoggle} is used.
14299 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
14300 and nonzero, implicitly enables @option{-fcompare-debug}. If
14301 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
14302 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
14305 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
14306 is equivalent to @option{-fno-compare-debug}, which disables the dumping
14307 of the final representation and the second compilation, preventing even
14308 @env{GCC_COMPARE_DEBUG} from taking effect.
14310 To verify full coverage during @option{-fcompare-debug} testing, set
14311 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
14312 which GCC rejects as an invalid option in any actual compilation
14313 (rather than preprocessing, assembly or linking). To get just a
14314 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
14315 not overridden} will do.
14317 @item -fcompare-debug-second
14318 @opindex fcompare-debug-second
14319 This option is implicitly passed to the compiler for the second
14320 compilation requested by @option{-fcompare-debug}, along with options to
14321 silence warnings, and omitting other options that would cause the compiler
14322 to produce output to files or to standard output as a side effect. Dump
14323 files and preserved temporary files are renamed so as to contain the
14324 @code{.gk} additional extension during the second compilation, to avoid
14325 overwriting those generated by the first.
14327 When this option is passed to the compiler driver, it causes the
14328 @emph{first} compilation to be skipped, which makes it useful for little
14329 other than debugging the compiler proper.
14333 Turn off generation of debug info, if leaving out this option
14334 generates it, or turn it on at level 2 otherwise. The position of this
14335 argument in the command line does not matter; it takes effect after all
14336 other options are processed, and it does so only once, no matter how
14337 many times it is given. This is mainly intended to be used with
14338 @option{-fcompare-debug}.
14340 @item -fvar-tracking-assignments-toggle
14341 @opindex fvar-tracking-assignments-toggle
14342 @opindex fno-var-tracking-assignments-toggle
14343 Toggle @option{-fvar-tracking-assignments}, in the same way that
14344 @option{-gtoggle} toggles @option{-g}.
14348 Makes the compiler print out each function name as it is compiled, and
14349 print some statistics about each pass when it finishes.
14351 @item -ftime-report
14352 @opindex ftime-report
14353 Makes the compiler print some statistics about the time consumed by each
14354 pass when it finishes.
14356 @item -ftime-report-details
14357 @opindex ftime-report-details
14358 Record the time consumed by infrastructure parts separately for each pass.
14360 @item -fira-verbose=@var{n}
14361 @opindex fira-verbose
14362 Control the verbosity of the dump file for the integrated register allocator.
14363 The default value is 5. If the value @var{n} is greater or equal to 10,
14364 the dump output is sent to stderr using the same format as @var{n} minus 10.
14367 @opindex flto-report
14368 Prints a report with internal details on the workings of the link-time
14369 optimizer. The contents of this report vary from version to version.
14370 It is meant to be useful to GCC developers when processing object
14371 files in LTO mode (via @option{-flto}).
14373 Disabled by default.
14375 @item -flto-report-wpa
14376 @opindex flto-report-wpa
14377 Like @option{-flto-report}, but only print for the WPA phase of Link
14381 @opindex fmem-report
14382 Makes the compiler print some statistics about permanent memory
14383 allocation when it finishes.
14385 @item -fmem-report-wpa
14386 @opindex fmem-report-wpa
14387 Makes the compiler print some statistics about permanent memory
14388 allocation for the WPA phase only.
14390 @item -fpre-ipa-mem-report
14391 @opindex fpre-ipa-mem-report
14392 @item -fpost-ipa-mem-report
14393 @opindex fpost-ipa-mem-report
14394 Makes the compiler print some statistics about permanent memory
14395 allocation before or after interprocedural optimization.
14397 @item -fprofile-report
14398 @opindex fprofile-report
14399 Makes the compiler print some statistics about consistency of the
14400 (estimated) profile and effect of individual passes.
14402 @item -fstack-usage
14403 @opindex fstack-usage
14404 Makes the compiler output stack usage information for the program, on a
14405 per-function basis. The filename for the dump is made by appending
14406 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
14407 the output file, if explicitly specified and it is not an executable,
14408 otherwise it is the basename of the source file. An entry is made up
14413 The name of the function.
14417 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
14420 The qualifier @code{static} means that the function manipulates the stack
14421 statically: a fixed number of bytes are allocated for the frame on function
14422 entry and released on function exit; no stack adjustments are otherwise made
14423 in the function. The second field is this fixed number of bytes.
14425 The qualifier @code{dynamic} means that the function manipulates the stack
14426 dynamically: in addition to the static allocation described above, stack
14427 adjustments are made in the body of the function, for example to push/pop
14428 arguments around function calls. If the qualifier @code{bounded} is also
14429 present, the amount of these adjustments is bounded at compile time and
14430 the second field is an upper bound of the total amount of stack used by
14431 the function. If it is not present, the amount of these adjustments is
14432 not bounded at compile time and the second field only represents the
14437 Emit statistics about front-end processing at the end of the compilation.
14438 This option is supported only by the C++ front end, and
14439 the information is generally only useful to the G++ development team.
14441 @item -fdbg-cnt-list
14442 @opindex fdbg-cnt-list
14443 Print the name and the counter upper bound for all debug counters.
14446 @item -fdbg-cnt=@var{counter-value-list}
14448 Set the internal debug counter lower and upper bound. @var{counter-value-list}
14449 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
14450 tuples which sets the lower and the upper bound of each debug
14451 counter @var{name}. The @var{lower_bound} is optional and is zero
14452 initialized if not set.
14453 All debug counters have the initial upper bound of @code{UINT_MAX};
14454 thus @code{dbg_cnt} returns true always unless the upper bound
14455 is set by this option.
14456 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
14457 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
14458 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
14460 @item -print-file-name=@var{library}
14461 @opindex print-file-name
14462 Print the full absolute name of the library file @var{library} that
14463 would be used when linking---and don't do anything else. With this
14464 option, GCC does not compile or link anything; it just prints the
14467 @item -print-multi-directory
14468 @opindex print-multi-directory
14469 Print the directory name corresponding to the multilib selected by any
14470 other switches present in the command line. This directory is supposed
14471 to exist in @env{GCC_EXEC_PREFIX}.
14473 @item -print-multi-lib
14474 @opindex print-multi-lib
14475 Print the mapping from multilib directory names to compiler switches
14476 that enable them. The directory name is separated from the switches by
14477 @samp{;}, and each switch starts with an @samp{@@} instead of the
14478 @samp{-}, without spaces between multiple switches. This is supposed to
14479 ease shell processing.
14481 @item -print-multi-os-directory
14482 @opindex print-multi-os-directory
14483 Print the path to OS libraries for the selected
14484 multilib, relative to some @file{lib} subdirectory. If OS libraries are
14485 present in the @file{lib} subdirectory and no multilibs are used, this is
14486 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
14487 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
14488 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
14489 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
14491 @item -print-multiarch
14492 @opindex print-multiarch
14493 Print the path to OS libraries for the selected multiarch,
14494 relative to some @file{lib} subdirectory.
14496 @item -print-prog-name=@var{program}
14497 @opindex print-prog-name
14498 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
14500 @item -print-libgcc-file-name
14501 @opindex print-libgcc-file-name
14502 Same as @option{-print-file-name=libgcc.a}.
14504 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
14505 but you do want to link with @file{libgcc.a}. You can do:
14508 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
14511 @item -print-search-dirs
14512 @opindex print-search-dirs
14513 Print the name of the configured installation directory and a list of
14514 program and library directories @command{gcc} searches---and don't do anything else.
14516 This is useful when @command{gcc} prints the error message
14517 @samp{installation problem, cannot exec cpp0: No such file or directory}.
14518 To resolve this you either need to put @file{cpp0} and the other compiler
14519 components where @command{gcc} expects to find them, or you can set the environment
14520 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
14521 Don't forget the trailing @samp{/}.
14522 @xref{Environment Variables}.
14524 @item -print-sysroot
14525 @opindex print-sysroot
14526 Print the target sysroot directory that is used during
14527 compilation. This is the target sysroot specified either at configure
14528 time or using the @option{--sysroot} option, possibly with an extra
14529 suffix that depends on compilation options. If no target sysroot is
14530 specified, the option prints nothing.
14532 @item -print-sysroot-headers-suffix
14533 @opindex print-sysroot-headers-suffix
14534 Print the suffix added to the target sysroot when searching for
14535 headers, or give an error if the compiler is not configured with such
14536 a suffix---and don't do anything else.
14539 @opindex dumpmachine
14540 Print the compiler's target machine (for example,
14541 @samp{i686-pc-linux-gnu})---and don't do anything else.
14544 @opindex dumpversion
14545 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
14546 anything else. This is the compiler version used in filesystem paths,
14547 specs, can be depending on how the compiler has been configured just
14548 a single number (major version), two numbers separated by dot (major and
14549 minor version) or three numbers separated by dots (major, minor and patchlevel
14552 @item -dumpfullversion
14553 @opindex dumpfullversion
14554 Print the full compiler version, always 3 numbers separated by dots,
14555 major, minor and patchlevel version.
14559 Print the compiler's built-in specs---and don't do anything else. (This
14560 is used when GCC itself is being built.) @xref{Spec Files}.
14563 @node Submodel Options
14564 @section Machine-Dependent Options
14565 @cindex submodel options
14566 @cindex specifying hardware config
14567 @cindex hardware models and configurations, specifying
14568 @cindex target-dependent options
14569 @cindex machine-dependent options
14571 Each target machine supported by GCC can have its own options---for
14572 example, to allow you to compile for a particular processor variant or
14573 ABI, or to control optimizations specific to that machine. By
14574 convention, the names of machine-specific options start with
14577 Some configurations of the compiler also support additional target-specific
14578 options, usually for compatibility with other compilers on the same
14581 @c This list is ordered alphanumerically by subsection name.
14582 @c It should be the same order and spelling as these options are listed
14583 @c in Machine Dependent Options
14586 * AArch64 Options::
14587 * Adapteva Epiphany Options::
14591 * Blackfin Options::
14596 * DEC Alpha Options::
14600 * GNU/Linux Options::
14610 * MicroBlaze Options::
14613 * MN10300 Options::
14617 * Nios II Options::
14618 * Nvidia PTX Options::
14620 * picoChip Options::
14621 * PowerPC Options::
14622 * PowerPC SPE Options::
14625 * RS/6000 and PowerPC Options::
14627 * S/390 and zSeries Options::
14630 * Solaris 2 Options::
14633 * System V Options::
14634 * TILE-Gx Options::
14635 * TILEPro Options::
14640 * VxWorks Options::
14642 * x86 Windows Options::
14643 * Xstormy16 Options::
14645 * zSeries Options::
14648 @node AArch64 Options
14649 @subsection AArch64 Options
14650 @cindex AArch64 Options
14652 These options are defined for AArch64 implementations:
14656 @item -mabi=@var{name}
14658 Generate code for the specified data model. Permissible values
14659 are @samp{ilp32} for SysV-like data model where int, long int and pointers
14660 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
14661 but long int and pointers are 64 bits.
14663 The default depends on the specific target configuration. Note that
14664 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
14665 entire program with the same ABI, and link with a compatible set of libraries.
14668 @opindex mbig-endian
14669 Generate big-endian code. This is the default when GCC is configured for an
14670 @samp{aarch64_be-*-*} target.
14672 @item -mgeneral-regs-only
14673 @opindex mgeneral-regs-only
14674 Generate code which uses only the general-purpose registers. This will prevent
14675 the compiler from using floating-point and Advanced SIMD registers but will not
14676 impose any restrictions on the assembler.
14678 @item -mlittle-endian
14679 @opindex mlittle-endian
14680 Generate little-endian code. This is the default when GCC is configured for an
14681 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
14683 @item -mcmodel=tiny
14684 @opindex mcmodel=tiny
14685 Generate code for the tiny code model. The program and its statically defined
14686 symbols must be within 1MB of each other. Programs can be statically or
14687 dynamically linked.
14689 @item -mcmodel=small
14690 @opindex mcmodel=small
14691 Generate code for the small code model. The program and its statically defined
14692 symbols must be within 4GB of each other. Programs can be statically or
14693 dynamically linked. This is the default code model.
14695 @item -mcmodel=large
14696 @opindex mcmodel=large
14697 Generate code for the large code model. This makes no assumptions about
14698 addresses and sizes of sections. Programs can be statically linked only.
14700 @item -mstrict-align
14701 @itemx -mno-strict-align
14702 @opindex mstrict-align
14703 @opindex mno-strict-align
14704 Avoid or allow generating memory accesses that may not be aligned on a natural
14705 object boundary as described in the architecture specification.
14707 @item -momit-leaf-frame-pointer
14708 @itemx -mno-omit-leaf-frame-pointer
14709 @opindex momit-leaf-frame-pointer
14710 @opindex mno-omit-leaf-frame-pointer
14711 Omit or keep the frame pointer in leaf functions. The former behavior is the
14714 @item -mtls-dialect=desc
14715 @opindex mtls-dialect=desc
14716 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
14717 of TLS variables. This is the default.
14719 @item -mtls-dialect=traditional
14720 @opindex mtls-dialect=traditional
14721 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
14724 @item -mtls-size=@var{size}
14726 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
14727 This option requires binutils 2.26 or newer.
14729 @item -mfix-cortex-a53-835769
14730 @itemx -mno-fix-cortex-a53-835769
14731 @opindex mfix-cortex-a53-835769
14732 @opindex mno-fix-cortex-a53-835769
14733 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
14734 This involves inserting a NOP instruction between memory instructions and
14735 64-bit integer multiply-accumulate instructions.
14737 @item -mfix-cortex-a53-843419
14738 @itemx -mno-fix-cortex-a53-843419
14739 @opindex mfix-cortex-a53-843419
14740 @opindex mno-fix-cortex-a53-843419
14741 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
14742 This erratum workaround is made at link time and this will only pass the
14743 corresponding flag to the linker.
14745 @item -mlow-precision-recip-sqrt
14746 @itemx -mno-low-precision-recip-sqrt
14747 @opindex mlow-precision-recip-sqrt
14748 @opindex mno-low-precision-recip-sqrt
14749 Enable or disable the reciprocal square root approximation.
14750 This option only has an effect if @option{-ffast-math} or
14751 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14752 precision of reciprocal square root results to about 16 bits for
14753 single precision and to 32 bits for double precision.
14755 @item -mlow-precision-sqrt
14756 @itemx -mno-low-precision-sqrt
14757 @opindex -mlow-precision-sqrt
14758 @opindex -mno-low-precision-sqrt
14759 Enable or disable the square root approximation.
14760 This option only has an effect if @option{-ffast-math} or
14761 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14762 precision of square root results to about 16 bits for
14763 single precision and to 32 bits for double precision.
14764 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
14766 @item -mlow-precision-div
14767 @itemx -mno-low-precision-div
14768 @opindex -mlow-precision-div
14769 @opindex -mno-low-precision-div
14770 Enable or disable the division approximation.
14771 This option only has an effect if @option{-ffast-math} or
14772 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14773 precision of division results to about 16 bits for
14774 single precision and to 32 bits for double precision.
14776 @item -march=@var{name}
14778 Specify the name of the target architecture and, optionally, one or
14779 more feature modifiers. This option has the form
14780 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
14782 The permissible values for @var{arch} are @samp{armv8-a},
14783 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a} or @samp{armv8.4-a}
14786 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
14787 support for the ARMv8.4-A architecture extensions.
14789 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
14790 support for the ARMv8.3-A architecture extensions.
14792 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
14793 support for the ARMv8.2-A architecture extensions.
14795 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
14796 support for the ARMv8.1-A architecture extension. In particular, it
14797 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
14799 The value @samp{native} is available on native AArch64 GNU/Linux and
14800 causes the compiler to pick the architecture of the host system. This
14801 option has no effect if the compiler is unable to recognize the
14802 architecture of the host system,
14804 The permissible values for @var{feature} are listed in the sub-section
14805 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
14806 Feature Modifiers}. Where conflicting feature modifiers are
14807 specified, the right-most feature is used.
14809 GCC uses @var{name} to determine what kind of instructions it can emit
14810 when generating assembly code. If @option{-march} is specified
14811 without either of @option{-mtune} or @option{-mcpu} also being
14812 specified, the code is tuned to perform well across a range of target
14813 processors implementing the target architecture.
14815 @item -mtune=@var{name}
14817 Specify the name of the target processor for which GCC should tune the
14818 performance of the code. Permissible values for this option are:
14819 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
14820 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
14821 @samp{cortex-a76}, @samp{exynos-m1}, @samp{falkor}, @samp{qdf24xx},
14822 @samp{saphira}, @samp{xgene1}, @samp{vulcan}, @samp{thunderx},
14823 @samp{thunderxt88}, @samp{thunderxt88p1}, @samp{thunderxt81},
14824 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{cortex-a57.cortex-a53},
14825 @samp{cortex-a72.cortex-a53}, @samp{cortex-a73.cortex-a35},
14826 @samp{cortex-a73.cortex-a53}, @samp{cortex-a75.cortex-a55},
14827 @samp{cortex-a76.cortex-a55}
14830 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
14831 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
14832 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
14833 should tune for a big.LITTLE system.
14835 Additionally on native AArch64 GNU/Linux systems the value
14836 @samp{native} tunes performance to the host system. This option has no effect
14837 if the compiler is unable to recognize the processor of the host system.
14839 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
14840 are specified, the code is tuned to perform well across a range
14841 of target processors.
14843 This option cannot be suffixed by feature modifiers.
14845 @item -mcpu=@var{name}
14847 Specify the name of the target processor, optionally suffixed by one
14848 or more feature modifiers. This option has the form
14849 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
14850 the permissible values for @var{cpu} are the same as those available
14851 for @option{-mtune}. The permissible values for @var{feature} are
14852 documented in the sub-section on
14853 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
14854 Feature Modifiers}. Where conflicting feature modifiers are
14855 specified, the right-most feature is used.
14857 GCC uses @var{name} to determine what kind of instructions it can emit when
14858 generating assembly code (as if by @option{-march}) and to determine
14859 the target processor for which to tune for performance (as if
14860 by @option{-mtune}). Where this option is used in conjunction
14861 with @option{-march} or @option{-mtune}, those options take precedence
14862 over the appropriate part of this option.
14864 @item -moverride=@var{string}
14866 Override tuning decisions made by the back-end in response to a
14867 @option{-mtune=} switch. The syntax, semantics, and accepted values
14868 for @var{string} in this option are not guaranteed to be consistent
14871 This option is only intended to be useful when developing GCC.
14873 @item -mverbose-cost-dump
14874 @opindex mverbose-cost-dump
14875 Enable verbose cost model dumping in the debug dump files. This option is
14876 provided for use in debugging the compiler.
14878 @item -mpc-relative-literal-loads
14879 @itemx -mno-pc-relative-literal-loads
14880 @opindex mpc-relative-literal-loads
14881 @opindex mno-pc-relative-literal-loads
14882 Enable or disable PC-relative literal loads. With this option literal pools are
14883 accessed using a single instruction and emitted after each function. This
14884 limits the maximum size of functions to 1MB. This is enabled by default for
14885 @option{-mcmodel=tiny}.
14887 @item -msign-return-address=@var{scope}
14888 @opindex msign-return-address
14889 Select the function scope on which return address signing will be applied.
14890 Permissible values are @samp{none}, which disables return address signing,
14891 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
14892 functions, and @samp{all}, which enables pointer signing for all functions. The
14893 default value is @samp{none}.
14895 @item -msve-vector-bits=@var{bits}
14896 @opindex msve-vector-bits
14897 Specify the number of bits in an SVE vector register. This option only has
14898 an effect when SVE is enabled.
14900 GCC supports two forms of SVE code generation: ``vector-length
14901 agnostic'' output that works with any size of vector register and
14902 ``vector-length specific'' output that only works when the vector
14903 registers are a particular size. Replacing @var{bits} with
14904 @samp{scalable} selects vector-length agnostic output while
14905 replacing it with a number selects vector-length specific output.
14906 The possible lengths in the latter case are: 128, 256, 512, 1024
14907 and 2048. @samp{scalable} is the default.
14909 At present, @samp{-msve-vector-bits=128} produces the same output
14910 as @samp{-msve-vector-bits=scalable}.
14914 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
14915 @anchor{aarch64-feature-modifiers}
14916 @cindex @option{-march} feature modifiers
14917 @cindex @option{-mcpu} feature modifiers
14918 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
14919 the following and their inverses @option{no@var{feature}}:
14923 Enable CRC extension. This is on by default for
14924 @option{-march=armv8.1-a}.
14926 Enable Crypto extension. This also enables Advanced SIMD and floating-point
14929 Enable floating-point instructions. This is on by default for all possible
14930 values for options @option{-march} and @option{-mcpu}.
14932 Enable Advanced SIMD instructions. This also enables floating-point
14933 instructions. This is on by default for all possible values for options
14934 @option{-march} and @option{-mcpu}.
14936 Enable Scalable Vector Extension instructions. This also enables Advanced
14937 SIMD and floating-point instructions.
14939 Enable Large System Extension instructions. This is on by default for
14940 @option{-march=armv8.1-a}.
14942 Enable Round Double Multiply Accumulate instructions. This is on by default
14943 for @option{-march=armv8.1-a}.
14945 Enable FP16 extension. This also enables floating-point instructions.
14947 Enable FP16 fmla extension. This also enables FP16 extensions and
14948 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.
14951 Enable the RcPc extension. This does not change code generation from GCC,
14952 but is passed on to the assembler, enabling inline asm statements to use
14953 instructions from the RcPc extension.
14955 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
14957 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
14960 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
14962 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
14963 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
14965 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
14966 Use of this option with architectures prior to Armv8.2-A is not supported.
14968 Enable the Statistical Profiling extension. This option is only to enable the
14969 extension at the assembler level and does not affect code generation.
14973 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
14974 which implies @option{fp}.
14975 Conversely, @option{nofp} implies @option{nosimd}, which implies
14976 @option{nocrypto}, @option{noaes} and @option{nosha2}.
14978 @node Adapteva Epiphany Options
14979 @subsection Adapteva Epiphany Options
14981 These @samp{-m} options are defined for Adapteva Epiphany:
14984 @item -mhalf-reg-file
14985 @opindex mhalf-reg-file
14986 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
14987 That allows code to run on hardware variants that lack these registers.
14989 @item -mprefer-short-insn-regs
14990 @opindex mprefer-short-insn-regs
14991 Preferentially allocate registers that allow short instruction generation.
14992 This can result in increased instruction count, so this may either reduce or
14993 increase overall code size.
14995 @item -mbranch-cost=@var{num}
14996 @opindex mbranch-cost
14997 Set the cost of branches to roughly @var{num} ``simple'' instructions.
14998 This cost is only a heuristic and is not guaranteed to produce
14999 consistent results across releases.
15003 Enable the generation of conditional moves.
15005 @item -mnops=@var{num}
15007 Emit @var{num} NOPs before every other generated instruction.
15009 @item -mno-soft-cmpsf
15010 @opindex mno-soft-cmpsf
15011 For single-precision floating-point comparisons, emit an @code{fsub} instruction
15012 and test the flags. This is faster than a software comparison, but can
15013 get incorrect results in the presence of NaNs, or when two different small
15014 numbers are compared such that their difference is calculated as zero.
15015 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
15016 software comparisons.
15018 @item -mstack-offset=@var{num}
15019 @opindex mstack-offset
15020 Set the offset between the top of the stack and the stack pointer.
15021 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
15022 can be used by leaf functions without stack allocation.
15023 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
15024 Note also that this option changes the ABI; compiling a program with a
15025 different stack offset than the libraries have been compiled with
15026 generally does not work.
15027 This option can be useful if you want to evaluate if a different stack
15028 offset would give you better code, but to actually use a different stack
15029 offset to build working programs, it is recommended to configure the
15030 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
15032 @item -mno-round-nearest
15033 @opindex mno-round-nearest
15034 Make the scheduler assume that the rounding mode has been set to
15035 truncating. The default is @option{-mround-nearest}.
15038 @opindex mlong-calls
15039 If not otherwise specified by an attribute, assume all calls might be beyond
15040 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
15041 function address into a register before performing a (otherwise direct) call.
15042 This is the default.
15044 @item -mshort-calls
15045 @opindex short-calls
15046 If not otherwise specified by an attribute, assume all direct calls are
15047 in the range of the @code{b} / @code{bl} instructions, so use these instructions
15048 for direct calls. The default is @option{-mlong-calls}.
15052 Assume addresses can be loaded as 16-bit unsigned values. This does not
15053 apply to function addresses for which @option{-mlong-calls} semantics
15056 @item -mfp-mode=@var{mode}
15058 Set the prevailing mode of the floating-point unit.
15059 This determines the floating-point mode that is provided and expected
15060 at function call and return time. Making this mode match the mode you
15061 predominantly need at function start can make your programs smaller and
15062 faster by avoiding unnecessary mode switches.
15064 @var{mode} can be set to one the following values:
15068 Any mode at function entry is valid, and retained or restored when
15069 the function returns, and when it calls other functions.
15070 This mode is useful for compiling libraries or other compilation units
15071 you might want to incorporate into different programs with different
15072 prevailing FPU modes, and the convenience of being able to use a single
15073 object file outweighs the size and speed overhead for any extra
15074 mode switching that might be needed, compared with what would be needed
15075 with a more specific choice of prevailing FPU mode.
15078 This is the mode used for floating-point calculations with
15079 truncating (i.e.@: round towards zero) rounding mode. That includes
15080 conversion from floating point to integer.
15082 @item round-nearest
15083 This is the mode used for floating-point calculations with
15084 round-to-nearest-or-even rounding mode.
15087 This is the mode used to perform integer calculations in the FPU, e.g.@:
15088 integer multiply, or integer multiply-and-accumulate.
15091 The default is @option{-mfp-mode=caller}
15093 @item -mnosplit-lohi
15094 @itemx -mno-postinc
15095 @itemx -mno-postmodify
15096 @opindex mnosplit-lohi
15097 @opindex mno-postinc
15098 @opindex mno-postmodify
15099 Code generation tweaks that disable, respectively, splitting of 32-bit
15100 loads, generation of post-increment addresses, and generation of
15101 post-modify addresses. The defaults are @option{msplit-lohi},
15102 @option{-mpost-inc}, and @option{-mpost-modify}.
15104 @item -mnovect-double
15105 @opindex mno-vect-double
15106 Change the preferred SIMD mode to SImode. The default is
15107 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
15109 @item -max-vect-align=@var{num}
15110 @opindex max-vect-align
15111 The maximum alignment for SIMD vector mode types.
15112 @var{num} may be 4 or 8. The default is 8.
15113 Note that this is an ABI change, even though many library function
15114 interfaces are unaffected if they don't use SIMD vector modes
15115 in places that affect size and/or alignment of relevant types.
15117 @item -msplit-vecmove-early
15118 @opindex msplit-vecmove-early
15119 Split vector moves into single word moves before reload. In theory this
15120 can give better register allocation, but so far the reverse seems to be
15121 generally the case.
15123 @item -m1reg-@var{reg}
15125 Specify a register to hold the constant @minus{}1, which makes loading small negative
15126 constants and certain bitmasks faster.
15127 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
15128 which specify use of that register as a fixed register,
15129 and @samp{none}, which means that no register is used for this
15130 purpose. The default is @option{-m1reg-none}.
15135 @subsection ARC Options
15136 @cindex ARC options
15138 The following options control the architecture variant for which code
15141 @c architecture variants
15144 @item -mbarrel-shifter
15145 @opindex mbarrel-shifter
15146 Generate instructions supported by barrel shifter. This is the default
15147 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
15150 @opindex mjli-alawys
15151 Force to call a function using jli_s instruction. This option is
15152 valid only for ARCv2 architecture.
15154 @item -mcpu=@var{cpu}
15156 Set architecture type, register usage, and instruction scheduling
15157 parameters for @var{cpu}. There are also shortcut alias options
15158 available for backward compatibility and convenience. Supported
15159 values for @var{cpu} are
15165 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
15169 Compile for ARC601. Alias: @option{-mARC601}.
15174 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
15175 This is the default when configured with @option{--with-cpu=arc700}@.
15178 Compile for ARC EM.
15181 Compile for ARC HS.
15184 Compile for ARC EM CPU with no hardware extensions.
15187 Compile for ARC EM4 CPU.
15190 Compile for ARC EM4 DMIPS CPU.
15193 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
15197 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
15198 double assist instructions.
15201 Compile for ARC HS CPU with no hardware extensions except the atomic
15205 Compile for ARC HS34 CPU.
15208 Compile for ARC HS38 CPU.
15211 Compile for ARC HS38 CPU with all hardware extensions on.
15214 Compile for ARC 600 CPU with @code{norm} instructions enabled.
15216 @item arc600_mul32x16
15217 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
15218 instructions enabled.
15221 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
15222 instructions enabled.
15225 Compile for ARC 601 CPU with @code{norm} instructions enabled.
15227 @item arc601_mul32x16
15228 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
15229 instructions enabled.
15232 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
15233 instructions enabled.
15236 Compile for ARC 700 on NPS400 chip.
15239 Compile for ARC EM minimalist configuration featuring reduced register
15246 @itemx -mdpfp-compact
15247 @opindex mdpfp-compact
15248 Generate double-precision FPX instructions, tuned for the compact
15252 @opindex mdpfp-fast
15253 Generate double-precision FPX instructions, tuned for the fast
15256 @item -mno-dpfp-lrsr
15257 @opindex mno-dpfp-lrsr
15258 Disable @code{lr} and @code{sr} instructions from using FPX extension
15263 Generate extended arithmetic instructions. Currently only
15264 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
15265 supported. This is always enabled for @option{-mcpu=ARC700}.
15269 Do not generate @code{mpy}-family instructions for ARC700. This option is
15274 Generate 32x16-bit multiply and multiply-accumulate instructions.
15278 Generate @code{mul64} and @code{mulu64} instructions.
15279 Only valid for @option{-mcpu=ARC600}.
15283 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
15288 @itemx -mspfp-compact
15289 @opindex mspfp-compact
15290 Generate single-precision FPX instructions, tuned for the compact
15294 @opindex mspfp-fast
15295 Generate single-precision FPX instructions, tuned for the fast
15300 Enable generation of ARC SIMD instructions via target-specific
15301 builtins. Only valid for @option{-mcpu=ARC700}.
15304 @opindex msoft-float
15305 This option ignored; it is provided for compatibility purposes only.
15306 Software floating-point code is emitted by default, and this default
15307 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
15308 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
15309 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
15313 Generate @code{swap} instructions.
15317 This enables use of the locked load/store conditional extension to implement
15318 atomic memory built-in functions. Not available for ARC 6xx or ARC
15323 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
15325 @item -mcode-density
15326 @opindex mcode-density
15327 Enable code density instructions for ARC EM.
15328 This option is on by default for ARC HS.
15332 Enable double load/store operations for ARC HS cores.
15334 @item -mtp-regno=@var{regno}
15336 Specify thread pointer register number.
15338 @item -mmpy-option=@var{multo}
15339 @opindex mmpy-option
15340 Compile ARCv2 code with a multiplier design option. You can specify
15341 the option using either a string or numeric value for @var{multo}.
15342 @samp{wlh1} is the default value. The recognized values are:
15347 No multiplier available.
15351 16x16 multiplier, fully pipelined.
15352 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
15356 32x32 multiplier, fully
15357 pipelined (1 stage). The following instructions are additionally
15358 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15362 32x32 multiplier, fully pipelined
15363 (2 stages). The following instructions are additionally enabled: @code{mpy},
15364 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15368 Two 16x16 multipliers, blocking,
15369 sequential. The following instructions are additionally enabled: @code{mpy},
15370 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15374 One 16x16 multiplier, blocking,
15375 sequential. The following instructions are additionally enabled: @code{mpy},
15376 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15380 One 32x4 multiplier, blocking,
15381 sequential. The following instructions are additionally enabled: @code{mpy},
15382 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15386 ARC HS SIMD support.
15390 ARC HS SIMD support.
15394 ARC HS SIMD support.
15398 This option is only available for ARCv2 cores@.
15400 @item -mfpu=@var{fpu}
15402 Enables support for specific floating-point hardware extensions for ARCv2
15403 cores. Supported values for @var{fpu} are:
15408 Enables support for single-precision floating-point hardware
15412 Enables support for double-precision floating-point hardware
15413 extensions. The single-precision floating-point extension is also
15414 enabled. Not available for ARC EM@.
15417 Enables support for double-precision floating-point hardware
15418 extensions using double-precision assist instructions. The single-precision
15419 floating-point extension is also enabled. This option is
15420 only available for ARC EM@.
15423 Enables support for double-precision floating-point hardware
15424 extensions using double-precision assist instructions.
15425 The single-precision floating-point, square-root, and divide
15426 extensions are also enabled. This option is
15427 only available for ARC EM@.
15430 Enables support for double-precision floating-point hardware
15431 extensions using double-precision assist instructions.
15432 The single-precision floating-point and fused multiply and add
15433 hardware extensions are also enabled. This option is
15434 only available for ARC EM@.
15437 Enables support for double-precision floating-point hardware
15438 extensions using double-precision assist instructions.
15439 All single-precision floating-point hardware extensions are also
15440 enabled. This option is only available for ARC EM@.
15443 Enables support for single-precision floating-point, square-root and divide
15444 hardware extensions@.
15447 Enables support for double-precision floating-point, square-root and divide
15448 hardware extensions. This option
15449 includes option @samp{fpus_div}. Not available for ARC EM@.
15452 Enables support for single-precision floating-point and
15453 fused multiply and add hardware extensions@.
15456 Enables support for double-precision floating-point and
15457 fused multiply and add hardware extensions. This option
15458 includes option @samp{fpus_fma}. Not available for ARC EM@.
15461 Enables support for all single-precision floating-point hardware
15465 Enables support for all single- and double-precision floating-point
15466 hardware extensions. Not available for ARC EM@.
15470 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
15471 @opindex mirq-ctrl-saved
15472 Specifies general-purposes registers that the processor automatically
15473 saves/restores on interrupt entry and exit. @var{register-range} is
15474 specified as two registers separated by a dash. The register range
15475 always starts with @code{r0}, the upper limit is @code{fp} register.
15476 @var{blink} and @var{lp_count} are optional. This option is only
15477 valid for ARC EM and ARC HS cores.
15479 @item -mrgf-banked-regs=@var{number}
15480 @opindex mrgf-banked-regs
15481 Specifies the number of registers replicated in second register bank
15482 on entry to fast interrupt. Fast interrupts are interrupts with the
15483 highest priority level P0. These interrupts save only PC and STATUS32
15484 registers to avoid memory transactions during interrupt entry and exit
15485 sequences. Use this option when you are using fast interrupts in an
15486 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
15488 @item -mlpc-width=@var{width}
15489 @opindex mlpc-width
15490 Specify the width of the @code{lp_count} register. Valid values for
15491 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
15492 fixed to 32 bits. If the width is less than 32, the compiler does not
15493 attempt to transform loops in your program to use the zero-delay loop
15494 mechanism unless it is known that the @code{lp_count} register can
15495 hold the required loop-counter value. Depending on the width
15496 specified, the compiler and run-time library might continue to use the
15497 loop mechanism for various needs. This option defines macro
15498 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
15502 This option instructs the compiler to generate code for a 16-entry
15503 register file. This option defines the @code{__ARC_RF16__}
15504 preprocessor macro.
15508 The following options are passed through to the assembler, and also
15509 define preprocessor macro symbols.
15511 @c Flags used by the assembler, but for which we define preprocessor
15512 @c macro symbols as well.
15515 @opindex mdsp-packa
15516 Passed down to the assembler to enable the DSP Pack A extensions.
15517 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
15522 Passed down to the assembler to enable the dual Viterbi butterfly
15523 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
15524 option is deprecated.
15526 @c ARC700 4.10 extension instruction
15529 Passed down to the assembler to enable the locked load/store
15530 conditional extension. Also sets the preprocessor symbol
15535 Passed down to the assembler. Also sets the preprocessor symbol
15536 @code{__Xxmac_d16}. This option is deprecated.
15540 Passed down to the assembler. Also sets the preprocessor symbol
15541 @code{__Xxmac_24}. This option is deprecated.
15543 @c ARC700 4.10 extension instruction
15546 Passed down to the assembler to enable the 64-bit time-stamp counter
15547 extension instruction. Also sets the preprocessor symbol
15548 @code{__Xrtsc}. This option is deprecated.
15550 @c ARC700 4.10 extension instruction
15553 Passed down to the assembler to enable the swap byte ordering
15554 extension instruction. Also sets the preprocessor symbol
15558 @opindex mtelephony
15559 Passed down to the assembler to enable dual- and single-operand
15560 instructions for telephony. Also sets the preprocessor symbol
15561 @code{__Xtelephony}. This option is deprecated.
15565 Passed down to the assembler to enable the XY memory extension. Also
15566 sets the preprocessor symbol @code{__Xxy}.
15570 The following options control how the assembly code is annotated:
15572 @c Assembly annotation options
15576 Annotate assembler instructions with estimated addresses.
15578 @item -mannotate-align
15579 @opindex mannotate-align
15580 Explain what alignment considerations lead to the decision to make an
15581 instruction short or long.
15585 The following options are passed through to the linker:
15587 @c options passed through to the linker
15591 Passed through to the linker, to specify use of the @code{arclinux} emulation.
15592 This option is enabled by default in tool chains built for
15593 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
15594 when profiling is not requested.
15596 @item -marclinux_prof
15597 @opindex marclinux_prof
15598 Passed through to the linker, to specify use of the
15599 @code{arclinux_prof} emulation. This option is enabled by default in
15600 tool chains built for @w{@code{arc-linux-uclibc}} and
15601 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
15605 The following options control the semantics of generated code:
15607 @c semantically relevant code generation options
15610 @opindex mlong-calls
15611 Generate calls as register indirect calls, thus providing access
15612 to the full 32-bit address range.
15614 @item -mmedium-calls
15615 @opindex mmedium-calls
15616 Don't use less than 25-bit addressing range for calls, which is the
15617 offset available for an unconditional branch-and-link
15618 instruction. Conditional execution of function calls is suppressed, to
15619 allow use of the 25-bit range, rather than the 21-bit range with
15620 conditional branch-and-link. This is the default for tool chains built
15621 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
15625 Put definitions of externally-visible data in a small data section if
15626 that data is no bigger than @var{num} bytes. The default value of
15627 @var{num} is 4 for any ARC configuration, or 8 when we have double
15628 load/store operations.
15632 Do not generate sdata references. This is the default for tool chains
15633 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
15636 @item -mvolatile-cache
15637 @opindex mvolatile-cache
15638 Use ordinarily cached memory accesses for volatile references. This is the
15641 @item -mno-volatile-cache
15642 @opindex mno-volatile-cache
15643 Enable cache bypass for volatile references.
15647 The following options fine tune code generation:
15648 @c code generation tuning options
15651 @opindex malign-call
15652 Do alignment optimizations for call instructions.
15654 @item -mauto-modify-reg
15655 @opindex mauto-modify-reg
15656 Enable the use of pre/post modify with register displacement.
15658 @item -mbbit-peephole
15659 @opindex mbbit-peephole
15660 Enable bbit peephole2.
15664 This option disables a target-specific pass in @file{arc_reorg} to
15665 generate compare-and-branch (@code{br@var{cc}}) instructions.
15666 It has no effect on
15667 generation of these instructions driven by the combiner pass.
15669 @item -mcase-vector-pcrel
15670 @opindex mcase-vector-pcrel
15671 Use PC-relative switch case tables to enable case table shortening.
15672 This is the default for @option{-Os}.
15674 @item -mcompact-casesi
15675 @opindex mcompact-casesi
15676 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
15677 and only available for ARCv1 cores.
15679 @item -mno-cond-exec
15680 @opindex mno-cond-exec
15681 Disable the ARCompact-specific pass to generate conditional
15682 execution instructions.
15684 Due to delay slot scheduling and interactions between operand numbers,
15685 literal sizes, instruction lengths, and the support for conditional execution,
15686 the target-independent pass to generate conditional execution is often lacking,
15687 so the ARC port has kept a special pass around that tries to find more
15688 conditional execution generation opportunities after register allocation,
15689 branch shortening, and delay slot scheduling have been done. This pass
15690 generally, but not always, improves performance and code size, at the cost of
15691 extra compilation time, which is why there is an option to switch it off.
15692 If you have a problem with call instructions exceeding their allowable
15693 offset range because they are conditionalized, you should consider using
15694 @option{-mmedium-calls} instead.
15696 @item -mearly-cbranchsi
15697 @opindex mearly-cbranchsi
15698 Enable pre-reload use of the @code{cbranchsi} pattern.
15700 @item -mexpand-adddi
15701 @opindex mexpand-adddi
15702 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
15703 @code{add.f}, @code{adc} etc. This option is deprecated.
15705 @item -mindexed-loads
15706 @opindex mindexed-loads
15707 Enable the use of indexed loads. This can be problematic because some
15708 optimizers then assume that indexed stores exist, which is not
15713 Enable Local Register Allocation. This is still experimental for ARC,
15714 so by default the compiler uses standard reload
15715 (i.e. @option{-mno-lra}).
15717 @item -mlra-priority-none
15718 @opindex mlra-priority-none
15719 Don't indicate any priority for target registers.
15721 @item -mlra-priority-compact
15722 @opindex mlra-priority-compact
15723 Indicate target register priority for r0..r3 / r12..r15.
15725 @item -mlra-priority-noncompact
15726 @opindex mlra-priority-noncompact
15727 Reduce target register priority for r0..r3 / r12..r15.
15729 @item -mno-millicode
15730 @opindex mno-millicode
15731 When optimizing for size (using @option{-Os}), prologues and epilogues
15732 that have to save or restore a large number of registers are often
15733 shortened by using call to a special function in libgcc; this is
15734 referred to as a @emph{millicode} call. As these calls can pose
15735 performance issues, and/or cause linking issues when linking in a
15736 nonstandard way, this option is provided to turn off millicode call
15740 @opindex mmixed-code
15741 Tweak register allocation to help 16-bit instruction generation.
15742 This generally has the effect of decreasing the average instruction size
15743 while increasing the instruction count.
15747 Enable @samp{q} instruction alternatives.
15748 This is the default for @option{-Os}.
15752 Enable @samp{Rcq} constraint handling.
15753 Most short code generation depends on this.
15754 This is the default.
15758 Enable @samp{Rcw} constraint handling.
15759 Most ccfsm condexec mostly depends on this.
15760 This is the default.
15762 @item -msize-level=@var{level}
15763 @opindex msize-level
15764 Fine-tune size optimization with regards to instruction lengths and alignment.
15765 The recognized values for @var{level} are:
15768 No size optimization. This level is deprecated and treated like @samp{1}.
15771 Short instructions are used opportunistically.
15774 In addition, alignment of loops and of code after barriers are dropped.
15777 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
15781 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
15782 the behavior when this is not set is equivalent to level @samp{1}.
15784 @item -mtune=@var{cpu}
15786 Set instruction scheduling parameters for @var{cpu}, overriding any implied
15787 by @option{-mcpu=}.
15789 Supported values for @var{cpu} are
15793 Tune for ARC600 CPU.
15796 Tune for ARC601 CPU.
15799 Tune for ARC700 CPU with standard multiplier block.
15802 Tune for ARC700 CPU with XMAC block.
15805 Tune for ARC725D CPU.
15808 Tune for ARC750D CPU.
15812 @item -mmultcost=@var{num}
15814 Cost to assume for a multiply instruction, with @samp{4} being equal to a
15815 normal instruction.
15817 @item -munalign-prob-threshold=@var{probability}
15818 @opindex munalign-prob-threshold
15819 Set probability threshold for unaligning branches.
15820 When tuning for @samp{ARC700} and optimizing for speed, branches without
15821 filled delay slot are preferably emitted unaligned and long, unless
15822 profiling indicates that the probability for the branch to be taken
15823 is below @var{probability}. @xref{Cross-profiling}.
15824 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
15828 The following options are maintained for backward compatibility, but
15829 are now deprecated and will be removed in a future release:
15831 @c Deprecated options
15839 @opindex mbig-endian
15842 Compile code for big-endian targets. Use of these options is now
15843 deprecated. Big-endian code is supported by configuring GCC to build
15844 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
15845 for which big endian is the default.
15847 @item -mlittle-endian
15848 @opindex mlittle-endian
15851 Compile code for little-endian targets. Use of these options is now
15852 deprecated. Little-endian code is supported by configuring GCC to build
15853 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
15854 for which little endian is the default.
15856 @item -mbarrel_shifter
15857 @opindex mbarrel_shifter
15858 Replaced by @option{-mbarrel-shifter}.
15860 @item -mdpfp_compact
15861 @opindex mdpfp_compact
15862 Replaced by @option{-mdpfp-compact}.
15865 @opindex mdpfp_fast
15866 Replaced by @option{-mdpfp-fast}.
15869 @opindex mdsp_packa
15870 Replaced by @option{-mdsp-packa}.
15874 Replaced by @option{-mea}.
15878 Replaced by @option{-mmac-24}.
15882 Replaced by @option{-mmac-d16}.
15884 @item -mspfp_compact
15885 @opindex mspfp_compact
15886 Replaced by @option{-mspfp-compact}.
15889 @opindex mspfp_fast
15890 Replaced by @option{-mspfp-fast}.
15892 @item -mtune=@var{cpu}
15894 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
15895 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
15896 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
15898 @item -multcost=@var{num}
15900 Replaced by @option{-mmultcost}.
15905 @subsection ARM Options
15906 @cindex ARM options
15908 These @samp{-m} options are defined for the ARM port:
15911 @item -mabi=@var{name}
15913 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
15914 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
15917 @opindex mapcs-frame
15918 Generate a stack frame that is compliant with the ARM Procedure Call
15919 Standard for all functions, even if this is not strictly necessary for
15920 correct execution of the code. Specifying @option{-fomit-frame-pointer}
15921 with this option causes the stack frames not to be generated for
15922 leaf functions. The default is @option{-mno-apcs-frame}.
15923 This option is deprecated.
15927 This is a synonym for @option{-mapcs-frame} and is deprecated.
15930 @c not currently implemented
15931 @item -mapcs-stack-check
15932 @opindex mapcs-stack-check
15933 Generate code to check the amount of stack space available upon entry to
15934 every function (that actually uses some stack space). If there is
15935 insufficient space available then either the function
15936 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
15937 called, depending upon the amount of stack space required. The runtime
15938 system is required to provide these functions. The default is
15939 @option{-mno-apcs-stack-check}, since this produces smaller code.
15941 @c not currently implemented
15942 @item -mapcs-reentrant
15943 @opindex mapcs-reentrant
15944 Generate reentrant, position-independent code. The default is
15945 @option{-mno-apcs-reentrant}.
15948 @item -mthumb-interwork
15949 @opindex mthumb-interwork
15950 Generate code that supports calling between the ARM and Thumb
15951 instruction sets. Without this option, on pre-v5 architectures, the
15952 two instruction sets cannot be reliably used inside one program. The
15953 default is @option{-mno-thumb-interwork}, since slightly larger code
15954 is generated when @option{-mthumb-interwork} is specified. In AAPCS
15955 configurations this option is meaningless.
15957 @item -mno-sched-prolog
15958 @opindex mno-sched-prolog
15959 Prevent the reordering of instructions in the function prologue, or the
15960 merging of those instruction with the instructions in the function's
15961 body. This means that all functions start with a recognizable set
15962 of instructions (or in fact one of a choice from a small set of
15963 different function prologues), and this information can be used to
15964 locate the start of functions inside an executable piece of code. The
15965 default is @option{-msched-prolog}.
15967 @item -mfloat-abi=@var{name}
15968 @opindex mfloat-abi
15969 Specifies which floating-point ABI to use. Permissible values
15970 are: @samp{soft}, @samp{softfp} and @samp{hard}.
15972 Specifying @samp{soft} causes GCC to generate output containing
15973 library calls for floating-point operations.
15974 @samp{softfp} allows the generation of code using hardware floating-point
15975 instructions, but still uses the soft-float calling conventions.
15976 @samp{hard} allows generation of floating-point instructions
15977 and uses FPU-specific calling conventions.
15979 The default depends on the specific target configuration. Note that
15980 the hard-float and soft-float ABIs are not link-compatible; you must
15981 compile your entire program with the same ABI, and link with a
15982 compatible set of libraries.
15984 @item -mlittle-endian
15985 @opindex mlittle-endian
15986 Generate code for a processor running in little-endian mode. This is
15987 the default for all standard configurations.
15990 @opindex mbig-endian
15991 Generate code for a processor running in big-endian mode; the default is
15992 to compile code for a little-endian processor.
15997 When linking a big-endian image select between BE8 and BE32 formats.
15998 The option has no effect for little-endian images and is ignored. The
15999 default is dependent on the selected target architecture. For ARMv6
16000 and later architectures the default is BE8, for older architectures
16001 the default is BE32. BE32 format has been deprecated by ARM.
16003 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
16005 This specifies the name of the target ARM architecture. GCC uses this
16006 name to determine what kind of instructions it can emit when generating
16007 assembly code. This option can be used in conjunction with or instead
16008 of the @option{-mcpu=} option.
16010 Permissible names are:
16012 @samp{armv5t}, @samp{armv5te},
16013 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
16014 @samp{armv6z}, @samp{armv6zk},
16015 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
16016 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
16020 @samp{armv6-m}, @samp{armv6s-m},
16021 @samp{armv7-m}, @samp{armv7e-m},
16022 @samp{armv8-m.base}, @samp{armv8-m.main},
16023 @samp{iwmmxt} and @samp{iwmmxt2}.
16025 Additionally, the following architectures, which lack support for the
16026 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
16028 Many of the architectures support extensions. These can be added by
16029 appending @samp{+@var{extension}} to the architecture name. Extension
16030 options are processed in order and capabilities accumulate. An extension
16031 will also enable any necessary base extensions
16032 upon which it depends. For example, the @samp{+crypto} extension
16033 will always enable the @samp{+simd} extension. The exception to the
16034 additive construction is for extensions that are prefixed with
16035 @samp{+no@dots{}}: these extensions disable the specified option and
16036 any other extensions that may depend on the presence of that
16039 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
16040 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
16041 entirely disabled by the @samp{+nofp} option that follows it.
16043 Most extension names are generically named, but have an effect that is
16044 dependent upon the architecture to which it is applied. For example,
16045 the @samp{+simd} option can be applied to both @samp{armv7-a} and
16046 @samp{armv8-a} architectures, but will enable the original ARMv7-A
16047 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
16048 variant for @samp{armv8-a}.
16050 The table below lists the supported extensions for each architecture.
16051 Architectures not mentioned do not support any extensions.
16064 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
16065 used as an alias for this extension.
16068 Disable the floating-point instructions.
16072 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
16075 The VFPv3 floating-point instructions, with 16 double-precision
16076 registers. The extension @samp{+vfpv3-d16} can be used as an alias
16077 for this extension. Note that floating-point is not supported by the
16078 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
16079 ARMv7-R architectures.
16082 Disable the floating-point instructions.
16088 The VFPv3 floating-point instructions, with 16 double-precision
16089 registers. The extension @samp{+vfpv3-d16} can be used as an alias
16090 for this extension.
16093 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
16094 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
16095 for this extension.
16098 The VFPv3 floating-point instructions, with 32 double-precision
16101 @item +vfpv3-d16-fp16
16102 The VFPv3 floating-point instructions, with 16 double-precision
16103 registers and the half-precision floating-point conversion operations.
16106 The VFPv3 floating-point instructions, with 32 double-precision
16107 registers and the half-precision floating-point conversion operations.
16110 The VFPv4 floating-point instructions, with 16 double-precision
16114 The VFPv4 floating-point instructions, with 32 double-precision
16118 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
16119 the half-precision floating-point conversion operations.
16122 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
16125 Disable the Advanced SIMD instructions (does not disable floating point).
16128 Disable the floating-point and Advanced SIMD instructions.
16132 The extended version of the ARMv7-A architecture with support for
16136 The VFPv4 floating-point instructions, with 16 double-precision registers.
16137 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
16140 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
16141 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
16144 The VFPv3 floating-point instructions, with 16 double-precision
16148 The VFPv3 floating-point instructions, with 32 double-precision
16151 @item +vfpv3-d16-fp16
16152 The VFPv3 floating-point instructions, with 16 double-precision
16153 registers and the half-precision floating-point conversion operations.
16156 The VFPv3 floating-point instructions, with 32 double-precision
16157 registers and the half-precision floating-point conversion operations.
16160 The VFPv4 floating-point instructions, with 16 double-precision
16164 The VFPv4 floating-point instructions, with 32 double-precision
16168 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
16169 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
16172 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
16173 the half-precision floating-point conversion operations.
16176 Disable the Advanced SIMD instructions (does not disable floating point).
16179 Disable the floating-point and Advanced SIMD instructions.
16185 The Cyclic Redundancy Check (CRC) instructions.
16187 The ARMv8-A Advanced SIMD and floating-point instructions.
16189 The cryptographic instructions.
16191 Disable the cryptographic instructions.
16193 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16199 The ARMv8.1-A Advanced SIMD and floating-point instructions.
16202 The cryptographic instructions. This also enables the Advanced SIMD and
16203 floating-point instructions.
16206 Disable the cryptographic instructions.
16209 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16216 The half-precision floating-point data processing instructions.
16217 This also enables the Advanced SIMD and floating-point instructions.
16220 The half-precision floating-point fmla extension. This also enables
16221 the half-precision floating-point extension and Advanced SIMD and
16222 floating-point instructions.
16225 The ARMv8.1-A Advanced SIMD and floating-point instructions.
16228 The cryptographic instructions. This also enables the Advanced SIMD and
16229 floating-point instructions.
16232 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
16235 Disable the cryptographic extension.
16238 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16244 The half-precision floating-point data processing instructions.
16245 This also enables the Advanced SIMD and floating-point instructions as well
16246 as the Dot Product extension and the half-precision floating-point fmla
16250 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
16251 Dot Product extension.
16254 The cryptographic instructions. This also enables the Advanced SIMD and
16255 floating-point instructions as well as the Dot Product extension.
16258 Disable the cryptographic extension.
16261 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16267 The single-precision VFPv3 floating-point instructions. The extension
16268 @samp{+vfpv3xd} can be used as an alias for this extension.
16271 The VFPv3 floating-point instructions with 16 double-precision registers.
16272 The extension +vfpv3-d16 can be used as an alias for this extension.
16275 Disable the floating-point extension.
16278 The ARM-state integer division instructions.
16281 Disable the ARM-state integer division extension.
16287 The single-precision VFPv4 floating-point instructions.
16290 The single-precision FPv5 floating-point instructions.
16293 The single- and double-precision FPv5 floating-point instructions.
16296 Disable the floating-point extensions.
16302 The DSP instructions.
16305 Disable the DSP extension.
16308 The single-precision floating-point instructions.
16311 The single- and double-precision floating-point instructions.
16314 Disable the floating-point extension.
16320 The Cyclic Redundancy Check (CRC) instructions.
16322 The single-precision FPv5 floating-point instructions.
16324 The ARMv8-A Advanced SIMD and floating-point instructions.
16326 The cryptographic instructions.
16328 Disable the cryptographic instructions.
16330 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16335 @option{-march=native} causes the compiler to auto-detect the architecture
16336 of the build computer. At present, this feature is only supported on
16337 GNU/Linux, and not all architectures are recognized. If the auto-detect
16338 is unsuccessful the option has no effect.
16340 @item -mtune=@var{name}
16342 This option specifies the name of the target ARM processor for
16343 which GCC should tune the performance of the code.
16344 For some ARM implementations better performance can be obtained by using
16346 Permissible names are: @samp{arm2}, @samp{arm250},
16347 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
16348 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
16349 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
16350 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
16352 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
16353 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
16354 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
16355 @samp{strongarm1110},
16356 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
16357 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
16358 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
16359 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
16360 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
16361 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
16362 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
16363 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
16364 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
16365 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
16366 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
16367 @samp{cortex-a76}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5},
16368 @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
16376 @samp{cortex-m0plus},
16377 @samp{cortex-m1.small-multiply},
16378 @samp{cortex-m0.small-multiply},
16379 @samp{cortex-m0plus.small-multiply},
16381 @samp{marvell-pj4},
16382 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
16383 @samp{fa526}, @samp{fa626},
16384 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
16387 Additionally, this option can specify that GCC should tune the performance
16388 of the code for a big.LITTLE system. Permissible names are:
16389 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
16390 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16391 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
16392 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
16394 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
16395 performance for a blend of processors within architecture @var{arch}.
16396 The aim is to generate code that run well on the current most popular
16397 processors, balancing between optimizations that benefit some CPUs in the
16398 range, and avoiding performance pitfalls of other CPUs. The effects of
16399 this option may change in future GCC versions as CPU models come and go.
16401 @option{-mtune} permits the same extension options as @option{-mcpu}, but
16402 the extension options do not affect the tuning of the generated code.
16404 @option{-mtune=native} causes the compiler to auto-detect the CPU
16405 of the build computer. At present, this feature is only supported on
16406 GNU/Linux, and not all architectures are recognized. If the auto-detect is
16407 unsuccessful the option has no effect.
16409 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
16411 This specifies the name of the target ARM processor. GCC uses this name
16412 to derive the name of the target ARM architecture (as if specified
16413 by @option{-march}) and the ARM processor type for which to tune for
16414 performance (as if specified by @option{-mtune}). Where this option
16415 is used in conjunction with @option{-march} or @option{-mtune},
16416 those options take precedence over the appropriate part of this option.
16418 Many of the supported CPUs implement optional architectural
16419 extensions. Where this is so the architectural extensions are
16420 normally enabled by default. If implementations that lack the
16421 extension exist, then the extension syntax can be used to disable
16422 those extensions that have been omitted. For floating-point and
16423 Advanced SIMD (Neon) instructions, the settings of the options
16424 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
16425 floating-point and Advanced SIMD instructions will only be used if
16426 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
16427 @option{-mfpu} other than @samp{auto} will override the available
16428 floating-point and SIMD extension instructions.
16430 For example, @samp{cortex-a9} can be found in three major
16431 configurations: integer only, with just a floating-point unit or with
16432 floating-point and Advanced SIMD. The default is to enable all the
16433 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
16434 be used to disable just the SIMD or both the SIMD and floating-point
16435 instructions respectively.
16437 Permissible names for this option are the same as those for
16440 The following extension options are common to the listed CPUs:
16444 Disable the DSP instructions on @samp{cortex-m33}.
16447 Disables the floating-point instructions on @samp{arm9e},
16448 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
16449 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
16450 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
16451 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
16452 Disables the floating-point and SIMD instructions on
16453 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
16454 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
16455 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
16456 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
16457 @samp{cortex-a53} and @samp{cortex-a55}.
16460 Disables the double-precision component of the floating-point instructions
16461 on @samp{cortex-r5}, @samp{cortex-r52} and @samp{cortex-m7}.
16464 Disables the SIMD (but not floating-point) instructions on
16465 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
16466 and @samp{cortex-a9}.
16469 Enables the cryptographic instructions on @samp{cortex-a32},
16470 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
16471 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
16472 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16473 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
16474 @samp{cortex-a75.cortex-a55}.
16477 Additionally the @samp{generic-armv7-a} pseudo target defaults to
16478 VFPv3 with 16 double-precision registers. It supports the following
16479 extension options: @samp{vfpv3-d16}, @samp{vfpv3},
16480 @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16}, @samp{vfpv4-d16},
16481 @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3}, @samp{neon-fp16},
16482 @samp{neon-vfpv4}. The meanings are the same as for the extensions to
16483 @option{-march=armv7-a}.
16485 @option{-mcpu=generic-@var{arch}} is also permissible, and is
16486 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
16487 See @option{-mtune} for more information.
16489 @option{-mcpu=native} causes the compiler to auto-detect the CPU
16490 of the build computer. At present, this feature is only supported on
16491 GNU/Linux, and not all architectures are recognized. If the auto-detect
16492 is unsuccessful the option has no effect.
16494 @item -mfpu=@var{name}
16496 This specifies what floating-point hardware (or hardware emulation) is
16497 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
16499 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
16500 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
16501 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
16502 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
16503 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
16504 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
16505 is an alias for @samp{vfpv2}.
16507 The setting @samp{auto} is the default and is special. It causes the
16508 compiler to select the floating-point and Advanced SIMD instructions
16509 based on the settings of @option{-mcpu} and @option{-march}.
16511 If the selected floating-point hardware includes the NEON extension
16512 (e.g. @option{-mfpu=neon}), note that floating-point
16513 operations are not generated by GCC's auto-vectorization pass unless
16514 @option{-funsafe-math-optimizations} is also specified. This is
16515 because NEON hardware does not fully implement the IEEE 754 standard for
16516 floating-point arithmetic (in particular denormal values are treated as
16517 zero), so the use of NEON instructions may lead to a loss of precision.
16519 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}).
16521 @item -mfp16-format=@var{name}
16522 @opindex mfp16-format
16523 Specify the format of the @code{__fp16} half-precision floating-point type.
16524 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
16525 the default is @samp{none}, in which case the @code{__fp16} type is not
16526 defined. @xref{Half-Precision}, for more information.
16528 @item -mstructure-size-boundary=@var{n}
16529 @opindex mstructure-size-boundary
16530 The sizes of all structures and unions are rounded up to a multiple
16531 of the number of bits set by this option. Permissible values are 8, 32
16532 and 64. The default value varies for different toolchains. For the COFF
16533 targeted toolchain the default value is 8. A value of 64 is only allowed
16534 if the underlying ABI supports it.
16536 Specifying a larger number can produce faster, more efficient code, but
16537 can also increase the size of the program. Different values are potentially
16538 incompatible. Code compiled with one value cannot necessarily expect to
16539 work with code or libraries compiled with another value, if they exchange
16540 information using structures or unions.
16542 This option is deprecated.
16544 @item -mabort-on-noreturn
16545 @opindex mabort-on-noreturn
16546 Generate a call to the function @code{abort} at the end of a
16547 @code{noreturn} function. It is executed if the function tries to
16551 @itemx -mno-long-calls
16552 @opindex mlong-calls
16553 @opindex mno-long-calls
16554 Tells the compiler to perform function calls by first loading the
16555 address of the function into a register and then performing a subroutine
16556 call on this register. This switch is needed if the target function
16557 lies outside of the 64-megabyte addressing range of the offset-based
16558 version of subroutine call instruction.
16560 Even if this switch is enabled, not all function calls are turned
16561 into long calls. The heuristic is that static functions, functions
16562 that have the @code{short_call} attribute, functions that are inside
16563 the scope of a @code{#pragma no_long_calls} directive, and functions whose
16564 definitions have already been compiled within the current compilation
16565 unit are not turned into long calls. The exceptions to this rule are
16566 that weak function definitions, functions with the @code{long_call}
16567 attribute or the @code{section} attribute, and functions that are within
16568 the scope of a @code{#pragma long_calls} directive are always
16569 turned into long calls.
16571 This feature is not enabled by default. Specifying
16572 @option{-mno-long-calls} restores the default behavior, as does
16573 placing the function calls within the scope of a @code{#pragma
16574 long_calls_off} directive. Note these switches have no effect on how
16575 the compiler generates code to handle function calls via function
16578 @item -msingle-pic-base
16579 @opindex msingle-pic-base
16580 Treat the register used for PIC addressing as read-only, rather than
16581 loading it in the prologue for each function. The runtime system is
16582 responsible for initializing this register with an appropriate value
16583 before execution begins.
16585 @item -mpic-register=@var{reg}
16586 @opindex mpic-register
16587 Specify the register to be used for PIC addressing.
16588 For standard PIC base case, the default is any suitable register
16589 determined by compiler. For single PIC base case, the default is
16590 @samp{R9} if target is EABI based or stack-checking is enabled,
16591 otherwise the default is @samp{R10}.
16593 @item -mpic-data-is-text-relative
16594 @opindex mpic-data-is-text-relative
16595 Assume that the displacement between the text and data segments is fixed
16596 at static link time. This permits using PC-relative addressing
16597 operations to access data known to be in the data segment. For
16598 non-VxWorks RTP targets, this option is enabled by default. When
16599 disabled on such targets, it will enable @option{-msingle-pic-base} by
16602 @item -mpoke-function-name
16603 @opindex mpoke-function-name
16604 Write the name of each function into the text section, directly
16605 preceding the function prologue. The generated code is similar to this:
16609 .ascii "arm_poke_function_name", 0
16612 .word 0xff000000 + (t1 - t0)
16613 arm_poke_function_name
16615 stmfd sp!, @{fp, ip, lr, pc@}
16619 When performing a stack backtrace, code can inspect the value of
16620 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
16621 location @code{pc - 12} and the top 8 bits are set, then we know that
16622 there is a function name embedded immediately preceding this location
16623 and has length @code{((pc[-3]) & 0xff000000)}.
16630 Select between generating code that executes in ARM and Thumb
16631 states. The default for most configurations is to generate code
16632 that executes in ARM state, but the default can be changed by
16633 configuring GCC with the @option{--with-mode=}@var{state}
16636 You can also override the ARM and Thumb mode for each function
16637 by using the @code{target("thumb")} and @code{target("arm")} function attributes
16638 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
16641 @opindex mflip-thumb
16642 Switch ARM/Thumb modes on alternating functions.
16643 This option is provided for regression testing of mixed Thumb/ARM code
16644 generation, and is not intended for ordinary use in compiling code.
16647 @opindex mtpcs-frame
16648 Generate a stack frame that is compliant with the Thumb Procedure Call
16649 Standard for all non-leaf functions. (A leaf function is one that does
16650 not call any other functions.) The default is @option{-mno-tpcs-frame}.
16652 @item -mtpcs-leaf-frame
16653 @opindex mtpcs-leaf-frame
16654 Generate a stack frame that is compliant with the Thumb Procedure Call
16655 Standard for all leaf functions. (A leaf function is one that does
16656 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
16658 @item -mcallee-super-interworking
16659 @opindex mcallee-super-interworking
16660 Gives all externally visible functions in the file being compiled an ARM
16661 instruction set header which switches to Thumb mode before executing the
16662 rest of the function. This allows these functions to be called from
16663 non-interworking code. This option is not valid in AAPCS configurations
16664 because interworking is enabled by default.
16666 @item -mcaller-super-interworking
16667 @opindex mcaller-super-interworking
16668 Allows calls via function pointers (including virtual functions) to
16669 execute correctly regardless of whether the target code has been
16670 compiled for interworking or not. There is a small overhead in the cost
16671 of executing a function pointer if this option is enabled. This option
16672 is not valid in AAPCS configurations because interworking is enabled
16675 @item -mtp=@var{name}
16677 Specify the access model for the thread local storage pointer. The valid
16678 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
16679 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
16680 (supported in the arm6k architecture), and @samp{auto}, which uses the
16681 best available method for the selected processor. The default setting is
16684 @item -mtls-dialect=@var{dialect}
16685 @opindex mtls-dialect
16686 Specify the dialect to use for accessing thread local storage. Two
16687 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
16688 @samp{gnu} dialect selects the original GNU scheme for supporting
16689 local and global dynamic TLS models. The @samp{gnu2} dialect
16690 selects the GNU descriptor scheme, which provides better performance
16691 for shared libraries. The GNU descriptor scheme is compatible with
16692 the original scheme, but does require new assembler, linker and
16693 library support. Initial and local exec TLS models are unaffected by
16694 this option and always use the original scheme.
16696 @item -mword-relocations
16697 @opindex mword-relocations
16698 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
16699 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
16700 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
16703 @item -mfix-cortex-m3-ldrd
16704 @opindex mfix-cortex-m3-ldrd
16705 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
16706 with overlapping destination and base registers are used. This option avoids
16707 generating these instructions. This option is enabled by default when
16708 @option{-mcpu=cortex-m3} is specified.
16710 @item -munaligned-access
16711 @itemx -mno-unaligned-access
16712 @opindex munaligned-access
16713 @opindex mno-unaligned-access
16714 Enables (or disables) reading and writing of 16- and 32- bit values
16715 from addresses that are not 16- or 32- bit aligned. By default
16716 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
16717 ARMv8-M Baseline architectures, and enabled for all other
16718 architectures. If unaligned access is not enabled then words in packed
16719 data structures are accessed a byte at a time.
16721 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
16722 generated object file to either true or false, depending upon the
16723 setting of this option. If unaligned access is enabled then the
16724 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
16727 @item -mneon-for-64bits
16728 @opindex mneon-for-64bits
16729 Enables using Neon to handle scalar 64-bits operations. This is
16730 disabled by default since the cost of moving data from core registers
16733 @item -mslow-flash-data
16734 @opindex mslow-flash-data
16735 Assume loading data from flash is slower than fetching instruction.
16736 Therefore literal load is minimized for better performance.
16737 This option is only supported when compiling for ARMv7 M-profile and
16740 @item -masm-syntax-unified
16741 @opindex masm-syntax-unified
16742 Assume inline assembler is using unified asm syntax. The default is
16743 currently off which implies divided syntax. This option has no impact
16744 on Thumb2. However, this may change in future releases of GCC.
16745 Divided syntax should be considered deprecated.
16747 @item -mrestrict-it
16748 @opindex mrestrict-it
16749 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
16750 IT blocks can only contain a single 16-bit instruction from a select
16751 set of instructions. This option is on by default for ARMv8-A Thumb mode.
16753 @item -mprint-tune-info
16754 @opindex mprint-tune-info
16755 Print CPU tuning information as comment in assembler file. This is
16756 an option used only for regression testing of the compiler and not
16757 intended for ordinary use in compiling code. This option is disabled
16760 @item -mverbose-cost-dump
16761 @opindex mverbose-cost-dump
16762 Enable verbose cost model dumping in the debug dump files. This option is
16763 provided for use in debugging the compiler.
16766 @opindex mpure-code
16767 Do not allow constant data to be placed in code sections.
16768 Additionally, when compiling for ELF object format give all text sections the
16769 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
16770 is only available when generating non-pic code for M-profile targets with the
16775 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
16776 Development Tools Engineering Specification", which can be found on
16777 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
16781 @subsection AVR Options
16782 @cindex AVR Options
16784 These options are defined for AVR implementations:
16787 @item -mmcu=@var{mcu}
16789 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
16791 The default for this option is@tie{}@samp{avr2}.
16793 GCC supports the following AVR devices and ISAs:
16795 @include avr-mmcu.texi
16800 Assume that all data in static storage can be accessed by LDS / STS
16801 instructions. This option has only an effect on reduced Tiny devices like
16802 ATtiny40. See also the @code{absdata}
16803 @ref{AVR Variable Attributes,variable attribute}.
16805 @item -maccumulate-args
16806 @opindex maccumulate-args
16807 Accumulate outgoing function arguments and acquire/release the needed
16808 stack space for outgoing function arguments once in function
16809 prologue/epilogue. Without this option, outgoing arguments are pushed
16810 before calling a function and popped afterwards.
16812 Popping the arguments after the function call can be expensive on
16813 AVR so that accumulating the stack space might lead to smaller
16814 executables because arguments need not be removed from the
16815 stack after such a function call.
16817 This option can lead to reduced code size for functions that perform
16818 several calls to functions that get their arguments on the stack like
16819 calls to printf-like functions.
16821 @item -mbranch-cost=@var{cost}
16822 @opindex mbranch-cost
16823 Set the branch costs for conditional branch instructions to
16824 @var{cost}. Reasonable values for @var{cost} are small, non-negative
16825 integers. The default branch cost is 0.
16827 @item -mcall-prologues
16828 @opindex mcall-prologues
16829 Functions prologues/epilogues are expanded as calls to appropriate
16830 subroutines. Code size is smaller.
16832 @item -mgas-isr-prologues
16833 @opindex mgas-isr-prologues
16834 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
16835 instruction supported by GNU Binutils.
16836 If this option is on, the feature can still be disabled for individual
16837 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
16838 function attribute. This feature is activated per default
16839 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
16840 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
16844 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
16845 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
16846 and @code{long long} is 4 bytes. Please note that this option does not
16847 conform to the C standards, but it results in smaller code
16850 @item -mmain-is-OS_task
16851 @opindex mmain-is-OS_task
16852 Do not save registers in @code{main}. The effect is the same like
16853 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
16854 to @code{main}. It is activated per default if optimization is on.
16856 @item -mn-flash=@var{num}
16858 Assume that the flash memory has a size of
16859 @var{num} times 64@tie{}KiB.
16861 @item -mno-interrupts
16862 @opindex mno-interrupts
16863 Generated code is not compatible with hardware interrupts.
16864 Code size is smaller.
16868 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
16869 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
16870 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
16871 the assembler's command line and the @option{--relax} option to the
16872 linker's command line.
16874 Jump relaxing is performed by the linker because jump offsets are not
16875 known before code is located. Therefore, the assembler code generated by the
16876 compiler is the same, but the instructions in the executable may
16877 differ from instructions in the assembler code.
16879 Relaxing must be turned on if linker stubs are needed, see the
16880 section on @code{EIND} and linker stubs below.
16884 Assume that the device supports the Read-Modify-Write
16885 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
16887 @item -mshort-calls
16888 @opindex mshort-calls
16890 Assume that @code{RJMP} and @code{RCALL} can target the whole
16893 This option is used internally for multilib selection. It is
16894 not an optimization option, and you don't need to set it by hand.
16898 Treat the stack pointer register as an 8-bit register,
16899 i.e.@: assume the high byte of the stack pointer is zero.
16900 In general, you don't need to set this option by hand.
16902 This option is used internally by the compiler to select and
16903 build multilibs for architectures @code{avr2} and @code{avr25}.
16904 These architectures mix devices with and without @code{SPH}.
16905 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
16906 the compiler driver adds or removes this option from the compiler
16907 proper's command line, because the compiler then knows if the device
16908 or architecture has an 8-bit stack pointer and thus no @code{SPH}
16913 Use address register @code{X} in a way proposed by the hardware. This means
16914 that @code{X} is only used in indirect, post-increment or
16915 pre-decrement addressing.
16917 Without this option, the @code{X} register may be used in the same way
16918 as @code{Y} or @code{Z} which then is emulated by additional
16920 For example, loading a value with @code{X+const} addressing with a
16921 small non-negative @code{const < 64} to a register @var{Rn} is
16925 adiw r26, const ; X += const
16926 ld @var{Rn}, X ; @var{Rn} = *X
16927 sbiw r26, const ; X -= const
16931 @opindex mtiny-stack
16932 Only change the lower 8@tie{}bits of the stack pointer.
16934 @item -mfract-convert-truncate
16935 @opindex mfract-convert-truncate
16936 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
16939 @opindex nodevicelib
16940 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
16942 @item -Waddr-space-convert
16943 @opindex Waddr-space-convert
16944 @opindex Wno-addr-space-convert
16945 Warn about conversions between address spaces in the case where the
16946 resulting address space is not contained in the incoming address space.
16948 @item -Wmisspelled-isr
16949 @opindex Wmisspelled-isr
16950 @opindex Wno-misspelled-isr
16951 Warn if the ISR is misspelled, i.e. without __vector prefix.
16952 Enabled by default.
16955 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
16956 @cindex @code{EIND}
16957 Pointers in the implementation are 16@tie{}bits wide.
16958 The address of a function or label is represented as word address so
16959 that indirect jumps and calls can target any code address in the
16960 range of 64@tie{}Ki words.
16962 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
16963 bytes of program memory space, there is a special function register called
16964 @code{EIND} that serves as most significant part of the target address
16965 when @code{EICALL} or @code{EIJMP} instructions are used.
16967 Indirect jumps and calls on these devices are handled as follows by
16968 the compiler and are subject to some limitations:
16973 The compiler never sets @code{EIND}.
16976 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
16977 instructions or might read @code{EIND} directly in order to emulate an
16978 indirect call/jump by means of a @code{RET} instruction.
16981 The compiler assumes that @code{EIND} never changes during the startup
16982 code or during the application. In particular, @code{EIND} is not
16983 saved/restored in function or interrupt service routine
16987 For indirect calls to functions and computed goto, the linker
16988 generates @emph{stubs}. Stubs are jump pads sometimes also called
16989 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
16990 The stub contains a direct jump to the desired address.
16993 Linker relaxation must be turned on so that the linker generates
16994 the stubs correctly in all situations. See the compiler option
16995 @option{-mrelax} and the linker option @option{--relax}.
16996 There are corner cases where the linker is supposed to generate stubs
16997 but aborts without relaxation and without a helpful error message.
17000 The default linker script is arranged for code with @code{EIND = 0}.
17001 If code is supposed to work for a setup with @code{EIND != 0}, a custom
17002 linker script has to be used in order to place the sections whose
17003 name start with @code{.trampolines} into the segment where @code{EIND}
17007 The startup code from libgcc never sets @code{EIND}.
17008 Notice that startup code is a blend of code from libgcc and AVR-LibC.
17009 For the impact of AVR-LibC on @code{EIND}, see the
17010 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
17013 It is legitimate for user-specific startup code to set up @code{EIND}
17014 early, for example by means of initialization code located in
17015 section @code{.init3}. Such code runs prior to general startup code
17016 that initializes RAM and calls constructors, but after the bit
17017 of startup code from AVR-LibC that sets @code{EIND} to the segment
17018 where the vector table is located.
17020 #include <avr/io.h>
17023 __attribute__((section(".init3"),naked,used,no_instrument_function))
17024 init3_set_eind (void)
17026 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
17027 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
17032 The @code{__trampolines_start} symbol is defined in the linker script.
17035 Stubs are generated automatically by the linker if
17036 the following two conditions are met:
17039 @item The address of a label is taken by means of the @code{gs} modifier
17040 (short for @emph{generate stubs}) like so:
17042 LDI r24, lo8(gs(@var{func}))
17043 LDI r25, hi8(gs(@var{func}))
17045 @item The final location of that label is in a code segment
17046 @emph{outside} the segment where the stubs are located.
17050 The compiler emits such @code{gs} modifiers for code labels in the
17051 following situations:
17053 @item Taking address of a function or code label.
17054 @item Computed goto.
17055 @item If prologue-save function is used, see @option{-mcall-prologues}
17056 command-line option.
17057 @item Switch/case dispatch tables. If you do not want such dispatch
17058 tables you can specify the @option{-fno-jump-tables} command-line option.
17059 @item C and C++ constructors/destructors called during startup/shutdown.
17060 @item If the tools hit a @code{gs()} modifier explained above.
17064 Jumping to non-symbolic addresses like so is @emph{not} supported:
17069 /* Call function at word address 0x2 */
17070 return ((int(*)(void)) 0x2)();
17074 Instead, a stub has to be set up, i.e.@: the function has to be called
17075 through a symbol (@code{func_4} in the example):
17080 extern int func_4 (void);
17082 /* Call function at byte address 0x4 */
17087 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
17088 Alternatively, @code{func_4} can be defined in the linker script.
17091 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
17092 @cindex @code{RAMPD}
17093 @cindex @code{RAMPX}
17094 @cindex @code{RAMPY}
17095 @cindex @code{RAMPZ}
17096 Some AVR devices support memories larger than the 64@tie{}KiB range
17097 that can be accessed with 16-bit pointers. To access memory locations
17098 outside this 64@tie{}KiB range, the content of a @code{RAMP}
17099 register is used as high part of the address:
17100 The @code{X}, @code{Y}, @code{Z} address register is concatenated
17101 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
17102 register, respectively, to get a wide address. Similarly,
17103 @code{RAMPD} is used together with direct addressing.
17107 The startup code initializes the @code{RAMP} special function
17108 registers with zero.
17111 If a @ref{AVR Named Address Spaces,named address space} other than
17112 generic or @code{__flash} is used, then @code{RAMPZ} is set
17113 as needed before the operation.
17116 If the device supports RAM larger than 64@tie{}KiB and the compiler
17117 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
17118 is reset to zero after the operation.
17121 If the device comes with a specific @code{RAMP} register, the ISR
17122 prologue/epilogue saves/restores that SFR and initializes it with
17123 zero in case the ISR code might (implicitly) use it.
17126 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
17127 If you use inline assembler to read from locations outside the
17128 16-bit address range and change one of the @code{RAMP} registers,
17129 you must reset it to zero after the access.
17133 @subsubsection AVR Built-in Macros
17135 GCC defines several built-in macros so that the user code can test
17136 for the presence or absence of features. Almost any of the following
17137 built-in macros are deduced from device capabilities and thus
17138 triggered by the @option{-mmcu=} command-line option.
17140 For even more AVR-specific built-in macros see
17141 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
17146 Build-in macro that resolves to a decimal number that identifies the
17147 architecture and depends on the @option{-mmcu=@var{mcu}} option.
17148 Possible values are:
17150 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
17151 @code{4}, @code{5}, @code{51}, @code{6}
17153 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
17154 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
17159 @code{102}, @code{103}, @code{104},
17160 @code{105}, @code{106}, @code{107}
17162 for @var{mcu}=@code{avrtiny},
17163 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
17164 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
17165 If @var{mcu} specifies a device, this built-in macro is set
17166 accordingly. For example, with @option{-mmcu=atmega8} the macro is
17167 defined to @code{4}.
17169 @item __AVR_@var{Device}__
17170 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
17171 the device's name. For example, @option{-mmcu=atmega8} defines the
17172 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
17173 @code{__AVR_ATtiny261A__}, etc.
17175 The built-in macros' names follow
17176 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
17177 the device name as from the AVR user manual. The difference between
17178 @var{Device} in the built-in macro and @var{device} in
17179 @option{-mmcu=@var{device}} is that the latter is always lowercase.
17181 If @var{device} is not a device but only a core architecture like
17182 @samp{avr51}, this macro is not defined.
17184 @item __AVR_DEVICE_NAME__
17185 Setting @option{-mmcu=@var{device}} defines this built-in macro to
17186 the device's name. For example, with @option{-mmcu=atmega8} the macro
17187 is defined to @code{atmega8}.
17189 If @var{device} is not a device but only a core architecture like
17190 @samp{avr51}, this macro is not defined.
17192 @item __AVR_XMEGA__
17193 The device / architecture belongs to the XMEGA family of devices.
17195 @item __AVR_HAVE_ELPM__
17196 The device has the @code{ELPM} instruction.
17198 @item __AVR_HAVE_ELPMX__
17199 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
17200 R@var{n},Z+} instructions.
17202 @item __AVR_HAVE_MOVW__
17203 The device has the @code{MOVW} instruction to perform 16-bit
17204 register-register moves.
17206 @item __AVR_HAVE_LPMX__
17207 The device has the @code{LPM R@var{n},Z} and
17208 @code{LPM R@var{n},Z+} instructions.
17210 @item __AVR_HAVE_MUL__
17211 The device has a hardware multiplier.
17213 @item __AVR_HAVE_JMP_CALL__
17214 The device has the @code{JMP} and @code{CALL} instructions.
17215 This is the case for devices with more than 8@tie{}KiB of program
17218 @item __AVR_HAVE_EIJMP_EICALL__
17219 @itemx __AVR_3_BYTE_PC__
17220 The device has the @code{EIJMP} and @code{EICALL} instructions.
17221 This is the case for devices with more than 128@tie{}KiB of program memory.
17222 This also means that the program counter
17223 (PC) is 3@tie{}bytes wide.
17225 @item __AVR_2_BYTE_PC__
17226 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
17227 with up to 128@tie{}KiB of program memory.
17229 @item __AVR_HAVE_8BIT_SP__
17230 @itemx __AVR_HAVE_16BIT_SP__
17231 The stack pointer (SP) register is treated as 8-bit respectively
17232 16-bit register by the compiler.
17233 The definition of these macros is affected by @option{-mtiny-stack}.
17235 @item __AVR_HAVE_SPH__
17237 The device has the SPH (high part of stack pointer) special function
17238 register or has an 8-bit stack pointer, respectively.
17239 The definition of these macros is affected by @option{-mmcu=} and
17240 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
17243 @item __AVR_HAVE_RAMPD__
17244 @itemx __AVR_HAVE_RAMPX__
17245 @itemx __AVR_HAVE_RAMPY__
17246 @itemx __AVR_HAVE_RAMPZ__
17247 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
17248 @code{RAMPZ} special function register, respectively.
17250 @item __NO_INTERRUPTS__
17251 This macro reflects the @option{-mno-interrupts} command-line option.
17253 @item __AVR_ERRATA_SKIP__
17254 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
17255 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
17256 instructions because of a hardware erratum. Skip instructions are
17257 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
17258 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
17261 @item __AVR_ISA_RMW__
17262 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
17264 @item __AVR_SFR_OFFSET__=@var{offset}
17265 Instructions that can address I/O special function registers directly
17266 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
17267 address as if addressed by an instruction to access RAM like @code{LD}
17268 or @code{STS}. This offset depends on the device architecture and has
17269 to be subtracted from the RAM address in order to get the
17270 respective I/O@tie{}address.
17272 @item __AVR_SHORT_CALLS__
17273 The @option{-mshort-calls} command line option is set.
17275 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
17276 Some devices support reading from flash memory by means of @code{LD*}
17277 instructions. The flash memory is seen in the data address space
17278 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
17279 is not defined, this feature is not available. If defined,
17280 the address space is linear and there is no need to put
17281 @code{.rodata} into RAM. This is handled by the default linker
17282 description file, and is currently available for
17283 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
17284 there is no need to use address spaces like @code{__flash} or
17285 features like attribute @code{progmem} and @code{pgm_read_*}.
17287 @item __WITH_AVRLIBC__
17288 The compiler is configured to be used together with AVR-Libc.
17289 See the @option{--with-avrlibc} configure option.
17293 @node Blackfin Options
17294 @subsection Blackfin Options
17295 @cindex Blackfin Options
17298 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
17300 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
17301 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
17302 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
17303 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
17304 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
17305 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
17306 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
17307 @samp{bf561}, @samp{bf592}.
17309 The optional @var{sirevision} specifies the silicon revision of the target
17310 Blackfin processor. Any workarounds available for the targeted silicon revision
17311 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
17312 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
17313 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
17314 hexadecimal digits representing the major and minor numbers in the silicon
17315 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
17316 is not defined. If @var{sirevision} is @samp{any}, the
17317 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
17318 If this optional @var{sirevision} is not used, GCC assumes the latest known
17319 silicon revision of the targeted Blackfin processor.
17321 GCC defines a preprocessor macro for the specified @var{cpu}.
17322 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
17323 provided by libgloss to be linked in if @option{-msim} is not given.
17325 Without this option, @samp{bf532} is used as the processor by default.
17327 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
17328 only the preprocessor macro is defined.
17332 Specifies that the program will be run on the simulator. This causes
17333 the simulator BSP provided by libgloss to be linked in. This option
17334 has effect only for @samp{bfin-elf} toolchain.
17335 Certain other options, such as @option{-mid-shared-library} and
17336 @option{-mfdpic}, imply @option{-msim}.
17338 @item -momit-leaf-frame-pointer
17339 @opindex momit-leaf-frame-pointer
17340 Don't keep the frame pointer in a register for leaf functions. This
17341 avoids the instructions to save, set up and restore frame pointers and
17342 makes an extra register available in leaf functions.
17344 @item -mspecld-anomaly
17345 @opindex mspecld-anomaly
17346 When enabled, the compiler ensures that the generated code does not
17347 contain speculative loads after jump instructions. If this option is used,
17348 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
17350 @item -mno-specld-anomaly
17351 @opindex mno-specld-anomaly
17352 Don't generate extra code to prevent speculative loads from occurring.
17354 @item -mcsync-anomaly
17355 @opindex mcsync-anomaly
17356 When enabled, the compiler ensures that the generated code does not
17357 contain CSYNC or SSYNC instructions too soon after conditional branches.
17358 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
17360 @item -mno-csync-anomaly
17361 @opindex mno-csync-anomaly
17362 Don't generate extra code to prevent CSYNC or SSYNC instructions from
17363 occurring too soon after a conditional branch.
17367 When enabled, the compiler is free to take advantage of the knowledge that
17368 the entire program fits into the low 64k of memory.
17371 @opindex mno-low-64k
17372 Assume that the program is arbitrarily large. This is the default.
17374 @item -mstack-check-l1
17375 @opindex mstack-check-l1
17376 Do stack checking using information placed into L1 scratchpad memory by the
17379 @item -mid-shared-library
17380 @opindex mid-shared-library
17381 Generate code that supports shared libraries via the library ID method.
17382 This allows for execute in place and shared libraries in an environment
17383 without virtual memory management. This option implies @option{-fPIC}.
17384 With a @samp{bfin-elf} target, this option implies @option{-msim}.
17386 @item -mno-id-shared-library
17387 @opindex mno-id-shared-library
17388 Generate code that doesn't assume ID-based shared libraries are being used.
17389 This is the default.
17391 @item -mleaf-id-shared-library
17392 @opindex mleaf-id-shared-library
17393 Generate code that supports shared libraries via the library ID method,
17394 but assumes that this library or executable won't link against any other
17395 ID shared libraries. That allows the compiler to use faster code for jumps
17398 @item -mno-leaf-id-shared-library
17399 @opindex mno-leaf-id-shared-library
17400 Do not assume that the code being compiled won't link against any ID shared
17401 libraries. Slower code is generated for jump and call insns.
17403 @item -mshared-library-id=n
17404 @opindex mshared-library-id
17405 Specifies the identification number of the ID-based shared library being
17406 compiled. Specifying a value of 0 generates more compact code; specifying
17407 other values forces the allocation of that number to the current
17408 library but is no more space- or time-efficient than omitting this option.
17412 Generate code that allows the data segment to be located in a different
17413 area of memory from the text segment. This allows for execute in place in
17414 an environment without virtual memory management by eliminating relocations
17415 against the text section.
17417 @item -mno-sep-data
17418 @opindex mno-sep-data
17419 Generate code that assumes that the data segment follows the text segment.
17420 This is the default.
17423 @itemx -mno-long-calls
17424 @opindex mlong-calls
17425 @opindex mno-long-calls
17426 Tells the compiler to perform function calls by first loading the
17427 address of the function into a register and then performing a subroutine
17428 call on this register. This switch is needed if the target function
17429 lies outside of the 24-bit addressing range of the offset-based
17430 version of subroutine call instruction.
17432 This feature is not enabled by default. Specifying
17433 @option{-mno-long-calls} restores the default behavior. Note these
17434 switches have no effect on how the compiler generates code to handle
17435 function calls via function pointers.
17439 Link with the fast floating-point library. This library relaxes some of
17440 the IEEE floating-point standard's rules for checking inputs against
17441 Not-a-Number (NAN), in the interest of performance.
17444 @opindex minline-plt
17445 Enable inlining of PLT entries in function calls to functions that are
17446 not known to bind locally. It has no effect without @option{-mfdpic}.
17449 @opindex mmulticore
17450 Build a standalone application for multicore Blackfin processors.
17451 This option causes proper start files and link scripts supporting
17452 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
17453 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
17455 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
17456 selects the one-application-per-core programming model. Without
17457 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
17458 programming model is used. In this model, the main function of Core B
17459 should be named as @code{coreb_main}.
17461 If this option is not used, the single-core application programming
17466 Build a standalone application for Core A of BF561 when using
17467 the one-application-per-core programming model. Proper start files
17468 and link scripts are used to support Core A, and the macro
17469 @code{__BFIN_COREA} is defined.
17470 This option can only be used in conjunction with @option{-mmulticore}.
17474 Build a standalone application for Core B of BF561 when using
17475 the one-application-per-core programming model. Proper start files
17476 and link scripts are used to support Core B, and the macro
17477 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
17478 should be used instead of @code{main}.
17479 This option can only be used in conjunction with @option{-mmulticore}.
17483 Build a standalone application for SDRAM. Proper start files and
17484 link scripts are used to put the application into SDRAM, and the macro
17485 @code{__BFIN_SDRAM} is defined.
17486 The loader should initialize SDRAM before loading the application.
17490 Assume that ICPLBs are enabled at run time. This has an effect on certain
17491 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
17492 are enabled; for standalone applications the default is off.
17496 @subsection C6X Options
17497 @cindex C6X Options
17500 @item -march=@var{name}
17502 This specifies the name of the target architecture. GCC uses this
17503 name to determine what kind of instructions it can emit when generating
17504 assembly code. Permissible names are: @samp{c62x},
17505 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
17508 @opindex mbig-endian
17509 Generate code for a big-endian target.
17511 @item -mlittle-endian
17512 @opindex mlittle-endian
17513 Generate code for a little-endian target. This is the default.
17517 Choose startup files and linker script suitable for the simulator.
17519 @item -msdata=default
17520 @opindex msdata=default
17521 Put small global and static data in the @code{.neardata} section,
17522 which is pointed to by register @code{B14}. Put small uninitialized
17523 global and static data in the @code{.bss} section, which is adjacent
17524 to the @code{.neardata} section. Put small read-only data into the
17525 @code{.rodata} section. The corresponding sections used for large
17526 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
17529 @opindex msdata=all
17530 Put all data, not just small objects, into the sections reserved for
17531 small data, and use addressing relative to the @code{B14} register to
17535 @opindex msdata=none
17536 Make no use of the sections reserved for small data, and use absolute
17537 addresses to access all data. Put all initialized global and static
17538 data in the @code{.fardata} section, and all uninitialized data in the
17539 @code{.far} section. Put all constant data into the @code{.const}
17544 @subsection CRIS Options
17545 @cindex CRIS Options
17547 These options are defined specifically for the CRIS ports.
17550 @item -march=@var{architecture-type}
17551 @itemx -mcpu=@var{architecture-type}
17554 Generate code for the specified architecture. The choices for
17555 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
17556 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
17557 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
17560 @item -mtune=@var{architecture-type}
17562 Tune to @var{architecture-type} everything applicable about the generated
17563 code, except for the ABI and the set of available instructions. The
17564 choices for @var{architecture-type} are the same as for
17565 @option{-march=@var{architecture-type}}.
17567 @item -mmax-stack-frame=@var{n}
17568 @opindex mmax-stack-frame
17569 Warn when the stack frame of a function exceeds @var{n} bytes.
17575 The options @option{-metrax4} and @option{-metrax100} are synonyms for
17576 @option{-march=v3} and @option{-march=v8} respectively.
17578 @item -mmul-bug-workaround
17579 @itemx -mno-mul-bug-workaround
17580 @opindex mmul-bug-workaround
17581 @opindex mno-mul-bug-workaround
17582 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
17583 models where it applies. This option is active by default.
17587 Enable CRIS-specific verbose debug-related information in the assembly
17588 code. This option also has the effect of turning off the @samp{#NO_APP}
17589 formatted-code indicator to the assembler at the beginning of the
17594 Do not use condition-code results from previous instruction; always emit
17595 compare and test instructions before use of condition codes.
17597 @item -mno-side-effects
17598 @opindex mno-side-effects
17599 Do not emit instructions with side effects in addressing modes other than
17602 @item -mstack-align
17603 @itemx -mno-stack-align
17604 @itemx -mdata-align
17605 @itemx -mno-data-align
17606 @itemx -mconst-align
17607 @itemx -mno-const-align
17608 @opindex mstack-align
17609 @opindex mno-stack-align
17610 @opindex mdata-align
17611 @opindex mno-data-align
17612 @opindex mconst-align
17613 @opindex mno-const-align
17614 These options (@samp{no-} options) arrange (eliminate arrangements) for the
17615 stack frame, individual data and constants to be aligned for the maximum
17616 single data access size for the chosen CPU model. The default is to
17617 arrange for 32-bit alignment. ABI details such as structure layout are
17618 not affected by these options.
17626 Similar to the stack- data- and const-align options above, these options
17627 arrange for stack frame, writable data and constants to all be 32-bit,
17628 16-bit or 8-bit aligned. The default is 32-bit alignment.
17630 @item -mno-prologue-epilogue
17631 @itemx -mprologue-epilogue
17632 @opindex mno-prologue-epilogue
17633 @opindex mprologue-epilogue
17634 With @option{-mno-prologue-epilogue}, the normal function prologue and
17635 epilogue which set up the stack frame are omitted and no return
17636 instructions or return sequences are generated in the code. Use this
17637 option only together with visual inspection of the compiled code: no
17638 warnings or errors are generated when call-saved registers must be saved,
17639 or storage for local variables needs to be allocated.
17643 @opindex mno-gotplt
17645 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
17646 instruction sequences that load addresses for functions from the PLT part
17647 of the GOT rather than (traditional on other architectures) calls to the
17648 PLT@. The default is @option{-mgotplt}.
17652 Legacy no-op option only recognized with the cris-axis-elf and
17653 cris-axis-linux-gnu targets.
17657 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
17661 This option, recognized for the cris-axis-elf, arranges
17662 to link with input-output functions from a simulator library. Code,
17663 initialized data and zero-initialized data are allocated consecutively.
17667 Like @option{-sim}, but pass linker options to locate initialized data at
17668 0x40000000 and zero-initialized data at 0x80000000.
17672 @subsection CR16 Options
17673 @cindex CR16 Options
17675 These options are defined specifically for the CR16 ports.
17681 Enable the use of multiply-accumulate instructions. Disabled by default.
17685 @opindex mcr16cplus
17687 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
17692 Links the library libsim.a which is in compatible with simulator. Applicable
17693 to ELF compiler only.
17697 Choose integer type as 32-bit wide.
17701 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
17703 @item -mdata-model=@var{model}
17704 @opindex mdata-model
17705 Choose a data model. The choices for @var{model} are @samp{near},
17706 @samp{far} or @samp{medium}. @samp{medium} is default.
17707 However, @samp{far} is not valid with @option{-mcr16c}, as the
17708 CR16C architecture does not support the far data model.
17711 @node Darwin Options
17712 @subsection Darwin Options
17713 @cindex Darwin options
17715 These options are defined for all architectures running the Darwin operating
17718 FSF GCC on Darwin does not create ``fat'' object files; it creates
17719 an object file for the single architecture that GCC was built to
17720 target. Apple's GCC on Darwin does create ``fat'' files if multiple
17721 @option{-arch} options are used; it does so by running the compiler or
17722 linker multiple times and joining the results together with
17725 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
17726 @samp{i686}) is determined by the flags that specify the ISA
17727 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
17728 @option{-force_cpusubtype_ALL} option can be used to override this.
17730 The Darwin tools vary in their behavior when presented with an ISA
17731 mismatch. The assembler, @file{as}, only permits instructions to
17732 be used that are valid for the subtype of the file it is generating,
17733 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
17734 The linker for shared libraries, @file{/usr/bin/libtool}, fails
17735 and prints an error if asked to create a shared library with a less
17736 restrictive subtype than its input files (for instance, trying to put
17737 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
17738 for executables, @command{ld}, quietly gives the executable the most
17739 restrictive subtype of any of its input files.
17744 Add the framework directory @var{dir} to the head of the list of
17745 directories to be searched for header files. These directories are
17746 interleaved with those specified by @option{-I} options and are
17747 scanned in a left-to-right order.
17749 A framework directory is a directory with frameworks in it. A
17750 framework is a directory with a @file{Headers} and/or
17751 @file{PrivateHeaders} directory contained directly in it that ends
17752 in @file{.framework}. The name of a framework is the name of this
17753 directory excluding the @file{.framework}. Headers associated with
17754 the framework are found in one of those two directories, with
17755 @file{Headers} being searched first. A subframework is a framework
17756 directory that is in a framework's @file{Frameworks} directory.
17757 Includes of subframework headers can only appear in a header of a
17758 framework that contains the subframework, or in a sibling subframework
17759 header. Two subframeworks are siblings if they occur in the same
17760 framework. A subframework should not have the same name as a
17761 framework; a warning is issued if this is violated. Currently a
17762 subframework cannot have subframeworks; in the future, the mechanism
17763 may be extended to support this. The standard frameworks can be found
17764 in @file{/System/Library/Frameworks} and
17765 @file{/Library/Frameworks}. An example include looks like
17766 @code{#include <Framework/header.h>}, where @file{Framework} denotes
17767 the name of the framework and @file{header.h} is found in the
17768 @file{PrivateHeaders} or @file{Headers} directory.
17770 @item -iframework@var{dir}
17771 @opindex iframework
17772 Like @option{-F} except the directory is a treated as a system
17773 directory. The main difference between this @option{-iframework} and
17774 @option{-F} is that with @option{-iframework} the compiler does not
17775 warn about constructs contained within header files found via
17776 @var{dir}. This option is valid only for the C family of languages.
17780 Emit debugging information for symbols that are used. For stabs
17781 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
17782 This is by default ON@.
17786 Emit debugging information for all symbols and types.
17788 @item -mmacosx-version-min=@var{version}
17789 The earliest version of MacOS X that this executable will run on
17790 is @var{version}. Typical values of @var{version} include @code{10.1},
17791 @code{10.2}, and @code{10.3.9}.
17793 If the compiler was built to use the system's headers by default,
17794 then the default for this option is the system version on which the
17795 compiler is running, otherwise the default is to make choices that
17796 are compatible with as many systems and code bases as possible.
17800 Enable kernel development mode. The @option{-mkernel} option sets
17801 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
17802 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
17803 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
17804 applicable. This mode also sets @option{-mno-altivec},
17805 @option{-msoft-float}, @option{-fno-builtin} and
17806 @option{-mlong-branch} for PowerPC targets.
17808 @item -mone-byte-bool
17809 @opindex mone-byte-bool
17810 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
17811 By default @code{sizeof(bool)} is @code{4} when compiling for
17812 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
17813 option has no effect on x86.
17815 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
17816 to generate code that is not binary compatible with code generated
17817 without that switch. Using this switch may require recompiling all
17818 other modules in a program, including system libraries. Use this
17819 switch to conform to a non-default data model.
17821 @item -mfix-and-continue
17822 @itemx -ffix-and-continue
17823 @itemx -findirect-data
17824 @opindex mfix-and-continue
17825 @opindex ffix-and-continue
17826 @opindex findirect-data
17827 Generate code suitable for fast turnaround development, such as to
17828 allow GDB to dynamically load @file{.o} files into already-running
17829 programs. @option{-findirect-data} and @option{-ffix-and-continue}
17830 are provided for backwards compatibility.
17834 Loads all members of static archive libraries.
17835 See man ld(1) for more information.
17837 @item -arch_errors_fatal
17838 @opindex arch_errors_fatal
17839 Cause the errors having to do with files that have the wrong architecture
17842 @item -bind_at_load
17843 @opindex bind_at_load
17844 Causes the output file to be marked such that the dynamic linker will
17845 bind all undefined references when the file is loaded or launched.
17849 Produce a Mach-o bundle format file.
17850 See man ld(1) for more information.
17852 @item -bundle_loader @var{executable}
17853 @opindex bundle_loader
17854 This option specifies the @var{executable} that will load the build
17855 output file being linked. See man ld(1) for more information.
17858 @opindex dynamiclib
17859 When passed this option, GCC produces a dynamic library instead of
17860 an executable when linking, using the Darwin @file{libtool} command.
17862 @item -force_cpusubtype_ALL
17863 @opindex force_cpusubtype_ALL
17864 This causes GCC's output file to have the @samp{ALL} subtype, instead of
17865 one controlled by the @option{-mcpu} or @option{-march} option.
17867 @item -allowable_client @var{client_name}
17868 @itemx -client_name
17869 @itemx -compatibility_version
17870 @itemx -current_version
17872 @itemx -dependency-file
17874 @itemx -dylinker_install_name
17876 @itemx -exported_symbols_list
17879 @itemx -flat_namespace
17880 @itemx -force_flat_namespace
17881 @itemx -headerpad_max_install_names
17884 @itemx -install_name
17885 @itemx -keep_private_externs
17886 @itemx -multi_module
17887 @itemx -multiply_defined
17888 @itemx -multiply_defined_unused
17891 @itemx -no_dead_strip_inits_and_terms
17892 @itemx -nofixprebinding
17893 @itemx -nomultidefs
17895 @itemx -noseglinkedit
17896 @itemx -pagezero_size
17898 @itemx -prebind_all_twolevel_modules
17899 @itemx -private_bundle
17901 @itemx -read_only_relocs
17903 @itemx -sectobjectsymbols
17907 @itemx -sectobjectsymbols
17910 @itemx -segs_read_only_addr
17912 @itemx -segs_read_write_addr
17913 @itemx -seg_addr_table
17914 @itemx -seg_addr_table_filename
17915 @itemx -seglinkedit
17917 @itemx -segs_read_only_addr
17918 @itemx -segs_read_write_addr
17919 @itemx -single_module
17921 @itemx -sub_library
17923 @itemx -sub_umbrella
17924 @itemx -twolevel_namespace
17927 @itemx -unexported_symbols_list
17928 @itemx -weak_reference_mismatches
17929 @itemx -whatsloaded
17930 @opindex allowable_client
17931 @opindex client_name
17932 @opindex compatibility_version
17933 @opindex current_version
17934 @opindex dead_strip
17935 @opindex dependency-file
17936 @opindex dylib_file
17937 @opindex dylinker_install_name
17939 @opindex exported_symbols_list
17941 @opindex flat_namespace
17942 @opindex force_flat_namespace
17943 @opindex headerpad_max_install_names
17944 @opindex image_base
17946 @opindex install_name
17947 @opindex keep_private_externs
17948 @opindex multi_module
17949 @opindex multiply_defined
17950 @opindex multiply_defined_unused
17951 @opindex noall_load
17952 @opindex no_dead_strip_inits_and_terms
17953 @opindex nofixprebinding
17954 @opindex nomultidefs
17956 @opindex noseglinkedit
17957 @opindex pagezero_size
17959 @opindex prebind_all_twolevel_modules
17960 @opindex private_bundle
17961 @opindex read_only_relocs
17963 @opindex sectobjectsymbols
17966 @opindex sectcreate
17967 @opindex sectobjectsymbols
17970 @opindex segs_read_only_addr
17971 @opindex segs_read_write_addr
17972 @opindex seg_addr_table
17973 @opindex seg_addr_table_filename
17974 @opindex seglinkedit
17976 @opindex segs_read_only_addr
17977 @opindex segs_read_write_addr
17978 @opindex single_module
17980 @opindex sub_library
17981 @opindex sub_umbrella
17982 @opindex twolevel_namespace
17985 @opindex unexported_symbols_list
17986 @opindex weak_reference_mismatches
17987 @opindex whatsloaded
17988 These options are passed to the Darwin linker. The Darwin linker man page
17989 describes them in detail.
17992 @node DEC Alpha Options
17993 @subsection DEC Alpha Options
17995 These @samp{-m} options are defined for the DEC Alpha implementations:
17998 @item -mno-soft-float
17999 @itemx -msoft-float
18000 @opindex mno-soft-float
18001 @opindex msoft-float
18002 Use (do not use) the hardware floating-point instructions for
18003 floating-point operations. When @option{-msoft-float} is specified,
18004 functions in @file{libgcc.a} are used to perform floating-point
18005 operations. Unless they are replaced by routines that emulate the
18006 floating-point operations, or compiled in such a way as to call such
18007 emulations routines, these routines issue floating-point
18008 operations. If you are compiling for an Alpha without floating-point
18009 operations, you must ensure that the library is built so as not to call
18012 Note that Alpha implementations without floating-point operations are
18013 required to have floating-point registers.
18016 @itemx -mno-fp-regs
18018 @opindex mno-fp-regs
18019 Generate code that uses (does not use) the floating-point register set.
18020 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
18021 register set is not used, floating-point operands are passed in integer
18022 registers as if they were integers and floating-point results are passed
18023 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
18024 so any function with a floating-point argument or return value called by code
18025 compiled with @option{-mno-fp-regs} must also be compiled with that
18028 A typical use of this option is building a kernel that does not use,
18029 and hence need not save and restore, any floating-point registers.
18033 The Alpha architecture implements floating-point hardware optimized for
18034 maximum performance. It is mostly compliant with the IEEE floating-point
18035 standard. However, for full compliance, software assistance is
18036 required. This option generates code fully IEEE-compliant code
18037 @emph{except} that the @var{inexact-flag} is not maintained (see below).
18038 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
18039 defined during compilation. The resulting code is less efficient but is
18040 able to correctly support denormalized numbers and exceptional IEEE
18041 values such as not-a-number and plus/minus infinity. Other Alpha
18042 compilers call this option @option{-ieee_with_no_inexact}.
18044 @item -mieee-with-inexact
18045 @opindex mieee-with-inexact
18046 This is like @option{-mieee} except the generated code also maintains
18047 the IEEE @var{inexact-flag}. Turning on this option causes the
18048 generated code to implement fully-compliant IEEE math. In addition to
18049 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
18050 macro. On some Alpha implementations the resulting code may execute
18051 significantly slower than the code generated by default. Since there is
18052 very little code that depends on the @var{inexact-flag}, you should
18053 normally not specify this option. Other Alpha compilers call this
18054 option @option{-ieee_with_inexact}.
18056 @item -mfp-trap-mode=@var{trap-mode}
18057 @opindex mfp-trap-mode
18058 This option controls what floating-point related traps are enabled.
18059 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
18060 The trap mode can be set to one of four values:
18064 This is the default (normal) setting. The only traps that are enabled
18065 are the ones that cannot be disabled in software (e.g., division by zero
18069 In addition to the traps enabled by @samp{n}, underflow traps are enabled
18073 Like @samp{u}, but the instructions are marked to be safe for software
18074 completion (see Alpha architecture manual for details).
18077 Like @samp{su}, but inexact traps are enabled as well.
18080 @item -mfp-rounding-mode=@var{rounding-mode}
18081 @opindex mfp-rounding-mode
18082 Selects the IEEE rounding mode. Other Alpha compilers call this option
18083 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
18088 Normal IEEE rounding mode. Floating-point numbers are rounded towards
18089 the nearest machine number or towards the even machine number in case
18093 Round towards minus infinity.
18096 Chopped rounding mode. Floating-point numbers are rounded towards zero.
18099 Dynamic rounding mode. A field in the floating-point control register
18100 (@var{fpcr}, see Alpha architecture reference manual) controls the
18101 rounding mode in effect. The C library initializes this register for
18102 rounding towards plus infinity. Thus, unless your program modifies the
18103 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
18106 @item -mtrap-precision=@var{trap-precision}
18107 @opindex mtrap-precision
18108 In the Alpha architecture, floating-point traps are imprecise. This
18109 means without software assistance it is impossible to recover from a
18110 floating trap and program execution normally needs to be terminated.
18111 GCC can generate code that can assist operating system trap handlers
18112 in determining the exact location that caused a floating-point trap.
18113 Depending on the requirements of an application, different levels of
18114 precisions can be selected:
18118 Program precision. This option is the default and means a trap handler
18119 can only identify which program caused a floating-point exception.
18122 Function precision. The trap handler can determine the function that
18123 caused a floating-point exception.
18126 Instruction precision. The trap handler can determine the exact
18127 instruction that caused a floating-point exception.
18130 Other Alpha compilers provide the equivalent options called
18131 @option{-scope_safe} and @option{-resumption_safe}.
18133 @item -mieee-conformant
18134 @opindex mieee-conformant
18135 This option marks the generated code as IEEE conformant. You must not
18136 use this option unless you also specify @option{-mtrap-precision=i} and either
18137 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
18138 is to emit the line @samp{.eflag 48} in the function prologue of the
18139 generated assembly file.
18141 @item -mbuild-constants
18142 @opindex mbuild-constants
18143 Normally GCC examines a 32- or 64-bit integer constant to
18144 see if it can construct it from smaller constants in two or three
18145 instructions. If it cannot, it outputs the constant as a literal and
18146 generates code to load it from the data segment at run time.
18148 Use this option to require GCC to construct @emph{all} integer constants
18149 using code, even if it takes more instructions (the maximum is six).
18151 You typically use this option to build a shared library dynamic
18152 loader. Itself a shared library, it must relocate itself in memory
18153 before it can find the variables and constants in its own data segment.
18171 Indicate whether GCC should generate code to use the optional BWX,
18172 CIX, FIX and MAX instruction sets. The default is to use the instruction
18173 sets supported by the CPU type specified via @option{-mcpu=} option or that
18174 of the CPU on which GCC was built if none is specified.
18177 @itemx -mfloat-ieee
18178 @opindex mfloat-vax
18179 @opindex mfloat-ieee
18180 Generate code that uses (does not use) VAX F and G floating-point
18181 arithmetic instead of IEEE single and double precision.
18183 @item -mexplicit-relocs
18184 @itemx -mno-explicit-relocs
18185 @opindex mexplicit-relocs
18186 @opindex mno-explicit-relocs
18187 Older Alpha assemblers provided no way to generate symbol relocations
18188 except via assembler macros. Use of these macros does not allow
18189 optimal instruction scheduling. GNU binutils as of version 2.12
18190 supports a new syntax that allows the compiler to explicitly mark
18191 which relocations should apply to which instructions. This option
18192 is mostly useful for debugging, as GCC detects the capabilities of
18193 the assembler when it is built and sets the default accordingly.
18196 @itemx -mlarge-data
18197 @opindex msmall-data
18198 @opindex mlarge-data
18199 When @option{-mexplicit-relocs} is in effect, static data is
18200 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
18201 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
18202 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
18203 16-bit relocations off of the @code{$gp} register. This limits the
18204 size of the small data area to 64KB, but allows the variables to be
18205 directly accessed via a single instruction.
18207 The default is @option{-mlarge-data}. With this option the data area
18208 is limited to just below 2GB@. Programs that require more than 2GB of
18209 data must use @code{malloc} or @code{mmap} to allocate the data in the
18210 heap instead of in the program's data segment.
18212 When generating code for shared libraries, @option{-fpic} implies
18213 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
18216 @itemx -mlarge-text
18217 @opindex msmall-text
18218 @opindex mlarge-text
18219 When @option{-msmall-text} is used, the compiler assumes that the
18220 code of the entire program (or shared library) fits in 4MB, and is
18221 thus reachable with a branch instruction. When @option{-msmall-data}
18222 is used, the compiler can assume that all local symbols share the
18223 same @code{$gp} value, and thus reduce the number of instructions
18224 required for a function call from 4 to 1.
18226 The default is @option{-mlarge-text}.
18228 @item -mcpu=@var{cpu_type}
18230 Set the instruction set and instruction scheduling parameters for
18231 machine type @var{cpu_type}. You can specify either the @samp{EV}
18232 style name or the corresponding chip number. GCC supports scheduling
18233 parameters for the EV4, EV5 and EV6 family of processors and
18234 chooses the default values for the instruction set from the processor
18235 you specify. If you do not specify a processor type, GCC defaults
18236 to the processor on which the compiler was built.
18238 Supported values for @var{cpu_type} are
18244 Schedules as an EV4 and has no instruction set extensions.
18248 Schedules as an EV5 and has no instruction set extensions.
18252 Schedules as an EV5 and supports the BWX extension.
18257 Schedules as an EV5 and supports the BWX and MAX extensions.
18261 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
18265 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
18268 Native toolchains also support the value @samp{native},
18269 which selects the best architecture option for the host processor.
18270 @option{-mcpu=native} has no effect if GCC does not recognize
18273 @item -mtune=@var{cpu_type}
18275 Set only the instruction scheduling parameters for machine type
18276 @var{cpu_type}. The instruction set is not changed.
18278 Native toolchains also support the value @samp{native},
18279 which selects the best architecture option for the host processor.
18280 @option{-mtune=native} has no effect if GCC does not recognize
18283 @item -mmemory-latency=@var{time}
18284 @opindex mmemory-latency
18285 Sets the latency the scheduler should assume for typical memory
18286 references as seen by the application. This number is highly
18287 dependent on the memory access patterns used by the application
18288 and the size of the external cache on the machine.
18290 Valid options for @var{time} are
18294 A decimal number representing clock cycles.
18300 The compiler contains estimates of the number of clock cycles for
18301 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
18302 (also called Dcache, Scache, and Bcache), as well as to main memory.
18303 Note that L3 is only valid for EV5.
18309 @subsection FR30 Options
18310 @cindex FR30 Options
18312 These options are defined specifically for the FR30 port.
18316 @item -msmall-model
18317 @opindex msmall-model
18318 Use the small address space model. This can produce smaller code, but
18319 it does assume that all symbolic values and addresses fit into a
18324 Assume that runtime support has been provided and so there is no need
18325 to include the simulator library (@file{libsim.a}) on the linker
18331 @subsection FT32 Options
18332 @cindex FT32 Options
18334 These options are defined specifically for the FT32 port.
18340 Specifies that the program will be run on the simulator. This causes
18341 an alternate runtime startup and library to be linked.
18342 You must not use this option when generating programs that will run on
18343 real hardware; you must provide your own runtime library for whatever
18344 I/O functions are needed.
18348 Enable Local Register Allocation. This is still experimental for FT32,
18349 so by default the compiler uses standard reload.
18353 Do not use div and mod instructions.
18357 Enable use of the extended instructions of the FT32B processor.
18361 Compress all code using the Ft32B code compression scheme.
18365 Do not generate code that reads program memory.
18370 @subsection FRV Options
18371 @cindex FRV Options
18377 Only use the first 32 general-purpose registers.
18382 Use all 64 general-purpose registers.
18387 Use only the first 32 floating-point registers.
18392 Use all 64 floating-point registers.
18395 @opindex mhard-float
18397 Use hardware instructions for floating-point operations.
18400 @opindex msoft-float
18402 Use library routines for floating-point operations.
18407 Dynamically allocate condition code registers.
18412 Do not try to dynamically allocate condition code registers, only
18413 use @code{icc0} and @code{fcc0}.
18418 Change ABI to use double word insns.
18423 Do not use double word instructions.
18428 Use floating-point double instructions.
18431 @opindex mno-double
18433 Do not use floating-point double instructions.
18438 Use media instructions.
18443 Do not use media instructions.
18448 Use multiply and add/subtract instructions.
18451 @opindex mno-muladd
18453 Do not use multiply and add/subtract instructions.
18458 Select the FDPIC ABI, which uses function descriptors to represent
18459 pointers to functions. Without any PIC/PIE-related options, it
18460 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
18461 assumes GOT entries and small data are within a 12-bit range from the
18462 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
18463 are computed with 32 bits.
18464 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18467 @opindex minline-plt
18469 Enable inlining of PLT entries in function calls to functions that are
18470 not known to bind locally. It has no effect without @option{-mfdpic}.
18471 It's enabled by default if optimizing for speed and compiling for
18472 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
18473 optimization option such as @option{-O3} or above is present in the
18479 Assume a large TLS segment when generating thread-local code.
18484 Do not assume a large TLS segment when generating thread-local code.
18489 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
18490 that is known to be in read-only sections. It's enabled by default,
18491 except for @option{-fpic} or @option{-fpie}: even though it may help
18492 make the global offset table smaller, it trades 1 instruction for 4.
18493 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
18494 one of which may be shared by multiple symbols, and it avoids the need
18495 for a GOT entry for the referenced symbol, so it's more likely to be a
18496 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
18498 @item -multilib-library-pic
18499 @opindex multilib-library-pic
18501 Link with the (library, not FD) pic libraries. It's implied by
18502 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
18503 @option{-fpic} without @option{-mfdpic}. You should never have to use
18507 @opindex mlinked-fp
18509 Follow the EABI requirement of always creating a frame pointer whenever
18510 a stack frame is allocated. This option is enabled by default and can
18511 be disabled with @option{-mno-linked-fp}.
18514 @opindex mlong-calls
18516 Use indirect addressing to call functions outside the current
18517 compilation unit. This allows the functions to be placed anywhere
18518 within the 32-bit address space.
18520 @item -malign-labels
18521 @opindex malign-labels
18523 Try to align labels to an 8-byte boundary by inserting NOPs into the
18524 previous packet. This option only has an effect when VLIW packing
18525 is enabled. It doesn't create new packets; it merely adds NOPs to
18528 @item -mlibrary-pic
18529 @opindex mlibrary-pic
18531 Generate position-independent EABI code.
18536 Use only the first four media accumulator registers.
18541 Use all eight media accumulator registers.
18546 Pack VLIW instructions.
18551 Do not pack VLIW instructions.
18554 @opindex mno-eflags
18556 Do not mark ABI switches in e_flags.
18559 @opindex mcond-move
18561 Enable the use of conditional-move instructions (default).
18563 This switch is mainly for debugging the compiler and will likely be removed
18564 in a future version.
18566 @item -mno-cond-move
18567 @opindex mno-cond-move
18569 Disable the use of conditional-move instructions.
18571 This switch is mainly for debugging the compiler and will likely be removed
18572 in a future version.
18577 Enable the use of conditional set instructions (default).
18579 This switch is mainly for debugging the compiler and will likely be removed
18580 in a future version.
18585 Disable the use of conditional set instructions.
18587 This switch is mainly for debugging the compiler and will likely be removed
18588 in a future version.
18591 @opindex mcond-exec
18593 Enable the use of conditional execution (default).
18595 This switch is mainly for debugging the compiler and will likely be removed
18596 in a future version.
18598 @item -mno-cond-exec
18599 @opindex mno-cond-exec
18601 Disable the use of conditional execution.
18603 This switch is mainly for debugging the compiler and will likely be removed
18604 in a future version.
18606 @item -mvliw-branch
18607 @opindex mvliw-branch
18609 Run a pass to pack branches into VLIW instructions (default).
18611 This switch is mainly for debugging the compiler and will likely be removed
18612 in a future version.
18614 @item -mno-vliw-branch
18615 @opindex mno-vliw-branch
18617 Do not run a pass to pack branches into VLIW instructions.
18619 This switch is mainly for debugging the compiler and will likely be removed
18620 in a future version.
18622 @item -mmulti-cond-exec
18623 @opindex mmulti-cond-exec
18625 Enable optimization of @code{&&} and @code{||} in conditional execution
18628 This switch is mainly for debugging the compiler and will likely be removed
18629 in a future version.
18631 @item -mno-multi-cond-exec
18632 @opindex mno-multi-cond-exec
18634 Disable optimization of @code{&&} and @code{||} in conditional execution.
18636 This switch is mainly for debugging the compiler and will likely be removed
18637 in a future version.
18639 @item -mnested-cond-exec
18640 @opindex mnested-cond-exec
18642 Enable nested conditional execution optimizations (default).
18644 This switch is mainly for debugging the compiler and will likely be removed
18645 in a future version.
18647 @item -mno-nested-cond-exec
18648 @opindex mno-nested-cond-exec
18650 Disable nested conditional execution optimizations.
18652 This switch is mainly for debugging the compiler and will likely be removed
18653 in a future version.
18655 @item -moptimize-membar
18656 @opindex moptimize-membar
18658 This switch removes redundant @code{membar} instructions from the
18659 compiler-generated code. It is enabled by default.
18661 @item -mno-optimize-membar
18662 @opindex mno-optimize-membar
18664 This switch disables the automatic removal of redundant @code{membar}
18665 instructions from the generated code.
18667 @item -mtomcat-stats
18668 @opindex mtomcat-stats
18670 Cause gas to print out tomcat statistics.
18672 @item -mcpu=@var{cpu}
18675 Select the processor type for which to generate code. Possible values are
18676 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
18677 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
18681 @node GNU/Linux Options
18682 @subsection GNU/Linux Options
18684 These @samp{-m} options are defined for GNU/Linux targets:
18689 Use the GNU C library. This is the default except
18690 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
18691 @samp{*-*-linux-*android*} targets.
18695 Use uClibc C library. This is the default on
18696 @samp{*-*-linux-*uclibc*} targets.
18700 Use the musl C library. This is the default on
18701 @samp{*-*-linux-*musl*} targets.
18705 Use Bionic C library. This is the default on
18706 @samp{*-*-linux-*android*} targets.
18710 Compile code compatible with Android platform. This is the default on
18711 @samp{*-*-linux-*android*} targets.
18713 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
18714 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
18715 this option makes the GCC driver pass Android-specific options to the linker.
18716 Finally, this option causes the preprocessor macro @code{__ANDROID__}
18719 @item -tno-android-cc
18720 @opindex tno-android-cc
18721 Disable compilation effects of @option{-mandroid}, i.e., do not enable
18722 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
18723 @option{-fno-rtti} by default.
18725 @item -tno-android-ld
18726 @opindex tno-android-ld
18727 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
18728 linking options to the linker.
18732 @node H8/300 Options
18733 @subsection H8/300 Options
18735 These @samp{-m} options are defined for the H8/300 implementations:
18740 Shorten some address references at link time, when possible; uses the
18741 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
18742 ld, Using ld}, for a fuller description.
18746 Generate code for the H8/300H@.
18750 Generate code for the H8S@.
18754 Generate code for the H8S and H8/300H in the normal mode. This switch
18755 must be used either with @option{-mh} or @option{-ms}.
18759 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
18763 Extended registers are stored on stack before execution of function
18764 with monitor attribute. Default option is @option{-mexr}.
18765 This option is valid only for H8S targets.
18769 Extended registers are not stored on stack before execution of function
18770 with monitor attribute. Default option is @option{-mno-exr}.
18771 This option is valid only for H8S targets.
18775 Make @code{int} data 32 bits by default.
18778 @opindex malign-300
18779 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
18780 The default for the H8/300H and H8S is to align longs and floats on
18782 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
18783 This option has no effect on the H8/300.
18787 @subsection HPPA Options
18788 @cindex HPPA Options
18790 These @samp{-m} options are defined for the HPPA family of computers:
18793 @item -march=@var{architecture-type}
18795 Generate code for the specified architecture. The choices for
18796 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
18797 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
18798 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
18799 architecture option for your machine. Code compiled for lower numbered
18800 architectures runs on higher numbered architectures, but not the
18803 @item -mpa-risc-1-0
18804 @itemx -mpa-risc-1-1
18805 @itemx -mpa-risc-2-0
18806 @opindex mpa-risc-1-0
18807 @opindex mpa-risc-1-1
18808 @opindex mpa-risc-2-0
18809 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
18811 @item -mcaller-copies
18812 @opindex mcaller-copies
18813 The caller copies function arguments passed by hidden reference. This
18814 option should be used with care as it is not compatible with the default
18815 32-bit runtime. However, only aggregates larger than eight bytes are
18816 passed by hidden reference and the option provides better compatibility
18819 @item -mjump-in-delay
18820 @opindex mjump-in-delay
18821 This option is ignored and provided for compatibility purposes only.
18823 @item -mdisable-fpregs
18824 @opindex mdisable-fpregs
18825 Prevent floating-point registers from being used in any manner. This is
18826 necessary for compiling kernels that perform lazy context switching of
18827 floating-point registers. If you use this option and attempt to perform
18828 floating-point operations, the compiler aborts.
18830 @item -mdisable-indexing
18831 @opindex mdisable-indexing
18832 Prevent the compiler from using indexing address modes. This avoids some
18833 rather obscure problems when compiling MIG generated code under MACH@.
18835 @item -mno-space-regs
18836 @opindex mno-space-regs
18837 Generate code that assumes the target has no space registers. This allows
18838 GCC to generate faster indirect calls and use unscaled index address modes.
18840 Such code is suitable for level 0 PA systems and kernels.
18842 @item -mfast-indirect-calls
18843 @opindex mfast-indirect-calls
18844 Generate code that assumes calls never cross space boundaries. This
18845 allows GCC to emit code that performs faster indirect calls.
18847 This option does not work in the presence of shared libraries or nested
18850 @item -mfixed-range=@var{register-range}
18851 @opindex mfixed-range
18852 Generate code treating the given register range as fixed registers.
18853 A fixed register is one that the register allocator cannot use. This is
18854 useful when compiling kernel code. A register range is specified as
18855 two registers separated by a dash. Multiple register ranges can be
18856 specified separated by a comma.
18858 @item -mlong-load-store
18859 @opindex mlong-load-store
18860 Generate 3-instruction load and store sequences as sometimes required by
18861 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
18864 @item -mportable-runtime
18865 @opindex mportable-runtime
18866 Use the portable calling conventions proposed by HP for ELF systems.
18870 Enable the use of assembler directives only GAS understands.
18872 @item -mschedule=@var{cpu-type}
18874 Schedule code according to the constraints for the machine type
18875 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
18876 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
18877 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
18878 proper scheduling option for your machine. The default scheduling is
18882 @opindex mlinker-opt
18883 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
18884 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
18885 linkers in which they give bogus error messages when linking some programs.
18888 @opindex msoft-float
18889 Generate output containing library calls for floating point.
18890 @strong{Warning:} the requisite libraries are not available for all HPPA
18891 targets. Normally the facilities of the machine's usual C compiler are
18892 used, but this cannot be done directly in cross-compilation. You must make
18893 your own arrangements to provide suitable library functions for
18896 @option{-msoft-float} changes the calling convention in the output file;
18897 therefore, it is only useful if you compile @emph{all} of a program with
18898 this option. In particular, you need to compile @file{libgcc.a}, the
18899 library that comes with GCC, with @option{-msoft-float} in order for
18904 Generate the predefine, @code{_SIO}, for server IO@. The default is
18905 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
18906 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
18907 options are available under HP-UX and HI-UX@.
18911 Use options specific to GNU @command{ld}.
18912 This passes @option{-shared} to @command{ld} when
18913 building a shared library. It is the default when GCC is configured,
18914 explicitly or implicitly, with the GNU linker. This option does not
18915 affect which @command{ld} is called; it only changes what parameters
18916 are passed to that @command{ld}.
18917 The @command{ld} that is called is determined by the
18918 @option{--with-ld} configure option, GCC's program search path, and
18919 finally by the user's @env{PATH}. The linker used by GCC can be printed
18920 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
18921 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
18925 Use options specific to HP @command{ld}.
18926 This passes @option{-b} to @command{ld} when building
18927 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
18928 links. It is the default when GCC is configured, explicitly or
18929 implicitly, with the HP linker. This option does not affect
18930 which @command{ld} is called; it only changes what parameters are passed to that
18932 The @command{ld} that is called is determined by the @option{--with-ld}
18933 configure option, GCC's program search path, and finally by the user's
18934 @env{PATH}. The linker used by GCC can be printed using @samp{which
18935 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
18936 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
18939 @opindex mno-long-calls
18940 Generate code that uses long call sequences. This ensures that a call
18941 is always able to reach linker generated stubs. The default is to generate
18942 long calls only when the distance from the call site to the beginning
18943 of the function or translation unit, as the case may be, exceeds a
18944 predefined limit set by the branch type being used. The limits for
18945 normal calls are 7,600,000 and 240,000 bytes, respectively for the
18946 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
18949 Distances are measured from the beginning of functions when using the
18950 @option{-ffunction-sections} option, or when using the @option{-mgas}
18951 and @option{-mno-portable-runtime} options together under HP-UX with
18954 It is normally not desirable to use this option as it degrades
18955 performance. However, it may be useful in large applications,
18956 particularly when partial linking is used to build the application.
18958 The types of long calls used depends on the capabilities of the
18959 assembler and linker, and the type of code being generated. The
18960 impact on systems that support long absolute calls, and long pic
18961 symbol-difference or pc-relative calls should be relatively small.
18962 However, an indirect call is used on 32-bit ELF systems in pic code
18963 and it is quite long.
18965 @item -munix=@var{unix-std}
18967 Generate compiler predefines and select a startfile for the specified
18968 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
18969 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
18970 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
18971 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
18972 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
18975 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
18976 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
18977 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
18978 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
18979 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
18980 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
18982 It is @emph{important} to note that this option changes the interfaces
18983 for various library routines. It also affects the operational behavior
18984 of the C library. Thus, @emph{extreme} care is needed in using this
18987 Library code that is intended to operate with more than one UNIX
18988 standard must test, set and restore the variable @code{__xpg4_extended_mask}
18989 as appropriate. Most GNU software doesn't provide this capability.
18993 Suppress the generation of link options to search libdld.sl when the
18994 @option{-static} option is specified on HP-UX 10 and later.
18998 The HP-UX implementation of setlocale in libc has a dependency on
18999 libdld.sl. There isn't an archive version of libdld.sl. Thus,
19000 when the @option{-static} option is specified, special link options
19001 are needed to resolve this dependency.
19003 On HP-UX 10 and later, the GCC driver adds the necessary options to
19004 link with libdld.sl when the @option{-static} option is specified.
19005 This causes the resulting binary to be dynamic. On the 64-bit port,
19006 the linkers generate dynamic binaries by default in any case. The
19007 @option{-nolibdld} option can be used to prevent the GCC driver from
19008 adding these link options.
19012 Add support for multithreading with the @dfn{dce thread} library
19013 under HP-UX@. This option sets flags for both the preprocessor and
19017 @node IA-64 Options
19018 @subsection IA-64 Options
19019 @cindex IA-64 Options
19021 These are the @samp{-m} options defined for the Intel IA-64 architecture.
19025 @opindex mbig-endian
19026 Generate code for a big-endian target. This is the default for HP-UX@.
19028 @item -mlittle-endian
19029 @opindex mlittle-endian
19030 Generate code for a little-endian target. This is the default for AIX5
19036 @opindex mno-gnu-as
19037 Generate (or don't) code for the GNU assembler. This is the default.
19038 @c Also, this is the default if the configure option @option{--with-gnu-as}
19044 @opindex mno-gnu-ld
19045 Generate (or don't) code for the GNU linker. This is the default.
19046 @c Also, this is the default if the configure option @option{--with-gnu-ld}
19051 Generate code that does not use a global pointer register. The result
19052 is not position independent code, and violates the IA-64 ABI@.
19054 @item -mvolatile-asm-stop
19055 @itemx -mno-volatile-asm-stop
19056 @opindex mvolatile-asm-stop
19057 @opindex mno-volatile-asm-stop
19058 Generate (or don't) a stop bit immediately before and after volatile asm
19061 @item -mregister-names
19062 @itemx -mno-register-names
19063 @opindex mregister-names
19064 @opindex mno-register-names
19065 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
19066 the stacked registers. This may make assembler output more readable.
19072 Disable (or enable) optimizations that use the small data section. This may
19073 be useful for working around optimizer bugs.
19075 @item -mconstant-gp
19076 @opindex mconstant-gp
19077 Generate code that uses a single constant global pointer value. This is
19078 useful when compiling kernel code.
19082 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
19083 This is useful when compiling firmware code.
19085 @item -minline-float-divide-min-latency
19086 @opindex minline-float-divide-min-latency
19087 Generate code for inline divides of floating-point values
19088 using the minimum latency algorithm.
19090 @item -minline-float-divide-max-throughput
19091 @opindex minline-float-divide-max-throughput
19092 Generate code for inline divides of floating-point values
19093 using the maximum throughput algorithm.
19095 @item -mno-inline-float-divide
19096 @opindex mno-inline-float-divide
19097 Do not generate inline code for divides of floating-point values.
19099 @item -minline-int-divide-min-latency
19100 @opindex minline-int-divide-min-latency
19101 Generate code for inline divides of integer values
19102 using the minimum latency algorithm.
19104 @item -minline-int-divide-max-throughput
19105 @opindex minline-int-divide-max-throughput
19106 Generate code for inline divides of integer values
19107 using the maximum throughput algorithm.
19109 @item -mno-inline-int-divide
19110 @opindex mno-inline-int-divide
19111 Do not generate inline code for divides of integer values.
19113 @item -minline-sqrt-min-latency
19114 @opindex minline-sqrt-min-latency
19115 Generate code for inline square roots
19116 using the minimum latency algorithm.
19118 @item -minline-sqrt-max-throughput
19119 @opindex minline-sqrt-max-throughput
19120 Generate code for inline square roots
19121 using the maximum throughput algorithm.
19123 @item -mno-inline-sqrt
19124 @opindex mno-inline-sqrt
19125 Do not generate inline code for @code{sqrt}.
19128 @itemx -mno-fused-madd
19129 @opindex mfused-madd
19130 @opindex mno-fused-madd
19131 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
19132 instructions. The default is to use these instructions.
19134 @item -mno-dwarf2-asm
19135 @itemx -mdwarf2-asm
19136 @opindex mno-dwarf2-asm
19137 @opindex mdwarf2-asm
19138 Don't (or do) generate assembler code for the DWARF line number debugging
19139 info. This may be useful when not using the GNU assembler.
19141 @item -mearly-stop-bits
19142 @itemx -mno-early-stop-bits
19143 @opindex mearly-stop-bits
19144 @opindex mno-early-stop-bits
19145 Allow stop bits to be placed earlier than immediately preceding the
19146 instruction that triggered the stop bit. This can improve instruction
19147 scheduling, but does not always do so.
19149 @item -mfixed-range=@var{register-range}
19150 @opindex mfixed-range
19151 Generate code treating the given register range as fixed registers.
19152 A fixed register is one that the register allocator cannot use. This is
19153 useful when compiling kernel code. A register range is specified as
19154 two registers separated by a dash. Multiple register ranges can be
19155 specified separated by a comma.
19157 @item -mtls-size=@var{tls-size}
19159 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
19162 @item -mtune=@var{cpu-type}
19164 Tune the instruction scheduling for a particular CPU, Valid values are
19165 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
19166 and @samp{mckinley}.
19172 Generate code for a 32-bit or 64-bit environment.
19173 The 32-bit environment sets int, long and pointer to 32 bits.
19174 The 64-bit environment sets int to 32 bits and long and pointer
19175 to 64 bits. These are HP-UX specific flags.
19177 @item -mno-sched-br-data-spec
19178 @itemx -msched-br-data-spec
19179 @opindex mno-sched-br-data-spec
19180 @opindex msched-br-data-spec
19181 (Dis/En)able data speculative scheduling before reload.
19182 This results in generation of @code{ld.a} instructions and
19183 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
19184 The default setting is disabled.
19186 @item -msched-ar-data-spec
19187 @itemx -mno-sched-ar-data-spec
19188 @opindex msched-ar-data-spec
19189 @opindex mno-sched-ar-data-spec
19190 (En/Dis)able data speculative scheduling after reload.
19191 This results in generation of @code{ld.a} instructions and
19192 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
19193 The default setting is enabled.
19195 @item -mno-sched-control-spec
19196 @itemx -msched-control-spec
19197 @opindex mno-sched-control-spec
19198 @opindex msched-control-spec
19199 (Dis/En)able control speculative scheduling. This feature is
19200 available only during region scheduling (i.e.@: before reload).
19201 This results in generation of the @code{ld.s} instructions and
19202 the corresponding check instructions @code{chk.s}.
19203 The default setting is disabled.
19205 @item -msched-br-in-data-spec
19206 @itemx -mno-sched-br-in-data-spec
19207 @opindex msched-br-in-data-spec
19208 @opindex mno-sched-br-in-data-spec
19209 (En/Dis)able speculative scheduling of the instructions that
19210 are dependent on the data speculative loads before reload.
19211 This is effective only with @option{-msched-br-data-spec} enabled.
19212 The default setting is enabled.
19214 @item -msched-ar-in-data-spec
19215 @itemx -mno-sched-ar-in-data-spec
19216 @opindex msched-ar-in-data-spec
19217 @opindex mno-sched-ar-in-data-spec
19218 (En/Dis)able speculative scheduling of the instructions that
19219 are dependent on the data speculative loads after reload.
19220 This is effective only with @option{-msched-ar-data-spec} enabled.
19221 The default setting is enabled.
19223 @item -msched-in-control-spec
19224 @itemx -mno-sched-in-control-spec
19225 @opindex msched-in-control-spec
19226 @opindex mno-sched-in-control-spec
19227 (En/Dis)able speculative scheduling of the instructions that
19228 are dependent on the control speculative loads.
19229 This is effective only with @option{-msched-control-spec} enabled.
19230 The default setting is enabled.
19232 @item -mno-sched-prefer-non-data-spec-insns
19233 @itemx -msched-prefer-non-data-spec-insns
19234 @opindex mno-sched-prefer-non-data-spec-insns
19235 @opindex msched-prefer-non-data-spec-insns
19236 If enabled, data-speculative instructions are chosen for schedule
19237 only if there are no other choices at the moment. This makes
19238 the use of the data speculation much more conservative.
19239 The default setting is disabled.
19241 @item -mno-sched-prefer-non-control-spec-insns
19242 @itemx -msched-prefer-non-control-spec-insns
19243 @opindex mno-sched-prefer-non-control-spec-insns
19244 @opindex msched-prefer-non-control-spec-insns
19245 If enabled, control-speculative instructions are chosen for schedule
19246 only if there are no other choices at the moment. This makes
19247 the use of the control speculation much more conservative.
19248 The default setting is disabled.
19250 @item -mno-sched-count-spec-in-critical-path
19251 @itemx -msched-count-spec-in-critical-path
19252 @opindex mno-sched-count-spec-in-critical-path
19253 @opindex msched-count-spec-in-critical-path
19254 If enabled, speculative dependencies are considered during
19255 computation of the instructions priorities. This makes the use of the
19256 speculation a bit more conservative.
19257 The default setting is disabled.
19259 @item -msched-spec-ldc
19260 @opindex msched-spec-ldc
19261 Use a simple data speculation check. This option is on by default.
19263 @item -msched-control-spec-ldc
19264 @opindex msched-spec-ldc
19265 Use a simple check for control speculation. This option is on by default.
19267 @item -msched-stop-bits-after-every-cycle
19268 @opindex msched-stop-bits-after-every-cycle
19269 Place a stop bit after every cycle when scheduling. This option is on
19272 @item -msched-fp-mem-deps-zero-cost
19273 @opindex msched-fp-mem-deps-zero-cost
19274 Assume that floating-point stores and loads are not likely to cause a conflict
19275 when placed into the same instruction group. This option is disabled by
19278 @item -msel-sched-dont-check-control-spec
19279 @opindex msel-sched-dont-check-control-spec
19280 Generate checks for control speculation in selective scheduling.
19281 This flag is disabled by default.
19283 @item -msched-max-memory-insns=@var{max-insns}
19284 @opindex msched-max-memory-insns
19285 Limit on the number of memory insns per instruction group, giving lower
19286 priority to subsequent memory insns attempting to schedule in the same
19287 instruction group. Frequently useful to prevent cache bank conflicts.
19288 The default value is 1.
19290 @item -msched-max-memory-insns-hard-limit
19291 @opindex msched-max-memory-insns-hard-limit
19292 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
19293 disallowing more than that number in an instruction group.
19294 Otherwise, the limit is ``soft'', meaning that non-memory operations
19295 are preferred when the limit is reached, but memory operations may still
19301 @subsection LM32 Options
19302 @cindex LM32 options
19304 These @option{-m} options are defined for the LatticeMico32 architecture:
19307 @item -mbarrel-shift-enabled
19308 @opindex mbarrel-shift-enabled
19309 Enable barrel-shift instructions.
19311 @item -mdivide-enabled
19312 @opindex mdivide-enabled
19313 Enable divide and modulus instructions.
19315 @item -mmultiply-enabled
19316 @opindex multiply-enabled
19317 Enable multiply instructions.
19319 @item -msign-extend-enabled
19320 @opindex msign-extend-enabled
19321 Enable sign extend instructions.
19323 @item -muser-enabled
19324 @opindex muser-enabled
19325 Enable user-defined instructions.
19330 @subsection M32C Options
19331 @cindex M32C options
19334 @item -mcpu=@var{name}
19336 Select the CPU for which code is generated. @var{name} may be one of
19337 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
19338 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
19339 the M32C/80 series.
19343 Specifies that the program will be run on the simulator. This causes
19344 an alternate runtime library to be linked in which supports, for
19345 example, file I/O@. You must not use this option when generating
19346 programs that will run on real hardware; you must provide your own
19347 runtime library for whatever I/O functions are needed.
19349 @item -memregs=@var{number}
19351 Specifies the number of memory-based pseudo-registers GCC uses
19352 during code generation. These pseudo-registers are used like real
19353 registers, so there is a tradeoff between GCC's ability to fit the
19354 code into available registers, and the performance penalty of using
19355 memory instead of registers. Note that all modules in a program must
19356 be compiled with the same value for this option. Because of that, you
19357 must not use this option with GCC's default runtime libraries.
19361 @node M32R/D Options
19362 @subsection M32R/D Options
19363 @cindex M32R/D options
19365 These @option{-m} options are defined for Renesas M32R/D architectures:
19370 Generate code for the M32R/2@.
19374 Generate code for the M32R/X@.
19378 Generate code for the M32R@. This is the default.
19380 @item -mmodel=small
19381 @opindex mmodel=small
19382 Assume all objects live in the lower 16MB of memory (so that their addresses
19383 can be loaded with the @code{ld24} instruction), and assume all subroutines
19384 are reachable with the @code{bl} instruction.
19385 This is the default.
19387 The addressability of a particular object can be set with the
19388 @code{model} attribute.
19390 @item -mmodel=medium
19391 @opindex mmodel=medium
19392 Assume objects may be anywhere in the 32-bit address space (the compiler
19393 generates @code{seth/add3} instructions to load their addresses), and
19394 assume all subroutines are reachable with the @code{bl} instruction.
19396 @item -mmodel=large
19397 @opindex mmodel=large
19398 Assume objects may be anywhere in the 32-bit address space (the compiler
19399 generates @code{seth/add3} instructions to load their addresses), and
19400 assume subroutines may not be reachable with the @code{bl} instruction
19401 (the compiler generates the much slower @code{seth/add3/jl}
19402 instruction sequence).
19405 @opindex msdata=none
19406 Disable use of the small data area. Variables are put into
19407 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
19408 @code{section} attribute has been specified).
19409 This is the default.
19411 The small data area consists of sections @code{.sdata} and @code{.sbss}.
19412 Objects may be explicitly put in the small data area with the
19413 @code{section} attribute using one of these sections.
19415 @item -msdata=sdata
19416 @opindex msdata=sdata
19417 Put small global and static data in the small data area, but do not
19418 generate special code to reference them.
19421 @opindex msdata=use
19422 Put small global and static data in the small data area, and generate
19423 special instructions to reference them.
19427 @cindex smaller data references
19428 Put global and static objects less than or equal to @var{num} bytes
19429 into the small data or BSS sections instead of the normal data or BSS
19430 sections. The default value of @var{num} is 8.
19431 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
19432 for this option to have any effect.
19434 All modules should be compiled with the same @option{-G @var{num}} value.
19435 Compiling with different values of @var{num} may or may not work; if it
19436 doesn't the linker gives an error message---incorrect code is not
19441 Makes the M32R-specific code in the compiler display some statistics
19442 that might help in debugging programs.
19444 @item -malign-loops
19445 @opindex malign-loops
19446 Align all loops to a 32-byte boundary.
19448 @item -mno-align-loops
19449 @opindex mno-align-loops
19450 Do not enforce a 32-byte alignment for loops. This is the default.
19452 @item -missue-rate=@var{number}
19453 @opindex missue-rate=@var{number}
19454 Issue @var{number} instructions per cycle. @var{number} can only be 1
19457 @item -mbranch-cost=@var{number}
19458 @opindex mbranch-cost=@var{number}
19459 @var{number} can only be 1 or 2. If it is 1 then branches are
19460 preferred over conditional code, if it is 2, then the opposite applies.
19462 @item -mflush-trap=@var{number}
19463 @opindex mflush-trap=@var{number}
19464 Specifies the trap number to use to flush the cache. The default is
19465 12. Valid numbers are between 0 and 15 inclusive.
19467 @item -mno-flush-trap
19468 @opindex mno-flush-trap
19469 Specifies that the cache cannot be flushed by using a trap.
19471 @item -mflush-func=@var{name}
19472 @opindex mflush-func=@var{name}
19473 Specifies the name of the operating system function to call to flush
19474 the cache. The default is @samp{_flush_cache}, but a function call
19475 is only used if a trap is not available.
19477 @item -mno-flush-func
19478 @opindex mno-flush-func
19479 Indicates that there is no OS function for flushing the cache.
19483 @node M680x0 Options
19484 @subsection M680x0 Options
19485 @cindex M680x0 options
19487 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
19488 The default settings depend on which architecture was selected when
19489 the compiler was configured; the defaults for the most common choices
19493 @item -march=@var{arch}
19495 Generate code for a specific M680x0 or ColdFire instruction set
19496 architecture. Permissible values of @var{arch} for M680x0
19497 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
19498 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
19499 architectures are selected according to Freescale's ISA classification
19500 and the permissible values are: @samp{isaa}, @samp{isaaplus},
19501 @samp{isab} and @samp{isac}.
19503 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
19504 code for a ColdFire target. The @var{arch} in this macro is one of the
19505 @option{-march} arguments given above.
19507 When used together, @option{-march} and @option{-mtune} select code
19508 that runs on a family of similar processors but that is optimized
19509 for a particular microarchitecture.
19511 @item -mcpu=@var{cpu}
19513 Generate code for a specific M680x0 or ColdFire processor.
19514 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
19515 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
19516 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
19517 below, which also classifies the CPUs into families:
19519 @multitable @columnfractions 0.20 0.80
19520 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
19521 @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}
19522 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
19523 @item @samp{5206e} @tab @samp{5206e}
19524 @item @samp{5208} @tab @samp{5207} @samp{5208}
19525 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
19526 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
19527 @item @samp{5216} @tab @samp{5214} @samp{5216}
19528 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
19529 @item @samp{5225} @tab @samp{5224} @samp{5225}
19530 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
19531 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
19532 @item @samp{5249} @tab @samp{5249}
19533 @item @samp{5250} @tab @samp{5250}
19534 @item @samp{5271} @tab @samp{5270} @samp{5271}
19535 @item @samp{5272} @tab @samp{5272}
19536 @item @samp{5275} @tab @samp{5274} @samp{5275}
19537 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
19538 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
19539 @item @samp{5307} @tab @samp{5307}
19540 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
19541 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
19542 @item @samp{5407} @tab @samp{5407}
19543 @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}
19546 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
19547 @var{arch} is compatible with @var{cpu}. Other combinations of
19548 @option{-mcpu} and @option{-march} are rejected.
19550 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
19551 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
19552 where the value of @var{family} is given by the table above.
19554 @item -mtune=@var{tune}
19556 Tune the code for a particular microarchitecture within the
19557 constraints set by @option{-march} and @option{-mcpu}.
19558 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
19559 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
19560 and @samp{cpu32}. The ColdFire microarchitectures
19561 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
19563 You can also use @option{-mtune=68020-40} for code that needs
19564 to run relatively well on 68020, 68030 and 68040 targets.
19565 @option{-mtune=68020-60} is similar but includes 68060 targets
19566 as well. These two options select the same tuning decisions as
19567 @option{-m68020-40} and @option{-m68020-60} respectively.
19569 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
19570 when tuning for 680x0 architecture @var{arch}. It also defines
19571 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
19572 option is used. If GCC is tuning for a range of architectures,
19573 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
19574 it defines the macros for every architecture in the range.
19576 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
19577 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
19578 of the arguments given above.
19584 Generate output for a 68000. This is the default
19585 when the compiler is configured for 68000-based systems.
19586 It is equivalent to @option{-march=68000}.
19588 Use this option for microcontrollers with a 68000 or EC000 core,
19589 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
19593 Generate output for a 68010. This is the default
19594 when the compiler is configured for 68010-based systems.
19595 It is equivalent to @option{-march=68010}.
19601 Generate output for a 68020. This is the default
19602 when the compiler is configured for 68020-based systems.
19603 It is equivalent to @option{-march=68020}.
19607 Generate output for a 68030. This is the default when the compiler is
19608 configured for 68030-based systems. It is equivalent to
19609 @option{-march=68030}.
19613 Generate output for a 68040. This is the default when the compiler is
19614 configured for 68040-based systems. It is equivalent to
19615 @option{-march=68040}.
19617 This option inhibits the use of 68881/68882 instructions that have to be
19618 emulated by software on the 68040. Use this option if your 68040 does not
19619 have code to emulate those instructions.
19623 Generate output for a 68060. This is the default when the compiler is
19624 configured for 68060-based systems. It is equivalent to
19625 @option{-march=68060}.
19627 This option inhibits the use of 68020 and 68881/68882 instructions that
19628 have to be emulated by software on the 68060. Use this option if your 68060
19629 does not have code to emulate those instructions.
19633 Generate output for a CPU32. This is the default
19634 when the compiler is configured for CPU32-based systems.
19635 It is equivalent to @option{-march=cpu32}.
19637 Use this option for microcontrollers with a
19638 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
19639 68336, 68340, 68341, 68349 and 68360.
19643 Generate output for a 520X ColdFire CPU@. This is the default
19644 when the compiler is configured for 520X-based systems.
19645 It is equivalent to @option{-mcpu=5206}, and is now deprecated
19646 in favor of that option.
19648 Use this option for microcontroller with a 5200 core, including
19649 the MCF5202, MCF5203, MCF5204 and MCF5206.
19653 Generate output for a 5206e ColdFire CPU@. The option is now
19654 deprecated in favor of the equivalent @option{-mcpu=5206e}.
19658 Generate output for a member of the ColdFire 528X family.
19659 The option is now deprecated in favor of the equivalent
19660 @option{-mcpu=528x}.
19664 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
19665 in favor of the equivalent @option{-mcpu=5307}.
19669 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
19670 in favor of the equivalent @option{-mcpu=5407}.
19674 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
19675 This includes use of hardware floating-point instructions.
19676 The option is equivalent to @option{-mcpu=547x}, and is now
19677 deprecated in favor of that option.
19681 Generate output for a 68040, without using any of the new instructions.
19682 This results in code that can run relatively efficiently on either a
19683 68020/68881 or a 68030 or a 68040. The generated code does use the
19684 68881 instructions that are emulated on the 68040.
19686 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
19690 Generate output for a 68060, without using any of the new instructions.
19691 This results in code that can run relatively efficiently on either a
19692 68020/68881 or a 68030 or a 68040. The generated code does use the
19693 68881 instructions that are emulated on the 68060.
19695 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
19699 @opindex mhard-float
19701 Generate floating-point instructions. This is the default for 68020
19702 and above, and for ColdFire devices that have an FPU@. It defines the
19703 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
19704 on ColdFire targets.
19707 @opindex msoft-float
19708 Do not generate floating-point instructions; use library calls instead.
19709 This is the default for 68000, 68010, and 68832 targets. It is also
19710 the default for ColdFire devices that have no FPU.
19716 Generate (do not generate) ColdFire hardware divide and remainder
19717 instructions. If @option{-march} is used without @option{-mcpu},
19718 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
19719 architectures. Otherwise, the default is taken from the target CPU
19720 (either the default CPU, or the one specified by @option{-mcpu}). For
19721 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
19722 @option{-mcpu=5206e}.
19724 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
19728 Consider type @code{int} to be 16 bits wide, like @code{short int}.
19729 Additionally, parameters passed on the stack are also aligned to a
19730 16-bit boundary even on targets whose API mandates promotion to 32-bit.
19734 Do not consider type @code{int} to be 16 bits wide. This is the default.
19737 @itemx -mno-bitfield
19738 @opindex mnobitfield
19739 @opindex mno-bitfield
19740 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
19741 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
19745 Do use the bit-field instructions. The @option{-m68020} option implies
19746 @option{-mbitfield}. This is the default if you use a configuration
19747 designed for a 68020.
19751 Use a different function-calling convention, in which functions
19752 that take a fixed number of arguments return with the @code{rtd}
19753 instruction, which pops their arguments while returning. This
19754 saves one instruction in the caller since there is no need to pop
19755 the arguments there.
19757 This calling convention is incompatible with the one normally
19758 used on Unix, so you cannot use it if you need to call libraries
19759 compiled with the Unix compiler.
19761 Also, you must provide function prototypes for all functions that
19762 take variable numbers of arguments (including @code{printf});
19763 otherwise incorrect code is generated for calls to those
19766 In addition, seriously incorrect code results if you call a
19767 function with too many arguments. (Normally, extra arguments are
19768 harmlessly ignored.)
19770 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
19771 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
19775 Do not use the calling conventions selected by @option{-mrtd}.
19776 This is the default.
19779 @itemx -mno-align-int
19780 @opindex malign-int
19781 @opindex mno-align-int
19782 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
19783 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
19784 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
19785 Aligning variables on 32-bit boundaries produces code that runs somewhat
19786 faster on processors with 32-bit busses at the expense of more memory.
19788 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
19789 aligns structures containing the above types differently than
19790 most published application binary interface specifications for the m68k.
19794 Use the pc-relative addressing mode of the 68000 directly, instead of
19795 using a global offset table. At present, this option implies @option{-fpic},
19796 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
19797 not presently supported with @option{-mpcrel}, though this could be supported for
19798 68020 and higher processors.
19800 @item -mno-strict-align
19801 @itemx -mstrict-align
19802 @opindex mno-strict-align
19803 @opindex mstrict-align
19804 Do not (do) assume that unaligned memory references are handled by
19808 Generate code that allows the data segment to be located in a different
19809 area of memory from the text segment. This allows for execute-in-place in
19810 an environment without virtual memory management. This option implies
19813 @item -mno-sep-data
19814 Generate code that assumes that the data segment follows the text segment.
19815 This is the default.
19817 @item -mid-shared-library
19818 Generate code that supports shared libraries via the library ID method.
19819 This allows for execute-in-place and shared libraries in an environment
19820 without virtual memory management. This option implies @option{-fPIC}.
19822 @item -mno-id-shared-library
19823 Generate code that doesn't assume ID-based shared libraries are being used.
19824 This is the default.
19826 @item -mshared-library-id=n
19827 Specifies the identification number of the ID-based shared library being
19828 compiled. Specifying a value of 0 generates more compact code; specifying
19829 other values forces the allocation of that number to the current
19830 library, but is no more space- or time-efficient than omitting this option.
19836 When generating position-independent code for ColdFire, generate code
19837 that works if the GOT has more than 8192 entries. This code is
19838 larger and slower than code generated without this option. On M680x0
19839 processors, this option is not needed; @option{-fPIC} suffices.
19841 GCC normally uses a single instruction to load values from the GOT@.
19842 While this is relatively efficient, it only works if the GOT
19843 is smaller than about 64k. Anything larger causes the linker
19844 to report an error such as:
19846 @cindex relocation truncated to fit (ColdFire)
19848 relocation truncated to fit: R_68K_GOT16O foobar
19851 If this happens, you should recompile your code with @option{-mxgot}.
19852 It should then work with very large GOTs. However, code generated with
19853 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
19854 the value of a global symbol.
19856 Note that some linkers, including newer versions of the GNU linker,
19857 can create multiple GOTs and sort GOT entries. If you have such a linker,
19858 you should only need to use @option{-mxgot} when compiling a single
19859 object file that accesses more than 8192 GOT entries. Very few do.
19861 These options have no effect unless GCC is generating
19862 position-independent code.
19864 @item -mlong-jump-table-offsets
19865 @opindex mlong-jump-table-offsets
19866 Use 32-bit offsets in @code{switch} tables. The default is to use
19871 @node MCore Options
19872 @subsection MCore Options
19873 @cindex MCore options
19875 These are the @samp{-m} options defined for the Motorola M*Core
19881 @itemx -mno-hardlit
19883 @opindex mno-hardlit
19884 Inline constants into the code stream if it can be done in two
19885 instructions or less.
19891 Use the divide instruction. (Enabled by default).
19893 @item -mrelax-immediate
19894 @itemx -mno-relax-immediate
19895 @opindex mrelax-immediate
19896 @opindex mno-relax-immediate
19897 Allow arbitrary-sized immediates in bit operations.
19899 @item -mwide-bitfields
19900 @itemx -mno-wide-bitfields
19901 @opindex mwide-bitfields
19902 @opindex mno-wide-bitfields
19903 Always treat bit-fields as @code{int}-sized.
19905 @item -m4byte-functions
19906 @itemx -mno-4byte-functions
19907 @opindex m4byte-functions
19908 @opindex mno-4byte-functions
19909 Force all functions to be aligned to a 4-byte boundary.
19911 @item -mcallgraph-data
19912 @itemx -mno-callgraph-data
19913 @opindex mcallgraph-data
19914 @opindex mno-callgraph-data
19915 Emit callgraph information.
19918 @itemx -mno-slow-bytes
19919 @opindex mslow-bytes
19920 @opindex mno-slow-bytes
19921 Prefer word access when reading byte quantities.
19923 @item -mlittle-endian
19924 @itemx -mbig-endian
19925 @opindex mlittle-endian
19926 @opindex mbig-endian
19927 Generate code for a little-endian target.
19933 Generate code for the 210 processor.
19937 Assume that runtime support has been provided and so omit the
19938 simulator library (@file{libsim.a)} from the linker command line.
19940 @item -mstack-increment=@var{size}
19941 @opindex mstack-increment
19942 Set the maximum amount for a single stack increment operation. Large
19943 values can increase the speed of programs that contain functions
19944 that need a large amount of stack space, but they can also trigger a
19945 segmentation fault if the stack is extended too much. The default
19951 @subsection MeP Options
19952 @cindex MeP options
19958 Enables the @code{abs} instruction, which is the absolute difference
19959 between two registers.
19963 Enables all the optional instructions---average, multiply, divide, bit
19964 operations, leading zero, absolute difference, min/max, clip, and
19970 Enables the @code{ave} instruction, which computes the average of two
19973 @item -mbased=@var{n}
19975 Variables of size @var{n} bytes or smaller are placed in the
19976 @code{.based} section by default. Based variables use the @code{$tp}
19977 register as a base register, and there is a 128-byte limit to the
19978 @code{.based} section.
19982 Enables the bit operation instructions---bit test (@code{btstm}), set
19983 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
19984 test-and-set (@code{tas}).
19986 @item -mc=@var{name}
19988 Selects which section constant data is placed in. @var{name} may
19989 be @samp{tiny}, @samp{near}, or @samp{far}.
19993 Enables the @code{clip} instruction. Note that @option{-mclip} is not
19994 useful unless you also provide @option{-mminmax}.
19996 @item -mconfig=@var{name}
19998 Selects one of the built-in core configurations. Each MeP chip has
19999 one or more modules in it; each module has a core CPU and a variety of
20000 coprocessors, optional instructions, and peripherals. The
20001 @code{MeP-Integrator} tool, not part of GCC, provides these
20002 configurations through this option; using this option is the same as
20003 using all the corresponding command-line options. The default
20004 configuration is @samp{default}.
20008 Enables the coprocessor instructions. By default, this is a 32-bit
20009 coprocessor. Note that the coprocessor is normally enabled via the
20010 @option{-mconfig=} option.
20014 Enables the 32-bit coprocessor's instructions.
20018 Enables the 64-bit coprocessor's instructions.
20022 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
20026 Causes constant variables to be placed in the @code{.near} section.
20030 Enables the @code{div} and @code{divu} instructions.
20034 Generate big-endian code.
20038 Generate little-endian code.
20040 @item -mio-volatile
20041 @opindex mio-volatile
20042 Tells the compiler that any variable marked with the @code{io}
20043 attribute is to be considered volatile.
20047 Causes variables to be assigned to the @code{.far} section by default.
20051 Enables the @code{leadz} (leading zero) instruction.
20055 Causes variables to be assigned to the @code{.near} section by default.
20059 Enables the @code{min} and @code{max} instructions.
20063 Enables the multiplication and multiply-accumulate instructions.
20067 Disables all the optional instructions enabled by @option{-mall-opts}.
20071 Enables the @code{repeat} and @code{erepeat} instructions, used for
20072 low-overhead looping.
20076 Causes all variables to default to the @code{.tiny} section. Note
20077 that there is a 65536-byte limit to this section. Accesses to these
20078 variables use the @code{%gp} base register.
20082 Enables the saturation instructions. Note that the compiler does not
20083 currently generate these itself, but this option is included for
20084 compatibility with other tools, like @code{as}.
20088 Link the SDRAM-based runtime instead of the default ROM-based runtime.
20092 Link the simulator run-time libraries.
20096 Link the simulator runtime libraries, excluding built-in support
20097 for reset and exception vectors and tables.
20101 Causes all functions to default to the @code{.far} section. Without
20102 this option, functions default to the @code{.near} section.
20104 @item -mtiny=@var{n}
20106 Variables that are @var{n} bytes or smaller are allocated to the
20107 @code{.tiny} section. These variables use the @code{$gp} base
20108 register. The default for this option is 4, but note that there's a
20109 65536-byte limit to the @code{.tiny} section.
20113 @node MicroBlaze Options
20114 @subsection MicroBlaze Options
20115 @cindex MicroBlaze Options
20120 @opindex msoft-float
20121 Use software emulation for floating point (default).
20124 @opindex mhard-float
20125 Use hardware floating-point instructions.
20129 Do not optimize block moves, use @code{memcpy}.
20131 @item -mno-clearbss
20132 @opindex mno-clearbss
20133 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
20135 @item -mcpu=@var{cpu-type}
20137 Use features of, and schedule code for, the given CPU.
20138 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
20139 where @var{X} is a major version, @var{YY} is the minor version, and
20140 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
20141 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
20143 @item -mxl-soft-mul
20144 @opindex mxl-soft-mul
20145 Use software multiply emulation (default).
20147 @item -mxl-soft-div
20148 @opindex mxl-soft-div
20149 Use software emulation for divides (default).
20151 @item -mxl-barrel-shift
20152 @opindex mxl-barrel-shift
20153 Use the hardware barrel shifter.
20155 @item -mxl-pattern-compare
20156 @opindex mxl-pattern-compare
20157 Use pattern compare instructions.
20159 @item -msmall-divides
20160 @opindex msmall-divides
20161 Use table lookup optimization for small signed integer divisions.
20163 @item -mxl-stack-check
20164 @opindex mxl-stack-check
20165 This option is deprecated. Use @option{-fstack-check} instead.
20168 @opindex mxl-gp-opt
20169 Use GP-relative @code{.sdata}/@code{.sbss} sections.
20171 @item -mxl-multiply-high
20172 @opindex mxl-multiply-high
20173 Use multiply high instructions for high part of 32x32 multiply.
20175 @item -mxl-float-convert
20176 @opindex mxl-float-convert
20177 Use hardware floating-point conversion instructions.
20179 @item -mxl-float-sqrt
20180 @opindex mxl-float-sqrt
20181 Use hardware floating-point square root instruction.
20184 @opindex mbig-endian
20185 Generate code for a big-endian target.
20187 @item -mlittle-endian
20188 @opindex mlittle-endian
20189 Generate code for a little-endian target.
20192 @opindex mxl-reorder
20193 Use reorder instructions (swap and byte reversed load/store).
20195 @item -mxl-mode-@var{app-model}
20196 Select application model @var{app-model}. Valid models are
20199 normal executable (default), uses startup code @file{crt0.o}.
20201 @item -mpic-data-is-text-relative
20202 @opindex mpic-data-is-text-relative
20203 Assume that the displacement between the text and data segments is fixed
20204 at static link time. This allows data to be referenced by offset from start of
20205 text address instead of GOT since PC-relative addressing is not supported.
20208 for use with Xilinx Microprocessor Debugger (XMD) based
20209 software intrusive debug agent called xmdstub. This uses startup file
20210 @file{crt1.o} and sets the start address of the program to 0x800.
20213 for applications that are loaded using a bootloader.
20214 This model uses startup file @file{crt2.o} which does not contain a processor
20215 reset vector handler. This is suitable for transferring control on a
20216 processor reset to the bootloader rather than the application.
20219 for applications that do not require any of the
20220 MicroBlaze vectors. This option may be useful for applications running
20221 within a monitoring application. This model uses @file{crt3.o} as a startup file.
20224 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
20225 @option{-mxl-mode-@var{app-model}}.
20230 @subsection MIPS Options
20231 @cindex MIPS options
20237 Generate big-endian code.
20241 Generate little-endian code. This is the default for @samp{mips*el-*-*}
20244 @item -march=@var{arch}
20246 Generate code that runs on @var{arch}, which can be the name of a
20247 generic MIPS ISA, or the name of a particular processor.
20249 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
20250 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
20251 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
20252 @samp{mips64r5} and @samp{mips64r6}.
20253 The processor names are:
20254 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
20255 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
20256 @samp{5kc}, @samp{5kf},
20258 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
20259 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
20260 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
20261 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
20262 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
20263 @samp{i6400}, @samp{i6500},
20265 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
20267 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
20268 @samp{m5100}, @samp{m5101},
20269 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
20271 @samp{p5600}, @samp{p6600},
20272 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
20273 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
20274 @samp{rm7000}, @samp{rm9000},
20275 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
20278 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
20279 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
20280 @samp{xlr} and @samp{xlp}.
20281 The special value @samp{from-abi} selects the
20282 most compatible architecture for the selected ABI (that is,
20283 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
20285 The native Linux/GNU toolchain also supports the value @samp{native},
20286 which selects the best architecture option for the host processor.
20287 @option{-march=native} has no effect if GCC does not recognize
20290 In processor names, a final @samp{000} can be abbreviated as @samp{k}
20291 (for example, @option{-march=r2k}). Prefixes are optional, and
20292 @samp{vr} may be written @samp{r}.
20294 Names of the form @samp{@var{n}f2_1} refer to processors with
20295 FPUs clocked at half the rate of the core, names of the form
20296 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
20297 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
20298 processors with FPUs clocked a ratio of 3:2 with respect to the core.
20299 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
20300 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
20301 accepted as synonyms for @samp{@var{n}f1_1}.
20303 GCC defines two macros based on the value of this option. The first
20304 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
20305 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
20306 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
20307 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
20308 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
20310 Note that the @code{_MIPS_ARCH} macro uses the processor names given
20311 above. In other words, it has the full prefix and does not
20312 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
20313 the macro names the resolved architecture (either @code{"mips1"} or
20314 @code{"mips3"}). It names the default architecture when no
20315 @option{-march} option is given.
20317 @item -mtune=@var{arch}
20319 Optimize for @var{arch}. Among other things, this option controls
20320 the way instructions are scheduled, and the perceived cost of arithmetic
20321 operations. The list of @var{arch} values is the same as for
20324 When this option is not used, GCC optimizes for the processor
20325 specified by @option{-march}. By using @option{-march} and
20326 @option{-mtune} together, it is possible to generate code that
20327 runs on a family of processors, but optimize the code for one
20328 particular member of that family.
20330 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
20331 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
20332 @option{-march} ones described above.
20336 Equivalent to @option{-march=mips1}.
20340 Equivalent to @option{-march=mips2}.
20344 Equivalent to @option{-march=mips3}.
20348 Equivalent to @option{-march=mips4}.
20352 Equivalent to @option{-march=mips32}.
20356 Equivalent to @option{-march=mips32r3}.
20360 Equivalent to @option{-march=mips32r5}.
20364 Equivalent to @option{-march=mips32r6}.
20368 Equivalent to @option{-march=mips64}.
20372 Equivalent to @option{-march=mips64r2}.
20376 Equivalent to @option{-march=mips64r3}.
20380 Equivalent to @option{-march=mips64r5}.
20384 Equivalent to @option{-march=mips64r6}.
20389 @opindex mno-mips16
20390 Generate (do not generate) MIPS16 code. If GCC is targeting a
20391 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
20393 MIPS16 code generation can also be controlled on a per-function basis
20394 by means of @code{mips16} and @code{nomips16} attributes.
20395 @xref{Function Attributes}, for more information.
20397 @item -mflip-mips16
20398 @opindex mflip-mips16
20399 Generate MIPS16 code on alternating functions. This option is provided
20400 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
20401 not intended for ordinary use in compiling user code.
20403 @item -minterlink-compressed
20404 @itemx -mno-interlink-compressed
20405 @opindex minterlink-compressed
20406 @opindex mno-interlink-compressed
20407 Require (do not require) that code using the standard (uncompressed) MIPS ISA
20408 be link-compatible with MIPS16 and microMIPS code, and vice versa.
20410 For example, code using the standard ISA encoding cannot jump directly
20411 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
20412 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
20413 knows that the target of the jump is not compressed.
20415 @item -minterlink-mips16
20416 @itemx -mno-interlink-mips16
20417 @opindex minterlink-mips16
20418 @opindex mno-interlink-mips16
20419 Aliases of @option{-minterlink-compressed} and
20420 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
20421 and are retained for backwards compatibility.
20433 Generate code for the given ABI@.
20435 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
20436 generates 64-bit code when you select a 64-bit architecture, but you
20437 can use @option{-mgp32} to get 32-bit code instead.
20439 For information about the O64 ABI, see
20440 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
20442 GCC supports a variant of the o32 ABI in which floating-point registers
20443 are 64 rather than 32 bits wide. You can select this combination with
20444 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
20445 and @code{mfhc1} instructions and is therefore only supported for
20446 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
20448 The register assignments for arguments and return values remain the
20449 same, but each scalar value is passed in a single 64-bit register
20450 rather than a pair of 32-bit registers. For example, scalar
20451 floating-point values are returned in @samp{$f0} only, not a
20452 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
20453 remains the same in that the even-numbered double-precision registers
20456 Two additional variants of the o32 ABI are supported to enable
20457 a transition from 32-bit to 64-bit registers. These are FPXX
20458 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
20459 The FPXX extension mandates that all code must execute correctly
20460 when run using 32-bit or 64-bit registers. The code can be interlinked
20461 with either FP32 or FP64, but not both.
20462 The FP64A extension is similar to the FP64 extension but forbids the
20463 use of odd-numbered single-precision registers. This can be used
20464 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
20465 processors and allows both FP32 and FP64A code to interlink and
20466 run in the same process without changing FPU modes.
20469 @itemx -mno-abicalls
20471 @opindex mno-abicalls
20472 Generate (do not generate) code that is suitable for SVR4-style
20473 dynamic objects. @option{-mabicalls} is the default for SVR4-based
20478 Generate (do not generate) code that is fully position-independent,
20479 and that can therefore be linked into shared libraries. This option
20480 only affects @option{-mabicalls}.
20482 All @option{-mabicalls} code has traditionally been position-independent,
20483 regardless of options like @option{-fPIC} and @option{-fpic}. However,
20484 as an extension, the GNU toolchain allows executables to use absolute
20485 accesses for locally-binding symbols. It can also use shorter GP
20486 initialization sequences and generate direct calls to locally-defined
20487 functions. This mode is selected by @option{-mno-shared}.
20489 @option{-mno-shared} depends on binutils 2.16 or higher and generates
20490 objects that can only be linked by the GNU linker. However, the option
20491 does not affect the ABI of the final executable; it only affects the ABI
20492 of relocatable objects. Using @option{-mno-shared} generally makes
20493 executables both smaller and quicker.
20495 @option{-mshared} is the default.
20501 Assume (do not assume) that the static and dynamic linkers
20502 support PLTs and copy relocations. This option only affects
20503 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
20504 has no effect without @option{-msym32}.
20506 You can make @option{-mplt} the default by configuring
20507 GCC with @option{--with-mips-plt}. The default is
20508 @option{-mno-plt} otherwise.
20514 Lift (do not lift) the usual restrictions on the size of the global
20517 GCC normally uses a single instruction to load values from the GOT@.
20518 While this is relatively efficient, it only works if the GOT
20519 is smaller than about 64k. Anything larger causes the linker
20520 to report an error such as:
20522 @cindex relocation truncated to fit (MIPS)
20524 relocation truncated to fit: R_MIPS_GOT16 foobar
20527 If this happens, you should recompile your code with @option{-mxgot}.
20528 This works with very large GOTs, although the code is also
20529 less efficient, since it takes three instructions to fetch the
20530 value of a global symbol.
20532 Note that some linkers can create multiple GOTs. If you have such a
20533 linker, you should only need to use @option{-mxgot} when a single object
20534 file accesses more than 64k's worth of GOT entries. Very few do.
20536 These options have no effect unless GCC is generating position
20541 Assume that general-purpose registers are 32 bits wide.
20545 Assume that general-purpose registers are 64 bits wide.
20549 Assume that floating-point registers are 32 bits wide.
20553 Assume that floating-point registers are 64 bits wide.
20557 Do not assume the width of floating-point registers.
20560 @opindex mhard-float
20561 Use floating-point coprocessor instructions.
20564 @opindex msoft-float
20565 Do not use floating-point coprocessor instructions. Implement
20566 floating-point calculations using library calls instead.
20570 Equivalent to @option{-msoft-float}, but additionally asserts that the
20571 program being compiled does not perform any floating-point operations.
20572 This option is presently supported only by some bare-metal MIPS
20573 configurations, where it may select a special set of libraries
20574 that lack all floating-point support (including, for example, the
20575 floating-point @code{printf} formats).
20576 If code compiled with @option{-mno-float} accidentally contains
20577 floating-point operations, it is likely to suffer a link-time
20578 or run-time failure.
20580 @item -msingle-float
20581 @opindex msingle-float
20582 Assume that the floating-point coprocessor only supports single-precision
20585 @item -mdouble-float
20586 @opindex mdouble-float
20587 Assume that the floating-point coprocessor supports double-precision
20588 operations. This is the default.
20591 @itemx -mno-odd-spreg
20592 @opindex modd-spreg
20593 @opindex mno-odd-spreg
20594 Enable the use of odd-numbered single-precision floating-point registers
20595 for the o32 ABI. This is the default for processors that are known to
20596 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
20600 @itemx -mabs=legacy
20602 @opindex mabs=legacy
20603 These options control the treatment of the special not-a-number (NaN)
20604 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
20605 @code{neg.@i{fmt}} machine instructions.
20607 By default or when @option{-mabs=legacy} is used the legacy
20608 treatment is selected. In this case these instructions are considered
20609 arithmetic and avoided where correct operation is required and the
20610 input operand might be a NaN. A longer sequence of instructions that
20611 manipulate the sign bit of floating-point datum manually is used
20612 instead unless the @option{-ffinite-math-only} option has also been
20615 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
20616 this case these instructions are considered non-arithmetic and therefore
20617 operating correctly in all cases, including in particular where the
20618 input operand is a NaN. These instructions are therefore always used
20619 for the respective operations.
20622 @itemx -mnan=legacy
20624 @opindex mnan=legacy
20625 These options control the encoding of the special not-a-number (NaN)
20626 IEEE 754 floating-point data.
20628 The @option{-mnan=legacy} option selects the legacy encoding. In this
20629 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
20630 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
20631 by the first bit of their trailing significand field being 1.
20633 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
20634 this case qNaNs are denoted by the first bit of their trailing
20635 significand field being 1, whereas sNaNs are denoted by the first bit of
20636 their trailing significand field being 0.
20638 The default is @option{-mnan=legacy} unless GCC has been configured with
20639 @option{--with-nan=2008}.
20645 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
20646 implement atomic memory built-in functions. When neither option is
20647 specified, GCC uses the instructions if the target architecture
20650 @option{-mllsc} is useful if the runtime environment can emulate the
20651 instructions and @option{-mno-llsc} can be useful when compiling for
20652 nonstandard ISAs. You can make either option the default by
20653 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
20654 respectively. @option{--with-llsc} is the default for some
20655 configurations; see the installation documentation for details.
20661 Use (do not use) revision 1 of the MIPS DSP ASE@.
20662 @xref{MIPS DSP Built-in Functions}. This option defines the
20663 preprocessor macro @code{__mips_dsp}. It also defines
20664 @code{__mips_dsp_rev} to 1.
20670 Use (do not use) revision 2 of the MIPS DSP ASE@.
20671 @xref{MIPS DSP Built-in Functions}. This option defines the
20672 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
20673 It also defines @code{__mips_dsp_rev} to 2.
20676 @itemx -mno-smartmips
20677 @opindex msmartmips
20678 @opindex mno-smartmips
20679 Use (do not use) the MIPS SmartMIPS ASE.
20681 @item -mpaired-single
20682 @itemx -mno-paired-single
20683 @opindex mpaired-single
20684 @opindex mno-paired-single
20685 Use (do not use) paired-single floating-point instructions.
20686 @xref{MIPS Paired-Single Support}. This option requires
20687 hardware floating-point support to be enabled.
20693 Use (do not use) MIPS Digital Media Extension instructions.
20694 This option can only be used when generating 64-bit code and requires
20695 hardware floating-point support to be enabled.
20700 @opindex mno-mips3d
20701 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
20702 The option @option{-mips3d} implies @option{-mpaired-single}.
20705 @itemx -mno-micromips
20706 @opindex mmicromips
20707 @opindex mno-mmicromips
20708 Generate (do not generate) microMIPS code.
20710 MicroMIPS code generation can also be controlled on a per-function basis
20711 by means of @code{micromips} and @code{nomicromips} attributes.
20712 @xref{Function Attributes}, for more information.
20718 Use (do not use) MT Multithreading instructions.
20724 Use (do not use) the MIPS MCU ASE instructions.
20730 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
20736 Use (do not use) the MIPS Virtualization (VZ) instructions.
20742 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
20748 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
20754 Use (do not use) the MIPS Global INValidate (GINV) instructions.
20758 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
20759 an explanation of the default and the way that the pointer size is
20764 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
20766 The default size of @code{int}s, @code{long}s and pointers depends on
20767 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
20768 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
20769 32-bit @code{long}s. Pointers are the same size as @code{long}s,
20770 or the same size as integer registers, whichever is smaller.
20776 Assume (do not assume) that all symbols have 32-bit values, regardless
20777 of the selected ABI@. This option is useful in combination with
20778 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
20779 to generate shorter and faster references to symbolic addresses.
20783 Put definitions of externally-visible data in a small data section
20784 if that data is no bigger than @var{num} bytes. GCC can then generate
20785 more efficient accesses to the data; see @option{-mgpopt} for details.
20787 The default @option{-G} option depends on the configuration.
20789 @item -mlocal-sdata
20790 @itemx -mno-local-sdata
20791 @opindex mlocal-sdata
20792 @opindex mno-local-sdata
20793 Extend (do not extend) the @option{-G} behavior to local data too,
20794 such as to static variables in C@. @option{-mlocal-sdata} is the
20795 default for all configurations.
20797 If the linker complains that an application is using too much small data,
20798 you might want to try rebuilding the less performance-critical parts with
20799 @option{-mno-local-sdata}. You might also want to build large
20800 libraries with @option{-mno-local-sdata}, so that the libraries leave
20801 more room for the main program.
20803 @item -mextern-sdata
20804 @itemx -mno-extern-sdata
20805 @opindex mextern-sdata
20806 @opindex mno-extern-sdata
20807 Assume (do not assume) that externally-defined data is in
20808 a small data section if the size of that data is within the @option{-G} limit.
20809 @option{-mextern-sdata} is the default for all configurations.
20811 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
20812 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
20813 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
20814 is placed in a small data section. If @var{Var} is defined by another
20815 module, you must either compile that module with a high-enough
20816 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
20817 definition. If @var{Var} is common, you must link the application
20818 with a high-enough @option{-G} setting.
20820 The easiest way of satisfying these restrictions is to compile
20821 and link every module with the same @option{-G} option. However,
20822 you may wish to build a library that supports several different
20823 small data limits. You can do this by compiling the library with
20824 the highest supported @option{-G} setting and additionally using
20825 @option{-mno-extern-sdata} to stop the library from making assumptions
20826 about externally-defined data.
20832 Use (do not use) GP-relative accesses for symbols that are known to be
20833 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
20834 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
20837 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
20838 might not hold the value of @code{_gp}. For example, if the code is
20839 part of a library that might be used in a boot monitor, programs that
20840 call boot monitor routines pass an unknown value in @code{$gp}.
20841 (In such situations, the boot monitor itself is usually compiled
20842 with @option{-G0}.)
20844 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
20845 @option{-mno-extern-sdata}.
20847 @item -membedded-data
20848 @itemx -mno-embedded-data
20849 @opindex membedded-data
20850 @opindex mno-embedded-data
20851 Allocate variables to the read-only data section first if possible, then
20852 next in the small data section if possible, otherwise in data. This gives
20853 slightly slower code than the default, but reduces the amount of RAM required
20854 when executing, and thus may be preferred for some embedded systems.
20856 @item -muninit-const-in-rodata
20857 @itemx -mno-uninit-const-in-rodata
20858 @opindex muninit-const-in-rodata
20859 @opindex mno-uninit-const-in-rodata
20860 Put uninitialized @code{const} variables in the read-only data section.
20861 This option is only meaningful in conjunction with @option{-membedded-data}.
20863 @item -mcode-readable=@var{setting}
20864 @opindex mcode-readable
20865 Specify whether GCC may generate code that reads from executable sections.
20866 There are three possible settings:
20869 @item -mcode-readable=yes
20870 Instructions may freely access executable sections. This is the
20873 @item -mcode-readable=pcrel
20874 MIPS16 PC-relative load instructions can access executable sections,
20875 but other instructions must not do so. This option is useful on 4KSc
20876 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
20877 It is also useful on processors that can be configured to have a dual
20878 instruction/data SRAM interface and that, like the M4K, automatically
20879 redirect PC-relative loads to the instruction RAM.
20881 @item -mcode-readable=no
20882 Instructions must not access executable sections. This option can be
20883 useful on targets that are configured to have a dual instruction/data
20884 SRAM interface but that (unlike the M4K) do not automatically redirect
20885 PC-relative loads to the instruction RAM.
20888 @item -msplit-addresses
20889 @itemx -mno-split-addresses
20890 @opindex msplit-addresses
20891 @opindex mno-split-addresses
20892 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
20893 relocation operators. This option has been superseded by
20894 @option{-mexplicit-relocs} but is retained for backwards compatibility.
20896 @item -mexplicit-relocs
20897 @itemx -mno-explicit-relocs
20898 @opindex mexplicit-relocs
20899 @opindex mno-explicit-relocs
20900 Use (do not use) assembler relocation operators when dealing with symbolic
20901 addresses. The alternative, selected by @option{-mno-explicit-relocs},
20902 is to use assembler macros instead.
20904 @option{-mexplicit-relocs} is the default if GCC was configured
20905 to use an assembler that supports relocation operators.
20907 @item -mcheck-zero-division
20908 @itemx -mno-check-zero-division
20909 @opindex mcheck-zero-division
20910 @opindex mno-check-zero-division
20911 Trap (do not trap) on integer division by zero.
20913 The default is @option{-mcheck-zero-division}.
20915 @item -mdivide-traps
20916 @itemx -mdivide-breaks
20917 @opindex mdivide-traps
20918 @opindex mdivide-breaks
20919 MIPS systems check for division by zero by generating either a
20920 conditional trap or a break instruction. Using traps results in
20921 smaller code, but is only supported on MIPS II and later. Also, some
20922 versions of the Linux kernel have a bug that prevents trap from
20923 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
20924 allow conditional traps on architectures that support them and
20925 @option{-mdivide-breaks} to force the use of breaks.
20927 The default is usually @option{-mdivide-traps}, but this can be
20928 overridden at configure time using @option{--with-divide=breaks}.
20929 Divide-by-zero checks can be completely disabled using
20930 @option{-mno-check-zero-division}.
20932 @item -mload-store-pairs
20933 @itemx -mno-load-store-pairs
20934 @opindex mload-store-pairs
20935 @opindex mno-load-store-pairs
20936 Enable (disable) an optimization that pairs consecutive load or store
20937 instructions to enable load/store bonding. This option is enabled by
20938 default but only takes effect when the selected architecture is known
20939 to support bonding.
20944 @opindex mno-memcpy
20945 Force (do not force) the use of @code{memcpy} for non-trivial block
20946 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
20947 most constant-sized copies.
20950 @itemx -mno-long-calls
20951 @opindex mlong-calls
20952 @opindex mno-long-calls
20953 Disable (do not disable) use of the @code{jal} instruction. Calling
20954 functions using @code{jal} is more efficient but requires the caller
20955 and callee to be in the same 256 megabyte segment.
20957 This option has no effect on abicalls code. The default is
20958 @option{-mno-long-calls}.
20964 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
20965 instructions, as provided by the R4650 ISA@.
20971 Enable (disable) use of the @code{madd} and @code{msub} integer
20972 instructions. The default is @option{-mimadd} on architectures
20973 that support @code{madd} and @code{msub} except for the 74k
20974 architecture where it was found to generate slower code.
20977 @itemx -mno-fused-madd
20978 @opindex mfused-madd
20979 @opindex mno-fused-madd
20980 Enable (disable) use of the floating-point multiply-accumulate
20981 instructions, when they are available. The default is
20982 @option{-mfused-madd}.
20984 On the R8000 CPU when multiply-accumulate instructions are used,
20985 the intermediate product is calculated to infinite precision
20986 and is not subject to the FCSR Flush to Zero bit. This may be
20987 undesirable in some circumstances. On other processors the result
20988 is numerically identical to the equivalent computation using
20989 separate multiply, add, subtract and negate instructions.
20993 Tell the MIPS assembler to not run its preprocessor over user
20994 assembler files (with a @samp{.s} suffix) when assembling them.
20997 @itemx -mno-fix-24k
20999 @opindex mno-fix-24k
21000 Work around the 24K E48 (lost data on stores during refill) errata.
21001 The workarounds are implemented by the assembler rather than by GCC@.
21004 @itemx -mno-fix-r4000
21005 @opindex mfix-r4000
21006 @opindex mno-fix-r4000
21007 Work around certain R4000 CPU errata:
21010 A double-word or a variable shift may give an incorrect result if executed
21011 immediately after starting an integer division.
21013 A double-word or a variable shift may give an incorrect result if executed
21014 while an integer multiplication is in progress.
21016 An integer division may give an incorrect result if started in a delay slot
21017 of a taken branch or a jump.
21021 @itemx -mno-fix-r4400
21022 @opindex mfix-r4400
21023 @opindex mno-fix-r4400
21024 Work around certain R4400 CPU errata:
21027 A double-word or a variable shift may give an incorrect result if executed
21028 immediately after starting an integer division.
21032 @itemx -mno-fix-r10000
21033 @opindex mfix-r10000
21034 @opindex mno-fix-r10000
21035 Work around certain R10000 errata:
21038 @code{ll}/@code{sc} sequences may not behave atomically on revisions
21039 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
21042 This option can only be used if the target architecture supports
21043 branch-likely instructions. @option{-mfix-r10000} is the default when
21044 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
21048 @itemx -mno-fix-rm7000
21049 @opindex mfix-rm7000
21050 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
21051 workarounds are implemented by the assembler rather than by GCC@.
21054 @itemx -mno-fix-vr4120
21055 @opindex mfix-vr4120
21056 Work around certain VR4120 errata:
21059 @code{dmultu} does not always produce the correct result.
21061 @code{div} and @code{ddiv} do not always produce the correct result if one
21062 of the operands is negative.
21064 The workarounds for the division errata rely on special functions in
21065 @file{libgcc.a}. At present, these functions are only provided by
21066 the @code{mips64vr*-elf} configurations.
21068 Other VR4120 errata require a NOP to be inserted between certain pairs of
21069 instructions. These errata are handled by the assembler, not by GCC itself.
21072 @opindex mfix-vr4130
21073 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
21074 workarounds are implemented by the assembler rather than by GCC,
21075 although GCC avoids using @code{mflo} and @code{mfhi} if the
21076 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
21077 instructions are available instead.
21080 @itemx -mno-fix-sb1
21082 Work around certain SB-1 CPU core errata.
21083 (This flag currently works around the SB-1 revision 2
21084 ``F1'' and ``F2'' floating-point errata.)
21086 @item -mr10k-cache-barrier=@var{setting}
21087 @opindex mr10k-cache-barrier
21088 Specify whether GCC should insert cache barriers to avoid the
21089 side effects of speculation on R10K processors.
21091 In common with many processors, the R10K tries to predict the outcome
21092 of a conditional branch and speculatively executes instructions from
21093 the ``taken'' branch. It later aborts these instructions if the
21094 predicted outcome is wrong. However, on the R10K, even aborted
21095 instructions can have side effects.
21097 This problem only affects kernel stores and, depending on the system,
21098 kernel loads. As an example, a speculatively-executed store may load
21099 the target memory into cache and mark the cache line as dirty, even if
21100 the store itself is later aborted. If a DMA operation writes to the
21101 same area of memory before the ``dirty'' line is flushed, the cached
21102 data overwrites the DMA-ed data. See the R10K processor manual
21103 for a full description, including other potential problems.
21105 One workaround is to insert cache barrier instructions before every memory
21106 access that might be speculatively executed and that might have side
21107 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
21108 controls GCC's implementation of this workaround. It assumes that
21109 aborted accesses to any byte in the following regions does not have
21114 the memory occupied by the current function's stack frame;
21117 the memory occupied by an incoming stack argument;
21120 the memory occupied by an object with a link-time-constant address.
21123 It is the kernel's responsibility to ensure that speculative
21124 accesses to these regions are indeed safe.
21126 If the input program contains a function declaration such as:
21132 then the implementation of @code{foo} must allow @code{j foo} and
21133 @code{jal foo} to be executed speculatively. GCC honors this
21134 restriction for functions it compiles itself. It expects non-GCC
21135 functions (such as hand-written assembly code) to do the same.
21137 The option has three forms:
21140 @item -mr10k-cache-barrier=load-store
21141 Insert a cache barrier before a load or store that might be
21142 speculatively executed and that might have side effects even
21145 @item -mr10k-cache-barrier=store
21146 Insert a cache barrier before a store that might be speculatively
21147 executed and that might have side effects even if aborted.
21149 @item -mr10k-cache-barrier=none
21150 Disable the insertion of cache barriers. This is the default setting.
21153 @item -mflush-func=@var{func}
21154 @itemx -mno-flush-func
21155 @opindex mflush-func
21156 Specifies the function to call to flush the I and D caches, or to not
21157 call any such function. If called, the function must take the same
21158 arguments as the common @code{_flush_func}, that is, the address of the
21159 memory range for which the cache is being flushed, the size of the
21160 memory range, and the number 3 (to flush both caches). The default
21161 depends on the target GCC was configured for, but commonly is either
21162 @code{_flush_func} or @code{__cpu_flush}.
21164 @item mbranch-cost=@var{num}
21165 @opindex mbranch-cost
21166 Set the cost of branches to roughly @var{num} ``simple'' instructions.
21167 This cost is only a heuristic and is not guaranteed to produce
21168 consistent results across releases. A zero cost redundantly selects
21169 the default, which is based on the @option{-mtune} setting.
21171 @item -mbranch-likely
21172 @itemx -mno-branch-likely
21173 @opindex mbranch-likely
21174 @opindex mno-branch-likely
21175 Enable or disable use of Branch Likely instructions, regardless of the
21176 default for the selected architecture. By default, Branch Likely
21177 instructions may be generated if they are supported by the selected
21178 architecture. An exception is for the MIPS32 and MIPS64 architectures
21179 and processors that implement those architectures; for those, Branch
21180 Likely instructions are not be generated by default because the MIPS32
21181 and MIPS64 architectures specifically deprecate their use.
21183 @item -mcompact-branches=never
21184 @itemx -mcompact-branches=optimal
21185 @itemx -mcompact-branches=always
21186 @opindex mcompact-branches=never
21187 @opindex mcompact-branches=optimal
21188 @opindex mcompact-branches=always
21189 These options control which form of branches will be generated. The
21190 default is @option{-mcompact-branches=optimal}.
21192 The @option{-mcompact-branches=never} option ensures that compact branch
21193 instructions will never be generated.
21195 The @option{-mcompact-branches=always} option ensures that a compact
21196 branch instruction will be generated if available. If a compact branch
21197 instruction is not available, a delay slot form of the branch will be
21200 This option is supported from MIPS Release 6 onwards.
21202 The @option{-mcompact-branches=optimal} option will cause a delay slot
21203 branch to be used if one is available in the current ISA and the delay
21204 slot is successfully filled. If the delay slot is not filled, a compact
21205 branch will be chosen if one is available.
21207 @item -mfp-exceptions
21208 @itemx -mno-fp-exceptions
21209 @opindex mfp-exceptions
21210 Specifies whether FP exceptions are enabled. This affects how
21211 FP instructions are scheduled for some processors.
21212 The default is that FP exceptions are
21215 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
21216 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
21219 @item -mvr4130-align
21220 @itemx -mno-vr4130-align
21221 @opindex mvr4130-align
21222 The VR4130 pipeline is two-way superscalar, but can only issue two
21223 instructions together if the first one is 8-byte aligned. When this
21224 option is enabled, GCC aligns pairs of instructions that it
21225 thinks should execute in parallel.
21227 This option only has an effect when optimizing for the VR4130.
21228 It normally makes code faster, but at the expense of making it bigger.
21229 It is enabled by default at optimization level @option{-O3}.
21234 Enable (disable) generation of @code{synci} instructions on
21235 architectures that support it. The @code{synci} instructions (if
21236 enabled) are generated when @code{__builtin___clear_cache} is
21239 This option defaults to @option{-mno-synci}, but the default can be
21240 overridden by configuring GCC with @option{--with-synci}.
21242 When compiling code for single processor systems, it is generally safe
21243 to use @code{synci}. However, on many multi-core (SMP) systems, it
21244 does not invalidate the instruction caches on all cores and may lead
21245 to undefined behavior.
21247 @item -mrelax-pic-calls
21248 @itemx -mno-relax-pic-calls
21249 @opindex mrelax-pic-calls
21250 Try to turn PIC calls that are normally dispatched via register
21251 @code{$25} into direct calls. This is only possible if the linker can
21252 resolve the destination at link time and if the destination is within
21253 range for a direct call.
21255 @option{-mrelax-pic-calls} is the default if GCC was configured to use
21256 an assembler and a linker that support the @code{.reloc} assembly
21257 directive and @option{-mexplicit-relocs} is in effect. With
21258 @option{-mno-explicit-relocs}, this optimization can be performed by the
21259 assembler and the linker alone without help from the compiler.
21261 @item -mmcount-ra-address
21262 @itemx -mno-mcount-ra-address
21263 @opindex mmcount-ra-address
21264 @opindex mno-mcount-ra-address
21265 Emit (do not emit) code that allows @code{_mcount} to modify the
21266 calling function's return address. When enabled, this option extends
21267 the usual @code{_mcount} interface with a new @var{ra-address}
21268 parameter, which has type @code{intptr_t *} and is passed in register
21269 @code{$12}. @code{_mcount} can then modify the return address by
21270 doing both of the following:
21273 Returning the new address in register @code{$31}.
21275 Storing the new address in @code{*@var{ra-address}},
21276 if @var{ra-address} is nonnull.
21279 The default is @option{-mno-mcount-ra-address}.
21281 @item -mframe-header-opt
21282 @itemx -mno-frame-header-opt
21283 @opindex mframe-header-opt
21284 Enable (disable) frame header optimization in the o32 ABI. When using the
21285 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
21286 function to write out register arguments. When enabled, this optimization
21287 will suppress the allocation of the frame header if it can be determined that
21290 This optimization is off by default at all optimization levels.
21293 @itemx -mno-lxc1-sxc1
21294 @opindex mlxc1-sxc1
21295 When applicable, enable (disable) the generation of @code{lwxc1},
21296 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
21301 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
21302 @code{madd.d} and related instructions. Enabled by default.
21307 @subsection MMIX Options
21308 @cindex MMIX Options
21310 These options are defined for the MMIX:
21314 @itemx -mno-libfuncs
21316 @opindex mno-libfuncs
21317 Specify that intrinsic library functions are being compiled, passing all
21318 values in registers, no matter the size.
21321 @itemx -mno-epsilon
21323 @opindex mno-epsilon
21324 Generate floating-point comparison instructions that compare with respect
21325 to the @code{rE} epsilon register.
21327 @item -mabi=mmixware
21329 @opindex mabi=mmixware
21331 Generate code that passes function parameters and return values that (in
21332 the called function) are seen as registers @code{$0} and up, as opposed to
21333 the GNU ABI which uses global registers @code{$231} and up.
21335 @item -mzero-extend
21336 @itemx -mno-zero-extend
21337 @opindex mzero-extend
21338 @opindex mno-zero-extend
21339 When reading data from memory in sizes shorter than 64 bits, use (do not
21340 use) zero-extending load instructions by default, rather than
21341 sign-extending ones.
21344 @itemx -mno-knuthdiv
21346 @opindex mno-knuthdiv
21347 Make the result of a division yielding a remainder have the same sign as
21348 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
21349 remainder follows the sign of the dividend. Both methods are
21350 arithmetically valid, the latter being almost exclusively used.
21352 @item -mtoplevel-symbols
21353 @itemx -mno-toplevel-symbols
21354 @opindex mtoplevel-symbols
21355 @opindex mno-toplevel-symbols
21356 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
21357 code can be used with the @code{PREFIX} assembly directive.
21361 Generate an executable in the ELF format, rather than the default
21362 @samp{mmo} format used by the @command{mmix} simulator.
21364 @item -mbranch-predict
21365 @itemx -mno-branch-predict
21366 @opindex mbranch-predict
21367 @opindex mno-branch-predict
21368 Use (do not use) the probable-branch instructions, when static branch
21369 prediction indicates a probable branch.
21371 @item -mbase-addresses
21372 @itemx -mno-base-addresses
21373 @opindex mbase-addresses
21374 @opindex mno-base-addresses
21375 Generate (do not generate) code that uses @emph{base addresses}. Using a
21376 base address automatically generates a request (handled by the assembler
21377 and the linker) for a constant to be set up in a global register. The
21378 register is used for one or more base address requests within the range 0
21379 to 255 from the value held in the register. The generally leads to short
21380 and fast code, but the number of different data items that can be
21381 addressed is limited. This means that a program that uses lots of static
21382 data may require @option{-mno-base-addresses}.
21384 @item -msingle-exit
21385 @itemx -mno-single-exit
21386 @opindex msingle-exit
21387 @opindex mno-single-exit
21388 Force (do not force) generated code to have a single exit point in each
21392 @node MN10300 Options
21393 @subsection MN10300 Options
21394 @cindex MN10300 options
21396 These @option{-m} options are defined for Matsushita MN10300 architectures:
21401 Generate code to avoid bugs in the multiply instructions for the MN10300
21402 processors. This is the default.
21404 @item -mno-mult-bug
21405 @opindex mno-mult-bug
21406 Do not generate code to avoid bugs in the multiply instructions for the
21407 MN10300 processors.
21411 Generate code using features specific to the AM33 processor.
21415 Do not generate code using features specific to the AM33 processor. This
21420 Generate code using features specific to the AM33/2.0 processor.
21424 Generate code using features specific to the AM34 processor.
21426 @item -mtune=@var{cpu-type}
21428 Use the timing characteristics of the indicated CPU type when
21429 scheduling instructions. This does not change the targeted processor
21430 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
21431 @samp{am33-2} or @samp{am34}.
21433 @item -mreturn-pointer-on-d0
21434 @opindex mreturn-pointer-on-d0
21435 When generating a function that returns a pointer, return the pointer
21436 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
21437 only in @code{a0}, and attempts to call such functions without a prototype
21438 result in errors. Note that this option is on by default; use
21439 @option{-mno-return-pointer-on-d0} to disable it.
21443 Do not link in the C run-time initialization object file.
21447 Indicate to the linker that it should perform a relaxation optimization pass
21448 to shorten branches, calls and absolute memory addresses. This option only
21449 has an effect when used on the command line for the final link step.
21451 This option makes symbolic debugging impossible.
21455 Allow the compiler to generate @emph{Long Instruction Word}
21456 instructions if the target is the @samp{AM33} or later. This is the
21457 default. This option defines the preprocessor macro @code{__LIW__}.
21461 Do not allow the compiler to generate @emph{Long Instruction Word}
21462 instructions. This option defines the preprocessor macro
21467 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
21468 instructions if the target is the @samp{AM33} or later. This is the
21469 default. This option defines the preprocessor macro @code{__SETLB__}.
21473 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
21474 instructions. This option defines the preprocessor macro
21475 @code{__NO_SETLB__}.
21479 @node Moxie Options
21480 @subsection Moxie Options
21481 @cindex Moxie Options
21487 Generate big-endian code. This is the default for @samp{moxie-*-*}
21492 Generate little-endian code.
21496 Generate mul.x and umul.x instructions. This is the default for
21497 @samp{moxiebox-*-*} configurations.
21501 Do not link in the C run-time initialization object file.
21505 @node MSP430 Options
21506 @subsection MSP430 Options
21507 @cindex MSP430 Options
21509 These options are defined for the MSP430:
21515 Force assembly output to always use hex constants. Normally such
21516 constants are signed decimals, but this option is available for
21517 testsuite and/or aesthetic purposes.
21521 Select the MCU to target. This is used to create a C preprocessor
21522 symbol based upon the MCU name, converted to upper case and pre- and
21523 post-fixed with @samp{__}. This in turn is used by the
21524 @file{msp430.h} header file to select an MCU-specific supplementary
21527 The option also sets the ISA to use. If the MCU name is one that is
21528 known to only support the 430 ISA then that is selected, otherwise the
21529 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
21530 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
21531 name selects the 430X ISA.
21533 In addition an MCU-specific linker script is added to the linker
21534 command line. The script's name is the name of the MCU with
21535 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
21536 command line defines the C preprocessor symbol @code{__XXX__} and
21537 cause the linker to search for a script called @file{xxx.ld}.
21539 This option is also passed on to the assembler.
21542 @itemx -mno-warn-mcu
21544 @opindex mno-warn-mcu
21545 This option enables or disables warnings about conflicts between the
21546 MCU name specified by the @option{-mmcu} option and the ISA set by the
21547 @option{-mcpu} option and/or the hardware multiply support set by the
21548 @option{-mhwmult} option. It also toggles warnings about unrecognized
21549 MCU names. This option is on by default.
21553 Specifies the ISA to use. Accepted values are @samp{msp430},
21554 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
21555 @option{-mmcu=} option should be used to select the ISA.
21559 Link to the simulator runtime libraries and linker script. Overrides
21560 any scripts that would be selected by the @option{-mmcu=} option.
21564 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
21568 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
21572 This option is passed to the assembler and linker, and allows the
21573 linker to perform certain optimizations that cannot be done until
21578 Describes the type of hardware multiply supported by the target.
21579 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
21580 for the original 16-bit-only multiply supported by early MCUs.
21581 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
21582 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
21583 A value of @samp{auto} can also be given. This tells GCC to deduce
21584 the hardware multiply support based upon the MCU name provided by the
21585 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
21586 the MCU name is not recognized then no hardware multiply support is
21587 assumed. @code{auto} is the default setting.
21589 Hardware multiplies are normally performed by calling a library
21590 routine. This saves space in the generated code. When compiling at
21591 @option{-O3} or higher however the hardware multiplier is invoked
21592 inline. This makes for bigger, but faster code.
21594 The hardware multiply routines disable interrupts whilst running and
21595 restore the previous interrupt state when they finish. This makes
21596 them safe to use inside interrupt handlers as well as in normal code.
21600 Enable the use of a minimum runtime environment - no static
21601 initializers or constructors. This is intended for memory-constrained
21602 devices. The compiler includes special symbols in some objects
21603 that tell the linker and runtime which code fragments are required.
21605 @item -mcode-region=
21606 @itemx -mdata-region=
21607 @opindex mcode-region
21608 @opindex mdata-region
21609 These options tell the compiler where to place functions and data that
21610 do not have one of the @code{lower}, @code{upper}, @code{either} or
21611 @code{section} attributes. Possible values are @code{lower},
21612 @code{upper}, @code{either} or @code{any}. The first three behave
21613 like the corresponding attribute. The fourth possible value -
21614 @code{any} - is the default. It leaves placement entirely up to the
21615 linker script and how it assigns the standard sections
21616 (@code{.text}, @code{.data}, etc) to the memory regions.
21618 @item -msilicon-errata=
21619 @opindex msilicon-errata
21620 This option passes on a request to assembler to enable the fixes for
21621 the named silicon errata.
21623 @item -msilicon-errata-warn=
21624 @opindex msilicon-errata-warn
21625 This option passes on a request to the assembler to enable warning
21626 messages when a silicon errata might need to be applied.
21630 @node NDS32 Options
21631 @subsection NDS32 Options
21632 @cindex NDS32 Options
21634 These options are defined for NDS32 implementations:
21639 @opindex mbig-endian
21640 Generate code in big-endian mode.
21642 @item -mlittle-endian
21643 @opindex mlittle-endian
21644 Generate code in little-endian mode.
21646 @item -mreduced-regs
21647 @opindex mreduced-regs
21648 Use reduced-set registers for register allocation.
21651 @opindex mfull-regs
21652 Use full-set registers for register allocation.
21656 Generate conditional move instructions.
21660 Do not generate conditional move instructions.
21664 Generate performance extension instructions.
21666 @item -mno-ext-perf
21667 @opindex mno-perf-ext
21668 Do not generate performance extension instructions.
21672 Generate performance extension 2 instructions.
21674 @item -mno-ext-perf2
21675 @opindex mno-perf-ext
21676 Do not generate performance extension 2 instructions.
21680 Generate string extension instructions.
21682 @item -mno-ext-string
21683 @opindex mno-perf-ext
21684 Do not generate string extension instructions.
21688 Generate v3 push25/pop25 instructions.
21691 @opindex mno-v3push
21692 Do not generate v3 push25/pop25 instructions.
21696 Generate 16-bit instructions.
21699 @opindex mno-16-bit
21700 Do not generate 16-bit instructions.
21702 @item -misr-vector-size=@var{num}
21703 @opindex misr-vector-size
21704 Specify the size of each interrupt vector, which must be 4 or 16.
21706 @item -mcache-block-size=@var{num}
21707 @opindex mcache-block-size
21708 Specify the size of each cache block,
21709 which must be a power of 2 between 4 and 512.
21711 @item -march=@var{arch}
21713 Specify the name of the target architecture.
21715 @item -mcmodel=@var{code-model}
21717 Set the code model to one of
21720 All the data and read-only data segments must be within 512KB addressing space.
21721 The text segment must be within 16MB addressing space.
21722 @item @samp{medium}
21723 The data segment must be within 512KB while the read-only data segment can be
21724 within 4GB addressing space. The text segment should be still within 16MB
21727 All the text and data segments can be within 4GB addressing space.
21731 @opindex mctor-dtor
21732 Enable constructor/destructor feature.
21736 Guide linker to relax instructions.
21740 @node Nios II Options
21741 @subsection Nios II Options
21742 @cindex Nios II options
21743 @cindex Altera Nios II options
21745 These are the options defined for the Altera Nios II processor.
21751 @cindex smaller data references
21752 Put global and static objects less than or equal to @var{num} bytes
21753 into the small data or BSS sections instead of the normal data or BSS
21754 sections. The default value of @var{num} is 8.
21756 @item -mgpopt=@var{option}
21761 Generate (do not generate) GP-relative accesses. The following
21762 @var{option} names are recognized:
21767 Do not generate GP-relative accesses.
21770 Generate GP-relative accesses for small data objects that are not
21771 external, weak, or uninitialized common symbols.
21772 Also use GP-relative addressing for objects that
21773 have been explicitly placed in a small data section via a @code{section}
21777 As for @samp{local}, but also generate GP-relative accesses for
21778 small data objects that are external, weak, or common. If you use this option,
21779 you must ensure that all parts of your program (including libraries) are
21780 compiled with the same @option{-G} setting.
21783 Generate GP-relative accesses for all data objects in the program. If you
21784 use this option, the entire data and BSS segments
21785 of your program must fit in 64K of memory and you must use an appropriate
21786 linker script to allocate them within the addressable range of the
21790 Generate GP-relative addresses for function pointers as well as data
21791 pointers. If you use this option, the entire text, data, and BSS segments
21792 of your program must fit in 64K of memory and you must use an appropriate
21793 linker script to allocate them within the addressable range of the
21798 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
21799 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
21801 The default is @option{-mgpopt} except when @option{-fpic} or
21802 @option{-fPIC} is specified to generate position-independent code.
21803 Note that the Nios II ABI does not permit GP-relative accesses from
21806 You may need to specify @option{-mno-gpopt} explicitly when building
21807 programs that include large amounts of small data, including large
21808 GOT data sections. In this case, the 16-bit offset for GP-relative
21809 addressing may not be large enough to allow access to the entire
21810 small data section.
21812 @item -mgprel-sec=@var{regexp}
21813 @opindex mgprel-sec
21814 This option specifies additional section names that can be accessed via
21815 GP-relative addressing. It is most useful in conjunction with
21816 @code{section} attributes on variable declarations
21817 (@pxref{Common Variable Attributes}) and a custom linker script.
21818 The @var{regexp} is a POSIX Extended Regular Expression.
21820 This option does not affect the behavior of the @option{-G} option, and
21821 and the specified sections are in addition to the standard @code{.sdata}
21822 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
21824 @item -mr0rel-sec=@var{regexp}
21825 @opindex mr0rel-sec
21826 This option specifies names of sections that can be accessed via a
21827 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
21828 of the 32-bit address space. It is most useful in conjunction with
21829 @code{section} attributes on variable declarations
21830 (@pxref{Common Variable Attributes}) and a custom linker script.
21831 The @var{regexp} is a POSIX Extended Regular Expression.
21833 In contrast to the use of GP-relative addressing for small data,
21834 zero-based addressing is never generated by default and there are no
21835 conventional section names used in standard linker scripts for sections
21836 in the low or high areas of memory.
21842 Generate little-endian (default) or big-endian (experimental) code,
21845 @item -march=@var{arch}
21847 This specifies the name of the target Nios II architecture. GCC uses this
21848 name to determine what kind of instructions it can emit when generating
21849 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
21851 The preprocessor macro @code{__nios2_arch__} is available to programs,
21852 with value 1 or 2, indicating the targeted ISA level.
21854 @item -mbypass-cache
21855 @itemx -mno-bypass-cache
21856 @opindex mno-bypass-cache
21857 @opindex mbypass-cache
21858 Force all load and store instructions to always bypass cache by
21859 using I/O variants of the instructions. The default is not to
21862 @item -mno-cache-volatile
21863 @itemx -mcache-volatile
21864 @opindex mcache-volatile
21865 @opindex mno-cache-volatile
21866 Volatile memory access bypass the cache using the I/O variants of
21867 the load and store instructions. The default is not to bypass the cache.
21869 @item -mno-fast-sw-div
21870 @itemx -mfast-sw-div
21871 @opindex mno-fast-sw-div
21872 @opindex mfast-sw-div
21873 Do not use table-based fast divide for small numbers. The default
21874 is to use the fast divide at @option{-O3} and above.
21878 @itemx -mno-hw-mulx
21882 @opindex mno-hw-mul
21884 @opindex mno-hw-mulx
21886 @opindex mno-hw-div
21888 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
21889 instructions by the compiler. The default is to emit @code{mul}
21890 and not emit @code{div} and @code{mulx}.
21896 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
21897 CDX (code density) instructions. Enabling these instructions also
21898 requires @option{-march=r2}. Since these instructions are optional
21899 extensions to the R2 architecture, the default is not to emit them.
21901 @item -mcustom-@var{insn}=@var{N}
21902 @itemx -mno-custom-@var{insn}
21903 @opindex mcustom-@var{insn}
21904 @opindex mno-custom-@var{insn}
21905 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
21906 custom instruction with encoding @var{N} when generating code that uses
21907 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
21908 instruction 253 for single-precision floating-point add operations instead
21909 of the default behavior of using a library call.
21911 The following values of @var{insn} are supported. Except as otherwise
21912 noted, floating-point operations are expected to be implemented with
21913 normal IEEE 754 semantics and correspond directly to the C operators or the
21914 equivalent GCC built-in functions (@pxref{Other Builtins}).
21916 Single-precision floating point:
21919 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
21920 Binary arithmetic operations.
21926 Unary absolute value.
21928 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
21929 Comparison operations.
21931 @item @samp{fmins}, @samp{fmaxs}
21932 Floating-point minimum and maximum. These instructions are only
21933 generated if @option{-ffinite-math-only} is specified.
21935 @item @samp{fsqrts}
21936 Unary square root operation.
21938 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
21939 Floating-point trigonometric and exponential functions. These instructions
21940 are only generated if @option{-funsafe-math-optimizations} is also specified.
21944 Double-precision floating point:
21947 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
21948 Binary arithmetic operations.
21954 Unary absolute value.
21956 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
21957 Comparison operations.
21959 @item @samp{fmind}, @samp{fmaxd}
21960 Double-precision minimum and maximum. These instructions are only
21961 generated if @option{-ffinite-math-only} is specified.
21963 @item @samp{fsqrtd}
21964 Unary square root operation.
21966 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
21967 Double-precision trigonometric and exponential functions. These instructions
21968 are only generated if @option{-funsafe-math-optimizations} is also specified.
21974 @item @samp{fextsd}
21975 Conversion from single precision to double precision.
21977 @item @samp{ftruncds}
21978 Conversion from double precision to single precision.
21980 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
21981 Conversion from floating point to signed or unsigned integer types, with
21982 truncation towards zero.
21985 Conversion from single-precision floating point to signed integer,
21986 rounding to the nearest integer and ties away from zero.
21987 This corresponds to the @code{__builtin_lroundf} function when
21988 @option{-fno-math-errno} is used.
21990 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
21991 Conversion from signed or unsigned integer types to floating-point types.
21995 In addition, all of the following transfer instructions for internal
21996 registers X and Y must be provided to use any of the double-precision
21997 floating-point instructions. Custom instructions taking two
21998 double-precision source operands expect the first operand in the
21999 64-bit register X. The other operand (or only operand of a unary
22000 operation) is given to the custom arithmetic instruction with the
22001 least significant half in source register @var{src1} and the most
22002 significant half in @var{src2}. A custom instruction that returns a
22003 double-precision result returns the most significant 32 bits in the
22004 destination register and the other half in 32-bit register Y.
22005 GCC automatically generates the necessary code sequences to write
22006 register X and/or read register Y when double-precision floating-point
22007 instructions are used.
22012 Write @var{src1} into the least significant half of X and @var{src2} into
22013 the most significant half of X.
22016 Write @var{src1} into Y.
22018 @item @samp{frdxhi}, @samp{frdxlo}
22019 Read the most or least (respectively) significant half of X and store it in
22023 Read the value of Y and store it into @var{dest}.
22026 Note that you can gain more local control over generation of Nios II custom
22027 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
22028 and @code{target("no-custom-@var{insn}")} function attributes
22029 (@pxref{Function Attributes})
22030 or pragmas (@pxref{Function Specific Option Pragmas}).
22032 @item -mcustom-fpu-cfg=@var{name}
22033 @opindex mcustom-fpu-cfg
22035 This option enables a predefined, named set of custom instruction encodings
22036 (see @option{-mcustom-@var{insn}} above).
22037 Currently, the following sets are defined:
22039 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
22040 @gccoptlist{-mcustom-fmuls=252 @gol
22041 -mcustom-fadds=253 @gol
22042 -mcustom-fsubs=254 @gol
22043 -fsingle-precision-constant}
22045 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
22046 @gccoptlist{-mcustom-fmuls=252 @gol
22047 -mcustom-fadds=253 @gol
22048 -mcustom-fsubs=254 @gol
22049 -mcustom-fdivs=255 @gol
22050 -fsingle-precision-constant}
22052 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
22053 @gccoptlist{-mcustom-floatus=243 @gol
22054 -mcustom-fixsi=244 @gol
22055 -mcustom-floatis=245 @gol
22056 -mcustom-fcmpgts=246 @gol
22057 -mcustom-fcmples=249 @gol
22058 -mcustom-fcmpeqs=250 @gol
22059 -mcustom-fcmpnes=251 @gol
22060 -mcustom-fmuls=252 @gol
22061 -mcustom-fadds=253 @gol
22062 -mcustom-fsubs=254 @gol
22063 -mcustom-fdivs=255 @gol
22064 -fsingle-precision-constant}
22066 Custom instruction assignments given by individual
22067 @option{-mcustom-@var{insn}=} options override those given by
22068 @option{-mcustom-fpu-cfg=}, regardless of the
22069 order of the options on the command line.
22071 Note that you can gain more local control over selection of a FPU
22072 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
22073 function attribute (@pxref{Function Attributes})
22074 or pragma (@pxref{Function Specific Option Pragmas}).
22078 These additional @samp{-m} options are available for the Altera Nios II
22079 ELF (bare-metal) target:
22085 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
22086 startup and termination code, and is typically used in conjunction with
22087 @option{-msys-crt0=} to specify the location of the alternate startup code
22088 provided by the HAL BSP.
22092 Link with a limited version of the C library, @option{-lsmallc}, rather than
22095 @item -msys-crt0=@var{startfile}
22097 @var{startfile} is the file name of the startfile (crt0) to use
22098 when linking. This option is only useful in conjunction with @option{-mhal}.
22100 @item -msys-lib=@var{systemlib}
22102 @var{systemlib} is the library name of the library that provides
22103 low-level system calls required by the C library,
22104 e.g. @code{read} and @code{write}.
22105 This option is typically used to link with a library provided by a HAL BSP.
22109 @node Nvidia PTX Options
22110 @subsection Nvidia PTX Options
22111 @cindex Nvidia PTX options
22112 @cindex nvptx options
22114 These options are defined for Nvidia PTX:
22122 Generate code for 32-bit or 64-bit ABI.
22125 @opindex mmainkernel
22126 Link in code for a __main kernel. This is for stand-alone instead of
22127 offloading execution.
22131 Apply partitioned execution optimizations. This is the default when any
22132 level of optimization is selected.
22135 @opindex msoft-stack
22136 Generate code that does not use @code{.local} memory
22137 directly for stack storage. Instead, a per-warp stack pointer is
22138 maintained explicitly. This enables variable-length stack allocation (with
22139 variable-length arrays or @code{alloca}), and when global memory is used for
22140 underlying storage, makes it possible to access automatic variables from other
22141 threads, or with atomic instructions. This code generation variant is used
22142 for OpenMP offloading, but the option is exposed on its own for the purpose
22143 of testing the compiler; to generate code suitable for linking into programs
22144 using OpenMP offloading, use option @option{-mgomp}.
22146 @item -muniform-simt
22147 @opindex muniform-simt
22148 Switch to code generation variant that allows to execute all threads in each
22149 warp, while maintaining memory state and side effects as if only one thread
22150 in each warp was active outside of OpenMP SIMD regions. All atomic operations
22151 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
22152 current lane index equals the master lane index), and the register being
22153 assigned is copied via a shuffle instruction from the master lane. Outside of
22154 SIMD regions lane 0 is the master; inside, each thread sees itself as the
22155 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
22156 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
22157 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
22158 with current lane index to compute the master lane index.
22162 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
22163 @option{-muniform-simt} options, and selects corresponding multilib variant.
22167 @node PDP-11 Options
22168 @subsection PDP-11 Options
22169 @cindex PDP-11 Options
22171 These options are defined for the PDP-11:
22176 Use hardware FPP floating point. This is the default. (FIS floating
22177 point on the PDP-11/40 is not supported.) Implies -m45.
22180 @opindex msoft-float
22181 Do not use hardware floating point.
22185 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
22189 Return floating-point results in memory. This is the default.
22193 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
22197 Generate code for a PDP-11/45. This is the default.
22201 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
22207 Use 16-bit @code{int}. This is the default.
22213 Use 32-bit @code{int}.
22216 @itemx -mno-float32
22218 @opindex mno-float32
22219 Use 64-bit @code{float}. This is the default.
22222 @itemx -mno-float64
22224 @opindex mno-float64
22225 Use 32-bit @code{float}.
22229 Target has split instruction and data space. Implies -m45.
22233 Use Unix assembler syntax.
22237 Use DEC assembler syntax.
22241 Use GNU assembler syntax. This is the default.
22244 @node picoChip Options
22245 @subsection picoChip Options
22246 @cindex picoChip options
22248 These @samp{-m} options are defined for picoChip implementations:
22252 @item -mae=@var{ae_type}
22254 Set the instruction set, register set, and instruction scheduling
22255 parameters for array element type @var{ae_type}. Supported values
22256 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
22258 @option{-mae=ANY} selects a completely generic AE type. Code
22259 generated with this option runs on any of the other AE types. The
22260 code is not as efficient as it would be if compiled for a specific
22261 AE type, and some types of operation (e.g., multiplication) do not
22262 work properly on all types of AE.
22264 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
22265 for compiled code, and is the default.
22267 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
22268 option may suffer from poor performance of byte (char) manipulation,
22269 since the DSP AE does not provide hardware support for byte load/stores.
22271 @item -msymbol-as-address
22272 Enable the compiler to directly use a symbol name as an address in a
22273 load/store instruction, without first loading it into a
22274 register. Typically, the use of this option generates larger
22275 programs, which run faster than when the option isn't used. However, the
22276 results vary from program to program, so it is left as a user option,
22277 rather than being permanently enabled.
22279 @item -mno-inefficient-warnings
22280 Disables warnings about the generation of inefficient code. These
22281 warnings can be generated, for example, when compiling code that
22282 performs byte-level memory operations on the MAC AE type. The MAC AE has
22283 no hardware support for byte-level memory operations, so all byte
22284 load/stores must be synthesized from word load/store operations. This is
22285 inefficient and a warning is generated to indicate
22286 that you should rewrite the code to avoid byte operations, or to target
22287 an AE type that has the necessary hardware support. This option disables
22292 @node PowerPC Options
22293 @subsection PowerPC Options
22294 @cindex PowerPC options
22296 These are listed under @xref{RS/6000 and PowerPC Options}.
22298 @node PowerPC SPE Options
22299 @subsection PowerPC SPE Options
22300 @cindex PowerPC SPE options
22302 These @samp{-m} options are defined for PowerPC SPE:
22307 @itemx -mno-popcntb
22311 @opindex mno-popcntb
22312 You use these options to specify which instructions are available on the
22313 processor you are using. The default value of these options is
22314 determined when configuring GCC@. Specifying the
22315 @option{-mcpu=@var{cpu_type}} overrides the specification of these
22316 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
22317 rather than the options listed above.
22319 The @option{-mmfcrf} option allows GCC to generate the move from
22320 condition register field instruction implemented on the POWER4
22321 processor and other processors that support the PowerPC V2.01
22323 The @option{-mpopcntb} option allows GCC to generate the popcount and
22324 double-precision FP reciprocal estimate instruction implemented on the
22325 POWER5 processor and other processors that support the PowerPC V2.02
22328 @item -mcpu=@var{cpu_type}
22330 Set architecture type, register usage, and
22331 instruction scheduling parameters for machine type @var{cpu_type}.
22332 Supported values for @var{cpu_type} are @samp{8540}, @samp{8548},
22335 @option{-mcpu=powerpc} specifies pure 32-bit PowerPC (either
22336 endian), with an appropriate, generic processor model assumed for
22337 scheduling purposes.
22339 Specifying @samp{native} as cpu type detects and selects the
22340 architecture option that corresponds to the host processor of the
22341 system performing the compilation.
22342 @option{-mcpu=native} has no effect if GCC does not recognize the
22345 The other options specify a specific processor. Code generated under
22346 those options runs best on that processor, and may not run at all on
22349 The @option{-mcpu} options automatically enable or disable the
22352 @gccoptlist{-mhard-float -mmfcrf -mmultiple @gol
22353 -mpopcntb -mpopcntd @gol
22354 -msingle-float -mdouble-float @gol
22357 The particular options set for any particular CPU varies between
22358 compiler versions, depending on what setting seems to produce optimal
22359 code for that CPU; it doesn't necessarily reflect the actual hardware's
22360 capabilities. If you wish to set an individual option to a particular
22361 value, you may specify it after the @option{-mcpu} option, like
22362 @option{-mcpu=8548}.
22364 @item -mtune=@var{cpu_type}
22366 Set the instruction scheduling parameters for machine type
22367 @var{cpu_type}, but do not set the architecture type or register usage,
22368 as @option{-mcpu=@var{cpu_type}} does. The same
22369 values for @var{cpu_type} are used for @option{-mtune} as for
22370 @option{-mcpu}. If both are specified, the code generated uses the
22371 architecture and registers set by @option{-mcpu}, but the
22372 scheduling parameters set by @option{-mtune}.
22375 @opindex msecure-plt
22376 Generate code that allows @command{ld} and @command{ld.so}
22377 to build executables and shared
22378 libraries with non-executable @code{.plt} and @code{.got} sections.
22380 32-bit SYSV ABI option.
22384 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
22386 requires @code{.plt} and @code{.got}
22387 sections that are both writable and executable.
22388 This is a PowerPC 32-bit SYSV ABI option.
22394 This switch enables or disables the generation of ISEL instructions.
22396 @item -misel=@var{yes/no}
22397 This switch has been deprecated. Use @option{-misel} and
22398 @option{-mno-isel} instead.
22404 This switch enables or disables the generation of SPE simd
22407 @item -mspe=@var{yes/no}
22408 This option has been deprecated. Use @option{-mspe} and
22409 @option{-mno-spe} instead.
22412 @itemx -mno-float128
22414 @opindex mno-float128
22415 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
22416 and use either software emulation for IEEE 128-bit floating point or
22417 hardware instructions.
22419 @item -mfloat-gprs=@var{yes/single/double/no}
22420 @itemx -mfloat-gprs
22421 @opindex mfloat-gprs
22422 This switch enables or disables the generation of floating-point
22423 operations on the general-purpose registers for architectures that
22426 The argument @samp{yes} or @samp{single} enables the use of
22427 single-precision floating-point operations.
22429 The argument @samp{double} enables the use of single and
22430 double-precision floating-point operations.
22432 The argument @samp{no} disables floating-point operations on the
22433 general-purpose registers.
22435 This option is currently only available on the MPC854x.
22438 @itemx -mno-fp-in-toc
22439 @itemx -mno-sum-in-toc
22440 @itemx -mminimal-toc
22442 @opindex mno-fp-in-toc
22443 @opindex mno-sum-in-toc
22444 @opindex mminimal-toc
22445 Modify generation of the TOC (Table Of Contents), which is created for
22446 every executable file. The @option{-mfull-toc} option is selected by
22447 default. In that case, GCC allocates at least one TOC entry for
22448 each unique non-automatic variable reference in your program. GCC
22449 also places floating-point constants in the TOC@. However, only
22450 16,384 entries are available in the TOC@.
22452 If you receive a linker error message that saying you have overflowed
22453 the available TOC space, you can reduce the amount of TOC space used
22454 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
22455 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
22456 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
22457 generate code to calculate the sum of an address and a constant at
22458 run time instead of putting that sum into the TOC@. You may specify one
22459 or both of these options. Each causes GCC to produce very slightly
22460 slower and larger code at the expense of conserving TOC space.
22462 If you still run out of space in the TOC even when you specify both of
22463 these options, specify @option{-mminimal-toc} instead. This option causes
22464 GCC to make only one TOC entry for every file. When you specify this
22465 option, GCC produces code that is slower and larger but which
22466 uses extremely little TOC space. You may wish to use this option
22467 only on files that contain less frequently-executed code.
22471 Disables the 64-bit ABI. GCC defaults to @option{-maix32}.
22474 @itemx -mno-xl-compat
22475 @opindex mxl-compat
22476 @opindex mno-xl-compat
22477 Produce code that conforms more closely to IBM XL compiler semantics
22478 when using AIX-compatible ABI@. Pass floating-point arguments to
22479 prototyped functions beyond the register save area (RSA) on the stack
22480 in addition to argument FPRs. Do not assume that most significant
22481 double in 128-bit long double value is properly rounded when comparing
22482 values and converting to double. Use XL symbol names for long double
22485 The AIX calling convention was extended but not initially documented to
22486 handle an obscure K&R C case of calling a function that takes the
22487 address of its arguments with fewer arguments than declared. IBM XL
22488 compilers access floating-point arguments that do not fit in the
22489 RSA from the stack when a subroutine is compiled without
22490 optimization. Because always storing floating-point arguments on the
22491 stack is inefficient and rarely needed, this option is not enabled by
22492 default and only is necessary when calling subroutines compiled by IBM
22493 XL compilers without optimization.
22495 @item -malign-natural
22496 @itemx -malign-power
22497 @opindex malign-natural
22498 @opindex malign-power
22499 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
22500 @option{-malign-natural} overrides the ABI-defined alignment of larger
22501 types, such as floating-point doubles, on their natural size-based boundary.
22502 The option @option{-malign-power} instructs GCC to follow the ABI-specified
22503 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
22505 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
22509 @itemx -mhard-float
22510 @opindex msoft-float
22511 @opindex mhard-float
22512 Generate code that does not use (uses) the floating-point register set.
22513 Software floating-point emulation is provided if you use the
22514 @option{-msoft-float} option, and pass the option to GCC when linking.
22516 @item -msingle-float
22517 @itemx -mdouble-float
22518 @opindex msingle-float
22519 @opindex mdouble-float
22520 Generate code for single- or double-precision floating-point operations.
22521 @option{-mdouble-float} implies @option{-msingle-float}.
22524 @itemx -mno-multiple
22526 @opindex mno-multiple
22527 Generate code that uses (does not use) the load multiple word
22528 instructions and the store multiple word instructions. These
22529 instructions are generated by default on POWER systems, and not
22530 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
22531 PowerPC systems, since those instructions do not work when the
22532 processor is in little-endian mode. The exceptions are PPC740 and
22533 PPC750 which permit these instructions in little-endian mode.
22538 @opindex mno-update
22539 Generate code that uses (does not use) the load or store instructions
22540 that update the base register to the address of the calculated memory
22541 location. These instructions are generated by default. If you use
22542 @option{-mno-update}, there is a small window between the time that the
22543 stack pointer is updated and the address of the previous frame is
22544 stored, which means code that walks the stack frame across interrupts or
22545 signals may get corrupted data.
22547 @item -mavoid-indexed-addresses
22548 @itemx -mno-avoid-indexed-addresses
22549 @opindex mavoid-indexed-addresses
22550 @opindex mno-avoid-indexed-addresses
22551 Generate code that tries to avoid (not avoid) the use of indexed load
22552 or store instructions. These instructions can incur a performance
22553 penalty on Power6 processors in certain situations, such as when
22554 stepping through large arrays that cross a 16M boundary. This option
22555 is enabled by default when targeting Power6 and disabled otherwise.
22558 @itemx -mno-fused-madd
22559 @opindex mfused-madd
22560 @opindex mno-fused-madd
22561 Generate code that uses (does not use) the floating-point multiply and
22562 accumulate instructions. These instructions are generated by default
22563 if hardware floating point is used. The machine-dependent
22564 @option{-mfused-madd} option is now mapped to the machine-independent
22565 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
22566 mapped to @option{-ffp-contract=off}.
22568 @item -mno-strict-align
22569 @itemx -mstrict-align
22570 @opindex mno-strict-align
22571 @opindex mstrict-align
22572 On System V.4 and embedded PowerPC systems do not (do) assume that
22573 unaligned memory references are handled by the system.
22575 @item -mrelocatable
22576 @itemx -mno-relocatable
22577 @opindex mrelocatable
22578 @opindex mno-relocatable
22579 Generate code that allows (does not allow) a static executable to be
22580 relocated to a different address at run time. A simple embedded
22581 PowerPC system loader should relocate the entire contents of
22582 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
22583 a table of 32-bit addresses generated by this option. For this to
22584 work, all objects linked together must be compiled with
22585 @option{-mrelocatable} or @option{-mrelocatable-lib}.
22586 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
22588 @item -mrelocatable-lib
22589 @itemx -mno-relocatable-lib
22590 @opindex mrelocatable-lib
22591 @opindex mno-relocatable-lib
22592 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
22593 @code{.fixup} section to allow static executables to be relocated at
22594 run time, but @option{-mrelocatable-lib} does not use the smaller stack
22595 alignment of @option{-mrelocatable}. Objects compiled with
22596 @option{-mrelocatable-lib} may be linked with objects compiled with
22597 any combination of the @option{-mrelocatable} options.
22603 On System V.4 and embedded PowerPC systems do not (do) assume that
22604 register 2 contains a pointer to a global area pointing to the addresses
22605 used in the program.
22608 @itemx -mlittle-endian
22610 @opindex mlittle-endian
22611 On System V.4 and embedded PowerPC systems compile code for the
22612 processor in little-endian mode. The @option{-mlittle-endian} option is
22613 the same as @option{-mlittle}.
22616 @itemx -mbig-endian
22618 @opindex mbig-endian
22619 On System V.4 and embedded PowerPC systems compile code for the
22620 processor in big-endian mode. The @option{-mbig-endian} option is
22621 the same as @option{-mbig}.
22623 @item -mdynamic-no-pic
22624 @opindex mdynamic-no-pic
22625 On Darwin and Mac OS X systems, compile code so that it is not
22626 relocatable, but that its external references are relocatable. The
22627 resulting code is suitable for applications, but not shared
22630 @item -msingle-pic-base
22631 @opindex msingle-pic-base
22632 Treat the register used for PIC addressing as read-only, rather than
22633 loading it in the prologue for each function. The runtime system is
22634 responsible for initializing this register with an appropriate value
22635 before execution begins.
22637 @item -mprioritize-restricted-insns=@var{priority}
22638 @opindex mprioritize-restricted-insns
22639 This option controls the priority that is assigned to
22640 dispatch-slot restricted instructions during the second scheduling
22641 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
22642 or @samp{2} to assign no, highest, or second-highest (respectively)
22643 priority to dispatch-slot restricted
22646 @item -msched-costly-dep=@var{dependence_type}
22647 @opindex msched-costly-dep
22648 This option controls which dependences are considered costly
22649 by the target during instruction scheduling. The argument
22650 @var{dependence_type} takes one of the following values:
22654 No dependence is costly.
22657 All dependences are costly.
22659 @item @samp{true_store_to_load}
22660 A true dependence from store to load is costly.
22662 @item @samp{store_to_load}
22663 Any dependence from store to load is costly.
22666 Any dependence for which the latency is greater than or equal to
22667 @var{number} is costly.
22670 @item -minsert-sched-nops=@var{scheme}
22671 @opindex minsert-sched-nops
22672 This option controls which NOP insertion scheme is used during
22673 the second scheduling pass. The argument @var{scheme} takes one of the
22681 Pad with NOPs any dispatch group that has vacant issue slots,
22682 according to the scheduler's grouping.
22684 @item @samp{regroup_exact}
22685 Insert NOPs to force costly dependent insns into
22686 separate groups. Insert exactly as many NOPs as needed to force an insn
22687 to a new group, according to the estimated processor grouping.
22690 Insert NOPs to force costly dependent insns into
22691 separate groups. Insert @var{number} NOPs to force an insn to a new group.
22695 @opindex mcall-sysv
22696 On System V.4 and embedded PowerPC systems compile code using calling
22697 conventions that adhere to the March 1995 draft of the System V
22698 Application Binary Interface, PowerPC processor supplement. This is the
22699 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
22701 @item -mcall-sysv-eabi
22703 @opindex mcall-sysv-eabi
22704 @opindex mcall-eabi
22705 Specify both @option{-mcall-sysv} and @option{-meabi} options.
22707 @item -mcall-sysv-noeabi
22708 @opindex mcall-sysv-noeabi
22709 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
22711 @item -mcall-aixdesc
22713 On System V.4 and embedded PowerPC systems compile code for the AIX
22717 @opindex mcall-linux
22718 On System V.4 and embedded PowerPC systems compile code for the
22719 Linux-based GNU system.
22721 @item -mcall-freebsd
22722 @opindex mcall-freebsd
22723 On System V.4 and embedded PowerPC systems compile code for the
22724 FreeBSD operating system.
22726 @item -mcall-netbsd
22727 @opindex mcall-netbsd
22728 On System V.4 and embedded PowerPC systems compile code for the
22729 NetBSD operating system.
22731 @item -mcall-openbsd
22732 @opindex mcall-netbsd
22733 On System V.4 and embedded PowerPC systems compile code for the
22734 OpenBSD operating system.
22736 @item -maix-struct-return
22737 @opindex maix-struct-return
22738 Return all structures in memory (as specified by the AIX ABI)@.
22740 @item -msvr4-struct-return
22741 @opindex msvr4-struct-return
22742 Return structures smaller than 8 bytes in registers (as specified by the
22745 @item -mabi=@var{abi-type}
22747 Extend the current ABI with a particular extension, or remove such extension.
22748 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
22749 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
22750 @samp{elfv1}, @samp{elfv2}@.
22754 Extend the current ABI with SPE ABI extensions. This does not change
22755 the default ABI, instead it adds the SPE ABI extensions to the current
22759 @opindex mabi=no-spe
22760 Disable Book-E SPE ABI extensions for the current ABI@.
22762 @item -mabi=ibmlongdouble
22763 @opindex mabi=ibmlongdouble
22764 Change the current ABI to use IBM extended-precision long double.
22765 This is not likely to work if your system defaults to using IEEE
22766 extended-precision long double. If you change the long double type
22767 from IEEE extended-precision, the compiler will issue a warning unless
22768 you use the @option{-Wno-psabi} option.
22770 @item -mabi=ieeelongdouble
22771 @opindex mabi=ieeelongdouble
22772 Change the current ABI to use IEEE extended-precision long double.
22773 This is not likely to work if your system defaults to using IBM
22774 extended-precision long double. If you change the long double type
22775 from IBM extended-precision, the compiler will issue a warning unless
22776 you use the @option{-Wno-psabi} option.
22779 @opindex mabi=elfv1
22780 Change the current ABI to use the ELFv1 ABI.
22781 This is the default ABI for big-endian PowerPC 64-bit Linux.
22782 Overriding the default ABI requires special system support and is
22783 likely to fail in spectacular ways.
22786 @opindex mabi=elfv2
22787 Change the current ABI to use the ELFv2 ABI.
22788 This is the default ABI for little-endian PowerPC 64-bit Linux.
22789 Overriding the default ABI requires special system support and is
22790 likely to fail in spectacular ways.
22792 @item -mgnu-attribute
22793 @itemx -mno-gnu-attribute
22794 @opindex mgnu-attribute
22795 @opindex mno-gnu-attribute
22796 Emit .gnu_attribute assembly directives to set tag/value pairs in a
22797 .gnu.attributes section that specify ABI variations in function
22798 parameters or return values.
22801 @itemx -mno-prototype
22802 @opindex mprototype
22803 @opindex mno-prototype
22804 On System V.4 and embedded PowerPC systems assume that all calls to
22805 variable argument functions are properly prototyped. Otherwise, the
22806 compiler must insert an instruction before every non-prototyped call to
22807 set or clear bit 6 of the condition code register (@code{CR}) to
22808 indicate whether floating-point values are passed in the floating-point
22809 registers in case the function takes variable arguments. With
22810 @option{-mprototype}, only calls to prototyped variable argument functions
22811 set or clear the bit.
22815 On embedded PowerPC systems, assume that the startup module is called
22816 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
22817 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
22822 On embedded PowerPC systems, assume that the startup module is called
22823 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
22828 On embedded PowerPC systems, assume that the startup module is called
22829 @file{crt0.o} and the standard C libraries are @file{libads.a} and
22832 @item -myellowknife
22833 @opindex myellowknife
22834 On embedded PowerPC systems, assume that the startup module is called
22835 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
22840 On System V.4 and embedded PowerPC systems, specify that you are
22841 compiling for a VxWorks system.
22845 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
22846 header to indicate that @samp{eabi} extended relocations are used.
22852 On System V.4 and embedded PowerPC systems do (do not) adhere to the
22853 Embedded Applications Binary Interface (EABI), which is a set of
22854 modifications to the System V.4 specifications. Selecting @option{-meabi}
22855 means that the stack is aligned to an 8-byte boundary, a function
22856 @code{__eabi} is called from @code{main} to set up the EABI
22857 environment, and the @option{-msdata} option can use both @code{r2} and
22858 @code{r13} to point to two separate small data areas. Selecting
22859 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
22860 no EABI initialization function is called from @code{main}, and the
22861 @option{-msdata} option only uses @code{r13} to point to a single
22862 small data area. The @option{-meabi} option is on by default if you
22863 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
22866 @opindex msdata=eabi
22867 On System V.4 and embedded PowerPC systems, put small initialized
22868 @code{const} global and static data in the @code{.sdata2} section, which
22869 is pointed to by register @code{r2}. Put small initialized
22870 non-@code{const} global and static data in the @code{.sdata} section,
22871 which is pointed to by register @code{r13}. Put small uninitialized
22872 global and static data in the @code{.sbss} section, which is adjacent to
22873 the @code{.sdata} section. The @option{-msdata=eabi} option is
22874 incompatible with the @option{-mrelocatable} option. The
22875 @option{-msdata=eabi} option also sets the @option{-memb} option.
22878 @opindex msdata=sysv
22879 On System V.4 and embedded PowerPC systems, put small global and static
22880 data in the @code{.sdata} section, which is pointed to by register
22881 @code{r13}. Put small uninitialized global and static data in the
22882 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
22883 The @option{-msdata=sysv} option is incompatible with the
22884 @option{-mrelocatable} option.
22886 @item -msdata=default
22888 @opindex msdata=default
22890 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
22891 compile code the same as @option{-msdata=eabi}, otherwise compile code the
22892 same as @option{-msdata=sysv}.
22895 @opindex msdata=data
22896 On System V.4 and embedded PowerPC systems, put small global
22897 data in the @code{.sdata} section. Put small uninitialized global
22898 data in the @code{.sbss} section. Do not use register @code{r13}
22899 to address small data however. This is the default behavior unless
22900 other @option{-msdata} options are used.
22904 @opindex msdata=none
22906 On embedded PowerPC systems, put all initialized global and static data
22907 in the @code{.data} section, and all uninitialized data in the
22908 @code{.bss} section.
22910 @item -mblock-move-inline-limit=@var{num}
22911 @opindex mblock-move-inline-limit
22912 Inline all block moves (such as calls to @code{memcpy} or structure
22913 copies) less than or equal to @var{num} bytes. The minimum value for
22914 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
22915 targets. The default value is target-specific.
22919 @cindex smaller data references (PowerPC)
22920 @cindex .sdata/.sdata2 references (PowerPC)
22921 On embedded PowerPC systems, put global and static items less than or
22922 equal to @var{num} bytes into the small data or BSS sections instead of
22923 the normal data or BSS section. By default, @var{num} is 8. The
22924 @option{-G @var{num}} switch is also passed to the linker.
22925 All modules should be compiled with the same @option{-G @var{num}} value.
22928 @itemx -mno-regnames
22930 @opindex mno-regnames
22931 On System V.4 and embedded PowerPC systems do (do not) emit register
22932 names in the assembly language output using symbolic forms.
22935 @itemx -mno-longcall
22937 @opindex mno-longcall
22938 By default assume that all calls are far away so that a longer and more
22939 expensive calling sequence is required. This is required for calls
22940 farther than 32 megabytes (33,554,432 bytes) from the current location.
22941 A short call is generated if the compiler knows
22942 the call cannot be that far away. This setting can be overridden by
22943 the @code{shortcall} function attribute, or by @code{#pragma
22946 Some linkers are capable of detecting out-of-range calls and generating
22947 glue code on the fly. On these systems, long calls are unnecessary and
22948 generate slower code. As of this writing, the AIX linker can do this,
22949 as can the GNU linker for PowerPC/64. It is planned to add this feature
22950 to the GNU linker for 32-bit PowerPC systems as well.
22952 In the future, GCC may ignore all longcall specifications
22953 when the linker is known to generate glue.
22955 @item -mtls-markers
22956 @itemx -mno-tls-markers
22957 @opindex mtls-markers
22958 @opindex mno-tls-markers
22959 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
22960 specifying the function argument. The relocation allows the linker to
22961 reliably associate function call with argument setup instructions for
22962 TLS optimization, which in turn allows GCC to better schedule the
22968 This option enables use of the reciprocal estimate and
22969 reciprocal square root estimate instructions with additional
22970 Newton-Raphson steps to increase precision instead of doing a divide or
22971 square root and divide for floating-point arguments. You should use
22972 the @option{-ffast-math} option when using @option{-mrecip} (or at
22973 least @option{-funsafe-math-optimizations},
22974 @option{-ffinite-math-only}, @option{-freciprocal-math} and
22975 @option{-fno-trapping-math}). Note that while the throughput of the
22976 sequence is generally higher than the throughput of the non-reciprocal
22977 instruction, the precision of the sequence can be decreased by up to 2
22978 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
22981 @item -mrecip=@var{opt}
22982 @opindex mrecip=opt
22983 This option controls which reciprocal estimate instructions
22984 may be used. @var{opt} is a comma-separated list of options, which may
22985 be preceded by a @code{!} to invert the option:
22990 Enable all estimate instructions.
22993 Enable the default instructions, equivalent to @option{-mrecip}.
22996 Disable all estimate instructions, equivalent to @option{-mno-recip}.
22999 Enable the reciprocal approximation instructions for both
23000 single and double precision.
23003 Enable the single-precision reciprocal approximation instructions.
23006 Enable the double-precision reciprocal approximation instructions.
23009 Enable the reciprocal square root approximation instructions for both
23010 single and double precision.
23013 Enable the single-precision reciprocal square root approximation instructions.
23016 Enable the double-precision reciprocal square root approximation instructions.
23020 So, for example, @option{-mrecip=all,!rsqrtd} enables
23021 all of the reciprocal estimate instructions, except for the
23022 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
23023 which handle the double-precision reciprocal square root calculations.
23025 @item -mrecip-precision
23026 @itemx -mno-recip-precision
23027 @opindex mrecip-precision
23028 Assume (do not assume) that the reciprocal estimate instructions
23029 provide higher-precision estimates than is mandated by the PowerPC
23030 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
23031 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
23032 The double-precision square root estimate instructions are not generated by
23033 default on low-precision machines, since they do not provide an
23034 estimate that converges after three steps.
23036 @item -mpointers-to-nested-functions
23037 @itemx -mno-pointers-to-nested-functions
23038 @opindex mpointers-to-nested-functions
23039 Generate (do not generate) code to load up the static chain register
23040 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
23041 systems where a function pointer points to a 3-word descriptor giving
23042 the function address, TOC value to be loaded in register @code{r2}, and
23043 static chain value to be loaded in register @code{r11}. The
23044 @option{-mpointers-to-nested-functions} is on by default. You cannot
23045 call through pointers to nested functions or pointers
23046 to functions compiled in other languages that use the static chain if
23047 you use @option{-mno-pointers-to-nested-functions}.
23049 @item -msave-toc-indirect
23050 @itemx -mno-save-toc-indirect
23051 @opindex msave-toc-indirect
23052 Generate (do not generate) code to save the TOC value in the reserved
23053 stack location in the function prologue if the function calls through
23054 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
23055 saved in the prologue, it is saved just before the call through the
23056 pointer. The @option{-mno-save-toc-indirect} option is the default.
23058 @item -mcompat-align-parm
23059 @itemx -mno-compat-align-parm
23060 @opindex mcompat-align-parm
23061 Generate (do not generate) code to pass structure parameters with a
23062 maximum alignment of 64 bits, for compatibility with older versions
23065 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
23066 structure parameter on a 128-bit boundary when that structure contained
23067 a member requiring 128-bit alignment. This is corrected in more
23068 recent versions of GCC. This option may be used to generate code
23069 that is compatible with functions compiled with older versions of
23072 The @option{-mno-compat-align-parm} option is the default.
23074 @item -mstack-protector-guard=@var{guard}
23075 @itemx -mstack-protector-guard-reg=@var{reg}
23076 @itemx -mstack-protector-guard-offset=@var{offset}
23077 @itemx -mstack-protector-guard-symbol=@var{symbol}
23078 @opindex mstack-protector-guard
23079 @opindex mstack-protector-guard-reg
23080 @opindex mstack-protector-guard-offset
23081 @opindex mstack-protector-guard-symbol
23082 Generate stack protection code using canary at @var{guard}. Supported
23083 locations are @samp{global} for global canary or @samp{tls} for per-thread
23084 canary in the TLS block (the default with GNU libc version 2.4 or later).
23086 With the latter choice the options
23087 @option{-mstack-protector-guard-reg=@var{reg}} and
23088 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
23089 which register to use as base register for reading the canary, and from what
23090 offset from that base register. The default for those is as specified in the
23091 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
23092 the offset with a symbol reference to a canary in the TLS block.
23096 @node RISC-V Options
23097 @subsection RISC-V Options
23098 @cindex RISC-V Options
23100 These command-line options are defined for RISC-V targets:
23103 @item -mbranch-cost=@var{n}
23104 @opindex mbranch-cost
23105 Set the cost of branches to roughly @var{n} instructions.
23110 When generating PIC code, do or don't allow the use of PLTs. Ignored for
23111 non-PIC. The default is @option{-mplt}.
23113 @item -mabi=@var{ABI-string}
23115 Specify integer and floating-point calling convention. @var{ABI-string}
23116 contains two parts: the size of integer types and the registers used for
23117 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
23118 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
23119 32-bit), and that floating-point values up to 64 bits wide are passed in F
23120 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
23121 allows the compiler to generate code that uses the F and D extensions but only
23122 allows floating-point values up to 32 bits long to be passed in registers; or
23123 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
23124 passed in registers.
23126 The default for this argument is system dependent, users who want a specific
23127 calling convention should specify one explicitly. The valid calling
23128 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
23129 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
23130 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
23131 invalid because the ABI requires 64-bit values be passed in F registers, but F
23132 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
23133 only be used with the @samp{rv32e} architecture. This ABI is not well
23134 specified at present, and is subject to change.
23139 Do or don't use hardware floating-point divide and square root instructions.
23140 This requires the F or D extensions for floating-point registers. The default
23141 is to use them if the specified architecture has these instructions.
23146 Do or don't use hardware instructions for integer division. This requires the
23147 M extension. The default is to use them if the specified architecture has
23148 these instructions.
23150 @item -march=@var{ISA-string}
23152 Generate code for given RISC-V ISA (e.g.@ @samp{rv64im}). ISA strings must be
23153 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
23156 @item -mtune=@var{processor-string}
23158 Optimize the output for the given processor, specified by microarchitecture
23161 @item -mpreferred-stack-boundary=@var{num}
23162 @opindex mpreferred-stack-boundary
23163 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
23164 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
23165 the default is 4 (16 bytes or 128-bits).
23167 @strong{Warning:} If you use this switch, then you must build all modules with
23168 the same value, including any libraries. This includes the system libraries
23169 and startup modules.
23171 @item -msmall-data-limit=@var{n}
23172 @opindex msmall-data-limit
23173 Put global and static data smaller than @var{n} bytes into a special section
23176 @item -msave-restore
23177 @itemx -mno-save-restore
23178 @opindex msave-restore
23179 Do or don't use smaller but slower prologue and epilogue code that uses
23180 library function calls. The default is to use fast inline prologues and
23183 @item -mstrict-align
23184 @itemx -mno-strict-align
23185 @opindex mstrict-align
23186 Do not or do generate unaligned memory accesses. The default is set depending
23187 on whether the processor we are optimizing for supports fast unaligned access
23190 @item -mcmodel=medlow
23191 @opindex mcmodel=medlow
23192 Generate code for the medium-low code model. The program and its statically
23193 defined symbols must lie within a single 2 GiB address range and must lie
23194 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
23195 statically or dynamically linked. This is the default code model.
23197 @item -mcmodel=medany
23198 @opindex mcmodel=medany
23199 Generate code for the medium-any code model. The program and its statically
23200 defined symbols must be within any single 2 GiB address range. Programs can be
23201 statically or dynamically linked.
23203 @item -mexplicit-relocs
23204 @itemx -mno-exlicit-relocs
23205 Use or do not use assembler relocation operators when dealing with symbolic
23206 addresses. The alternative is to use assembler macros instead, which may
23207 limit optimization.
23211 Take advantage of linker relaxations to reduce the number of instructions
23212 required to materialize symbol addresses. The default is to take advantage of
23213 linker relaxations.
23218 @subsection RL78 Options
23219 @cindex RL78 Options
23225 Links in additional target libraries to support operation within a
23234 Specifies the type of hardware multiplication and division support to
23235 be used. The simplest is @code{none}, which uses software for both
23236 multiplication and division. This is the default. The @code{g13}
23237 value is for the hardware multiply/divide peripheral found on the
23238 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
23239 the multiplication and division instructions supported by the RL78/G14
23240 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
23241 the value @code{mg10} is an alias for @code{none}.
23243 In addition a C preprocessor macro is defined, based upon the setting
23244 of this option. Possible values are: @code{__RL78_MUL_NONE__},
23245 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
23252 Specifies the RL78 core to target. The default is the G14 core, also
23253 known as an S3 core or just RL78. The G13 or S2 core does not have
23254 multiply or divide instructions, instead it uses a hardware peripheral
23255 for these operations. The G10 or S1 core does not have register
23256 banks, so it uses a different calling convention.
23258 If this option is set it also selects the type of hardware multiply
23259 support to use, unless this is overridden by an explicit
23260 @option{-mmul=none} option on the command line. Thus specifying
23261 @option{-mcpu=g13} enables the use of the G13 hardware multiply
23262 peripheral and specifying @option{-mcpu=g10} disables the use of
23263 hardware multiplications altogether.
23265 Note, although the RL78/G14 core is the default target, specifying
23266 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
23267 change the behavior of the toolchain since it also enables G14
23268 hardware multiply support. If these options are not specified on the
23269 command line then software multiplication routines will be used even
23270 though the code targets the RL78 core. This is for backwards
23271 compatibility with older toolchains which did not have hardware
23272 multiply and divide support.
23274 In addition a C preprocessor macro is defined, based upon the setting
23275 of this option. Possible values are: @code{__RL78_G10__},
23276 @code{__RL78_G13__} or @code{__RL78_G14__}.
23286 These are aliases for the corresponding @option{-mcpu=} option. They
23287 are provided for backwards compatibility.
23291 Allow the compiler to use all of the available registers. By default
23292 registers @code{r24..r31} are reserved for use in interrupt handlers.
23293 With this option enabled these registers can be used in ordinary
23296 @item -m64bit-doubles
23297 @itemx -m32bit-doubles
23298 @opindex m64bit-doubles
23299 @opindex m32bit-doubles
23300 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
23301 or 32 bits (@option{-m32bit-doubles}) in size. The default is
23302 @option{-m32bit-doubles}.
23304 @item -msave-mduc-in-interrupts
23305 @itemx -mno-save-mduc-in-interrupts
23306 @opindex msave-mduc-in-interrupts
23307 @opindex mno-save-mduc-in-interrupts
23308 Specifies that interrupt handler functions should preserve the
23309 MDUC registers. This is only necessary if normal code might use
23310 the MDUC registers, for example because it performs multiplication
23311 and division operations. The default is to ignore the MDUC registers
23312 as this makes the interrupt handlers faster. The target option -mg13
23313 needs to be passed for this to work as this feature is only available
23314 on the G13 target (S2 core). The MDUC registers will only be saved
23315 if the interrupt handler performs a multiplication or division
23316 operation or it calls another function.
23320 @node RS/6000 and PowerPC Options
23321 @subsection IBM RS/6000 and PowerPC Options
23322 @cindex RS/6000 and PowerPC Options
23323 @cindex IBM RS/6000 and PowerPC Options
23325 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
23327 @item -mpowerpc-gpopt
23328 @itemx -mno-powerpc-gpopt
23329 @itemx -mpowerpc-gfxopt
23330 @itemx -mno-powerpc-gfxopt
23333 @itemx -mno-powerpc64
23337 @itemx -mno-popcntb
23339 @itemx -mno-popcntd
23348 @itemx -mno-hard-dfp
23349 @opindex mpowerpc-gpopt
23350 @opindex mno-powerpc-gpopt
23351 @opindex mpowerpc-gfxopt
23352 @opindex mno-powerpc-gfxopt
23353 @opindex mpowerpc64
23354 @opindex mno-powerpc64
23358 @opindex mno-popcntb
23360 @opindex mno-popcntd
23366 @opindex mno-mfpgpr
23368 @opindex mno-hard-dfp
23369 You use these options to specify which instructions are available on the
23370 processor you are using. The default value of these options is
23371 determined when configuring GCC@. Specifying the
23372 @option{-mcpu=@var{cpu_type}} overrides the specification of these
23373 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
23374 rather than the options listed above.
23376 Specifying @option{-mpowerpc-gpopt} allows
23377 GCC to use the optional PowerPC architecture instructions in the
23378 General Purpose group, including floating-point square root. Specifying
23379 @option{-mpowerpc-gfxopt} allows GCC to
23380 use the optional PowerPC architecture instructions in the Graphics
23381 group, including floating-point select.
23383 The @option{-mmfcrf} option allows GCC to generate the move from
23384 condition register field instruction implemented on the POWER4
23385 processor and other processors that support the PowerPC V2.01
23387 The @option{-mpopcntb} option allows GCC to generate the popcount and
23388 double-precision FP reciprocal estimate instruction implemented on the
23389 POWER5 processor and other processors that support the PowerPC V2.02
23391 The @option{-mpopcntd} option allows GCC to generate the popcount
23392 instruction implemented on the POWER7 processor and other processors
23393 that support the PowerPC V2.06 architecture.
23394 The @option{-mfprnd} option allows GCC to generate the FP round to
23395 integer instructions implemented on the POWER5+ processor and other
23396 processors that support the PowerPC V2.03 architecture.
23397 The @option{-mcmpb} option allows GCC to generate the compare bytes
23398 instruction implemented on the POWER6 processor and other processors
23399 that support the PowerPC V2.05 architecture.
23400 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
23401 general-purpose register instructions implemented on the POWER6X
23402 processor and other processors that support the extended PowerPC V2.05
23404 The @option{-mhard-dfp} option allows GCC to generate the decimal
23405 floating-point instructions implemented on some POWER processors.
23407 The @option{-mpowerpc64} option allows GCC to generate the additional
23408 64-bit instructions that are found in the full PowerPC64 architecture
23409 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
23410 @option{-mno-powerpc64}.
23412 @item -mcpu=@var{cpu_type}
23414 Set architecture type, register usage, and
23415 instruction scheduling parameters for machine type @var{cpu_type}.
23416 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
23417 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
23418 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
23419 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
23420 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
23421 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
23422 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
23423 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
23424 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
23425 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
23426 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
23427 @samp{rs64}, and @samp{native}.
23429 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
23430 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
23431 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
23432 architecture machine types, with an appropriate, generic processor
23433 model assumed for scheduling purposes.
23435 Specifying @samp{native} as cpu type detects and selects the
23436 architecture option that corresponds to the host processor of the
23437 system performing the compilation.
23438 @option{-mcpu=native} has no effect if GCC does not recognize the
23441 The other options specify a specific processor. Code generated under
23442 those options runs best on that processor, and may not run at all on
23445 The @option{-mcpu} options automatically enable or disable the
23448 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
23449 -mpopcntb -mpopcntd -mpowerpc64 @gol
23450 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
23451 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
23452 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
23453 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
23455 The particular options set for any particular CPU varies between
23456 compiler versions, depending on what setting seems to produce optimal
23457 code for that CPU; it doesn't necessarily reflect the actual hardware's
23458 capabilities. If you wish to set an individual option to a particular
23459 value, you may specify it after the @option{-mcpu} option, like
23460 @option{-mcpu=970 -mno-altivec}.
23462 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
23463 not enabled or disabled by the @option{-mcpu} option at present because
23464 AIX does not have full support for these options. You may still
23465 enable or disable them individually if you're sure it'll work in your
23468 @item -mtune=@var{cpu_type}
23470 Set the instruction scheduling parameters for machine type
23471 @var{cpu_type}, but do not set the architecture type or register usage,
23472 as @option{-mcpu=@var{cpu_type}} does. The same
23473 values for @var{cpu_type} are used for @option{-mtune} as for
23474 @option{-mcpu}. If both are specified, the code generated uses the
23475 architecture and registers set by @option{-mcpu}, but the
23476 scheduling parameters set by @option{-mtune}.
23478 @item -mcmodel=small
23479 @opindex mcmodel=small
23480 Generate PowerPC64 code for the small model: The TOC is limited to
23483 @item -mcmodel=medium
23484 @opindex mcmodel=medium
23485 Generate PowerPC64 code for the medium model: The TOC and other static
23486 data may be up to a total of 4G in size. This is the default for 64-bit
23489 @item -mcmodel=large
23490 @opindex mcmodel=large
23491 Generate PowerPC64 code for the large model: The TOC may be up to 4G
23492 in size. Other data and code is only limited by the 64-bit address
23496 @itemx -mno-altivec
23498 @opindex mno-altivec
23499 Generate code that uses (does not use) AltiVec instructions, and also
23500 enable the use of built-in functions that allow more direct access to
23501 the AltiVec instruction set. You may also need to set
23502 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
23505 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
23506 @option{-maltivec=be}, the element order for AltiVec intrinsics such
23507 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
23508 match array element order corresponding to the endianness of the
23509 target. That is, element zero identifies the leftmost element in a
23510 vector register when targeting a big-endian platform, and identifies
23511 the rightmost element in a vector register when targeting a
23512 little-endian platform.
23515 @opindex maltivec=be
23516 Generate AltiVec instructions using big-endian element order,
23517 regardless of whether the target is big- or little-endian. This is
23518 the default when targeting a big-endian platform. Using this option
23519 is currently deprecated. Support for this feature will be removed in
23522 The element order is used to interpret element numbers in AltiVec
23523 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
23524 @code{vec_insert}. By default, these match array element order
23525 corresponding to the endianness for the target.
23528 @opindex maltivec=le
23529 Generate AltiVec instructions using little-endian element order,
23530 regardless of whether the target is big- or little-endian. This is
23531 the default when targeting a little-endian platform. This option is
23532 currently ignored when targeting a big-endian platform.
23534 The element order is used to interpret element numbers in AltiVec
23535 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
23536 @code{vec_insert}. By default, these match array element order
23537 corresponding to the endianness for the target.
23542 @opindex mno-vrsave
23543 Generate VRSAVE instructions when generating AltiVec code.
23546 @opindex msecure-plt
23547 Generate code that allows @command{ld} and @command{ld.so}
23548 to build executables and shared
23549 libraries with non-executable @code{.plt} and @code{.got} sections.
23551 32-bit SYSV ABI option.
23555 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
23557 requires @code{.plt} and @code{.got}
23558 sections that are both writable and executable.
23559 This is a PowerPC 32-bit SYSV ABI option.
23565 This switch enables or disables the generation of ISEL instructions.
23567 @item -misel=@var{yes/no}
23568 This switch has been deprecated. Use @option{-misel} and
23569 @option{-mno-isel} instead.
23575 Generate code that uses (does not use) vector/scalar (VSX)
23576 instructions, and also enable the use of built-in functions that allow
23577 more direct access to the VSX instruction set.
23582 @opindex mno-crypto
23583 Enable the use (disable) of the built-in functions that allow direct
23584 access to the cryptographic instructions that were added in version
23585 2.07 of the PowerPC ISA.
23591 Enable (disable) the use of the built-in functions that allow direct
23592 access to the Hardware Transactional Memory (HTM) instructions that
23593 were added in version 2.07 of the PowerPC ISA.
23595 @item -mpower8-fusion
23596 @itemx -mno-power8-fusion
23597 @opindex mpower8-fusion
23598 @opindex mno-power8-fusion
23599 Generate code that keeps (does not keeps) some integer operations
23600 adjacent so that the instructions can be fused together on power8 and
23603 @item -mpower8-vector
23604 @itemx -mno-power8-vector
23605 @opindex mpower8-vector
23606 @opindex mno-power8-vector
23607 Generate code that uses (does not use) the vector and scalar
23608 instructions that were added in version 2.07 of the PowerPC ISA. Also
23609 enable the use of built-in functions that allow more direct access to
23610 the vector instructions.
23612 @item -mquad-memory
23613 @itemx -mno-quad-memory
23614 @opindex mquad-memory
23615 @opindex mno-quad-memory
23616 Generate code that uses (does not use) the non-atomic quad word memory
23617 instructions. The @option{-mquad-memory} option requires use of
23620 @item -mquad-memory-atomic
23621 @itemx -mno-quad-memory-atomic
23622 @opindex mquad-memory-atomic
23623 @opindex mno-quad-memory-atomic
23624 Generate code that uses (does not use) the atomic quad word memory
23625 instructions. The @option{-mquad-memory-atomic} option requires use of
23629 @itemx -mno-float128
23631 @opindex mno-float128
23632 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
23633 and use either software emulation for IEEE 128-bit floating point or
23634 hardware instructions.
23636 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
23637 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
23638 use the IEEE 128-bit floating point support. The IEEE 128-bit
23639 floating point support only works on PowerPC Linux systems.
23641 The default for @option{-mfloat128} is enabled on PowerPC Linux
23642 systems using the VSX instruction set, and disabled on other systems.
23644 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
23645 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
23646 point support will also enable the generation of ISA 3.0 IEEE 128-bit
23647 floating point instructions. Otherwise, if you do not specify to
23648 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
23649 system, IEEE 128-bit floating point will be done with software
23652 @item -mfloat128-hardware
23653 @itemx -mno-float128-hardware
23654 @opindex mfloat128-hardware
23655 @opindex mno-float128-hardware
23656 Enable/disable using ISA 3.0 hardware instructions to support the
23657 @var{__float128} data type.
23659 The default for @option{-mfloat128-hardware} is enabled on PowerPC
23660 Linux systems using the ISA 3.0 instruction set, and disabled on other
23667 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
23668 targets (including GNU/Linux). The 32-bit environment sets int, long
23669 and pointer to 32 bits and generates code that runs on any PowerPC
23670 variant. The 64-bit environment sets int to 32 bits and long and
23671 pointer to 64 bits, and generates code for PowerPC64, as for
23672 @option{-mpowerpc64}.
23675 @itemx -mno-fp-in-toc
23676 @itemx -mno-sum-in-toc
23677 @itemx -mminimal-toc
23679 @opindex mno-fp-in-toc
23680 @opindex mno-sum-in-toc
23681 @opindex mminimal-toc
23682 Modify generation of the TOC (Table Of Contents), which is created for
23683 every executable file. The @option{-mfull-toc} option is selected by
23684 default. In that case, GCC allocates at least one TOC entry for
23685 each unique non-automatic variable reference in your program. GCC
23686 also places floating-point constants in the TOC@. However, only
23687 16,384 entries are available in the TOC@.
23689 If you receive a linker error message that saying you have overflowed
23690 the available TOC space, you can reduce the amount of TOC space used
23691 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
23692 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
23693 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
23694 generate code to calculate the sum of an address and a constant at
23695 run time instead of putting that sum into the TOC@. You may specify one
23696 or both of these options. Each causes GCC to produce very slightly
23697 slower and larger code at the expense of conserving TOC space.
23699 If you still run out of space in the TOC even when you specify both of
23700 these options, specify @option{-mminimal-toc} instead. This option causes
23701 GCC to make only one TOC entry for every file. When you specify this
23702 option, GCC produces code that is slower and larger but which
23703 uses extremely little TOC space. You may wish to use this option
23704 only on files that contain less frequently-executed code.
23710 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
23711 @code{long} type, and the infrastructure needed to support them.
23712 Specifying @option{-maix64} implies @option{-mpowerpc64},
23713 while @option{-maix32} disables the 64-bit ABI and
23714 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
23717 @itemx -mno-xl-compat
23718 @opindex mxl-compat
23719 @opindex mno-xl-compat
23720 Produce code that conforms more closely to IBM XL compiler semantics
23721 when using AIX-compatible ABI@. Pass floating-point arguments to
23722 prototyped functions beyond the register save area (RSA) on the stack
23723 in addition to argument FPRs. Do not assume that most significant
23724 double in 128-bit long double value is properly rounded when comparing
23725 values and converting to double. Use XL symbol names for long double
23728 The AIX calling convention was extended but not initially documented to
23729 handle an obscure K&R C case of calling a function that takes the
23730 address of its arguments with fewer arguments than declared. IBM XL
23731 compilers access floating-point arguments that do not fit in the
23732 RSA from the stack when a subroutine is compiled without
23733 optimization. Because always storing floating-point arguments on the
23734 stack is inefficient and rarely needed, this option is not enabled by
23735 default and only is necessary when calling subroutines compiled by IBM
23736 XL compilers without optimization.
23740 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
23741 application written to use message passing with special startup code to
23742 enable the application to run. The system must have PE installed in the
23743 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
23744 must be overridden with the @option{-specs=} option to specify the
23745 appropriate directory location. The Parallel Environment does not
23746 support threads, so the @option{-mpe} option and the @option{-pthread}
23747 option are incompatible.
23749 @item -malign-natural
23750 @itemx -malign-power
23751 @opindex malign-natural
23752 @opindex malign-power
23753 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
23754 @option{-malign-natural} overrides the ABI-defined alignment of larger
23755 types, such as floating-point doubles, on their natural size-based boundary.
23756 The option @option{-malign-power} instructs GCC to follow the ABI-specified
23757 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
23759 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
23763 @itemx -mhard-float
23764 @opindex msoft-float
23765 @opindex mhard-float
23766 Generate code that does not use (uses) the floating-point register set.
23767 Software floating-point emulation is provided if you use the
23768 @option{-msoft-float} option, and pass the option to GCC when linking.
23771 @itemx -mno-multiple
23773 @opindex mno-multiple
23774 Generate code that uses (does not use) the load multiple word
23775 instructions and the store multiple word instructions. These
23776 instructions are generated by default on POWER systems, and not
23777 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
23778 PowerPC systems, since those instructions do not work when the
23779 processor is in little-endian mode. The exceptions are PPC740 and
23780 PPC750 which permit these instructions in little-endian mode.
23785 @opindex mno-update
23786 Generate code that uses (does not use) the load or store instructions
23787 that update the base register to the address of the calculated memory
23788 location. These instructions are generated by default. If you use
23789 @option{-mno-update}, there is a small window between the time that the
23790 stack pointer is updated and the address of the previous frame is
23791 stored, which means code that walks the stack frame across interrupts or
23792 signals may get corrupted data.
23794 @item -mavoid-indexed-addresses
23795 @itemx -mno-avoid-indexed-addresses
23796 @opindex mavoid-indexed-addresses
23797 @opindex mno-avoid-indexed-addresses
23798 Generate code that tries to avoid (not avoid) the use of indexed load
23799 or store instructions. These instructions can incur a performance
23800 penalty on Power6 processors in certain situations, such as when
23801 stepping through large arrays that cross a 16M boundary. This option
23802 is enabled by default when targeting Power6 and disabled otherwise.
23805 @itemx -mno-fused-madd
23806 @opindex mfused-madd
23807 @opindex mno-fused-madd
23808 Generate code that uses (does not use) the floating-point multiply and
23809 accumulate instructions. These instructions are generated by default
23810 if hardware floating point is used. The machine-dependent
23811 @option{-mfused-madd} option is now mapped to the machine-independent
23812 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
23813 mapped to @option{-ffp-contract=off}.
23819 Generate code that uses (does not use) the half-word multiply and
23820 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
23821 These instructions are generated by default when targeting those
23828 Generate code that uses (does not use) the string-search @samp{dlmzb}
23829 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
23830 generated by default when targeting those processors.
23832 @item -mno-bit-align
23834 @opindex mno-bit-align
23835 @opindex mbit-align
23836 On System V.4 and embedded PowerPC systems do not (do) force structures
23837 and unions that contain bit-fields to be aligned to the base type of the
23840 For example, by default a structure containing nothing but 8
23841 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
23842 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
23843 the structure is aligned to a 1-byte boundary and is 1 byte in
23846 @item -mno-strict-align
23847 @itemx -mstrict-align
23848 @opindex mno-strict-align
23849 @opindex mstrict-align
23850 On System V.4 and embedded PowerPC systems do not (do) assume that
23851 unaligned memory references are handled by the system.
23853 @item -mrelocatable
23854 @itemx -mno-relocatable
23855 @opindex mrelocatable
23856 @opindex mno-relocatable
23857 Generate code that allows (does not allow) a static executable to be
23858 relocated to a different address at run time. A simple embedded
23859 PowerPC system loader should relocate the entire contents of
23860 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
23861 a table of 32-bit addresses generated by this option. For this to
23862 work, all objects linked together must be compiled with
23863 @option{-mrelocatable} or @option{-mrelocatable-lib}.
23864 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
23866 @item -mrelocatable-lib
23867 @itemx -mno-relocatable-lib
23868 @opindex mrelocatable-lib
23869 @opindex mno-relocatable-lib
23870 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
23871 @code{.fixup} section to allow static executables to be relocated at
23872 run time, but @option{-mrelocatable-lib} does not use the smaller stack
23873 alignment of @option{-mrelocatable}. Objects compiled with
23874 @option{-mrelocatable-lib} may be linked with objects compiled with
23875 any combination of the @option{-mrelocatable} options.
23881 On System V.4 and embedded PowerPC systems do not (do) assume that
23882 register 2 contains a pointer to a global area pointing to the addresses
23883 used in the program.
23886 @itemx -mlittle-endian
23888 @opindex mlittle-endian
23889 On System V.4 and embedded PowerPC systems compile code for the
23890 processor in little-endian mode. The @option{-mlittle-endian} option is
23891 the same as @option{-mlittle}.
23894 @itemx -mbig-endian
23896 @opindex mbig-endian
23897 On System V.4 and embedded PowerPC systems compile code for the
23898 processor in big-endian mode. The @option{-mbig-endian} option is
23899 the same as @option{-mbig}.
23901 @item -mdynamic-no-pic
23902 @opindex mdynamic-no-pic
23903 On Darwin and Mac OS X systems, compile code so that it is not
23904 relocatable, but that its external references are relocatable. The
23905 resulting code is suitable for applications, but not shared
23908 @item -msingle-pic-base
23909 @opindex msingle-pic-base
23910 Treat the register used for PIC addressing as read-only, rather than
23911 loading it in the prologue for each function. The runtime system is
23912 responsible for initializing this register with an appropriate value
23913 before execution begins.
23915 @item -mprioritize-restricted-insns=@var{priority}
23916 @opindex mprioritize-restricted-insns
23917 This option controls the priority that is assigned to
23918 dispatch-slot restricted instructions during the second scheduling
23919 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
23920 or @samp{2} to assign no, highest, or second-highest (respectively)
23921 priority to dispatch-slot restricted
23924 @item -msched-costly-dep=@var{dependence_type}
23925 @opindex msched-costly-dep
23926 This option controls which dependences are considered costly
23927 by the target during instruction scheduling. The argument
23928 @var{dependence_type} takes one of the following values:
23932 No dependence is costly.
23935 All dependences are costly.
23937 @item @samp{true_store_to_load}
23938 A true dependence from store to load is costly.
23940 @item @samp{store_to_load}
23941 Any dependence from store to load is costly.
23944 Any dependence for which the latency is greater than or equal to
23945 @var{number} is costly.
23948 @item -minsert-sched-nops=@var{scheme}
23949 @opindex minsert-sched-nops
23950 This option controls which NOP insertion scheme is used during
23951 the second scheduling pass. The argument @var{scheme} takes one of the
23959 Pad with NOPs any dispatch group that has vacant issue slots,
23960 according to the scheduler's grouping.
23962 @item @samp{regroup_exact}
23963 Insert NOPs to force costly dependent insns into
23964 separate groups. Insert exactly as many NOPs as needed to force an insn
23965 to a new group, according to the estimated processor grouping.
23968 Insert NOPs to force costly dependent insns into
23969 separate groups. Insert @var{number} NOPs to force an insn to a new group.
23973 @opindex mcall-sysv
23974 On System V.4 and embedded PowerPC systems compile code using calling
23975 conventions that adhere to the March 1995 draft of the System V
23976 Application Binary Interface, PowerPC processor supplement. This is the
23977 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
23979 @item -mcall-sysv-eabi
23981 @opindex mcall-sysv-eabi
23982 @opindex mcall-eabi
23983 Specify both @option{-mcall-sysv} and @option{-meabi} options.
23985 @item -mcall-sysv-noeabi
23986 @opindex mcall-sysv-noeabi
23987 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
23989 @item -mcall-aixdesc
23991 On System V.4 and embedded PowerPC systems compile code for the AIX
23995 @opindex mcall-linux
23996 On System V.4 and embedded PowerPC systems compile code for the
23997 Linux-based GNU system.
23999 @item -mcall-freebsd
24000 @opindex mcall-freebsd
24001 On System V.4 and embedded PowerPC systems compile code for the
24002 FreeBSD operating system.
24004 @item -mcall-netbsd
24005 @opindex mcall-netbsd
24006 On System V.4 and embedded PowerPC systems compile code for the
24007 NetBSD operating system.
24009 @item -mcall-openbsd
24010 @opindex mcall-netbsd
24011 On System V.4 and embedded PowerPC systems compile code for the
24012 OpenBSD operating system.
24014 @item -mtraceback=@var{traceback_type}
24015 @opindex mtraceback
24016 Select the type of traceback table. Valid values for @var{traceback_type}
24017 are @samp{full}, @samp{part}, and @samp{no}.
24019 @item -maix-struct-return
24020 @opindex maix-struct-return
24021 Return all structures in memory (as specified by the AIX ABI)@.
24023 @item -msvr4-struct-return
24024 @opindex msvr4-struct-return
24025 Return structures smaller than 8 bytes in registers (as specified by the
24028 @item -mabi=@var{abi-type}
24030 Extend the current ABI with a particular extension, or remove such extension.
24031 Valid values are @samp{altivec}, @samp{no-altivec},
24032 @samp{ibmlongdouble}, @samp{ieeelongdouble},
24033 @samp{elfv1}, @samp{elfv2}@.
24035 @item -mabi=ibmlongdouble
24036 @opindex mabi=ibmlongdouble
24037 Change the current ABI to use IBM extended-precision long double.
24038 This is not likely to work if your system defaults to using IEEE
24039 extended-precision long double. If you change the long double type
24040 from IEEE extended-precision, the compiler will issue a warning unless
24041 you use the @option{-Wno-psabi} option.
24043 @item -mabi=ieeelongdouble
24044 @opindex mabi=ieeelongdouble
24045 Change the current ABI to use IEEE extended-precision long double.
24046 This is not likely to work if your system defaults to using IBM
24047 extended-precision long double. If you change the long double type
24048 from IBM extended-precision, the compiler will issue a warning unless
24049 you use the @option{-Wno-psabi} option.
24052 @opindex mabi=elfv1
24053 Change the current ABI to use the ELFv1 ABI.
24054 This is the default ABI for big-endian PowerPC 64-bit Linux.
24055 Overriding the default ABI requires special system support and is
24056 likely to fail in spectacular ways.
24059 @opindex mabi=elfv2
24060 Change the current ABI to use the ELFv2 ABI.
24061 This is the default ABI for little-endian PowerPC 64-bit Linux.
24062 Overriding the default ABI requires special system support and is
24063 likely to fail in spectacular ways.
24065 @item -mgnu-attribute
24066 @itemx -mno-gnu-attribute
24067 @opindex mgnu-attribute
24068 @opindex mno-gnu-attribute
24069 Emit .gnu_attribute assembly directives to set tag/value pairs in a
24070 .gnu.attributes section that specify ABI variations in function
24071 parameters or return values.
24074 @itemx -mno-prototype
24075 @opindex mprototype
24076 @opindex mno-prototype
24077 On System V.4 and embedded PowerPC systems assume that all calls to
24078 variable argument functions are properly prototyped. Otherwise, the
24079 compiler must insert an instruction before every non-prototyped call to
24080 set or clear bit 6 of the condition code register (@code{CR}) to
24081 indicate whether floating-point values are passed in the floating-point
24082 registers in case the function takes variable arguments. With
24083 @option{-mprototype}, only calls to prototyped variable argument functions
24084 set or clear the bit.
24088 On embedded PowerPC systems, assume that the startup module is called
24089 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
24090 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
24095 On embedded PowerPC systems, assume that the startup module is called
24096 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
24101 On embedded PowerPC systems, assume that the startup module is called
24102 @file{crt0.o} and the standard C libraries are @file{libads.a} and
24105 @item -myellowknife
24106 @opindex myellowknife
24107 On embedded PowerPC systems, assume that the startup module is called
24108 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
24113 On System V.4 and embedded PowerPC systems, specify that you are
24114 compiling for a VxWorks system.
24118 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
24119 header to indicate that @samp{eabi} extended relocations are used.
24125 On System V.4 and embedded PowerPC systems do (do not) adhere to the
24126 Embedded Applications Binary Interface (EABI), which is a set of
24127 modifications to the System V.4 specifications. Selecting @option{-meabi}
24128 means that the stack is aligned to an 8-byte boundary, a function
24129 @code{__eabi} is called from @code{main} to set up the EABI
24130 environment, and the @option{-msdata} option can use both @code{r2} and
24131 @code{r13} to point to two separate small data areas. Selecting
24132 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
24133 no EABI initialization function is called from @code{main}, and the
24134 @option{-msdata} option only uses @code{r13} to point to a single
24135 small data area. The @option{-meabi} option is on by default if you
24136 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
24139 @opindex msdata=eabi
24140 On System V.4 and embedded PowerPC systems, put small initialized
24141 @code{const} global and static data in the @code{.sdata2} section, which
24142 is pointed to by register @code{r2}. Put small initialized
24143 non-@code{const} global and static data in the @code{.sdata} section,
24144 which is pointed to by register @code{r13}. Put small uninitialized
24145 global and static data in the @code{.sbss} section, which is adjacent to
24146 the @code{.sdata} section. The @option{-msdata=eabi} option is
24147 incompatible with the @option{-mrelocatable} option. The
24148 @option{-msdata=eabi} option also sets the @option{-memb} option.
24151 @opindex msdata=sysv
24152 On System V.4 and embedded PowerPC systems, put small global and static
24153 data in the @code{.sdata} section, which is pointed to by register
24154 @code{r13}. Put small uninitialized global and static data in the
24155 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
24156 The @option{-msdata=sysv} option is incompatible with the
24157 @option{-mrelocatable} option.
24159 @item -msdata=default
24161 @opindex msdata=default
24163 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
24164 compile code the same as @option{-msdata=eabi}, otherwise compile code the
24165 same as @option{-msdata=sysv}.
24168 @opindex msdata=data
24169 On System V.4 and embedded PowerPC systems, put small global
24170 data in the @code{.sdata} section. Put small uninitialized global
24171 data in the @code{.sbss} section. Do not use register @code{r13}
24172 to address small data however. This is the default behavior unless
24173 other @option{-msdata} options are used.
24177 @opindex msdata=none
24179 On embedded PowerPC systems, put all initialized global and static data
24180 in the @code{.data} section, and all uninitialized data in the
24181 @code{.bss} section.
24183 @item -mreadonly-in-sdata
24184 @opindex mreadonly-in-sdata
24185 @opindex mno-readonly-in-sdata
24186 Put read-only objects in the @code{.sdata} section as well. This is the
24189 @item -mblock-move-inline-limit=@var{num}
24190 @opindex mblock-move-inline-limit
24191 Inline all block moves (such as calls to @code{memcpy} or structure
24192 copies) less than or equal to @var{num} bytes. The minimum value for
24193 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
24194 targets. The default value is target-specific.
24196 @item -mblock-compare-inline-limit=@var{num}
24197 @opindex mblock-compare-inline-limit
24198 Generate non-looping inline code for all block compares (such as calls
24199 to @code{memcmp} or structure compares) less than or equal to @var{num}
24200 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
24201 block compare is disabled. The default value is target-specific.
24203 @item -mblock-compare-inline-loop-limit=@var{num}
24204 @opindex mblock-compare-inline-loop-limit
24205 Generate an inline expansion using loop code for all block compares that
24206 are less than or equal to @var{num} bytes, but greater than the limit
24207 for non-loop inline block compare expansion. If the block length is not
24208 constant, at most @var{num} bytes will be compared before @code{memcmp}
24209 is called to compare the remainder of the block. The default value is
24212 @item -mstring-compare-inline-limit=@var{num}
24213 @opindex mstring-compare-inline-limit
24214 Generate at most @var{num} pairs of load instructions to compare the
24215 string inline. If the difference or end of string is not found at the
24216 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
24217 take care of the rest of the comparison. The default is 8 pairs of
24218 loads, which will compare 64 bytes on a 64-bit target and 32 bytes on a
24223 @cindex smaller data references (PowerPC)
24224 @cindex .sdata/.sdata2 references (PowerPC)
24225 On embedded PowerPC systems, put global and static items less than or
24226 equal to @var{num} bytes into the small data or BSS sections instead of
24227 the normal data or BSS section. By default, @var{num} is 8. The
24228 @option{-G @var{num}} switch is also passed to the linker.
24229 All modules should be compiled with the same @option{-G @var{num}} value.
24232 @itemx -mno-regnames
24234 @opindex mno-regnames
24235 On System V.4 and embedded PowerPC systems do (do not) emit register
24236 names in the assembly language output using symbolic forms.
24239 @itemx -mno-longcall
24241 @opindex mno-longcall
24242 By default assume that all calls are far away so that a longer and more
24243 expensive calling sequence is required. This is required for calls
24244 farther than 32 megabytes (33,554,432 bytes) from the current location.
24245 A short call is generated if the compiler knows
24246 the call cannot be that far away. This setting can be overridden by
24247 the @code{shortcall} function attribute, or by @code{#pragma
24250 Some linkers are capable of detecting out-of-range calls and generating
24251 glue code on the fly. On these systems, long calls are unnecessary and
24252 generate slower code. As of this writing, the AIX linker can do this,
24253 as can the GNU linker for PowerPC/64. It is planned to add this feature
24254 to the GNU linker for 32-bit PowerPC systems as well.
24256 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
24257 callee, L42}, plus a @dfn{branch island} (glue code). The two target
24258 addresses represent the callee and the branch island. The
24259 Darwin/PPC linker prefers the first address and generates a @code{bl
24260 callee} if the PPC @code{bl} instruction reaches the callee directly;
24261 otherwise, the linker generates @code{bl L42} to call the branch
24262 island. The branch island is appended to the body of the
24263 calling function; it computes the full 32-bit address of the callee
24266 On Mach-O (Darwin) systems, this option directs the compiler emit to
24267 the glue for every direct call, and the Darwin linker decides whether
24268 to use or discard it.
24270 In the future, GCC may ignore all longcall specifications
24271 when the linker is known to generate glue.
24273 @item -mtls-markers
24274 @itemx -mno-tls-markers
24275 @opindex mtls-markers
24276 @opindex mno-tls-markers
24277 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
24278 specifying the function argument. The relocation allows the linker to
24279 reliably associate function call with argument setup instructions for
24280 TLS optimization, which in turn allows GCC to better schedule the
24286 This option enables use of the reciprocal estimate and
24287 reciprocal square root estimate instructions with additional
24288 Newton-Raphson steps to increase precision instead of doing a divide or
24289 square root and divide for floating-point arguments. You should use
24290 the @option{-ffast-math} option when using @option{-mrecip} (or at
24291 least @option{-funsafe-math-optimizations},
24292 @option{-ffinite-math-only}, @option{-freciprocal-math} and
24293 @option{-fno-trapping-math}). Note that while the throughput of the
24294 sequence is generally higher than the throughput of the non-reciprocal
24295 instruction, the precision of the sequence can be decreased by up to 2
24296 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
24299 @item -mrecip=@var{opt}
24300 @opindex mrecip=opt
24301 This option controls which reciprocal estimate instructions
24302 may be used. @var{opt} is a comma-separated list of options, which may
24303 be preceded by a @code{!} to invert the option:
24308 Enable all estimate instructions.
24311 Enable the default instructions, equivalent to @option{-mrecip}.
24314 Disable all estimate instructions, equivalent to @option{-mno-recip}.
24317 Enable the reciprocal approximation instructions for both
24318 single and double precision.
24321 Enable the single-precision reciprocal approximation instructions.
24324 Enable the double-precision reciprocal approximation instructions.
24327 Enable the reciprocal square root approximation instructions for both
24328 single and double precision.
24331 Enable the single-precision reciprocal square root approximation instructions.
24334 Enable the double-precision reciprocal square root approximation instructions.
24338 So, for example, @option{-mrecip=all,!rsqrtd} enables
24339 all of the reciprocal estimate instructions, except for the
24340 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
24341 which handle the double-precision reciprocal square root calculations.
24343 @item -mrecip-precision
24344 @itemx -mno-recip-precision
24345 @opindex mrecip-precision
24346 Assume (do not assume) that the reciprocal estimate instructions
24347 provide higher-precision estimates than is mandated by the PowerPC
24348 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
24349 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
24350 The double-precision square root estimate instructions are not generated by
24351 default on low-precision machines, since they do not provide an
24352 estimate that converges after three steps.
24354 @item -mveclibabi=@var{type}
24355 @opindex mveclibabi
24356 Specifies the ABI type to use for vectorizing intrinsics using an
24357 external library. The only type supported at present is @samp{mass},
24358 which specifies to use IBM's Mathematical Acceleration Subsystem
24359 (MASS) libraries for vectorizing intrinsics using external libraries.
24360 GCC currently emits calls to @code{acosd2}, @code{acosf4},
24361 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
24362 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
24363 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
24364 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
24365 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
24366 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
24367 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
24368 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
24369 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
24370 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
24371 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
24372 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
24373 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
24374 for power7. Both @option{-ftree-vectorize} and
24375 @option{-funsafe-math-optimizations} must also be enabled. The MASS
24376 libraries must be specified at link time.
24381 Generate (do not generate) the @code{friz} instruction when the
24382 @option{-funsafe-math-optimizations} option is used to optimize
24383 rounding of floating-point values to 64-bit integer and back to floating
24384 point. The @code{friz} instruction does not return the same value if
24385 the floating-point number is too large to fit in an integer.
24387 @item -mpointers-to-nested-functions
24388 @itemx -mno-pointers-to-nested-functions
24389 @opindex mpointers-to-nested-functions
24390 Generate (do not generate) code to load up the static chain register
24391 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
24392 systems where a function pointer points to a 3-word descriptor giving
24393 the function address, TOC value to be loaded in register @code{r2}, and
24394 static chain value to be loaded in register @code{r11}. The
24395 @option{-mpointers-to-nested-functions} is on by default. You cannot
24396 call through pointers to nested functions or pointers
24397 to functions compiled in other languages that use the static chain if
24398 you use @option{-mno-pointers-to-nested-functions}.
24400 @item -msave-toc-indirect
24401 @itemx -mno-save-toc-indirect
24402 @opindex msave-toc-indirect
24403 Generate (do not generate) code to save the TOC value in the reserved
24404 stack location in the function prologue if the function calls through
24405 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
24406 saved in the prologue, it is saved just before the call through the
24407 pointer. The @option{-mno-save-toc-indirect} option is the default.
24409 @item -mcompat-align-parm
24410 @itemx -mno-compat-align-parm
24411 @opindex mcompat-align-parm
24412 Generate (do not generate) code to pass structure parameters with a
24413 maximum alignment of 64 bits, for compatibility with older versions
24416 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
24417 structure parameter on a 128-bit boundary when that structure contained
24418 a member requiring 128-bit alignment. This is corrected in more
24419 recent versions of GCC. This option may be used to generate code
24420 that is compatible with functions compiled with older versions of
24423 The @option{-mno-compat-align-parm} option is the default.
24425 @item -mstack-protector-guard=@var{guard}
24426 @itemx -mstack-protector-guard-reg=@var{reg}
24427 @itemx -mstack-protector-guard-offset=@var{offset}
24428 @itemx -mstack-protector-guard-symbol=@var{symbol}
24429 @opindex mstack-protector-guard
24430 @opindex mstack-protector-guard-reg
24431 @opindex mstack-protector-guard-offset
24432 @opindex mstack-protector-guard-symbol
24433 Generate stack protection code using canary at @var{guard}. Supported
24434 locations are @samp{global} for global canary or @samp{tls} for per-thread
24435 canary in the TLS block (the default with GNU libc version 2.4 or later).
24437 With the latter choice the options
24438 @option{-mstack-protector-guard-reg=@var{reg}} and
24439 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
24440 which register to use as base register for reading the canary, and from what
24441 offset from that base register. The default for those is as specified in the
24442 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
24443 the offset with a symbol reference to a canary in the TLS block.
24447 @subsection RX Options
24450 These command-line options are defined for RX targets:
24453 @item -m64bit-doubles
24454 @itemx -m32bit-doubles
24455 @opindex m64bit-doubles
24456 @opindex m32bit-doubles
24457 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24458 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24459 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
24460 works on 32-bit values, which is why the default is
24461 @option{-m32bit-doubles}.
24467 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
24468 floating-point hardware. The default is enabled for the RX600
24469 series and disabled for the RX200 series.
24471 Floating-point instructions are only generated for 32-bit floating-point
24472 values, however, so the FPU hardware is not used for doubles if the
24473 @option{-m64bit-doubles} option is used.
24475 @emph{Note} If the @option{-fpu} option is enabled then
24476 @option{-funsafe-math-optimizations} is also enabled automatically.
24477 This is because the RX FPU instructions are themselves unsafe.
24479 @item -mcpu=@var{name}
24481 Selects the type of RX CPU to be targeted. Currently three types are
24482 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
24483 the specific @samp{RX610} CPU. The default is @samp{RX600}.
24485 The only difference between @samp{RX600} and @samp{RX610} is that the
24486 @samp{RX610} does not support the @code{MVTIPL} instruction.
24488 The @samp{RX200} series does not have a hardware floating-point unit
24489 and so @option{-nofpu} is enabled by default when this type is
24492 @item -mbig-endian-data
24493 @itemx -mlittle-endian-data
24494 @opindex mbig-endian-data
24495 @opindex mlittle-endian-data
24496 Store data (but not code) in the big-endian format. The default is
24497 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
24500 @item -msmall-data-limit=@var{N}
24501 @opindex msmall-data-limit
24502 Specifies the maximum size in bytes of global and static variables
24503 which can be placed into the small data area. Using the small data
24504 area can lead to smaller and faster code, but the size of area is
24505 limited and it is up to the programmer to ensure that the area does
24506 not overflow. Also when the small data area is used one of the RX's
24507 registers (usually @code{r13}) is reserved for use pointing to this
24508 area, so it is no longer available for use by the compiler. This
24509 could result in slower and/or larger code if variables are pushed onto
24510 the stack instead of being held in this register.
24512 Note, common variables (variables that have not been initialized) and
24513 constants are not placed into the small data area as they are assigned
24514 to other sections in the output executable.
24516 The default value is zero, which disables this feature. Note, this
24517 feature is not enabled by default with higher optimization levels
24518 (@option{-O2} etc) because of the potentially detrimental effects of
24519 reserving a register. It is up to the programmer to experiment and
24520 discover whether this feature is of benefit to their program. See the
24521 description of the @option{-mpid} option for a description of how the
24522 actual register to hold the small data area pointer is chosen.
24528 Use the simulator runtime. The default is to use the libgloss
24529 board-specific runtime.
24531 @item -mas100-syntax
24532 @itemx -mno-as100-syntax
24533 @opindex mas100-syntax
24534 @opindex mno-as100-syntax
24535 When generating assembler output use a syntax that is compatible with
24536 Renesas's AS100 assembler. This syntax can also be handled by the GAS
24537 assembler, but it has some restrictions so it is not generated by default.
24539 @item -mmax-constant-size=@var{N}
24540 @opindex mmax-constant-size
24541 Specifies the maximum size, in bytes, of a constant that can be used as
24542 an operand in a RX instruction. Although the RX instruction set does
24543 allow constants of up to 4 bytes in length to be used in instructions,
24544 a longer value equates to a longer instruction. Thus in some
24545 circumstances it can be beneficial to restrict the size of constants
24546 that are used in instructions. Constants that are too big are instead
24547 placed into a constant pool and referenced via register indirection.
24549 The value @var{N} can be between 0 and 4. A value of 0 (the default)
24550 or 4 means that constants of any size are allowed.
24554 Enable linker relaxation. Linker relaxation is a process whereby the
24555 linker attempts to reduce the size of a program by finding shorter
24556 versions of various instructions. Disabled by default.
24558 @item -mint-register=@var{N}
24559 @opindex mint-register
24560 Specify the number of registers to reserve for fast interrupt handler
24561 functions. The value @var{N} can be between 0 and 4. A value of 1
24562 means that register @code{r13} is reserved for the exclusive use
24563 of fast interrupt handlers. A value of 2 reserves @code{r13} and
24564 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
24565 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
24566 A value of 0, the default, does not reserve any registers.
24568 @item -msave-acc-in-interrupts
24569 @opindex msave-acc-in-interrupts
24570 Specifies that interrupt handler functions should preserve the
24571 accumulator register. This is only necessary if normal code might use
24572 the accumulator register, for example because it performs 64-bit
24573 multiplications. The default is to ignore the accumulator as this
24574 makes the interrupt handlers faster.
24580 Enables the generation of position independent data. When enabled any
24581 access to constant data is done via an offset from a base address
24582 held in a register. This allows the location of constant data to be
24583 determined at run time without requiring the executable to be
24584 relocated, which is a benefit to embedded applications with tight
24585 memory constraints. Data that can be modified is not affected by this
24588 Note, using this feature reserves a register, usually @code{r13}, for
24589 the constant data base address. This can result in slower and/or
24590 larger code, especially in complicated functions.
24592 The actual register chosen to hold the constant data base address
24593 depends upon whether the @option{-msmall-data-limit} and/or the
24594 @option{-mint-register} command-line options are enabled. Starting
24595 with register @code{r13} and proceeding downwards, registers are
24596 allocated first to satisfy the requirements of @option{-mint-register},
24597 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
24598 is possible for the small data area register to be @code{r8} if both
24599 @option{-mint-register=4} and @option{-mpid} are specified on the
24602 By default this feature is not enabled. The default can be restored
24603 via the @option{-mno-pid} command-line option.
24605 @item -mno-warn-multiple-fast-interrupts
24606 @itemx -mwarn-multiple-fast-interrupts
24607 @opindex mno-warn-multiple-fast-interrupts
24608 @opindex mwarn-multiple-fast-interrupts
24609 Prevents GCC from issuing a warning message if it finds more than one
24610 fast interrupt handler when it is compiling a file. The default is to
24611 issue a warning for each extra fast interrupt handler found, as the RX
24612 only supports one such interrupt.
24614 @item -mallow-string-insns
24615 @itemx -mno-allow-string-insns
24616 @opindex mallow-string-insns
24617 @opindex mno-allow-string-insns
24618 Enables or disables the use of the string manipulation instructions
24619 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
24620 @code{SWHILE} and also the @code{RMPA} instruction. These
24621 instructions may prefetch data, which is not safe to do if accessing
24622 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
24623 for more information).
24625 The default is to allow these instructions, but it is not possible for
24626 GCC to reliably detect all circumstances where a string instruction
24627 might be used to access an I/O register, so their use cannot be
24628 disabled automatically. Instead it is reliant upon the programmer to
24629 use the @option{-mno-allow-string-insns} option if their program
24630 accesses I/O space.
24632 When the instructions are enabled GCC defines the C preprocessor
24633 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
24634 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
24640 Use only (or not only) @code{JSR} instructions to access functions.
24641 This option can be used when code size exceeds the range of @code{BSR}
24642 instructions. Note that @option{-mno-jsr} does not mean to not use
24643 @code{JSR} but instead means that any type of branch may be used.
24646 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
24647 has special significance to the RX port when used with the
24648 @code{interrupt} function attribute. This attribute indicates a
24649 function intended to process fast interrupts. GCC ensures
24650 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
24651 and/or @code{r13} and only provided that the normal use of the
24652 corresponding registers have been restricted via the
24653 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
24656 @node S/390 and zSeries Options
24657 @subsection S/390 and zSeries Options
24658 @cindex S/390 and zSeries Options
24660 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
24664 @itemx -msoft-float
24665 @opindex mhard-float
24666 @opindex msoft-float
24667 Use (do not use) the hardware floating-point instructions and registers
24668 for floating-point operations. When @option{-msoft-float} is specified,
24669 functions in @file{libgcc.a} are used to perform floating-point
24670 operations. When @option{-mhard-float} is specified, the compiler
24671 generates IEEE floating-point instructions. This is the default.
24674 @itemx -mno-hard-dfp
24676 @opindex mno-hard-dfp
24677 Use (do not use) the hardware decimal-floating-point instructions for
24678 decimal-floating-point operations. When @option{-mno-hard-dfp} is
24679 specified, functions in @file{libgcc.a} are used to perform
24680 decimal-floating-point operations. When @option{-mhard-dfp} is
24681 specified, the compiler generates decimal-floating-point hardware
24682 instructions. This is the default for @option{-march=z9-ec} or higher.
24684 @item -mlong-double-64
24685 @itemx -mlong-double-128
24686 @opindex mlong-double-64
24687 @opindex mlong-double-128
24688 These switches control the size of @code{long double} type. A size
24689 of 64 bits makes the @code{long double} type equivalent to the @code{double}
24690 type. This is the default.
24693 @itemx -mno-backchain
24694 @opindex mbackchain
24695 @opindex mno-backchain
24696 Store (do not store) the address of the caller's frame as backchain pointer
24697 into the callee's stack frame.
24698 A backchain may be needed to allow debugging using tools that do not understand
24699 DWARF call frame information.
24700 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
24701 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
24702 the backchain is placed into the topmost word of the 96/160 byte register
24705 In general, code compiled with @option{-mbackchain} is call-compatible with
24706 code compiled with @option{-mmo-backchain}; however, use of the backchain
24707 for debugging purposes usually requires that the whole binary is built with
24708 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
24709 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
24710 to build a linux kernel use @option{-msoft-float}.
24712 The default is to not maintain the backchain.
24714 @item -mpacked-stack
24715 @itemx -mno-packed-stack
24716 @opindex mpacked-stack
24717 @opindex mno-packed-stack
24718 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
24719 specified, the compiler uses the all fields of the 96/160 byte register save
24720 area only for their default purpose; unused fields still take up stack space.
24721 When @option{-mpacked-stack} is specified, register save slots are densely
24722 packed at the top of the register save area; unused space is reused for other
24723 purposes, allowing for more efficient use of the available stack space.
24724 However, when @option{-mbackchain} is also in effect, the topmost word of
24725 the save area is always used to store the backchain, and the return address
24726 register is always saved two words below the backchain.
24728 As long as the stack frame backchain is not used, code generated with
24729 @option{-mpacked-stack} is call-compatible with code generated with
24730 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
24731 S/390 or zSeries generated code that uses the stack frame backchain at run
24732 time, not just for debugging purposes. Such code is not call-compatible
24733 with code compiled with @option{-mpacked-stack}. Also, note that the
24734 combination of @option{-mbackchain},
24735 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
24736 to build a linux kernel use @option{-msoft-float}.
24738 The default is to not use the packed stack layout.
24741 @itemx -mno-small-exec
24742 @opindex msmall-exec
24743 @opindex mno-small-exec
24744 Generate (or do not generate) code using the @code{bras} instruction
24745 to do subroutine calls.
24746 This only works reliably if the total executable size does not
24747 exceed 64k. The default is to use the @code{basr} instruction instead,
24748 which does not have this limitation.
24754 When @option{-m31} is specified, generate code compliant to the
24755 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
24756 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
24757 particular to generate 64-bit instructions. For the @samp{s390}
24758 targets, the default is @option{-m31}, while the @samp{s390x}
24759 targets default to @option{-m64}.
24765 When @option{-mzarch} is specified, generate code using the
24766 instructions available on z/Architecture.
24767 When @option{-mesa} is specified, generate code using the
24768 instructions available on ESA/390. Note that @option{-mesa} is
24769 not possible with @option{-m64}.
24770 When generating code compliant to the GNU/Linux for S/390 ABI,
24771 the default is @option{-mesa}. When generating code compliant
24772 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
24778 The @option{-mhtm} option enables a set of builtins making use of
24779 instructions available with the transactional execution facility
24780 introduced with the IBM zEnterprise EC12 machine generation
24781 @ref{S/390 System z Built-in Functions}.
24782 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
24788 When @option{-mvx} is specified, generate code using the instructions
24789 available with the vector extension facility introduced with the IBM
24790 z13 machine generation.
24791 This option changes the ABI for some vector type values with regard to
24792 alignment and calling conventions. In case vector type values are
24793 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
24794 command will be added to mark the resulting binary with the ABI used.
24795 @option{-mvx} is enabled by default when using @option{-march=z13}.
24798 @itemx -mno-zvector
24800 @opindex mno-zvector
24801 The @option{-mzvector} option enables vector language extensions and
24802 builtins using instructions available with the vector extension
24803 facility introduced with the IBM z13 machine generation.
24804 This option adds support for @samp{vector} to be used as a keyword to
24805 define vector type variables and arguments. @samp{vector} is only
24806 available when GNU extensions are enabled. It will not be expanded
24807 when requesting strict standard compliance e.g. with @option{-std=c99}.
24808 In addition to the GCC low-level builtins @option{-mzvector} enables
24809 a set of builtins added for compatibility with AltiVec-style
24810 implementations like Power and Cell. In order to make use of these
24811 builtins the header file @file{vecintrin.h} needs to be included.
24812 @option{-mzvector} is disabled by default.
24818 Generate (or do not generate) code using the @code{mvcle} instruction
24819 to perform block moves. When @option{-mno-mvcle} is specified,
24820 use a @code{mvc} loop instead. This is the default unless optimizing for
24827 Print (or do not print) additional debug information when compiling.
24828 The default is to not print debug information.
24830 @item -march=@var{cpu-type}
24832 Generate code that runs on @var{cpu-type}, which is the name of a
24833 system representing a certain processor type. Possible values for
24834 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
24835 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
24836 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11}, and
24839 The default is @option{-march=z900}. @samp{g5}/@samp{arch3} and
24840 @samp{g6} are deprecated and will be removed with future releases.
24842 Specifying @samp{native} as cpu type can be used to select the best
24843 architecture option for the host processor.
24844 @option{-march=native} has no effect if GCC does not recognize the
24847 @item -mtune=@var{cpu-type}
24849 Tune to @var{cpu-type} everything applicable about the generated code,
24850 except for the ABI and the set of available instructions.
24851 The list of @var{cpu-type} values is the same as for @option{-march}.
24852 The default is the value used for @option{-march}.
24855 @itemx -mno-tpf-trace
24856 @opindex mtpf-trace
24857 @opindex mno-tpf-trace
24858 Generate code that adds (does not add) in TPF OS specific branches to trace
24859 routines in the operating system. This option is off by default, even
24860 when compiling for the TPF OS@.
24863 @itemx -mno-fused-madd
24864 @opindex mfused-madd
24865 @opindex mno-fused-madd
24866 Generate code that uses (does not use) the floating-point multiply and
24867 accumulate instructions. These instructions are generated by default if
24868 hardware floating point is used.
24870 @item -mwarn-framesize=@var{framesize}
24871 @opindex mwarn-framesize
24872 Emit a warning if the current function exceeds the given frame size. Because
24873 this is a compile-time check it doesn't need to be a real problem when the program
24874 runs. It is intended to identify functions that most probably cause
24875 a stack overflow. It is useful to be used in an environment with limited stack
24876 size e.g.@: the linux kernel.
24878 @item -mwarn-dynamicstack
24879 @opindex mwarn-dynamicstack
24880 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
24881 arrays. This is generally a bad idea with a limited stack size.
24883 @item -mstack-guard=@var{stack-guard}
24884 @itemx -mstack-size=@var{stack-size}
24885 @opindex mstack-guard
24886 @opindex mstack-size
24887 If these options are provided the S/390 back end emits additional instructions in
24888 the function prologue that trigger a trap if the stack size is @var{stack-guard}
24889 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
24890 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
24891 the frame size of the compiled function is chosen.
24892 These options are intended to be used to help debugging stack overflow problems.
24893 The additionally emitted code causes only little overhead and hence can also be
24894 used in production-like systems without greater performance degradation. The given
24895 values have to be exact powers of 2 and @var{stack-size} has to be greater than
24896 @var{stack-guard} without exceeding 64k.
24897 In order to be efficient the extra code makes the assumption that the stack starts
24898 at an address aligned to the value given by @var{stack-size}.
24899 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
24901 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
24903 If the hotpatch option is enabled, a ``hot-patching'' function
24904 prologue is generated for all functions in the compilation unit.
24905 The funtion label is prepended with the given number of two-byte
24906 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
24907 the label, 2 * @var{post-halfwords} bytes are appended, using the
24908 largest NOP like instructions the architecture allows (maximum
24911 If both arguments are zero, hotpatching is disabled.
24913 This option can be overridden for individual functions with the
24914 @code{hotpatch} attribute.
24917 @node Score Options
24918 @subsection Score Options
24919 @cindex Score Options
24921 These options are defined for Score implementations:
24926 Compile code for big-endian mode. This is the default.
24930 Compile code for little-endian mode.
24934 Disable generation of @code{bcnz} instructions.
24938 Enable generation of unaligned load and store instructions.
24942 Enable the use of multiply-accumulate instructions. Disabled by default.
24946 Specify the SCORE5 as the target architecture.
24950 Specify the SCORE5U of the target architecture.
24954 Specify the SCORE7 as the target architecture. This is the default.
24958 Specify the SCORE7D as the target architecture.
24962 @subsection SH Options
24964 These @samp{-m} options are defined for the SH implementations:
24969 Generate code for the SH1.
24973 Generate code for the SH2.
24976 Generate code for the SH2e.
24980 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
24981 that the floating-point unit is not used.
24983 @item -m2a-single-only
24984 @opindex m2a-single-only
24985 Generate code for the SH2a-FPU, in such a way that no double-precision
24986 floating-point operations are used.
24989 @opindex m2a-single
24990 Generate code for the SH2a-FPU assuming the floating-point unit is in
24991 single-precision mode by default.
24995 Generate code for the SH2a-FPU assuming the floating-point unit is in
24996 double-precision mode by default.
25000 Generate code for the SH3.
25004 Generate code for the SH3e.
25008 Generate code for the SH4 without a floating-point unit.
25010 @item -m4-single-only
25011 @opindex m4-single-only
25012 Generate code for the SH4 with a floating-point unit that only
25013 supports single-precision arithmetic.
25017 Generate code for the SH4 assuming the floating-point unit is in
25018 single-precision mode by default.
25022 Generate code for the SH4.
25026 Generate code for SH4-100.
25028 @item -m4-100-nofpu
25029 @opindex m4-100-nofpu
25030 Generate code for SH4-100 in such a way that the
25031 floating-point unit is not used.
25033 @item -m4-100-single
25034 @opindex m4-100-single
25035 Generate code for SH4-100 assuming the floating-point unit is in
25036 single-precision mode by default.
25038 @item -m4-100-single-only
25039 @opindex m4-100-single-only
25040 Generate code for SH4-100 in such a way that no double-precision
25041 floating-point operations are used.
25045 Generate code for SH4-200.
25047 @item -m4-200-nofpu
25048 @opindex m4-200-nofpu
25049 Generate code for SH4-200 without in such a way that the
25050 floating-point unit is not used.
25052 @item -m4-200-single
25053 @opindex m4-200-single
25054 Generate code for SH4-200 assuming the floating-point unit is in
25055 single-precision mode by default.
25057 @item -m4-200-single-only
25058 @opindex m4-200-single-only
25059 Generate code for SH4-200 in such a way that no double-precision
25060 floating-point operations are used.
25064 Generate code for SH4-300.
25066 @item -m4-300-nofpu
25067 @opindex m4-300-nofpu
25068 Generate code for SH4-300 without in such a way that the
25069 floating-point unit is not used.
25071 @item -m4-300-single
25072 @opindex m4-300-single
25073 Generate code for SH4-300 in such a way that no double-precision
25074 floating-point operations are used.
25076 @item -m4-300-single-only
25077 @opindex m4-300-single-only
25078 Generate code for SH4-300 in such a way that no double-precision
25079 floating-point operations are used.
25083 Generate code for SH4-340 (no MMU, no FPU).
25087 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
25092 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
25093 floating-point unit is not used.
25095 @item -m4a-single-only
25096 @opindex m4a-single-only
25097 Generate code for the SH4a, in such a way that no double-precision
25098 floating-point operations are used.
25101 @opindex m4a-single
25102 Generate code for the SH4a assuming the floating-point unit is in
25103 single-precision mode by default.
25107 Generate code for the SH4a.
25111 Same as @option{-m4a-nofpu}, except that it implicitly passes
25112 @option{-dsp} to the assembler. GCC doesn't generate any DSP
25113 instructions at the moment.
25117 Compile code for the processor in big-endian mode.
25121 Compile code for the processor in little-endian mode.
25125 Align doubles at 64-bit boundaries. Note that this changes the calling
25126 conventions, and thus some functions from the standard C library do
25127 not work unless you recompile it first with @option{-mdalign}.
25131 Shorten some address references at link time, when possible; uses the
25132 linker option @option{-relax}.
25136 Use 32-bit offsets in @code{switch} tables. The default is to use
25141 Enable the use of bit manipulation instructions on SH2A.
25145 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
25146 alignment constraints.
25150 Comply with the calling conventions defined by Renesas.
25153 @opindex mno-renesas
25154 Comply with the calling conventions defined for GCC before the Renesas
25155 conventions were available. This option is the default for all
25156 targets of the SH toolchain.
25159 @opindex mnomacsave
25160 Mark the @code{MAC} register as call-clobbered, even if
25161 @option{-mrenesas} is given.
25167 Control the IEEE compliance of floating-point comparisons, which affects the
25168 handling of cases where the result of a comparison is unordered. By default
25169 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
25170 enabled @option{-mno-ieee} is implicitly set, which results in faster
25171 floating-point greater-equal and less-equal comparisons. The implicit settings
25172 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
25174 @item -minline-ic_invalidate
25175 @opindex minline-ic_invalidate
25176 Inline code to invalidate instruction cache entries after setting up
25177 nested function trampolines.
25178 This option has no effect if @option{-musermode} is in effect and the selected
25179 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
25181 If the selected code generation option does not allow the use of the @code{icbi}
25182 instruction, and @option{-musermode} is not in effect, the inlined code
25183 manipulates the instruction cache address array directly with an associative
25184 write. This not only requires privileged mode at run time, but it also
25185 fails if the cache line had been mapped via the TLB and has become unmapped.
25189 Dump instruction size and location in the assembly code.
25192 @opindex mpadstruct
25193 This option is deprecated. It pads structures to multiple of 4 bytes,
25194 which is incompatible with the SH ABI@.
25196 @item -matomic-model=@var{model}
25197 @opindex matomic-model=@var{model}
25198 Sets the model of atomic operations and additional parameters as a comma
25199 separated list. For details on the atomic built-in functions see
25200 @ref{__atomic Builtins}. The following models and parameters are supported:
25205 Disable compiler generated atomic sequences and emit library calls for atomic
25206 operations. This is the default if the target is not @code{sh*-*-linux*}.
25209 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
25210 built-in functions. The generated atomic sequences require additional support
25211 from the interrupt/exception handling code of the system and are only suitable
25212 for SH3* and SH4* single-core systems. This option is enabled by default when
25213 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
25214 this option also partially utilizes the hardware atomic instructions
25215 @code{movli.l} and @code{movco.l} to create more efficient code, unless
25216 @samp{strict} is specified.
25219 Generate software atomic sequences that use a variable in the thread control
25220 block. This is a variation of the gUSA sequences which can also be used on
25221 SH1* and SH2* targets. The generated atomic sequences require additional
25222 support from the interrupt/exception handling code of the system and are only
25223 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
25224 parameter has to be specified as well.
25227 Generate software atomic sequences that temporarily disable interrupts by
25228 setting @code{SR.IMASK = 1111}. This model works only when the program runs
25229 in privileged mode and is only suitable for single-core systems. Additional
25230 support from the interrupt/exception handling code of the system is not
25231 required. This model is enabled by default when the target is
25232 @code{sh*-*-linux*} and SH1* or SH2*.
25235 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
25236 instructions only. This is only available on SH4A and is suitable for
25237 multi-core systems. Since the hardware instructions support only 32 bit atomic
25238 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
25239 Code compiled with this option is also compatible with other software
25240 atomic model interrupt/exception handling systems if executed on an SH4A
25241 system. Additional support from the interrupt/exception handling code of the
25242 system is not required for this model.
25245 This parameter specifies the offset in bytes of the variable in the thread
25246 control block structure that should be used by the generated atomic sequences
25247 when the @samp{soft-tcb} model has been selected. For other models this
25248 parameter is ignored. The specified value must be an integer multiple of four
25249 and in the range 0-1020.
25252 This parameter prevents mixed usage of multiple atomic models, even if they
25253 are compatible, and makes the compiler generate atomic sequences of the
25254 specified model only.
25260 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
25261 Notice that depending on the particular hardware and software configuration
25262 this can degrade overall performance due to the operand cache line flushes
25263 that are implied by the @code{tas.b} instruction. On multi-core SH4A
25264 processors the @code{tas.b} instruction must be used with caution since it
25265 can result in data corruption for certain cache configurations.
25268 @opindex mprefergot
25269 When generating position-independent code, emit function calls using
25270 the Global Offset Table instead of the Procedure Linkage Table.
25273 @itemx -mno-usermode
25275 @opindex mno-usermode
25276 Don't allow (allow) the compiler generating privileged mode code. Specifying
25277 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
25278 inlined code would not work in user mode. @option{-musermode} is the default
25279 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
25280 @option{-musermode} has no effect, since there is no user mode.
25282 @item -multcost=@var{number}
25283 @opindex multcost=@var{number}
25284 Set the cost to assume for a multiply insn.
25286 @item -mdiv=@var{strategy}
25287 @opindex mdiv=@var{strategy}
25288 Set the division strategy to be used for integer division operations.
25289 @var{strategy} can be one of:
25294 Calls a library function that uses the single-step division instruction
25295 @code{div1} to perform the operation. Division by zero calculates an
25296 unspecified result and does not trap. This is the default except for SH4,
25297 SH2A and SHcompact.
25300 Calls a library function that performs the operation in double precision
25301 floating point. Division by zero causes a floating-point exception. This is
25302 the default for SHcompact with FPU. Specifying this for targets that do not
25303 have a double precision FPU defaults to @code{call-div1}.
25306 Calls a library function that uses a lookup table for small divisors and
25307 the @code{div1} instruction with case distinction for larger divisors. Division
25308 by zero calculates an unspecified result and does not trap. This is the default
25309 for SH4. Specifying this for targets that do not have dynamic shift
25310 instructions defaults to @code{call-div1}.
25314 When a division strategy has not been specified the default strategy is
25315 selected based on the current target. For SH2A the default strategy is to
25316 use the @code{divs} and @code{divu} instructions instead of library function
25319 @item -maccumulate-outgoing-args
25320 @opindex maccumulate-outgoing-args
25321 Reserve space once for outgoing arguments in the function prologue rather
25322 than around each call. Generally beneficial for performance and size. Also
25323 needed for unwinding to avoid changing the stack frame around conditional code.
25325 @item -mdivsi3_libfunc=@var{name}
25326 @opindex mdivsi3_libfunc=@var{name}
25327 Set the name of the library function used for 32-bit signed division to
25329 This only affects the name used in the @samp{call} division strategies, and
25330 the compiler still expects the same sets of input/output/clobbered registers as
25331 if this option were not present.
25333 @item -mfixed-range=@var{register-range}
25334 @opindex mfixed-range
25335 Generate code treating the given register range as fixed registers.
25336 A fixed register is one that the register allocator can not use. This is
25337 useful when compiling kernel code. A register range is specified as
25338 two registers separated by a dash. Multiple register ranges can be
25339 specified separated by a comma.
25341 @item -mbranch-cost=@var{num}
25342 @opindex mbranch-cost=@var{num}
25343 Assume @var{num} to be the cost for a branch instruction. Higher numbers
25344 make the compiler try to generate more branch-free code if possible.
25345 If not specified the value is selected depending on the processor type that
25346 is being compiled for.
25349 @itemx -mno-zdcbranch
25350 @opindex mzdcbranch
25351 @opindex mno-zdcbranch
25352 Assume (do not assume) that zero displacement conditional branch instructions
25353 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
25354 compiler prefers zero displacement branch code sequences. This is
25355 enabled by default when generating code for SH4 and SH4A. It can be explicitly
25356 disabled by specifying @option{-mno-zdcbranch}.
25358 @item -mcbranch-force-delay-slot
25359 @opindex mcbranch-force-delay-slot
25360 Force the usage of delay slots for conditional branches, which stuffs the delay
25361 slot with a @code{nop} if a suitable instruction cannot be found. By default
25362 this option is disabled. It can be enabled to work around hardware bugs as
25363 found in the original SH7055.
25366 @itemx -mno-fused-madd
25367 @opindex mfused-madd
25368 @opindex mno-fused-madd
25369 Generate code that uses (does not use) the floating-point multiply and
25370 accumulate instructions. These instructions are generated by default
25371 if hardware floating point is used. The machine-dependent
25372 @option{-mfused-madd} option is now mapped to the machine-independent
25373 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
25374 mapped to @option{-ffp-contract=off}.
25380 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
25381 and cosine approximations. The option @option{-mfsca} must be used in
25382 combination with @option{-funsafe-math-optimizations}. It is enabled by default
25383 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
25384 approximations even if @option{-funsafe-math-optimizations} is in effect.
25390 Allow or disallow the compiler to emit the @code{fsrra} instruction for
25391 reciprocal square root approximations. The option @option{-mfsrra} must be used
25392 in combination with @option{-funsafe-math-optimizations} and
25393 @option{-ffinite-math-only}. It is enabled by default when generating code for
25394 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
25395 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
25398 @item -mpretend-cmove
25399 @opindex mpretend-cmove
25400 Prefer zero-displacement conditional branches for conditional move instruction
25401 patterns. This can result in faster code on the SH4 processor.
25405 Generate code using the FDPIC ABI.
25409 @node Solaris 2 Options
25410 @subsection Solaris 2 Options
25411 @cindex Solaris 2 options
25413 These @samp{-m} options are supported on Solaris 2:
25416 @item -mclear-hwcap
25417 @opindex mclear-hwcap
25418 @option{-mclear-hwcap} tells the compiler to remove the hardware
25419 capabilities generated by the Solaris assembler. This is only necessary
25420 when object files use ISA extensions not supported by the current
25421 machine, but check at runtime whether or not to use them.
25423 @item -mimpure-text
25424 @opindex mimpure-text
25425 @option{-mimpure-text}, used in addition to @option{-shared}, tells
25426 the compiler to not pass @option{-z text} to the linker when linking a
25427 shared object. Using this option, you can link position-dependent
25428 code into a shared object.
25430 @option{-mimpure-text} suppresses the ``relocations remain against
25431 allocatable but non-writable sections'' linker error message.
25432 However, the necessary relocations trigger copy-on-write, and the
25433 shared object is not actually shared across processes. Instead of
25434 using @option{-mimpure-text}, you should compile all source code with
25435 @option{-fpic} or @option{-fPIC}.
25439 These switches are supported in addition to the above on Solaris 2:
25444 This is a synonym for @option{-pthread}.
25447 @node SPARC Options
25448 @subsection SPARC Options
25449 @cindex SPARC options
25451 These @samp{-m} options are supported on the SPARC:
25454 @item -mno-app-regs
25456 @opindex mno-app-regs
25458 Specify @option{-mapp-regs} to generate output using the global registers
25459 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
25460 global register 1, each global register 2 through 4 is then treated as an
25461 allocable register that is clobbered by function calls. This is the default.
25463 To be fully SVR4 ABI-compliant at the cost of some performance loss,
25464 specify @option{-mno-app-regs}. You should compile libraries and system
25465 software with this option.
25471 With @option{-mflat}, the compiler does not generate save/restore instructions
25472 and uses a ``flat'' or single register window model. This model is compatible
25473 with the regular register window model. The local registers and the input
25474 registers (0--5) are still treated as ``call-saved'' registers and are
25475 saved on the stack as needed.
25477 With @option{-mno-flat} (the default), the compiler generates save/restore
25478 instructions (except for leaf functions). This is the normal operating mode.
25481 @itemx -mhard-float
25483 @opindex mhard-float
25484 Generate output containing floating-point instructions. This is the
25488 @itemx -msoft-float
25490 @opindex msoft-float
25491 Generate output containing library calls for floating point.
25492 @strong{Warning:} the requisite libraries are not available for all SPARC
25493 targets. Normally the facilities of the machine's usual C compiler are
25494 used, but this cannot be done directly in cross-compilation. You must make
25495 your own arrangements to provide suitable library functions for
25496 cross-compilation. The embedded targets @samp{sparc-*-aout} and
25497 @samp{sparclite-*-*} do provide software floating-point support.
25499 @option{-msoft-float} changes the calling convention in the output file;
25500 therefore, it is only useful if you compile @emph{all} of a program with
25501 this option. In particular, you need to compile @file{libgcc.a}, the
25502 library that comes with GCC, with @option{-msoft-float} in order for
25505 @item -mhard-quad-float
25506 @opindex mhard-quad-float
25507 Generate output containing quad-word (long double) floating-point
25510 @item -msoft-quad-float
25511 @opindex msoft-quad-float
25512 Generate output containing library calls for quad-word (long double)
25513 floating-point instructions. The functions called are those specified
25514 in the SPARC ABI@. This is the default.
25516 As of this writing, there are no SPARC implementations that have hardware
25517 support for the quad-word floating-point instructions. They all invoke
25518 a trap handler for one of these instructions, and then the trap handler
25519 emulates the effect of the instruction. Because of the trap handler overhead,
25520 this is much slower than calling the ABI library routines. Thus the
25521 @option{-msoft-quad-float} option is the default.
25523 @item -mno-unaligned-doubles
25524 @itemx -munaligned-doubles
25525 @opindex mno-unaligned-doubles
25526 @opindex munaligned-doubles
25527 Assume that doubles have 8-byte alignment. This is the default.
25529 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
25530 alignment only if they are contained in another type, or if they have an
25531 absolute address. Otherwise, it assumes they have 4-byte alignment.
25532 Specifying this option avoids some rare compatibility problems with code
25533 generated by other compilers. It is not the default because it results
25534 in a performance loss, especially for floating-point code.
25537 @itemx -mno-user-mode
25538 @opindex muser-mode
25539 @opindex mno-user-mode
25540 Do not generate code that can only run in supervisor mode. This is relevant
25541 only for the @code{casa} instruction emitted for the LEON3 processor. This
25544 @item -mfaster-structs
25545 @itemx -mno-faster-structs
25546 @opindex mfaster-structs
25547 @opindex mno-faster-structs
25548 With @option{-mfaster-structs}, the compiler assumes that structures
25549 should have 8-byte alignment. This enables the use of pairs of
25550 @code{ldd} and @code{std} instructions for copies in structure
25551 assignment, in place of twice as many @code{ld} and @code{st} pairs.
25552 However, the use of this changed alignment directly violates the SPARC
25553 ABI@. Thus, it's intended only for use on targets where the developer
25554 acknowledges that their resulting code is not directly in line with
25555 the rules of the ABI@.
25557 @item -mstd-struct-return
25558 @itemx -mno-std-struct-return
25559 @opindex mstd-struct-return
25560 @opindex mno-std-struct-return
25561 With @option{-mstd-struct-return}, the compiler generates checking code
25562 in functions returning structures or unions to detect size mismatches
25563 between the two sides of function calls, as per the 32-bit ABI@.
25565 The default is @option{-mno-std-struct-return}. This option has no effect
25572 Enable Local Register Allocation. This is the default for SPARC since GCC 7
25573 so @option{-mno-lra} needs to be passed to get old Reload.
25575 @item -mcpu=@var{cpu_type}
25577 Set the instruction set, register set, and instruction scheduling parameters
25578 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
25579 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
25580 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
25581 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
25582 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
25583 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
25585 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
25586 which selects the best architecture option for the host processor.
25587 @option{-mcpu=native} has no effect if GCC does not recognize
25590 Default instruction scheduling parameters are used for values that select
25591 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
25592 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
25594 Here is a list of each supported architecture and their supported
25602 supersparc, hypersparc, leon, leon3
25605 f930, f934, sparclite86x
25611 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
25615 By default (unless configured otherwise), GCC generates code for the V7
25616 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
25617 additionally optimizes it for the Cypress CY7C602 chip, as used in the
25618 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
25619 SPARCStation 1, 2, IPX etc.
25621 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
25622 architecture. The only difference from V7 code is that the compiler emits
25623 the integer multiply and integer divide instructions which exist in SPARC-V8
25624 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
25625 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
25628 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
25629 the SPARC architecture. This adds the integer multiply, integer divide step
25630 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
25631 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
25632 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
25633 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
25634 MB86934 chip, which is the more recent SPARClite with FPU@.
25636 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
25637 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
25638 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
25639 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
25640 optimizes it for the TEMIC SPARClet chip.
25642 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
25643 architecture. This adds 64-bit integer and floating-point move instructions,
25644 3 additional floating-point condition code registers and conditional move
25645 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
25646 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
25647 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
25648 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
25649 @option{-mcpu=niagara}, the compiler additionally optimizes it for
25650 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
25651 additionally optimizes it for Sun UltraSPARC T2 chips. With
25652 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
25653 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
25654 additionally optimizes it for Sun UltraSPARC T4 chips. With
25655 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
25656 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
25657 additionally optimizes it for Oracle M8 chips.
25659 @item -mtune=@var{cpu_type}
25661 Set the instruction scheduling parameters for machine type
25662 @var{cpu_type}, but do not set the instruction set or register set that the
25663 option @option{-mcpu=@var{cpu_type}} does.
25665 The same values for @option{-mcpu=@var{cpu_type}} can be used for
25666 @option{-mtune=@var{cpu_type}}, but the only useful values are those
25667 that select a particular CPU implementation. Those are
25668 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
25669 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
25670 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
25671 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
25672 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
25673 and GNU/Linux toolchains, @samp{native} can also be used.
25678 @opindex mno-v8plus
25679 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
25680 difference from the V8 ABI is that the global and out registers are
25681 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
25682 mode for all SPARC-V9 processors.
25688 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
25689 Visual Instruction Set extensions. The default is @option{-mno-vis}.
25695 With @option{-mvis2}, GCC generates code that takes advantage of
25696 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
25697 default is @option{-mvis2} when targeting a cpu that supports such
25698 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
25699 also sets @option{-mvis}.
25705 With @option{-mvis3}, GCC generates code that takes advantage of
25706 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
25707 default is @option{-mvis3} when targeting a cpu that supports such
25708 instructions, such as niagara-3 and later. Setting @option{-mvis3}
25709 also sets @option{-mvis2} and @option{-mvis}.
25715 With @option{-mvis4}, GCC generates code that takes advantage of
25716 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
25717 default is @option{-mvis4} when targeting a cpu that supports such
25718 instructions, such as niagara-7 and later. Setting @option{-mvis4}
25719 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
25725 With @option{-mvis4b}, GCC generates code that takes advantage of
25726 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
25727 the additional VIS instructions introduced in the Oracle SPARC
25728 Architecture 2017. The default is @option{-mvis4b} when targeting a
25729 cpu that supports such instructions, such as m8 and later. Setting
25730 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
25731 @option{-mvis2} and @option{-mvis}.
25736 @opindex mno-cbcond
25737 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
25738 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
25739 when targeting a CPU that supports such instructions, such as Niagara-4 and
25746 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
25747 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
25748 when targeting a CPU that supports such instructions, such as Niagara-3 and
25754 @opindex mno-fsmuld
25755 With @option{-mfsmuld}, GCC generates code that takes advantage of the
25756 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
25757 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
25758 or V9 with FPU except @option{-mcpu=leon}.
25764 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
25765 Population Count instruction. The default is @option{-mpopc}
25766 when targeting a CPU that supports such an instruction, such as Niagara-2 and
25773 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
25774 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
25775 when targeting a CPU that supports such an instruction, such as Niagara-7 and
25779 @opindex mfix-at697f
25780 Enable the documented workaround for the single erratum of the Atmel AT697F
25781 processor (which corresponds to erratum #13 of the AT697E processor).
25784 @opindex mfix-ut699
25785 Enable the documented workarounds for the floating-point errata and the data
25786 cache nullify errata of the UT699 processor.
25789 @opindex mfix-ut700
25790 Enable the documented workaround for the back-to-back store errata of
25791 the UT699E/UT700 processor.
25793 @item -mfix-gr712rc
25794 @opindex mfix-gr712rc
25795 Enable the documented workaround for the back-to-back store errata of
25796 the GR712RC processor.
25799 These @samp{-m} options are supported in addition to the above
25800 on SPARC-V9 processors in 64-bit environments:
25807 Generate code for a 32-bit or 64-bit environment.
25808 The 32-bit environment sets int, long and pointer to 32 bits.
25809 The 64-bit environment sets int to 32 bits and long and pointer
25812 @item -mcmodel=@var{which}
25814 Set the code model to one of
25818 The Medium/Low code model: 64-bit addresses, programs
25819 must be linked in the low 32 bits of memory. Programs can be statically
25820 or dynamically linked.
25823 The Medium/Middle code model: 64-bit addresses, programs
25824 must be linked in the low 44 bits of memory, the text and data segments must
25825 be less than 2GB in size and the data segment must be located within 2GB of
25829 The Medium/Anywhere code model: 64-bit addresses, programs
25830 may be linked anywhere in memory, the text and data segments must be less
25831 than 2GB in size and the data segment must be located within 2GB of the
25835 The Medium/Anywhere code model for embedded systems:
25836 64-bit addresses, the text and data segments must be less than 2GB in
25837 size, both starting anywhere in memory (determined at link time). The
25838 global register %g4 points to the base of the data segment. Programs
25839 are statically linked and PIC is not supported.
25842 @item -mmemory-model=@var{mem-model}
25843 @opindex mmemory-model
25844 Set the memory model in force on the processor to one of
25848 The default memory model for the processor and operating system.
25851 Relaxed Memory Order
25854 Partial Store Order
25860 Sequential Consistency
25863 These memory models are formally defined in Appendix D of the SPARC-V9
25864 architecture manual, as set in the processor's @code{PSTATE.MM} field.
25867 @itemx -mno-stack-bias
25868 @opindex mstack-bias
25869 @opindex mno-stack-bias
25870 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
25871 frame pointer if present, are offset by @minus{}2047 which must be added back
25872 when making stack frame references. This is the default in 64-bit mode.
25873 Otherwise, assume no such offset is present.
25877 @subsection SPU Options
25878 @cindex SPU options
25880 These @samp{-m} options are supported on the SPU:
25884 @itemx -merror-reloc
25885 @opindex mwarn-reloc
25886 @opindex merror-reloc
25888 The loader for SPU does not handle dynamic relocations. By default, GCC
25889 gives an error when it generates code that requires a dynamic
25890 relocation. @option{-mno-error-reloc} disables the error,
25891 @option{-mwarn-reloc} generates a warning instead.
25894 @itemx -munsafe-dma
25896 @opindex munsafe-dma
25898 Instructions that initiate or test completion of DMA must not be
25899 reordered with respect to loads and stores of the memory that is being
25901 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
25902 memory accesses, but that can lead to inefficient code in places where the
25903 memory is known to not change. Rather than mark the memory as volatile,
25904 you can use @option{-msafe-dma} to tell the compiler to treat
25905 the DMA instructions as potentially affecting all memory.
25907 @item -mbranch-hints
25908 @opindex mbranch-hints
25910 By default, GCC generates a branch hint instruction to avoid
25911 pipeline stalls for always-taken or probably-taken branches. A hint
25912 is not generated closer than 8 instructions away from its branch.
25913 There is little reason to disable them, except for debugging purposes,
25914 or to make an object a little bit smaller.
25918 @opindex msmall-mem
25919 @opindex mlarge-mem
25921 By default, GCC generates code assuming that addresses are never larger
25922 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
25923 a full 32-bit address.
25928 By default, GCC links against startup code that assumes the SPU-style
25929 main function interface (which has an unconventional parameter list).
25930 With @option{-mstdmain}, GCC links your program against startup
25931 code that assumes a C99-style interface to @code{main}, including a
25932 local copy of @code{argv} strings.
25934 @item -mfixed-range=@var{register-range}
25935 @opindex mfixed-range
25936 Generate code treating the given register range as fixed registers.
25937 A fixed register is one that the register allocator cannot use. This is
25938 useful when compiling kernel code. A register range is specified as
25939 two registers separated by a dash. Multiple register ranges can be
25940 specified separated by a comma.
25946 Compile code assuming that pointers to the PPU address space accessed
25947 via the @code{__ea} named address space qualifier are either 32 or 64
25948 bits wide. The default is 32 bits. As this is an ABI-changing option,
25949 all object code in an executable must be compiled with the same setting.
25951 @item -maddress-space-conversion
25952 @itemx -mno-address-space-conversion
25953 @opindex maddress-space-conversion
25954 @opindex mno-address-space-conversion
25955 Allow/disallow treating the @code{__ea} address space as superset
25956 of the generic address space. This enables explicit type casts
25957 between @code{__ea} and generic pointer as well as implicit
25958 conversions of generic pointers to @code{__ea} pointers. The
25959 default is to allow address space pointer conversions.
25961 @item -mcache-size=@var{cache-size}
25962 @opindex mcache-size
25963 This option controls the version of libgcc that the compiler links to an
25964 executable and selects a software-managed cache for accessing variables
25965 in the @code{__ea} address space with a particular cache size. Possible
25966 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
25967 and @samp{128}. The default cache size is 64KB.
25969 @item -matomic-updates
25970 @itemx -mno-atomic-updates
25971 @opindex matomic-updates
25972 @opindex mno-atomic-updates
25973 This option controls the version of libgcc that the compiler links to an
25974 executable and selects whether atomic updates to the software-managed
25975 cache of PPU-side variables are used. If you use atomic updates, changes
25976 to a PPU variable from SPU code using the @code{__ea} named address space
25977 qualifier do not interfere with changes to other PPU variables residing
25978 in the same cache line from PPU code. If you do not use atomic updates,
25979 such interference may occur; however, writing back cache lines is
25980 more efficient. The default behavior is to use atomic updates.
25983 @itemx -mdual-nops=@var{n}
25984 @opindex mdual-nops
25985 By default, GCC inserts NOPs to increase dual issue when it expects
25986 it to increase performance. @var{n} can be a value from 0 to 10. A
25987 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
25988 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
25990 @item -mhint-max-nops=@var{n}
25991 @opindex mhint-max-nops
25992 Maximum number of NOPs to insert for a branch hint. A branch hint must
25993 be at least 8 instructions away from the branch it is affecting. GCC
25994 inserts up to @var{n} NOPs to enforce this, otherwise it does not
25995 generate the branch hint.
25997 @item -mhint-max-distance=@var{n}
25998 @opindex mhint-max-distance
25999 The encoding of the branch hint instruction limits the hint to be within
26000 256 instructions of the branch it is affecting. By default, GCC makes
26001 sure it is within 125.
26004 @opindex msafe-hints
26005 Work around a hardware bug that causes the SPU to stall indefinitely.
26006 By default, GCC inserts the @code{hbrp} instruction to make sure
26007 this stall won't happen.
26011 @node System V Options
26012 @subsection Options for System V
26014 These additional options are available on System V Release 4 for
26015 compatibility with other compilers on those systems:
26020 Create a shared object.
26021 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
26025 Identify the versions of each tool used by the compiler, in a
26026 @code{.ident} assembler directive in the output.
26030 Refrain from adding @code{.ident} directives to the output file (this is
26033 @item -YP,@var{dirs}
26035 Search the directories @var{dirs}, and no others, for libraries
26036 specified with @option{-l}.
26038 @item -Ym,@var{dir}
26040 Look in the directory @var{dir} to find the M4 preprocessor.
26041 The assembler uses this option.
26042 @c This is supposed to go with a -Yd for predefined M4 macro files, but
26043 @c the generic assembler that comes with Solaris takes just -Ym.
26046 @node TILE-Gx Options
26047 @subsection TILE-Gx Options
26048 @cindex TILE-Gx options
26050 These @samp{-m} options are supported on the TILE-Gx:
26053 @item -mcmodel=small
26054 @opindex mcmodel=small
26055 Generate code for the small model. The distance for direct calls is
26056 limited to 500M in either direction. PC-relative addresses are 32
26057 bits. Absolute addresses support the full address range.
26059 @item -mcmodel=large
26060 @opindex mcmodel=large
26061 Generate code for the large model. There is no limitation on call
26062 distance, pc-relative addresses, or absolute addresses.
26064 @item -mcpu=@var{name}
26066 Selects the type of CPU to be targeted. Currently the only supported
26067 type is @samp{tilegx}.
26073 Generate code for a 32-bit or 64-bit environment. The 32-bit
26074 environment sets int, long, and pointer to 32 bits. The 64-bit
26075 environment sets int to 32 bits and long and pointer to 64 bits.
26078 @itemx -mlittle-endian
26079 @opindex mbig-endian
26080 @opindex mlittle-endian
26081 Generate code in big/little endian mode, respectively.
26084 @node TILEPro Options
26085 @subsection TILEPro Options
26086 @cindex TILEPro options
26088 These @samp{-m} options are supported on the TILEPro:
26091 @item -mcpu=@var{name}
26093 Selects the type of CPU to be targeted. Currently the only supported
26094 type is @samp{tilepro}.
26098 Generate code for a 32-bit environment, which sets int, long, and
26099 pointer to 32 bits. This is the only supported behavior so the flag
26100 is essentially ignored.
26104 @subsection V850 Options
26105 @cindex V850 Options
26107 These @samp{-m} options are defined for V850 implementations:
26111 @itemx -mno-long-calls
26112 @opindex mlong-calls
26113 @opindex mno-long-calls
26114 Treat all calls as being far away (near). If calls are assumed to be
26115 far away, the compiler always loads the function's address into a
26116 register, and calls indirect through the pointer.
26122 Do not optimize (do optimize) basic blocks that use the same index
26123 pointer 4 or more times to copy pointer into the @code{ep} register, and
26124 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
26125 option is on by default if you optimize.
26127 @item -mno-prolog-function
26128 @itemx -mprolog-function
26129 @opindex mno-prolog-function
26130 @opindex mprolog-function
26131 Do not use (do use) external functions to save and restore registers
26132 at the prologue and epilogue of a function. The external functions
26133 are slower, but use less code space if more than one function saves
26134 the same number of registers. The @option{-mprolog-function} option
26135 is on by default if you optimize.
26139 Try to make the code as small as possible. At present, this just turns
26140 on the @option{-mep} and @option{-mprolog-function} options.
26142 @item -mtda=@var{n}
26144 Put static or global variables whose size is @var{n} bytes or less into
26145 the tiny data area that register @code{ep} points to. The tiny data
26146 area can hold up to 256 bytes in total (128 bytes for byte references).
26148 @item -msda=@var{n}
26150 Put static or global variables whose size is @var{n} bytes or less into
26151 the small data area that register @code{gp} points to. The small data
26152 area can hold up to 64 kilobytes.
26154 @item -mzda=@var{n}
26156 Put static or global variables whose size is @var{n} bytes or less into
26157 the first 32 kilobytes of memory.
26161 Specify that the target processor is the V850.
26165 Specify that the target processor is the V850E3V5. The preprocessor
26166 constant @code{__v850e3v5__} is defined if this option is used.
26170 Specify that the target processor is the V850E3V5. This is an alias for
26171 the @option{-mv850e3v5} option.
26175 Specify that the target processor is the V850E2V3. The preprocessor
26176 constant @code{__v850e2v3__} is defined if this option is used.
26180 Specify that the target processor is the V850E2. The preprocessor
26181 constant @code{__v850e2__} is defined if this option is used.
26185 Specify that the target processor is the V850E1. The preprocessor
26186 constants @code{__v850e1__} and @code{__v850e__} are defined if
26187 this option is used.
26191 Specify that the target processor is the V850ES. This is an alias for
26192 the @option{-mv850e1} option.
26196 Specify that the target processor is the V850E@. The preprocessor
26197 constant @code{__v850e__} is defined if this option is used.
26199 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
26200 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
26201 are defined then a default target processor is chosen and the
26202 relevant @samp{__v850*__} preprocessor constant is defined.
26204 The preprocessor constants @code{__v850} and @code{__v851__} are always
26205 defined, regardless of which processor variant is the target.
26207 @item -mdisable-callt
26208 @itemx -mno-disable-callt
26209 @opindex mdisable-callt
26210 @opindex mno-disable-callt
26211 This option suppresses generation of the @code{CALLT} instruction for the
26212 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
26215 This option is enabled by default when the RH850 ABI is
26216 in use (see @option{-mrh850-abi}), and disabled by default when the
26217 GCC ABI is in use. If @code{CALLT} instructions are being generated
26218 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
26224 Pass on (or do not pass on) the @option{-mrelax} command-line option
26228 @itemx -mno-long-jumps
26229 @opindex mlong-jumps
26230 @opindex mno-long-jumps
26231 Disable (or re-enable) the generation of PC-relative jump instructions.
26234 @itemx -mhard-float
26235 @opindex msoft-float
26236 @opindex mhard-float
26237 Disable (or re-enable) the generation of hardware floating point
26238 instructions. This option is only significant when the target
26239 architecture is @samp{V850E2V3} or higher. If hardware floating point
26240 instructions are being generated then the C preprocessor symbol
26241 @code{__FPU_OK__} is defined, otherwise the symbol
26242 @code{__NO_FPU__} is defined.
26246 Enables the use of the e3v5 LOOP instruction. The use of this
26247 instruction is not enabled by default when the e3v5 architecture is
26248 selected because its use is still experimental.
26252 @opindex mrh850-abi
26254 Enables support for the RH850 version of the V850 ABI. This is the
26255 default. With this version of the ABI the following rules apply:
26259 Integer sized structures and unions are returned via a memory pointer
26260 rather than a register.
26263 Large structures and unions (more than 8 bytes in size) are passed by
26267 Functions are aligned to 16-bit boundaries.
26270 The @option{-m8byte-align} command-line option is supported.
26273 The @option{-mdisable-callt} command-line option is enabled by
26274 default. The @option{-mno-disable-callt} command-line option is not
26278 When this version of the ABI is enabled the C preprocessor symbol
26279 @code{__V850_RH850_ABI__} is defined.
26283 Enables support for the old GCC version of the V850 ABI. With this
26284 version of the ABI the following rules apply:
26288 Integer sized structures and unions are returned in register @code{r10}.
26291 Large structures and unions (more than 8 bytes in size) are passed by
26295 Functions are aligned to 32-bit boundaries, unless optimizing for
26299 The @option{-m8byte-align} command-line option is not supported.
26302 The @option{-mdisable-callt} command-line option is supported but not
26303 enabled by default.
26306 When this version of the ABI is enabled the C preprocessor symbol
26307 @code{__V850_GCC_ABI__} is defined.
26309 @item -m8byte-align
26310 @itemx -mno-8byte-align
26311 @opindex m8byte-align
26312 @opindex mno-8byte-align
26313 Enables support for @code{double} and @code{long long} types to be
26314 aligned on 8-byte boundaries. The default is to restrict the
26315 alignment of all objects to at most 4-bytes. When
26316 @option{-m8byte-align} is in effect the C preprocessor symbol
26317 @code{__V850_8BYTE_ALIGN__} is defined.
26320 @opindex mbig-switch
26321 Generate code suitable for big switch tables. Use this option only if
26322 the assembler/linker complain about out of range branches within a switch
26327 This option causes r2 and r5 to be used in the code generated by
26328 the compiler. This setting is the default.
26330 @item -mno-app-regs
26331 @opindex mno-app-regs
26332 This option causes r2 and r5 to be treated as fixed registers.
26337 @subsection VAX Options
26338 @cindex VAX options
26340 These @samp{-m} options are defined for the VAX:
26345 Do not output certain jump instructions (@code{aobleq} and so on)
26346 that the Unix assembler for the VAX cannot handle across long
26351 Do output those jump instructions, on the assumption that the
26352 GNU assembler is being used.
26356 Output code for G-format floating-point numbers instead of D-format.
26359 @node Visium Options
26360 @subsection Visium Options
26361 @cindex Visium options
26367 A program which performs file I/O and is destined to run on an MCM target
26368 should be linked with this option. It causes the libraries libc.a and
26369 libdebug.a to be linked. The program should be run on the target under
26370 the control of the GDB remote debugging stub.
26374 A program which performs file I/O and is destined to run on the simulator
26375 should be linked with option. This causes libraries libc.a and libsim.a to
26379 @itemx -mhard-float
26381 @opindex mhard-float
26382 Generate code containing floating-point instructions. This is the
26386 @itemx -msoft-float
26388 @opindex msoft-float
26389 Generate code containing library calls for floating-point.
26391 @option{-msoft-float} changes the calling convention in the output file;
26392 therefore, it is only useful if you compile @emph{all} of a program with
26393 this option. In particular, you need to compile @file{libgcc.a}, the
26394 library that comes with GCC, with @option{-msoft-float} in order for
26397 @item -mcpu=@var{cpu_type}
26399 Set the instruction set, register set, and instruction scheduling parameters
26400 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26401 @samp{mcm}, @samp{gr5} and @samp{gr6}.
26403 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
26405 By default (unless configured otherwise), GCC generates code for the GR5
26406 variant of the Visium architecture.
26408 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
26409 architecture. The only difference from GR5 code is that the compiler will
26410 generate block move instructions.
26412 @item -mtune=@var{cpu_type}
26414 Set the instruction scheduling parameters for machine type @var{cpu_type},
26415 but do not set the instruction set or register set that the option
26416 @option{-mcpu=@var{cpu_type}} would.
26420 Generate code for the supervisor mode, where there are no restrictions on
26421 the access to general registers. This is the default.
26424 @opindex muser-mode
26425 Generate code for the user mode, where the access to some general registers
26426 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
26427 mode; on the GR6, only registers r29 to r31 are affected.
26431 @subsection VMS Options
26433 These @samp{-m} options are defined for the VMS implementations:
26436 @item -mvms-return-codes
26437 @opindex mvms-return-codes
26438 Return VMS condition codes from @code{main}. The default is to return POSIX-style
26439 condition (e.g.@ error) codes.
26441 @item -mdebug-main=@var{prefix}
26442 @opindex mdebug-main=@var{prefix}
26443 Flag the first routine whose name starts with @var{prefix} as the main
26444 routine for the debugger.
26448 Default to 64-bit memory allocation routines.
26450 @item -mpointer-size=@var{size}
26451 @opindex mpointer-size=@var{size}
26452 Set the default size of pointers. Possible options for @var{size} are
26453 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
26454 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
26455 The later option disables @code{pragma pointer_size}.
26458 @node VxWorks Options
26459 @subsection VxWorks Options
26460 @cindex VxWorks Options
26462 The options in this section are defined for all VxWorks targets.
26463 Options specific to the target hardware are listed with the other
26464 options for that target.
26469 GCC can generate code for both VxWorks kernels and real time processes
26470 (RTPs). This option switches from the former to the latter. It also
26471 defines the preprocessor macro @code{__RTP__}.
26474 @opindex non-static
26475 Link an RTP executable against shared libraries rather than static
26476 libraries. The options @option{-static} and @option{-shared} can
26477 also be used for RTPs (@pxref{Link Options}); @option{-static}
26484 These options are passed down to the linker. They are defined for
26485 compatibility with Diab.
26488 @opindex Xbind-lazy
26489 Enable lazy binding of function calls. This option is equivalent to
26490 @option{-Wl,-z,now} and is defined for compatibility with Diab.
26494 Disable lazy binding of function calls. This option is the default and
26495 is defined for compatibility with Diab.
26499 @subsection x86 Options
26500 @cindex x86 Options
26502 These @samp{-m} options are defined for the x86 family of computers.
26506 @item -march=@var{cpu-type}
26508 Generate instructions for the machine type @var{cpu-type}. In contrast to
26509 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
26510 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
26511 to generate code that may not run at all on processors other than the one
26512 indicated. Specifying @option{-march=@var{cpu-type}} implies
26513 @option{-mtune=@var{cpu-type}}.
26515 The choices for @var{cpu-type} are:
26519 This selects the CPU to generate code for at compilation time by determining
26520 the processor type of the compiling machine. Using @option{-march=native}
26521 enables all instruction subsets supported by the local machine (hence
26522 the result might not run on different machines). Using @option{-mtune=native}
26523 produces code optimized for the local machine under the constraints
26524 of the selected instruction set.
26527 A generic CPU with 64-bit extensions.
26530 Original Intel i386 CPU@.
26533 Intel i486 CPU@. (No scheduling is implemented for this chip.)
26537 Intel Pentium CPU with no MMX support.
26540 Intel Lakemont MCU, based on Intel Pentium CPU.
26543 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
26546 Intel Pentium Pro CPU@.
26549 When used with @option{-march}, the Pentium Pro
26550 instruction set is used, so the code runs on all i686 family chips.
26551 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
26554 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
26559 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
26563 Intel Pentium M; low-power version of Intel Pentium III CPU
26564 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
26568 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
26571 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
26575 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
26576 SSE2 and SSE3 instruction set support.
26579 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
26580 instruction set support.
26583 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26584 SSE4.1, SSE4.2 and POPCNT instruction set support.
26587 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26588 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
26591 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26592 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
26595 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26596 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
26597 instruction set support.
26600 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26601 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26602 BMI, BMI2 and F16C instruction set support.
26605 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26606 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26607 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
26610 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26611 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26612 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
26613 XSAVES instruction set support.
26616 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
26617 instruction set support.
26620 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26621 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
26624 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26625 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
26626 instruction set support.
26628 @item goldmont-plus
26629 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
26630 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
26631 PTWRITE, RDPID, SGX and UMIP instruction set support.
26634 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26635 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
26636 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
26639 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
26640 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26641 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
26642 AVX512CD instruction set support.
26645 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
26646 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26647 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
26648 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
26650 @item skylake-avx512
26651 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
26652 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26653 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
26654 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
26657 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
26658 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
26659 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
26660 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
26661 AVX512IFMA, SHA and UMIP instruction set support.
26663 @item icelake-client
26664 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
26665 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
26666 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
26667 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
26668 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
26669 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
26671 @item icelake-server
26672 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
26673 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
26674 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
26675 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
26676 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
26677 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
26681 AMD K6 CPU with MMX instruction set support.
26685 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
26688 @itemx athlon-tbird
26689 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
26695 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
26696 instruction set support.
26702 Processors based on the AMD K8 core with x86-64 instruction set support,
26703 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
26704 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
26705 instruction set extensions.)
26708 @itemx opteron-sse3
26709 @itemx athlon64-sse3
26710 Improved versions of AMD K8 cores with SSE3 instruction set support.
26714 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
26715 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
26716 instruction set extensions.)
26719 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
26720 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
26721 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
26723 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
26724 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
26725 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
26728 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
26729 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
26730 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
26731 64-bit instruction set extensions.
26733 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
26734 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
26735 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
26736 SSE4.2, ABM and 64-bit instruction set extensions.
26739 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
26740 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
26741 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
26742 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
26743 instruction set extensions.
26746 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
26747 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
26748 instruction set extensions.)
26751 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
26752 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
26753 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
26756 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
26760 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
26761 instruction set support.
26764 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
26765 (No scheduling is implemented for this chip.)
26768 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
26769 (No scheduling is implemented for this chip.)
26772 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
26773 (No scheduling is implemented for this chip.)
26776 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
26777 (No scheduling is implemented for this chip.)
26780 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
26781 (No scheduling is implemented for this chip.)
26784 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
26785 (No scheduling is implemented for this chip.)
26788 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
26789 (No scheduling is implemented for this chip.)
26792 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
26793 AVX and AVX2 instruction set support.
26794 (No scheduling is implemented for this chip.)
26797 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
26798 instruction set support.
26799 (No scheduling is implemented for this chip.)
26802 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
26803 instruction set support.
26804 (No scheduling is implemented for this chip.)
26807 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
26808 instruction set support.
26809 (No scheduling is implemented for this chip.)
26812 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
26813 instruction set support.
26814 (No scheduling is implemented for this chip.)
26817 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
26818 instruction set support.
26819 (No scheduling is implemented for this chip.)
26822 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
26823 instruction set support.
26824 (No scheduling is implemented for this chip.)
26827 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
26830 @item -mtune=@var{cpu-type}
26832 Tune to @var{cpu-type} everything applicable about the generated code, except
26833 for the ABI and the set of available instructions.
26834 While picking a specific @var{cpu-type} schedules things appropriately
26835 for that particular chip, the compiler does not generate any code that
26836 cannot run on the default machine type unless you use a
26837 @option{-march=@var{cpu-type}} option.
26838 For example, if GCC is configured for i686-pc-linux-gnu
26839 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
26840 but still runs on i686 machines.
26842 The choices for @var{cpu-type} are the same as for @option{-march}.
26843 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
26847 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
26848 If you know the CPU on which your code will run, then you should use
26849 the corresponding @option{-mtune} or @option{-march} option instead of
26850 @option{-mtune=generic}. But, if you do not know exactly what CPU users
26851 of your application will have, then you should use this option.
26853 As new processors are deployed in the marketplace, the behavior of this
26854 option will change. Therefore, if you upgrade to a newer version of
26855 GCC, code generation controlled by this option will change to reflect
26857 that are most common at the time that version of GCC is released.
26859 There is no @option{-march=generic} option because @option{-march}
26860 indicates the instruction set the compiler can use, and there is no
26861 generic instruction set applicable to all processors. In contrast,
26862 @option{-mtune} indicates the processor (or, in this case, collection of
26863 processors) for which the code is optimized.
26866 Produce code optimized for the most current Intel processors, which are
26867 Haswell and Silvermont for this version of GCC. If you know the CPU
26868 on which your code will run, then you should use the corresponding
26869 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
26870 But, if you want your application performs better on both Haswell and
26871 Silvermont, then you should use this option.
26873 As new Intel processors are deployed in the marketplace, the behavior of
26874 this option will change. Therefore, if you upgrade to a newer version of
26875 GCC, code generation controlled by this option will change to reflect
26876 the most current Intel processors at the time that version of GCC is
26879 There is no @option{-march=intel} option because @option{-march} indicates
26880 the instruction set the compiler can use, and there is no common
26881 instruction set applicable to all processors. In contrast,
26882 @option{-mtune} indicates the processor (or, in this case, collection of
26883 processors) for which the code is optimized.
26886 @item -mcpu=@var{cpu-type}
26888 A deprecated synonym for @option{-mtune}.
26890 @item -mfpmath=@var{unit}
26892 Generate floating-point arithmetic for selected unit @var{unit}. The choices
26893 for @var{unit} are:
26897 Use the standard 387 floating-point coprocessor present on the majority of chips and
26898 emulated otherwise. Code compiled with this option runs almost everywhere.
26899 The temporary results are computed in 80-bit precision instead of the precision
26900 specified by the type, resulting in slightly different results compared to most
26901 of other chips. See @option{-ffloat-store} for more detailed description.
26903 This is the default choice for non-Darwin x86-32 targets.
26906 Use scalar floating-point instructions present in the SSE instruction set.
26907 This instruction set is supported by Pentium III and newer chips,
26908 and in the AMD line
26909 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
26910 instruction set supports only single-precision arithmetic, thus the double and
26911 extended-precision arithmetic are still done using 387. A later version, present
26912 only in Pentium 4 and AMD x86-64 chips, supports double-precision
26915 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
26916 or @option{-msse2} switches to enable SSE extensions and make this option
26917 effective. For the x86-64 compiler, these extensions are enabled by default.
26919 The resulting code should be considerably faster in the majority of cases and avoid
26920 the numerical instability problems of 387 code, but may break some existing
26921 code that expects temporaries to be 80 bits.
26923 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
26924 and the default choice for x86-32 targets with the SSE2 instruction set
26925 when @option{-ffast-math} is enabled.
26930 Attempt to utilize both instruction sets at once. This effectively doubles the
26931 amount of available registers, and on chips with separate execution units for
26932 387 and SSE the execution resources too. Use this option with care, as it is
26933 still experimental, because the GCC register allocator does not model separate
26934 functional units well, resulting in unstable performance.
26937 @item -masm=@var{dialect}
26938 @opindex masm=@var{dialect}
26939 Output assembly instructions using selected @var{dialect}. Also affects
26940 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
26941 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
26942 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
26943 not support @samp{intel}.
26946 @itemx -mno-ieee-fp
26948 @opindex mno-ieee-fp
26949 Control whether or not the compiler uses IEEE floating-point
26950 comparisons. These correctly handle the case where the result of a
26951 comparison is unordered.
26954 @itemx -mhard-float
26956 @opindex mhard-float
26957 Generate output containing 80387 instructions for floating point.
26960 @itemx -msoft-float
26962 @opindex msoft-float
26963 Generate output containing library calls for floating point.
26965 @strong{Warning:} the requisite libraries are not part of GCC@.
26966 Normally the facilities of the machine's usual C compiler are used, but
26967 this cannot be done directly in cross-compilation. You must make your
26968 own arrangements to provide suitable library functions for
26971 On machines where a function returns floating-point results in the 80387
26972 register stack, some floating-point opcodes may be emitted even if
26973 @option{-msoft-float} is used.
26975 @item -mno-fp-ret-in-387
26976 @opindex mno-fp-ret-in-387
26977 Do not use the FPU registers for return values of functions.
26979 The usual calling convention has functions return values of types
26980 @code{float} and @code{double} in an FPU register, even if there
26981 is no FPU@. The idea is that the operating system should emulate
26984 The option @option{-mno-fp-ret-in-387} causes such values to be returned
26985 in ordinary CPU registers instead.
26987 @item -mno-fancy-math-387
26988 @opindex mno-fancy-math-387
26989 Some 387 emulators do not support the @code{sin}, @code{cos} and
26990 @code{sqrt} instructions for the 387. Specify this option to avoid
26991 generating those instructions.
26992 This option is overridden when @option{-march}
26993 indicates that the target CPU always has an FPU and so the
26994 instruction does not need emulation. These
26995 instructions are not generated unless you also use the
26996 @option{-funsafe-math-optimizations} switch.
26998 @item -malign-double
26999 @itemx -mno-align-double
27000 @opindex malign-double
27001 @opindex mno-align-double
27002 Control whether GCC aligns @code{double}, @code{long double}, and
27003 @code{long long} variables on a two-word boundary or a one-word
27004 boundary. Aligning @code{double} variables on a two-word boundary
27005 produces code that runs somewhat faster on a Pentium at the
27006 expense of more memory.
27008 On x86-64, @option{-malign-double} is enabled by default.
27010 @strong{Warning:} if you use the @option{-malign-double} switch,
27011 structures containing the above types are aligned differently than
27012 the published application binary interface specifications for the x86-32
27013 and are not binary compatible with structures in code compiled
27014 without that switch.
27016 @item -m96bit-long-double
27017 @itemx -m128bit-long-double
27018 @opindex m96bit-long-double
27019 @opindex m128bit-long-double
27020 These switches control the size of @code{long double} type. The x86-32
27021 application binary interface specifies the size to be 96 bits,
27022 so @option{-m96bit-long-double} is the default in 32-bit mode.
27024 Modern architectures (Pentium and newer) prefer @code{long double}
27025 to be aligned to an 8- or 16-byte boundary. In arrays or structures
27026 conforming to the ABI, this is not possible. So specifying
27027 @option{-m128bit-long-double} aligns @code{long double}
27028 to a 16-byte boundary by padding the @code{long double} with an additional
27031 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
27032 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
27034 Notice that neither of these options enable any extra precision over the x87
27035 standard of 80 bits for a @code{long double}.
27037 @strong{Warning:} if you override the default value for your target ABI, this
27038 changes the size of
27039 structures and arrays containing @code{long double} variables,
27040 as well as modifying the function calling convention for functions taking
27041 @code{long double}. Hence they are not binary-compatible
27042 with code compiled without that switch.
27044 @item -mlong-double-64
27045 @itemx -mlong-double-80
27046 @itemx -mlong-double-128
27047 @opindex mlong-double-64
27048 @opindex mlong-double-80
27049 @opindex mlong-double-128
27050 These switches control the size of @code{long double} type. A size
27051 of 64 bits makes the @code{long double} type equivalent to the @code{double}
27052 type. This is the default for 32-bit Bionic C library. A size
27053 of 128 bits makes the @code{long double} type equivalent to the
27054 @code{__float128} type. This is the default for 64-bit Bionic C library.
27056 @strong{Warning:} if you override the default value for your target ABI, this
27057 changes the size of
27058 structures and arrays containing @code{long double} variables,
27059 as well as modifying the function calling convention for functions taking
27060 @code{long double}. Hence they are not binary-compatible
27061 with code compiled without that switch.
27063 @item -malign-data=@var{type}
27064 @opindex malign-data
27065 Control how GCC aligns variables. Supported values for @var{type} are
27066 @samp{compat} uses increased alignment value compatible uses GCC 4.8
27067 and earlier, @samp{abi} uses alignment value as specified by the
27068 psABI, and @samp{cacheline} uses increased alignment value to match
27069 the cache line size. @samp{compat} is the default.
27071 @item -mlarge-data-threshold=@var{threshold}
27072 @opindex mlarge-data-threshold
27073 When @option{-mcmodel=medium} is specified, data objects larger than
27074 @var{threshold} are placed in the large data section. This value must be the
27075 same across all objects linked into the binary, and defaults to 65535.
27079 Use a different function-calling convention, in which functions that
27080 take a fixed number of arguments return with the @code{ret @var{num}}
27081 instruction, which pops their arguments while returning. This saves one
27082 instruction in the caller since there is no need to pop the arguments
27085 You can specify that an individual function is called with this calling
27086 sequence with the function attribute @code{stdcall}. You can also
27087 override the @option{-mrtd} option by using the function attribute
27088 @code{cdecl}. @xref{Function Attributes}.
27090 @strong{Warning:} this calling convention is incompatible with the one
27091 normally used on Unix, so you cannot use it if you need to call
27092 libraries compiled with the Unix compiler.
27094 Also, you must provide function prototypes for all functions that
27095 take variable numbers of arguments (including @code{printf});
27096 otherwise incorrect code is generated for calls to those
27099 In addition, seriously incorrect code results if you call a
27100 function with too many arguments. (Normally, extra arguments are
27101 harmlessly ignored.)
27103 @item -mregparm=@var{num}
27105 Control how many registers are used to pass integer arguments. By
27106 default, no registers are used to pass arguments, and at most 3
27107 registers can be used. You can control this behavior for a specific
27108 function by using the function attribute @code{regparm}.
27109 @xref{Function Attributes}.
27111 @strong{Warning:} if you use this switch, and
27112 @var{num} is nonzero, then you must build all modules with the same
27113 value, including any libraries. This includes the system libraries and
27117 @opindex msseregparm
27118 Use SSE register passing conventions for float and double arguments
27119 and return values. You can control this behavior for a specific
27120 function by using the function attribute @code{sseregparm}.
27121 @xref{Function Attributes}.
27123 @strong{Warning:} if you use this switch then you must build all
27124 modules with the same value, including any libraries. This includes
27125 the system libraries and startup modules.
27127 @item -mvect8-ret-in-mem
27128 @opindex mvect8-ret-in-mem
27129 Return 8-byte vectors in memory instead of MMX registers. This is the
27130 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
27131 Studio compilers until version 12. Later compiler versions (starting
27132 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
27133 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
27134 you need to remain compatible with existing code produced by those
27135 previous compiler versions or older versions of GCC@.
27144 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
27145 is specified, the significands of results of floating-point operations are
27146 rounded to 24 bits (single precision); @option{-mpc64} rounds the
27147 significands of results of floating-point operations to 53 bits (double
27148 precision) and @option{-mpc80} rounds the significands of results of
27149 floating-point operations to 64 bits (extended double precision), which is
27150 the default. When this option is used, floating-point operations in higher
27151 precisions are not available to the programmer without setting the FPU
27152 control word explicitly.
27154 Setting the rounding of floating-point operations to less than the default
27155 80 bits can speed some programs by 2% or more. Note that some mathematical
27156 libraries assume that extended-precision (80-bit) floating-point operations
27157 are enabled by default; routines in such libraries could suffer significant
27158 loss of accuracy, typically through so-called ``catastrophic cancellation'',
27159 when this option is used to set the precision to less than extended precision.
27161 @item -mstackrealign
27162 @opindex mstackrealign
27163 Realign the stack at entry. On the x86, the @option{-mstackrealign}
27164 option generates an alternate prologue and epilogue that realigns the
27165 run-time stack if necessary. This supports mixing legacy codes that keep
27166 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
27167 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
27168 applicable to individual functions.
27170 @item -mpreferred-stack-boundary=@var{num}
27171 @opindex mpreferred-stack-boundary
27172 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
27173 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
27174 the default is 4 (16 bytes or 128 bits).
27176 @strong{Warning:} When generating code for the x86-64 architecture with
27177 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
27178 used to keep the stack boundary aligned to 8 byte boundary. Since
27179 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
27180 intended to be used in controlled environment where stack space is
27181 important limitation. This option leads to wrong code when functions
27182 compiled with 16 byte stack alignment (such as functions from a standard
27183 library) are called with misaligned stack. In this case, SSE
27184 instructions may lead to misaligned memory access traps. In addition,
27185 variable arguments are handled incorrectly for 16 byte aligned
27186 objects (including x87 long double and __int128), leading to wrong
27187 results. You must build all modules with
27188 @option{-mpreferred-stack-boundary=3}, including any libraries. This
27189 includes the system libraries and startup modules.
27191 @item -mincoming-stack-boundary=@var{num}
27192 @opindex mincoming-stack-boundary
27193 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
27194 boundary. If @option{-mincoming-stack-boundary} is not specified,
27195 the one specified by @option{-mpreferred-stack-boundary} is used.
27197 On Pentium and Pentium Pro, @code{double} and @code{long double} values
27198 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
27199 suffer significant run time performance penalties. On Pentium III, the
27200 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
27201 properly if it is not 16-byte aligned.
27203 To ensure proper alignment of this values on the stack, the stack boundary
27204 must be as aligned as that required by any value stored on the stack.
27205 Further, every function must be generated such that it keeps the stack
27206 aligned. Thus calling a function compiled with a higher preferred
27207 stack boundary from a function compiled with a lower preferred stack
27208 boundary most likely misaligns the stack. It is recommended that
27209 libraries that use callbacks always use the default setting.
27211 This extra alignment does consume extra stack space, and generally
27212 increases code size. Code that is sensitive to stack space usage, such
27213 as embedded systems and operating system kernels, may want to reduce the
27214 preferred alignment to @option{-mpreferred-stack-boundary=2}.
27271 @itemx -mavx512ifma
27272 @opindex mavx512ifma
27274 @itemx -mavx512vbmi
27275 @opindex mavx512vbmi
27286 @itemx -mclflushopt
27287 @opindex mclflushopt
27310 @itemx -mprefetchwt1
27311 @opindex mprefetchwt1
27369 @itemx -mavx512vbmi2
27370 @opindex mavx512vbmi2
27381 @itemx -mvpclmulqdq
27382 @opindex mvpclmulqdq
27384 @itemx -mavx512bitalg
27385 @opindex mavx512bitalg
27391 @opindex mmovdir64b
27393 @itemx -mavx512vpopcntdq
27394 @opindex mavx512vpopcntdq
27398 These switches enable the use of instructions in the MMX, SSE,
27399 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27400 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
27401 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, BMI, BMI2, VAES, WAITPKG,
27402 FXSR, XSAVE, XSAVEOPT, LZCNT, RTM, MWAITX, PKU, IBT, SHSTK, AVX512VBMI2,
27403 GFNI, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B,
27404 AVX512VPOPCNTDQ, CLDEMOTE, 3DNow!@: or enhanced 3DNow!@: extended instruction
27405 sets. Each has a corresponding @option{-mno-} option to disable use of these
27408 These extensions are also available as built-in functions: see
27409 @ref{x86 Built-in Functions}, for details of the functions enabled and
27410 disabled by these switches.
27412 To generate SSE/SSE2 instructions automatically from floating-point
27413 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
27415 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
27416 generates new AVX instructions or AVX equivalence for all SSEx instructions
27419 These options enable GCC to use these extended instructions in
27420 generated code, even without @option{-mfpmath=sse}. Applications that
27421 perform run-time CPU detection must compile separate files for each
27422 supported architecture, using the appropriate flags. In particular,
27423 the file containing the CPU detection code should be compiled without
27426 @item -mdump-tune-features
27427 @opindex mdump-tune-features
27428 This option instructs GCC to dump the names of the x86 performance
27429 tuning features and default settings. The names can be used in
27430 @option{-mtune-ctrl=@var{feature-list}}.
27432 @item -mtune-ctrl=@var{feature-list}
27433 @opindex mtune-ctrl=@var{feature-list}
27434 This option is used to do fine grain control of x86 code generation features.
27435 @var{feature-list} is a comma separated list of @var{feature} names. See also
27436 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
27437 on if it is not preceded with @samp{^}, otherwise, it is turned off.
27438 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
27439 developers. Using it may lead to code paths not covered by testing and can
27440 potentially result in compiler ICEs or runtime errors.
27443 @opindex mno-default
27444 This option instructs GCC to turn off all tunable features. See also
27445 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
27449 This option instructs GCC to emit a @code{cld} instruction in the prologue
27450 of functions that use string instructions. String instructions depend on
27451 the DF flag to select between autoincrement or autodecrement mode. While the
27452 ABI specifies the DF flag to be cleared on function entry, some operating
27453 systems violate this specification by not clearing the DF flag in their
27454 exception dispatchers. The exception handler can be invoked with the DF flag
27455 set, which leads to wrong direction mode when string instructions are used.
27456 This option can be enabled by default on 32-bit x86 targets by configuring
27457 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
27458 instructions can be suppressed with the @option{-mno-cld} compiler option
27462 @opindex mvzeroupper
27463 This option instructs GCC to emit a @code{vzeroupper} instruction
27464 before a transfer of control flow out of the function to minimize
27465 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
27468 @item -mprefer-avx128
27469 @opindex mprefer-avx128
27470 This option instructs GCC to use 128-bit AVX instructions instead of
27471 256-bit AVX instructions in the auto-vectorizer.
27473 @item -mprefer-vector-width=@var{opt}
27474 @opindex mprefer-vector-width
27475 This option instructs GCC to use @var{opt}-bit vector width in instructions
27476 instead of default on the selected platform.
27480 No extra limitations applied to GCC other than defined by the selected platform.
27483 Prefer 128-bit vector width for instructions.
27486 Prefer 256-bit vector width for instructions.
27489 Prefer 512-bit vector width for instructions.
27494 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
27495 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
27496 objects. This is useful for atomic updates of data structures exceeding one
27497 machine word in size. The compiler uses this instruction to implement
27498 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
27499 128-bit integers, a library call is always used.
27503 This option enables generation of @code{SAHF} instructions in 64-bit code.
27504 Early Intel Pentium 4 CPUs with Intel 64 support,
27505 prior to the introduction of Pentium 4 G1 step in December 2005,
27506 lacked the @code{LAHF} and @code{SAHF} instructions
27507 which are supported by AMD64.
27508 These are load and store instructions, respectively, for certain status flags.
27509 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
27510 @code{drem}, and @code{remainder} built-in functions;
27511 see @ref{Other Builtins} for details.
27515 This option enables use of the @code{movbe} instruction to implement
27516 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
27520 The @option{-mshstk} option enables shadow stack built-in functions
27521 from x86 Control-flow Enforcement Technology (CET).
27525 This option enables built-in functions @code{__builtin_ia32_crc32qi},
27526 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
27527 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
27531 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
27532 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
27533 with an additional Newton-Raphson step
27534 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
27535 (and their vectorized
27536 variants) for single-precision floating-point arguments. These instructions
27537 are generated only when @option{-funsafe-math-optimizations} is enabled
27538 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
27539 Note that while the throughput of the sequence is higher than the throughput
27540 of the non-reciprocal instruction, the precision of the sequence can be
27541 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
27543 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
27544 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
27545 combination), and doesn't need @option{-mrecip}.
27547 Also note that GCC emits the above sequence with additional Newton-Raphson step
27548 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
27549 already with @option{-ffast-math} (or the above option combination), and
27550 doesn't need @option{-mrecip}.
27552 @item -mrecip=@var{opt}
27553 @opindex mrecip=opt
27554 This option controls which reciprocal estimate instructions
27555 may be used. @var{opt} is a comma-separated list of options, which may
27556 be preceded by a @samp{!} to invert the option:
27560 Enable all estimate instructions.
27563 Enable the default instructions, equivalent to @option{-mrecip}.
27566 Disable all estimate instructions, equivalent to @option{-mno-recip}.
27569 Enable the approximation for scalar division.
27572 Enable the approximation for vectorized division.
27575 Enable the approximation for scalar square root.
27578 Enable the approximation for vectorized square root.
27581 So, for example, @option{-mrecip=all,!sqrt} enables
27582 all of the reciprocal approximations, except for square root.
27584 @item -mveclibabi=@var{type}
27585 @opindex mveclibabi
27586 Specifies the ABI type to use for vectorizing intrinsics using an
27587 external library. Supported values for @var{type} are @samp{svml}
27588 for the Intel short
27589 vector math library and @samp{acml} for the AMD math core library.
27590 To use this option, both @option{-ftree-vectorize} and
27591 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
27592 ABI-compatible library must be specified at link time.
27594 GCC currently emits calls to @code{vmldExp2},
27595 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
27596 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
27597 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
27598 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
27599 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
27600 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
27601 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
27602 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
27603 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
27604 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
27605 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
27606 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
27607 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
27608 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
27609 when @option{-mveclibabi=acml} is used.
27611 @item -mabi=@var{name}
27613 Generate code for the specified calling convention. Permissible values
27614 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
27615 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
27616 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
27617 You can control this behavior for specific functions by
27618 using the function attributes @code{ms_abi} and @code{sysv_abi}.
27619 @xref{Function Attributes}.
27621 @item -mforce-indirect-call
27622 @opindex mforce-indirect-call
27623 Force all calls to functions to be indirect. This is useful
27624 when using Intel Processor Trace where it generates more precise timing
27625 information for function calls.
27627 @item -mcall-ms2sysv-xlogues
27628 @opindex mcall-ms2sysv-xlogues
27629 @opindex mno-call-ms2sysv-xlogues
27630 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
27631 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
27632 default, the code for saving and restoring these registers is emitted inline,
27633 resulting in fairly lengthy prologues and epilogues. Using
27634 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
27635 use stubs in the static portion of libgcc to perform these saves and restores,
27636 thus reducing function size at the cost of a few extra instructions.
27638 @item -mtls-dialect=@var{type}
27639 @opindex mtls-dialect
27640 Generate code to access thread-local storage using the @samp{gnu} or
27641 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
27642 @samp{gnu2} is more efficient, but it may add compile- and run-time
27643 requirements that cannot be satisfied on all systems.
27646 @itemx -mno-push-args
27647 @opindex mpush-args
27648 @opindex mno-push-args
27649 Use PUSH operations to store outgoing parameters. This method is shorter
27650 and usually equally fast as method using SUB/MOV operations and is enabled
27651 by default. In some cases disabling it may improve performance because of
27652 improved scheduling and reduced dependencies.
27654 @item -maccumulate-outgoing-args
27655 @opindex maccumulate-outgoing-args
27656 If enabled, the maximum amount of space required for outgoing arguments is
27657 computed in the function prologue. This is faster on most modern CPUs
27658 because of reduced dependencies, improved scheduling and reduced stack usage
27659 when the preferred stack boundary is not equal to 2. The drawback is a notable
27660 increase in code size. This switch implies @option{-mno-push-args}.
27664 Support thread-safe exception handling on MinGW. Programs that rely
27665 on thread-safe exception handling must compile and link all code with the
27666 @option{-mthreads} option. When compiling, @option{-mthreads} defines
27667 @option{-D_MT}; when linking, it links in a special thread helper library
27668 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
27670 @item -mms-bitfields
27671 @itemx -mno-ms-bitfields
27672 @opindex mms-bitfields
27673 @opindex mno-ms-bitfields
27675 Enable/disable bit-field layout compatible with the native Microsoft
27678 If @code{packed} is used on a structure, or if bit-fields are used,
27679 it may be that the Microsoft ABI lays out the structure differently
27680 than the way GCC normally does. Particularly when moving packed
27681 data between functions compiled with GCC and the native Microsoft compiler
27682 (either via function call or as data in a file), it may be necessary to access
27685 This option is enabled by default for Microsoft Windows
27686 targets. This behavior can also be controlled locally by use of variable
27687 or type attributes. For more information, see @ref{x86 Variable Attributes}
27688 and @ref{x86 Type Attributes}.
27690 The Microsoft structure layout algorithm is fairly simple with the exception
27691 of the bit-field packing.
27692 The padding and alignment of members of structures and whether a bit-field
27693 can straddle a storage-unit boundary are determine by these rules:
27696 @item Structure members are stored sequentially in the order in which they are
27697 declared: the first member has the lowest memory address and the last member
27700 @item Every data object has an alignment requirement. The alignment requirement
27701 for all data except structures, unions, and arrays is either the size of the
27702 object or the current packing size (specified with either the
27703 @code{aligned} attribute or the @code{pack} pragma),
27704 whichever is less. For structures, unions, and arrays,
27705 the alignment requirement is the largest alignment requirement of its members.
27706 Every object is allocated an offset so that:
27709 offset % alignment_requirement == 0
27712 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
27713 unit if the integral types are the same size and if the next bit-field fits
27714 into the current allocation unit without crossing the boundary imposed by the
27715 common alignment requirements of the bit-fields.
27718 MSVC interprets zero-length bit-fields in the following ways:
27721 @item If a zero-length bit-field is inserted between two bit-fields that
27722 are normally coalesced, the bit-fields are not coalesced.
27729 unsigned long bf_1 : 12;
27731 unsigned long bf_2 : 12;
27736 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
27737 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
27739 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
27740 alignment of the zero-length bit-field is greater than the member that follows it,
27741 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
27762 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
27763 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
27764 bit-field does not affect the alignment of @code{bar} or, as a result, the size
27767 Taking this into account, it is important to note the following:
27770 @item If a zero-length bit-field follows a normal bit-field, the type of the
27771 zero-length bit-field may affect the alignment of the structure as whole. For
27772 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
27773 normal bit-field, and is of type short.
27775 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
27776 still affect the alignment of the structure:
27787 Here, @code{t4} takes up 4 bytes.
27790 @item Zero-length bit-fields following non-bit-field members are ignored:
27802 Here, @code{t5} takes up 2 bytes.
27806 @item -mno-align-stringops
27807 @opindex mno-align-stringops
27808 Do not align the destination of inlined string operations. This switch reduces
27809 code size and improves performance in case the destination is already aligned,
27810 but GCC doesn't know about it.
27812 @item -minline-all-stringops
27813 @opindex minline-all-stringops
27814 By default GCC inlines string operations only when the destination is
27815 known to be aligned to least a 4-byte boundary.
27816 This enables more inlining and increases code
27817 size, but may improve performance of code that depends on fast
27818 @code{memcpy}, @code{strlen},
27819 and @code{memset} for short lengths.
27821 @item -minline-stringops-dynamically
27822 @opindex minline-stringops-dynamically
27823 For string operations of unknown size, use run-time checks with
27824 inline code for small blocks and a library call for large blocks.
27826 @item -mstringop-strategy=@var{alg}
27827 @opindex mstringop-strategy=@var{alg}
27828 Override the internal decision heuristic for the particular algorithm to use
27829 for inlining string operations. The allowed values for @var{alg} are:
27835 Expand using i386 @code{rep} prefix of the specified size.
27839 @itemx unrolled_loop
27840 Expand into an inline loop.
27843 Always use a library call.
27846 @item -mmemcpy-strategy=@var{strategy}
27847 @opindex mmemcpy-strategy=@var{strategy}
27848 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
27849 should be inlined and what inline algorithm to use when the expected size
27850 of the copy operation is known. @var{strategy}
27851 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
27852 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
27853 the max byte size with which inline algorithm @var{alg} is allowed. For the last
27854 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
27855 in the list must be specified in increasing order. The minimal byte size for
27856 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
27859 @item -mmemset-strategy=@var{strategy}
27860 @opindex mmemset-strategy=@var{strategy}
27861 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
27862 @code{__builtin_memset} expansion.
27864 @item -momit-leaf-frame-pointer
27865 @opindex momit-leaf-frame-pointer
27866 Don't keep the frame pointer in a register for leaf functions. This
27867 avoids the instructions to save, set up, and restore frame pointers and
27868 makes an extra register available in leaf functions. The option
27869 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
27870 which might make debugging harder.
27872 @item -mtls-direct-seg-refs
27873 @itemx -mno-tls-direct-seg-refs
27874 @opindex mtls-direct-seg-refs
27875 Controls whether TLS variables may be accessed with offsets from the
27876 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
27877 or whether the thread base pointer must be added. Whether or not this
27878 is valid depends on the operating system, and whether it maps the
27879 segment to cover the entire TLS area.
27881 For systems that use the GNU C Library, the default is on.
27884 @itemx -mno-sse2avx
27886 Specify that the assembler should encode SSE instructions with VEX
27887 prefix. The option @option{-mavx} turns this on by default.
27892 If profiling is active (@option{-pg}), put the profiling
27893 counter call before the prologue.
27894 Note: On x86 architectures the attribute @code{ms_hook_prologue}
27895 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
27897 @item -mrecord-mcount
27898 @itemx -mno-record-mcount
27899 @opindex mrecord-mcount
27900 If profiling is active (@option{-pg}), generate a __mcount_loc section
27901 that contains pointers to each profiling call. This is useful for
27902 automatically patching and out calls.
27905 @itemx -mno-nop-mcount
27906 @opindex mnop-mcount
27907 If profiling is active (@option{-pg}), generate the calls to
27908 the profiling functions as NOPs. This is useful when they
27909 should be patched in later dynamically. This is likely only
27910 useful together with @option{-mrecord-mcount}.
27912 @item -mskip-rax-setup
27913 @itemx -mno-skip-rax-setup
27914 @opindex mskip-rax-setup
27915 When generating code for the x86-64 architecture with SSE extensions
27916 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
27917 register when there are no variable arguments passed in vector registers.
27919 @strong{Warning:} Since RAX register is used to avoid unnecessarily
27920 saving vector registers on stack when passing variable arguments, the
27921 impacts of this option are callees may waste some stack space,
27922 misbehave or jump to a random location. GCC 4.4 or newer don't have
27923 those issues, regardless the RAX register value.
27926 @itemx -mno-8bit-idiv
27927 @opindex m8bit-idiv
27928 On some processors, like Intel Atom, 8-bit unsigned integer divide is
27929 much faster than 32-bit/64-bit integer divide. This option generates a
27930 run-time check. If both dividend and divisor are within range of 0
27931 to 255, 8-bit unsigned integer divide is used instead of
27932 32-bit/64-bit integer divide.
27934 @item -mavx256-split-unaligned-load
27935 @itemx -mavx256-split-unaligned-store
27936 @opindex mavx256-split-unaligned-load
27937 @opindex mavx256-split-unaligned-store
27938 Split 32-byte AVX unaligned load and store.
27940 @item -mstack-protector-guard=@var{guard}
27941 @itemx -mstack-protector-guard-reg=@var{reg}
27942 @itemx -mstack-protector-guard-offset=@var{offset}
27943 @opindex mstack-protector-guard
27944 @opindex mstack-protector-guard-reg
27945 @opindex mstack-protector-guard-offset
27946 Generate stack protection code using canary at @var{guard}. Supported
27947 locations are @samp{global} for global canary or @samp{tls} for per-thread
27948 canary in the TLS block (the default). This option has effect only when
27949 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
27951 With the latter choice the options
27952 @option{-mstack-protector-guard-reg=@var{reg}} and
27953 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
27954 which segment register (@code{%fs} or @code{%gs}) to use as base register
27955 for reading the canary, and from what offset from that base register.
27956 The default for those is as specified in the relevant ABI.
27958 @item -mmitigate-rop
27959 @opindex mmitigate-rop
27960 Try to avoid generating code sequences that contain unintended return
27961 opcodes, to mitigate against certain forms of attack. At the moment,
27962 this option is limited in what it can do and should not be relied
27963 on to provide serious protection.
27965 @item -mgeneral-regs-only
27966 @opindex mgeneral-regs-only
27967 Generate code that uses only the general-purpose registers. This
27968 prevents the compiler from using floating-point, vector, mask and bound
27971 @item -mindirect-branch=@var{choice}
27972 @opindex -mindirect-branch
27973 Convert indirect call and jump with @var{choice}. The default is
27974 @samp{keep}, which keeps indirect call and jump unmodified.
27975 @samp{thunk} converts indirect call and jump to call and return thunk.
27976 @samp{thunk-inline} converts indirect call and jump to inlined call
27977 and return thunk. @samp{thunk-extern} converts indirect call and jump
27978 to external call and return thunk provided in a separate object file.
27979 You can control this behavior for a specific function by using the
27980 function attribute @code{indirect_branch}. @xref{Function Attributes}.
27982 Note that @option{-mcmodel=large} is incompatible with
27983 @option{-mindirect-branch=thunk} and
27984 @option{-mindirect-branch=thunk-extern} since the thunk function may
27985 not be reachable in the large code model.
27987 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
27988 @option{-fcf-protection=branch} since the external thunk can not be modified
27989 to disable control-flow check.
27991 @item -mfunction-return=@var{choice}
27992 @opindex -mfunction-return
27993 Convert function return with @var{choice}. The default is @samp{keep},
27994 which keeps function return unmodified. @samp{thunk} converts function
27995 return to call and return thunk. @samp{thunk-inline} converts function
27996 return to inlined call and return thunk. @samp{thunk-extern} converts
27997 function return to external call and return thunk provided in a separate
27998 object file. You can control this behavior for a specific function by
27999 using the function attribute @code{function_return}.
28000 @xref{Function Attributes}.
28002 Note that @option{-mcmodel=large} is incompatible with
28003 @option{-mfunction-return=thunk} and
28004 @option{-mfunction-return=thunk-extern} since the thunk function may
28005 not be reachable in the large code model.
28008 @item -mindirect-branch-register
28009 @opindex -mindirect-branch-register
28010 Force indirect call and jump via register.
28014 These @samp{-m} switches are supported in addition to the above
28015 on x86-64 processors in 64-bit environments.
28028 Generate code for a 16-bit, 32-bit or 64-bit environment.
28029 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
28031 generates code that runs on any i386 system.
28033 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
28034 types to 64 bits, and generates code for the x86-64 architecture.
28035 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
28036 and @option{-mdynamic-no-pic} options.
28038 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
28040 generates code for the x86-64 architecture.
28042 The @option{-m16} option is the same as @option{-m32}, except for that
28043 it outputs the @code{.code16gcc} assembly directive at the beginning of
28044 the assembly output so that the binary can run in 16-bit mode.
28046 The @option{-miamcu} option generates code which conforms to Intel MCU
28047 psABI. It requires the @option{-m32} option to be turned on.
28049 @item -mno-red-zone
28050 @opindex mno-red-zone
28051 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
28052 by the x86-64 ABI; it is a 128-byte area beyond the location of the
28053 stack pointer that is not modified by signal or interrupt handlers
28054 and therefore can be used for temporary data without adjusting the stack
28055 pointer. The flag @option{-mno-red-zone} disables this red zone.
28057 @item -mcmodel=small
28058 @opindex mcmodel=small
28059 Generate code for the small code model: the program and its symbols must
28060 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
28061 Programs can be statically or dynamically linked. This is the default
28064 @item -mcmodel=kernel
28065 @opindex mcmodel=kernel
28066 Generate code for the kernel code model. The kernel runs in the
28067 negative 2 GB of the address space.
28068 This model has to be used for Linux kernel code.
28070 @item -mcmodel=medium
28071 @opindex mcmodel=medium
28072 Generate code for the medium model: the program is linked in the lower 2
28073 GB of the address space. Small symbols are also placed there. Symbols
28074 with sizes larger than @option{-mlarge-data-threshold} are put into
28075 large data or BSS sections and can be located above 2GB. Programs can
28076 be statically or dynamically linked.
28078 @item -mcmodel=large
28079 @opindex mcmodel=large
28080 Generate code for the large model. This model makes no assumptions
28081 about addresses and sizes of sections.
28083 @item -maddress-mode=long
28084 @opindex maddress-mode=long
28085 Generate code for long address mode. This is only supported for 64-bit
28086 and x32 environments. It is the default address mode for 64-bit
28089 @item -maddress-mode=short
28090 @opindex maddress-mode=short
28091 Generate code for short address mode. This is only supported for 32-bit
28092 and x32 environments. It is the default address mode for 32-bit and
28096 @node x86 Windows Options
28097 @subsection x86 Windows Options
28098 @cindex x86 Windows Options
28099 @cindex Windows Options for x86
28101 These additional options are available for Microsoft Windows targets:
28107 specifies that a console application is to be generated, by
28108 instructing the linker to set the PE header subsystem type
28109 required for console applications.
28110 This option is available for Cygwin and MinGW targets and is
28111 enabled by default on those targets.
28115 This option is available for Cygwin and MinGW targets. It
28116 specifies that a DLL---a dynamic link library---is to be
28117 generated, enabling the selection of the required runtime
28118 startup object and entry point.
28120 @item -mnop-fun-dllimport
28121 @opindex mnop-fun-dllimport
28122 This option is available for Cygwin and MinGW targets. It
28123 specifies that the @code{dllimport} attribute should be ignored.
28127 This option is available for MinGW targets. It specifies
28128 that MinGW-specific thread support is to be used.
28132 This option is available for MinGW-w64 targets. It causes
28133 the @code{UNICODE} preprocessor macro to be predefined, and
28134 chooses Unicode-capable runtime startup code.
28138 This option is available for Cygwin and MinGW targets. It
28139 specifies that the typical Microsoft Windows predefined macros are to
28140 be set in the pre-processor, but does not influence the choice
28141 of runtime library/startup code.
28145 This option is available for Cygwin and MinGW targets. It
28146 specifies that a GUI application is to be generated by
28147 instructing the linker to set the PE header subsystem type
28150 @item -fno-set-stack-executable
28151 @opindex fno-set-stack-executable
28152 This option is available for MinGW targets. It specifies that
28153 the executable flag for the stack used by nested functions isn't
28154 set. This is necessary for binaries running in kernel mode of
28155 Microsoft Windows, as there the User32 API, which is used to set executable
28156 privileges, isn't available.
28158 @item -fwritable-relocated-rdata
28159 @opindex fno-writable-relocated-rdata
28160 This option is available for MinGW and Cygwin targets. It specifies
28161 that relocated-data in read-only section is put into the @code{.data}
28162 section. This is a necessary for older runtimes not supporting
28163 modification of @code{.rdata} sections for pseudo-relocation.
28165 @item -mpe-aligned-commons
28166 @opindex mpe-aligned-commons
28167 This option is available for Cygwin and MinGW targets. It
28168 specifies that the GNU extension to the PE file format that
28169 permits the correct alignment of COMMON variables should be
28170 used when generating code. It is enabled by default if
28171 GCC detects that the target assembler found during configuration
28172 supports the feature.
28175 See also under @ref{x86 Options} for standard options.
28177 @node Xstormy16 Options
28178 @subsection Xstormy16 Options
28179 @cindex Xstormy16 Options
28181 These options are defined for Xstormy16:
28186 Choose startup files and linker script suitable for the simulator.
28189 @node Xtensa Options
28190 @subsection Xtensa Options
28191 @cindex Xtensa Options
28193 These options are supported for Xtensa targets:
28197 @itemx -mno-const16
28199 @opindex mno-const16
28200 Enable or disable use of @code{CONST16} instructions for loading
28201 constant values. The @code{CONST16} instruction is currently not a
28202 standard option from Tensilica. When enabled, @code{CONST16}
28203 instructions are always used in place of the standard @code{L32R}
28204 instructions. The use of @code{CONST16} is enabled by default only if
28205 the @code{L32R} instruction is not available.
28208 @itemx -mno-fused-madd
28209 @opindex mfused-madd
28210 @opindex mno-fused-madd
28211 Enable or disable use of fused multiply/add and multiply/subtract
28212 instructions in the floating-point option. This has no effect if the
28213 floating-point option is not also enabled. Disabling fused multiply/add
28214 and multiply/subtract instructions forces the compiler to use separate
28215 instructions for the multiply and add/subtract operations. This may be
28216 desirable in some cases where strict IEEE 754-compliant results are
28217 required: the fused multiply add/subtract instructions do not round the
28218 intermediate result, thereby producing results with @emph{more} bits of
28219 precision than specified by the IEEE standard. Disabling fused multiply
28220 add/subtract instructions also ensures that the program output is not
28221 sensitive to the compiler's ability to combine multiply and add/subtract
28224 @item -mserialize-volatile
28225 @itemx -mno-serialize-volatile
28226 @opindex mserialize-volatile
28227 @opindex mno-serialize-volatile
28228 When this option is enabled, GCC inserts @code{MEMW} instructions before
28229 @code{volatile} memory references to guarantee sequential consistency.
28230 The default is @option{-mserialize-volatile}. Use
28231 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
28233 @item -mforce-no-pic
28234 @opindex mforce-no-pic
28235 For targets, like GNU/Linux, where all user-mode Xtensa code must be
28236 position-independent code (PIC), this option disables PIC for compiling
28239 @item -mtext-section-literals
28240 @itemx -mno-text-section-literals
28241 @opindex mtext-section-literals
28242 @opindex mno-text-section-literals
28243 These options control the treatment of literal pools. The default is
28244 @option{-mno-text-section-literals}, which places literals in a separate
28245 section in the output file. This allows the literal pool to be placed
28246 in a data RAM/ROM, and it also allows the linker to combine literal
28247 pools from separate object files to remove redundant literals and
28248 improve code size. With @option{-mtext-section-literals}, the literals
28249 are interspersed in the text section in order to keep them as close as
28250 possible to their references. This may be necessary for large assembly
28251 files. Literals for each function are placed right before that function.
28253 @item -mauto-litpools
28254 @itemx -mno-auto-litpools
28255 @opindex mauto-litpools
28256 @opindex mno-auto-litpools
28257 These options control the treatment of literal pools. The default is
28258 @option{-mno-auto-litpools}, which places literals in a separate
28259 section in the output file unless @option{-mtext-section-literals} is
28260 used. With @option{-mauto-litpools} the literals are interspersed in
28261 the text section by the assembler. Compiler does not produce explicit
28262 @code{.literal} directives and loads literals into registers with
28263 @code{MOVI} instructions instead of @code{L32R} to let the assembler
28264 do relaxation and place literals as necessary. This option allows
28265 assembler to create several literal pools per function and assemble
28266 very big functions, which may not be possible with
28267 @option{-mtext-section-literals}.
28269 @item -mtarget-align
28270 @itemx -mno-target-align
28271 @opindex mtarget-align
28272 @opindex mno-target-align
28273 When this option is enabled, GCC instructs the assembler to
28274 automatically align instructions to reduce branch penalties at the
28275 expense of some code density. The assembler attempts to widen density
28276 instructions to align branch targets and the instructions following call
28277 instructions. If there are not enough preceding safe density
28278 instructions to align a target, no widening is performed. The
28279 default is @option{-mtarget-align}. These options do not affect the
28280 treatment of auto-aligned instructions like @code{LOOP}, which the
28281 assembler always aligns, either by widening density instructions or
28282 by inserting NOP instructions.
28285 @itemx -mno-longcalls
28286 @opindex mlongcalls
28287 @opindex mno-longcalls
28288 When this option is enabled, GCC instructs the assembler to translate
28289 direct calls to indirect calls unless it can determine that the target
28290 of a direct call is in the range allowed by the call instruction. This
28291 translation typically occurs for calls to functions in other source
28292 files. Specifically, the assembler translates a direct @code{CALL}
28293 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
28294 The default is @option{-mno-longcalls}. This option should be used in
28295 programs where the call target can potentially be out of range. This
28296 option is implemented in the assembler, not the compiler, so the
28297 assembly code generated by GCC still shows direct call
28298 instructions---look at the disassembled object code to see the actual
28299 instructions. Note that the assembler uses an indirect call for
28300 every cross-file call, not just those that really are out of range.
28303 @node zSeries Options
28304 @subsection zSeries Options
28305 @cindex zSeries options
28307 These are listed under @xref{S/390 and zSeries Options}.
28313 @section Specifying Subprocesses and the Switches to Pass to Them
28316 @command{gcc} is a driver program. It performs its job by invoking a
28317 sequence of other programs to do the work of compiling, assembling and
28318 linking. GCC interprets its command-line parameters and uses these to
28319 deduce which programs it should invoke, and which command-line options
28320 it ought to place on their command lines. This behavior is controlled
28321 by @dfn{spec strings}. In most cases there is one spec string for each
28322 program that GCC can invoke, but a few programs have multiple spec
28323 strings to control their behavior. The spec strings built into GCC can
28324 be overridden by using the @option{-specs=} command-line switch to specify
28327 @dfn{Spec files} are plain-text files that are used to construct spec
28328 strings. They consist of a sequence of directives separated by blank
28329 lines. The type of directive is determined by the first non-whitespace
28330 character on the line, which can be one of the following:
28333 @item %@var{command}
28334 Issues a @var{command} to the spec file processor. The commands that can
28338 @item %include <@var{file}>
28339 @cindex @code{%include}
28340 Search for @var{file} and insert its text at the current point in the
28343 @item %include_noerr <@var{file}>
28344 @cindex @code{%include_noerr}
28345 Just like @samp{%include}, but do not generate an error message if the include
28346 file cannot be found.
28348 @item %rename @var{old_name} @var{new_name}
28349 @cindex @code{%rename}
28350 Rename the spec string @var{old_name} to @var{new_name}.
28354 @item *[@var{spec_name}]:
28355 This tells the compiler to create, override or delete the named spec
28356 string. All lines after this directive up to the next directive or
28357 blank line are considered to be the text for the spec string. If this
28358 results in an empty string then the spec is deleted. (Or, if the
28359 spec did not exist, then nothing happens.) Otherwise, if the spec
28360 does not currently exist a new spec is created. If the spec does
28361 exist then its contents are overridden by the text of this
28362 directive, unless the first character of that text is the @samp{+}
28363 character, in which case the text is appended to the spec.
28365 @item [@var{suffix}]:
28366 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
28367 and up to the next directive or blank line are considered to make up the
28368 spec string for the indicated suffix. When the compiler encounters an
28369 input file with the named suffix, it processes the spec string in
28370 order to work out how to compile that file. For example:
28374 z-compile -input %i
28377 This says that any input file whose name ends in @samp{.ZZ} should be
28378 passed to the program @samp{z-compile}, which should be invoked with the
28379 command-line switch @option{-input} and with the result of performing the
28380 @samp{%i} substitution. (See below.)
28382 As an alternative to providing a spec string, the text following a
28383 suffix directive can be one of the following:
28386 @item @@@var{language}
28387 This says that the suffix is an alias for a known @var{language}. This is
28388 similar to using the @option{-x} command-line switch to GCC to specify a
28389 language explicitly. For example:
28396 Says that .ZZ files are, in fact, C++ source files.
28399 This causes an error messages saying:
28402 @var{name} compiler not installed on this system.
28406 GCC already has an extensive list of suffixes built into it.
28407 This directive adds an entry to the end of the list of suffixes, but
28408 since the list is searched from the end backwards, it is effectively
28409 possible to override earlier entries using this technique.
28413 GCC has the following spec strings built into it. Spec files can
28414 override these strings or create their own. Note that individual
28415 targets can also add their own spec strings to this list.
28418 asm Options to pass to the assembler
28419 asm_final Options to pass to the assembler post-processor
28420 cpp Options to pass to the C preprocessor
28421 cc1 Options to pass to the C compiler
28422 cc1plus Options to pass to the C++ compiler
28423 endfile Object files to include at the end of the link
28424 link Options to pass to the linker
28425 lib Libraries to include on the command line to the linker
28426 libgcc Decides which GCC support library to pass to the linker
28427 linker Sets the name of the linker
28428 predefines Defines to be passed to the C preprocessor
28429 signed_char Defines to pass to CPP to say whether @code{char} is signed
28431 startfile Object files to include at the start of the link
28434 Here is a small example of a spec file:
28437 %rename lib old_lib
28440 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
28443 This example renames the spec called @samp{lib} to @samp{old_lib} and
28444 then overrides the previous definition of @samp{lib} with a new one.
28445 The new definition adds in some extra command-line options before
28446 including the text of the old definition.
28448 @dfn{Spec strings} are a list of command-line options to be passed to their
28449 corresponding program. In addition, the spec strings can contain
28450 @samp{%}-prefixed sequences to substitute variable text or to
28451 conditionally insert text into the command line. Using these constructs
28452 it is possible to generate quite complex command lines.
28454 Here is a table of all defined @samp{%}-sequences for spec
28455 strings. Note that spaces are not generated automatically around the
28456 results of expanding these sequences. Therefore you can concatenate them
28457 together or combine them with constant text in a single argument.
28461 Substitute one @samp{%} into the program name or argument.
28464 Substitute the name of the input file being processed.
28467 Substitute the basename of the input file being processed.
28468 This is the substring up to (and not including) the last period
28469 and not including the directory.
28472 This is the same as @samp{%b}, but include the file suffix (text after
28476 Marks the argument containing or following the @samp{%d} as a
28477 temporary file name, so that that file is deleted if GCC exits
28478 successfully. Unlike @samp{%g}, this contributes no text to the
28481 @item %g@var{suffix}
28482 Substitute a file name that has suffix @var{suffix} and is chosen
28483 once per compilation, and mark the argument in the same way as
28484 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
28485 name is now chosen in a way that is hard to predict even when previously
28486 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
28487 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
28488 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
28489 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
28490 was simply substituted with a file name chosen once per compilation,
28491 without regard to any appended suffix (which was therefore treated
28492 just like ordinary text), making such attacks more likely to succeed.
28494 @item %u@var{suffix}
28495 Like @samp{%g}, but generates a new temporary file name
28496 each time it appears instead of once per compilation.
28498 @item %U@var{suffix}
28499 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
28500 new one if there is no such last file name. In the absence of any
28501 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
28502 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
28503 involves the generation of two distinct file names, one
28504 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
28505 simply substituted with a file name chosen for the previous @samp{%u},
28506 without regard to any appended suffix.
28508 @item %j@var{suffix}
28509 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
28510 writable, and if @option{-save-temps} is not used;
28511 otherwise, substitute the name
28512 of a temporary file, just like @samp{%u}. This temporary file is not
28513 meant for communication between processes, but rather as a junk
28514 disposal mechanism.
28516 @item %|@var{suffix}
28517 @itemx %m@var{suffix}
28518 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
28519 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
28520 all. These are the two most common ways to instruct a program that it
28521 should read from standard input or write to standard output. If you
28522 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
28523 construct: see for example @file{f/lang-specs.h}.
28525 @item %.@var{SUFFIX}
28526 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
28527 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
28528 terminated by the next space or %.
28531 Marks the argument containing or following the @samp{%w} as the
28532 designated output file of this compilation. This puts the argument
28533 into the sequence of arguments that @samp{%o} substitutes.
28536 Substitutes the names of all the output files, with spaces
28537 automatically placed around them. You should write spaces
28538 around the @samp{%o} as well or the results are undefined.
28539 @samp{%o} is for use in the specs for running the linker.
28540 Input files whose names have no recognized suffix are not compiled
28541 at all, but they are included among the output files, so they are
28545 Substitutes the suffix for object files. Note that this is
28546 handled specially when it immediately follows @samp{%g, %u, or %U},
28547 because of the need for those to form complete file names. The
28548 handling is such that @samp{%O} is treated exactly as if it had already
28549 been substituted, except that @samp{%g, %u, and %U} do not currently
28550 support additional @var{suffix} characters following @samp{%O} as they do
28551 following, for example, @samp{.o}.
28554 Substitutes the standard macro predefinitions for the
28555 current target machine. Use this when running @command{cpp}.
28558 Like @samp{%p}, but puts @samp{__} before and after the name of each
28559 predefined macro, except for macros that start with @samp{__} or with
28560 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
28564 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
28565 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
28566 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
28567 and @option{-imultilib} as necessary.
28570 Current argument is the name of a library or startup file of some sort.
28571 Search for that file in a standard list of directories and substitute
28572 the full name found. The current working directory is included in the
28573 list of directories scanned.
28576 Current argument is the name of a linker script. Search for that file
28577 in the current list of directories to scan for libraries. If the file
28578 is located insert a @option{--script} option into the command line
28579 followed by the full path name found. If the file is not found then
28580 generate an error message. Note: the current working directory is not
28584 Print @var{str} as an error message. @var{str} is terminated by a newline.
28585 Use this when inconsistent options are detected.
28587 @item %(@var{name})
28588 Substitute the contents of spec string @var{name} at this point.
28590 @item %x@{@var{option}@}
28591 Accumulate an option for @samp{%X}.
28594 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
28598 Output the accumulated assembler options specified by @option{-Wa}.
28601 Output the accumulated preprocessor options specified by @option{-Wp}.
28604 Process the @code{asm} spec. This is used to compute the
28605 switches to be passed to the assembler.
28608 Process the @code{asm_final} spec. This is a spec string for
28609 passing switches to an assembler post-processor, if such a program is
28613 Process the @code{link} spec. This is the spec for computing the
28614 command line passed to the linker. Typically it makes use of the
28615 @samp{%L %G %S %D and %E} sequences.
28618 Dump out a @option{-L} option for each directory that GCC believes might
28619 contain startup files. If the target supports multilibs then the
28620 current multilib directory is prepended to each of these paths.
28623 Process the @code{lib} spec. This is a spec string for deciding which
28624 libraries are included on the command line to the linker.
28627 Process the @code{libgcc} spec. This is a spec string for deciding
28628 which GCC support library is included on the command line to the linker.
28631 Process the @code{startfile} spec. This is a spec for deciding which
28632 object files are the first ones passed to the linker. Typically
28633 this might be a file named @file{crt0.o}.
28636 Process the @code{endfile} spec. This is a spec string that specifies
28637 the last object files that are passed to the linker.
28640 Process the @code{cpp} spec. This is used to construct the arguments
28641 to be passed to the C preprocessor.
28644 Process the @code{cc1} spec. This is used to construct the options to be
28645 passed to the actual C compiler (@command{cc1}).
28648 Process the @code{cc1plus} spec. This is used to construct the options to be
28649 passed to the actual C++ compiler (@command{cc1plus}).
28652 Substitute the variable part of a matched option. See below.
28653 Note that each comma in the substituted string is replaced by
28657 Remove all occurrences of @code{-S} from the command line. Note---this
28658 command is position dependent. @samp{%} commands in the spec string
28659 before this one see @code{-S}, @samp{%} commands in the spec string
28660 after this one do not.
28662 @item %:@var{function}(@var{args})
28663 Call the named function @var{function}, passing it @var{args}.
28664 @var{args} is first processed as a nested spec string, then split
28665 into an argument vector in the usual fashion. The function returns
28666 a string which is processed as if it had appeared literally as part
28667 of the current spec.
28669 The following built-in spec functions are provided:
28672 @item @code{getenv}
28673 The @code{getenv} spec function takes two arguments: an environment
28674 variable name and a string. If the environment variable is not
28675 defined, a fatal error is issued. Otherwise, the return value is the
28676 value of the environment variable concatenated with the string. For
28677 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
28680 %:getenv(TOPDIR /include)
28683 expands to @file{/path/to/top/include}.
28685 @item @code{if-exists}
28686 The @code{if-exists} spec function takes one argument, an absolute
28687 pathname to a file. If the file exists, @code{if-exists} returns the
28688 pathname. Here is a small example of its usage:
28692 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
28695 @item @code{if-exists-else}
28696 The @code{if-exists-else} spec function is similar to the @code{if-exists}
28697 spec function, except that it takes two arguments. The first argument is
28698 an absolute pathname to a file. If the file exists, @code{if-exists-else}
28699 returns the pathname. If it does not exist, it returns the second argument.
28700 This way, @code{if-exists-else} can be used to select one file or another,
28701 based on the existence of the first. Here is a small example of its usage:
28705 crt0%O%s %:if-exists(crti%O%s) \
28706 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
28709 @item @code{replace-outfile}
28710 The @code{replace-outfile} spec function takes two arguments. It looks for the
28711 first argument in the outfiles array and replaces it with the second argument. Here
28712 is a small example of its usage:
28715 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
28718 @item @code{remove-outfile}
28719 The @code{remove-outfile} spec function takes one argument. It looks for the
28720 first argument in the outfiles array and removes it. Here is a small example
28724 %:remove-outfile(-lm)
28727 @item @code{pass-through-libs}
28728 The @code{pass-through-libs} spec function takes any number of arguments. It
28729 finds any @option{-l} options and any non-options ending in @file{.a} (which it
28730 assumes are the names of linker input library archive files) and returns a
28731 result containing all the found arguments each prepended by
28732 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
28733 intended to be passed to the LTO linker plugin.
28736 %:pass-through-libs(%G %L %G)
28739 @item @code{print-asm-header}
28740 The @code{print-asm-header} function takes no arguments and simply
28741 prints a banner like:
28747 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
28750 It is used to separate compiler options from assembler options
28751 in the @option{--target-help} output.
28755 Substitutes the @code{-S} switch, if that switch is given to GCC@.
28756 If that switch is not specified, this substitutes nothing. Note that
28757 the leading dash is omitted when specifying this option, and it is
28758 automatically inserted if the substitution is performed. Thus the spec
28759 string @samp{%@{foo@}} matches the command-line option @option{-foo}
28760 and outputs the command-line option @option{-foo}.
28763 Like %@{@code{S}@} but mark last argument supplied within as a file to be
28764 deleted on failure.
28767 Substitutes all the switches specified to GCC whose names start
28768 with @code{-S}, but which also take an argument. This is used for
28769 switches like @option{-o}, @option{-D}, @option{-I}, etc.
28770 GCC considers @option{-o foo} as being
28771 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
28772 text, including the space. Thus two arguments are generated.
28775 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
28776 (the order of @code{S} and @code{T} in the spec is not significant).
28777 There can be any number of ampersand-separated variables; for each the
28778 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
28781 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
28784 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
28787 Substitutes @code{X} if one or more switches whose names start with
28788 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
28789 once, no matter how many such switches appeared. However, if @code{%*}
28790 appears somewhere in @code{X}, then @code{X} is substituted once
28791 for each matching switch, with the @code{%*} replaced by the part of
28792 that switch matching the @code{*}.
28794 If @code{%*} appears as the last part of a spec sequence then a space
28795 is added after the end of the last substitution. If there is more
28796 text in the sequence, however, then a space is not generated. This
28797 allows the @code{%*} substitution to be used as part of a larger
28798 string. For example, a spec string like this:
28801 %@{mcu=*:--script=%*/memory.ld@}
28805 when matching an option like @option{-mcu=newchip} produces:
28808 --script=newchip/memory.ld
28812 Substitutes @code{X}, if processing a file with suffix @code{S}.
28815 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
28818 Substitutes @code{X}, if processing a file for language @code{S}.
28821 Substitutes @code{X}, if not processing a file for language @code{S}.
28824 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
28825 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
28826 @code{*} sequences as well, although they have a stronger binding than
28827 the @samp{|}. If @code{%*} appears in @code{X}, all of the
28828 alternatives must be starred, and only the first matching alternative
28831 For example, a spec string like this:
28834 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
28838 outputs the following command-line options from the following input
28839 command-line options:
28844 -d fred.c -foo -baz -boggle
28845 -d jim.d -bar -baz -boggle
28848 @item %@{S:X; T:Y; :D@}
28850 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
28851 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
28852 be as many clauses as you need. This may be combined with @code{.},
28853 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
28858 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
28859 or similar construct can use a backslash to ignore the special meaning
28860 of the character following it, thus allowing literal matching of a
28861 character that is otherwise specially treated. For example,
28862 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
28863 @option{-std=iso9899:1999} option is given.
28865 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
28866 construct may contain other nested @samp{%} constructs or spaces, or
28867 even newlines. They are processed as usual, as described above.
28868 Trailing white space in @code{X} is ignored. White space may also
28869 appear anywhere on the left side of the colon in these constructs,
28870 except between @code{.} or @code{*} and the corresponding word.
28872 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
28873 handled specifically in these constructs. If another value of
28874 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
28875 @option{-W} switch is found later in the command line, the earlier
28876 switch value is ignored, except with @{@code{S}*@} where @code{S} is
28877 just one letter, which passes all matching options.
28879 The character @samp{|} at the beginning of the predicate text is used to
28880 indicate that a command should be piped to the following command, but
28881 only if @option{-pipe} is specified.
28883 It is built into GCC which switches take arguments and which do not.
28884 (You might think it would be useful to generalize this to allow each
28885 compiler's spec to say which switches take arguments. But this cannot
28886 be done in a consistent fashion. GCC cannot even decide which input
28887 files have been specified without knowing which switches take arguments,
28888 and it must know which input files to compile in order to tell which
28891 GCC also knows implicitly that arguments starting in @option{-l} are to be
28892 treated as compiler output files, and passed to the linker in their
28893 proper position among the other output files.
28895 @node Environment Variables
28896 @section Environment Variables Affecting GCC
28897 @cindex environment variables
28899 @c man begin ENVIRONMENT
28900 This section describes several environment variables that affect how GCC
28901 operates. Some of them work by specifying directories or prefixes to use
28902 when searching for various kinds of files. Some are used to specify other
28903 aspects of the compilation environment.
28905 Note that you can also specify places to search using options such as
28906 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
28907 take precedence over places specified using environment variables, which
28908 in turn take precedence over those specified by the configuration of GCC@.
28909 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
28910 GNU Compiler Collection (GCC) Internals}.
28915 @c @itemx LC_COLLATE
28917 @c @itemx LC_MONETARY
28918 @c @itemx LC_NUMERIC
28923 @c @findex LC_COLLATE
28924 @findex LC_MESSAGES
28925 @c @findex LC_MONETARY
28926 @c @findex LC_NUMERIC
28930 These environment variables control the way that GCC uses
28931 localization information which allows GCC to work with different
28932 national conventions. GCC inspects the locale categories
28933 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
28934 so. These locale categories can be set to any value supported by your
28935 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
28936 Kingdom encoded in UTF-8.
28938 The @env{LC_CTYPE} environment variable specifies character
28939 classification. GCC uses it to determine the character boundaries in
28940 a string; this is needed for some multibyte encodings that contain quote
28941 and escape characters that are otherwise interpreted as a string
28944 The @env{LC_MESSAGES} environment variable specifies the language to
28945 use in diagnostic messages.
28947 If the @env{LC_ALL} environment variable is set, it overrides the value
28948 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
28949 and @env{LC_MESSAGES} default to the value of the @env{LANG}
28950 environment variable. If none of these variables are set, GCC
28951 defaults to traditional C English behavior.
28955 If @env{TMPDIR} is set, it specifies the directory to use for temporary
28956 files. GCC uses temporary files to hold the output of one stage of
28957 compilation which is to be used as input to the next stage: for example,
28958 the output of the preprocessor, which is the input to the compiler
28961 @item GCC_COMPARE_DEBUG
28962 @findex GCC_COMPARE_DEBUG
28963 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
28964 @option{-fcompare-debug} to the compiler driver. See the documentation
28965 of this option for more details.
28967 @item GCC_EXEC_PREFIX
28968 @findex GCC_EXEC_PREFIX
28969 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
28970 names of the subprograms executed by the compiler. No slash is added
28971 when this prefix is combined with the name of a subprogram, but you can
28972 specify a prefix that ends with a slash if you wish.
28974 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
28975 an appropriate prefix to use based on the pathname it is invoked with.
28977 If GCC cannot find the subprogram using the specified prefix, it
28978 tries looking in the usual places for the subprogram.
28980 The default value of @env{GCC_EXEC_PREFIX} is
28981 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
28982 the installed compiler. In many cases @var{prefix} is the value
28983 of @code{prefix} when you ran the @file{configure} script.
28985 Other prefixes specified with @option{-B} take precedence over this prefix.
28987 This prefix is also used for finding files such as @file{crt0.o} that are
28990 In addition, the prefix is used in an unusual way in finding the
28991 directories to search for header files. For each of the standard
28992 directories whose name normally begins with @samp{/usr/local/lib/gcc}
28993 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
28994 replacing that beginning with the specified prefix to produce an
28995 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
28996 @file{foo/bar} just before it searches the standard directory
28997 @file{/usr/local/lib/bar}.
28998 If a standard directory begins with the configured
28999 @var{prefix} then the value of @var{prefix} is replaced by
29000 @env{GCC_EXEC_PREFIX} when looking for header files.
29002 @item COMPILER_PATH
29003 @findex COMPILER_PATH
29004 The value of @env{COMPILER_PATH} is a colon-separated list of
29005 directories, much like @env{PATH}. GCC tries the directories thus
29006 specified when searching for subprograms, if it cannot find the
29007 subprograms using @env{GCC_EXEC_PREFIX}.
29010 @findex LIBRARY_PATH
29011 The value of @env{LIBRARY_PATH} is a colon-separated list of
29012 directories, much like @env{PATH}. When configured as a native compiler,
29013 GCC tries the directories thus specified when searching for special
29014 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
29015 using GCC also uses these directories when searching for ordinary
29016 libraries for the @option{-l} option (but directories specified with
29017 @option{-L} come first).
29021 @cindex locale definition
29022 This variable is used to pass locale information to the compiler. One way in
29023 which this information is used is to determine the character set to be used
29024 when character literals, string literals and comments are parsed in C and C++.
29025 When the compiler is configured to allow multibyte characters,
29026 the following values for @env{LANG} are recognized:
29030 Recognize JIS characters.
29032 Recognize SJIS characters.
29034 Recognize EUCJP characters.
29037 If @env{LANG} is not defined, or if it has some other value, then the
29038 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
29039 recognize and translate multibyte characters.
29043 Some additional environment variables affect the behavior of the
29046 @include cppenv.texi
29050 @node Precompiled Headers
29051 @section Using Precompiled Headers
29052 @cindex precompiled headers
29053 @cindex speed of compilation
29055 Often large projects have many header files that are included in every
29056 source file. The time the compiler takes to process these header files
29057 over and over again can account for nearly all of the time required to
29058 build the project. To make builds faster, GCC allows you to
29059 @dfn{precompile} a header file.
29061 To create a precompiled header file, simply compile it as you would any
29062 other file, if necessary using the @option{-x} option to make the driver
29063 treat it as a C or C++ header file. You may want to use a
29064 tool like @command{make} to keep the precompiled header up-to-date when
29065 the headers it contains change.
29067 A precompiled header file is searched for when @code{#include} is
29068 seen in the compilation. As it searches for the included file
29069 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
29070 compiler looks for a precompiled header in each directory just before it
29071 looks for the include file in that directory. The name searched for is
29072 the name specified in the @code{#include} with @samp{.gch} appended. If
29073 the precompiled header file cannot be used, it is ignored.
29075 For instance, if you have @code{#include "all.h"}, and you have
29076 @file{all.h.gch} in the same directory as @file{all.h}, then the
29077 precompiled header file is used if possible, and the original
29078 header is used otherwise.
29080 Alternatively, you might decide to put the precompiled header file in a
29081 directory and use @option{-I} to ensure that directory is searched
29082 before (or instead of) the directory containing the original header.
29083 Then, if you want to check that the precompiled header file is always
29084 used, you can put a file of the same name as the original header in this
29085 directory containing an @code{#error} command.
29087 This also works with @option{-include}. So yet another way to use
29088 precompiled headers, good for projects not designed with precompiled
29089 header files in mind, is to simply take most of the header files used by
29090 a project, include them from another header file, precompile that header
29091 file, and @option{-include} the precompiled header. If the header files
29092 have guards against multiple inclusion, they are skipped because
29093 they've already been included (in the precompiled header).
29095 If you need to precompile the same header file for different
29096 languages, targets, or compiler options, you can instead make a
29097 @emph{directory} named like @file{all.h.gch}, and put each precompiled
29098 header in the directory, perhaps using @option{-o}. It doesn't matter
29099 what you call the files in the directory; every precompiled header in
29100 the directory is considered. The first precompiled header
29101 encountered in the directory that is valid for this compilation is
29102 used; they're searched in no particular order.
29104 There are many other possibilities, limited only by your imagination,
29105 good sense, and the constraints of your build system.
29107 A precompiled header file can be used only when these conditions apply:
29111 Only one precompiled header can be used in a particular compilation.
29114 A precompiled header cannot be used once the first C token is seen. You
29115 can have preprocessor directives before a precompiled header; you cannot
29116 include a precompiled header from inside another header.
29119 The precompiled header file must be produced for the same language as
29120 the current compilation. You cannot use a C precompiled header for a C++
29124 The precompiled header file must have been produced by the same compiler
29125 binary as the current compilation is using.
29128 Any macros defined before the precompiled header is included must
29129 either be defined in the same way as when the precompiled header was
29130 generated, or must not affect the precompiled header, which usually
29131 means that they don't appear in the precompiled header at all.
29133 The @option{-D} option is one way to define a macro before a
29134 precompiled header is included; using a @code{#define} can also do it.
29135 There are also some options that define macros implicitly, like
29136 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
29139 @item If debugging information is output when using the precompiled
29140 header, using @option{-g} or similar, the same kind of debugging information
29141 must have been output when building the precompiled header. However,
29142 a precompiled header built using @option{-g} can be used in a compilation
29143 when no debugging information is being output.
29145 @item The same @option{-m} options must generally be used when building
29146 and using the precompiled header. @xref{Submodel Options},
29147 for any cases where this rule is relaxed.
29149 @item Each of the following options must be the same when building and using
29150 the precompiled header:
29152 @gccoptlist{-fexceptions}
29155 Some other command-line options starting with @option{-f},
29156 @option{-p}, or @option{-O} must be defined in the same way as when
29157 the precompiled header was generated. At present, it's not clear
29158 which options are safe to change and which are not; the safest choice
29159 is to use exactly the same options when generating and using the
29160 precompiled header. The following are known to be safe:
29162 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
29163 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
29164 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
29169 For all of these except the last, the compiler automatically
29170 ignores the precompiled header if the conditions aren't met. If you
29171 find an option combination that doesn't work and doesn't cause the
29172 precompiled header to be ignored, please consider filing a bug report,
29175 If you do use differing options when generating and using the
29176 precompiled header, the actual behavior is a mixture of the
29177 behavior for the options. For instance, if you use @option{-g} to
29178 generate the precompiled header but not when using it, you may or may
29179 not get debugging information for routines in the precompiled header.