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 -fno-diagnostics-show-line-numbers @gol
271 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
272 -fdiagnostics-show-template-tree -fno-elide-type @gol
275 @item Warning Options
276 @xref{Warning Options,,Options to Request or Suppress Warnings}.
277 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
278 -pedantic-errors @gol
279 -w -Wextra -Wall -Waddress -Waggregate-return @gol
280 -Walloc-zero -Walloc-size-larger-than=@var{byte-size}
281 -Walloca -Walloca-larger-than=@var{byte-size} @gol
282 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
283 -Wno-attributes -Wbool-compare -Wbool-operation @gol
284 -Wno-builtin-declaration-mismatch @gol
285 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
286 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
287 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
288 -Wchar-subscripts -Wcatch-value -Wcatch-value=@var{n} @gol
289 -Wclobbered -Wcomment -Wconditionally-supported @gol
290 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
291 -Wdelete-incomplete @gol
292 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
293 -Wdisabled-optimization @gol
294 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
295 -Wno-div-by-zero -Wdouble-promotion @gol
296 -Wduplicated-branches -Wduplicated-cond @gol
297 -Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol
298 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
299 -Wfloat-equal -Wformat -Wformat=2 @gol
300 -Wno-format-contains-nul -Wno-format-extra-args @gol
301 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
302 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
303 -Wformat-y2k -Wframe-address @gol
304 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
305 -Wjump-misses-init @gol
306 -Wif-not-aligned @gol
307 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
308 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
309 -Wimplicit-function-declaration -Wimplicit-int @gol
310 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
311 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
312 -Winvalid-pch -Wlarger-than=@var{byte-size} @gol
313 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
314 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
315 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
316 -Wmissing-field-initializers -Wmissing-include-dirs @gol
317 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
318 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
319 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
320 -Woverride-init-side-effects -Woverlength-strings @gol
321 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
322 -Wparentheses -Wno-pedantic-ms-format @gol
323 -Wplacement-new -Wplacement-new=@var{n} @gol
324 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
325 -Wno-pragmas -Wredundant-decls -Wrestrict -Wno-return-local-addr @gol
326 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
327 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
328 -Wshift-overflow -Wshift-overflow=@var{n} @gol
329 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
330 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
331 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
332 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
333 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
334 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
335 -Wstringop-overflow=@var{n} -Wstringop-truncation @gol
336 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
337 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
338 -Wmissing-format-attribute -Wsubobject-linkage @gol
339 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
340 -Wswitch-unreachable -Wsync-nand @gol
341 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
342 -Wtype-limits -Wundef @gol
343 -Wuninitialized -Wunknown-pragmas @gol
344 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
345 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
346 -Wunused-parameter -Wno-unused-result @gol
347 -Wunused-value -Wunused-variable @gol
348 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
349 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
350 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
351 -Wvla -Wvla-larger-than=@var{byte-size} -Wvolatile-register-var @gol
353 -Wzero-as-null-pointer-constant -Whsa}
355 @item C and Objective-C-only Warning Options
356 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
357 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
358 -Wold-style-declaration -Wold-style-definition @gol
359 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
360 -Wdeclaration-after-statement -Wpointer-sign}
362 @item Debugging Options
363 @xref{Debugging Options,,Options for Debugging Your Program}.
364 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
365 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
366 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
367 -gas-loc-support -gno-as-loc-support @gol
368 -gas-locview-support -gno-as-locview-support @gol
369 -gcolumn-info -gno-column-info @gol
370 -gstatement-frontiers -gno-statement-frontiers @gol
371 -gvariable-location-views -gno-variable-location-views @gol
372 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
373 -ginline-points -gno-inline-points @gol
374 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
376 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
377 -fno-eliminate-unused-debug-types @gol
378 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
379 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
380 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
381 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
382 -fvar-tracking -fvar-tracking-assignments}
384 @item Optimization Options
385 @xref{Optimize Options,,Options that Control Optimization}.
386 @gccoptlist{-faggressive-loop-optimizations @gol
387 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
388 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
389 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
390 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
391 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
392 -fauto-inc-dec -fbranch-probabilities @gol
393 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
394 -fbtr-bb-exclusive -fcaller-saves @gol
395 -fcombine-stack-adjustments -fconserve-stack @gol
396 -fcompare-elim -fcprop-registers -fcrossjumping @gol
397 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
398 -fcx-limited-range @gol
399 -fdata-sections -fdce -fdelayed-branch @gol
400 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
401 -fdevirtualize-at-ltrans -fdse @gol
402 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
403 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
404 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
405 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
406 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
407 -fif-conversion2 -findirect-inlining @gol
408 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
409 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
410 -fipa-bit-cp -fipa-vrp @gol
411 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol
412 -fira-algorithm=@var{algorithm} @gol
413 -fira-region=@var{region} -fira-hoist-pressure @gol
414 -fira-loop-pressure -fno-ira-share-save-slots @gol
415 -fno-ira-share-spill-slots @gol
416 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
417 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
418 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
419 -floop-block -floop-interchange -floop-strip-mine @gol
420 -floop-unroll-and-jam -floop-nest-optimize @gol
421 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
422 -flto-partition=@var{alg} -fmerge-all-constants @gol
423 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
424 -fmove-loop-invariants -fno-branch-count-reg @gol
425 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
426 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
427 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
428 -fno-sched-spec -fno-signed-zeros @gol
429 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
430 -fomit-frame-pointer -foptimize-sibling-calls @gol
431 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
432 -fprefetch-loop-arrays @gol
433 -fprofile-correction @gol
434 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
435 -fprofile-reorder-functions @gol
436 -freciprocal-math -free -frename-registers -freorder-blocks @gol
437 -freorder-blocks-algorithm=@var{algorithm} @gol
438 -freorder-blocks-and-partition -freorder-functions @gol
439 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
440 -frounding-math -fsave-optimization-record @gol
441 -fsched2-use-superblocks -fsched-pressure @gol
442 -fsched-spec-load -fsched-spec-load-dangerous @gol
443 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
444 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
445 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
446 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
447 -fschedule-fusion @gol
448 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
449 -fselective-scheduling -fselective-scheduling2 @gol
450 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
451 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
452 -fsignaling-nans @gol
453 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
455 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
456 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
457 -fthread-jumps -ftracer -ftree-bit-ccp @gol
458 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
459 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
460 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
461 -ftree-loop-if-convert -ftree-loop-im @gol
462 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
463 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
464 -ftree-loop-vectorize @gol
465 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
466 -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
467 -ftree-switch-conversion -ftree-tail-merge @gol
468 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
469 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
470 -funsafe-math-optimizations -funswitch-loops @gol
471 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
472 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
473 --param @var{name}=@var{value}
474 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
476 @item Program Instrumentation Options
477 @xref{Instrumentation Options,,Program Instrumentation Options}.
478 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
479 -fprofile-abs-path @gol
480 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
481 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
482 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
483 -fsanitize-undefined-trap-on-error -fbounds-check @gol
484 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
485 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
486 -fstack-protector-explicit -fstack-check @gol
487 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
488 -fno-stack-limit -fsplit-stack @gol
489 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
490 -fvtv-counts -fvtv-debug @gol
491 -finstrument-functions @gol
492 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
493 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
495 @item Preprocessor Options
496 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
497 @gccoptlist{-A@var{question}=@var{answer} @gol
498 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
499 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
500 -dD -dI -dM -dN -dU @gol
501 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
502 -fexec-charset=@var{charset} -fextended-identifiers @gol
503 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
504 -fno-canonical-system-headers @gol -fpch-deps -fpch-preprocess @gol
505 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
506 -fwide-exec-charset=@var{charset} -fworking-directory @gol
507 -H -imacros @var{file} -include @var{file} @gol
508 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
509 -no-integrated-cpp -P -pthread -remap @gol
510 -traditional -traditional-cpp -trigraphs @gol
511 -U@var{macro} -undef @gol
512 -Wp,@var{option} -Xpreprocessor @var{option}}
514 @item Assembler Options
515 @xref{Assembler Options,,Passing Options to the Assembler}.
516 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
519 @xref{Link Options,,Options for Linking}.
520 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
521 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
522 -pie -pthread -rdynamic @gol
523 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
524 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
525 -shared -shared-libgcc -symbolic @gol
526 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
527 -u @var{symbol} -z @var{keyword}}
529 @item Directory Options
530 @xref{Directory Options,,Options for Directory Search}.
531 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
532 -idirafter @var{dir} @gol
533 -imacros @var{file} -imultilib @var{dir} @gol
534 -iplugindir=@var{dir} -iprefix @var{file} @gol
535 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
536 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
537 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
538 -nostdinc -nostdinc++ --sysroot=@var{dir}}
540 @item Code Generation Options
541 @xref{Code Gen Options,,Options for Code Generation Conventions}.
542 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
543 -ffixed-@var{reg} -fexceptions @gol
544 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
545 -fasynchronous-unwind-tables @gol
547 -finhibit-size-directive -fno-common -fno-ident @gol
548 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
549 -fno-jump-tables @gol
550 -frecord-gcc-switches @gol
551 -freg-struct-return -fshort-enums -fshort-wchar @gol
552 -fverbose-asm -fpack-struct[=@var{n}] @gol
553 -fleading-underscore -ftls-model=@var{model} @gol
554 -fstack-reuse=@var{reuse_level} @gol
555 -ftrampolines -ftrapv -fwrapv @gol
556 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
557 -fstrict-volatile-bitfields -fsync-libcalls}
559 @item Developer Options
560 @xref{Developer Options,,GCC Developer Options}.
561 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
562 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
563 -fdbg-cnt=@var{counter-value-list} @gol
564 -fdisable-ipa-@var{pass_name} @gol
565 -fdisable-rtl-@var{pass_name} @gol
566 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
567 -fdisable-tree-@var{pass_name} @gol
568 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
569 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
570 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
571 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
572 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
574 -fdump-lang-@var{switch} @gol
575 -fdump-lang-@var{switch}-@var{options} @gol
576 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
578 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
579 -fdump-statistics @gol
581 -fdump-tree-@var{switch} @gol
582 -fdump-tree-@var{switch}-@var{options} @gol
583 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
584 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
585 -fenable-@var{kind}-@var{pass} @gol
586 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
587 -fira-verbose=@var{n} @gol
588 -flto-report -flto-report-wpa -fmem-report-wpa @gol
589 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
590 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
591 -fprofile-report @gol
592 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
593 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
594 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
595 -fvar-tracking-assignments-toggle -gtoggle @gol
596 -print-file-name=@var{library} -print-libgcc-file-name @gol
597 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
598 -print-prog-name=@var{program} -print-search-dirs -Q @gol
599 -print-sysroot -print-sysroot-headers-suffix @gol
600 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
602 @item Machine-Dependent Options
603 @xref{Submodel Options,,Machine-Dependent Options}.
604 @c This list is ordered alphanumerically by subsection name.
605 @c Try and put the significant identifier (CPU or system) first,
606 @c so users have a clue at guessing where the ones they want will be.
608 @emph{AArch64 Options}
609 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
610 -mgeneral-regs-only @gol
611 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
612 -mstrict-align -mno-strict-align @gol
613 -momit-leaf-frame-pointer @gol
614 -mtls-dialect=desc -mtls-dialect=traditional @gol
615 -mtls-size=@var{size} @gol
616 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
617 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
618 -mpc-relative-literal-loads @gol
619 -msign-return-address=@var{scope} @gol
620 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
621 -moverride=@var{string} -mverbose-cost-dump -mtrack-speculation}
623 @emph{Adapteva Epiphany Options}
624 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
625 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
626 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
627 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
628 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
629 -msplit-vecmove-early -m1reg-@var{reg}}
632 @gccoptlist{-mbarrel-shifter -mjli-always @gol
633 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
634 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
635 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
636 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
637 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
638 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
639 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
640 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
641 -mvolatile-cache -mtp-regno=@var{regno} @gol
642 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
643 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
644 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
645 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
646 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
647 -mtune=@var{cpu} -mmultcost=@var{num} @gol
648 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
649 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16}
652 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
653 -mabi=@var{name} @gol
654 -mapcs-stack-check -mno-apcs-stack-check @gol
655 -mapcs-reentrant -mno-apcs-reentrant @gol
656 -msched-prolog -mno-sched-prolog @gol
657 -mlittle-endian -mbig-endian @gol
659 -mfloat-abi=@var{name} @gol
660 -mfp16-format=@var{name}
661 -mthumb-interwork -mno-thumb-interwork @gol
662 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
663 -mtune=@var{name} -mprint-tune-info @gol
664 -mstructure-size-boundary=@var{n} @gol
665 -mabort-on-noreturn @gol
666 -mlong-calls -mno-long-calls @gol
667 -msingle-pic-base -mno-single-pic-base @gol
668 -mpic-register=@var{reg} @gol
669 -mnop-fun-dllimport @gol
670 -mpoke-function-name @gol
671 -mthumb -marm -mflip-thumb @gol
672 -mtpcs-frame -mtpcs-leaf-frame @gol
673 -mcaller-super-interworking -mcallee-super-interworking @gol
674 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
675 -mword-relocations @gol
676 -mfix-cortex-m3-ldrd @gol
677 -munaligned-access @gol
678 -mneon-for-64bits @gol
679 -mslow-flash-data @gol
680 -masm-syntax-unified @gol
682 -mverbose-cost-dump @gol
687 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
688 -mbranch-cost=@var{cost} @gol
689 -mcall-prologues -mgas-isr-prologues -mint8 @gol
690 -mn_flash=@var{size} -mno-interrupts @gol
691 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
692 -mfract-convert-truncate @gol
693 -mshort-calls -nodevicelib @gol
694 -Waddr-space-convert -Wmisspelled-isr}
696 @emph{Blackfin Options}
697 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
698 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
699 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
700 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
701 -mno-id-shared-library -mshared-library-id=@var{n} @gol
702 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
703 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
704 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
708 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
709 -msim -msdata=@var{sdata-type}}
712 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
713 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
714 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
715 -mstack-align -mdata-align -mconst-align @gol
716 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
717 -melf -maout -melinux -mlinux -sim -sim2 @gol
718 -mmul-bug-workaround -mno-mul-bug-workaround}
721 @gccoptlist{-mmac @gol
722 -mcr16cplus -mcr16c @gol
723 -msim -mint32 -mbit-ops
724 -mdata-model=@var{model}}
726 @emph{Darwin Options}
727 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
728 -arch_only -bind_at_load -bundle -bundle_loader @gol
729 -client_name -compatibility_version -current_version @gol
731 -dependency-file -dylib_file -dylinker_install_name @gol
732 -dynamic -dynamiclib -exported_symbols_list @gol
733 -filelist -flat_namespace -force_cpusubtype_ALL @gol
734 -force_flat_namespace -headerpad_max_install_names @gol
736 -image_base -init -install_name -keep_private_externs @gol
737 -multi_module -multiply_defined -multiply_defined_unused @gol
738 -noall_load -no_dead_strip_inits_and_terms @gol
739 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
740 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
741 -private_bundle -read_only_relocs -sectalign @gol
742 -sectobjectsymbols -whyload -seg1addr @gol
743 -sectcreate -sectobjectsymbols -sectorder @gol
744 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
745 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
746 -segprot -segs_read_only_addr -segs_read_write_addr @gol
747 -single_module -static -sub_library -sub_umbrella @gol
748 -twolevel_namespace -umbrella -undefined @gol
749 -unexported_symbols_list -weak_reference_mismatches @gol
750 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
751 -mkernel -mone-byte-bool}
753 @emph{DEC Alpha Options}
754 @gccoptlist{-mno-fp-regs -msoft-float @gol
755 -mieee -mieee-with-inexact -mieee-conformant @gol
756 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
757 -mtrap-precision=@var{mode} -mbuild-constants @gol
758 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
759 -mbwx -mmax -mfix -mcix @gol
760 -mfloat-vax -mfloat-ieee @gol
761 -mexplicit-relocs -msmall-data -mlarge-data @gol
762 -msmall-text -mlarge-text @gol
763 -mmemory-latency=@var{time}}
766 @gccoptlist{-msmall-model -mno-lsim}
769 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
772 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
773 -mhard-float -msoft-float @gol
774 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
775 -mdouble -mno-double @gol
776 -mmedia -mno-media -mmuladd -mno-muladd @gol
777 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
778 -mlinked-fp -mlong-calls -malign-labels @gol
779 -mlibrary-pic -macc-4 -macc-8 @gol
780 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
781 -moptimize-membar -mno-optimize-membar @gol
782 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
783 -mvliw-branch -mno-vliw-branch @gol
784 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
785 -mno-nested-cond-exec -mtomcat-stats @gol
789 @emph{GNU/Linux Options}
790 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
791 -tno-android-cc -tno-android-ld}
793 @emph{H8/300 Options}
794 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
797 @gccoptlist{-march=@var{architecture-type} @gol
798 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
799 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
800 -mfixed-range=@var{register-range} @gol
801 -mjump-in-delay -mlinker-opt -mlong-calls @gol
802 -mlong-load-store -mno-disable-fpregs @gol
803 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
804 -mno-jump-in-delay -mno-long-load-store @gol
805 -mno-portable-runtime -mno-soft-float @gol
806 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
807 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
808 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
809 -munix=@var{unix-std} -nolibdld -static -threads}
812 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
813 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
814 -mconstant-gp -mauto-pic -mfused-madd @gol
815 -minline-float-divide-min-latency @gol
816 -minline-float-divide-max-throughput @gol
817 -mno-inline-float-divide @gol
818 -minline-int-divide-min-latency @gol
819 -minline-int-divide-max-throughput @gol
820 -mno-inline-int-divide @gol
821 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
822 -mno-inline-sqrt @gol
823 -mdwarf2-asm -mearly-stop-bits @gol
824 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
825 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
826 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
827 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
828 -msched-spec-ldc -msched-spec-control-ldc @gol
829 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
830 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
831 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
832 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
835 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
836 -msign-extend-enabled -muser-enabled}
838 @emph{M32R/D Options}
839 @gccoptlist{-m32r2 -m32rx -m32r @gol
841 -malign-loops -mno-align-loops @gol
842 -missue-rate=@var{number} @gol
843 -mbranch-cost=@var{number} @gol
844 -mmodel=@var{code-size-model-type} @gol
845 -msdata=@var{sdata-type} @gol
846 -mno-flush-func -mflush-func=@var{name} @gol
847 -mno-flush-trap -mflush-trap=@var{number} @gol
851 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
853 @emph{M680x0 Options}
854 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
855 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
856 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
857 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
858 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
859 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
860 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
861 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
862 -mxgot -mno-xgot -mlong-jump-table-offsets}
865 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
866 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
867 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
868 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
869 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
872 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
873 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
874 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
875 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
878 @emph{MicroBlaze Options}
879 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
880 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
881 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
882 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
883 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}
884 -mpic-data-is-text-relative}
887 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
888 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
889 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
890 -mips16 -mno-mips16 -mflip-mips16 @gol
891 -minterlink-compressed -mno-interlink-compressed @gol
892 -minterlink-mips16 -mno-interlink-mips16 @gol
893 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
894 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
895 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
896 -mno-float -msingle-float -mdouble-float @gol
897 -modd-spreg -mno-odd-spreg @gol
898 -mabs=@var{mode} -mnan=@var{encoding} @gol
899 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
902 -mvirt -mno-virt @gol
905 -mginv -mno-ginv @gol
906 -mmicromips -mno-micromips @gol
908 -mfpu=@var{fpu-type} @gol
909 -msmartmips -mno-smartmips @gol
910 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
911 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
912 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
913 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
914 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
915 -membedded-data -mno-embedded-data @gol
916 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
917 -mcode-readable=@var{setting} @gol
918 -msplit-addresses -mno-split-addresses @gol
919 -mexplicit-relocs -mno-explicit-relocs @gol
920 -mcheck-zero-division -mno-check-zero-division @gol
921 -mdivide-traps -mdivide-breaks @gol
922 -mload-store-pairs -mno-load-store-pairs @gol
923 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
924 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
925 -mfix-24k -mno-fix-24k @gol
926 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
927 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
928 -mfix-vr4120 -mno-fix-vr4120 @gol
929 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
930 -mflush-func=@var{func} -mno-flush-func @gol
931 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
932 -mcompact-branches=@var{policy} @gol
933 -mfp-exceptions -mno-fp-exceptions @gol
934 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
935 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
936 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
937 -mframe-header-opt -mno-frame-header-opt}
940 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
941 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
942 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
943 -mno-base-addresses -msingle-exit -mno-single-exit}
945 @emph{MN10300 Options}
946 @gccoptlist{-mmult-bug -mno-mult-bug @gol
947 -mno-am33 -mam33 -mam33-2 -mam34 @gol
948 -mtune=@var{cpu-type} @gol
949 -mreturn-pointer-on-d0 @gol
950 -mno-crt0 -mrelax -mliw -msetlb}
953 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
955 @emph{MSP430 Options}
956 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
958 -mcode-region= -mdata-region= @gol
959 -msilicon-errata= -msilicon-errata-warn= @gol
963 @gccoptlist{-mbig-endian -mlittle-endian @gol
964 -mreduced-regs -mfull-regs @gol
965 -mcmov -mno-cmov @gol
966 -mext-perf -mno-ext-perf @gol
967 -mext-perf2 -mno-ext-perf2 @gol
968 -mext-string -mno-ext-string @gol
969 -mv3push -mno-v3push @gol
970 -m16bit -mno-16bit @gol
971 -misr-vector-size=@var{num} @gol
972 -mcache-block-size=@var{num} @gol
973 -march=@var{arch} @gol
974 -mcmodel=@var{code-model} @gol
977 @emph{Nios II Options}
978 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
979 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
981 -mno-bypass-cache -mbypass-cache @gol
982 -mno-cache-volatile -mcache-volatile @gol
983 -mno-fast-sw-div -mfast-sw-div @gol
984 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
985 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
986 -mcustom-fpu-cfg=@var{name} @gol
987 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
988 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
990 @emph{Nvidia PTX Options}
991 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
993 @emph{PDP-11 Options}
994 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
995 -mint32 -mno-int16 -mint16 -mno-int32 @gol
996 -mfloat32 -mno-float64 -mfloat64 -mno-float32 @gol
997 -msplit -munix-asm -mdec-asm -mgnu-asm}
999 @emph{picoChip Options}
1000 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1001 -msymbol-as-address -mno-inefficient-warnings}
1003 @emph{PowerPC Options}
1004 See RS/6000 and PowerPC Options.
1006 @emph{PowerPC SPE Options}
1007 @gccoptlist{-mcpu=@var{cpu-type} @gol
1008 -mtune=@var{cpu-type} @gol
1009 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb @gol
1010 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1011 -m32 -mxl-compat -mno-xl-compat @gol
1012 -malign-power -malign-natural @gol
1013 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1014 -msingle-float -mdouble-float @gol
1015 -mupdate -mno-update @gol
1016 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1017 -mstrict-align -mno-strict-align -mrelocatable @gol
1018 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1019 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1020 -msingle-pic-base @gol
1021 -mprioritize-restricted-insns=@var{priority} @gol
1022 -msched-costly-dep=@var{dependence_type} @gol
1023 -minsert-sched-nops=@var{scheme} @gol
1024 -mcall-sysv -mcall-netbsd @gol
1025 -maix-struct-return -msvr4-struct-return @gol
1026 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1027 -mblock-move-inline-limit=@var{num} @gol
1028 -misel -mno-isel @gol
1029 -misel=yes -misel=no @gol
1031 -mspe=yes -mspe=no @gol
1032 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
1033 -mprototype -mno-prototype @gol
1034 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1035 -msdata=@var{opt} -mvxworks -G @var{num} @gol
1036 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1037 -mno-recip-precision @gol
1038 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1039 -msave-toc-indirect -mno-save-toc-indirect @gol
1040 -mcompat-align-parm -mno-compat-align-parm @gol
1041 -mfloat128 -mno-float128 @gol
1042 -mgnu-attribute -mno-gnu-attribute @gol
1043 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1044 -mstack-protector-guard-offset=@var{offset}}
1046 @emph{RISC-V Options}
1047 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1049 -mabi=@var{ABI-string} @gol
1050 -mfdiv -mno-fdiv @gol
1052 -march=@var{ISA-string} @gol
1053 -mtune=@var{processor-string} @gol
1054 -mpreferred-stack-boundary=@var{num} @gol
1055 -msmall-data-limit=@var{N-bytes} @gol
1056 -msave-restore -mno-save-restore @gol
1057 -mstrict-align -mno-strict-align @gol
1058 -mcmodel=medlow -mcmodel=medany @gol
1059 -mexplicit-relocs -mno-explicit-relocs @gol
1060 -mrelax -mno-relax @gol}
1063 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1064 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1065 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1067 @emph{RS/6000 and PowerPC Options}
1068 @gccoptlist{-mcpu=@var{cpu-type} @gol
1069 -mtune=@var{cpu-type} @gol
1070 -mcmodel=@var{code-model} @gol
1072 -maltivec -mno-altivec @gol
1073 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1074 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1075 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1076 -mfprnd -mno-fprnd @gol
1077 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
1078 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1079 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1080 -malign-power -malign-natural @gol
1081 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1082 -mupdate -mno-update @gol
1083 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1084 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1085 -mstrict-align -mno-strict-align -mrelocatable @gol
1086 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1087 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1088 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
1089 -mprioritize-restricted-insns=@var{priority} @gol
1090 -msched-costly-dep=@var{dependence_type} @gol
1091 -minsert-sched-nops=@var{scheme} @gol
1092 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1093 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1094 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1095 -mtraceback=@var{traceback_type} @gol
1096 -maix-struct-return -msvr4-struct-return @gol
1097 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1098 -mblock-move-inline-limit=@var{num} @gol
1099 -mblock-compare-inline-limit=@var{num} @gol
1100 -mblock-compare-inline-loop-limit=@var{num} @gol
1101 -mstring-compare-inline-limit=@var{num} @gol
1102 -misel -mno-isel @gol
1103 -misel=yes -misel=no @gol
1104 -mvrsave -mno-vrsave @gol
1105 -mmulhw -mno-mulhw @gol
1106 -mdlmzb -mno-dlmzb @gol
1107 -mprototype -mno-prototype @gol
1108 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1109 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1110 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1111 -mno-recip-precision @gol
1112 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1113 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1114 -msave-toc-indirect -mno-save-toc-indirect @gol
1115 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1116 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1117 -mquad-memory -mno-quad-memory @gol
1118 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1119 -mcompat-align-parm -mno-compat-align-parm @gol
1120 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1121 -mgnu-attribute -mno-gnu-attribute @gol
1122 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1123 -mstack-protector-guard-offset=@var{offset}}
1126 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1128 -mbig-endian-data -mlittle-endian-data @gol
1131 -mas100-syntax -mno-as100-syntax@gol
1133 -mmax-constant-size=@gol
1136 -mallow-string-insns -mno-allow-string-insns@gol
1138 -mno-warn-multiple-fast-interrupts@gol
1139 -msave-acc-in-interrupts}
1141 @emph{S/390 and zSeries Options}
1142 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1143 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1144 -mlong-double-64 -mlong-double-128 @gol
1145 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1146 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1147 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1148 -mhtm -mvx -mzvector @gol
1149 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1150 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1151 -mhotpatch=@var{halfwords},@var{halfwords}}
1153 @emph{Score Options}
1154 @gccoptlist{-meb -mel @gol
1158 -mscore5 -mscore5u -mscore7 -mscore7d}
1161 @gccoptlist{-m1 -m2 -m2e @gol
1162 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1164 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1165 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1166 -mb -ml -mdalign -mrelax @gol
1167 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1168 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1169 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1170 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1171 -maccumulate-outgoing-args @gol
1172 -matomic-model=@var{atomic-model} @gol
1173 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1174 -mcbranch-force-delay-slot @gol
1175 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1176 -mpretend-cmove -mtas}
1178 @emph{Solaris 2 Options}
1179 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1182 @emph{SPARC Options}
1183 @gccoptlist{-mcpu=@var{cpu-type} @gol
1184 -mtune=@var{cpu-type} @gol
1185 -mcmodel=@var{code-model} @gol
1186 -mmemory-model=@var{mem-model} @gol
1187 -m32 -m64 -mapp-regs -mno-app-regs @gol
1188 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1189 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1190 -mhard-quad-float -msoft-quad-float @gol
1191 -mstack-bias -mno-stack-bias @gol
1192 -mstd-struct-return -mno-std-struct-return @gol
1193 -munaligned-doubles -mno-unaligned-doubles @gol
1194 -muser-mode -mno-user-mode @gol
1195 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1196 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1197 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1198 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1199 -mpopc -mno-popc -msubxc -mno-subxc @gol
1200 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1204 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1205 -msafe-dma -munsafe-dma @gol
1207 -msmall-mem -mlarge-mem -mstdmain @gol
1208 -mfixed-range=@var{register-range} @gol
1210 -maddress-space-conversion -mno-address-space-conversion @gol
1211 -mcache-size=@var{cache-size} @gol
1212 -matomic-updates -mno-atomic-updates}
1214 @emph{System V Options}
1215 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1217 @emph{TILE-Gx Options}
1218 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1219 -mcmodel=@var{code-model}}
1221 @emph{TILEPro Options}
1222 @gccoptlist{-mcpu=@var{cpu} -m32}
1225 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1226 -mprolog-function -mno-prolog-function -mspace @gol
1227 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1228 -mapp-regs -mno-app-regs @gol
1229 -mdisable-callt -mno-disable-callt @gol
1230 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1231 -mv850e -mv850 -mv850e3v5 @gol
1242 @gccoptlist{-mg -mgnu -munix}
1244 @emph{Visium Options}
1245 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1246 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1249 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1250 -mpointer-size=@var{size}}
1252 @emph{VxWorks Options}
1253 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1254 -Xbind-lazy -Xbind-now}
1257 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1258 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1259 -mfpmath=@var{unit} @gol
1260 -masm=@var{dialect} -mno-fancy-math-387 @gol
1261 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1262 -mno-wide-multiply -mrtd -malign-double @gol
1263 -mpreferred-stack-boundary=@var{num} @gol
1264 -mincoming-stack-boundary=@var{num} @gol
1265 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1266 -mrecip -mrecip=@var{opt} @gol
1267 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1268 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1269 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1270 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1271 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1272 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1273 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1274 -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp @gol
1275 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1276 -mshstk -mforce-indirect-call -mavx512vbmi2 @gol
1277 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq
1279 -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1280 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1281 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1282 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1283 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1284 -mregparm=@var{num} -msseregparm @gol
1285 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1286 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1287 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1288 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1289 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1290 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1291 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1292 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1293 -mstack-protector-guard-reg=@var{reg} @gol
1294 -mstack-protector-guard-offset=@var{offset} @gol
1295 -mstack-protector-guard-symbol=@var{symbol} -mmitigate-rop @gol
1296 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1297 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1298 -mindirect-branch-register}
1300 @emph{x86 Windows Options}
1301 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1302 -mnop-fun-dllimport -mthread @gol
1303 -municode -mwin32 -mwindows -fno-set-stack-executable}
1305 @emph{Xstormy16 Options}
1308 @emph{Xtensa Options}
1309 @gccoptlist{-mconst16 -mno-const16 @gol
1310 -mfused-madd -mno-fused-madd @gol
1312 -mserialize-volatile -mno-serialize-volatile @gol
1313 -mtext-section-literals -mno-text-section-literals @gol
1314 -mauto-litpools -mno-auto-litpools @gol
1315 -mtarget-align -mno-target-align @gol
1316 -mlongcalls -mno-longcalls}
1318 @emph{zSeries Options}
1319 See S/390 and zSeries Options.
1323 @node Overall Options
1324 @section Options Controlling the Kind of Output
1326 Compilation can involve up to four stages: preprocessing, compilation
1327 proper, assembly and linking, always in that order. GCC is capable of
1328 preprocessing and compiling several files either into several
1329 assembler input files, or into one assembler input file; then each
1330 assembler input file produces an object file, and linking combines all
1331 the object files (those newly compiled, and those specified as input)
1332 into an executable file.
1334 @cindex file name suffix
1335 For any given input file, the file name suffix determines what kind of
1336 compilation is done:
1340 C source code that must be preprocessed.
1343 C source code that should not be preprocessed.
1346 C++ source code that should not be preprocessed.
1349 Objective-C source code. Note that you must link with the @file{libobjc}
1350 library to make an Objective-C program work.
1353 Objective-C source code that should not be preprocessed.
1357 Objective-C++ source code. Note that you must link with the @file{libobjc}
1358 library to make an Objective-C++ program work. Note that @samp{.M} refers
1359 to a literal capital M@.
1361 @item @var{file}.mii
1362 Objective-C++ source code that should not be preprocessed.
1365 C, C++, Objective-C or Objective-C++ header file to be turned into a
1366 precompiled header (default), or C, C++ header file to be turned into an
1367 Ada spec (via the @option{-fdump-ada-spec} switch).
1370 @itemx @var{file}.cp
1371 @itemx @var{file}.cxx
1372 @itemx @var{file}.cpp
1373 @itemx @var{file}.CPP
1374 @itemx @var{file}.c++
1376 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1377 the last two letters must both be literally @samp{x}. Likewise,
1378 @samp{.C} refers to a literal capital C@.
1382 Objective-C++ source code that must be preprocessed.
1384 @item @var{file}.mii
1385 Objective-C++ source code that should not be preprocessed.
1389 @itemx @var{file}.hp
1390 @itemx @var{file}.hxx
1391 @itemx @var{file}.hpp
1392 @itemx @var{file}.HPP
1393 @itemx @var{file}.h++
1394 @itemx @var{file}.tcc
1395 C++ header file to be turned into a precompiled header or Ada spec.
1398 @itemx @var{file}.for
1399 @itemx @var{file}.ftn
1400 Fixed form Fortran source code that should not be preprocessed.
1403 @itemx @var{file}.FOR
1404 @itemx @var{file}.fpp
1405 @itemx @var{file}.FPP
1406 @itemx @var{file}.FTN
1407 Fixed form Fortran source code that must be preprocessed (with the traditional
1410 @item @var{file}.f90
1411 @itemx @var{file}.f95
1412 @itemx @var{file}.f03
1413 @itemx @var{file}.f08
1414 Free form Fortran source code that should not be preprocessed.
1416 @item @var{file}.F90
1417 @itemx @var{file}.F95
1418 @itemx @var{file}.F03
1419 @itemx @var{file}.F08
1420 Free form Fortran source code that must be preprocessed (with the
1421 traditional preprocessor).
1426 @item @var{file}.brig
1427 BRIG files (binary representation of HSAIL).
1429 @item @var{file}.ads
1430 Ada source code file that contains a library unit declaration (a
1431 declaration of a package, subprogram, or generic, or a generic
1432 instantiation), or a library unit renaming declaration (a package,
1433 generic, or subprogram renaming declaration). Such files are also
1436 @item @var{file}.adb
1437 Ada source code file containing a library unit body (a subprogram or
1438 package body). Such files are also called @dfn{bodies}.
1440 @c GCC also knows about some suffixes for languages not yet included:
1451 @itemx @var{file}.sx
1452 Assembler code that must be preprocessed.
1455 An object file to be fed straight into linking.
1456 Any file name with no recognized suffix is treated this way.
1460 You can specify the input language explicitly with the @option{-x} option:
1463 @item -x @var{language}
1464 Specify explicitly the @var{language} for the following input files
1465 (rather than letting the compiler choose a default based on the file
1466 name suffix). This option applies to all following input files until
1467 the next @option{-x} option. Possible values for @var{language} are:
1469 c c-header cpp-output
1470 c++ c++-header c++-cpp-output
1471 objective-c objective-c-header objective-c-cpp-output
1472 objective-c++ objective-c++-header objective-c++-cpp-output
1473 assembler assembler-with-cpp
1475 f77 f77-cpp-input f95 f95-cpp-input
1481 Turn off any specification of a language, so that subsequent files are
1482 handled according to their file name suffixes (as they are if @option{-x}
1483 has not been used at all).
1486 If you only want some of the stages of compilation, you can use
1487 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1488 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1489 @command{gcc} is to stop. Note that some combinations (for example,
1490 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1495 Compile or assemble the source files, but do not link. The linking
1496 stage simply is not done. The ultimate output is in the form of an
1497 object file for each source file.
1499 By default, the object file name for a source file is made by replacing
1500 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1502 Unrecognized input files, not requiring compilation or assembly, are
1507 Stop after the stage of compilation proper; do not assemble. The output
1508 is in the form of an assembler code file for each non-assembler input
1511 By default, the assembler file name for a source file is made by
1512 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1514 Input files that don't require compilation are ignored.
1518 Stop after the preprocessing stage; do not run the compiler proper. The
1519 output is in the form of preprocessed source code, which is sent to the
1522 Input files that don't require preprocessing are ignored.
1524 @cindex output file option
1527 Place output in file @var{file}. This applies to whatever
1528 sort of output is being produced, whether it be an executable file,
1529 an object file, an assembler file or preprocessed C code.
1531 If @option{-o} is not specified, the default is to put an executable
1532 file in @file{a.out}, the object file for
1533 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1534 assembler file in @file{@var{source}.s}, a precompiled header file in
1535 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1540 Print (on standard error output) the commands executed to run the stages
1541 of compilation. Also print the version number of the compiler driver
1542 program and of the preprocessor and the compiler proper.
1546 Like @option{-v} except the commands are not executed and arguments
1547 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1548 This is useful for shell scripts to capture the driver-generated command lines.
1552 Print (on the standard output) a description of the command-line options
1553 understood by @command{gcc}. If the @option{-v} option is also specified
1554 then @option{--help} is also passed on to the various processes
1555 invoked by @command{gcc}, so that they can display the command-line options
1556 they accept. If the @option{-Wextra} option has also been specified
1557 (prior to the @option{--help} option), then command-line options that
1558 have no documentation associated with them are also displayed.
1561 @opindex target-help
1562 Print (on the standard output) a description of target-specific command-line
1563 options for each tool. For some targets extra target-specific
1564 information may also be printed.
1566 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1567 Print (on the standard output) a description of the command-line
1568 options understood by the compiler that fit into all specified classes
1569 and qualifiers. These are the supported classes:
1572 @item @samp{optimizers}
1573 Display all of the optimization options supported by the
1576 @item @samp{warnings}
1577 Display all of the options controlling warning messages
1578 produced by the compiler.
1581 Display target-specific options. Unlike the
1582 @option{--target-help} option however, target-specific options of the
1583 linker and assembler are not displayed. This is because those
1584 tools do not currently support the extended @option{--help=} syntax.
1587 Display the values recognized by the @option{--param}
1590 @item @var{language}
1591 Display the options supported for @var{language}, where
1592 @var{language} is the name of one of the languages supported in this
1596 Display the options that are common to all languages.
1599 These are the supported qualifiers:
1602 @item @samp{undocumented}
1603 Display only those options that are undocumented.
1606 Display options taking an argument that appears after an equal
1607 sign in the same continuous piece of text, such as:
1608 @samp{--help=target}.
1610 @item @samp{separate}
1611 Display options taking an argument that appears as a separate word
1612 following the original option, such as: @samp{-o output-file}.
1615 Thus for example to display all the undocumented target-specific
1616 switches supported by the compiler, use:
1619 --help=target,undocumented
1622 The sense of a qualifier can be inverted by prefixing it with the
1623 @samp{^} character, so for example to display all binary warning
1624 options (i.e., ones that are either on or off and that do not take an
1625 argument) that have a description, use:
1628 --help=warnings,^joined,^undocumented
1631 The argument to @option{--help=} should not consist solely of inverted
1634 Combining several classes is possible, although this usually
1635 restricts the output so much that there is nothing to display. One
1636 case where it does work, however, is when one of the classes is
1637 @var{target}. For example, to display all the target-specific
1638 optimization options, use:
1641 --help=target,optimizers
1644 The @option{--help=} option can be repeated on the command line. Each
1645 successive use displays its requested class of options, skipping
1646 those that have already been displayed.
1648 If the @option{-Q} option appears on the command line before the
1649 @option{--help=} option, then the descriptive text displayed by
1650 @option{--help=} is changed. Instead of describing the displayed
1651 options, an indication is given as to whether the option is enabled,
1652 disabled or set to a specific value (assuming that the compiler
1653 knows this at the point where the @option{--help=} option is used).
1655 Here is a truncated example from the ARM port of @command{gcc}:
1658 % gcc -Q -mabi=2 --help=target -c
1659 The following options are target specific:
1661 -mabort-on-noreturn [disabled]
1665 The output is sensitive to the effects of previous command-line
1666 options, so for example it is possible to find out which optimizations
1667 are enabled at @option{-O2} by using:
1670 -Q -O2 --help=optimizers
1673 Alternatively you can discover which binary optimizations are enabled
1674 by @option{-O3} by using:
1677 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1678 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1679 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1684 Display the version number and copyrights of the invoked GCC@.
1686 @item -pass-exit-codes
1687 @opindex pass-exit-codes
1688 Normally the @command{gcc} program exits with the code of 1 if any
1689 phase of the compiler returns a non-success return code. If you specify
1690 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1691 the numerically highest error produced by any phase returning an error
1692 indication. The C, C++, and Fortran front ends return 4 if an internal
1693 compiler error is encountered.
1697 Use pipes rather than temporary files for communication between the
1698 various stages of compilation. This fails to work on some systems where
1699 the assembler is unable to read from a pipe; but the GNU assembler has
1702 @item -specs=@var{file}
1704 Process @var{file} after the compiler reads in the standard @file{specs}
1705 file, in order to override the defaults which the @command{gcc} driver
1706 program uses when determining what switches to pass to @command{cc1},
1707 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1708 @option{-specs=@var{file}} can be specified on the command line, and they
1709 are processed in order, from left to right. @xref{Spec Files}, for
1710 information about the format of the @var{file}.
1714 Invoke all subcommands under a wrapper program. The name of the
1715 wrapper program and its parameters are passed as a comma separated
1719 gcc -c t.c -wrapper gdb,--args
1723 This invokes all subprograms of @command{gcc} under
1724 @samp{gdb --args}, thus the invocation of @command{cc1} is
1725 @samp{gdb --args cc1 @dots{}}.
1727 @item -ffile-prefix-map=@var{old}=@var{new}
1728 @opindex ffile-prefix-map
1729 When compiling files residing in directory @file{@var{old}}, record
1730 any references to them in the result of the compilation as if the
1731 files resided in directory @file{@var{new}} instead. Specifying this
1732 option is equivalent to specifying all the individual
1733 @option{-f*-prefix-map} options. This can be used to make reproducible
1734 builds that are location independent. See also
1735 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1737 @item -fplugin=@var{name}.so
1739 Load the plugin code in file @var{name}.so, assumed to be a
1740 shared object to be dlopen'd by the compiler. The base name of
1741 the shared object file is used to identify the plugin for the
1742 purposes of argument parsing (See
1743 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1744 Each plugin should define the callback functions specified in the
1747 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1748 @opindex fplugin-arg
1749 Define an argument called @var{key} with a value of @var{value}
1750 for the plugin called @var{name}.
1752 @item -fdump-ada-spec@r{[}-slim@r{]}
1753 @opindex fdump-ada-spec
1754 For C and C++ source and include files, generate corresponding Ada specs.
1755 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1756 GNAT User's Guide}, which provides detailed documentation on this feature.
1758 @item -fada-spec-parent=@var{unit}
1759 @opindex fada-spec-parent
1760 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1761 Ada specs as child units of parent @var{unit}.
1763 @item -fdump-go-spec=@var{file}
1764 @opindex fdump-go-spec
1765 For input files in any language, generate corresponding Go
1766 declarations in @var{file}. This generates Go @code{const},
1767 @code{type}, @code{var}, and @code{func} declarations which may be a
1768 useful way to start writing a Go interface to code written in some
1771 @include @value{srcdir}/../libiberty/at-file.texi
1775 @section Compiling C++ Programs
1777 @cindex suffixes for C++ source
1778 @cindex C++ source file suffixes
1779 C++ source files conventionally use one of the suffixes @samp{.C},
1780 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1781 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1782 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1783 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1784 files with these names and compiles them as C++ programs even if you
1785 call the compiler the same way as for compiling C programs (usually
1786 with the name @command{gcc}).
1790 However, the use of @command{gcc} does not add the C++ library.
1791 @command{g++} is a program that calls GCC and automatically specifies linking
1792 against the C++ library. It treats @samp{.c},
1793 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1794 files unless @option{-x} is used. This program is also useful when
1795 precompiling a C header file with a @samp{.h} extension for use in C++
1796 compilations. On many systems, @command{g++} is also installed with
1797 the name @command{c++}.
1799 @cindex invoking @command{g++}
1800 When you compile C++ programs, you may specify many of the same
1801 command-line options that you use for compiling programs in any
1802 language; or command-line options meaningful for C and related
1803 languages; or options that are meaningful only for C++ programs.
1804 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1805 explanations of options for languages related to C@.
1806 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1807 explanations of options that are meaningful only for C++ programs.
1809 @node C Dialect Options
1810 @section Options Controlling C Dialect
1811 @cindex dialect options
1812 @cindex language dialect options
1813 @cindex options, dialect
1815 The following options control the dialect of C (or languages derived
1816 from C, such as C++, Objective-C and Objective-C++) that the compiler
1820 @cindex ANSI support
1824 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1825 equivalent to @option{-std=c++98}.
1827 This turns off certain features of GCC that are incompatible with ISO
1828 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1829 such as the @code{asm} and @code{typeof} keywords, and
1830 predefined macros such as @code{unix} and @code{vax} that identify the
1831 type of system you are using. It also enables the undesirable and
1832 rarely used ISO trigraph feature. For the C compiler,
1833 it disables recognition of C++ style @samp{//} comments as well as
1834 the @code{inline} keyword.
1836 The alternate keywords @code{__asm__}, @code{__extension__},
1837 @code{__inline__} and @code{__typeof__} continue to work despite
1838 @option{-ansi}. You would not want to use them in an ISO C program, of
1839 course, but it is useful to put them in header files that might be included
1840 in compilations done with @option{-ansi}. Alternate predefined macros
1841 such as @code{__unix__} and @code{__vax__} are also available, with or
1842 without @option{-ansi}.
1844 The @option{-ansi} option does not cause non-ISO programs to be
1845 rejected gratuitously. For that, @option{-Wpedantic} is required in
1846 addition to @option{-ansi}. @xref{Warning Options}.
1848 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1849 option is used. Some header files may notice this macro and refrain
1850 from declaring certain functions or defining certain macros that the
1851 ISO standard doesn't call for; this is to avoid interfering with any
1852 programs that might use these names for other things.
1854 Functions that are normally built in but do not have semantics
1855 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1856 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1857 built-in functions provided by GCC}, for details of the functions
1862 Determine the language standard. @xref{Standards,,Language Standards
1863 Supported by GCC}, for details of these standard versions. This option
1864 is currently only supported when compiling C or C++.
1866 The compiler can accept several base standards, such as @samp{c90} or
1867 @samp{c++98}, and GNU dialects of those standards, such as
1868 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1869 compiler accepts all programs following that standard plus those
1870 using GNU extensions that do not contradict it. For example,
1871 @option{-std=c90} turns off certain features of GCC that are
1872 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1873 keywords, but not other GNU extensions that do not have a meaning in
1874 ISO C90, such as omitting the middle term of a @code{?:}
1875 expression. On the other hand, when a GNU dialect of a standard is
1876 specified, all features supported by the compiler are enabled, even when
1877 those features change the meaning of the base standard. As a result, some
1878 strict-conforming programs may be rejected. The particular standard
1879 is used by @option{-Wpedantic} to identify which features are GNU
1880 extensions given that version of the standard. For example
1881 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1882 comments, while @option{-std=gnu99 -Wpedantic} does not.
1884 A value for this option must be provided; possible values are
1890 Support all ISO C90 programs (certain GNU extensions that conflict
1891 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1893 @item iso9899:199409
1894 ISO C90 as modified in amendment 1.
1900 ISO C99. This standard is substantially completely supported, modulo
1901 bugs and floating-point issues
1902 (mainly but not entirely relating to optional C99 features from
1903 Annexes F and G). See
1904 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1905 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1910 ISO C11, the 2011 revision of the ISO C standard. This standard is
1911 substantially completely supported, modulo bugs, floating-point issues
1912 (mainly but not entirely relating to optional C11 features from
1913 Annexes F and G) and the optional Annexes K (Bounds-checking
1914 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1920 ISO C17, the 2017 revision of the ISO C standard (expected to be
1921 published in 2018). This standard is
1922 same as C11 except for corrections of defects (all of which are also
1923 applied with @option{-std=c11}) and a new value of
1924 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1928 GNU dialect of ISO C90 (including some C99 features).
1932 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1936 GNU dialect of ISO C11.
1937 The name @samp{gnu1x} is deprecated.
1941 GNU dialect of ISO C17. This is the default for C code.
1945 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1946 additional defect reports. Same as @option{-ansi} for C++ code.
1950 GNU dialect of @option{-std=c++98}.
1954 The 2011 ISO C++ standard plus amendments.
1955 The name @samp{c++0x} is deprecated.
1959 GNU dialect of @option{-std=c++11}.
1960 The name @samp{gnu++0x} is deprecated.
1964 The 2014 ISO C++ standard plus amendments.
1965 The name @samp{c++1y} is deprecated.
1969 GNU dialect of @option{-std=c++14}.
1970 This is the default for C++ code.
1971 The name @samp{gnu++1y} is deprecated.
1975 The 2017 ISO C++ standard plus amendments.
1976 The name @samp{c++1z} is deprecated.
1980 GNU dialect of @option{-std=c++17}.
1981 The name @samp{gnu++1z} is deprecated.
1984 The next revision of the ISO C++ standard, tentatively planned for
1985 2020. Support is highly experimental, and will almost certainly
1986 change in incompatible ways in future releases.
1989 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
1990 and will almost certainly change in incompatible ways in future
1994 @item -fgnu89-inline
1995 @opindex fgnu89-inline
1996 The option @option{-fgnu89-inline} tells GCC to use the traditional
1997 GNU semantics for @code{inline} functions when in C99 mode.
1998 @xref{Inline,,An Inline Function is As Fast As a Macro}.
1999 Using this option is roughly equivalent to adding the
2000 @code{gnu_inline} function attribute to all inline functions
2001 (@pxref{Function Attributes}).
2003 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2004 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2005 specifies the default behavior).
2006 This option is not supported in @option{-std=c90} or
2007 @option{-std=gnu90} mode.
2009 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2010 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2011 in effect for @code{inline} functions. @xref{Common Predefined
2012 Macros,,,cpp,The C Preprocessor}.
2014 @item -fpermitted-flt-eval-methods=@var{style}
2015 @opindex fpermitted-flt-eval-methods
2016 @opindex fpermitted-flt-eval-methods=c11
2017 @opindex fpermitted-flt-eval-methods=ts-18661-3
2018 ISO/IEC TS 18661-3 defines new permissible values for
2019 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2020 a semantic type that is an interchange or extended format should be
2021 evaluated to the precision and range of that type. These new values are
2022 a superset of those permitted under C99/C11, which does not specify the
2023 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2024 conforming to C11 may not have been written expecting the possibility of
2027 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2028 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2029 or the extended set of values specified in ISO/IEC TS 18661-3.
2031 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2033 The default when in a standards compliant mode (@option{-std=c11} or similar)
2034 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2035 dialect (@option{-std=gnu11} or similar) is
2036 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2038 @item -aux-info @var{filename}
2040 Output to the given filename prototyped declarations for all functions
2041 declared and/or defined in a translation unit, including those in header
2042 files. This option is silently ignored in any language other than C@.
2044 Besides declarations, the file indicates, in comments, the origin of
2045 each declaration (source file and line), whether the declaration was
2046 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2047 @samp{O} for old, respectively, in the first character after the line
2048 number and the colon), and whether it came from a declaration or a
2049 definition (@samp{C} or @samp{F}, respectively, in the following
2050 character). In the case of function definitions, a K&R-style list of
2051 arguments followed by their declarations is also provided, inside
2052 comments, after the declaration.
2054 @item -fallow-parameterless-variadic-functions
2055 @opindex fallow-parameterless-variadic-functions
2056 Accept variadic functions without named parameters.
2058 Although it is possible to define such a function, this is not very
2059 useful as it is not possible to read the arguments. This is only
2060 supported for C as this construct is allowed by C++.
2064 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2065 keyword, so that code can use these words as identifiers. You can use
2066 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2067 instead. @option{-ansi} implies @option{-fno-asm}.
2069 In C++, this switch only affects the @code{typeof} keyword, since
2070 @code{asm} and @code{inline} are standard keywords. You may want to
2071 use the @option{-fno-gnu-keywords} flag instead, which has the same
2072 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2073 switch only affects the @code{asm} and @code{typeof} keywords, since
2074 @code{inline} is a standard keyword in ISO C99.
2077 @itemx -fno-builtin-@var{function}
2078 @opindex fno-builtin
2079 @cindex built-in functions
2080 Don't recognize built-in functions that do not begin with
2081 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2082 functions provided by GCC}, for details of the functions affected,
2083 including those which are not built-in functions when @option{-ansi} or
2084 @option{-std} options for strict ISO C conformance are used because they
2085 do not have an ISO standard meaning.
2087 GCC normally generates special code to handle certain built-in functions
2088 more efficiently; for instance, calls to @code{alloca} may become single
2089 instructions which adjust the stack directly, and calls to @code{memcpy}
2090 may become inline copy loops. The resulting code is often both smaller
2091 and faster, but since the function calls no longer appear as such, you
2092 cannot set a breakpoint on those calls, nor can you change the behavior
2093 of the functions by linking with a different library. In addition,
2094 when a function is recognized as a built-in function, GCC may use
2095 information about that function to warn about problems with calls to
2096 that function, or to generate more efficient code, even if the
2097 resulting code still contains calls to that function. For example,
2098 warnings are given with @option{-Wformat} for bad calls to
2099 @code{printf} when @code{printf} is built in and @code{strlen} is
2100 known not to modify global memory.
2102 With the @option{-fno-builtin-@var{function}} option
2103 only the built-in function @var{function} is
2104 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2105 function is named that is not built-in in this version of GCC, this
2106 option is ignored. There is no corresponding
2107 @option{-fbuiltin-@var{function}} option; if you wish to enable
2108 built-in functions selectively when using @option{-fno-builtin} or
2109 @option{-ffreestanding}, you may define macros such as:
2112 #define abs(n) __builtin_abs ((n))
2113 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2119 Enable parsing of function definitions marked with @code{__GIMPLE}.
2120 This is an experimental feature that allows unit testing of GIMPLE
2125 @cindex hosted environment
2127 Assert that compilation targets a hosted environment. This implies
2128 @option{-fbuiltin}. A hosted environment is one in which the
2129 entire standard library is available, and in which @code{main} has a return
2130 type of @code{int}. Examples are nearly everything except a kernel.
2131 This is equivalent to @option{-fno-freestanding}.
2133 @item -ffreestanding
2134 @opindex ffreestanding
2135 @cindex hosted environment
2137 Assert that compilation targets a freestanding environment. This
2138 implies @option{-fno-builtin}. A freestanding environment
2139 is one in which the standard library may not exist, and program startup may
2140 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2141 This is equivalent to @option{-fno-hosted}.
2143 @xref{Standards,,Language Standards Supported by GCC}, for details of
2144 freestanding and hosted environments.
2148 @cindex OpenACC accelerator programming
2149 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2150 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2151 compiler generates accelerated code according to the OpenACC Application
2152 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2153 implies @option{-pthread}, and thus is only supported on targets that
2154 have support for @option{-pthread}.
2156 @item -fopenacc-dim=@var{geom}
2157 @opindex fopenacc-dim
2158 @cindex OpenACC accelerator programming
2159 Specify default compute dimensions for parallel offload regions that do
2160 not explicitly specify. The @var{geom} value is a triple of
2161 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2162 can be omitted, to use a target-specific default value.
2166 @cindex OpenMP parallel
2167 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2168 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2169 compiler generates parallel code according to the OpenMP Application
2170 Program Interface v4.5 @w{@uref{http://www.openmp.org/}}. This option
2171 implies @option{-pthread}, and thus is only supported on targets that
2172 have support for @option{-pthread}. @option{-fopenmp} implies
2173 @option{-fopenmp-simd}.
2176 @opindex fopenmp-simd
2179 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2180 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2185 When the option @option{-fgnu-tm} is specified, the compiler
2186 generates code for the Linux variant of Intel's current Transactional
2187 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2188 an experimental feature whose interface may change in future versions
2189 of GCC, as the official specification changes. Please note that not
2190 all architectures are supported for this feature.
2192 For more information on GCC's support for transactional memory,
2193 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2194 Transactional Memory Library}.
2196 Note that the transactional memory feature is not supported with
2197 non-call exceptions (@option{-fnon-call-exceptions}).
2199 @item -fms-extensions
2200 @opindex fms-extensions
2201 Accept some non-standard constructs used in Microsoft header files.
2203 In C++ code, this allows member names in structures to be similar
2204 to previous types declarations.
2213 Some cases of unnamed fields in structures and unions are only
2214 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2215 fields within structs/unions}, for details.
2217 Note that this option is off for all targets but x86
2218 targets using ms-abi.
2220 @item -fplan9-extensions
2221 @opindex fplan9-extensions
2222 Accept some non-standard constructs used in Plan 9 code.
2224 This enables @option{-fms-extensions}, permits passing pointers to
2225 structures with anonymous fields to functions that expect pointers to
2226 elements of the type of the field, and permits referring to anonymous
2227 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2228 struct/union fields within structs/unions}, for details. This is only
2229 supported for C, not C++.
2231 @item -fcond-mismatch
2232 @opindex fcond-mismatch
2233 Allow conditional expressions with mismatched types in the second and
2234 third arguments. The value of such an expression is void. This option
2235 is not supported for C++.
2237 @item -flax-vector-conversions
2238 @opindex flax-vector-conversions
2239 Allow implicit conversions between vectors with differing numbers of
2240 elements and/or incompatible element types. This option should not be
2243 @item -funsigned-char
2244 @opindex funsigned-char
2245 Let the type @code{char} be unsigned, like @code{unsigned char}.
2247 Each kind of machine has a default for what @code{char} should
2248 be. It is either like @code{unsigned char} by default or like
2249 @code{signed char} by default.
2251 Ideally, a portable program should always use @code{signed char} or
2252 @code{unsigned char} when it depends on the signedness of an object.
2253 But many programs have been written to use plain @code{char} and
2254 expect it to be signed, or expect it to be unsigned, depending on the
2255 machines they were written for. This option, and its inverse, let you
2256 make such a program work with the opposite default.
2258 The type @code{char} is always a distinct type from each of
2259 @code{signed char} or @code{unsigned char}, even though its behavior
2260 is always just like one of those two.
2263 @opindex fsigned-char
2264 Let the type @code{char} be signed, like @code{signed char}.
2266 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2267 the negative form of @option{-funsigned-char}. Likewise, the option
2268 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2270 @item -fsigned-bitfields
2271 @itemx -funsigned-bitfields
2272 @itemx -fno-signed-bitfields
2273 @itemx -fno-unsigned-bitfields
2274 @opindex fsigned-bitfields
2275 @opindex funsigned-bitfields
2276 @opindex fno-signed-bitfields
2277 @opindex fno-unsigned-bitfields
2278 These options control whether a bit-field is signed or unsigned, when the
2279 declaration does not use either @code{signed} or @code{unsigned}. By
2280 default, such a bit-field is signed, because this is consistent: the
2281 basic integer types such as @code{int} are signed types.
2283 @item -fsso-struct=@var{endianness}
2284 @opindex fsso-struct
2285 Set the default scalar storage order of structures and unions to the
2286 specified endianness. The accepted values are @samp{big-endian},
2287 @samp{little-endian} and @samp{native} for the native endianness of
2288 the target (the default). This option is not supported for C++.
2290 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2291 code that is not binary compatible with code generated without it if the
2292 specified endianness is not the native endianness of the target.
2295 @node C++ Dialect Options
2296 @section Options Controlling C++ Dialect
2298 @cindex compiler options, C++
2299 @cindex C++ options, command-line
2300 @cindex options, C++
2301 This section describes the command-line options that are only meaningful
2302 for C++ programs. You can also use most of the GNU compiler options
2303 regardless of what language your program is in. For example, you
2304 might compile a file @file{firstClass.C} like this:
2307 g++ -g -fstrict-enums -O -c firstClass.C
2311 In this example, only @option{-fstrict-enums} is an option meant
2312 only for C++ programs; you can use the other options with any
2313 language supported by GCC@.
2315 Some options for compiling C programs, such as @option{-std}, are also
2316 relevant for C++ programs.
2317 @xref{C Dialect Options,,Options Controlling C Dialect}.
2319 Here is a list of options that are @emph{only} for compiling C++ programs:
2323 @item -fabi-version=@var{n}
2324 @opindex fabi-version
2325 Use version @var{n} of the C++ ABI@. The default is version 0.
2327 Version 0 refers to the version conforming most closely to
2328 the C++ ABI specification. Therefore, the ABI obtained using version 0
2329 will change in different versions of G++ as ABI bugs are fixed.
2331 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2333 Version 2 is the version of the C++ ABI that first appeared in G++
2334 3.4, and was the default through G++ 4.9.
2336 Version 3 corrects an error in mangling a constant address as a
2339 Version 4, which first appeared in G++ 4.5, implements a standard
2340 mangling for vector types.
2342 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2343 attribute const/volatile on function pointer types, decltype of a
2344 plain decl, and use of a function parameter in the declaration of
2347 Version 6, which first appeared in G++ 4.7, corrects the promotion
2348 behavior of C++11 scoped enums and the mangling of template argument
2349 packs, const/static_cast, prefix ++ and --, and a class scope function
2350 used as a template argument.
2352 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2353 builtin type and corrects the mangling of lambdas in default argument
2356 Version 8, which first appeared in G++ 4.9, corrects the substitution
2357 behavior of function types with function-cv-qualifiers.
2359 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2362 Version 10, which first appeared in G++ 6.1, adds mangling of
2363 attributes that affect type identity, such as ia32 calling convention
2364 attributes (e.g. @samp{stdcall}).
2366 Version 11, which first appeared in G++ 7, corrects the mangling of
2367 sizeof... expressions and operator names. For multiple entities with
2368 the same name within a function, that are declared in different scopes,
2369 the mangling now changes starting with the twelfth occurrence. It also
2370 implies @option{-fnew-inheriting-ctors}.
2372 Version 12, which first appeared in G++ 8, corrects the calling
2373 conventions for empty classes on the x86_64 target and for classes
2374 with only deleted copy/move constructors. It accidentally changes the
2375 calling convention for classes with a deleted copy constructor and a
2376 trivial move constructor.
2378 Version 13, which first appeared in G++ 8.2, fixes the accidental
2379 change in version 12.
2381 See also @option{-Wabi}.
2383 @item -fabi-compat-version=@var{n}
2384 @opindex fabi-compat-version
2385 On targets that support strong aliases, G++
2386 works around mangling changes by creating an alias with the correct
2387 mangled name when defining a symbol with an incorrect mangled name.
2388 This switch specifies which ABI version to use for the alias.
2390 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2391 compatibility). If another ABI version is explicitly selected, this
2392 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2393 use @option{-fabi-compat-version=2}.
2395 If this option is not provided but @option{-Wabi=@var{n}} is, that
2396 version is used for compatibility aliases. If this option is provided
2397 along with @option{-Wabi} (without the version), the version from this
2398 option is used for the warning.
2400 @item -fno-access-control
2401 @opindex fno-access-control
2402 Turn off all access checking. This switch is mainly useful for working
2403 around bugs in the access control code.
2406 @opindex faligned-new
2407 Enable support for C++17 @code{new} of types that require more
2408 alignment than @code{void* ::operator new(std::size_t)} provides. A
2409 numeric argument such as @code{-faligned-new=32} can be used to
2410 specify how much alignment (in bytes) is provided by that function,
2411 but few users will need to override the default of
2412 @code{alignof(std::max_align_t)}.
2414 This flag is enabled by default for @option{-std=c++17}.
2418 Check that the pointer returned by @code{operator new} is non-null
2419 before attempting to modify the storage allocated. This check is
2420 normally unnecessary because the C++ standard specifies that
2421 @code{operator new} only returns @code{0} if it is declared
2422 @code{throw()}, in which case the compiler always checks the
2423 return value even without this option. In all other cases, when
2424 @code{operator new} has a non-empty exception specification, memory
2425 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2426 @samp{new (nothrow)}.
2430 Enable support for the C++ Extensions for Concepts Technical
2431 Specification, ISO 19217 (2015), which allows code like
2434 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2435 template <Addable T> T add (T a, T b) @{ return a + b; @}
2438 @item -fconstexpr-depth=@var{n}
2439 @opindex fconstexpr-depth
2440 Set the maximum nested evaluation depth for C++11 constexpr functions
2441 to @var{n}. A limit is needed to detect endless recursion during
2442 constant expression evaluation. The minimum specified by the standard
2445 @item -fconstexpr-loop-limit=@var{n}
2446 @opindex fconstexpr-loop-limit
2447 Set the maximum number of iterations for a loop in C++14 constexpr functions
2448 to @var{n}. A limit is needed to detect infinite loops during
2449 constant expression evaluation. The default is 262144 (1<<18).
2451 @item -fdeduce-init-list
2452 @opindex fdeduce-init-list
2453 Enable deduction of a template type parameter as
2454 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2457 template <class T> auto forward(T t) -> decltype (realfn (t))
2464 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2468 This deduction was implemented as a possible extension to the
2469 originally proposed semantics for the C++11 standard, but was not part
2470 of the final standard, so it is disabled by default. This option is
2471 deprecated, and may be removed in a future version of G++.
2473 @item -fno-elide-constructors
2474 @opindex fno-elide-constructors
2475 The C++ standard allows an implementation to omit creating a temporary
2476 that is only used to initialize another object of the same type.
2477 Specifying this option disables that optimization, and forces G++ to
2478 call the copy constructor in all cases. This option also causes G++
2479 to call trivial member functions which otherwise would be expanded inline.
2481 In C++17, the compiler is required to omit these temporaries, but this
2482 option still affects trivial member functions.
2484 @item -fno-enforce-eh-specs
2485 @opindex fno-enforce-eh-specs
2486 Don't generate code to check for violation of exception specifications
2487 at run time. This option violates the C++ standard, but may be useful
2488 for reducing code size in production builds, much like defining
2489 @code{NDEBUG}. This does not give user code permission to throw
2490 exceptions in violation of the exception specifications; the compiler
2491 still optimizes based on the specifications, so throwing an
2492 unexpected exception results in undefined behavior at run time.
2494 @item -fextern-tls-init
2495 @itemx -fno-extern-tls-init
2496 @opindex fextern-tls-init
2497 @opindex fno-extern-tls-init
2498 The C++11 and OpenMP standards allow @code{thread_local} and
2499 @code{threadprivate} variables to have dynamic (runtime)
2500 initialization. To support this, any use of such a variable goes
2501 through a wrapper function that performs any necessary initialization.
2502 When the use and definition of the variable are in the same
2503 translation unit, this overhead can be optimized away, but when the
2504 use is in a different translation unit there is significant overhead
2505 even if the variable doesn't actually need dynamic initialization. If
2506 the programmer can be sure that no use of the variable in a
2507 non-defining TU needs to trigger dynamic initialization (either
2508 because the variable is statically initialized, or a use of the
2509 variable in the defining TU will be executed before any uses in
2510 another TU), they can avoid this overhead with the
2511 @option{-fno-extern-tls-init} option.
2513 On targets that support symbol aliases, the default is
2514 @option{-fextern-tls-init}. On targets that do not support symbol
2515 aliases, the default is @option{-fno-extern-tls-init}.
2517 @item -fno-gnu-keywords
2518 @opindex fno-gnu-keywords
2519 Do not recognize @code{typeof} as a keyword, so that code can use this
2520 word as an identifier. You can use the keyword @code{__typeof__} instead.
2521 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2522 @option{-std=c++98}, @option{-std=c++11}, etc.
2524 @item -fno-implicit-templates
2525 @opindex fno-implicit-templates
2526 Never emit code for non-inline templates that are instantiated
2527 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2528 @xref{Template Instantiation}, for more information.
2530 @item -fno-implicit-inline-templates
2531 @opindex fno-implicit-inline-templates
2532 Don't emit code for implicit instantiations of inline templates, either.
2533 The default is to handle inlines differently so that compiles with and
2534 without optimization need the same set of explicit instantiations.
2536 @item -fno-implement-inlines
2537 @opindex fno-implement-inlines
2538 To save space, do not emit out-of-line copies of inline functions
2539 controlled by @code{#pragma implementation}. This causes linker
2540 errors if these functions are not inlined everywhere they are called.
2542 @item -fms-extensions
2543 @opindex fms-extensions
2544 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2545 int and getting a pointer to member function via non-standard syntax.
2547 @item -fnew-inheriting-ctors
2548 @opindex fnew-inheriting-ctors
2549 Enable the P0136 adjustment to the semantics of C++11 constructor
2550 inheritance. This is part of C++17 but also considered to be a Defect
2551 Report against C++11 and C++14. This flag is enabled by default
2552 unless @option{-fabi-version=10} or lower is specified.
2554 @item -fnew-ttp-matching
2555 @opindex fnew-ttp-matching
2556 Enable the P0522 resolution to Core issue 150, template template
2557 parameters and default arguments: this allows a template with default
2558 template arguments as an argument for a template template parameter
2559 with fewer template parameters. This flag is enabled by default for
2560 @option{-std=c++17}.
2562 @item -fno-nonansi-builtins
2563 @opindex fno-nonansi-builtins
2564 Disable built-in declarations of functions that are not mandated by
2565 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2566 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2569 @opindex fnothrow-opt
2570 Treat a @code{throw()} exception specification as if it were a
2571 @code{noexcept} specification to reduce or eliminate the text size
2572 overhead relative to a function with no exception specification. If
2573 the function has local variables of types with non-trivial
2574 destructors, the exception specification actually makes the
2575 function smaller because the EH cleanups for those variables can be
2576 optimized away. The semantic effect is that an exception thrown out of
2577 a function with such an exception specification results in a call
2578 to @code{terminate} rather than @code{unexpected}.
2580 @item -fno-operator-names
2581 @opindex fno-operator-names
2582 Do not treat the operator name keywords @code{and}, @code{bitand},
2583 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2584 synonyms as keywords.
2586 @item -fno-optional-diags
2587 @opindex fno-optional-diags
2588 Disable diagnostics that the standard says a compiler does not need to
2589 issue. Currently, the only such diagnostic issued by G++ is the one for
2590 a name having multiple meanings within a class.
2593 @opindex fpermissive
2594 Downgrade some diagnostics about nonconformant code from errors to
2595 warnings. Thus, using @option{-fpermissive} allows some
2596 nonconforming code to compile.
2598 @item -fno-pretty-templates
2599 @opindex fno-pretty-templates
2600 When an error message refers to a specialization of a function
2601 template, the compiler normally prints the signature of the
2602 template followed by the template arguments and any typedefs or
2603 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2604 rather than @code{void f(int)}) so that it's clear which template is
2605 involved. When an error message refers to a specialization of a class
2606 template, the compiler omits any template arguments that match
2607 the default template arguments for that template. If either of these
2608 behaviors make it harder to understand the error message rather than
2609 easier, you can use @option{-fno-pretty-templates} to disable them.
2613 Enable automatic template instantiation at link time. This option also
2614 implies @option{-fno-implicit-templates}. @xref{Template
2615 Instantiation}, for more information.
2619 Disable generation of information about every class with virtual
2620 functions for use by the C++ run-time type identification features
2621 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2622 of the language, you can save some space by using this flag. Note that
2623 exception handling uses the same information, but G++ generates it as
2624 needed. The @code{dynamic_cast} operator can still be used for casts that
2625 do not require run-time type information, i.e.@: casts to @code{void *} or to
2626 unambiguous base classes.
2628 @item -fsized-deallocation
2629 @opindex fsized-deallocation
2630 Enable the built-in global declarations
2632 void operator delete (void *, std::size_t) noexcept;
2633 void operator delete[] (void *, std::size_t) noexcept;
2635 as introduced in C++14. This is useful for user-defined replacement
2636 deallocation functions that, for example, use the size of the object
2637 to make deallocation faster. Enabled by default under
2638 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2639 warns about places that might want to add a definition.
2641 @item -fstrict-enums
2642 @opindex fstrict-enums
2643 Allow the compiler to optimize using the assumption that a value of
2644 enumerated type can only be one of the values of the enumeration (as
2645 defined in the C++ standard; basically, a value that can be
2646 represented in the minimum number of bits needed to represent all the
2647 enumerators). This assumption may not be valid if the program uses a
2648 cast to convert an arbitrary integer value to the enumerated type.
2650 @item -fstrong-eval-order
2651 @opindex fstrong-eval-order
2652 Evaluate member access, array subscripting, and shift expressions in
2653 left-to-right order, and evaluate assignment in right-to-left order,
2654 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2655 @option{-fstrong-eval-order=some} enables just the ordering of member
2656 access and shift expressions, and is the default without
2657 @option{-std=c++17}.
2659 @item -ftemplate-backtrace-limit=@var{n}
2660 @opindex ftemplate-backtrace-limit
2661 Set the maximum number of template instantiation notes for a single
2662 warning or error to @var{n}. The default value is 10.
2664 @item -ftemplate-depth=@var{n}
2665 @opindex ftemplate-depth
2666 Set the maximum instantiation depth for template classes to @var{n}.
2667 A limit on the template instantiation depth is needed to detect
2668 endless recursions during template class instantiation. ANSI/ISO C++
2669 conforming programs must not rely on a maximum depth greater than 17
2670 (changed to 1024 in C++11). The default value is 900, as the compiler
2671 can run out of stack space before hitting 1024 in some situations.
2673 @item -fno-threadsafe-statics
2674 @opindex fno-threadsafe-statics
2675 Do not emit the extra code to use the routines specified in the C++
2676 ABI for thread-safe initialization of local statics. You can use this
2677 option to reduce code size slightly in code that doesn't need to be
2680 @item -fuse-cxa-atexit
2681 @opindex fuse-cxa-atexit
2682 Register destructors for objects with static storage duration with the
2683 @code{__cxa_atexit} function rather than the @code{atexit} function.
2684 This option is required for fully standards-compliant handling of static
2685 destructors, but only works if your C library supports
2686 @code{__cxa_atexit}.
2688 @item -fno-use-cxa-get-exception-ptr
2689 @opindex fno-use-cxa-get-exception-ptr
2690 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2691 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2692 if the runtime routine is not available.
2694 @item -fvisibility-inlines-hidden
2695 @opindex fvisibility-inlines-hidden
2696 This switch declares that the user does not attempt to compare
2697 pointers to inline functions or methods where the addresses of the two functions
2698 are taken in different shared objects.
2700 The effect of this is that GCC may, effectively, mark inline methods with
2701 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2702 appear in the export table of a DSO and do not require a PLT indirection
2703 when used within the DSO@. Enabling this option can have a dramatic effect
2704 on load and link times of a DSO as it massively reduces the size of the
2705 dynamic export table when the library makes heavy use of templates.
2707 The behavior of this switch is not quite the same as marking the
2708 methods as hidden directly, because it does not affect static variables
2709 local to the function or cause the compiler to deduce that
2710 the function is defined in only one shared object.
2712 You may mark a method as having a visibility explicitly to negate the
2713 effect of the switch for that method. For example, if you do want to
2714 compare pointers to a particular inline method, you might mark it as
2715 having default visibility. Marking the enclosing class with explicit
2716 visibility has no effect.
2718 Explicitly instantiated inline methods are unaffected by this option
2719 as their linkage might otherwise cross a shared library boundary.
2720 @xref{Template Instantiation}.
2722 @item -fvisibility-ms-compat
2723 @opindex fvisibility-ms-compat
2724 This flag attempts to use visibility settings to make GCC's C++
2725 linkage model compatible with that of Microsoft Visual Studio.
2727 The flag makes these changes to GCC's linkage model:
2731 It sets the default visibility to @code{hidden}, like
2732 @option{-fvisibility=hidden}.
2735 Types, but not their members, are not hidden by default.
2738 The One Definition Rule is relaxed for types without explicit
2739 visibility specifications that are defined in more than one
2740 shared object: those declarations are permitted if they are
2741 permitted when this option is not used.
2744 In new code it is better to use @option{-fvisibility=hidden} and
2745 export those classes that are intended to be externally visible.
2746 Unfortunately it is possible for code to rely, perhaps accidentally,
2747 on the Visual Studio behavior.
2749 Among the consequences of these changes are that static data members
2750 of the same type with the same name but defined in different shared
2751 objects are different, so changing one does not change the other;
2752 and that pointers to function members defined in different shared
2753 objects may not compare equal. When this flag is given, it is a
2754 violation of the ODR to define types with the same name differently.
2758 Do not use weak symbol support, even if it is provided by the linker.
2759 By default, G++ uses weak symbols if they are available. This
2760 option exists only for testing, and should not be used by end-users;
2761 it results in inferior code and has no benefits. This option may
2762 be removed in a future release of G++.
2766 Do not search for header files in the standard directories specific to
2767 C++, but do still search the other standard directories. (This option
2768 is used when building the C++ library.)
2771 In addition, these optimization, warning, and code generation options
2772 have meanings only for C++ programs:
2775 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2778 Warn when G++ it generates code that is probably not compatible with
2779 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2780 ABI with each major release, normally @option{-Wabi} will warn only if
2781 there is a check added later in a release series for an ABI issue
2782 discovered since the initial release. @option{-Wabi} will warn about
2783 more things if an older ABI version is selected (with
2784 @option{-fabi-version=@var{n}}).
2786 @option{-Wabi} can also be used with an explicit version number to
2787 warn about compatibility with a particular @option{-fabi-version}
2788 level, e.g. @option{-Wabi=2} to warn about changes relative to
2789 @option{-fabi-version=2}.
2791 If an explicit version number is provided and
2792 @option{-fabi-compat-version} is not specified, the version number
2793 from this option is used for compatibility aliases. If no explicit
2794 version number is provided with this option, but
2795 @option{-fabi-compat-version} is specified, that version number is
2796 used for ABI warnings.
2798 Although an effort has been made to warn about
2799 all such cases, there are probably some cases that are not warned about,
2800 even though G++ is generating incompatible code. There may also be
2801 cases where warnings are emitted even though the code that is generated
2804 You should rewrite your code to avoid these warnings if you are
2805 concerned about the fact that code generated by G++ may not be binary
2806 compatible with code generated by other compilers.
2808 Known incompatibilities in @option{-fabi-version=2} (which was the
2809 default from GCC 3.4 to 4.9) include:
2814 A template with a non-type template parameter of reference type was
2815 mangled incorrectly:
2818 template <int &> struct S @{@};
2822 This was fixed in @option{-fabi-version=3}.
2825 SIMD vector types declared using @code{__attribute ((vector_size))} were
2826 mangled in a non-standard way that does not allow for overloading of
2827 functions taking vectors of different sizes.
2829 The mangling was changed in @option{-fabi-version=4}.
2832 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2833 qualifiers, and @code{decltype} of a plain declaration was folded away.
2835 These mangling issues were fixed in @option{-fabi-version=5}.
2838 Scoped enumerators passed as arguments to a variadic function are
2839 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2840 On most targets this does not actually affect the parameter passing
2841 ABI, as there is no way to pass an argument smaller than @code{int}.
2843 Also, the ABI changed the mangling of template argument packs,
2844 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2845 a class scope function used as a template argument.
2847 These issues were corrected in @option{-fabi-version=6}.
2850 Lambdas in default argument scope were mangled incorrectly, and the
2851 ABI changed the mangling of @code{nullptr_t}.
2853 These issues were corrected in @option{-fabi-version=7}.
2856 When mangling a function type with function-cv-qualifiers, the
2857 un-qualified function type was incorrectly treated as a substitution
2860 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2863 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2864 unaligned accesses. Note that this did not affect the ABI of a
2865 function with a @code{nullptr_t} parameter, as parameters have a
2868 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2871 Target-specific attributes that affect the identity of a type, such as
2872 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2873 did not affect the mangled name, leading to name collisions when
2874 function pointers were used as template arguments.
2876 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2880 It also warns about psABI-related changes. The known psABI changes at this
2886 For SysV/x86-64, unions with @code{long double} members are
2887 passed in memory as specified in psABI. For example:
2897 @code{union U} is always passed in memory.
2901 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2904 Warn when a type with an ABI tag is used in a context that does not
2905 have that ABI tag. See @ref{C++ Attributes} for more information
2908 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2909 @opindex Wctor-dtor-privacy
2910 @opindex Wno-ctor-dtor-privacy
2911 Warn when a class seems unusable because all the constructors or
2912 destructors in that class are private, and it has neither friends nor
2913 public static member functions. Also warn if there are no non-private
2914 methods, and there's at least one private member function that isn't
2915 a constructor or destructor.
2917 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2918 @opindex Wdelete-non-virtual-dtor
2919 @opindex Wno-delete-non-virtual-dtor
2920 Warn when @code{delete} is used to destroy an instance of a class that
2921 has virtual functions and non-virtual destructor. It is unsafe to delete
2922 an instance of a derived class through a pointer to a base class if the
2923 base class does not have a virtual destructor. This warning is enabled
2926 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
2927 @opindex Wdeprecated-copy
2928 @opindex Wno-deprecated-copy
2929 Warn that the implicit declaration of a copy constructor or copy
2930 assignment operator is deprecated if the class has a user-provided
2931 copy constructor, copy assignment operator, or destructor, in C++11
2932 and up. This warning is enabled by @option{-Wall}.
2934 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
2935 @opindex Winit-list-lifetime
2936 @opindex Wno-init-list-lifetime
2937 Do not warn about uses of @code{std::initializer_list} that are likely
2938 to result in dangling pointers. Since the underlying array for an
2939 @code{initializer_list} is handled like a normal C++ temporary object,
2940 it is easy to inadvertently keep a pointer to the array past the end
2941 of the array's lifetime. For example:
2945 If a function returns a temporary @code{initializer_list}, or a local
2946 @code{initializer_list} variable, the array's lifetime ends at the end
2947 of the return statement, so the value returned has a dangling pointer.
2950 If a new-expression creates an @code{initializer_list}, the array only
2951 lives until the end of the enclosing full-expression, so the
2952 @code{initializer_list} in the heap has a dangling pointer.
2955 When an @code{initializer_list} variable is assigned from a
2956 brace-enclosed initializer list, the temporary array created for the
2957 right side of the assignment only lives until the end of the
2958 full-expression, so at the next statement the @code{initializer_list}
2959 variable has a dangling pointer.
2962 // li's initial underlying array lives as long as li
2963 std::initializer_list<int> li = @{ 1,2,3 @};
2964 // assignment changes li to point to a temporary array
2966 // now the temporary is gone and li has a dangling pointer
2967 int i = li.begin()[0] // undefined behavior
2971 When a list constructor stores the @code{begin} pointer from the
2972 @code{initializer_list} argument, this doesn't extend the lifetime of
2973 the array, so if a class variable is constructed from a temporary
2974 @code{initializer_list}, the pointer is left dangling by the end of
2975 the variable declaration statement.
2979 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2980 @opindex Wliteral-suffix
2981 @opindex Wno-literal-suffix
2982 Warn when a string or character literal is followed by a ud-suffix which does
2983 not begin with an underscore. As a conforming extension, GCC treats such
2984 suffixes as separate preprocessing tokens in order to maintain backwards
2985 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2989 #define __STDC_FORMAT_MACROS
2990 #include <inttypes.h>
2995 printf("My int64: %" PRId64"\n", i64);
2999 In this case, @code{PRId64} is treated as a separate preprocessing token.
3001 Additionally, warn when a user-defined literal operator is declared with
3002 a literal suffix identifier that doesn't begin with an underscore. Literal
3003 suffix identifiers that don't begin with an underscore are reserved for
3004 future standardization.
3006 This warning is enabled by default.
3008 @item -Wlto-type-mismatch
3009 @opindex Wlto-type-mismatch
3010 @opindex Wno-lto-type-mismatch
3012 During the link-time optimization warn about type mismatches in
3013 global declarations from different compilation units.
3014 Requires @option{-flto} to be enabled. Enabled by default.
3016 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3018 @opindex Wno-narrowing
3019 For C++11 and later standards, narrowing conversions are diagnosed by default,
3020 as required by the standard. A narrowing conversion from a constant produces
3021 an error, and a narrowing conversion from a non-constant produces a warning,
3022 but @option{-Wno-narrowing} suppresses the diagnostic.
3023 Note that this does not affect the meaning of well-formed code;
3024 narrowing conversions are still considered ill-formed in SFINAE contexts.
3026 With @option{-Wnarrowing} in C++98, warn when a narrowing
3027 conversion prohibited by C++11 occurs within
3031 int i = @{ 2.2 @}; // error: narrowing from double to int
3034 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3036 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3038 @opindex Wno-noexcept
3039 Warn when a noexcept-expression evaluates to false because of a call
3040 to a function that does not have a non-throwing exception
3041 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3042 the compiler to never throw an exception.
3044 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3045 @opindex Wnoexcept-type
3046 @opindex Wno-noexcept-type
3047 Warn if the C++17 feature making @code{noexcept} part of a function
3048 type changes the mangled name of a symbol relative to C++14. Enabled
3049 by @option{-Wabi} and @option{-Wc++17-compat}.
3054 template <class T> void f(T t) @{ t(); @};
3056 void h() @{ f(g); @}
3060 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3061 C++17 it calls @code{f<void(*)()noexcept>}.
3063 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3064 @opindex Wclass-memaccess
3065 @opindex Wno-class-memaccess
3066 Warn when the destination of a call to a raw memory function such as
3067 @code{memset} or @code{memcpy} is an object of class type, and when writing
3068 into such an object might bypass the class non-trivial or deleted constructor
3069 or copy assignment, violate const-correctness or encapsulation, or corrupt
3070 virtual table pointers. Modifying the representation of such objects may
3071 violate invariants maintained by member functions of the class. For example,
3072 the call to @code{memset} below is undefined because it modifies a non-trivial
3073 class object and is, therefore, diagnosed. The safe way to either initialize
3074 or clear the storage of objects of such types is by using the appropriate
3075 constructor or assignment operator, if one is available.
3077 std::string str = "abc";
3078 memset (&str, 0, sizeof str);
3080 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3081 Explicitly casting the pointer to the class object to @code{void *} or
3082 to a type that can be safely accessed by the raw memory function suppresses
3085 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3086 @opindex Wnon-virtual-dtor
3087 @opindex Wno-non-virtual-dtor
3088 Warn when a class has virtual functions and an accessible non-virtual
3089 destructor itself or in an accessible polymorphic base class, in which
3090 case it is possible but unsafe to delete an instance of a derived
3091 class through a pointer to the class itself or base class. This
3092 warning is automatically enabled if @option{-Weffc++} is specified.
3094 @item -Wregister @r{(C++ and Objective-C++ only)}
3096 @opindex Wno-register
3097 Warn on uses of the @code{register} storage class specifier, except
3098 when it is part of the GNU @ref{Explicit Register Variables} extension.
3099 The use of the @code{register} keyword as storage class specifier has
3100 been deprecated in C++11 and removed in C++17.
3101 Enabled by default with @option{-std=c++17}.
3103 @item -Wreorder @r{(C++ and Objective-C++ only)}
3105 @opindex Wno-reorder
3106 @cindex reordering, warning
3107 @cindex warning for reordering of member initializers
3108 Warn when the order of member initializers given in the code does not
3109 match the order in which they must be executed. For instance:
3115 A(): j (0), i (1) @{ @}
3120 The compiler rearranges the member initializers for @code{i}
3121 and @code{j} to match the declaration order of the members, emitting
3122 a warning to that effect. This warning is enabled by @option{-Wall}.
3124 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3125 @opindex fext-numeric-literals
3126 @opindex fno-ext-numeric-literals
3127 Accept imaginary, fixed-point, or machine-defined
3128 literal number suffixes as GNU extensions.
3129 When this option is turned off these suffixes are treated
3130 as C++11 user-defined literal numeric suffixes.
3131 This is on by default for all pre-C++11 dialects and all GNU dialects:
3132 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3133 @option{-std=gnu++14}.
3134 This option is off by default
3135 for ISO C++11 onwards (@option{-std=c++11}, ...).
3138 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3141 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3144 Warn about violations of the following style guidelines from Scott Meyers'
3145 @cite{Effective C++} series of books:
3149 Define a copy constructor and an assignment operator for classes
3150 with dynamically-allocated memory.
3153 Prefer initialization to assignment in constructors.
3156 Have @code{operator=} return a reference to @code{*this}.
3159 Don't try to return a reference when you must return an object.
3162 Distinguish between prefix and postfix forms of increment and
3163 decrement operators.
3166 Never overload @code{&&}, @code{||}, or @code{,}.
3170 This option also enables @option{-Wnon-virtual-dtor}, which is also
3171 one of the effective C++ recommendations. However, the check is
3172 extended to warn about the lack of virtual destructor in accessible
3173 non-polymorphic bases classes too.
3175 When selecting this option, be aware that the standard library
3176 headers do not obey all of these guidelines; use @samp{grep -v}
3177 to filter out those warnings.
3179 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3180 @opindex Wstrict-null-sentinel
3181 @opindex Wno-strict-null-sentinel
3182 Warn about the use of an uncasted @code{NULL} as sentinel. When
3183 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3184 to @code{__null}. Although it is a null pointer constant rather than a
3185 null pointer, it is guaranteed to be of the same size as a pointer.
3186 But this use is not portable across different compilers.
3188 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3189 @opindex Wno-non-template-friend
3190 @opindex Wnon-template-friend
3191 Disable warnings when non-template friend functions are declared
3192 within a template. In very old versions of GCC that predate implementation
3193 of the ISO standard, declarations such as
3194 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3195 could be interpreted as a particular specialization of a template
3196 function; the warning exists to diagnose compatibility problems,
3197 and is enabled by default.
3199 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3200 @opindex Wold-style-cast
3201 @opindex Wno-old-style-cast
3202 Warn if an old-style (C-style) cast to a non-void type is used within
3203 a C++ program. The new-style casts (@code{dynamic_cast},
3204 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3205 less vulnerable to unintended effects and much easier to search for.
3207 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3208 @opindex Woverloaded-virtual
3209 @opindex Wno-overloaded-virtual
3210 @cindex overloaded virtual function, warning
3211 @cindex warning for overloaded virtual function
3212 Warn when a function declaration hides virtual functions from a
3213 base class. For example, in:
3220 struct B: public A @{
3225 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3236 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3237 @opindex Wno-pmf-conversions
3238 @opindex Wpmf-conversions
3239 Disable the diagnostic for converting a bound pointer to member function
3242 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3243 @opindex Wsign-promo
3244 @opindex Wno-sign-promo
3245 Warn when overload resolution chooses a promotion from unsigned or
3246 enumerated type to a signed type, over a conversion to an unsigned type of
3247 the same size. Previous versions of G++ tried to preserve
3248 unsignedness, but the standard mandates the current behavior.
3250 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3252 @opindex Wno-templates
3253 Warn when a primary template declaration is encountered. Some coding
3254 rules disallow templates, and this may be used to enforce that rule.
3255 The warning is inactive inside a system header file, such as the STL, so
3256 one can still use the STL. One may also instantiate or specialize
3259 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3260 @opindex Wmultiple-inheritance
3261 @opindex Wno-multiple-inheritance
3262 Warn when a class is defined with multiple direct base classes. Some
3263 coding rules disallow multiple inheritance, and this may be used to
3264 enforce that rule. The warning is inactive inside a system header file,
3265 such as the STL, so one can still use the STL. One may also define
3266 classes that indirectly use multiple inheritance.
3268 @item -Wvirtual-inheritance
3269 @opindex Wvirtual-inheritance
3270 @opindex Wno-virtual-inheritance
3271 Warn when a class is defined with a virtual direct base class. Some
3272 coding rules disallow multiple inheritance, and this may be used to
3273 enforce that rule. The warning is inactive inside a system header file,
3274 such as the STL, so one can still use the STL. One may also define
3275 classes that indirectly use virtual inheritance.
3278 @opindex Wnamespaces
3279 @opindex Wno-namespaces
3280 Warn when a namespace definition is opened. Some coding rules disallow
3281 namespaces, and this may be used to enforce that rule. The warning is
3282 inactive inside a system header file, such as the STL, so one can still
3283 use the STL. One may also use using directives and qualified names.
3285 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3287 @opindex Wno-terminate
3288 Disable the warning about a throw-expression that will immediately
3289 result in a call to @code{terminate}.
3292 @node Objective-C and Objective-C++ Dialect Options
3293 @section Options Controlling Objective-C and Objective-C++ Dialects
3295 @cindex compiler options, Objective-C and Objective-C++
3296 @cindex Objective-C and Objective-C++ options, command-line
3297 @cindex options, Objective-C and Objective-C++
3298 (NOTE: This manual does not describe the Objective-C and Objective-C++
3299 languages themselves. @xref{Standards,,Language Standards
3300 Supported by GCC}, for references.)
3302 This section describes the command-line options that are only meaningful
3303 for Objective-C and Objective-C++ programs. You can also use most of
3304 the language-independent GNU compiler options.
3305 For example, you might compile a file @file{some_class.m} like this:
3308 gcc -g -fgnu-runtime -O -c some_class.m
3312 In this example, @option{-fgnu-runtime} is an option meant only for
3313 Objective-C and Objective-C++ programs; you can use the other options with
3314 any language supported by GCC@.
3316 Note that since Objective-C is an extension of the C language, Objective-C
3317 compilations may also use options specific to the C front-end (e.g.,
3318 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3319 C++-specific options (e.g., @option{-Wabi}).
3321 Here is a list of options that are @emph{only} for compiling Objective-C
3322 and Objective-C++ programs:
3325 @item -fconstant-string-class=@var{class-name}
3326 @opindex fconstant-string-class
3327 Use @var{class-name} as the name of the class to instantiate for each
3328 literal string specified with the syntax @code{@@"@dots{}"}. The default
3329 class name is @code{NXConstantString} if the GNU runtime is being used, and
3330 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3331 @option{-fconstant-cfstrings} option, if also present, overrides the
3332 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3333 to be laid out as constant CoreFoundation strings.
3336 @opindex fgnu-runtime
3337 Generate object code compatible with the standard GNU Objective-C
3338 runtime. This is the default for most types of systems.
3340 @item -fnext-runtime
3341 @opindex fnext-runtime
3342 Generate output compatible with the NeXT runtime. This is the default
3343 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3344 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3347 @item -fno-nil-receivers
3348 @opindex fno-nil-receivers
3349 Assume that all Objective-C message dispatches (@code{[receiver
3350 message:arg]}) in this translation unit ensure that the receiver is
3351 not @code{nil}. This allows for more efficient entry points in the
3352 runtime to be used. This option is only available in conjunction with
3353 the NeXT runtime and ABI version 0 or 1.
3355 @item -fobjc-abi-version=@var{n}
3356 @opindex fobjc-abi-version
3357 Use version @var{n} of the Objective-C ABI for the selected runtime.
3358 This option is currently supported only for the NeXT runtime. In that
3359 case, Version 0 is the traditional (32-bit) ABI without support for
3360 properties and other Objective-C 2.0 additions. Version 1 is the
3361 traditional (32-bit) ABI with support for properties and other
3362 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3363 nothing is specified, the default is Version 0 on 32-bit target
3364 machines, and Version 2 on 64-bit target machines.
3366 @item -fobjc-call-cxx-cdtors
3367 @opindex fobjc-call-cxx-cdtors
3368 For each Objective-C class, check if any of its instance variables is a
3369 C++ object with a non-trivial default constructor. If so, synthesize a
3370 special @code{- (id) .cxx_construct} instance method which runs
3371 non-trivial default constructors on any such instance variables, in order,
3372 and then return @code{self}. Similarly, check if any instance variable
3373 is a C++ object with a non-trivial destructor, and if so, synthesize a
3374 special @code{- (void) .cxx_destruct} method which runs
3375 all such default destructors, in reverse order.
3377 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3378 methods thusly generated only operate on instance variables
3379 declared in the current Objective-C class, and not those inherited
3380 from superclasses. It is the responsibility of the Objective-C
3381 runtime to invoke all such methods in an object's inheritance
3382 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3383 by the runtime immediately after a new object instance is allocated;
3384 the @code{- (void) .cxx_destruct} methods are invoked immediately
3385 before the runtime deallocates an object instance.
3387 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3388 support for invoking the @code{- (id) .cxx_construct} and
3389 @code{- (void) .cxx_destruct} methods.
3391 @item -fobjc-direct-dispatch
3392 @opindex fobjc-direct-dispatch
3393 Allow fast jumps to the message dispatcher. On Darwin this is
3394 accomplished via the comm page.
3396 @item -fobjc-exceptions
3397 @opindex fobjc-exceptions
3398 Enable syntactic support for structured exception handling in
3399 Objective-C, similar to what is offered by C++. This option
3400 is required to use the Objective-C keywords @code{@@try},
3401 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3402 @code{@@synchronized}. This option is available with both the GNU
3403 runtime and the NeXT runtime (but not available in conjunction with
3404 the NeXT runtime on Mac OS X 10.2 and earlier).
3408 Enable garbage collection (GC) in Objective-C and Objective-C++
3409 programs. This option is only available with the NeXT runtime; the
3410 GNU runtime has a different garbage collection implementation that
3411 does not require special compiler flags.
3413 @item -fobjc-nilcheck
3414 @opindex fobjc-nilcheck
3415 For the NeXT runtime with version 2 of the ABI, check for a nil
3416 receiver in method invocations before doing the actual method call.
3417 This is the default and can be disabled using
3418 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3419 checked for nil in this way no matter what this flag is set to.
3420 Currently this flag does nothing when the GNU runtime, or an older
3421 version of the NeXT runtime ABI, is used.
3423 @item -fobjc-std=objc1
3425 Conform to the language syntax of Objective-C 1.0, the language
3426 recognized by GCC 4.0. This only affects the Objective-C additions to
3427 the C/C++ language; it does not affect conformance to C/C++ standards,
3428 which is controlled by the separate C/C++ dialect option flags. When
3429 this option is used with the Objective-C or Objective-C++ compiler,
3430 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3431 This is useful if you need to make sure that your Objective-C code can
3432 be compiled with older versions of GCC@.
3434 @item -freplace-objc-classes
3435 @opindex freplace-objc-classes
3436 Emit a special marker instructing @command{ld(1)} not to statically link in
3437 the resulting object file, and allow @command{dyld(1)} to load it in at
3438 run time instead. This is used in conjunction with the Fix-and-Continue
3439 debugging mode, where the object file in question may be recompiled and
3440 dynamically reloaded in the course of program execution, without the need
3441 to restart the program itself. Currently, Fix-and-Continue functionality
3442 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3447 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3448 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3449 compile time) with static class references that get initialized at load time,
3450 which improves run-time performance. Specifying the @option{-fzero-link} flag
3451 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3452 to be retained. This is useful in Zero-Link debugging mode, since it allows
3453 for individual class implementations to be modified during program execution.
3454 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3455 regardless of command-line options.
3457 @item -fno-local-ivars
3458 @opindex fno-local-ivars
3459 @opindex flocal-ivars
3460 By default instance variables in Objective-C can be accessed as if
3461 they were local variables from within the methods of the class they're
3462 declared in. This can lead to shadowing between instance variables
3463 and other variables declared either locally inside a class method or
3464 globally with the same name. Specifying the @option{-fno-local-ivars}
3465 flag disables this behavior thus avoiding variable shadowing issues.
3467 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3468 @opindex fivar-visibility
3469 Set the default instance variable visibility to the specified option
3470 so that instance variables declared outside the scope of any access
3471 modifier directives default to the specified visibility.
3475 Dump interface declarations for all classes seen in the source file to a
3476 file named @file{@var{sourcename}.decl}.
3478 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3479 @opindex Wassign-intercept
3480 @opindex Wno-assign-intercept
3481 Warn whenever an Objective-C assignment is being intercepted by the
3484 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3485 @opindex Wno-protocol
3487 If a class is declared to implement a protocol, a warning is issued for
3488 every method in the protocol that is not implemented by the class. The
3489 default behavior is to issue a warning for every method not explicitly
3490 implemented in the class, even if a method implementation is inherited
3491 from the superclass. If you use the @option{-Wno-protocol} option, then
3492 methods inherited from the superclass are considered to be implemented,
3493 and no warning is issued for them.
3495 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3497 @opindex Wno-selector
3498 Warn if multiple methods of different types for the same selector are
3499 found during compilation. The check is performed on the list of methods
3500 in the final stage of compilation. Additionally, a check is performed
3501 for each selector appearing in a @code{@@selector(@dots{})}
3502 expression, and a corresponding method for that selector has been found
3503 during compilation. Because these checks scan the method table only at
3504 the end of compilation, these warnings are not produced if the final
3505 stage of compilation is not reached, for example because an error is
3506 found during compilation, or because the @option{-fsyntax-only} option is
3509 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3510 @opindex Wstrict-selector-match
3511 @opindex Wno-strict-selector-match
3512 Warn if multiple methods with differing argument and/or return types are
3513 found for a given selector when attempting to send a message using this
3514 selector to a receiver of type @code{id} or @code{Class}. When this flag
3515 is off (which is the default behavior), the compiler omits such warnings
3516 if any differences found are confined to types that share the same size
3519 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3520 @opindex Wundeclared-selector
3521 @opindex Wno-undeclared-selector
3522 Warn if a @code{@@selector(@dots{})} expression referring to an
3523 undeclared selector is found. A selector is considered undeclared if no
3524 method with that name has been declared before the
3525 @code{@@selector(@dots{})} expression, either explicitly in an
3526 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3527 an @code{@@implementation} section. This option always performs its
3528 checks as soon as a @code{@@selector(@dots{})} expression is found,
3529 while @option{-Wselector} only performs its checks in the final stage of
3530 compilation. This also enforces the coding style convention
3531 that methods and selectors must be declared before being used.
3533 @item -print-objc-runtime-info
3534 @opindex print-objc-runtime-info
3535 Generate C header describing the largest structure that is passed by
3540 @node Diagnostic Message Formatting Options
3541 @section Options to Control Diagnostic Messages Formatting
3542 @cindex options to control diagnostics formatting
3543 @cindex diagnostic messages
3544 @cindex message formatting
3546 Traditionally, diagnostic messages have been formatted irrespective of
3547 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3548 options described below
3549 to control the formatting algorithm for diagnostic messages,
3550 e.g.@: how many characters per line, how often source location
3551 information should be reported. Note that some language front ends may not
3552 honor these options.
3555 @item -fmessage-length=@var{n}
3556 @opindex fmessage-length
3557 Try to format error messages so that they fit on lines of about
3558 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3559 done; each error message appears on a single line. This is the
3560 default for all front ends.
3562 Note - this option also affects the display of the @samp{#error} and
3563 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3564 function/type/variable attribute. It does not however affect the
3565 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3567 @item -fdiagnostics-show-location=once
3568 @opindex fdiagnostics-show-location
3569 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3570 reporter to emit source location information @emph{once}; that is, in
3571 case the message is too long to fit on a single physical line and has to
3572 be wrapped, the source location won't be emitted (as prefix) again,
3573 over and over, in subsequent continuation lines. This is the default
3576 @item -fdiagnostics-show-location=every-line
3577 Only meaningful in line-wrapping mode. Instructs the diagnostic
3578 messages reporter to emit the same source location information (as
3579 prefix) for physical lines that result from the process of breaking
3580 a message which is too long to fit on a single line.
3582 @item -fdiagnostics-color[=@var{WHEN}]
3583 @itemx -fno-diagnostics-color
3584 @opindex fdiagnostics-color
3585 @cindex highlight, color
3586 @vindex GCC_COLORS @r{environment variable}
3587 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3588 or @samp{auto}. The default depends on how the compiler has been configured,
3589 it can be any of the above @var{WHEN} options or also @samp{never}
3590 if @env{GCC_COLORS} environment variable isn't present in the environment,
3591 and @samp{auto} otherwise.
3592 @samp{auto} means to use color only when the standard error is a terminal.
3593 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3594 aliases for @option{-fdiagnostics-color=always} and
3595 @option{-fdiagnostics-color=never}, respectively.
3597 The colors are defined by the environment variable @env{GCC_COLORS}.
3598 Its value is a colon-separated list of capabilities and Select Graphic
3599 Rendition (SGR) substrings. SGR commands are interpreted by the
3600 terminal or terminal emulator. (See the section in the documentation
3601 of your text terminal for permitted values and their meanings as
3602 character attributes.) These substring values are integers in decimal
3603 representation and can be concatenated with semicolons.
3604 Common values to concatenate include
3606 @samp{4} for underline,
3608 @samp{7} for inverse,
3609 @samp{39} for default foreground color,
3610 @samp{30} to @samp{37} for foreground colors,
3611 @samp{90} to @samp{97} for 16-color mode foreground colors,
3612 @samp{38;5;0} to @samp{38;5;255}
3613 for 88-color and 256-color modes foreground colors,
3614 @samp{49} for default background color,
3615 @samp{40} to @samp{47} for background colors,
3616 @samp{100} to @samp{107} for 16-color mode background colors,
3617 and @samp{48;5;0} to @samp{48;5;255}
3618 for 88-color and 256-color modes background colors.
3620 The default @env{GCC_COLORS} is
3622 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3623 quote=01:fixit-insert=32:fixit-delete=31:\
3624 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3628 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3629 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3630 @samp{01} is bold, and @samp{31} is red.
3631 Setting @env{GCC_COLORS} to the empty string disables colors.
3632 Supported capabilities are as follows.
3636 @vindex error GCC_COLORS @r{capability}
3637 SGR substring for error: markers.
3640 @vindex warning GCC_COLORS @r{capability}
3641 SGR substring for warning: markers.
3644 @vindex note GCC_COLORS @r{capability}
3645 SGR substring for note: markers.
3648 @vindex range1 GCC_COLORS @r{capability}
3649 SGR substring for first additional range.
3652 @vindex range2 GCC_COLORS @r{capability}
3653 SGR substring for second additional range.
3656 @vindex locus GCC_COLORS @r{capability}
3657 SGR substring for location information, @samp{file:line} or
3658 @samp{file:line:column} etc.
3661 @vindex quote GCC_COLORS @r{capability}
3662 SGR substring for information printed within quotes.
3665 @vindex fixit-insert GCC_COLORS @r{capability}
3666 SGR substring for fix-it hints suggesting text to
3667 be inserted or replaced.
3670 @vindex fixit-delete GCC_COLORS @r{capability}
3671 SGR substring for fix-it hints suggesting text to
3674 @item diff-filename=
3675 @vindex diff-filename GCC_COLORS @r{capability}
3676 SGR substring for filename headers within generated patches.
3679 @vindex diff-hunk GCC_COLORS @r{capability}
3680 SGR substring for the starts of hunks within generated patches.
3683 @vindex diff-delete GCC_COLORS @r{capability}
3684 SGR substring for deleted lines within generated patches.
3687 @vindex diff-insert GCC_COLORS @r{capability}
3688 SGR substring for inserted lines within generated patches.
3691 @vindex type-diff GCC_COLORS @r{capability}
3692 SGR substring for highlighting mismatching types within template
3693 arguments in the C++ frontend.
3696 @item -fno-diagnostics-show-option
3697 @opindex fno-diagnostics-show-option
3698 @opindex fdiagnostics-show-option
3699 By default, each diagnostic emitted includes text indicating the
3700 command-line option that directly controls the diagnostic (if such an
3701 option is known to the diagnostic machinery). Specifying the
3702 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3704 @item -fno-diagnostics-show-caret
3705 @opindex fno-diagnostics-show-caret
3706 @opindex fdiagnostics-show-caret
3707 By default, each diagnostic emitted includes the original source line
3708 and a caret @samp{^} indicating the column. This option suppresses this
3709 information. The source line is truncated to @var{n} characters, if
3710 the @option{-fmessage-length=n} option is given. When the output is done
3711 to the terminal, the width is limited to the width given by the
3712 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3714 @item -fno-diagnostics-show-line-numbers
3715 @opindex fno-diagnostics-show-line-numbers
3716 @opindex fdiagnostics-show-line-numbers
3717 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3718 a left margin is printed, showing line numbers. This option suppresses this
3721 @item -fdiagnostics-parseable-fixits
3722 @opindex fdiagnostics-parseable-fixits
3723 Emit fix-it hints in a machine-parseable format, suitable for consumption
3724 by IDEs. For each fix-it, a line will be printed after the relevant
3725 diagnostic, starting with the string ``fix-it:''. For example:
3728 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3731 The location is expressed as a half-open range, expressed as a count of
3732 bytes, starting at byte 1 for the initial column. In the above example,
3733 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3737 00000000011111111112222222222
3738 12345678901234567890123456789
3739 gtk_widget_showall (dlg);
3744 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3745 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3746 (e.g. vertical tab as ``\013'').
3748 An empty replacement string indicates that the given range is to be removed.
3749 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3750 be inserted at the given position.
3752 @item -fdiagnostics-generate-patch
3753 @opindex fdiagnostics-generate-patch
3754 Print fix-it hints to stderr in unified diff format, after any diagnostics
3755 are printed. For example:
3762 void show_cb(GtkDialog *dlg)
3764 - gtk_widget_showall(dlg);
3765 + gtk_widget_show_all(dlg);
3770 The diff may or may not be colorized, following the same rules
3771 as for diagnostics (see @option{-fdiagnostics-color}).
3773 @item -fdiagnostics-show-template-tree
3774 @opindex fdiagnostics-show-template-tree
3776 In the C++ frontend, when printing diagnostics showing mismatching
3777 template types, such as:
3780 could not convert 'std::map<int, std::vector<double> >()'
3781 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3784 the @option{-fdiagnostics-show-template-tree} flag enables printing a
3785 tree-like structure showing the common and differing parts of the types,
3795 The parts that differ are highlighted with color (``double'' and
3796 ``float'' in this case).
3798 @item -fno-elide-type
3799 @opindex fno-elide-type
3800 @opindex felide-type
3801 By default when the C++ frontend prints diagnostics showing mismatching
3802 template types, common parts of the types are printed as ``[...]'' to
3803 simplify the error message. For example:
3806 could not convert 'std::map<int, std::vector<double> >()'
3807 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3810 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
3811 This flag also affects the output of the
3812 @option{-fdiagnostics-show-template-tree} flag.
3814 @item -fno-show-column
3815 @opindex fno-show-column
3816 Do not print column numbers in diagnostics. This may be necessary if
3817 diagnostics are being scanned by a program that does not understand the
3818 column numbers, such as @command{dejagnu}.
3822 @node Warning Options
3823 @section Options to Request or Suppress Warnings
3824 @cindex options to control warnings
3825 @cindex warning messages
3826 @cindex messages, warning
3827 @cindex suppressing warnings
3829 Warnings are diagnostic messages that report constructions that
3830 are not inherently erroneous but that are risky or suggest there
3831 may have been an error.
3833 The following language-independent options do not enable specific
3834 warnings but control the kinds of diagnostics produced by GCC@.
3837 @cindex syntax checking
3839 @opindex fsyntax-only
3840 Check the code for syntax errors, but don't do anything beyond that.
3842 @item -fmax-errors=@var{n}
3843 @opindex fmax-errors
3844 Limits the maximum number of error messages to @var{n}, at which point
3845 GCC bails out rather than attempting to continue processing the source
3846 code. If @var{n} is 0 (the default), there is no limit on the number
3847 of error messages produced. If @option{-Wfatal-errors} is also
3848 specified, then @option{-Wfatal-errors} takes precedence over this
3853 Inhibit all warning messages.
3858 Make all warnings into errors.
3863 Make the specified warning into an error. The specifier for a warning
3864 is appended; for example @option{-Werror=switch} turns the warnings
3865 controlled by @option{-Wswitch} into errors. This switch takes a
3866 negative form, to be used to negate @option{-Werror} for specific
3867 warnings; for example @option{-Wno-error=switch} makes
3868 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3871 The warning message for each controllable warning includes the
3872 option that controls the warning. That option can then be used with
3873 @option{-Werror=} and @option{-Wno-error=} as described above.
3874 (Printing of the option in the warning message can be disabled using the
3875 @option{-fno-diagnostics-show-option} flag.)
3877 Note that specifying @option{-Werror=}@var{foo} automatically implies
3878 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3881 @item -Wfatal-errors
3882 @opindex Wfatal-errors
3883 @opindex Wno-fatal-errors
3884 This option causes the compiler to abort compilation on the first error
3885 occurred rather than trying to keep going and printing further error
3890 You can request many specific warnings with options beginning with
3891 @samp{-W}, for example @option{-Wimplicit} to request warnings on
3892 implicit declarations. Each of these specific warning options also
3893 has a negative form beginning @samp{-Wno-} to turn off warnings; for
3894 example, @option{-Wno-implicit}. This manual lists only one of the
3895 two forms, whichever is not the default. For further
3896 language-specific options also refer to @ref{C++ Dialect Options} and
3897 @ref{Objective-C and Objective-C++ Dialect Options}.
3899 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
3900 options, such as @option{-Wunused}, which may turn on further options,
3901 such as @option{-Wunused-value}. The combined effect of positive and
3902 negative forms is that more specific options have priority over less
3903 specific ones, independently of their position in the command-line. For
3904 options of the same specificity, the last one takes effect. Options
3905 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
3906 as if they appeared at the end of the command-line.
3908 When an unrecognized warning option is requested (e.g.,
3909 @option{-Wunknown-warning}), GCC emits a diagnostic stating
3910 that the option is not recognized. However, if the @option{-Wno-} form
3911 is used, the behavior is slightly different: no diagnostic is
3912 produced for @option{-Wno-unknown-warning} unless other diagnostics
3913 are being produced. This allows the use of new @option{-Wno-} options
3914 with old compilers, but if something goes wrong, the compiler
3915 warns that an unrecognized option is present.
3922 @opindex Wno-pedantic
3923 Issue all the warnings demanded by strict ISO C and ISO C++;
3924 reject all programs that use forbidden extensions, and some other
3925 programs that do not follow ISO C and ISO C++. For ISO C, follows the
3926 version of the ISO C standard specified by any @option{-std} option used.
3928 Valid ISO C and ISO C++ programs should compile properly with or without
3929 this option (though a rare few require @option{-ansi} or a
3930 @option{-std} option specifying the required version of ISO C)@. However,
3931 without this option, certain GNU extensions and traditional C and C++
3932 features are supported as well. With this option, they are rejected.
3934 @option{-Wpedantic} does not cause warning messages for use of the
3935 alternate keywords whose names begin and end with @samp{__}. Pedantic
3936 warnings are also disabled in the expression that follows
3937 @code{__extension__}. However, only system header files should use
3938 these escape routes; application programs should avoid them.
3939 @xref{Alternate Keywords}.
3941 Some users try to use @option{-Wpedantic} to check programs for strict ISO
3942 C conformance. They soon find that it does not do quite what they want:
3943 it finds some non-ISO practices, but not all---only those for which
3944 ISO C @emph{requires} a diagnostic, and some others for which
3945 diagnostics have been added.
3947 A feature to report any failure to conform to ISO C might be useful in
3948 some instances, but would require considerable additional work and would
3949 be quite different from @option{-Wpedantic}. We don't have plans to
3950 support such a feature in the near future.
3952 Where the standard specified with @option{-std} represents a GNU
3953 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3954 corresponding @dfn{base standard}, the version of ISO C on which the GNU
3955 extended dialect is based. Warnings from @option{-Wpedantic} are given
3956 where they are required by the base standard. (It does not make sense
3957 for such warnings to be given only for features not in the specified GNU
3958 C dialect, since by definition the GNU dialects of C include all
3959 features the compiler supports with the given option, and there would be
3960 nothing to warn about.)
3962 @item -pedantic-errors
3963 @opindex pedantic-errors
3964 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
3965 requires a diagnostic, in some cases where there is undefined behavior
3966 at compile-time and in some other cases that do not prevent compilation
3967 of programs that are valid according to the standard. This is not
3968 equivalent to @option{-Werror=pedantic}, since there are errors enabled
3969 by this option and not enabled by the latter and vice versa.
3974 This enables all the warnings about constructions that some users
3975 consider questionable, and that are easy to avoid (or modify to
3976 prevent the warning), even in conjunction with macros. This also
3977 enables some language-specific warnings described in @ref{C++ Dialect
3978 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3980 @option{-Wall} turns on the following warning flags:
3982 @gccoptlist{-Waddress @gol
3983 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
3985 -Wbool-operation @gol
3986 -Wc++11-compat -Wc++14-compat @gol
3987 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
3988 -Wchar-subscripts @gol
3990 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
3991 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3993 -Wint-in-bool-context @gol
3994 -Wimplicit @r{(C and Objective-C only)} @gol
3995 -Wimplicit-int @r{(C and Objective-C only)} @gol
3996 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3997 -Winit-self @r{(only for C++)} @gol
3998 -Wlogical-not-parentheses @gol
3999 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4000 -Wmaybe-uninitialized @gol
4001 -Wmemset-elt-size @gol
4002 -Wmemset-transposed-args @gol
4003 -Wmisleading-indentation @r{(only for C/C++)} @gol
4004 -Wmissing-attributes @gol
4005 -Wmissing-braces @r{(only for C/ObjC)} @gol
4006 -Wmultistatement-macros @gol
4007 -Wnarrowing @r{(only for C++)} @gol
4009 -Wnonnull-compare @gol
4016 -Wsequence-point @gol
4017 -Wsign-compare @r{(only in C++)} @gol
4018 -Wsizeof-pointer-div @gol
4019 -Wsizeof-pointer-memaccess @gol
4020 -Wstrict-aliasing @gol
4021 -Wstrict-overflow=1 @gol
4023 -Wtautological-compare @gol
4025 -Wuninitialized @gol
4026 -Wunknown-pragmas @gol
4027 -Wunused-function @gol
4030 -Wunused-variable @gol
4031 -Wvolatile-register-var @gol
4034 Note that some warning flags are not implied by @option{-Wall}. Some of
4035 them warn about constructions that users generally do not consider
4036 questionable, but which occasionally you might wish to check for;
4037 others warn about constructions that are necessary or hard to avoid in
4038 some cases, and there is no simple way to modify the code to suppress
4039 the warning. Some of them are enabled by @option{-Wextra} but many of
4040 them must be enabled individually.
4046 This enables some extra warning flags that are not enabled by
4047 @option{-Wall}. (This option used to be called @option{-W}. The older
4048 name is still supported, but the newer name is more descriptive.)
4050 @gccoptlist{-Wclobbered @gol
4051 -Wcast-function-type @gol
4053 -Wignored-qualifiers @gol
4054 -Wimplicit-fallthrough=3 @gol
4055 -Wmissing-field-initializers @gol
4056 -Wmissing-parameter-type @r{(C only)} @gol
4057 -Wold-style-declaration @r{(C only)} @gol
4058 -Woverride-init @gol
4059 -Wsign-compare @r{(C only)} @gol
4061 -Wuninitialized @gol
4062 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4063 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4064 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4067 The option @option{-Wextra} also prints warning messages for the
4073 A pointer is compared against integer zero with @code{<}, @code{<=},
4074 @code{>}, or @code{>=}.
4077 (C++ only) An enumerator and a non-enumerator both appear in a
4078 conditional expression.
4081 (C++ only) Ambiguous virtual bases.
4084 (C++ only) Subscripting an array that has been declared @code{register}.
4087 (C++ only) Taking the address of a variable that has been declared
4091 (C++ only) A base class is not initialized in the copy constructor
4096 @item -Wchar-subscripts
4097 @opindex Wchar-subscripts
4098 @opindex Wno-char-subscripts
4099 Warn if an array subscript has type @code{char}. This is a common cause
4100 of error, as programmers often forget that this type is signed on some
4102 This warning is enabled by @option{-Wall}.
4107 Warn about an invalid memory access that is found by Pointer Bounds Checker
4108 (@option{-fcheck-pointer-bounds}).
4110 @item -Wno-coverage-mismatch
4111 @opindex Wno-coverage-mismatch
4112 @opindex Wcoverage-mismatch
4113 Warn if feedback profiles do not match when using the
4114 @option{-fprofile-use} option.
4115 If a source file is changed between compiling with @option{-fprofile-gen} and
4116 with @option{-fprofile-use}, the files with the profile feedback can fail
4117 to match the source file and GCC cannot use the profile feedback
4118 information. By default, this warning is enabled and is treated as an
4119 error. @option{-Wno-coverage-mismatch} can be used to disable the
4120 warning or @option{-Wno-error=coverage-mismatch} can be used to
4121 disable the error. Disabling the error for this warning can result in
4122 poorly optimized code and is useful only in the
4123 case of very minor changes such as bug fixes to an existing code-base.
4124 Completely disabling the warning is not recommended.
4127 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4129 Suppress warning messages emitted by @code{#warning} directives.
4131 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4132 @opindex Wdouble-promotion
4133 @opindex Wno-double-promotion
4134 Give a warning when a value of type @code{float} is implicitly
4135 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4136 floating-point unit implement @code{float} in hardware, but emulate
4137 @code{double} in software. On such a machine, doing computations
4138 using @code{double} values is much more expensive because of the
4139 overhead required for software emulation.
4141 It is easy to accidentally do computations with @code{double} because
4142 floating-point literals are implicitly of type @code{double}. For
4146 float area(float radius)
4148 return 3.14159 * radius * radius;
4152 the compiler performs the entire computation with @code{double}
4153 because the floating-point literal is a @code{double}.
4155 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4156 @opindex Wduplicate-decl-specifier
4157 @opindex Wno-duplicate-decl-specifier
4158 Warn if a declaration has duplicate @code{const}, @code{volatile},
4159 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4163 @itemx -Wformat=@var{n}
4166 @opindex ffreestanding
4167 @opindex fno-builtin
4169 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4170 the arguments supplied have types appropriate to the format string
4171 specified, and that the conversions specified in the format string make
4172 sense. This includes standard functions, and others specified by format
4173 attributes (@pxref{Function Attributes}), in the @code{printf},
4174 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4175 not in the C standard) families (or other target-specific families).
4176 Which functions are checked without format attributes having been
4177 specified depends on the standard version selected, and such checks of
4178 functions without the attribute specified are disabled by
4179 @option{-ffreestanding} or @option{-fno-builtin}.
4181 The formats are checked against the format features supported by GNU
4182 libc version 2.2. These include all ISO C90 and C99 features, as well
4183 as features from the Single Unix Specification and some BSD and GNU
4184 extensions. Other library implementations may not support all these
4185 features; GCC does not support warning about features that go beyond a
4186 particular library's limitations. However, if @option{-Wpedantic} is used
4187 with @option{-Wformat}, warnings are given about format features not
4188 in the selected standard version (but not for @code{strfmon} formats,
4189 since those are not in any version of the C standard). @xref{C Dialect
4190 Options,,Options Controlling C Dialect}.
4197 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4198 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4199 @option{-Wformat} also checks for null format arguments for several
4200 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4201 aspects of this level of format checking can be disabled by the
4202 options: @option{-Wno-format-contains-nul},
4203 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4204 @option{-Wformat} is enabled by @option{-Wall}.
4206 @item -Wno-format-contains-nul
4207 @opindex Wno-format-contains-nul
4208 @opindex Wformat-contains-nul
4209 If @option{-Wformat} is specified, do not warn about format strings that
4212 @item -Wno-format-extra-args
4213 @opindex Wno-format-extra-args
4214 @opindex Wformat-extra-args
4215 If @option{-Wformat} is specified, do not warn about excess arguments to a
4216 @code{printf} or @code{scanf} format function. The C standard specifies
4217 that such arguments are ignored.
4219 Where the unused arguments lie between used arguments that are
4220 specified with @samp{$} operand number specifications, normally
4221 warnings are still given, since the implementation could not know what
4222 type to pass to @code{va_arg} to skip the unused arguments. However,
4223 in the case of @code{scanf} formats, this option suppresses the
4224 warning if the unused arguments are all pointers, since the Single
4225 Unix Specification says that such unused arguments are allowed.
4227 @item -Wformat-overflow
4228 @itemx -Wformat-overflow=@var{level}
4229 @opindex Wformat-overflow
4230 @opindex Wno-format-overflow
4231 Warn about calls to formatted input/output functions such as @code{sprintf}
4232 and @code{vsprintf} that might overflow the destination buffer. When the
4233 exact number of bytes written by a format directive cannot be determined
4234 at compile-time it is estimated based on heuristics that depend on the
4235 @var{level} argument and on optimization. While enabling optimization
4236 will in most cases improve the accuracy of the warning, it may also
4237 result in false positives.
4240 @item -Wformat-overflow
4241 @itemx -Wformat-overflow=1
4242 @opindex Wformat-overflow
4243 @opindex Wno-format-overflow
4244 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4245 employs a conservative approach that warns only about calls that most
4246 likely overflow the buffer. At this level, numeric arguments to format
4247 directives with unknown values are assumed to have the value of one, and
4248 strings of unknown length to be empty. Numeric arguments that are known
4249 to be bounded to a subrange of their type, or string arguments whose output
4250 is bounded either by their directive's precision or by a finite set of
4251 string literals, are assumed to take on the value within the range that
4252 results in the most bytes on output. For example, the call to @code{sprintf}
4253 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4254 the terminating NUL character (@code{'\0'}) appended by the function
4255 to the destination buffer will be written past its end. Increasing
4256 the size of the buffer by a single byte is sufficient to avoid the
4257 warning, though it may not be sufficient to avoid the overflow.
4260 void f (int a, int b)
4263 sprintf (buf, "a = %i, b = %i\n", a, b);
4267 @item -Wformat-overflow=2
4268 Level @var{2} warns also about calls that might overflow the destination
4269 buffer given an argument of sufficient length or magnitude. At level
4270 @var{2}, unknown numeric arguments are assumed to have the minimum
4271 representable value for signed types with a precision greater than 1, and
4272 the maximum representable value otherwise. Unknown string arguments whose
4273 length cannot be assumed to be bounded either by the directive's precision,
4274 or by a finite set of string literals they may evaluate to, or the character
4275 array they may point to, are assumed to be 1 character long.
4277 At level @var{2}, the call in the example above is again diagnosed, but
4278 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4279 @code{%i} directive will write some of its digits beyond the end of
4280 the destination buffer. To make the call safe regardless of the values
4281 of the two variables, the size of the destination buffer must be increased
4282 to at least 34 bytes. GCC includes the minimum size of the buffer in
4283 an informational note following the warning.
4285 An alternative to increasing the size of the destination buffer is to
4286 constrain the range of formatted values. The maximum length of string
4287 arguments can be bounded by specifying the precision in the format
4288 directive. When numeric arguments of format directives can be assumed
4289 to be bounded by less than the precision of their type, choosing
4290 an appropriate length modifier to the format specifier will reduce
4291 the required buffer size. For example, if @var{a} and @var{b} in the
4292 example above can be assumed to be within the precision of
4293 the @code{short int} type then using either the @code{%hi} format
4294 directive or casting the argument to @code{short} reduces the maximum
4295 required size of the buffer to 24 bytes.
4298 void f (int a, int b)
4301 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4306 @item -Wno-format-zero-length
4307 @opindex Wno-format-zero-length
4308 @opindex Wformat-zero-length
4309 If @option{-Wformat} is specified, do not warn about zero-length formats.
4310 The C standard specifies that zero-length formats are allowed.
4315 Enable @option{-Wformat} plus additional format checks. Currently
4316 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4319 @item -Wformat-nonliteral
4320 @opindex Wformat-nonliteral
4321 @opindex Wno-format-nonliteral
4322 If @option{-Wformat} is specified, also warn if the format string is not a
4323 string literal and so cannot be checked, unless the format function
4324 takes its format arguments as a @code{va_list}.
4326 @item -Wformat-security
4327 @opindex Wformat-security
4328 @opindex Wno-format-security
4329 If @option{-Wformat} is specified, also warn about uses of format
4330 functions that represent possible security problems. At present, this
4331 warns about calls to @code{printf} and @code{scanf} functions where the
4332 format string is not a string literal and there are no format arguments,
4333 as in @code{printf (foo);}. This may be a security hole if the format
4334 string came from untrusted input and contains @samp{%n}. (This is
4335 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4336 in future warnings may be added to @option{-Wformat-security} that are not
4337 included in @option{-Wformat-nonliteral}.)
4339 @item -Wformat-signedness
4340 @opindex Wformat-signedness
4341 @opindex Wno-format-signedness
4342 If @option{-Wformat} is specified, also warn if the format string
4343 requires an unsigned argument and the argument is signed and vice versa.
4345 @item -Wformat-truncation
4346 @itemx -Wformat-truncation=@var{level}
4347 @opindex Wformat-truncation
4348 @opindex Wno-format-truncation
4349 Warn about calls to formatted input/output functions such as @code{snprintf}
4350 and @code{vsnprintf} that might result in output truncation. When the exact
4351 number of bytes written by a format directive cannot be determined at
4352 compile-time it is estimated based on heuristics that depend on
4353 the @var{level} argument and on optimization. While enabling optimization
4354 will in most cases improve the accuracy of the warning, it may also result
4355 in false positives. Except as noted otherwise, the option uses the same
4356 logic @option{-Wformat-overflow}.
4359 @item -Wformat-truncation
4360 @itemx -Wformat-truncation=1
4361 @opindex Wformat-truncation
4362 @opindex Wno-format-truncation
4363 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4364 employs a conservative approach that warns only about calls to bounded
4365 functions whose return value is unused and that will most likely result
4366 in output truncation.
4368 @item -Wformat-truncation=2
4369 Level @var{2} warns also about calls to bounded functions whose return
4370 value is used and that might result in truncation given an argument of
4371 sufficient length or magnitude.
4375 @opindex Wformat-y2k
4376 @opindex Wno-format-y2k
4377 If @option{-Wformat} is specified, also warn about @code{strftime}
4378 formats that may yield only a two-digit year.
4383 @opindex Wno-nonnull
4384 Warn about passing a null pointer for arguments marked as
4385 requiring a non-null value by the @code{nonnull} function attribute.
4387 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4388 can be disabled with the @option{-Wno-nonnull} option.
4390 @item -Wnonnull-compare
4391 @opindex Wnonnull-compare
4392 @opindex Wno-nonnull-compare
4393 Warn when comparing an argument marked with the @code{nonnull}
4394 function attribute against null inside the function.
4396 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4397 can be disabled with the @option{-Wno-nonnull-compare} option.
4399 @item -Wnull-dereference
4400 @opindex Wnull-dereference
4401 @opindex Wno-null-dereference
4402 Warn if the compiler detects paths that trigger erroneous or
4403 undefined behavior due to dereferencing a null pointer. This option
4404 is only active when @option{-fdelete-null-pointer-checks} is active,
4405 which is enabled by optimizations in most targets. The precision of
4406 the warnings depends on the optimization options used.
4408 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4410 @opindex Wno-init-self
4411 Warn about uninitialized variables that are initialized with themselves.
4412 Note this option can only be used with the @option{-Wuninitialized} option.
4414 For example, GCC warns about @code{i} being uninitialized in the
4415 following snippet only when @option{-Winit-self} has been specified:
4426 This warning is enabled by @option{-Wall} in C++.
4428 @item -Wimplicit-int @r{(C and Objective-C only)}
4429 @opindex Wimplicit-int
4430 @opindex Wno-implicit-int
4431 Warn when a declaration does not specify a type.
4432 This warning is enabled by @option{-Wall}.
4434 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4435 @opindex Wimplicit-function-declaration
4436 @opindex Wno-implicit-function-declaration
4437 Give a warning whenever a function is used before being declared. In
4438 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4439 enabled by default and it is made into an error by
4440 @option{-pedantic-errors}. This warning is also enabled by
4443 @item -Wimplicit @r{(C and Objective-C only)}
4445 @opindex Wno-implicit
4446 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4447 This warning is enabled by @option{-Wall}.
4449 @item -Wimplicit-fallthrough
4450 @opindex Wimplicit-fallthrough
4451 @opindex Wno-implicit-fallthrough
4452 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4453 and @option{-Wno-implicit-fallthrough} is the same as
4454 @option{-Wimplicit-fallthrough=0}.
4456 @item -Wimplicit-fallthrough=@var{n}
4457 @opindex Wimplicit-fallthrough=
4458 Warn when a switch case falls through. For example:
4476 This warning does not warn when the last statement of a case cannot
4477 fall through, e.g. when there is a return statement or a call to function
4478 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4479 also takes into account control flow statements, such as ifs, and only
4480 warns when appropriate. E.g.@:
4490 @} else if (i < 1) @{
4500 Since there are occasions where a switch case fall through is desirable,
4501 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4502 to be used along with a null statement to suppress this warning that
4503 would normally occur:
4511 __attribute__ ((fallthrough));
4518 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4519 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4520 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4521 Instead of these attributes, it is also possible to add a fallthrough comment
4522 to silence the warning. The whole body of the C or C++ style comment should
4523 match the given regular expressions listed below. The option argument @var{n}
4524 specifies what kind of comments are accepted:
4528 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4530 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4531 expression, any comment is used as fallthrough comment.
4533 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4534 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4536 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4537 following regular expressions:
4541 @item @code{-fallthrough}
4543 @item @code{@@fallthrough@@}
4545 @item @code{lint -fallthrough[ \t]*}
4547 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4549 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4551 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4555 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4556 following regular expressions:
4560 @item @code{-fallthrough}
4562 @item @code{@@fallthrough@@}
4564 @item @code{lint -fallthrough[ \t]*}
4566 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4570 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
4571 fallthrough comments, only attributes disable the warning.
4575 The comment needs to be followed after optional whitespace and other comments
4576 by @code{case} or @code{default} keywords or by a user label that precedes some
4577 @code{case} or @code{default} label.
4592 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
4594 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
4595 @opindex Wif-not-aligned
4596 @opindex Wno-if-not-aligned
4597 Control if warning triggered by the @code{warn_if_not_aligned} attribute
4598 should be issued. This is enabled by default.
4599 Use @option{-Wno-if-not-aligned} to disable it.
4601 @item -Wignored-qualifiers @r{(C and C++ only)}
4602 @opindex Wignored-qualifiers
4603 @opindex Wno-ignored-qualifiers
4604 Warn if the return type of a function has a type qualifier
4605 such as @code{const}. For ISO C such a type qualifier has no effect,
4606 since the value returned by a function is not an lvalue.
4607 For C++, the warning is only emitted for scalar types or @code{void}.
4608 ISO C prohibits qualified @code{void} return types on function
4609 definitions, so such return types always receive a warning
4610 even without this option.
4612 This warning is also enabled by @option{-Wextra}.
4614 @item -Wignored-attributes @r{(C and C++ only)}
4615 @opindex Wignored-attributes
4616 @opindex Wno-ignored-attributes
4617 Warn when an attribute is ignored. This is different from the
4618 @option{-Wattributes} option in that it warns whenever the compiler decides
4619 to drop an attribute, not that the attribute is either unknown, used in a
4620 wrong place, etc. This warning is enabled by default.
4625 Warn if the type of @code{main} is suspicious. @code{main} should be
4626 a function with external linkage, returning int, taking either zero
4627 arguments, two, or three arguments of appropriate types. This warning
4628 is enabled by default in C++ and is enabled by either @option{-Wall}
4629 or @option{-Wpedantic}.
4631 @item -Wmisleading-indentation @r{(C and C++ only)}
4632 @opindex Wmisleading-indentation
4633 @opindex Wno-misleading-indentation
4634 Warn when the indentation of the code does not reflect the block structure.
4635 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
4636 @code{for} clauses with a guarded statement that does not use braces,
4637 followed by an unguarded statement with the same indentation.
4639 In the following example, the call to ``bar'' is misleadingly indented as
4640 if it were guarded by the ``if'' conditional.
4643 if (some_condition ())
4645 bar (); /* Gotcha: this is not guarded by the "if". */
4648 In the case of mixed tabs and spaces, the warning uses the
4649 @option{-ftabstop=} option to determine if the statements line up
4652 The warning is not issued for code involving multiline preprocessor logic
4653 such as the following example.
4658 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
4664 The warning is not issued after a @code{#line} directive, since this
4665 typically indicates autogenerated code, and no assumptions can be made
4666 about the layout of the file that the directive references.
4668 This warning is enabled by @option{-Wall} in C and C++.
4670 @item -Wmissing-attributes
4671 @opindex Wmissing-attributes
4672 @opindex Wno-missing-attributes
4673 Warn when a declaration of a function is missing one or more attributes
4674 that a related function is declared with and whose absence may adversely
4675 affect the correctness or efficiency of generated code. For example, in
4676 C++, the warning is issued when an explicit specialization of a primary
4677 template declared with attribute @code{alloc_align}, @code{alloc_size},
4678 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
4679 or @code{nonnull} is declared without it. Attributes @code{deprecated},
4680 @code{error}, and @code{warning} suppress the warning.
4681 (@pxref{Function Attributes}).
4683 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
4685 For example, since the declaration of the primary function template
4686 below makes use of both attribute @code{malloc} and @code{alloc_size}
4687 the declaration of the explicit specialization of the template is
4688 diagnosed because it is missing one of the attributes.
4692 T* __attribute__ ((malloc, alloc_size (1)))
4696 void* __attribute__ ((malloc)) // missing alloc_size
4697 allocate<void> (size_t);
4700 @item -Wmissing-braces
4701 @opindex Wmissing-braces
4702 @opindex Wno-missing-braces
4703 Warn if an aggregate or union initializer is not fully bracketed. In
4704 the following example, the initializer for @code{a} is not fully
4705 bracketed, but that for @code{b} is fully bracketed. This warning is
4706 enabled by @option{-Wall} in C.
4709 int a[2][2] = @{ 0, 1, 2, 3 @};
4710 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
4713 This warning is enabled by @option{-Wall}.
4715 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
4716 @opindex Wmissing-include-dirs
4717 @opindex Wno-missing-include-dirs
4718 Warn if a user-supplied include directory does not exist.
4720 @item -Wmultistatement-macros
4721 @opindex Wmultistatement-macros
4722 @opindex Wno-multistatement-macros
4723 Warn about unsafe multiple statement macros that appear to be guarded
4724 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
4725 @code{while}, in which only the first statement is actually guarded after
4726 the macro is expanded.
4731 #define DOIT x++; y++
4736 will increment @code{y} unconditionally, not just when @code{c} holds.
4737 The can usually be fixed by wrapping the macro in a do-while loop:
4739 #define DOIT do @{ x++; y++; @} while (0)
4744 This warning is enabled by @option{-Wall} in C and C++.
4747 @opindex Wparentheses
4748 @opindex Wno-parentheses
4749 Warn if parentheses are omitted in certain contexts, such
4750 as when there is an assignment in a context where a truth value
4751 is expected, or when operators are nested whose precedence people
4752 often get confused about.
4754 Also warn if a comparison like @code{x<=y<=z} appears; this is
4755 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
4756 interpretation from that of ordinary mathematical notation.
4758 Also warn for dangerous uses of the GNU extension to
4759 @code{?:} with omitted middle operand. When the condition
4760 in the @code{?}: operator is a boolean expression, the omitted value is
4761 always 1. Often programmers expect it to be a value computed
4762 inside the conditional expression instead.
4764 For C++ this also warns for some cases of unnecessary parentheses in
4765 declarations, which can indicate an attempt at a function call instead
4769 // Declares a local variable called mymutex.
4770 std::unique_lock<std::mutex> (mymutex);
4771 // User meant std::unique_lock<std::mutex> lock (mymutex);
4775 This warning is enabled by @option{-Wall}.
4777 @item -Wsequence-point
4778 @opindex Wsequence-point
4779 @opindex Wno-sequence-point
4780 Warn about code that may have undefined semantics because of violations
4781 of sequence point rules in the C and C++ standards.
4783 The C and C++ standards define the order in which expressions in a C/C++
4784 program are evaluated in terms of @dfn{sequence points}, which represent
4785 a partial ordering between the execution of parts of the program: those
4786 executed before the sequence point, and those executed after it. These
4787 occur after the evaluation of a full expression (one which is not part
4788 of a larger expression), after the evaluation of the first operand of a
4789 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
4790 function is called (but after the evaluation of its arguments and the
4791 expression denoting the called function), and in certain other places.
4792 Other than as expressed by the sequence point rules, the order of
4793 evaluation of subexpressions of an expression is not specified. All
4794 these rules describe only a partial order rather than a total order,
4795 since, for example, if two functions are called within one expression
4796 with no sequence point between them, the order in which the functions
4797 are called is not specified. However, the standards committee have
4798 ruled that function calls do not overlap.
4800 It is not specified when between sequence points modifications to the
4801 values of objects take effect. Programs whose behavior depends on this
4802 have undefined behavior; the C and C++ standards specify that ``Between
4803 the previous and next sequence point an object shall have its stored
4804 value modified at most once by the evaluation of an expression.
4805 Furthermore, the prior value shall be read only to determine the value
4806 to be stored.''. If a program breaks these rules, the results on any
4807 particular implementation are entirely unpredictable.
4809 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
4810 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
4811 diagnosed by this option, and it may give an occasional false positive
4812 result, but in general it has been found fairly effective at detecting
4813 this sort of problem in programs.
4815 The C++17 standard will define the order of evaluation of operands in
4816 more cases: in particular it requires that the right-hand side of an
4817 assignment be evaluated before the left-hand side, so the above
4818 examples are no longer undefined. But this warning will still warn
4819 about them, to help people avoid writing code that is undefined in C
4820 and earlier revisions of C++.
4822 The standard is worded confusingly, therefore there is some debate
4823 over the precise meaning of the sequence point rules in subtle cases.
4824 Links to discussions of the problem, including proposed formal
4825 definitions, may be found on the GCC readings page, at
4826 @uref{http://gcc.gnu.org/@/readings.html}.
4828 This warning is enabled by @option{-Wall} for C and C++.
4830 @item -Wno-return-local-addr
4831 @opindex Wno-return-local-addr
4832 @opindex Wreturn-local-addr
4833 Do not warn about returning a pointer (or in C++, a reference) to a
4834 variable that goes out of scope after the function returns.
4837 @opindex Wreturn-type
4838 @opindex Wno-return-type
4839 Warn whenever a function is defined with a return type that defaults
4840 to @code{int}. Also warn about any @code{return} statement with no
4841 return value in a function whose return type is not @code{void}
4842 (falling off the end of the function body is considered returning
4845 For C only, warn about a @code{return} statement with an expression in a
4846 function whose return type is @code{void}, unless the expression type is
4847 also @code{void}. As a GNU extension, the latter case is accepted
4848 without a warning unless @option{-Wpedantic} is used.
4850 For C++, a function without return type always produces a diagnostic
4851 message, even when @option{-Wno-return-type} is specified. The only
4852 exceptions are @code{main} and functions defined in system headers.
4854 This warning is enabled by default for C++ and is enabled by @option{-Wall}.
4856 @item -Wshift-count-negative
4857 @opindex Wshift-count-negative
4858 @opindex Wno-shift-count-negative
4859 Warn if shift count is negative. This warning is enabled by default.
4861 @item -Wshift-count-overflow
4862 @opindex Wshift-count-overflow
4863 @opindex Wno-shift-count-overflow
4864 Warn if shift count >= width of type. This warning is enabled by default.
4866 @item -Wshift-negative-value
4867 @opindex Wshift-negative-value
4868 @opindex Wno-shift-negative-value
4869 Warn if left shifting a negative value. This warning is enabled by
4870 @option{-Wextra} in C99 and C++11 modes (and newer).
4872 @item -Wshift-overflow
4873 @itemx -Wshift-overflow=@var{n}
4874 @opindex Wshift-overflow
4875 @opindex Wno-shift-overflow
4876 Warn about left shift overflows. This warning is enabled by
4877 default in C99 and C++11 modes (and newer).
4880 @item -Wshift-overflow=1
4881 This is the warning level of @option{-Wshift-overflow} and is enabled
4882 by default in C99 and C++11 modes (and newer). This warning level does
4883 not warn about left-shifting 1 into the sign bit. (However, in C, such
4884 an overflow is still rejected in contexts where an integer constant expression
4887 @item -Wshift-overflow=2
4888 This warning level also warns about left-shifting 1 into the sign bit,
4889 unless C++14 mode is active.
4895 Warn whenever a @code{switch} statement has an index of enumerated type
4896 and lacks a @code{case} for one or more of the named codes of that
4897 enumeration. (The presence of a @code{default} label prevents this
4898 warning.) @code{case} labels outside the enumeration range also
4899 provoke warnings when this option is used (even if there is a
4900 @code{default} label).
4901 This warning is enabled by @option{-Wall}.
4903 @item -Wswitch-default
4904 @opindex Wswitch-default
4905 @opindex Wno-switch-default
4906 Warn whenever a @code{switch} statement does not have a @code{default}
4910 @opindex Wswitch-enum
4911 @opindex Wno-switch-enum
4912 Warn whenever a @code{switch} statement has an index of enumerated type
4913 and lacks a @code{case} for one or more of the named codes of that
4914 enumeration. @code{case} labels outside the enumeration range also
4915 provoke warnings when this option is used. The only difference
4916 between @option{-Wswitch} and this option is that this option gives a
4917 warning about an omitted enumeration code even if there is a
4918 @code{default} label.
4921 @opindex Wswitch-bool
4922 @opindex Wno-switch-bool
4923 Warn whenever a @code{switch} statement has an index of boolean type
4924 and the case values are outside the range of a boolean type.
4925 It is possible to suppress this warning by casting the controlling
4926 expression to a type other than @code{bool}. For example:
4929 switch ((int) (a == 4))
4935 This warning is enabled by default for C and C++ programs.
4937 @item -Wswitch-unreachable
4938 @opindex Wswitch-unreachable
4939 @opindex Wno-switch-unreachable
4940 Warn whenever a @code{switch} statement contains statements between the
4941 controlling expression and the first case label, which will never be
4942 executed. For example:
4954 @option{-Wswitch-unreachable} does not warn if the statement between the
4955 controlling expression and the first case label is just a declaration:
4968 This warning is enabled by default for C and C++ programs.
4970 @item -Wsync-nand @r{(C and C++ only)}
4972 @opindex Wno-sync-nand
4973 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
4974 built-in functions are used. These functions changed semantics in GCC 4.4.
4976 @item -Wunused-but-set-parameter
4977 @opindex Wunused-but-set-parameter
4978 @opindex Wno-unused-but-set-parameter
4979 Warn whenever a function parameter is assigned to, but otherwise unused
4980 (aside from its declaration).
4982 To suppress this warning use the @code{unused} attribute
4983 (@pxref{Variable Attributes}).
4985 This warning is also enabled by @option{-Wunused} together with
4988 @item -Wunused-but-set-variable
4989 @opindex Wunused-but-set-variable
4990 @opindex Wno-unused-but-set-variable
4991 Warn whenever a local variable is assigned to, but otherwise unused
4992 (aside from its declaration).
4993 This warning is enabled by @option{-Wall}.
4995 To suppress this warning use the @code{unused} attribute
4996 (@pxref{Variable Attributes}).
4998 This warning is also enabled by @option{-Wunused}, which is enabled
5001 @item -Wunused-function
5002 @opindex Wunused-function
5003 @opindex Wno-unused-function
5004 Warn whenever a static function is declared but not defined or a
5005 non-inline static function is unused.
5006 This warning is enabled by @option{-Wall}.
5008 @item -Wunused-label
5009 @opindex Wunused-label
5010 @opindex Wno-unused-label
5011 Warn whenever a label is declared but not used.
5012 This warning is enabled by @option{-Wall}.
5014 To suppress this warning use the @code{unused} attribute
5015 (@pxref{Variable Attributes}).
5017 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5018 @opindex Wunused-local-typedefs
5019 @opindex Wno-unused-local-typedefs
5020 Warn when a typedef locally defined in a function is not used.
5021 This warning is enabled by @option{-Wall}.
5023 @item -Wunused-parameter
5024 @opindex Wunused-parameter
5025 @opindex Wno-unused-parameter
5026 Warn whenever a function parameter is unused aside from its declaration.
5028 To suppress this warning use the @code{unused} attribute
5029 (@pxref{Variable Attributes}).
5031 @item -Wno-unused-result
5032 @opindex Wunused-result
5033 @opindex Wno-unused-result
5034 Do not warn if a caller of a function marked with attribute
5035 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5036 its return value. The default is @option{-Wunused-result}.
5038 @item -Wunused-variable
5039 @opindex Wunused-variable
5040 @opindex Wno-unused-variable
5041 Warn whenever a local or static variable is unused aside from its
5042 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5043 but not for C++. This warning is enabled by @option{-Wall}.
5045 To suppress this warning use the @code{unused} attribute
5046 (@pxref{Variable Attributes}).
5048 @item -Wunused-const-variable
5049 @itemx -Wunused-const-variable=@var{n}
5050 @opindex Wunused-const-variable
5051 @opindex Wno-unused-const-variable
5052 Warn whenever a constant static variable is unused aside from its declaration.
5053 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5054 for C, but not for C++. In C this declares variable storage, but in C++ this
5055 is not an error since const variables take the place of @code{#define}s.
5057 To suppress this warning use the @code{unused} attribute
5058 (@pxref{Variable Attributes}).
5061 @item -Wunused-const-variable=1
5062 This is the warning level that is enabled by @option{-Wunused-variable} for
5063 C. It warns only about unused static const variables defined in the main
5064 compilation unit, but not about static const variables declared in any
5067 @item -Wunused-const-variable=2
5068 This warning level also warns for unused constant static variables in
5069 headers (excluding system headers). This is the warning level of
5070 @option{-Wunused-const-variable} and must be explicitly requested since
5071 in C++ this isn't an error and in C it might be harder to clean up all
5075 @item -Wunused-value
5076 @opindex Wunused-value
5077 @opindex Wno-unused-value
5078 Warn whenever a statement computes a result that is explicitly not
5079 used. To suppress this warning cast the unused expression to
5080 @code{void}. This includes an expression-statement or the left-hand
5081 side of a comma expression that contains no side effects. For example,
5082 an expression such as @code{x[i,j]} causes a warning, while
5083 @code{x[(void)i,j]} does not.
5085 This warning is enabled by @option{-Wall}.
5090 All the above @option{-Wunused} options combined.
5092 In order to get a warning about an unused function parameter, you must
5093 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5094 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5096 @item -Wuninitialized
5097 @opindex Wuninitialized
5098 @opindex Wno-uninitialized
5099 Warn if an automatic variable is used without first being initialized
5100 or if a variable may be clobbered by a @code{setjmp} call. In C++,
5101 warn if a non-static reference or non-static @code{const} member
5102 appears in a class without constructors.
5104 If you want to warn about code that uses the uninitialized value of the
5105 variable in its own initializer, use the @option{-Winit-self} option.
5107 These warnings occur for individual uninitialized or clobbered
5108 elements of structure, union or array variables as well as for
5109 variables that are uninitialized or clobbered as a whole. They do
5110 not occur for variables or elements declared @code{volatile}. Because
5111 these warnings depend on optimization, the exact variables or elements
5112 for which there are warnings depends on the precise optimization
5113 options and version of GCC used.
5115 Note that there may be no warning about a variable that is used only
5116 to compute a value that itself is never used, because such
5117 computations may be deleted by data flow analysis before the warnings
5120 @item -Winvalid-memory-model
5121 @opindex Winvalid-memory-model
5122 @opindex Wno-invalid-memory-model
5123 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5124 and the C11 atomic generic functions with a memory consistency argument
5125 that is either invalid for the operation or outside the range of values
5126 of the @code{memory_order} enumeration. For example, since the
5127 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5128 defined for the relaxed, release, and sequentially consistent memory
5129 orders the following code is diagnosed:
5134 __atomic_store_n (i, 0, memory_order_consume);
5138 @option{-Winvalid-memory-model} is enabled by default.
5140 @item -Wmaybe-uninitialized
5141 @opindex Wmaybe-uninitialized
5142 @opindex Wno-maybe-uninitialized
5143 For an automatic (i.e.@ local) variable, if there exists a path from the
5144 function entry to a use of the variable that is initialized, but there exist
5145 some other paths for which the variable is not initialized, the compiler
5146 emits a warning if it cannot prove the uninitialized paths are not
5147 executed at run time.
5149 These warnings are only possible in optimizing compilation, because otherwise
5150 GCC does not keep track of the state of variables.
5152 These warnings are made optional because GCC may not be able to determine when
5153 the code is correct in spite of appearing to have an error. Here is one
5154 example of how this can happen:
5174 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5175 always initialized, but GCC doesn't know this. To suppress the
5176 warning, you need to provide a default case with assert(0) or
5179 @cindex @code{longjmp} warnings
5180 This option also warns when a non-volatile automatic variable might be
5181 changed by a call to @code{longjmp}.
5182 The compiler sees only the calls to @code{setjmp}. It cannot know
5183 where @code{longjmp} will be called; in fact, a signal handler could
5184 call it at any point in the code. As a result, you may get a warning
5185 even when there is in fact no problem because @code{longjmp} cannot
5186 in fact be called at the place that would cause a problem.
5188 Some spurious warnings can be avoided if you declare all the functions
5189 you use that never return as @code{noreturn}. @xref{Function
5192 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5194 @item -Wunknown-pragmas
5195 @opindex Wunknown-pragmas
5196 @opindex Wno-unknown-pragmas
5197 @cindex warning for unknown pragmas
5198 @cindex unknown pragmas, warning
5199 @cindex pragmas, warning of unknown
5200 Warn when a @code{#pragma} directive is encountered that is not understood by
5201 GCC@. If this command-line option is used, warnings are even issued
5202 for unknown pragmas in system header files. This is not the case if
5203 the warnings are only enabled by the @option{-Wall} command-line option.
5206 @opindex Wno-pragmas
5208 Do not warn about misuses of pragmas, such as incorrect parameters,
5209 invalid syntax, or conflicts between pragmas. See also
5210 @option{-Wunknown-pragmas}.
5212 @item -Wstrict-aliasing
5213 @opindex Wstrict-aliasing
5214 @opindex Wno-strict-aliasing
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. The warning does not catch all
5218 cases, but does attempt to catch the more common pitfalls. It is
5219 included in @option{-Wall}.
5220 It is equivalent to @option{-Wstrict-aliasing=3}
5222 @item -Wstrict-aliasing=n
5223 @opindex Wstrict-aliasing=n
5224 This option is only active when @option{-fstrict-aliasing} is active.
5225 It warns about code that might break the strict aliasing rules that the
5226 compiler is using for optimization.
5227 Higher levels correspond to higher accuracy (fewer false positives).
5228 Higher levels also correspond to more effort, similar to the way @option{-O}
5230 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5232 Level 1: Most aggressive, quick, least accurate.
5233 Possibly useful when higher levels
5234 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5235 false negatives. However, it has many false positives.
5236 Warns for all pointer conversions between possibly incompatible types,
5237 even if never dereferenced. Runs in the front end only.
5239 Level 2: Aggressive, quick, not too precise.
5240 May still have many false positives (not as many as level 1 though),
5241 and few false negatives (but possibly more than level 1).
5242 Unlike level 1, it only warns when an address is taken. Warns about
5243 incomplete types. Runs in the front end only.
5245 Level 3 (default for @option{-Wstrict-aliasing}):
5246 Should have very few false positives and few false
5247 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5248 Takes care of the common pun+dereference pattern in the front end:
5249 @code{*(int*)&some_float}.
5250 If optimization is enabled, it also runs in the back end, where it deals
5251 with multiple statement cases using flow-sensitive points-to information.
5252 Only warns when the converted pointer is dereferenced.
5253 Does not warn about incomplete types.
5255 @item -Wstrict-overflow
5256 @itemx -Wstrict-overflow=@var{n}
5257 @opindex Wstrict-overflow
5258 @opindex Wno-strict-overflow
5259 This option is only active when signed overflow is undefined.
5260 It warns about cases where the compiler optimizes based on the
5261 assumption that signed overflow does not occur. Note that it does not
5262 warn about all cases where the code might overflow: it only warns
5263 about cases where the compiler implements some optimization. Thus
5264 this warning depends on the optimization level.
5266 An optimization that assumes that signed overflow does not occur is
5267 perfectly safe if the values of the variables involved are such that
5268 overflow never does, in fact, occur. Therefore this warning can
5269 easily give a false positive: a warning about code that is not
5270 actually a problem. To help focus on important issues, several
5271 warning levels are defined. No warnings are issued for the use of
5272 undefined signed overflow when estimating how many iterations a loop
5273 requires, in particular when determining whether a loop will be
5277 @item -Wstrict-overflow=1
5278 Warn about cases that are both questionable and easy to avoid. For
5279 example the compiler simplifies
5280 @code{x + 1 > x} to @code{1}. This level of
5281 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5282 are not, and must be explicitly requested.
5284 @item -Wstrict-overflow=2
5285 Also warn about other cases where a comparison is simplified to a
5286 constant. For example: @code{abs (x) >= 0}. This can only be
5287 simplified when signed integer overflow is undefined, because
5288 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5289 zero. @option{-Wstrict-overflow} (with no level) is the same as
5290 @option{-Wstrict-overflow=2}.
5292 @item -Wstrict-overflow=3
5293 Also warn about other cases where a comparison is simplified. For
5294 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5296 @item -Wstrict-overflow=4
5297 Also warn about other simplifications not covered by the above cases.
5298 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5300 @item -Wstrict-overflow=5
5301 Also warn about cases where the compiler reduces the magnitude of a
5302 constant involved in a comparison. For example: @code{x + 2 > y} is
5303 simplified to @code{x + 1 >= y}. This is reported only at the
5304 highest warning level because this simplification applies to many
5305 comparisons, so this warning level gives a very large number of
5309 @item -Wstringop-overflow
5310 @itemx -Wstringop-overflow=@var{type}
5311 @opindex Wstringop-overflow
5312 @opindex Wno-stringop-overflow
5313 Warn for calls to string manipulation functions such as @code{memcpy} and
5314 @code{strcpy} that are determined to overflow the destination buffer. The
5315 optional argument is one greater than the type of Object Size Checking to
5316 perform to determine the size of the destination. @xref{Object Size Checking}.
5317 The argument is meaningful only for functions that operate on character arrays
5318 but not for raw memory functions like @code{memcpy} which always make use
5319 of Object Size type-0. The option also warns for calls that specify a size
5320 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5321 The option produces the best results with optimization enabled but can detect
5322 a small subset of simple buffer overflows even without optimization in
5323 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5324 correspond to the standard functions. In any case, the option warns about
5325 just a subset of buffer overflows detected by the corresponding overflow
5326 checking built-ins. For example, the option will issue a warning for
5327 the @code{strcpy} call below because it copies at least 5 characters
5328 (the string @code{"blue"} including the terminating NUL) into the buffer
5332 enum Color @{ blue, purple, yellow @};
5333 const char* f (enum Color clr)
5335 static char buf [4];
5339 case blue: str = "blue"; break;
5340 case purple: str = "purple"; break;
5341 case yellow: str = "yellow"; break;
5344 return strcpy (buf, str); // warning here
5348 Option @option{-Wstringop-overflow=2} is enabled by default.
5351 @item -Wstringop-overflow
5352 @itemx -Wstringop-overflow=1
5353 @opindex Wstringop-overflow
5354 @opindex Wno-stringop-overflow
5355 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5356 to determine the sizes of destination objects. This is the default setting
5357 of the option. At this setting the option will not warn for writes past
5358 the end of subobjects of larger objects accessed by pointers unless the
5359 size of the largest surrounding object is known. When the destination may
5360 be one of several objects it is assumed to be the largest one of them. On
5361 Linux systems, when optimization is enabled at this setting the option warns
5362 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5365 @item -Wstringop-overflow=2
5366 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5367 to determine the sizes of destination objects. At this setting the option
5368 will warn about overflows when writing to members of the largest complete
5369 objects whose exact size is known. It will, however, not warn for excessive
5370 writes to the same members of unknown objects referenced by pointers since
5371 they may point to arrays containing unknown numbers of elements.
5373 @item -Wstringop-overflow=3
5374 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5375 to determine the sizes of destination objects. At this setting the option
5376 warns about overflowing the smallest object or data member. This is the
5377 most restrictive setting of the option that may result in warnings for safe
5380 @item -Wstringop-overflow=4
5381 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5382 to determine the sizes of destination objects. At this setting the option
5383 will warn about overflowing any data members, and when the destination is
5384 one of several objects it uses the size of the largest of them to decide
5385 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5386 setting of the option may result in warnings for benign code.
5389 @item -Wstringop-truncation
5390 @opindex Wstringop-truncation
5391 @opindex Wno-stringop-truncation
5392 Warn for calls to bounded string manipulation functions such as @code{strncat},
5393 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5394 or leave the destination unchanged.
5396 In the following example, the call to @code{strncat} specifies a bound that
5397 is less than the length of the source string. As a result, the copy of
5398 the source will be truncated and so the call is diagnosed. To avoid the
5399 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5402 void append (char *buf, size_t bufsize)
5404 strncat (buf, ".txt", 3);
5408 As another example, the following call to @code{strncpy} results in copying
5409 to @code{d} just the characters preceding the terminating NUL, without
5410 appending the NUL to the end. Assuming the result of @code{strncpy} is
5411 necessarily a NUL-terminated string is a common mistake, and so the call
5412 is diagnosed. To avoid the warning when the result is not expected to be
5413 NUL-terminated, call @code{memcpy} instead.
5416 void copy (char *d, const char *s)
5418 strncpy (d, s, strlen (s));
5422 In the following example, the call to @code{strncpy} specifies the size
5423 of the destination buffer as the bound. If the length of the source
5424 string is equal to or greater than this size the result of the copy will
5425 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5426 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5427 element of the buffer to @code{NUL}.
5430 void copy (const char *s)
5433 strncpy (buf, s, sizeof buf);
5438 In situations where a character array is intended to store a sequence
5439 of bytes with no terminating @code{NUL} such an array may be annotated
5440 with attribute @code{nonstring} to avoid this warning. Such arrays,
5441 however, are not suitable arguments to functions that expect
5442 @code{NUL}-terminated strings. To help detect accidental misuses of
5443 such arrays GCC issues warnings unless it can prove that the use is
5444 safe. @xref{Common Variable Attributes}.
5446 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5447 @opindex Wsuggest-attribute=
5448 @opindex Wno-suggest-attribute=
5449 Warn for cases where adding an attribute may be beneficial. The
5450 attributes currently supported are listed below.
5453 @item -Wsuggest-attribute=pure
5454 @itemx -Wsuggest-attribute=const
5455 @itemx -Wsuggest-attribute=noreturn
5456 @itemx -Wsuggest-attribute=malloc
5457 @opindex Wsuggest-attribute=pure
5458 @opindex Wno-suggest-attribute=pure
5459 @opindex Wsuggest-attribute=const
5460 @opindex Wno-suggest-attribute=const
5461 @opindex Wsuggest-attribute=noreturn
5462 @opindex Wno-suggest-attribute=noreturn
5463 @opindex Wsuggest-attribute=malloc
5464 @opindex Wno-suggest-attribute=malloc
5466 Warn about functions that might be candidates for attributes
5467 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5468 only warns for functions visible in other compilation units or (in the case of
5469 @code{pure} and @code{const}) if it cannot prove that the function returns
5470 normally. A function returns normally if it doesn't contain an infinite loop or
5471 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5472 requires option @option{-fipa-pure-const}, which is enabled by default at
5473 @option{-O} and higher. Higher optimization levels improve the accuracy
5476 @item -Wsuggest-attribute=format
5477 @itemx -Wmissing-format-attribute
5478 @opindex Wsuggest-attribute=format
5479 @opindex Wmissing-format-attribute
5480 @opindex Wno-suggest-attribute=format
5481 @opindex Wno-missing-format-attribute
5485 Warn about function pointers that might be candidates for @code{format}
5486 attributes. Note these are only possible candidates, not absolute ones.
5487 GCC guesses that function pointers with @code{format} attributes that
5488 are used in assignment, initialization, parameter passing or return
5489 statements should have a corresponding @code{format} attribute in the
5490 resulting type. I.e.@: the left-hand side of the assignment or
5491 initialization, the type of the parameter variable, or the return type
5492 of the containing function respectively should also have a @code{format}
5493 attribute to avoid the warning.
5495 GCC also warns about function definitions that might be
5496 candidates for @code{format} attributes. Again, these are only
5497 possible candidates. GCC guesses that @code{format} attributes
5498 might be appropriate for any function that calls a function like
5499 @code{vprintf} or @code{vscanf}, but this might not always be the
5500 case, and some functions for which @code{format} attributes are
5501 appropriate may not be detected.
5503 @item -Wsuggest-attribute=cold
5504 @opindex Wsuggest-attribute=cold
5505 @opindex Wno-suggest-attribute=cold
5507 Warn about functions that might be candidates for @code{cold} attribute. This
5508 is based on static detection and generally will only warn about functions which
5509 always leads to a call to another @code{cold} function such as wrappers of
5510 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
5513 @item -Wsuggest-final-types
5514 @opindex Wno-suggest-final-types
5515 @opindex Wsuggest-final-types
5516 Warn about types with virtual methods where code quality would be improved
5517 if the type were declared with the C++11 @code{final} specifier,
5519 declared in an anonymous namespace. This allows GCC to more aggressively
5520 devirtualize the polymorphic calls. This warning is more effective with link
5521 time optimization, where the information about the class hierarchy graph is
5524 @item -Wsuggest-final-methods
5525 @opindex Wno-suggest-final-methods
5526 @opindex Wsuggest-final-methods
5527 Warn about virtual methods where code quality would be improved if the method
5528 were declared with the C++11 @code{final} specifier,
5529 or, if possible, its type were
5530 declared in an anonymous namespace or with the @code{final} specifier.
5532 more effective with link-time optimization, where the information about the
5533 class hierarchy graph is more complete. It is recommended to first consider
5534 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
5537 @item -Wsuggest-override
5538 Warn about overriding virtual functions that are not marked with the override
5542 @opindex Wno-alloc-zero
5543 @opindex Walloc-zero
5544 Warn about calls to allocation functions decorated with attribute
5545 @code{alloc_size} that specify zero bytes, including those to the built-in
5546 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
5547 @code{malloc}, and @code{realloc}. Because the behavior of these functions
5548 when called with a zero size differs among implementations (and in the case
5549 of @code{realloc} has been deprecated) relying on it may result in subtle
5550 portability bugs and should be avoided.
5552 @item -Walloc-size-larger-than=@var{byte-size}
5553 @opindex Walloc-size-larger-than=
5554 @opindex Wno-alloc-size-larger-than
5555 Warn about calls to functions decorated with attribute @code{alloc_size}
5556 that attempt to allocate objects larger than the specified number of bytes,
5557 or where the result of the size computation in an integer type with infinite
5558 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
5559 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
5560 Warnings controlled by the option can be disabled either by specifying
5561 @var{byte-size} of @samp{SIZE_MAX} or more or by
5562 @option{-Wno-alloc-size-larger-than}.
5563 @xref{Function Attributes}.
5565 @item -Wno-alloc-size-larger-than
5566 @opindex Wno-alloc-size-larger-than
5567 Disable @option{-Walloc-size-larger-than=} warnings. The option is
5568 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
5574 This option warns on all uses of @code{alloca} in the source.
5576 @item -Walloca-larger-than=@var{byte-size}
5577 @opindex -Walloca-larger-than=
5578 @opindex -Wno-alloca-larger-than
5579 This option warns on calls to @code{alloca} with an integer argument whose
5580 value is either zero, or that is not bounded by a controlling predicate
5581 that limits its value to at most @var{byte-size}. It also warns for calls
5582 to @code{alloca} where the bound value is unknown. Arguments of non-integer
5583 types are considered unbounded even if they appear to be constrained to
5586 For example, a bounded case of @code{alloca} could be:
5589 void func (size_t n)
5600 In the above example, passing @code{-Walloca-larger-than=1000} would not
5601 issue a warning because the call to @code{alloca} is known to be at most
5602 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
5603 the compiler would emit a warning.
5605 Unbounded uses, on the other hand, are uses of @code{alloca} with no
5606 controlling predicate constraining its integer argument. For example:
5611 void *p = alloca (n);
5616 If @code{-Walloca-larger-than=500} were passed, the above would trigger
5617 a warning, but this time because of the lack of bounds checking.
5619 Note, that even seemingly correct code involving signed integers could
5623 void func (signed int n)
5633 In the above example, @var{n} could be negative, causing a larger than
5634 expected argument to be implicitly cast into the @code{alloca} call.
5636 This option also warns when @code{alloca} is used in a loop.
5638 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
5639 but is usually only effective when @option{-ftree-vrp} is active (default
5640 for @option{-O2} and above).
5642 See also @option{-Wvla-larger-than=}@samp{byte-size}.
5644 @item -Wno-alloca-larger-than
5645 @opindex Wno-alloca-larger-than
5646 Disable @option{-Walloca-larger-than=} warnings. The option is
5647 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
5649 @item -Warray-bounds
5650 @itemx -Warray-bounds=@var{n}
5651 @opindex Wno-array-bounds
5652 @opindex Warray-bounds
5653 This option is only active when @option{-ftree-vrp} is active
5654 (default for @option{-O2} and above). It warns about subscripts to arrays
5655 that are always out of bounds. This warning is enabled by @option{-Wall}.
5658 @item -Warray-bounds=1
5659 This is the warning level of @option{-Warray-bounds} and is enabled
5660 by @option{-Wall}; higher levels are not, and must be explicitly requested.
5662 @item -Warray-bounds=2
5663 This warning level also warns about out of bounds access for
5664 arrays at the end of a struct and for arrays accessed through
5665 pointers. This warning level may give a larger number of
5666 false positives and is deactivated by default.
5669 @item -Wattribute-alias
5670 Warn about declarations using the @code{alias} and similar attributes whose
5671 target is incompatible with the type of the alias. @xref{Function Attributes,
5672 ,Declaring Attributes of Functions}.
5674 @item -Wbool-compare
5675 @opindex Wno-bool-compare
5676 @opindex Wbool-compare
5677 Warn about boolean expression compared with an integer value different from
5678 @code{true}/@code{false}. For instance, the following comparison is
5683 if ((n > 1) == 2) @{ @dots{} @}
5685 This warning is enabled by @option{-Wall}.
5687 @item -Wbool-operation
5688 @opindex Wno-bool-operation
5689 @opindex Wbool-operation
5690 Warn about suspicious operations on expressions of a boolean type. For
5691 instance, bitwise negation of a boolean is very likely a bug in the program.
5692 For C, this warning also warns about incrementing or decrementing a boolean,
5693 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
5694 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
5696 This warning is enabled by @option{-Wall}.
5698 @item -Wduplicated-branches
5699 @opindex Wno-duplicated-branches
5700 @opindex Wduplicated-branches
5701 Warn when an if-else has identical branches. This warning detects cases like
5708 It doesn't warn when both branches contain just a null statement. This warning
5709 also warn for conditional operators:
5711 int i = x ? *p : *p;
5714 @item -Wduplicated-cond
5715 @opindex Wno-duplicated-cond
5716 @opindex Wduplicated-cond
5717 Warn about duplicated conditions in an if-else-if chain. For instance,
5718 warn for the following code:
5720 if (p->q != NULL) @{ @dots{} @}
5721 else if (p->q != NULL) @{ @dots{} @}
5724 @item -Wframe-address
5725 @opindex Wno-frame-address
5726 @opindex Wframe-address
5727 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
5728 is called with an argument greater than 0. Such calls may return indeterminate
5729 values or crash the program. The warning is included in @option{-Wall}.
5731 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
5732 @opindex Wno-discarded-qualifiers
5733 @opindex Wdiscarded-qualifiers
5734 Do not warn if type qualifiers on pointers are being discarded.
5735 Typically, the compiler warns if a @code{const char *} variable is
5736 passed to a function that takes a @code{char *} parameter. This option
5737 can be used to suppress such a warning.
5739 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
5740 @opindex Wno-discarded-array-qualifiers
5741 @opindex Wdiscarded-array-qualifiers
5742 Do not warn if type qualifiers on arrays which are pointer targets
5743 are being discarded. Typically, the compiler warns if a
5744 @code{const int (*)[]} variable is passed to a function that
5745 takes a @code{int (*)[]} parameter. This option can be used to
5746 suppress such a warning.
5748 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
5749 @opindex Wno-incompatible-pointer-types
5750 @opindex Wincompatible-pointer-types
5751 Do not warn when there is a conversion between pointers that have incompatible
5752 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
5753 which warns for pointer argument passing or assignment with different
5756 @item -Wno-int-conversion @r{(C and Objective-C only)}
5757 @opindex Wno-int-conversion
5758 @opindex Wint-conversion
5759 Do not warn about incompatible integer to pointer and pointer to integer
5760 conversions. This warning is about implicit conversions; for explicit
5761 conversions the warnings @option{-Wno-int-to-pointer-cast} and
5762 @option{-Wno-pointer-to-int-cast} may be used.
5764 @item -Wno-div-by-zero
5765 @opindex Wno-div-by-zero
5766 @opindex Wdiv-by-zero
5767 Do not warn about compile-time integer division by zero. Floating-point
5768 division by zero is not warned about, as it can be a legitimate way of
5769 obtaining infinities and NaNs.
5771 @item -Wsystem-headers
5772 @opindex Wsystem-headers
5773 @opindex Wno-system-headers
5774 @cindex warnings from system headers
5775 @cindex system headers, warnings from
5776 Print warning messages for constructs found in system header files.
5777 Warnings from system headers are normally suppressed, on the assumption
5778 that they usually do not indicate real problems and would only make the
5779 compiler output harder to read. Using this command-line option tells
5780 GCC to emit warnings from system headers as if they occurred in user
5781 code. However, note that using @option{-Wall} in conjunction with this
5782 option does @emph{not} warn about unknown pragmas in system
5783 headers---for that, @option{-Wunknown-pragmas} must also be used.
5785 @item -Wtautological-compare
5786 @opindex Wtautological-compare
5787 @opindex Wno-tautological-compare
5788 Warn if a self-comparison always evaluates to true or false. This
5789 warning detects various mistakes such as:
5793 if (i > i) @{ @dots{} @}
5796 This warning also warns about bitwise comparisons that always evaluate
5797 to true or false, for instance:
5799 if ((a & 16) == 10) @{ @dots{} @}
5801 will always be false.
5803 This warning is enabled by @option{-Wall}.
5806 @opindex Wtrampolines
5807 @opindex Wno-trampolines
5808 Warn about trampolines generated for pointers to nested functions.
5809 A trampoline is a small piece of data or code that is created at run
5810 time on the stack when the address of a nested function is taken, and is
5811 used to call the nested function indirectly. For some targets, it is
5812 made up of data only and thus requires no special treatment. But, for
5813 most targets, it is made up of code and thus requires the stack to be
5814 made executable in order for the program to work properly.
5817 @opindex Wfloat-equal
5818 @opindex Wno-float-equal
5819 Warn if floating-point values are used in equality comparisons.
5821 The idea behind this is that sometimes it is convenient (for the
5822 programmer) to consider floating-point values as approximations to
5823 infinitely precise real numbers. If you are doing this, then you need
5824 to compute (by analyzing the code, or in some other way) the maximum or
5825 likely maximum error that the computation introduces, and allow for it
5826 when performing comparisons (and when producing output, but that's a
5827 different problem). In particular, instead of testing for equality, you
5828 should check to see whether the two values have ranges that overlap; and
5829 this is done with the relational operators, so equality comparisons are
5832 @item -Wtraditional @r{(C and Objective-C only)}
5833 @opindex Wtraditional
5834 @opindex Wno-traditional
5835 Warn about certain constructs that behave differently in traditional and
5836 ISO C@. Also warn about ISO C constructs that have no traditional C
5837 equivalent, and/or problematic constructs that should be avoided.
5841 Macro parameters that appear within string literals in the macro body.
5842 In traditional C macro replacement takes place within string literals,
5843 but in ISO C it does not.
5846 In traditional C, some preprocessor directives did not exist.
5847 Traditional preprocessors only considered a line to be a directive
5848 if the @samp{#} appeared in column 1 on the line. Therefore
5849 @option{-Wtraditional} warns about directives that traditional C
5850 understands but ignores because the @samp{#} does not appear as the
5851 first character on the line. It also suggests you hide directives like
5852 @code{#pragma} not understood by traditional C by indenting them. Some
5853 traditional implementations do not recognize @code{#elif}, so this option
5854 suggests avoiding it altogether.
5857 A function-like macro that appears without arguments.
5860 The unary plus operator.
5863 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
5864 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
5865 constants.) Note, these suffixes appear in macros defined in the system
5866 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
5867 Use of these macros in user code might normally lead to spurious
5868 warnings, however GCC's integrated preprocessor has enough context to
5869 avoid warning in these cases.
5872 A function declared external in one block and then used after the end of
5876 A @code{switch} statement has an operand of type @code{long}.
5879 A non-@code{static} function declaration follows a @code{static} one.
5880 This construct is not accepted by some traditional C compilers.
5883 The ISO type of an integer constant has a different width or
5884 signedness from its traditional type. This warning is only issued if
5885 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
5886 typically represent bit patterns, are not warned about.
5889 Usage of ISO string concatenation is detected.
5892 Initialization of automatic aggregates.
5895 Identifier conflicts with labels. Traditional C lacks a separate
5896 namespace for labels.
5899 Initialization of unions. If the initializer is zero, the warning is
5900 omitted. This is done under the assumption that the zero initializer in
5901 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
5902 initializer warnings and relies on default initialization to zero in the
5906 Conversions by prototypes between fixed/floating-point values and vice
5907 versa. The absence of these prototypes when compiling with traditional
5908 C causes serious problems. This is a subset of the possible
5909 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
5912 Use of ISO C style function definitions. This warning intentionally is
5913 @emph{not} issued for prototype declarations or variadic functions
5914 because these ISO C features appear in your code when using
5915 libiberty's traditional C compatibility macros, @code{PARAMS} and
5916 @code{VPARAMS}. This warning is also bypassed for nested functions
5917 because that feature is already a GCC extension and thus not relevant to
5918 traditional C compatibility.
5921 @item -Wtraditional-conversion @r{(C and Objective-C only)}
5922 @opindex Wtraditional-conversion
5923 @opindex Wno-traditional-conversion
5924 Warn if a prototype causes a type conversion that is different from what
5925 would happen to the same argument in the absence of a prototype. This
5926 includes conversions of fixed point to floating and vice versa, and
5927 conversions changing the width or signedness of a fixed-point argument
5928 except when the same as the default promotion.
5930 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
5931 @opindex Wdeclaration-after-statement
5932 @opindex Wno-declaration-after-statement
5933 Warn when a declaration is found after a statement in a block. This
5934 construct, known from C++, was introduced with ISO C99 and is by default
5935 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
5940 Warn whenever a local variable or type declaration shadows another
5941 variable, parameter, type, class member (in C++), or instance variable
5942 (in Objective-C) or whenever a built-in function is shadowed. Note
5943 that in C++, the compiler warns if a local variable shadows an
5944 explicit typedef, but not if it shadows a struct/class/enum.
5945 Same as @option{-Wshadow=global}.
5947 @item -Wno-shadow-ivar @r{(Objective-C only)}
5948 @opindex Wno-shadow-ivar
5949 @opindex Wshadow-ivar
5950 Do not warn whenever a local variable shadows an instance variable in an
5953 @item -Wshadow=global
5954 @opindex Wshadow=local
5955 The default for @option{-Wshadow}. Warns for any (global) shadowing.
5957 @item -Wshadow=local
5958 @opindex Wshadow=local
5959 Warn when a local variable shadows another local variable or parameter.
5960 This warning is enabled by @option{-Wshadow=global}.
5962 @item -Wshadow=compatible-local
5963 @opindex Wshadow=compatible-local
5964 Warn when a local variable shadows another local variable or parameter
5965 whose type is compatible with that of the shadowing variable. In C++,
5966 type compatibility here means the type of the shadowing variable can be
5967 converted to that of the shadowed variable. The creation of this flag
5968 (in addition to @option{-Wshadow=local}) is based on the idea that when
5969 a local variable shadows another one of incompatible type, it is most
5970 likely intentional, not a bug or typo, as shown in the following example:
5974 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
5976 for (int i = 0; i < N; ++i)
5985 Since the two variable @code{i} in the example above have incompatible types,
5986 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
5987 Because their types are incompatible, if a programmer accidentally uses one
5988 in place of the other, type checking will catch that and emit an error or
5989 warning. So not warning (about shadowing) in this case will not lead to
5990 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
5991 possibly reduce the number of warnings triggered by intentional shadowing.
5993 This warning is enabled by @option{-Wshadow=local}.
5995 @item -Wlarger-than=@var{byte-size}
5996 @opindex Wlarger-than=
5997 @opindex Wlarger-than-@var{byte-size}
5998 Warn whenever an object is defined whose size exceeds @var{byte-size}.
5999 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6000 Warnings controlled by the option can be disabled either by specifying
6001 @var{byte-size} of @samp{SIZE_MAX} or more or by
6002 @option{-Wno-larger-than}.
6004 @item -Wno-larger-than
6005 @opindex Wno-larger-than
6006 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6007 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6009 @item -Wframe-larger-than=@var{byte-size}
6010 @opindex Wframe-larger-than=
6011 @opindex Wno-frame-larger-than
6012 Warn if the size of a function frame exceeds @var{byte-size}.
6013 The computation done to determine the stack frame size is approximate
6014 and not conservative.
6015 The actual requirements may be somewhat greater than @var{byte-size}
6016 even if you do not get a warning. In addition, any space allocated
6017 via @code{alloca}, variable-length arrays, or related constructs
6018 is not included by the compiler when determining
6019 whether or not to issue a warning.
6020 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6021 Warnings controlled by the option can be disabled either by specifying
6022 @var{byte-size} of @samp{SIZE_MAX} or more or by
6023 @option{-Wno-frame-larger-than}.
6025 @item -Wno-frame-larger-than
6026 @opindex Wno-frame-larger-than
6027 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6028 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6030 @item -Wno-free-nonheap-object
6031 @opindex Wno-free-nonheap-object
6032 @opindex Wfree-nonheap-object
6033 Do not warn when attempting to free an object that was not allocated
6036 @item -Wstack-usage=@var{byte-size}
6037 @opindex Wstack-usage
6038 @opindex Wno-stack-usage
6039 Warn if the stack usage of a function might exceed @var{byte-size}.
6040 The computation done to determine the stack usage is conservative.
6041 Any space allocated via @code{alloca}, variable-length arrays, or related
6042 constructs is included by the compiler when determining whether or not to
6045 The message is in keeping with the output of @option{-fstack-usage}.
6049 If the stack usage is fully static but exceeds the specified amount, it's:
6052 warning: stack usage is 1120 bytes
6055 If the stack usage is (partly) dynamic but bounded, it's:
6058 warning: stack usage might be 1648 bytes
6061 If the stack usage is (partly) dynamic and not bounded, it's:
6064 warning: stack usage might be unbounded
6068 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6069 Warnings controlled by the option can be disabled either by specifying
6070 @var{byte-size} of @samp{SIZE_MAX} or more or by
6071 @option{-Wno-stack-usage}.
6073 @item -Wno-stack-usage
6074 @opindex Wno-stack-usage
6075 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6076 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6078 @item -Wunsafe-loop-optimizations
6079 @opindex Wunsafe-loop-optimizations
6080 @opindex Wno-unsafe-loop-optimizations
6081 Warn if the loop cannot be optimized because the compiler cannot
6082 assume anything on the bounds of the loop indices. With
6083 @option{-funsafe-loop-optimizations} warn if the compiler makes
6086 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6087 @opindex Wno-pedantic-ms-format
6088 @opindex Wpedantic-ms-format
6089 When used in combination with @option{-Wformat}
6090 and @option{-pedantic} without GNU extensions, this option
6091 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6092 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6093 which depend on the MS runtime.
6096 @opindex Waligned-new
6097 @opindex Wno-aligned-new
6098 Warn about a new-expression of a type that requires greater alignment
6099 than the @code{alignof(std::max_align_t)} but uses an allocation
6100 function without an explicit alignment parameter. This option is
6101 enabled by @option{-Wall}.
6103 Normally this only warns about global allocation functions, but
6104 @option{-Waligned-new=all} also warns about class member allocation
6107 @item -Wplacement-new
6108 @itemx -Wplacement-new=@var{n}
6109 @opindex Wplacement-new
6110 @opindex Wno-placement-new
6111 Warn about placement new expressions with undefined behavior, such as
6112 constructing an object in a buffer that is smaller than the type of
6113 the object. For example, the placement new expression below is diagnosed
6114 because it attempts to construct an array of 64 integers in a buffer only
6120 This warning is enabled by default.
6123 @item -Wplacement-new=1
6124 This is the default warning level of @option{-Wplacement-new}. At this
6125 level the warning is not issued for some strictly undefined constructs that
6126 GCC allows as extensions for compatibility with legacy code. For example,
6127 the following @code{new} expression is not diagnosed at this level even
6128 though it has undefined behavior according to the C++ standard because
6129 it writes past the end of the one-element array.
6131 struct S @{ int n, a[1]; @};
6132 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6133 new (s->a)int [32]();
6136 @item -Wplacement-new=2
6137 At this level, in addition to diagnosing all the same constructs as at level
6138 1, a diagnostic is also issued for placement new expressions that construct
6139 an object in the last member of structure whose type is an array of a single
6140 element and whose size is less than the size of the object being constructed.
6141 While the previous example would be diagnosed, the following construct makes
6142 use of the flexible member array extension to avoid the warning at level 2.
6144 struct S @{ int n, a[]; @};
6145 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6146 new (s->a)int [32]();
6151 @item -Wpointer-arith
6152 @opindex Wpointer-arith
6153 @opindex Wno-pointer-arith
6154 Warn about anything that depends on the ``size of'' a function type or
6155 of @code{void}. GNU C assigns these types a size of 1, for
6156 convenience in calculations with @code{void *} pointers and pointers
6157 to functions. In C++, warn also when an arithmetic operation involves
6158 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6160 @item -Wpointer-compare
6161 @opindex Wpointer-compare
6162 @opindex Wno-pointer-compare
6163 Warn if a pointer is compared with a zero character constant. This usually
6164 means that the pointer was meant to be dereferenced. For example:
6167 const char *p = foo ();
6172 Note that the code above is invalid in C++11.
6174 This warning is enabled by default.
6177 @opindex Wtype-limits
6178 @opindex Wno-type-limits
6179 Warn if a comparison is always true or always false due to the limited
6180 range of the data type, but do not warn for constant expressions. For
6181 example, warn if an unsigned variable is compared against zero with
6182 @code{<} or @code{>=}. This warning is also enabled by
6185 @include cppwarnopts.texi
6187 @item -Wbad-function-cast @r{(C and Objective-C only)}
6188 @opindex Wbad-function-cast
6189 @opindex Wno-bad-function-cast
6190 Warn when a function call is cast to a non-matching type.
6191 For example, warn if a call to a function returning an integer type
6192 is cast to a pointer type.
6194 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6195 @opindex Wc90-c99-compat
6196 @opindex Wno-c90-c99-compat
6197 Warn about features not present in ISO C90, but present in ISO C99.
6198 For instance, warn about use of variable length arrays, @code{long long}
6199 type, @code{bool} type, compound literals, designated initializers, and so
6200 on. This option is independent of the standards mode. Warnings are disabled
6201 in the expression that follows @code{__extension__}.
6203 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6204 @opindex Wc99-c11-compat
6205 @opindex Wno-c99-c11-compat
6206 Warn about features not present in ISO C99, but present in ISO C11.
6207 For instance, warn about use of anonymous structures and unions,
6208 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6209 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6210 and so on. This option is independent of the standards mode. Warnings are
6211 disabled in the expression that follows @code{__extension__}.
6213 @item -Wc++-compat @r{(C and Objective-C only)}
6214 @opindex Wc++-compat
6215 @opindex Wno-c++-compat
6216 Warn about ISO C constructs that are outside of the common subset of
6217 ISO C and ISO C++, e.g.@: request for implicit conversion from
6218 @code{void *} to a pointer to non-@code{void} type.
6220 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6221 @opindex Wc++11-compat
6222 @opindex Wno-c++11-compat
6223 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6224 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6225 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6226 enabled by @option{-Wall}.
6228 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6229 @opindex Wc++14-compat
6230 @opindex Wno-c++14-compat
6231 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6232 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6234 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6235 @opindex Wc++17-compat
6236 @opindex Wno-c++17-compat
6237 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6238 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6242 @opindex Wno-cast-qual
6243 Warn whenever a pointer is cast so as to remove a type qualifier from
6244 the target type. For example, warn if a @code{const char *} is cast
6245 to an ordinary @code{char *}.
6247 Also warn when making a cast that introduces a type qualifier in an
6248 unsafe way. For example, casting @code{char **} to @code{const char **}
6249 is unsafe, as in this example:
6252 /* p is char ** value. */
6253 const char **q = (const char **) p;
6254 /* Assignment of readonly string to const char * is OK. */
6256 /* Now char** pointer points to read-only memory. */
6261 @opindex Wcast-align
6262 @opindex Wno-cast-align
6263 Warn whenever a pointer is cast such that the required alignment of the
6264 target is increased. For example, warn if a @code{char *} is cast to
6265 an @code{int *} on machines where integers can only be accessed at
6266 two- or four-byte boundaries.
6268 @item -Wcast-align=strict
6269 @opindex Wcast-align=strict
6270 Warn whenever a pointer is cast such that the required alignment of the
6271 target is increased. For example, warn if a @code{char *} is cast to
6272 an @code{int *} regardless of the target machine.
6274 @item -Wcast-function-type
6275 @opindex Wcast-function-type
6276 @opindex Wno-cast-function-type
6277 Warn when a function pointer is cast to an incompatible function pointer.
6278 In a cast involving function types with a variable argument list only
6279 the types of initial arguments that are provided are considered.
6280 Any parameter of pointer-type matches any other pointer-type. Any benign
6281 differences in integral types are ignored, like @code{int} vs. @code{long}
6282 on ILP32 targets. Likewise type qualifiers are ignored. The function
6283 type @code{void (*) (void)} is special and matches everything, which can
6284 be used to suppress this warning.
6285 In a cast involving pointer to member types this warning warns whenever
6286 the type cast is changing the pointer to member type.
6287 This warning is enabled by @option{-Wextra}.
6289 @item -Wwrite-strings
6290 @opindex Wwrite-strings
6291 @opindex Wno-write-strings
6292 When compiling C, give string constants the type @code{const
6293 char[@var{length}]} so that copying the address of one into a
6294 non-@code{const} @code{char *} pointer produces a warning. These
6295 warnings help you find at compile time code that can try to write
6296 into a string constant, but only if you have been very careful about
6297 using @code{const} in declarations and prototypes. Otherwise, it is
6298 just a nuisance. This is why we did not make @option{-Wall} request
6301 When compiling C++, warn about the deprecated conversion from string
6302 literals to @code{char *}. This warning is enabled by default for C++
6306 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6307 @opindex Wcatch-value
6308 @opindex Wno-catch-value
6309 Warn about catch handlers that do not catch via reference.
6310 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6311 warn about polymorphic class types that are caught by value.
6312 With @option{-Wcatch-value=2} warn about all class types that are caught
6313 by value. With @option{-Wcatch-value=3} warn about all types that are
6314 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6318 @opindex Wno-clobbered
6319 Warn for variables that might be changed by @code{longjmp} or
6320 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6322 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6323 @opindex Wconditionally-supported
6324 @opindex Wno-conditionally-supported
6325 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6328 @opindex Wconversion
6329 @opindex Wno-conversion
6330 Warn for implicit conversions that may alter a value. This includes
6331 conversions between real and integer, like @code{abs (x)} when
6332 @code{x} is @code{double}; conversions between signed and unsigned,
6333 like @code{unsigned ui = -1}; and conversions to smaller types, like
6334 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6335 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6336 changed by the conversion like in @code{abs (2.0)}. Warnings about
6337 conversions between signed and unsigned integers can be disabled by
6338 using @option{-Wno-sign-conversion}.
6340 For C++, also warn for confusing overload resolution for user-defined
6341 conversions; and conversions that never use a type conversion
6342 operator: conversions to @code{void}, the same type, a base class or a
6343 reference to them. Warnings about conversions between signed and
6344 unsigned integers are disabled by default in C++ unless
6345 @option{-Wsign-conversion} is explicitly enabled.
6347 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6348 @opindex Wconversion-null
6349 @opindex Wno-conversion-null
6350 Do not warn for conversions between @code{NULL} and non-pointer
6351 types. @option{-Wconversion-null} is enabled by default.
6353 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6354 @opindex Wzero-as-null-pointer-constant
6355 @opindex Wno-zero-as-null-pointer-constant
6356 Warn when a literal @samp{0} is used as null pointer constant. This can
6357 be useful to facilitate the conversion to @code{nullptr} in C++11.
6359 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6360 @opindex Wsubobject-linkage
6361 @opindex Wno-subobject-linkage
6362 Warn if a class type has a base or a field whose type uses the anonymous
6363 namespace or depends on a type with no linkage. If a type A depends on
6364 a type B with no or internal linkage, defining it in multiple
6365 translation units would be an ODR violation because the meaning of B
6366 is different in each translation unit. If A only appears in a single
6367 translation unit, the best way to silence the warning is to give it
6368 internal linkage by putting it in an anonymous namespace as well. The
6369 compiler doesn't give this warning for types defined in the main .C
6370 file, as those are unlikely to have multiple definitions.
6371 @option{-Wsubobject-linkage} is enabled by default.
6373 @item -Wdangling-else
6374 @opindex Wdangling-else
6375 @opindex Wno-dangling-else
6376 Warn about constructions where there may be confusion to which
6377 @code{if} statement an @code{else} branch belongs. Here is an example of
6392 In C/C++, every @code{else} branch belongs to the innermost possible
6393 @code{if} statement, which in this example is @code{if (b)}. This is
6394 often not what the programmer expected, as illustrated in the above
6395 example by indentation the programmer chose. When there is the
6396 potential for this confusion, GCC issues a warning when this flag
6397 is specified. To eliminate the warning, add explicit braces around
6398 the innermost @code{if} statement so there is no way the @code{else}
6399 can belong to the enclosing @code{if}. The resulting code
6416 This warning is enabled by @option{-Wparentheses}.
6420 @opindex Wno-date-time
6421 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6422 are encountered as they might prevent bit-wise-identical reproducible
6425 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6426 @opindex Wdelete-incomplete
6427 @opindex Wno-delete-incomplete
6428 Warn when deleting a pointer to incomplete type, which may cause
6429 undefined behavior at runtime. This warning is enabled by default.
6431 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6432 @opindex Wuseless-cast
6433 @opindex Wno-useless-cast
6434 Warn when an expression is casted to its own type.
6437 @opindex Wempty-body
6438 @opindex Wno-empty-body
6439 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6440 while} statement. This warning is also enabled by @option{-Wextra}.
6442 @item -Wenum-compare
6443 @opindex Wenum-compare
6444 @opindex Wno-enum-compare
6445 Warn about a comparison between values of different enumerated types.
6446 In C++ enumerated type mismatches in conditional expressions are also
6447 diagnosed and the warning is enabled by default. In C this warning is
6448 enabled by @option{-Wall}.
6450 @item -Wextra-semi @r{(C++, Objective-C++ only)}
6451 @opindex Wextra-semi
6452 @opindex Wno-extra-semi
6453 Warn about redundant semicolon after in-class function definition.
6455 @item -Wjump-misses-init @r{(C, Objective-C only)}
6456 @opindex Wjump-misses-init
6457 @opindex Wno-jump-misses-init
6458 Warn if a @code{goto} statement or a @code{switch} statement jumps
6459 forward across the initialization of a variable, or jumps backward to a
6460 label after the variable has been initialized. This only warns about
6461 variables that are initialized when they are declared. This warning is
6462 only supported for C and Objective-C; in C++ this sort of branch is an
6465 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
6466 can be disabled with the @option{-Wno-jump-misses-init} option.
6468 @item -Wsign-compare
6469 @opindex Wsign-compare
6470 @opindex Wno-sign-compare
6471 @cindex warning for comparison of signed and unsigned values
6472 @cindex comparison of signed and unsigned values, warning
6473 @cindex signed and unsigned values, comparison warning
6474 Warn when a comparison between signed and unsigned values could produce
6475 an incorrect result when the signed value is converted to unsigned.
6476 In C++, this warning is also enabled by @option{-Wall}. In C, it is
6477 also enabled by @option{-Wextra}.
6479 @item -Wsign-conversion
6480 @opindex Wsign-conversion
6481 @opindex Wno-sign-conversion
6482 Warn for implicit conversions that may change the sign of an integer
6483 value, like assigning a signed integer expression to an unsigned
6484 integer variable. An explicit cast silences the warning. In C, this
6485 option is enabled also by @option{-Wconversion}.
6487 @item -Wfloat-conversion
6488 @opindex Wfloat-conversion
6489 @opindex Wno-float-conversion
6490 Warn for implicit conversions that reduce the precision of a real value.
6491 This includes conversions from real to integer, and from higher precision
6492 real to lower precision real values. This option is also enabled by
6493 @option{-Wconversion}.
6495 @item -Wno-scalar-storage-order
6496 @opindex -Wno-scalar-storage-order
6497 @opindex -Wscalar-storage-order
6498 Do not warn on suspicious constructs involving reverse scalar storage order.
6500 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
6501 @opindex Wsized-deallocation
6502 @opindex Wno-sized-deallocation
6503 Warn about a definition of an unsized deallocation function
6505 void operator delete (void *) noexcept;
6506 void operator delete[] (void *) noexcept;
6508 without a definition of the corresponding sized deallocation function
6510 void operator delete (void *, std::size_t) noexcept;
6511 void operator delete[] (void *, std::size_t) noexcept;
6513 or vice versa. Enabled by @option{-Wextra} along with
6514 @option{-fsized-deallocation}.
6516 @item -Wsizeof-pointer-div
6517 @opindex Wsizeof-pointer-div
6518 @opindex Wno-sizeof-pointer-div
6519 Warn for suspicious divisions of two sizeof expressions that divide
6520 the pointer size by the element size, which is the usual way to compute
6521 the array size but won't work out correctly with pointers. This warning
6522 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
6523 not an array, but a pointer. This warning is enabled by @option{-Wall}.
6525 @item -Wsizeof-pointer-memaccess
6526 @opindex Wsizeof-pointer-memaccess
6527 @opindex Wno-sizeof-pointer-memaccess
6528 Warn for suspicious length parameters to certain string and memory built-in
6529 functions if the argument uses @code{sizeof}. This warning triggers for
6530 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
6531 an array, but a pointer, and suggests a possible fix, or about
6532 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
6533 also warns about calls to bounded string copy functions like @code{strncat}
6534 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
6535 the source array. For example, in the following function the call to
6536 @code{strncat} specifies the size of the source string as the bound. That
6537 is almost certainly a mistake and so the call is diagnosed.
6539 void make_file (const char *name)
6541 char path[PATH_MAX];
6542 strncpy (path, name, sizeof path - 1);
6543 strncat (path, ".text", sizeof ".text");
6548 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
6550 @item -Wsizeof-array-argument
6551 @opindex Wsizeof-array-argument
6552 @opindex Wno-sizeof-array-argument
6553 Warn when the @code{sizeof} operator is applied to a parameter that is
6554 declared as an array in a function definition. This warning is enabled by
6555 default for C and C++ programs.
6557 @item -Wmemset-elt-size
6558 @opindex Wmemset-elt-size
6559 @opindex Wno-memset-elt-size
6560 Warn for suspicious calls to the @code{memset} built-in function, if the
6561 first argument references an array, and the third argument is a number
6562 equal to the number of elements, but not equal to the size of the array
6563 in memory. This indicates that the user has omitted a multiplication by
6564 the element size. This warning is enabled by @option{-Wall}.
6566 @item -Wmemset-transposed-args
6567 @opindex Wmemset-transposed-args
6568 @opindex Wno-memset-transposed-args
6569 Warn for suspicious calls to the @code{memset} built-in function, if the
6570 second argument is not zero and the third argument is zero. This warns e.g.@
6571 about @code{memset (buf, sizeof buf, 0)} where most probably
6572 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
6573 is only emitted if the third argument is literal zero. If it is some
6574 expression that is folded to zero, a cast of zero to some type, etc.,
6575 it is far less likely that the user has mistakenly exchanged the arguments
6576 and no warning is emitted. This warning is enabled by @option{-Wall}.
6580 @opindex Wno-address
6581 Warn about suspicious uses of memory addresses. These include using
6582 the address of a function in a conditional expression, such as
6583 @code{void func(void); if (func)}, and comparisons against the memory
6584 address of a string literal, such as @code{if (x == "abc")}. Such
6585 uses typically indicate a programmer error: the address of a function
6586 always evaluates to true, so their use in a conditional usually
6587 indicate that the programmer forgot the parentheses in a function
6588 call; and comparisons against string literals result in unspecified
6589 behavior and are not portable in C, so they usually indicate that the
6590 programmer intended to use @code{strcmp}. This warning is enabled by
6594 @opindex Wlogical-op
6595 @opindex Wno-logical-op
6596 Warn about suspicious uses of logical operators in expressions.
6597 This includes using logical operators in contexts where a
6598 bit-wise operator is likely to be expected. Also warns when
6599 the operands of a logical operator are the same:
6602 if (a < 0 && a < 0) @{ @dots{} @}
6605 @item -Wlogical-not-parentheses
6606 @opindex Wlogical-not-parentheses
6607 @opindex Wno-logical-not-parentheses
6608 Warn about logical not used on the left hand side operand of a comparison.
6609 This option does not warn if the right operand is considered to be a boolean
6610 expression. Its purpose is to detect suspicious code like the following:
6614 if (!a > 1) @{ @dots{} @}
6617 It is possible to suppress the warning by wrapping the LHS into
6620 if ((!a) > 1) @{ @dots{} @}
6623 This warning is enabled by @option{-Wall}.
6625 @item -Waggregate-return
6626 @opindex Waggregate-return
6627 @opindex Wno-aggregate-return
6628 Warn if any functions that return structures or unions are defined or
6629 called. (In languages where you can return an array, this also elicits
6632 @item -Wno-aggressive-loop-optimizations
6633 @opindex Wno-aggressive-loop-optimizations
6634 @opindex Waggressive-loop-optimizations
6635 Warn if in a loop with constant number of iterations the compiler detects
6636 undefined behavior in some statement during one or more of the iterations.
6638 @item -Wno-attributes
6639 @opindex Wno-attributes
6640 @opindex Wattributes
6641 Do not warn if an unexpected @code{__attribute__} is used, such as
6642 unrecognized attributes, function attributes applied to variables,
6643 etc. This does not stop errors for incorrect use of supported
6646 @item -Wno-builtin-declaration-mismatch
6647 @opindex Wno-builtin-declaration-mismatch
6648 @opindex Wbuiltin-declaration-mismatch
6649 Warn if a built-in function is declared with the wrong signature or
6651 This warning is enabled by default.
6653 @item -Wno-builtin-macro-redefined
6654 @opindex Wno-builtin-macro-redefined
6655 @opindex Wbuiltin-macro-redefined
6656 Do not warn if certain built-in macros are redefined. This suppresses
6657 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
6658 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
6660 @item -Wstrict-prototypes @r{(C and Objective-C only)}
6661 @opindex Wstrict-prototypes
6662 @opindex Wno-strict-prototypes
6663 Warn if a function is declared or defined without specifying the
6664 argument types. (An old-style function definition is permitted without
6665 a warning if preceded by a declaration that specifies the argument
6668 @item -Wold-style-declaration @r{(C and Objective-C only)}
6669 @opindex Wold-style-declaration
6670 @opindex Wno-old-style-declaration
6671 Warn for obsolescent usages, according to the C Standard, in a
6672 declaration. For example, warn if storage-class specifiers like
6673 @code{static} are not the first things in a declaration. This warning
6674 is also enabled by @option{-Wextra}.
6676 @item -Wold-style-definition @r{(C and Objective-C only)}
6677 @opindex Wold-style-definition
6678 @opindex Wno-old-style-definition
6679 Warn if an old-style function definition is used. A warning is given
6680 even if there is a previous prototype.
6682 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
6683 @opindex Wmissing-parameter-type
6684 @opindex Wno-missing-parameter-type
6685 A function parameter is declared without a type specifier in K&R-style
6692 This warning is also enabled by @option{-Wextra}.
6694 @item -Wmissing-prototypes @r{(C and Objective-C only)}
6695 @opindex Wmissing-prototypes
6696 @opindex Wno-missing-prototypes
6697 Warn if a global function is defined without a previous prototype
6698 declaration. This warning is issued even if the definition itself
6699 provides a prototype. Use this option to detect global functions
6700 that do not have a matching prototype declaration in a header file.
6701 This option is not valid for C++ because all function declarations
6702 provide prototypes and a non-matching declaration declares an
6703 overload rather than conflict with an earlier declaration.
6704 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
6706 @item -Wmissing-declarations
6707 @opindex Wmissing-declarations
6708 @opindex Wno-missing-declarations
6709 Warn if a global function is defined without a previous declaration.
6710 Do so even if the definition itself provides a prototype.
6711 Use this option to detect global functions that are not declared in
6712 header files. In C, no warnings are issued for functions with previous
6713 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
6714 missing prototypes. In C++, no warnings are issued for function templates,
6715 or for inline functions, or for functions in anonymous namespaces.
6717 @item -Wmissing-field-initializers
6718 @opindex Wmissing-field-initializers
6719 @opindex Wno-missing-field-initializers
6723 Warn if a structure's initializer has some fields missing. For
6724 example, the following code causes such a warning, because
6725 @code{x.h} is implicitly zero:
6728 struct s @{ int f, g, h; @};
6729 struct s x = @{ 3, 4 @};
6732 This option does not warn about designated initializers, so the following
6733 modification does not trigger a warning:
6736 struct s @{ int f, g, h; @};
6737 struct s x = @{ .f = 3, .g = 4 @};
6740 In C this option does not warn about the universal zero initializer
6744 struct s @{ int f, g, h; @};
6745 struct s x = @{ 0 @};
6748 Likewise, in C++ this option does not warn about the empty @{ @}
6749 initializer, for example:
6752 struct s @{ int f, g, h; @};
6756 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
6757 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
6759 @item -Wno-multichar
6760 @opindex Wno-multichar
6762 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
6763 Usually they indicate a typo in the user's code, as they have
6764 implementation-defined values, and should not be used in portable code.
6766 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
6767 @opindex Wnormalized=
6768 @opindex Wnormalized
6769 @opindex Wno-normalized
6772 @cindex character set, input normalization
6773 In ISO C and ISO C++, two identifiers are different if they are
6774 different sequences of characters. However, sometimes when characters
6775 outside the basic ASCII character set are used, you can have two
6776 different character sequences that look the same. To avoid confusion,
6777 the ISO 10646 standard sets out some @dfn{normalization rules} which
6778 when applied ensure that two sequences that look the same are turned into
6779 the same sequence. GCC can warn you if you are using identifiers that
6780 have not been normalized; this option controls that warning.
6782 There are four levels of warning supported by GCC@. The default is
6783 @option{-Wnormalized=nfc}, which warns about any identifier that is
6784 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
6785 recommended form for most uses. It is equivalent to
6786 @option{-Wnormalized}.
6788 Unfortunately, there are some characters allowed in identifiers by
6789 ISO C and ISO C++ that, when turned into NFC, are not allowed in
6790 identifiers. That is, there's no way to use these symbols in portable
6791 ISO C or C++ and have all your identifiers in NFC@.
6792 @option{-Wnormalized=id} suppresses the warning for these characters.
6793 It is hoped that future versions of the standards involved will correct
6794 this, which is why this option is not the default.
6796 You can switch the warning off for all characters by writing
6797 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
6798 only do this if you are using some other normalization scheme (like
6799 ``D''), because otherwise you can easily create bugs that are
6800 literally impossible to see.
6802 Some characters in ISO 10646 have distinct meanings but look identical
6803 in some fonts or display methodologies, especially once formatting has
6804 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
6805 LETTER N'', displays just like a regular @code{n} that has been
6806 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
6807 normalization scheme to convert all these into a standard form as
6808 well, and GCC warns if your code is not in NFKC if you use
6809 @option{-Wnormalized=nfkc}. This warning is comparable to warning
6810 about every identifier that contains the letter O because it might be
6811 confused with the digit 0, and so is not the default, but may be
6812 useful as a local coding convention if the programming environment
6813 cannot be fixed to display these characters distinctly.
6815 @item -Wno-deprecated
6816 @opindex Wno-deprecated
6817 @opindex Wdeprecated
6818 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
6820 @item -Wno-deprecated-declarations
6821 @opindex Wno-deprecated-declarations
6822 @opindex Wdeprecated-declarations
6823 Do not warn about uses of functions (@pxref{Function Attributes}),
6824 variables (@pxref{Variable Attributes}), and types (@pxref{Type
6825 Attributes}) marked as deprecated by using the @code{deprecated}
6829 @opindex Wno-overflow
6831 Do not warn about compile-time overflow in constant expressions.
6836 Warn about One Definition Rule violations during link-time optimization.
6837 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
6840 @opindex Wopenmp-simd
6841 @opindex Wno-openmp-simd
6842 Warn if the vectorizer cost model overrides the OpenMP
6843 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
6844 option can be used to relax the cost model.
6846 @item -Woverride-init @r{(C and Objective-C only)}
6847 @opindex Woverride-init
6848 @opindex Wno-override-init
6852 Warn if an initialized field without side effects is overridden when
6853 using designated initializers (@pxref{Designated Inits, , Designated
6856 This warning is included in @option{-Wextra}. To get other
6857 @option{-Wextra} warnings without this one, use @option{-Wextra
6858 -Wno-override-init}.
6860 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
6861 @opindex Woverride-init-side-effects
6862 @opindex Wno-override-init-side-effects
6863 Warn if an initialized field with side effects is overridden when
6864 using designated initializers (@pxref{Designated Inits, , Designated
6865 Initializers}). This warning is enabled by default.
6870 Warn if a structure is given the packed attribute, but the packed
6871 attribute has no effect on the layout or size of the structure.
6872 Such structures may be mis-aligned for little benefit. For
6873 instance, in this code, the variable @code{f.x} in @code{struct bar}
6874 is misaligned even though @code{struct bar} does not itself
6875 have the packed attribute:
6882 @} __attribute__((packed));
6890 @item -Wpacked-bitfield-compat
6891 @opindex Wpacked-bitfield-compat
6892 @opindex Wno-packed-bitfield-compat
6893 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
6894 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
6895 the change can lead to differences in the structure layout. GCC
6896 informs you when the offset of such a field has changed in GCC 4.4.
6897 For example there is no longer a 4-bit padding between field @code{a}
6898 and @code{b} in this structure:
6905 @} __attribute__ ((packed));
6908 This warning is enabled by default. Use
6909 @option{-Wno-packed-bitfield-compat} to disable this warning.
6911 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
6912 @opindex Wpacked-not-aligned
6913 @opindex Wno-packed-not-aligned
6914 Warn if a structure field with explicitly specified alignment in a
6915 packed struct or union is misaligned. For example, a warning will
6916 be issued on @code{struct S}, like, @code{warning: alignment 1 of
6917 'struct S' is less than 8}, in this code:
6921 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
6922 struct __attribute__ ((packed)) S @{
6928 This warning is enabled by @option{-Wall}.
6933 Warn if padding is included in a structure, either to align an element
6934 of the structure or to align the whole structure. Sometimes when this
6935 happens it is possible to rearrange the fields of the structure to
6936 reduce the padding and so make the structure smaller.
6938 @item -Wredundant-decls
6939 @opindex Wredundant-decls
6940 @opindex Wno-redundant-decls
6941 Warn if anything is declared more than once in the same scope, even in
6942 cases where multiple declaration is valid and changes nothing.
6946 @opindex Wno-restrict
6947 Warn when an object referenced by a @code{restrict}-qualified parameter
6948 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
6949 argument, or when copies between such objects overlap. For example,
6950 the call to the @code{strcpy} function below attempts to truncate the string
6951 by replacing its initial characters with the last four. However, because
6952 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
6953 the call is diagnosed.
6958 char a[] = "abcd1234";
6963 The @option{-Wrestrict} option detects some instances of simple overlap
6964 even without optimization but works best at @option{-O2} and above. It
6965 is included in @option{-Wall}.
6967 @item -Wnested-externs @r{(C and Objective-C only)}
6968 @opindex Wnested-externs
6969 @opindex Wno-nested-externs
6970 Warn if an @code{extern} declaration is encountered within a function.
6972 @item -Wno-inherited-variadic-ctor
6973 @opindex Winherited-variadic-ctor
6974 @opindex Wno-inherited-variadic-ctor
6975 Suppress warnings about use of C++11 inheriting constructors when the
6976 base class inherited from has a C variadic constructor; the warning is
6977 on by default because the ellipsis is not inherited.
6982 Warn if a function that is declared as inline cannot be inlined.
6983 Even with this option, the compiler does not warn about failures to
6984 inline functions declared in system headers.
6986 The compiler uses a variety of heuristics to determine whether or not
6987 to inline a function. For example, the compiler takes into account
6988 the size of the function being inlined and the amount of inlining
6989 that has already been done in the current function. Therefore,
6990 seemingly insignificant changes in the source program can cause the
6991 warnings produced by @option{-Winline} to appear or disappear.
6993 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
6994 @opindex Wno-invalid-offsetof
6995 @opindex Winvalid-offsetof
6996 Suppress warnings from applying the @code{offsetof} macro to a non-POD
6997 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
6998 to a non-standard-layout type is undefined. In existing C++ implementations,
6999 however, @code{offsetof} typically gives meaningful results.
7000 This flag is for users who are aware that they are
7001 writing nonportable code and who have deliberately chosen to ignore the
7004 The restrictions on @code{offsetof} may be relaxed in a future version
7005 of the C++ standard.
7007 @item -Wint-in-bool-context
7008 @opindex Wint-in-bool-context
7009 @opindex Wno-int-in-bool-context
7010 Warn for suspicious use of integer values where boolean values are expected,
7011 such as conditional expressions (?:) using non-boolean integer constants in
7012 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7013 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7014 for all kinds of multiplications regardless of the data type.
7015 This warning is enabled by @option{-Wall}.
7017 @item -Wno-int-to-pointer-cast
7018 @opindex Wno-int-to-pointer-cast
7019 @opindex Wint-to-pointer-cast
7020 Suppress warnings from casts to pointer type of an integer of a
7021 different size. In C++, casting to a pointer type of smaller size is
7022 an error. @option{Wint-to-pointer-cast} is enabled by default.
7025 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7026 @opindex Wno-pointer-to-int-cast
7027 @opindex Wpointer-to-int-cast
7028 Suppress warnings from casts from a pointer to an integer type of a
7032 @opindex Winvalid-pch
7033 @opindex Wno-invalid-pch
7034 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7035 the search path but cannot be used.
7039 @opindex Wno-long-long
7040 Warn if @code{long long} type is used. This is enabled by either
7041 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7042 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7044 @item -Wvariadic-macros
7045 @opindex Wvariadic-macros
7046 @opindex Wno-variadic-macros
7047 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7048 alternate syntax is used in ISO C99 mode. This is enabled by either
7049 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7050 messages, use @option{-Wno-variadic-macros}.
7054 @opindex Wno-varargs
7055 Warn upon questionable usage of the macros used to handle variable
7056 arguments like @code{va_start}. This is default. To inhibit the
7057 warning messages, use @option{-Wno-varargs}.
7059 @item -Wvector-operation-performance
7060 @opindex Wvector-operation-performance
7061 @opindex Wno-vector-operation-performance
7062 Warn if vector operation is not implemented via SIMD capabilities of the
7063 architecture. Mainly useful for the performance tuning.
7064 Vector operation can be implemented @code{piecewise}, which means that the
7065 scalar operation is performed on every vector element;
7066 @code{in parallel}, which means that the vector operation is implemented
7067 using scalars of wider type, which normally is more performance efficient;
7068 and @code{as a single scalar}, which means that vector fits into a
7071 @item -Wno-virtual-move-assign
7072 @opindex Wvirtual-move-assign
7073 @opindex Wno-virtual-move-assign
7074 Suppress warnings about inheriting from a virtual base with a
7075 non-trivial C++11 move assignment operator. This is dangerous because
7076 if the virtual base is reachable along more than one path, it is
7077 moved multiple times, which can mean both objects end up in the
7078 moved-from state. If the move assignment operator is written to avoid
7079 moving from a moved-from object, this warning can be disabled.
7084 Warn if a variable-length array is used in the code.
7085 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7086 the variable-length array.
7088 @item -Wvla-larger-than=@var{byte-size}
7089 @opindex -Wvla-larger-than=
7090 @opindex -Wno-vla-larger-than
7091 If this option is used, the compiler will warn for declarations of
7092 variable-length arrays whose size is either unbounded, or bounded
7093 by an argument that allows the array size to exceed @var{byte-size}
7094 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7095 works, but with variable-length arrays.
7097 Note that GCC may optimize small variable-length arrays of a known
7098 value into plain arrays, so this warning may not get triggered for
7101 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7102 is typically only effective when @option{-ftree-vrp} is active (default
7103 for @option{-O2} and above).
7105 See also @option{-Walloca-larger-than=@var{byte-size}}.
7107 @item -Wno-vla-larger-than
7108 @opindex Wno-vla-larger-than
7109 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7110 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7112 @item -Wvolatile-register-var
7113 @opindex Wvolatile-register-var
7114 @opindex Wno-volatile-register-var
7115 Warn if a register variable is declared volatile. The volatile
7116 modifier does not inhibit all optimizations that may eliminate reads
7117 and/or writes to register variables. This warning is enabled by
7120 @item -Wdisabled-optimization
7121 @opindex Wdisabled-optimization
7122 @opindex Wno-disabled-optimization
7123 Warn if a requested optimization pass is disabled. This warning does
7124 not generally indicate that there is anything wrong with your code; it
7125 merely indicates that GCC's optimizers are unable to handle the code
7126 effectively. Often, the problem is that your code is too big or too
7127 complex; GCC refuses to optimize programs when the optimization
7128 itself is likely to take inordinate amounts of time.
7130 @item -Wpointer-sign @r{(C and Objective-C only)}
7131 @opindex Wpointer-sign
7132 @opindex Wno-pointer-sign
7133 Warn for pointer argument passing or assignment with different signedness.
7134 This option is only supported for C and Objective-C@. It is implied by
7135 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7136 @option{-Wno-pointer-sign}.
7138 @item -Wstack-protector
7139 @opindex Wstack-protector
7140 @opindex Wno-stack-protector
7141 This option is only active when @option{-fstack-protector} is active. It
7142 warns about functions that are not protected against stack smashing.
7144 @item -Woverlength-strings
7145 @opindex Woverlength-strings
7146 @opindex Wno-overlength-strings
7147 Warn about string constants that are longer than the ``minimum
7148 maximum'' length specified in the C standard. Modern compilers
7149 generally allow string constants that are much longer than the
7150 standard's minimum limit, but very portable programs should avoid
7151 using longer strings.
7153 The limit applies @emph{after} string constant concatenation, and does
7154 not count the trailing NUL@. In C90, the limit was 509 characters; in
7155 C99, it was raised to 4095. C++98 does not specify a normative
7156 minimum maximum, so we do not diagnose overlength strings in C++@.
7158 This option is implied by @option{-Wpedantic}, and can be disabled with
7159 @option{-Wno-overlength-strings}.
7161 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7162 @opindex Wunsuffixed-float-constants
7163 @opindex Wno-unsuffixed-float-constants
7165 Issue a warning for any floating constant that does not have
7166 a suffix. When used together with @option{-Wsystem-headers} it
7167 warns about such constants in system header files. This can be useful
7168 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7169 from the decimal floating-point extension to C99.
7171 @item -Wno-designated-init @r{(C and Objective-C only)}
7172 Suppress warnings when a positional initializer is used to initialize
7173 a structure that has been marked with the @code{designated_init}
7177 Issue a warning when HSAIL cannot be emitted for the compiled function or
7182 @node Debugging Options
7183 @section Options for Debugging Your Program
7184 @cindex options, debugging
7185 @cindex debugging information options
7187 To tell GCC to emit extra information for use by a debugger, in almost
7188 all cases you need only to add @option{-g} to your other options.
7190 GCC allows you to use @option{-g} with
7191 @option{-O}. The shortcuts taken by optimized code may occasionally
7192 be surprising: some variables you declared may not exist
7193 at all; flow of control may briefly move where you did not expect it;
7194 some statements may not be executed because they compute constant
7195 results or their values are already at hand; some statements may
7196 execute in different places because they have been moved out of loops.
7197 Nevertheless it is possible to debug optimized output. This makes
7198 it reasonable to use the optimizer for programs that might have bugs.
7200 If you are not using some other optimization option, consider
7201 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7202 With no @option{-O} option at all, some compiler passes that collect
7203 information useful for debugging do not run at all, so that
7204 @option{-Og} may result in a better debugging experience.
7209 Produce debugging information in the operating system's native format
7210 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7213 On most systems that use stabs format, @option{-g} enables use of extra
7214 debugging information that only GDB can use; this extra information
7215 makes debugging work better in GDB but probably makes other debuggers
7217 refuse to read the program. If you want to control for certain whether
7218 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7219 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7223 Produce debugging information for use by GDB@. This means to use the
7224 most expressive format available (DWARF, stabs, or the native format
7225 if neither of those are supported), including GDB extensions if at all
7229 @itemx -gdwarf-@var{version}
7231 Produce debugging information in DWARF format (if that is supported).
7232 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7233 for most targets is 4. DWARF Version 5 is only experimental.
7235 Note that with DWARF Version 2, some ports require and always
7236 use some non-conflicting DWARF 3 extensions in the unwind tables.
7238 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7239 for maximum benefit.
7241 GCC no longer supports DWARF Version 1, which is substantially
7242 different than Version 2 and later. For historical reasons, some
7243 other DWARF-related options such as
7244 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7245 in their names, but apply to all currently-supported versions of DWARF.
7249 Produce debugging information in stabs format (if that is supported),
7250 without GDB extensions. This is the format used by DBX on most BSD
7251 systems. On MIPS, Alpha and System V Release 4 systems this option
7252 produces stabs debugging output that is not understood by DBX@.
7253 On System V Release 4 systems this option requires the GNU assembler.
7257 Produce debugging information in stabs format (if that is supported),
7258 using GNU extensions understood only by the GNU debugger (GDB)@. The
7259 use of these extensions is likely to make other debuggers crash or
7260 refuse to read the program.
7264 Produce debugging information in XCOFF format (if that is supported).
7265 This is the format used by the DBX debugger on IBM RS/6000 systems.
7269 Produce debugging information in XCOFF format (if that is supported),
7270 using GNU extensions understood only by the GNU debugger (GDB)@. The
7271 use of these extensions is likely to make other debuggers crash or
7272 refuse to read the program, and may cause assemblers other than the GNU
7273 assembler (GAS) to fail with an error.
7277 Produce debugging information in Alpha/VMS debug format (if that is
7278 supported). This is the format used by DEBUG on Alpha/VMS systems.
7281 @itemx -ggdb@var{level}
7282 @itemx -gstabs@var{level}
7283 @itemx -gxcoff@var{level}
7284 @itemx -gvms@var{level}
7285 Request debugging information and also use @var{level} to specify how
7286 much information. The default level is 2.
7288 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7291 Level 1 produces minimal information, enough for making backtraces in
7292 parts of the program that you don't plan to debug. This includes
7293 descriptions of functions and external variables, and line number
7294 tables, but no information about local variables.
7296 Level 3 includes extra information, such as all the macro definitions
7297 present in the program. Some debuggers support macro expansion when
7298 you use @option{-g3}.
7300 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7301 confusion with @option{-gdwarf-@var{level}}.
7302 Instead use an additional @option{-g@var{level}} option to change the
7303 debug level for DWARF.
7305 @item -feliminate-unused-debug-symbols
7306 @opindex feliminate-unused-debug-symbols
7307 Produce debugging information in stabs format (if that is supported),
7308 for only symbols that are actually used.
7310 @item -femit-class-debug-always
7311 @opindex femit-class-debug-always
7312 Instead of emitting debugging information for a C++ class in only one
7313 object file, emit it in all object files using the class. This option
7314 should be used only with debuggers that are unable to handle the way GCC
7315 normally emits debugging information for classes because using this
7316 option increases the size of debugging information by as much as a
7319 @item -fno-merge-debug-strings
7320 @opindex fmerge-debug-strings
7321 @opindex fno-merge-debug-strings
7322 Direct the linker to not merge together strings in the debugging
7323 information that are identical in different object files. Merging is
7324 not supported by all assemblers or linkers. Merging decreases the size
7325 of the debug information in the output file at the cost of increasing
7326 link processing time. Merging is enabled by default.
7328 @item -fdebug-prefix-map=@var{old}=@var{new}
7329 @opindex fdebug-prefix-map
7330 When compiling files residing in directory @file{@var{old}}, record
7331 debugging information describing them as if the files resided in
7332 directory @file{@var{new}} instead. This can be used to replace a
7333 build-time path with an install-time path in the debug info. It can
7334 also be used to change an absolute path to a relative path by using
7335 @file{.} for @var{new}. This can give more reproducible builds, which
7336 are location independent, but may require an extra command to tell GDB
7337 where to find the source files. See also @option{-ffile-prefix-map}.
7339 @item -fvar-tracking
7340 @opindex fvar-tracking
7341 Run variable tracking pass. It computes where variables are stored at each
7342 position in code. Better debugging information is then generated
7343 (if the debugging information format supports this information).
7345 It is enabled by default when compiling with optimization (@option{-Os},
7346 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7347 the debug info format supports it.
7349 @item -fvar-tracking-assignments
7350 @opindex fvar-tracking-assignments
7351 @opindex fno-var-tracking-assignments
7352 Annotate assignments to user variables early in the compilation and
7353 attempt to carry the annotations over throughout the compilation all the
7354 way to the end, in an attempt to improve debug information while
7355 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7357 It can be enabled even if var-tracking is disabled, in which case
7358 annotations are created and maintained, but discarded at the end.
7359 By default, this flag is enabled together with @option{-fvar-tracking},
7360 except when selective scheduling is enabled.
7363 @opindex gsplit-dwarf
7364 Separate as much DWARF debugging information as possible into a
7365 separate output file with the extension @file{.dwo}. This option allows
7366 the build system to avoid linking files with debug information. To
7367 be useful, this option requires a debugger capable of reading @file{.dwo}
7372 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7374 @item -ggnu-pubnames
7375 @opindex ggnu-pubnames
7376 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7377 suitable for conversion into a GDB@ index. This option is only useful
7378 with a linker that can produce GDB@ index version 7.
7380 @item -fdebug-types-section
7381 @opindex fdebug-types-section
7382 @opindex fno-debug-types-section
7383 When using DWARF Version 4 or higher, type DIEs can be put into
7384 their own @code{.debug_types} section instead of making them part of the
7385 @code{.debug_info} section. It is more efficient to put them in a separate
7386 comdat section since the linker can then remove duplicates.
7387 But not all DWARF consumers support @code{.debug_types} sections yet
7388 and on some objects @code{.debug_types} produces larger instead of smaller
7389 debugging information.
7391 @item -grecord-gcc-switches
7392 @itemx -gno-record-gcc-switches
7393 @opindex grecord-gcc-switches
7394 @opindex gno-record-gcc-switches
7395 This switch causes the command-line options used to invoke the
7396 compiler that may affect code generation to be appended to the
7397 DW_AT_producer attribute in DWARF debugging information. The options
7398 are concatenated with spaces separating them from each other and from
7399 the compiler version.
7400 It is enabled by default.
7401 See also @option{-frecord-gcc-switches} for another
7402 way of storing compiler options into the object file.
7404 @item -gstrict-dwarf
7405 @opindex gstrict-dwarf
7406 Disallow using extensions of later DWARF standard version than selected
7407 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
7408 DWARF extensions from later standard versions is allowed.
7410 @item -gno-strict-dwarf
7411 @opindex gno-strict-dwarf
7412 Allow using extensions of later DWARF standard version than selected with
7413 @option{-gdwarf-@var{version}}.
7415 @item -gas-loc-support
7416 @opindex gas-loc-support
7417 Inform the compiler that the assembler supports @code{.loc} directives.
7418 It may then use them for the assembler to generate DWARF2+ line number
7421 This is generally desirable, because assembler-generated line-number
7422 tables are a lot more compact than those the compiler can generate
7425 This option will be enabled by default if, at GCC configure time, the
7426 assembler was found to support such directives.
7428 @item -gno-as-loc-support
7429 @opindex gno-as-loc-support
7430 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
7431 line number tables are to be generated.
7433 @item gas-locview-support
7434 @opindex gas-locview-support
7435 Inform the compiler that the assembler supports @code{view} assignment
7436 and reset assertion checking in @code{.loc} directives.
7438 This option will be enabled by default if, at GCC configure time, the
7439 assembler was found to support them.
7441 @item gno-as-locview-support
7442 Force GCC to assign view numbers internally, if
7443 @option{-gvariable-location-views} are explicitly requested.
7446 @itemx -gno-column-info
7447 @opindex gcolumn-info
7448 @opindex gno-column-info
7449 Emit location column information into DWARF debugging information, rather
7450 than just file and line.
7451 This option is enabled by default.
7453 @item -gstatement-frontiers
7454 @itemx -gno-statement-frontiers
7455 @opindex gstatement-frontiers
7456 @opindex gno-statement-frontiers
7457 This option causes GCC to create markers in the internal representation
7458 at the beginning of statements, and to keep them roughly in place
7459 throughout compilation, using them to guide the output of @code{is_stmt}
7460 markers in the line number table. This is enabled by default when
7461 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
7462 @dots{}), and outputting DWARF 2 debug information at the normal level.
7464 @item -gvariable-location-views
7465 @itemx -gvariable-location-views=incompat5
7466 @itemx -gno-variable-location-views
7467 @opindex gvariable-location-views
7468 @opindex gvariable-location-views=incompat5
7469 @opindex gno-variable-location-views
7470 Augment variable location lists with progressive view numbers implied
7471 from the line number table. This enables debug information consumers to
7472 inspect state at certain points of the program, even if no instructions
7473 associated with the corresponding source locations are present at that
7474 point. If the assembler lacks support for view numbers in line number
7475 tables, this will cause the compiler to emit the line number table,
7476 which generally makes them somewhat less compact. The augmented line
7477 number tables and location lists are fully backward-compatible, so they
7478 can be consumed by debug information consumers that are not aware of
7479 these augmentations, but they won't derive any benefit from them either.
7481 This is enabled by default when outputting DWARF 2 debug information at
7482 the normal level, as long as there is assembler support,
7483 @option{-fvar-tracking-assignments} is enabled and
7484 @option{-gstrict-dwarf} is not. When assembler support is not
7485 available, this may still be enabled, but it will force GCC to output
7486 internal line number tables, and if
7487 @option{-ginternal-reset-location-views} is not enabled, that will most
7488 certainly lead to silently mismatching location views.
7490 There is a proposed representation for view numbers that is not backward
7491 compatible with the location list format introduced in DWARF 5, that can
7492 be enabled with @option{-gvariable-location-views=incompat5}. This
7493 option may be removed in the future, is only provided as a reference
7494 implementation of the proposed representation. Debug information
7495 consumers are not expected to support this extended format, and they
7496 would be rendered unable to decode location lists using it.
7498 @item -ginternal-reset-location-views
7499 @itemx -gnointernal-reset-location-views
7500 @opindex ginternal-reset-location-views
7501 @opindex gno-internal-reset-location-views
7502 Attempt to determine location views that can be omitted from location
7503 view lists. This requires the compiler to have very accurate insn
7504 length estimates, which isn't always the case, and it may cause
7505 incorrect view lists to be generated silently when using an assembler
7506 that does not support location view lists. The GNU assembler will flag
7507 any such error as a @code{view number mismatch}. This is only enabled
7508 on ports that define a reliable estimation function.
7510 @item -ginline-points
7511 @itemx -gno-inline-points
7512 @opindex ginline-points
7513 @opindex gno-inline-points
7514 Generate extended debug information for inlined functions. Location
7515 view tracking markers are inserted at inlined entry points, so that
7516 address and view numbers can be computed and output in debug
7517 information. This can be enabled independently of location views, in
7518 which case the view numbers won't be output, but it can only be enabled
7519 along with statement frontiers, and it is only enabled by default if
7520 location views are enabled.
7522 @item -gz@r{[}=@var{type}@r{]}
7524 Produce compressed debug sections in DWARF format, if that is supported.
7525 If @var{type} is not given, the default type depends on the capabilities
7526 of the assembler and linker used. @var{type} may be one of
7527 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
7528 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
7529 compression in traditional GNU format). If the linker doesn't support
7530 writing compressed debug sections, the option is rejected. Otherwise,
7531 if the assembler does not support them, @option{-gz} is silently ignored
7532 when producing object files.
7534 @item -femit-struct-debug-baseonly
7535 @opindex femit-struct-debug-baseonly
7536 Emit debug information for struct-like types
7537 only when the base name of the compilation source file
7538 matches the base name of file in which the struct is defined.
7540 This option substantially reduces the size of debugging information,
7541 but at significant potential loss in type information to the debugger.
7542 See @option{-femit-struct-debug-reduced} for a less aggressive option.
7543 See @option{-femit-struct-debug-detailed} for more detailed control.
7545 This option works only with DWARF debug output.
7547 @item -femit-struct-debug-reduced
7548 @opindex femit-struct-debug-reduced
7549 Emit debug information for struct-like types
7550 only when the base name of the compilation source file
7551 matches the base name of file in which the type is defined,
7552 unless the struct is a template or defined in a system header.
7554 This option significantly reduces the size of debugging information,
7555 with some potential loss in type information to the debugger.
7556 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
7557 See @option{-femit-struct-debug-detailed} for more detailed control.
7559 This option works only with DWARF debug output.
7561 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
7562 @opindex femit-struct-debug-detailed
7563 Specify the struct-like types
7564 for which the compiler generates debug information.
7565 The intent is to reduce duplicate struct debug information
7566 between different object files within the same program.
7568 This option is a detailed version of
7569 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
7570 which serves for most needs.
7572 A specification has the syntax@*
7573 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
7575 The optional first word limits the specification to
7576 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
7577 A struct type is used directly when it is the type of a variable, member.
7578 Indirect uses arise through pointers to structs.
7579 That is, when use of an incomplete struct is valid, the use is indirect.
7581 @samp{struct one direct; struct two * indirect;}.
7583 The optional second word limits the specification to
7584 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
7585 Generic structs are a bit complicated to explain.
7586 For C++, these are non-explicit specializations of template classes,
7587 or non-template classes within the above.
7588 Other programming languages have generics,
7589 but @option{-femit-struct-debug-detailed} does not yet implement them.
7591 The third word specifies the source files for those
7592 structs for which the compiler should emit debug information.
7593 The values @samp{none} and @samp{any} have the normal meaning.
7594 The value @samp{base} means that
7595 the base of name of the file in which the type declaration appears
7596 must match the base of the name of the main compilation file.
7597 In practice, this means that when compiling @file{foo.c}, debug information
7598 is generated for types declared in that file and @file{foo.h},
7599 but not other header files.
7600 The value @samp{sys} means those types satisfying @samp{base}
7601 or declared in system or compiler headers.
7603 You may need to experiment to determine the best settings for your application.
7605 The default is @option{-femit-struct-debug-detailed=all}.
7607 This option works only with DWARF debug output.
7609 @item -fno-dwarf2-cfi-asm
7610 @opindex fdwarf2-cfi-asm
7611 @opindex fno-dwarf2-cfi-asm
7612 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
7613 instead of using GAS @code{.cfi_*} directives.
7615 @item -fno-eliminate-unused-debug-types
7616 @opindex feliminate-unused-debug-types
7617 @opindex fno-eliminate-unused-debug-types
7618 Normally, when producing DWARF output, GCC avoids producing debug symbol
7619 output for types that are nowhere used in the source file being compiled.
7620 Sometimes it is useful to have GCC emit debugging
7621 information for all types declared in a compilation
7622 unit, regardless of whether or not they are actually used
7623 in that compilation unit, for example
7624 if, in the debugger, you want to cast a value to a type that is
7625 not actually used in your program (but is declared). More often,
7626 however, this results in a significant amount of wasted space.
7629 @node Optimize Options
7630 @section Options That Control Optimization
7631 @cindex optimize options
7632 @cindex options, optimization
7634 These options control various sorts of optimizations.
7636 Without any optimization option, the compiler's goal is to reduce the
7637 cost of compilation and to make debugging produce the expected
7638 results. Statements are independent: if you stop the program with a
7639 breakpoint between statements, you can then assign a new value to any
7640 variable or change the program counter to any other statement in the
7641 function and get exactly the results you expect from the source
7644 Turning on optimization flags makes the compiler attempt to improve
7645 the performance and/or code size at the expense of compilation time
7646 and possibly the ability to debug the program.
7648 The compiler performs optimization based on the knowledge it has of the
7649 program. Compiling multiple files at once to a single output file mode allows
7650 the compiler to use information gained from all of the files when compiling
7653 Not all optimizations are controlled directly by a flag. Only
7654 optimizations that have a flag are listed in this section.
7656 Most optimizations are only enabled if an @option{-O} level is set on
7657 the command line. Otherwise they are disabled, even if individual
7658 optimization flags are specified.
7660 Depending on the target and how GCC was configured, a slightly different
7661 set of optimizations may be enabled at each @option{-O} level than
7662 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
7663 to find out the exact set of optimizations that are enabled at each level.
7664 @xref{Overall Options}, for examples.
7671 Optimize. Optimizing compilation takes somewhat more time, and a lot
7672 more memory for a large function.
7674 With @option{-O}, the compiler tries to reduce code size and execution
7675 time, without performing any optimizations that take a great deal of
7678 @option{-O} turns on the following optimization flags:
7681 -fbranch-count-reg @gol
7682 -fcombine-stack-adjustments @gol
7684 -fcprop-registers @gol
7687 -fdelayed-branch @gol
7689 -fforward-propagate @gol
7690 -fguess-branch-probability @gol
7691 -fif-conversion2 @gol
7692 -fif-conversion @gol
7693 -finline-functions-called-once @gol
7694 -fipa-pure-const @gol
7696 -fipa-reference @gol
7697 -fmerge-constants @gol
7698 -fmove-loop-invariants @gol
7699 -fomit-frame-pointer @gol
7700 -freorder-blocks @gol
7702 -fshrink-wrap-separate @gol
7703 -fsplit-wide-types @gol
7709 -ftree-coalesce-vars @gol
7710 -ftree-copy-prop @gol
7712 -ftree-dominator-opts @gol
7714 -ftree-forwprop @gol
7726 Optimize even more. GCC performs nearly all supported optimizations
7727 that do not involve a space-speed tradeoff.
7728 As compared to @option{-O}, this option increases both compilation time
7729 and the performance of the generated code.
7731 @option{-O2} turns on all optimization flags specified by @option{-O}. It
7732 also turns on the following optimization flags:
7733 @gccoptlist{-fthread-jumps @gol
7734 -falign-functions -falign-jumps @gol
7735 -falign-loops -falign-labels @gol
7738 -fcse-follow-jumps -fcse-skip-blocks @gol
7739 -fdelete-null-pointer-checks @gol
7740 -fdevirtualize -fdevirtualize-speculatively @gol
7741 -fexpensive-optimizations @gol
7742 -fgcse -fgcse-lm @gol
7743 -fhoist-adjacent-loads @gol
7744 -finline-small-functions @gol
7745 -findirect-inlining @gol
7751 -fisolate-erroneous-paths-dereference @gol
7753 -foptimize-sibling-calls @gol
7754 -foptimize-strlen @gol
7755 -fpartial-inlining @gol
7757 -freorder-blocks-algorithm=stc @gol
7758 -freorder-blocks-and-partition -freorder-functions @gol
7759 -frerun-cse-after-loop @gol
7760 -fsched-interblock -fsched-spec @gol
7761 -fschedule-insns -fschedule-insns2 @gol
7762 -fstore-merging @gol
7763 -fstrict-aliasing @gol
7764 -ftree-builtin-call-dce @gol
7765 -ftree-switch-conversion -ftree-tail-merge @gol
7766 -fcode-hoisting @gol
7771 Please note the warning under @option{-fgcse} about
7772 invoking @option{-O2} on programs that use computed gotos.
7776 Optimize yet more. @option{-O3} turns on all optimizations specified
7777 by @option{-O2} and also turns on the following optimization flags:
7778 @gccoptlist{-finline-functions @gol
7779 -funswitch-loops @gol
7780 -fpredictive-commoning @gol
7781 -fgcse-after-reload @gol
7782 -ftree-loop-vectorize @gol
7783 -ftree-loop-distribution @gol
7784 -ftree-loop-distribute-patterns @gol
7785 -floop-interchange @gol
7786 -floop-unroll-and-jam @gol
7788 -ftree-slp-vectorize @gol
7789 -fvect-cost-model @gol
7790 -ftree-partial-pre @gol
7796 Reduce compilation time and make debugging produce the expected
7797 results. This is the default.
7801 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
7802 do not typically increase code size. It also performs further
7803 optimizations designed to reduce code size.
7805 @option{-Os} disables the following optimization flags:
7806 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
7807 -falign-labels -freorder-blocks -freorder-blocks-algorithm=stc @gol
7808 -freorder-blocks-and-partition -fprefetch-loop-arrays}
7812 Disregard strict standards compliance. @option{-Ofast} enables all
7813 @option{-O3} optimizations. It also enables optimizations that are not
7814 valid for all standard-compliant programs.
7815 It turns on @option{-ffast-math} and the Fortran-specific
7816 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
7817 specified, and @option{-fno-protect-parens}.
7821 Optimize debugging experience. @option{-Og} enables optimizations
7822 that do not interfere with debugging. It should be the optimization
7823 level of choice for the standard edit-compile-debug cycle, offering
7824 a reasonable level of optimization while maintaining fast compilation
7825 and a good debugging experience.
7828 If you use multiple @option{-O} options, with or without level numbers,
7829 the last such option is the one that is effective.
7831 Options of the form @option{-f@var{flag}} specify machine-independent
7832 flags. Most flags have both positive and negative forms; the negative
7833 form of @option{-ffoo} is @option{-fno-foo}. In the table
7834 below, only one of the forms is listed---the one you typically
7835 use. You can figure out the other form by either removing @samp{no-}
7838 The following options control specific optimizations. They are either
7839 activated by @option{-O} options or are related to ones that are. You
7840 can use the following flags in the rare cases when ``fine-tuning'' of
7841 optimizations to be performed is desired.
7844 @item -fno-defer-pop
7845 @opindex fno-defer-pop
7846 Always pop the arguments to each function call as soon as that function
7847 returns. For machines that must pop arguments after a function call,
7848 the compiler normally lets arguments accumulate on the stack for several
7849 function calls and pops them all at once.
7851 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7853 @item -fforward-propagate
7854 @opindex fforward-propagate
7855 Perform a forward propagation pass on RTL@. The pass tries to combine two
7856 instructions and checks if the result can be simplified. If loop unrolling
7857 is active, two passes are performed and the second is scheduled after
7860 This option is enabled by default at optimization levels @option{-O},
7861 @option{-O2}, @option{-O3}, @option{-Os}.
7863 @item -ffp-contract=@var{style}
7864 @opindex ffp-contract
7865 @option{-ffp-contract=off} disables floating-point expression contraction.
7866 @option{-ffp-contract=fast} enables floating-point expression contraction
7867 such as forming of fused multiply-add operations if the target has
7868 native support for them.
7869 @option{-ffp-contract=on} enables floating-point expression contraction
7870 if allowed by the language standard. This is currently not implemented
7871 and treated equal to @option{-ffp-contract=off}.
7873 The default is @option{-ffp-contract=fast}.
7875 @item -fomit-frame-pointer
7876 @opindex fomit-frame-pointer
7877 Omit the frame pointer in functions that don't need one. This avoids the
7878 instructions to save, set up and restore the frame pointer; on many targets
7879 it also makes an extra register available.
7881 On some targets this flag has no effect because the standard calling sequence
7882 always uses a frame pointer, so it cannot be omitted.
7884 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
7885 is used in all functions. Several targets always omit the frame pointer in
7888 Enabled by default at @option{-O} and higher.
7890 @item -foptimize-sibling-calls
7891 @opindex foptimize-sibling-calls
7892 Optimize sibling and tail recursive calls.
7894 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7896 @item -foptimize-strlen
7897 @opindex foptimize-strlen
7898 Optimize various standard C string functions (e.g. @code{strlen},
7899 @code{strchr} or @code{strcpy}) and
7900 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
7902 Enabled at levels @option{-O2}, @option{-O3}.
7906 Do not expand any functions inline apart from those marked with
7907 the @code{always_inline} attribute. This is the default when not
7910 Single functions can be exempted from inlining by marking them
7911 with the @code{noinline} attribute.
7913 @item -finline-small-functions
7914 @opindex finline-small-functions
7915 Integrate functions into their callers when their body is smaller than expected
7916 function call code (so overall size of program gets smaller). The compiler
7917 heuristically decides which functions are simple enough to be worth integrating
7918 in this way. This inlining applies to all functions, even those not declared
7921 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7923 @item -findirect-inlining
7924 @opindex findirect-inlining
7925 Inline also indirect calls that are discovered to be known at compile
7926 time thanks to previous inlining. This option has any effect only
7927 when inlining itself is turned on by the @option{-finline-functions}
7928 or @option{-finline-small-functions} options.
7930 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7932 @item -finline-functions
7933 @opindex finline-functions
7934 Consider all functions for inlining, even if they are not declared inline.
7935 The compiler heuristically decides which functions are worth integrating
7938 If all calls to a given function are integrated, and the function is
7939 declared @code{static}, then the function is normally not output as
7940 assembler code in its own right.
7942 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7944 @item -finline-functions-called-once
7945 @opindex finline-functions-called-once
7946 Consider all @code{static} functions called once for inlining into their
7947 caller even if they are not marked @code{inline}. If a call to a given
7948 function is integrated, then the function is not output as assembler code
7951 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
7953 @item -fearly-inlining
7954 @opindex fearly-inlining
7955 Inline functions marked by @code{always_inline} and functions whose body seems
7956 smaller than the function call overhead early before doing
7957 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
7958 makes profiling significantly cheaper and usually inlining faster on programs
7959 having large chains of nested wrapper functions.
7965 Perform interprocedural scalar replacement of aggregates, removal of
7966 unused parameters and replacement of parameters passed by reference
7967 by parameters passed by value.
7969 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
7971 @item -finline-limit=@var{n}
7972 @opindex finline-limit
7973 By default, GCC limits the size of functions that can be inlined. This flag
7974 allows coarse control of this limit. @var{n} is the size of functions that
7975 can be inlined in number of pseudo instructions.
7977 Inlining is actually controlled by a number of parameters, which may be
7978 specified individually by using @option{--param @var{name}=@var{value}}.
7979 The @option{-finline-limit=@var{n}} option sets some of these parameters
7983 @item max-inline-insns-single
7984 is set to @var{n}/2.
7985 @item max-inline-insns-auto
7986 is set to @var{n}/2.
7989 See below for a documentation of the individual
7990 parameters controlling inlining and for the defaults of these parameters.
7992 @emph{Note:} there may be no value to @option{-finline-limit} that results
7993 in default behavior.
7995 @emph{Note:} pseudo instruction represents, in this particular context, an
7996 abstract measurement of function's size. In no way does it represent a count
7997 of assembly instructions and as such its exact meaning might change from one
7998 release to an another.
8000 @item -fno-keep-inline-dllexport
8001 @opindex fno-keep-inline-dllexport
8002 This is a more fine-grained version of @option{-fkeep-inline-functions},
8003 which applies only to functions that are declared using the @code{dllexport}
8004 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8007 @item -fkeep-inline-functions
8008 @opindex fkeep-inline-functions
8009 In C, emit @code{static} functions that are declared @code{inline}
8010 into the object file, even if the function has been inlined into all
8011 of its callers. This switch does not affect functions using the
8012 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8013 inline functions into the object file.
8015 @item -fkeep-static-functions
8016 @opindex fkeep-static-functions
8017 Emit @code{static} functions into the object file, even if the function
8020 @item -fkeep-static-consts
8021 @opindex fkeep-static-consts
8022 Emit variables declared @code{static const} when optimization isn't turned
8023 on, even if the variables aren't referenced.
8025 GCC enables this option by default. If you want to force the compiler to
8026 check if a variable is referenced, regardless of whether or not
8027 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8029 @item -fmerge-constants
8030 @opindex fmerge-constants
8031 Attempt to merge identical constants (string constants and floating-point
8032 constants) across compilation units.
8034 This option is the default for optimized compilation if the assembler and
8035 linker support it. Use @option{-fno-merge-constants} to inhibit this
8038 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8040 @item -fmerge-all-constants
8041 @opindex fmerge-all-constants
8042 Attempt to merge identical constants and identical variables.
8044 This option implies @option{-fmerge-constants}. In addition to
8045 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8046 arrays or initialized constant variables with integral or floating-point
8047 types. Languages like C or C++ require each variable, including multiple
8048 instances of the same variable in recursive calls, to have distinct locations,
8049 so using this option results in non-conforming
8052 @item -fmodulo-sched
8053 @opindex fmodulo-sched
8054 Perform swing modulo scheduling immediately before the first scheduling
8055 pass. This pass looks at innermost loops and reorders their
8056 instructions by overlapping different iterations.
8058 @item -fmodulo-sched-allow-regmoves
8059 @opindex fmodulo-sched-allow-regmoves
8060 Perform more aggressive SMS-based modulo scheduling with register moves
8061 allowed. By setting this flag certain anti-dependences edges are
8062 deleted, which triggers the generation of reg-moves based on the
8063 life-range analysis. This option is effective only with
8064 @option{-fmodulo-sched} enabled.
8066 @item -fno-branch-count-reg
8067 @opindex fno-branch-count-reg
8068 Avoid running a pass scanning for opportunities to use ``decrement and
8069 branch'' instructions on a count register instead of generating sequences
8070 of instructions that decrement a register, compare it against zero, and
8071 then branch based upon the result. This option is only meaningful on
8072 architectures that support such instructions, which include x86, PowerPC,
8073 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8074 doesn't remove the decrement and branch instructions from the generated
8075 instruction stream introduced by other optimization passes.
8077 Enabled by default at @option{-O1} and higher.
8079 The default is @option{-fbranch-count-reg}.
8081 @item -fno-function-cse
8082 @opindex fno-function-cse
8083 Do not put function addresses in registers; make each instruction that
8084 calls a constant function contain the function's address explicitly.
8086 This option results in less efficient code, but some strange hacks
8087 that alter the assembler output may be confused by the optimizations
8088 performed when this option is not used.
8090 The default is @option{-ffunction-cse}
8092 @item -fno-zero-initialized-in-bss
8093 @opindex fno-zero-initialized-in-bss
8094 If the target supports a BSS section, GCC by default puts variables that
8095 are initialized to zero into BSS@. This can save space in the resulting
8098 This option turns off this behavior because some programs explicitly
8099 rely on variables going to the data section---e.g., so that the
8100 resulting executable can find the beginning of that section and/or make
8101 assumptions based on that.
8103 The default is @option{-fzero-initialized-in-bss}.
8105 @item -fthread-jumps
8106 @opindex fthread-jumps
8107 Perform optimizations that check to see if a jump branches to a
8108 location where another comparison subsumed by the first is found. If
8109 so, the first branch is redirected to either the destination of the
8110 second branch or a point immediately following it, depending on whether
8111 the condition is known to be true or false.
8113 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8115 @item -fsplit-wide-types
8116 @opindex fsplit-wide-types
8117 When using a type that occupies multiple registers, such as @code{long
8118 long} on a 32-bit system, split the registers apart and allocate them
8119 independently. This normally generates better code for those types,
8120 but may make debugging more difficult.
8122 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8125 @item -fcse-follow-jumps
8126 @opindex fcse-follow-jumps
8127 In common subexpression elimination (CSE), scan through jump instructions
8128 when the target of the jump is not reached by any other path. For
8129 example, when CSE encounters an @code{if} statement with an
8130 @code{else} clause, CSE follows the jump when the condition
8133 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8135 @item -fcse-skip-blocks
8136 @opindex fcse-skip-blocks
8137 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8138 follow jumps that conditionally skip over blocks. When CSE
8139 encounters a simple @code{if} statement with no else clause,
8140 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8141 body of the @code{if}.
8143 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8145 @item -frerun-cse-after-loop
8146 @opindex frerun-cse-after-loop
8147 Re-run common subexpression elimination after loop optimizations are
8150 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8154 Perform a global common subexpression elimination pass.
8155 This pass also performs global constant and copy propagation.
8157 @emph{Note:} When compiling a program using computed gotos, a GCC
8158 extension, you may get better run-time performance if you disable
8159 the global common subexpression elimination pass by adding
8160 @option{-fno-gcse} to the command line.
8162 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8166 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8167 attempts to move loads that are only killed by stores into themselves. This
8168 allows a loop containing a load/store sequence to be changed to a load outside
8169 the loop, and a copy/store within the loop.
8171 Enabled by default when @option{-fgcse} is enabled.
8175 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8176 global common subexpression elimination. This pass attempts to move
8177 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8178 loops containing a load/store sequence can be changed to a load before
8179 the loop and a store after the loop.
8181 Not enabled at any optimization level.
8185 When @option{-fgcse-las} is enabled, the global common subexpression
8186 elimination pass eliminates redundant loads that come after stores to the
8187 same memory location (both partial and full redundancies).
8189 Not enabled at any optimization level.
8191 @item -fgcse-after-reload
8192 @opindex fgcse-after-reload
8193 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8194 pass is performed after reload. The purpose of this pass is to clean up
8197 @item -faggressive-loop-optimizations
8198 @opindex faggressive-loop-optimizations
8199 This option tells the loop optimizer to use language constraints to
8200 derive bounds for the number of iterations of a loop. This assumes that
8201 loop code does not invoke undefined behavior by for example causing signed
8202 integer overflows or out-of-bound array accesses. The bounds for the
8203 number of iterations of a loop are used to guide loop unrolling and peeling
8204 and loop exit test optimizations.
8205 This option is enabled by default.
8207 @item -funconstrained-commons
8208 @opindex funconstrained-commons
8209 This option tells the compiler that variables declared in common blocks
8210 (e.g. Fortran) may later be overridden with longer trailing arrays. This
8211 prevents certain optimizations that depend on knowing the array bounds.
8213 @item -fcrossjumping
8214 @opindex fcrossjumping
8215 Perform cross-jumping transformation.
8216 This transformation unifies equivalent code and saves code size. The
8217 resulting code may or may not perform better than without cross-jumping.
8219 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8221 @item -fauto-inc-dec
8222 @opindex fauto-inc-dec
8223 Combine increments or decrements of addresses with memory accesses.
8224 This pass is always skipped on architectures that do not have
8225 instructions to support this. Enabled by default at @option{-O} and
8226 higher on architectures that support this.
8230 Perform dead code elimination (DCE) on RTL@.
8231 Enabled by default at @option{-O} and higher.
8235 Perform dead store elimination (DSE) on RTL@.
8236 Enabled by default at @option{-O} and higher.
8238 @item -fif-conversion
8239 @opindex fif-conversion
8240 Attempt to transform conditional jumps into branch-less equivalents. This
8241 includes use of conditional moves, min, max, set flags and abs instructions, and
8242 some tricks doable by standard arithmetics. The use of conditional execution
8243 on chips where it is available is controlled by @option{-fif-conversion2}.
8245 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8247 @item -fif-conversion2
8248 @opindex fif-conversion2
8249 Use conditional execution (where available) to transform conditional jumps into
8250 branch-less equivalents.
8252 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8254 @item -fdeclone-ctor-dtor
8255 @opindex fdeclone-ctor-dtor
8256 The C++ ABI requires multiple entry points for constructors and
8257 destructors: one for a base subobject, one for a complete object, and
8258 one for a virtual destructor that calls operator delete afterwards.
8259 For a hierarchy with virtual bases, the base and complete variants are
8260 clones, which means two copies of the function. With this option, the
8261 base and complete variants are changed to be thunks that call a common
8264 Enabled by @option{-Os}.
8266 @item -fdelete-null-pointer-checks
8267 @opindex fdelete-null-pointer-checks
8268 Assume that programs cannot safely dereference null pointers, and that
8269 no code or data element resides at address zero.
8270 This option enables simple constant
8271 folding optimizations at all optimization levels. In addition, other
8272 optimization passes in GCC use this flag to control global dataflow
8273 analyses that eliminate useless checks for null pointers; these assume
8274 that a memory access to address zero always results in a trap, so
8275 that if a pointer is checked after it has already been dereferenced,
8278 Note however that in some environments this assumption is not true.
8279 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8280 for programs that depend on that behavior.
8282 This option is enabled by default on most targets. On Nios II ELF, it
8283 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8285 Passes that use the dataflow information
8286 are enabled independently at different optimization levels.
8288 @item -fdevirtualize
8289 @opindex fdevirtualize
8290 Attempt to convert calls to virtual functions to direct calls. This
8291 is done both within a procedure and interprocedurally as part of
8292 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8293 propagation (@option{-fipa-cp}).
8294 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8296 @item -fdevirtualize-speculatively
8297 @opindex fdevirtualize-speculatively
8298 Attempt to convert calls to virtual functions to speculative direct calls.
8299 Based on the analysis of the type inheritance graph, determine for a given call
8300 the set of likely targets. If the set is small, preferably of size 1, change
8301 the call into a conditional deciding between direct and indirect calls. The
8302 speculative calls enable more optimizations, such as inlining. When they seem
8303 useless after further optimization, they are converted back into original form.
8305 @item -fdevirtualize-at-ltrans
8306 @opindex fdevirtualize-at-ltrans
8307 Stream extra information needed for aggressive devirtualization when running
8308 the link-time optimizer in local transformation mode.
8309 This option enables more devirtualization but
8310 significantly increases the size of streamed data. For this reason it is
8311 disabled by default.
8313 @item -fexpensive-optimizations
8314 @opindex fexpensive-optimizations
8315 Perform a number of minor optimizations that are relatively expensive.
8317 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8321 Attempt to remove redundant extension instructions. This is especially
8322 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8323 registers after writing to their lower 32-bit half.
8325 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8326 @option{-O3}, @option{-Os}.
8328 @item -fno-lifetime-dse
8329 @opindex fno-lifetime-dse
8330 In C++ the value of an object is only affected by changes within its
8331 lifetime: when the constructor begins, the object has an indeterminate
8332 value, and any changes during the lifetime of the object are dead when
8333 the object is destroyed. Normally dead store elimination will take
8334 advantage of this; if your code relies on the value of the object
8335 storage persisting beyond the lifetime of the object, you can use this
8336 flag to disable this optimization. To preserve stores before the
8337 constructor starts (e.g. because your operator new clears the object
8338 storage) but still treat the object as dead after the destructor you,
8339 can use @option{-flifetime-dse=1}. The default behavior can be
8340 explicitly selected with @option{-flifetime-dse=2}.
8341 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8343 @item -flive-range-shrinkage
8344 @opindex flive-range-shrinkage
8345 Attempt to decrease register pressure through register live range
8346 shrinkage. This is helpful for fast processors with small or moderate
8349 @item -fira-algorithm=@var{algorithm}
8350 @opindex fira-algorithm
8351 Use the specified coloring algorithm for the integrated register
8352 allocator. The @var{algorithm} argument can be @samp{priority}, which
8353 specifies Chow's priority coloring, or @samp{CB}, which specifies
8354 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8355 for all architectures, but for those targets that do support it, it is
8356 the default because it generates better code.
8358 @item -fira-region=@var{region}
8359 @opindex fira-region
8360 Use specified regions for the integrated register allocator. The
8361 @var{region} argument should be one of the following:
8366 Use all loops as register allocation regions.
8367 This can give the best results for machines with a small and/or
8368 irregular register set.
8371 Use all loops except for loops with small register pressure
8372 as the regions. This value usually gives
8373 the best results in most cases and for most architectures,
8374 and is enabled by default when compiling with optimization for speed
8375 (@option{-O}, @option{-O2}, @dots{}).
8378 Use all functions as a single region.
8379 This typically results in the smallest code size, and is enabled by default for
8380 @option{-Os} or @option{-O0}.
8384 @item -fira-hoist-pressure
8385 @opindex fira-hoist-pressure
8386 Use IRA to evaluate register pressure in the code hoisting pass for
8387 decisions to hoist expressions. This option usually results in smaller
8388 code, but it can slow the compiler down.
8390 This option is enabled at level @option{-Os} for all targets.
8392 @item -fira-loop-pressure
8393 @opindex fira-loop-pressure
8394 Use IRA to evaluate register pressure in loops for decisions to move
8395 loop invariants. This option usually results in generation
8396 of faster and smaller code on machines with large register files (>= 32
8397 registers), but it can slow the compiler down.
8399 This option is enabled at level @option{-O3} for some targets.
8401 @item -fno-ira-share-save-slots
8402 @opindex fno-ira-share-save-slots
8403 Disable sharing of stack slots used for saving call-used hard
8404 registers living through a call. Each hard register gets a
8405 separate stack slot, and as a result function stack frames are
8408 @item -fno-ira-share-spill-slots
8409 @opindex fno-ira-share-spill-slots
8410 Disable sharing of stack slots allocated for pseudo-registers. Each
8411 pseudo-register that does not get a hard register gets a separate
8412 stack slot, and as a result function stack frames are larger.
8416 Enable CFG-sensitive rematerialization in LRA. Instead of loading
8417 values of spilled pseudos, LRA tries to rematerialize (recalculate)
8418 values if it is profitable.
8420 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8422 @item -fdelayed-branch
8423 @opindex fdelayed-branch
8424 If supported for the target machine, attempt to reorder instructions
8425 to exploit instruction slots available after delayed branch
8428 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8430 @item -fschedule-insns
8431 @opindex fschedule-insns
8432 If supported for the target machine, attempt to reorder instructions to
8433 eliminate execution stalls due to required data being unavailable. This
8434 helps machines that have slow floating point or memory load instructions
8435 by allowing other instructions to be issued until the result of the load
8436 or floating-point instruction is required.
8438 Enabled at levels @option{-O2}, @option{-O3}.
8440 @item -fschedule-insns2
8441 @opindex fschedule-insns2
8442 Similar to @option{-fschedule-insns}, but requests an additional pass of
8443 instruction scheduling after register allocation has been done. This is
8444 especially useful on machines with a relatively small number of
8445 registers and where memory load instructions take more than one cycle.
8447 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8449 @item -fno-sched-interblock
8450 @opindex fno-sched-interblock
8451 Don't schedule instructions across basic blocks. This is normally
8452 enabled by default when scheduling before register allocation, i.e.@:
8453 with @option{-fschedule-insns} or at @option{-O2} or higher.
8455 @item -fno-sched-spec
8456 @opindex fno-sched-spec
8457 Don't allow speculative motion of non-load instructions. This is normally
8458 enabled by default when scheduling before register allocation, i.e.@:
8459 with @option{-fschedule-insns} or at @option{-O2} or higher.
8461 @item -fsched-pressure
8462 @opindex fsched-pressure
8463 Enable register pressure sensitive insn scheduling before register
8464 allocation. This only makes sense when scheduling before register
8465 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
8466 @option{-O2} or higher. Usage of this option can improve the
8467 generated code and decrease its size by preventing register pressure
8468 increase above the number of available hard registers and subsequent
8469 spills in register allocation.
8471 @item -fsched-spec-load
8472 @opindex fsched-spec-load
8473 Allow speculative motion of some load instructions. This only makes
8474 sense when scheduling before register allocation, i.e.@: with
8475 @option{-fschedule-insns} or at @option{-O2} or higher.
8477 @item -fsched-spec-load-dangerous
8478 @opindex fsched-spec-load-dangerous
8479 Allow speculative motion of more load instructions. This only makes
8480 sense when scheduling before register allocation, i.e.@: with
8481 @option{-fschedule-insns} or at @option{-O2} or higher.
8483 @item -fsched-stalled-insns
8484 @itemx -fsched-stalled-insns=@var{n}
8485 @opindex fsched-stalled-insns
8486 Define how many insns (if any) can be moved prematurely from the queue
8487 of stalled insns into the ready list during the second scheduling pass.
8488 @option{-fno-sched-stalled-insns} means that no insns are moved
8489 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
8490 on how many queued insns can be moved prematurely.
8491 @option{-fsched-stalled-insns} without a value is equivalent to
8492 @option{-fsched-stalled-insns=1}.
8494 @item -fsched-stalled-insns-dep
8495 @itemx -fsched-stalled-insns-dep=@var{n}
8496 @opindex fsched-stalled-insns-dep
8497 Define how many insn groups (cycles) are examined for a dependency
8498 on a stalled insn that is a candidate for premature removal from the queue
8499 of stalled insns. This has an effect only during the second scheduling pass,
8500 and only if @option{-fsched-stalled-insns} is used.
8501 @option{-fno-sched-stalled-insns-dep} is equivalent to
8502 @option{-fsched-stalled-insns-dep=0}.
8503 @option{-fsched-stalled-insns-dep} without a value is equivalent to
8504 @option{-fsched-stalled-insns-dep=1}.
8506 @item -fsched2-use-superblocks
8507 @opindex fsched2-use-superblocks
8508 When scheduling after register allocation, use superblock scheduling.
8509 This allows motion across basic block boundaries,
8510 resulting in faster schedules. This option is experimental, as not all machine
8511 descriptions used by GCC model the CPU closely enough to avoid unreliable
8512 results from the algorithm.
8514 This only makes sense when scheduling after register allocation, i.e.@: with
8515 @option{-fschedule-insns2} or at @option{-O2} or higher.
8517 @item -fsched-group-heuristic
8518 @opindex fsched-group-heuristic
8519 Enable the group heuristic in the scheduler. This heuristic favors
8520 the instruction that belongs to a schedule group. This is enabled
8521 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8522 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8524 @item -fsched-critical-path-heuristic
8525 @opindex fsched-critical-path-heuristic
8526 Enable the critical-path heuristic in the scheduler. This heuristic favors
8527 instructions on the critical path. This is enabled by default when
8528 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8529 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8531 @item -fsched-spec-insn-heuristic
8532 @opindex fsched-spec-insn-heuristic
8533 Enable the speculative instruction heuristic in the scheduler. This
8534 heuristic favors speculative instructions with greater dependency weakness.
8535 This is enabled by default when scheduling is enabled, i.e.@:
8536 with @option{-fschedule-insns} or @option{-fschedule-insns2}
8537 or at @option{-O2} or higher.
8539 @item -fsched-rank-heuristic
8540 @opindex fsched-rank-heuristic
8541 Enable the rank heuristic in the scheduler. This heuristic favors
8542 the instruction belonging to a basic block with greater size or frequency.
8543 This is enabled by default when scheduling is enabled, i.e.@:
8544 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8545 at @option{-O2} or higher.
8547 @item -fsched-last-insn-heuristic
8548 @opindex fsched-last-insn-heuristic
8549 Enable the last-instruction heuristic in the scheduler. This heuristic
8550 favors the instruction that is less dependent on the last instruction
8551 scheduled. This is enabled by default when scheduling is enabled,
8552 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8553 at @option{-O2} or higher.
8555 @item -fsched-dep-count-heuristic
8556 @opindex fsched-dep-count-heuristic
8557 Enable the dependent-count heuristic in the scheduler. This heuristic
8558 favors the instruction that has more instructions depending on it.
8559 This is enabled by default when scheduling is enabled, i.e.@:
8560 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8561 at @option{-O2} or higher.
8563 @item -freschedule-modulo-scheduled-loops
8564 @opindex freschedule-modulo-scheduled-loops
8565 Modulo scheduling is performed before traditional scheduling. If a loop
8566 is modulo scheduled, later scheduling passes may change its schedule.
8567 Use this option to control that behavior.
8569 @item -fselective-scheduling
8570 @opindex fselective-scheduling
8571 Schedule instructions using selective scheduling algorithm. Selective
8572 scheduling runs instead of the first scheduler pass.
8574 @item -fselective-scheduling2
8575 @opindex fselective-scheduling2
8576 Schedule instructions using selective scheduling algorithm. Selective
8577 scheduling runs instead of the second scheduler pass.
8579 @item -fsel-sched-pipelining
8580 @opindex fsel-sched-pipelining
8581 Enable software pipelining of innermost loops during selective scheduling.
8582 This option has no effect unless one of @option{-fselective-scheduling} or
8583 @option{-fselective-scheduling2} is turned on.
8585 @item -fsel-sched-pipelining-outer-loops
8586 @opindex fsel-sched-pipelining-outer-loops
8587 When pipelining loops during selective scheduling, also pipeline outer loops.
8588 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
8590 @item -fsemantic-interposition
8591 @opindex fsemantic-interposition
8592 Some object formats, like ELF, allow interposing of symbols by the
8594 This means that for symbols exported from the DSO, the compiler cannot perform
8595 interprocedural propagation, inlining and other optimizations in anticipation
8596 that the function or variable in question may change. While this feature is
8597 useful, for example, to rewrite memory allocation functions by a debugging
8598 implementation, it is expensive in the terms of code quality.
8599 With @option{-fno-semantic-interposition} the compiler assumes that
8600 if interposition happens for functions the overwriting function will have
8601 precisely the same semantics (and side effects).
8602 Similarly if interposition happens
8603 for variables, the constructor of the variable will be the same. The flag
8604 has no effect for functions explicitly declared inline
8605 (where it is never allowed for interposition to change semantics)
8606 and for symbols explicitly declared weak.
8609 @opindex fshrink-wrap
8610 Emit function prologues only before parts of the function that need it,
8611 rather than at the top of the function. This flag is enabled by default at
8612 @option{-O} and higher.
8614 @item -fshrink-wrap-separate
8615 @opindex fshrink-wrap-separate
8616 Shrink-wrap separate parts of the prologue and epilogue separately, so that
8617 those parts are only executed when needed.
8618 This option is on by default, but has no effect unless @option{-fshrink-wrap}
8619 is also turned on and the target supports this.
8621 @item -fcaller-saves
8622 @opindex fcaller-saves
8623 Enable allocation of values to registers that are clobbered by
8624 function calls, by emitting extra instructions to save and restore the
8625 registers around such calls. Such allocation is done only when it
8626 seems to result in better code.
8628 This option is always enabled by default on certain machines, usually
8629 those which have no call-preserved registers to use instead.
8631 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8633 @item -fcombine-stack-adjustments
8634 @opindex fcombine-stack-adjustments
8635 Tracks stack adjustments (pushes and pops) and stack memory references
8636 and then tries to find ways to combine them.
8638 Enabled by default at @option{-O1} and higher.
8642 Use caller save registers for allocation if those registers are not used by
8643 any called function. In that case it is not necessary to save and restore
8644 them around calls. This is only possible if called functions are part of
8645 same compilation unit as current function and they are compiled before it.
8647 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
8648 is disabled if generated code will be instrumented for profiling
8649 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
8650 exactly (this happens on targets that do not expose prologues
8651 and epilogues in RTL).
8653 @item -fconserve-stack
8654 @opindex fconserve-stack
8655 Attempt to minimize stack usage. The compiler attempts to use less
8656 stack space, even if that makes the program slower. This option
8657 implies setting the @option{large-stack-frame} parameter to 100
8658 and the @option{large-stack-frame-growth} parameter to 400.
8660 @item -ftree-reassoc
8661 @opindex ftree-reassoc
8662 Perform reassociation on trees. This flag is enabled by default
8663 at @option{-O} and higher.
8665 @item -fcode-hoisting
8666 @opindex fcode-hoisting
8667 Perform code hoisting. Code hoisting tries to move the
8668 evaluation of expressions executed on all paths to the function exit
8669 as early as possible. This is especially useful as a code size
8670 optimization, but it often helps for code speed as well.
8671 This flag is enabled by default at @option{-O2} and higher.
8675 Perform partial redundancy elimination (PRE) on trees. This flag is
8676 enabled by default at @option{-O2} and @option{-O3}.
8678 @item -ftree-partial-pre
8679 @opindex ftree-partial-pre
8680 Make partial redundancy elimination (PRE) more aggressive. This flag is
8681 enabled by default at @option{-O3}.
8683 @item -ftree-forwprop
8684 @opindex ftree-forwprop
8685 Perform forward propagation on trees. This flag is enabled by default
8686 at @option{-O} and higher.
8690 Perform full redundancy elimination (FRE) on trees. The difference
8691 between FRE and PRE is that FRE only considers expressions
8692 that are computed on all paths leading to the redundant computation.
8693 This analysis is faster than PRE, though it exposes fewer redundancies.
8694 This flag is enabled by default at @option{-O} and higher.
8696 @item -ftree-phiprop
8697 @opindex ftree-phiprop
8698 Perform hoisting of loads from conditional pointers on trees. This
8699 pass is enabled by default at @option{-O} and higher.
8701 @item -fhoist-adjacent-loads
8702 @opindex fhoist-adjacent-loads
8703 Speculatively hoist loads from both branches of an if-then-else if the
8704 loads are from adjacent locations in the same structure and the target
8705 architecture has a conditional move instruction. This flag is enabled
8706 by default at @option{-O2} and higher.
8708 @item -ftree-copy-prop
8709 @opindex ftree-copy-prop
8710 Perform copy propagation on trees. This pass eliminates unnecessary
8711 copy operations. This flag is enabled by default at @option{-O} and
8714 @item -fipa-pure-const
8715 @opindex fipa-pure-const
8716 Discover which functions are pure or constant.
8717 Enabled by default at @option{-O} and higher.
8719 @item -fipa-reference
8720 @opindex fipa-reference
8721 Discover which static variables do not escape the
8723 Enabled by default at @option{-O} and higher.
8727 Perform interprocedural pointer analysis and interprocedural modification
8728 and reference analysis. This option can cause excessive memory and
8729 compile-time usage on large compilation units. It is not enabled by
8730 default at any optimization level.
8733 @opindex fipa-profile
8734 Perform interprocedural profile propagation. The functions called only from
8735 cold functions are marked as cold. Also functions executed once (such as
8736 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
8737 functions and loop less parts of functions executed once are then optimized for
8739 Enabled by default at @option{-O} and higher.
8743 Perform interprocedural constant propagation.
8744 This optimization analyzes the program to determine when values passed
8745 to functions are constants and then optimizes accordingly.
8746 This optimization can substantially increase performance
8747 if the application has constants passed to functions.
8748 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
8750 @item -fipa-cp-clone
8751 @opindex fipa-cp-clone
8752 Perform function cloning to make interprocedural constant propagation stronger.
8753 When enabled, interprocedural constant propagation performs function cloning
8754 when externally visible function can be called with constant arguments.
8755 Because this optimization can create multiple copies of functions,
8756 it may significantly increase code size
8757 (see @option{--param ipcp-unit-growth=@var{value}}).
8758 This flag is enabled by default at @option{-O3}.
8761 @opindex -fipa-bit-cp
8762 When enabled, perform interprocedural bitwise constant
8763 propagation. This flag is enabled by default at @option{-O2}. It
8764 requires that @option{-fipa-cp} is enabled.
8768 When enabled, perform interprocedural propagation of value
8769 ranges. This flag is enabled by default at @option{-O2}. It requires
8770 that @option{-fipa-cp} is enabled.
8774 Perform Identical Code Folding for functions and read-only variables.
8775 The optimization reduces code size and may disturb unwind stacks by replacing
8776 a function by equivalent one with a different name. The optimization works
8777 more effectively with link-time optimization enabled.
8779 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
8780 works on different levels and thus the optimizations are not same - there are
8781 equivalences that are found only by GCC and equivalences found only by Gold.
8783 This flag is enabled by default at @option{-O2} and @option{-Os}.
8785 @item -fisolate-erroneous-paths-dereference
8786 @opindex fisolate-erroneous-paths-dereference
8787 Detect paths that trigger erroneous or undefined behavior due to
8788 dereferencing a null pointer. Isolate those paths from the main control
8789 flow and turn the statement with erroneous or undefined behavior into a trap.
8790 This flag is enabled by default at @option{-O2} and higher and depends on
8791 @option{-fdelete-null-pointer-checks} also being enabled.
8793 @item -fisolate-erroneous-paths-attribute
8794 @opindex fisolate-erroneous-paths-attribute
8795 Detect paths that trigger erroneous or undefined behavior due to a null value
8796 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
8797 attribute. Isolate those paths from the main control flow and turn the
8798 statement with erroneous or undefined behavior into a trap. This is not
8799 currently enabled, but may be enabled by @option{-O2} in the future.
8803 Perform forward store motion on trees. This flag is
8804 enabled by default at @option{-O} and higher.
8806 @item -ftree-bit-ccp
8807 @opindex ftree-bit-ccp
8808 Perform sparse conditional bit constant propagation on trees and propagate
8809 pointer alignment information.
8810 This pass only operates on local scalar variables and is enabled by default
8811 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
8815 Perform sparse conditional constant propagation (CCP) on trees. This
8816 pass only operates on local scalar variables and is enabled by default
8817 at @option{-O} and higher.
8819 @item -fssa-backprop
8820 @opindex fssa-backprop
8821 Propagate information about uses of a value up the definition chain
8822 in order to simplify the definitions. For example, this pass strips
8823 sign operations if the sign of a value never matters. The flag is
8824 enabled by default at @option{-O} and higher.
8827 @opindex fssa-phiopt
8828 Perform pattern matching on SSA PHI nodes to optimize conditional
8829 code. This pass is enabled by default at @option{-O} and higher.
8831 @item -ftree-switch-conversion
8832 @opindex ftree-switch-conversion
8833 Perform conversion of simple initializations in a switch to
8834 initializations from a scalar array. This flag is enabled by default
8835 at @option{-O2} and higher.
8837 @item -ftree-tail-merge
8838 @opindex ftree-tail-merge
8839 Look for identical code sequences. When found, replace one with a jump to the
8840 other. This optimization is known as tail merging or cross jumping. This flag
8841 is enabled by default at @option{-O2} and higher. The compilation time
8843 be limited using @option{max-tail-merge-comparisons} parameter and
8844 @option{max-tail-merge-iterations} parameter.
8848 Perform dead code elimination (DCE) on trees. This flag is enabled by
8849 default at @option{-O} and higher.
8851 @item -ftree-builtin-call-dce
8852 @opindex ftree-builtin-call-dce
8853 Perform conditional dead code elimination (DCE) for calls to built-in functions
8854 that may set @code{errno} but are otherwise free of side effects. This flag is
8855 enabled by default at @option{-O2} and higher if @option{-Os} is not also
8858 @item -ftree-dominator-opts
8859 @opindex ftree-dominator-opts
8860 Perform a variety of simple scalar cleanups (constant/copy
8861 propagation, redundancy elimination, range propagation and expression
8862 simplification) based on a dominator tree traversal. This also
8863 performs jump threading (to reduce jumps to jumps). This flag is
8864 enabled by default at @option{-O} and higher.
8868 Perform dead store elimination (DSE) on trees. A dead store is a store into
8869 a memory location that is later overwritten by another store without
8870 any intervening loads. In this case the earlier store can be deleted. This
8871 flag is enabled by default at @option{-O} and higher.
8875 Perform loop header copying on trees. This is beneficial since it increases
8876 effectiveness of code motion optimizations. It also saves one jump. This flag
8877 is enabled by default at @option{-O} and higher. It is not enabled
8878 for @option{-Os}, since it usually increases code size.
8880 @item -ftree-loop-optimize
8881 @opindex ftree-loop-optimize
8882 Perform loop optimizations on trees. This flag is enabled by default
8883 at @option{-O} and higher.
8885 @item -ftree-loop-linear
8886 @itemx -floop-strip-mine
8888 @opindex ftree-loop-linear
8889 @opindex floop-strip-mine
8890 @opindex floop-block
8891 Perform loop nest optimizations. Same as
8892 @option{-floop-nest-optimize}. To use this code transformation, GCC has
8893 to be configured with @option{--with-isl} to enable the Graphite loop
8894 transformation infrastructure.
8896 @item -fgraphite-identity
8897 @opindex fgraphite-identity
8898 Enable the identity transformation for graphite. For every SCoP we generate
8899 the polyhedral representation and transform it back to gimple. Using
8900 @option{-fgraphite-identity} we can check the costs or benefits of the
8901 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
8902 are also performed by the code generator isl, like index splitting and
8903 dead code elimination in loops.
8905 @item -floop-nest-optimize
8906 @opindex floop-nest-optimize
8907 Enable the isl based loop nest optimizer. This is a generic loop nest
8908 optimizer based on the Pluto optimization algorithms. It calculates a loop
8909 structure optimized for data-locality and parallelism. This option
8912 @item -floop-parallelize-all
8913 @opindex floop-parallelize-all
8914 Use the Graphite data dependence analysis to identify loops that can
8915 be parallelized. Parallelize all the loops that can be analyzed to
8916 not contain loop carried dependences without checking that it is
8917 profitable to parallelize the loops.
8919 @item -ftree-coalesce-vars
8920 @opindex ftree-coalesce-vars
8921 While transforming the program out of the SSA representation, attempt to
8922 reduce copying by coalescing versions of different user-defined
8923 variables, instead of just compiler temporaries. This may severely
8924 limit the ability to debug an optimized program compiled with
8925 @option{-fno-var-tracking-assignments}. In the negated form, this flag
8926 prevents SSA coalescing of user variables. This option is enabled by
8927 default if optimization is enabled, and it does very little otherwise.
8929 @item -ftree-loop-if-convert
8930 @opindex ftree-loop-if-convert
8931 Attempt to transform conditional jumps in the innermost loops to
8932 branch-less equivalents. The intent is to remove control-flow from
8933 the innermost loops in order to improve the ability of the
8934 vectorization pass to handle these loops. This is enabled by default
8935 if vectorization is enabled.
8937 @item -ftree-loop-distribution
8938 @opindex ftree-loop-distribution
8939 Perform loop distribution. This flag can improve cache performance on
8940 big loop bodies and allow further loop optimizations, like
8941 parallelization or vectorization, to take place. For example, the loop
8958 @item -ftree-loop-distribute-patterns
8959 @opindex ftree-loop-distribute-patterns
8960 Perform loop distribution of patterns that can be code generated with
8961 calls to a library. This flag is enabled by default at @option{-O3}.
8963 This pass distributes the initialization loops and generates a call to
8964 memset zero. For example, the loop
8980 and the initialization loop is transformed into a call to memset zero.
8982 @item -floop-interchange
8983 @opindex floop-interchange
8984 Perform loop interchange outside of graphite. This flag can improve cache
8985 performance on loop nest and allow further loop optimizations, like
8986 vectorization, to take place. For example, the loop
8988 for (int i = 0; i < N; i++)
8989 for (int j = 0; j < N; j++)
8990 for (int k = 0; k < N; k++)
8991 c[i][j] = c[i][j] + a[i][k]*b[k][j];
8995 for (int i = 0; i < N; i++)
8996 for (int k = 0; k < N; k++)
8997 for (int j = 0; j < N; j++)
8998 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9000 This flag is enabled by default at @option{-O3}.
9002 @item -floop-unroll-and-jam
9003 @opindex floop-unroll-and-jam
9004 Apply unroll and jam transformations on feasible loops. In a loop
9005 nest this unrolls the outer loop by some factor and fuses the resulting
9006 multiple inner loops. This flag is enabled by default at @option{-O3}.
9008 @item -ftree-loop-im
9009 @opindex ftree-loop-im
9010 Perform loop invariant motion on trees. This pass moves only invariants that
9011 are hard to handle at RTL level (function calls, operations that expand to
9012 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9013 operands of conditions that are invariant out of the loop, so that we can use
9014 just trivial invariantness analysis in loop unswitching. The pass also includes
9017 @item -ftree-loop-ivcanon
9018 @opindex ftree-loop-ivcanon
9019 Create a canonical counter for number of iterations in loops for which
9020 determining number of iterations requires complicated analysis. Later
9021 optimizations then may determine the number easily. Useful especially
9022 in connection with unrolling.
9026 Perform induction variable optimizations (strength reduction, induction
9027 variable merging and induction variable elimination) on trees.
9029 @item -ftree-parallelize-loops=n
9030 @opindex ftree-parallelize-loops
9031 Parallelize loops, i.e., split their iteration space to run in n threads.
9032 This is only possible for loops whose iterations are independent
9033 and can be arbitrarily reordered. The optimization is only
9034 profitable on multiprocessor machines, for loops that are CPU-intensive,
9035 rather than constrained e.g.@: by memory bandwidth. This option
9036 implies @option{-pthread}, and thus is only supported on targets
9037 that have support for @option{-pthread}.
9041 Perform function-local points-to analysis on trees. This flag is
9042 enabled by default at @option{-O} and higher.
9046 Perform scalar replacement of aggregates. This pass replaces structure
9047 references with scalars to prevent committing structures to memory too
9048 early. This flag is enabled by default at @option{-O} and higher.
9050 @item -fstore-merging
9051 @opindex fstore-merging
9052 Perform merging of narrow stores to consecutive memory addresses. This pass
9053 merges contiguous stores of immediate values narrower than a word into fewer
9054 wider stores to reduce the number of instructions. This is enabled by default
9055 at @option{-O2} and higher as well as @option{-Os}.
9059 Perform temporary expression replacement during the SSA->normal phase. Single
9060 use/single def temporaries are replaced at their use location with their
9061 defining expression. This results in non-GIMPLE code, but gives the expanders
9062 much more complex trees to work on resulting in better RTL generation. This is
9063 enabled by default at @option{-O} and higher.
9067 Perform straight-line strength reduction on trees. This recognizes related
9068 expressions involving multiplications and replaces them by less expensive
9069 calculations when possible. This is enabled by default at @option{-O} and
9072 @item -ftree-vectorize
9073 @opindex ftree-vectorize
9074 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9075 and @option{-ftree-slp-vectorize} if not explicitly specified.
9077 @item -ftree-loop-vectorize
9078 @opindex ftree-loop-vectorize
9079 Perform loop vectorization on trees. This flag is enabled by default at
9080 @option{-O3} and when @option{-ftree-vectorize} is enabled.
9082 @item -ftree-slp-vectorize
9083 @opindex ftree-slp-vectorize
9084 Perform basic block vectorization on trees. This flag is enabled by default at
9085 @option{-O3} and when @option{-ftree-vectorize} is enabled.
9087 @item -fvect-cost-model=@var{model}
9088 @opindex fvect-cost-model
9089 Alter the cost model used for vectorization. The @var{model} argument
9090 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9091 With the @samp{unlimited} model the vectorized code-path is assumed
9092 to be profitable while with the @samp{dynamic} model a runtime check
9093 guards the vectorized code-path to enable it only for iteration
9094 counts that will likely execute faster than when executing the original
9095 scalar loop. The @samp{cheap} model disables vectorization of
9096 loops where doing so would be cost prohibitive for example due to
9097 required runtime checks for data dependence or alignment but otherwise
9098 is equal to the @samp{dynamic} model.
9099 The default cost model depends on other optimization flags and is
9100 either @samp{dynamic} or @samp{cheap}.
9102 @item -fsimd-cost-model=@var{model}
9103 @opindex fsimd-cost-model
9104 Alter the cost model used for vectorization of loops marked with the OpenMP
9105 simd directive. The @var{model} argument should be one of
9106 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9107 have the same meaning as described in @option{-fvect-cost-model} and by
9108 default a cost model defined with @option{-fvect-cost-model} is used.
9112 Perform Value Range Propagation on trees. This is similar to the
9113 constant propagation pass, but instead of values, ranges of values are
9114 propagated. This allows the optimizers to remove unnecessary range
9115 checks like array bound checks and null pointer checks. This is
9116 enabled by default at @option{-O2} and higher. Null pointer check
9117 elimination is only done if @option{-fdelete-null-pointer-checks} is
9121 @opindex fsplit-paths
9122 Split paths leading to loop backedges. This can improve dead code
9123 elimination and common subexpression elimination. This is enabled by
9124 default at @option{-O2} and above.
9126 @item -fsplit-ivs-in-unroller
9127 @opindex fsplit-ivs-in-unroller
9128 Enables expression of values of induction variables in later iterations
9129 of the unrolled loop using the value in the first iteration. This breaks
9130 long dependency chains, thus improving efficiency of the scheduling passes.
9132 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9133 same effect. However, that is not reliable in cases where the loop body
9134 is more complicated than a single basic block. It also does not work at all
9135 on some architectures due to restrictions in the CSE pass.
9137 This optimization is enabled by default.
9139 @item -fvariable-expansion-in-unroller
9140 @opindex fvariable-expansion-in-unroller
9141 With this option, the compiler creates multiple copies of some
9142 local variables when unrolling a loop, which can result in superior code.
9144 @item -fpartial-inlining
9145 @opindex fpartial-inlining
9146 Inline parts of functions. This option has any effect only
9147 when inlining itself is turned on by the @option{-finline-functions}
9148 or @option{-finline-small-functions} options.
9150 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9152 @item -fpredictive-commoning
9153 @opindex fpredictive-commoning
9154 Perform predictive commoning optimization, i.e., reusing computations
9155 (especially memory loads and stores) performed in previous
9156 iterations of loops.
9158 This option is enabled at level @option{-O3}.
9160 @item -fprefetch-loop-arrays
9161 @opindex fprefetch-loop-arrays
9162 If supported by the target machine, generate instructions to prefetch
9163 memory to improve the performance of loops that access large arrays.
9165 This option may generate better or worse code; results are highly
9166 dependent on the structure of loops within the source code.
9168 Disabled at level @option{-Os}.
9170 @item -fno-printf-return-value
9171 @opindex fno-printf-return-value
9172 Do not substitute constants for known return value of formatted output
9173 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9174 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9175 transformation allows GCC to optimize or even eliminate branches based
9176 on the known return value of these functions called with arguments that
9177 are either constant, or whose values are known to be in a range that
9178 makes determining the exact return value possible. For example, when
9179 @option{-fprintf-return-value} is in effect, both the branch and the
9180 body of the @code{if} statement (but not the call to @code{snprint})
9181 can be optimized away when @code{i} is a 32-bit or smaller integer
9182 because the return value is guaranteed to be at most 8.
9186 if (snprintf (buf, "%08x", i) >= sizeof buf)
9190 The @option{-fprintf-return-value} option relies on other optimizations
9191 and yields best results with @option{-O2} and above. It works in tandem
9192 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9193 options. The @option{-fprintf-return-value} option is enabled by default.
9196 @itemx -fno-peephole2
9197 @opindex fno-peephole
9198 @opindex fno-peephole2
9199 Disable any machine-specific peephole optimizations. The difference
9200 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9201 are implemented in the compiler; some targets use one, some use the
9202 other, a few use both.
9204 @option{-fpeephole} is enabled by default.
9205 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9207 @item -fno-guess-branch-probability
9208 @opindex fno-guess-branch-probability
9209 Do not guess branch probabilities using heuristics.
9211 GCC uses heuristics to guess branch probabilities if they are
9212 not provided by profiling feedback (@option{-fprofile-arcs}). These
9213 heuristics are based on the control flow graph. If some branch probabilities
9214 are specified by @code{__builtin_expect}, then the heuristics are
9215 used to guess branch probabilities for the rest of the control flow graph,
9216 taking the @code{__builtin_expect} info into account. The interactions
9217 between the heuristics and @code{__builtin_expect} can be complex, and in
9218 some cases, it may be useful to disable the heuristics so that the effects
9219 of @code{__builtin_expect} are easier to understand.
9221 It is also possible to specify expected probability of the expression
9222 with @code{__builtin_expect_with_probability} built-in function.
9224 The default is @option{-fguess-branch-probability} at levels
9225 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9227 @item -freorder-blocks
9228 @opindex freorder-blocks
9229 Reorder basic blocks in the compiled function in order to reduce number of
9230 taken branches and improve code locality.
9232 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9234 @item -freorder-blocks-algorithm=@var{algorithm}
9235 @opindex freorder-blocks-algorithm
9236 Use the specified algorithm for basic block reordering. The
9237 @var{algorithm} argument can be @samp{simple}, which does not increase
9238 code size (except sometimes due to secondary effects like alignment),
9239 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9240 put all often executed code together, minimizing the number of branches
9241 executed by making extra copies of code.
9243 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9244 @samp{stc} at levels @option{-O2}, @option{-O3}.
9246 @item -freorder-blocks-and-partition
9247 @opindex freorder-blocks-and-partition
9248 In addition to reordering basic blocks in the compiled function, in order
9249 to reduce number of taken branches, partitions hot and cold basic blocks
9250 into separate sections of the assembly and @file{.o} files, to improve
9251 paging and cache locality performance.
9253 This optimization is automatically turned off in the presence of
9254 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
9255 section attribute and on any architecture that does not support named
9256 sections. When @option{-fsplit-stack} is used this option is not
9257 enabled by default (to avoid linker errors), but may be enabled
9258 explicitly (if using a working linker).
9260 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
9262 @item -freorder-functions
9263 @opindex freorder-functions
9264 Reorder functions in the object file in order to
9265 improve code locality. This is implemented by using special
9266 subsections @code{.text.hot} for most frequently executed functions and
9267 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
9268 the linker so object file format must support named sections and linker must
9269 place them in a reasonable way.
9271 Also profile feedback must be available to make this option effective. See
9272 @option{-fprofile-arcs} for details.
9274 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9276 @item -fstrict-aliasing
9277 @opindex fstrict-aliasing
9278 Allow the compiler to assume the strictest aliasing rules applicable to
9279 the language being compiled. For C (and C++), this activates
9280 optimizations based on the type of expressions. In particular, an
9281 object of one type is assumed never to reside at the same address as an
9282 object of a different type, unless the types are almost the same. For
9283 example, an @code{unsigned int} can alias an @code{int}, but not a
9284 @code{void*} or a @code{double}. A character type may alias any other
9287 @anchor{Type-punning}Pay special attention to code like this:
9300 The practice of reading from a different union member than the one most
9301 recently written to (called ``type-punning'') is common. Even with
9302 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
9303 is accessed through the union type. So, the code above works as
9304 expected. @xref{Structures unions enumerations and bit-fields
9305 implementation}. However, this code might not:
9316 Similarly, access by taking the address, casting the resulting pointer
9317 and dereferencing the result has undefined behavior, even if the cast
9318 uses a union type, e.g.:
9322 return ((union a_union *) &d)->i;
9326 The @option{-fstrict-aliasing} option is enabled at levels
9327 @option{-O2}, @option{-O3}, @option{-Os}.
9329 @item -falign-functions
9330 @itemx -falign-functions=@var{n}
9331 @itemx -falign-functions=@var{n}:@var{m}
9332 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
9333 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
9334 @opindex falign-functions
9335 Align the start of functions to the next power-of-two greater than
9336 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
9337 the first @var{m} bytes of the function can be fetched by the CPU
9338 without crossing an @var{n}-byte alignment boundary.
9340 If @var{m} is not specified, it defaults to @var{n}.
9342 Examples: @option{-falign-functions=32} aligns functions to the next
9343 32-byte boundary, @option{-falign-functions=24} aligns to the next
9344 32-byte boundary only if this can be done by skipping 23 bytes or less,
9345 @option{-falign-functions=32:7} aligns to the next
9346 32-byte boundary only if this can be done by skipping 6 bytes or less.
9348 The second pair of @var{n2}:@var{m2} values allows you to specify
9349 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
9350 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
9351 otherwise aligns to the next 32-byte boundary if this can be done
9352 by skipping 2 bytes or less.
9353 If @var{m2} is not specified, it defaults to @var{n2}.
9355 Some assemblers only support this flag when @var{n} is a power of two;
9356 in that case, it is rounded up.
9358 @option{-fno-align-functions} and @option{-falign-functions=1} are
9359 equivalent and mean that functions are not aligned.
9361 If @var{n} is not specified or is zero, use a machine-dependent default.
9362 The maximum allowed @var{n} option value is 65536.
9364 Enabled at levels @option{-O2}, @option{-O3}.
9366 @item -flimit-function-alignment
9367 If this option is enabled, the compiler tries to avoid unnecessarily
9368 overaligning functions. It attempts to instruct the assembler to align
9369 by the amount specified by @option{-falign-functions}, but not to
9370 skip more bytes than the size of the function.
9372 @item -falign-labels
9373 @itemx -falign-labels=@var{n}
9374 @itemx -falign-labels=@var{n}:@var{m}
9375 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
9376 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
9377 @opindex falign-labels
9378 Align all branch targets to a power-of-two boundary.
9380 Parameters of this option are analogous to the @option{-falign-functions} option.
9381 @option{-fno-align-labels} and @option{-falign-labels=1} are
9382 equivalent and mean that labels are not aligned.
9384 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
9385 are greater than this value, then their values are used instead.
9387 If @var{n} is not specified or is zero, use a machine-dependent default
9388 which is very likely to be @samp{1}, meaning no alignment.
9389 The maximum allowed @var{n} option value is 65536.
9391 Enabled at levels @option{-O2}, @option{-O3}.
9394 @itemx -falign-loops=@var{n}
9395 @itemx -falign-loops=@var{n}:@var{m}
9396 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
9397 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
9398 @opindex falign-loops
9399 Align loops to a power-of-two boundary. If the loops are executed
9400 many times, this makes up for any execution of the dummy padding
9403 Parameters of this option are analogous to the @option{-falign-functions} option.
9404 @option{-fno-align-loops} and @option{-falign-loops=1} are
9405 equivalent and mean that loops are not aligned.
9406 The maximum allowed @var{n} option value is 65536.
9408 If @var{n} is not specified or is zero, use a machine-dependent default.
9410 Enabled at levels @option{-O2}, @option{-O3}.
9413 @itemx -falign-jumps=@var{n}
9414 @itemx -falign-jumps=@var{n}:@var{m}
9415 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
9416 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
9417 @opindex falign-jumps
9418 Align branch targets to a power-of-two boundary, for branch targets
9419 where the targets can only be reached by jumping. In this case,
9420 no dummy operations need be executed.
9422 Parameters of this option are analogous to the @option{-falign-functions} option.
9423 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
9424 equivalent and mean that loops are not aligned.
9426 If @var{n} is not specified or is zero, use a machine-dependent default.
9427 The maximum allowed @var{n} option value is 65536.
9429 Enabled at levels @option{-O2}, @option{-O3}.
9431 @item -funit-at-a-time
9432 @opindex funit-at-a-time
9433 This option is left for compatibility reasons. @option{-funit-at-a-time}
9434 has no effect, while @option{-fno-unit-at-a-time} implies
9435 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
9439 @item -fno-toplevel-reorder
9440 @opindex fno-toplevel-reorder
9441 Do not reorder top-level functions, variables, and @code{asm}
9442 statements. Output them in the same order that they appear in the
9443 input file. When this option is used, unreferenced static variables
9444 are not removed. This option is intended to support existing code
9445 that relies on a particular ordering. For new code, it is better to
9446 use attributes when possible.
9448 Enabled at level @option{-O0}. When disabled explicitly, it also implies
9449 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
9454 Constructs webs as commonly used for register allocation purposes and assign
9455 each web individual pseudo register. This allows the register allocation pass
9456 to operate on pseudos directly, but also strengthens several other optimization
9457 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
9458 however, make debugging impossible, since variables no longer stay in a
9461 Enabled by default with @option{-funroll-loops}.
9463 @item -fwhole-program
9464 @opindex fwhole-program
9465 Assume that the current compilation unit represents the whole program being
9466 compiled. All public functions and variables with the exception of @code{main}
9467 and those merged by attribute @code{externally_visible} become static functions
9468 and in effect are optimized more aggressively by interprocedural optimizers.
9470 This option should not be used in combination with @option{-flto}.
9471 Instead relying on a linker plugin should provide safer and more precise
9474 @item -flto[=@var{n}]
9476 This option runs the standard link-time optimizer. When invoked
9477 with source code, it generates GIMPLE (one of GCC's internal
9478 representations) and writes it to special ELF sections in the object
9479 file. When the object files are linked together, all the function
9480 bodies are read from these ELF sections and instantiated as if they
9481 had been part of the same translation unit.
9483 To use the link-time optimizer, @option{-flto} and optimization
9484 options should be specified at compile time and during the final link.
9485 It is recommended that you compile all the files participating in the
9486 same link with the same options and also specify those options at
9491 gcc -c -O2 -flto foo.c
9492 gcc -c -O2 -flto bar.c
9493 gcc -o myprog -flto -O2 foo.o bar.o
9496 The first two invocations to GCC save a bytecode representation
9497 of GIMPLE into special ELF sections inside @file{foo.o} and
9498 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
9499 @file{foo.o} and @file{bar.o}, merges the two files into a single
9500 internal image, and compiles the result as usual. Since both
9501 @file{foo.o} and @file{bar.o} are merged into a single image, this
9502 causes all the interprocedural analyses and optimizations in GCC to
9503 work across the two files as if they were a single one. This means,
9504 for example, that the inliner is able to inline functions in
9505 @file{bar.o} into functions in @file{foo.o} and vice-versa.
9507 Another (simpler) way to enable link-time optimization is:
9510 gcc -o myprog -flto -O2 foo.c bar.c
9513 The above generates bytecode for @file{foo.c} and @file{bar.c},
9514 merges them together into a single GIMPLE representation and optimizes
9515 them as usual to produce @file{myprog}.
9517 The only important thing to keep in mind is that to enable link-time
9518 optimizations you need to use the GCC driver to perform the link step.
9519 GCC then automatically performs link-time optimization if any of the
9520 objects involved were compiled with the @option{-flto} command-line option.
9522 should specify the optimization options to be used for link-time
9523 optimization though GCC tries to be clever at guessing an
9524 optimization level to use from the options used at compile time
9525 if you fail to specify one at link time. You can always override
9526 the automatic decision to do link-time optimization
9527 by passing @option{-fno-lto} to the link command.
9529 To make whole program optimization effective, it is necessary to make
9530 certain whole program assumptions. The compiler needs to know
9531 what functions and variables can be accessed by libraries and runtime
9532 outside of the link-time optimized unit. When supported by the linker,
9533 the linker plugin (see @option{-fuse-linker-plugin}) passes information
9534 to the compiler about used and externally visible symbols. When
9535 the linker plugin is not available, @option{-fwhole-program} should be
9536 used to allow the compiler to make these assumptions, which leads
9537 to more aggressive optimization decisions.
9539 When @option{-fuse-linker-plugin} is not enabled, when a file is
9540 compiled with @option{-flto}, the generated object file is larger than
9541 a regular object file because it contains GIMPLE bytecodes and the usual
9542 final code (see @option{-ffat-lto-objects}. This means that
9543 object files with LTO information can be linked as normal object
9544 files; if @option{-fno-lto} is passed to the linker, no
9545 interprocedural optimizations are applied. Note that when
9546 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
9547 but you cannot perform a regular, non-LTO link on them.
9549 Additionally, the optimization flags used to compile individual files
9550 are not necessarily related to those used at link time. For instance,
9553 gcc -c -O0 -ffat-lto-objects -flto foo.c
9554 gcc -c -O0 -ffat-lto-objects -flto bar.c
9555 gcc -o myprog -O3 foo.o bar.o
9558 This produces individual object files with unoptimized assembler
9559 code, but the resulting binary @file{myprog} is optimized at
9560 @option{-O3}. If, instead, the final binary is generated with
9561 @option{-fno-lto}, then @file{myprog} is not optimized.
9563 When producing the final binary, GCC only
9564 applies link-time optimizations to those files that contain bytecode.
9565 Therefore, you can mix and match object files and libraries with
9566 GIMPLE bytecodes and final object code. GCC automatically selects
9567 which files to optimize in LTO mode and which files to link without
9570 There are some code generation flags preserved by GCC when
9571 generating bytecodes, as they need to be used during the final link
9572 stage. Generally options specified at link time override those
9573 specified at compile time.
9575 If you do not specify an optimization level option @option{-O} at
9576 link time, then GCC uses the highest optimization level
9577 used when compiling the object files.
9579 Currently, the following options and their settings are taken from
9580 the first object file that explicitly specifies them:
9581 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
9582 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
9583 and all the @option{-m} target flags.
9585 Certain ABI-changing flags are required to match in all compilation units,
9586 and trying to override this at link time with a conflicting value
9587 is ignored. This includes options such as @option{-freg-struct-return}
9588 and @option{-fpcc-struct-return}.
9590 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
9591 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
9592 are passed through to the link stage and merged conservatively for
9593 conflicting translation units. Specifically
9594 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
9595 precedence; and for example @option{-ffp-contract=off} takes precedence
9596 over @option{-ffp-contract=fast}. You can override them at link time.
9598 If LTO encounters objects with C linkage declared with incompatible
9599 types in separate translation units to be linked together (undefined
9600 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
9601 issued. The behavior is still undefined at run time. Similar
9602 diagnostics may be raised for other languages.
9604 Another feature of LTO is that it is possible to apply interprocedural
9605 optimizations on files written in different languages:
9610 gfortran -c -flto baz.f90
9611 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
9614 Notice that the final link is done with @command{g++} to get the C++
9615 runtime libraries and @option{-lgfortran} is added to get the Fortran
9616 runtime libraries. In general, when mixing languages in LTO mode, you
9617 should use the same link command options as when mixing languages in a
9618 regular (non-LTO) compilation.
9620 If object files containing GIMPLE bytecode are stored in a library archive, say
9621 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
9622 are using a linker with plugin support. To create static libraries suitable
9623 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
9624 and @command{ranlib};
9625 to show the symbols of object files with GIMPLE bytecode, use
9626 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
9627 and @command{nm} have been compiled with plugin support. At link time, use the
9628 flag @option{-fuse-linker-plugin} to ensure that the library participates in
9629 the LTO optimization process:
9632 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
9635 With the linker plugin enabled, the linker extracts the needed
9636 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
9637 to make them part of the aggregated GIMPLE image to be optimized.
9639 If you are not using a linker with plugin support and/or do not
9640 enable the linker plugin, then the objects inside @file{libfoo.a}
9641 are extracted and linked as usual, but they do not participate
9642 in the LTO optimization process. In order to make a static library suitable
9643 for both LTO optimization and usual linkage, compile its object files with
9644 @option{-flto} @option{-ffat-lto-objects}.
9646 Link-time optimizations do not require the presence of the whole program to
9647 operate. If the program does not require any symbols to be exported, it is
9648 possible to combine @option{-flto} and @option{-fwhole-program} to allow
9649 the interprocedural optimizers to use more aggressive assumptions which may
9650 lead to improved optimization opportunities.
9651 Use of @option{-fwhole-program} is not needed when linker plugin is
9652 active (see @option{-fuse-linker-plugin}).
9654 The current implementation of LTO makes no
9655 attempt to generate bytecode that is portable between different
9656 types of hosts. The bytecode files are versioned and there is a
9657 strict version check, so bytecode files generated in one version of
9658 GCC do not work with an older or newer version of GCC.
9660 Link-time optimization does not work well with generation of debugging
9661 information on systems other than those using a combination of ELF and
9664 If you specify the optional @var{n}, the optimization and code
9665 generation done at link time is executed in parallel using @var{n}
9666 parallel jobs by utilizing an installed @command{make} program. The
9667 environment variable @env{MAKE} may be used to override the program
9668 used. The default value for @var{n} is 1.
9670 You can also specify @option{-flto=jobserver} to use GNU make's
9671 job server mode to determine the number of parallel jobs. This
9672 is useful when the Makefile calling GCC is already executing in parallel.
9673 You must prepend a @samp{+} to the command recipe in the parent Makefile
9674 for this to work. This option likely only works if @env{MAKE} is
9677 @item -flto-partition=@var{alg}
9678 @opindex flto-partition
9679 Specify the partitioning algorithm used by the link-time optimizer.
9680 The value is either @samp{1to1} to specify a partitioning mirroring
9681 the original source files or @samp{balanced} to specify partitioning
9682 into equally sized chunks (whenever possible) or @samp{max} to create
9683 new partition for every symbol where possible. Specifying @samp{none}
9684 as an algorithm disables partitioning and streaming completely.
9685 The default value is @samp{balanced}. While @samp{1to1} can be used
9686 as an workaround for various code ordering issues, the @samp{max}
9687 partitioning is intended for internal testing only.
9688 The value @samp{one} specifies that exactly one partition should be
9689 used while the value @samp{none} bypasses partitioning and executes
9690 the link-time optimization step directly from the WPA phase.
9692 @item -flto-odr-type-merging
9693 @opindex flto-odr-type-merging
9694 Enable streaming of mangled types names of C++ types and their unification
9695 at link time. This increases size of LTO object files, but enables
9696 diagnostics about One Definition Rule violations.
9698 @item -flto-compression-level=@var{n}
9699 @opindex flto-compression-level
9700 This option specifies the level of compression used for intermediate
9701 language written to LTO object files, and is only meaningful in
9702 conjunction with LTO mode (@option{-flto}). Valid
9703 values are 0 (no compression) to 9 (maximum compression). Values
9704 outside this range are clamped to either 0 or 9. If the option is not
9705 given, a default balanced compression setting is used.
9707 @item -fuse-linker-plugin
9708 @opindex fuse-linker-plugin
9709 Enables the use of a linker plugin during link-time optimization. This
9710 option relies on plugin support in the linker, which is available in gold
9711 or in GNU ld 2.21 or newer.
9713 This option enables the extraction of object files with GIMPLE bytecode out
9714 of library archives. This improves the quality of optimization by exposing
9715 more code to the link-time optimizer. This information specifies what
9716 symbols can be accessed externally (by non-LTO object or during dynamic
9717 linking). Resulting code quality improvements on binaries (and shared
9718 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
9719 See @option{-flto} for a description of the effect of this flag and how to
9722 This option is enabled by default when LTO support in GCC is enabled
9723 and GCC was configured for use with
9724 a linker supporting plugins (GNU ld 2.21 or newer or gold).
9726 @item -ffat-lto-objects
9727 @opindex ffat-lto-objects
9728 Fat LTO objects are object files that contain both the intermediate language
9729 and the object code. This makes them usable for both LTO linking and normal
9730 linking. This option is effective only when compiling with @option{-flto}
9731 and is ignored at link time.
9733 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
9734 requires the complete toolchain to be aware of LTO. It requires a linker with
9735 linker plugin support for basic functionality. Additionally,
9736 @command{nm}, @command{ar} and @command{ranlib}
9737 need to support linker plugins to allow a full-featured build environment
9738 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
9739 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
9740 to these tools. With non fat LTO makefiles need to be modified to use them.
9742 Note that modern binutils provide plugin auto-load mechanism.
9743 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
9744 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
9745 @command{gcc-ranlib}).
9747 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
9750 @item -fcompare-elim
9751 @opindex fcompare-elim
9752 After register allocation and post-register allocation instruction splitting,
9753 identify arithmetic instructions that compute processor flags similar to a
9754 comparison operation based on that arithmetic. If possible, eliminate the
9755 explicit comparison operation.
9757 This pass only applies to certain targets that cannot explicitly represent
9758 the comparison operation before register allocation is complete.
9760 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9762 @item -fcprop-registers
9763 @opindex fcprop-registers
9764 After register allocation and post-register allocation instruction splitting,
9765 perform a copy-propagation pass to try to reduce scheduling dependencies
9766 and occasionally eliminate the copy.
9768 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9770 @item -fprofile-correction
9771 @opindex fprofile-correction
9772 Profiles collected using an instrumented binary for multi-threaded programs may
9773 be inconsistent due to missed counter updates. When this option is specified,
9774 GCC uses heuristics to correct or smooth out such inconsistencies. By
9775 default, GCC emits an error message when an inconsistent profile is detected.
9778 @itemx -fprofile-use=@var{path}
9779 @opindex fprofile-use
9780 Enable profile feedback-directed optimizations,
9781 and the following optimizations
9782 which are generally profitable only with profile feedback available:
9783 @option{-fbranch-probabilities}, @option{-fvpt},
9784 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9785 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
9787 Before you can use this option, you must first generate profiling information.
9788 @xref{Instrumentation Options}, for information about the
9789 @option{-fprofile-generate} option.
9791 By default, GCC emits an error message if the feedback profiles do not
9792 match the source code. This error can be turned into a warning by using
9793 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
9796 If @var{path} is specified, GCC looks at the @var{path} to find
9797 the profile feedback data files. See @option{-fprofile-dir}.
9799 @item -fauto-profile
9800 @itemx -fauto-profile=@var{path}
9801 @opindex fauto-profile
9802 Enable sampling-based feedback-directed optimizations,
9803 and the following optimizations
9804 which are generally profitable only with profile feedback available:
9805 @option{-fbranch-probabilities}, @option{-fvpt},
9806 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9807 @option{-ftree-vectorize},
9808 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
9809 @option{-fpredictive-commoning}, @option{-funswitch-loops},
9810 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
9812 @var{path} is the name of a file containing AutoFDO profile information.
9813 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
9815 Producing an AutoFDO profile data file requires running your program
9816 with the @command{perf} utility on a supported GNU/Linux target system.
9817 For more information, see @uref{https://perf.wiki.kernel.org/}.
9821 perf record -e br_inst_retired:near_taken -b -o perf.data \
9825 Then use the @command{create_gcov} tool to convert the raw profile data
9826 to a format that can be used by GCC.@ You must also supply the
9827 unstripped binary for your program to this tool.
9828 See @uref{https://github.com/google/autofdo}.
9832 create_gcov --binary=your_program.unstripped --profile=perf.data \
9837 The following options control compiler behavior regarding floating-point
9838 arithmetic. These options trade off between speed and
9839 correctness. All must be specifically enabled.
9843 @opindex ffloat-store
9844 Do not store floating-point variables in registers, and inhibit other
9845 options that might change whether a floating-point value is taken from a
9848 @cindex floating-point precision
9849 This option prevents undesirable excess precision on machines such as
9850 the 68000 where the floating registers (of the 68881) keep more
9851 precision than a @code{double} is supposed to have. Similarly for the
9852 x86 architecture. For most programs, the excess precision does only
9853 good, but a few programs rely on the precise definition of IEEE floating
9854 point. Use @option{-ffloat-store} for such programs, after modifying
9855 them to store all pertinent intermediate computations into variables.
9857 @item -fexcess-precision=@var{style}
9858 @opindex fexcess-precision
9859 This option allows further control over excess precision on machines
9860 where floating-point operations occur in a format with more precision or
9861 range than the IEEE standard and interchange floating-point types. By
9862 default, @option{-fexcess-precision=fast} is in effect; this means that
9863 operations may be carried out in a wider precision than the types specified
9864 in the source if that would result in faster code, and it is unpredictable
9865 when rounding to the types specified in the source code takes place.
9866 When compiling C, if @option{-fexcess-precision=standard} is specified then
9867 excess precision follows the rules specified in ISO C99; in particular,
9868 both casts and assignments cause values to be rounded to their
9869 semantic types (whereas @option{-ffloat-store} only affects
9870 assignments). This option is enabled by default for C if a strict
9871 conformance option such as @option{-std=c99} is used.
9872 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
9873 regardless of whether a strict conformance option is used.
9876 @option{-fexcess-precision=standard} is not implemented for languages
9877 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
9878 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
9879 semantics apply without excess precision, and in the latter, rounding
9884 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
9885 @option{-ffinite-math-only}, @option{-fno-rounding-math},
9886 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
9887 @option{-fexcess-precision=fast}.
9889 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
9891 This option is not turned on by any @option{-O} option besides
9892 @option{-Ofast} since it can result in incorrect output for programs
9893 that depend on an exact implementation of IEEE or ISO rules/specifications
9894 for math functions. It may, however, yield faster code for programs
9895 that do not require the guarantees of these specifications.
9897 @item -fno-math-errno
9898 @opindex fno-math-errno
9899 Do not set @code{errno} after calling math functions that are executed
9900 with a single instruction, e.g., @code{sqrt}. A program that relies on
9901 IEEE exceptions for math error handling may want to use this flag
9902 for speed while maintaining IEEE arithmetic compatibility.
9904 This option is not turned on by any @option{-O} option since
9905 it can result in incorrect output for programs that depend on
9906 an exact implementation of IEEE or ISO rules/specifications for
9907 math functions. It may, however, yield faster code for programs
9908 that do not require the guarantees of these specifications.
9910 The default is @option{-fmath-errno}.
9912 On Darwin systems, the math library never sets @code{errno}. There is
9913 therefore no reason for the compiler to consider the possibility that
9914 it might, and @option{-fno-math-errno} is the default.
9916 @item -funsafe-math-optimizations
9917 @opindex funsafe-math-optimizations
9919 Allow optimizations for floating-point arithmetic that (a) assume
9920 that arguments and results are valid and (b) may violate IEEE or
9921 ANSI standards. When used at link time, it may include libraries
9922 or startup files that change the default FPU control word or other
9923 similar optimizations.
9925 This option is not turned on by any @option{-O} option since
9926 it can result in incorrect output for programs that depend on
9927 an exact implementation of IEEE or ISO rules/specifications for
9928 math functions. It may, however, yield faster code for programs
9929 that do not require the guarantees of these specifications.
9930 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
9931 @option{-fassociative-math} and @option{-freciprocal-math}.
9933 The default is @option{-fno-unsafe-math-optimizations}.
9935 @item -fassociative-math
9936 @opindex fassociative-math
9938 Allow re-association of operands in series of floating-point operations.
9939 This violates the ISO C and C++ language standard by possibly changing
9940 computation result. NOTE: re-ordering may change the sign of zero as
9941 well as ignore NaNs and inhibit or create underflow or overflow (and
9942 thus cannot be used on code that relies on rounding behavior like
9943 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
9944 and thus may not be used when ordered comparisons are required.
9945 This option requires that both @option{-fno-signed-zeros} and
9946 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
9947 much sense with @option{-frounding-math}. For Fortran the option
9948 is automatically enabled when both @option{-fno-signed-zeros} and
9949 @option{-fno-trapping-math} are in effect.
9951 The default is @option{-fno-associative-math}.
9953 @item -freciprocal-math
9954 @opindex freciprocal-math
9956 Allow the reciprocal of a value to be used instead of dividing by
9957 the value if this enables optimizations. For example @code{x / y}
9958 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
9959 is subject to common subexpression elimination. Note that this loses
9960 precision and increases the number of flops operating on the value.
9962 The default is @option{-fno-reciprocal-math}.
9964 @item -ffinite-math-only
9965 @opindex ffinite-math-only
9966 Allow optimizations for floating-point arithmetic that assume
9967 that arguments and results are not NaNs or +-Infs.
9969 This option is not turned on by any @option{-O} option since
9970 it can result in incorrect output for programs that depend on
9971 an exact implementation of IEEE or ISO rules/specifications for
9972 math functions. It may, however, yield faster code for programs
9973 that do not require the guarantees of these specifications.
9975 The default is @option{-fno-finite-math-only}.
9977 @item -fno-signed-zeros
9978 @opindex fno-signed-zeros
9979 Allow optimizations for floating-point arithmetic that ignore the
9980 signedness of zero. IEEE arithmetic specifies the behavior of
9981 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
9982 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
9983 This option implies that the sign of a zero result isn't significant.
9985 The default is @option{-fsigned-zeros}.
9987 @item -fno-trapping-math
9988 @opindex fno-trapping-math
9989 Compile code assuming that floating-point operations cannot generate
9990 user-visible traps. These traps include division by zero, overflow,
9991 underflow, inexact result and invalid operation. This option requires
9992 that @option{-fno-signaling-nans} be in effect. Setting this option may
9993 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
9995 This option should never be turned on by any @option{-O} option since
9996 it can result in incorrect output for programs that depend on
9997 an exact implementation of IEEE or ISO rules/specifications for
10000 The default is @option{-ftrapping-math}.
10002 @item -frounding-math
10003 @opindex frounding-math
10004 Disable transformations and optimizations that assume default floating-point
10005 rounding behavior. This is round-to-zero for all floating point
10006 to integer conversions, and round-to-nearest for all other arithmetic
10007 truncations. This option should be specified for programs that change
10008 the FP rounding mode dynamically, or that may be executed with a
10009 non-default rounding mode. This option disables constant folding of
10010 floating-point expressions at compile time (which may be affected by
10011 rounding mode) and arithmetic transformations that are unsafe in the
10012 presence of sign-dependent rounding modes.
10014 The default is @option{-fno-rounding-math}.
10016 This option is experimental and does not currently guarantee to
10017 disable all GCC optimizations that are affected by rounding mode.
10018 Future versions of GCC may provide finer control of this setting
10019 using C99's @code{FENV_ACCESS} pragma. This command-line option
10020 will be used to specify the default state for @code{FENV_ACCESS}.
10022 @item -fsignaling-nans
10023 @opindex fsignaling-nans
10024 Compile code assuming that IEEE signaling NaNs may generate user-visible
10025 traps during floating-point operations. Setting this option disables
10026 optimizations that may change the number of exceptions visible with
10027 signaling NaNs. This option implies @option{-ftrapping-math}.
10029 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10032 The default is @option{-fno-signaling-nans}.
10034 This option is experimental and does not currently guarantee to
10035 disable all GCC optimizations that affect signaling NaN behavior.
10037 @item -fno-fp-int-builtin-inexact
10038 @opindex fno-fp-int-builtin-inexact
10039 Do not allow the built-in functions @code{ceil}, @code{floor},
10040 @code{round} and @code{trunc}, and their @code{float} and @code{long
10041 double} variants, to generate code that raises the ``inexact''
10042 floating-point exception for noninteger arguments. ISO C99 and C11
10043 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10044 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
10045 functions to do so.
10047 The default is @option{-ffp-int-builtin-inexact}, allowing the
10048 exception to be raised. This option does nothing unless
10049 @option{-ftrapping-math} is in effect.
10051 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10052 generate a call to a library function then the ``inexact'' exception
10053 may be raised if the library implementation does not follow TS 18661.
10055 @item -fsingle-precision-constant
10056 @opindex fsingle-precision-constant
10057 Treat floating-point constants as single precision instead of
10058 implicitly converting them to double-precision constants.
10060 @item -fcx-limited-range
10061 @opindex fcx-limited-range
10062 When enabled, this option states that a range reduction step is not
10063 needed when performing complex division. Also, there is no checking
10064 whether the result of a complex multiplication or division is @code{NaN
10065 + I*NaN}, with an attempt to rescue the situation in that case. The
10066 default is @option{-fno-cx-limited-range}, but is enabled by
10067 @option{-ffast-math}.
10069 This option controls the default setting of the ISO C99
10070 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10073 @item -fcx-fortran-rules
10074 @opindex fcx-fortran-rules
10075 Complex multiplication and division follow Fortran rules. Range
10076 reduction is done as part of complex division, but there is no checking
10077 whether the result of a complex multiplication or division is @code{NaN
10078 + I*NaN}, with an attempt to rescue the situation in that case.
10080 The default is @option{-fno-cx-fortran-rules}.
10084 The following options control optimizations that may improve
10085 performance, but are not enabled by any @option{-O} options. This
10086 section includes experimental options that may produce broken code.
10089 @item -fbranch-probabilities
10090 @opindex fbranch-probabilities
10091 After running a program compiled with @option{-fprofile-arcs}
10092 (@pxref{Instrumentation Options}),
10093 you can compile it a second time using
10094 @option{-fbranch-probabilities}, to improve optimizations based on
10095 the number of times each branch was taken. When a program
10096 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10097 counts to a file called @file{@var{sourcename}.gcda} for each source
10098 file. The information in this data file is very dependent on the
10099 structure of the generated code, so you must use the same source code
10100 and the same optimization options for both compilations.
10102 With @option{-fbranch-probabilities}, GCC puts a
10103 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10104 These can be used to improve optimization. Currently, they are only
10105 used in one place: in @file{reorg.c}, instead of guessing which path a
10106 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10107 exactly determine which path is taken more often.
10109 @item -fprofile-values
10110 @opindex fprofile-values
10111 If combined with @option{-fprofile-arcs}, it adds code so that some
10112 data about values of expressions in the program is gathered.
10114 With @option{-fbranch-probabilities}, it reads back the data gathered
10115 from profiling values of expressions for usage in optimizations.
10117 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
10119 @item -fprofile-reorder-functions
10120 @opindex fprofile-reorder-functions
10121 Function reordering based on profile instrumentation collects
10122 first time of execution of a function and orders these functions
10123 in ascending order.
10125 Enabled with @option{-fprofile-use}.
10129 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10130 to add code to gather information about values of expressions.
10132 With @option{-fbranch-probabilities}, it reads back the data gathered
10133 and actually performs the optimizations based on them.
10134 Currently the optimizations include specialization of division operations
10135 using the knowledge about the value of the denominator.
10137 @item -frename-registers
10138 @opindex frename-registers
10139 Attempt to avoid false dependencies in scheduled code by making use
10140 of registers left over after register allocation. This optimization
10141 most benefits processors with lots of registers. Depending on the
10142 debug information format adopted by the target, however, it can
10143 make debugging impossible, since variables no longer stay in
10144 a ``home register''.
10146 Enabled by default with @option{-funroll-loops}.
10148 @item -fschedule-fusion
10149 @opindex fschedule-fusion
10150 Performs a target dependent pass over the instruction stream to schedule
10151 instructions of same type together because target machine can execute them
10152 more efficiently if they are adjacent to each other in the instruction flow.
10154 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10158 Perform tail duplication to enlarge superblock size. This transformation
10159 simplifies the control flow of the function allowing other optimizations to do
10162 Enabled with @option{-fprofile-use}.
10164 @item -funroll-loops
10165 @opindex funroll-loops
10166 Unroll loops whose number of iterations can be determined at compile time or
10167 upon entry to the loop. @option{-funroll-loops} implies
10168 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10169 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10170 a small constant number of iterations). This option makes code larger, and may
10171 or may not make it run faster.
10173 Enabled with @option{-fprofile-use}.
10175 @item -funroll-all-loops
10176 @opindex funroll-all-loops
10177 Unroll all loops, even if their number of iterations is uncertain when
10178 the loop is entered. This usually makes programs run more slowly.
10179 @option{-funroll-all-loops} implies the same options as
10180 @option{-funroll-loops}.
10183 @opindex fpeel-loops
10184 Peels loops for which there is enough information that they do not
10185 roll much (from profile feedback or static analysis). It also turns on
10186 complete loop peeling (i.e.@: complete removal of loops with small constant
10187 number of iterations).
10189 Enabled with @option{-O3} and/or @option{-fprofile-use}.
10191 @item -fmove-loop-invariants
10192 @opindex fmove-loop-invariants
10193 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10194 at level @option{-O1}
10196 @item -fsplit-loops
10197 @opindex fsplit-loops
10198 Split a loop into two if it contains a condition that's always true
10199 for one side of the iteration space and false for the other.
10201 @item -funswitch-loops
10202 @opindex funswitch-loops
10203 Move branches with loop invariant conditions out of the loop, with duplicates
10204 of the loop on both branches (modified according to result of the condition).
10206 @item -ffunction-sections
10207 @itemx -fdata-sections
10208 @opindex ffunction-sections
10209 @opindex fdata-sections
10210 Place each function or data item into its own section in the output
10211 file if the target supports arbitrary sections. The name of the
10212 function or the name of the data item determines the section's name
10213 in the output file.
10215 Use these options on systems where the linker can perform optimizations to
10216 improve locality of reference in the instruction space. Most systems using the
10217 ELF object format have linkers with such optimizations. On AIX, the linker
10218 rearranges sections (CSECTs) based on the call graph. The performance impact
10221 Together with a linker garbage collection (linker @option{--gc-sections}
10222 option) these options may lead to smaller statically-linked executables (after
10225 On ELF/DWARF systems these options do not degenerate the quality of the debug
10226 information. There could be issues with other object files/debug info formats.
10228 Only use these options when there are significant benefits from doing so. When
10229 you specify these options, the assembler and linker create larger object and
10230 executable files and are also slower. These options affect code generation.
10231 They prevent optimizations by the compiler and assembler using relative
10232 locations inside a translation unit since the locations are unknown until
10233 link time. An example of such an optimization is relaxing calls to short call
10236 @item -fbranch-target-load-optimize
10237 @opindex fbranch-target-load-optimize
10238 Perform branch target register load optimization before prologue / epilogue
10240 The use of target registers can typically be exposed only during reload,
10241 thus hoisting loads out of loops and doing inter-block scheduling needs
10242 a separate optimization pass.
10244 @item -fbranch-target-load-optimize2
10245 @opindex fbranch-target-load-optimize2
10246 Perform branch target register load optimization after prologue / epilogue
10249 @item -fbtr-bb-exclusive
10250 @opindex fbtr-bb-exclusive
10251 When performing branch target register load optimization, don't reuse
10252 branch target registers within any basic block.
10255 @opindex fstdarg-opt
10256 Optimize the prologue of variadic argument functions with respect to usage of
10259 @item -fsection-anchors
10260 @opindex fsection-anchors
10261 Try to reduce the number of symbolic address calculations by using
10262 shared ``anchor'' symbols to address nearby objects. This transformation
10263 can help to reduce the number of GOT entries and GOT accesses on some
10266 For example, the implementation of the following function @code{foo}:
10269 static int a, b, c;
10270 int foo (void) @{ return a + b + c; @}
10274 usually calculates the addresses of all three variables, but if you
10275 compile it with @option{-fsection-anchors}, it accesses the variables
10276 from a common anchor point instead. The effect is similar to the
10277 following pseudocode (which isn't valid C):
10282 register int *xr = &x;
10283 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
10287 Not all targets support this option.
10289 @item --param @var{name}=@var{value}
10291 In some places, GCC uses various constants to control the amount of
10292 optimization that is done. For example, GCC does not inline functions
10293 that contain more than a certain number of instructions. You can
10294 control some of these constants on the command line using the
10295 @option{--param} option.
10297 The names of specific parameters, and the meaning of the values, are
10298 tied to the internals of the compiler, and are subject to change
10299 without notice in future releases.
10301 In each case, the @var{value} is an integer. The allowable choices for
10305 @item predictable-branch-outcome
10306 When branch is predicted to be taken with probability lower than this threshold
10307 (in percent), then it is considered well predictable. The default is 10.
10309 @item max-rtl-if-conversion-insns
10310 RTL if-conversion tries to remove conditional branches around a block and
10311 replace them with conditionally executed instructions. This parameter
10312 gives the maximum number of instructions in a block which should be
10313 considered for if-conversion. The default is 10, though the compiler will
10314 also use other heuristics to decide whether if-conversion is likely to be
10317 @item max-rtl-if-conversion-predictable-cost
10318 @itemx max-rtl-if-conversion-unpredictable-cost
10319 RTL if-conversion will try to remove conditional branches around a block
10320 and replace them with conditionally executed instructions. These parameters
10321 give the maximum permissible cost for the sequence that would be generated
10322 by if-conversion depending on whether the branch is statically determined
10323 to be predictable or not. The units for this parameter are the same as
10324 those for the GCC internal seq_cost metric. The compiler will try to
10325 provide a reasonable default for this parameter using the BRANCH_COST
10328 @item max-crossjump-edges
10329 The maximum number of incoming edges to consider for cross-jumping.
10330 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
10331 the number of edges incoming to each block. Increasing values mean
10332 more aggressive optimization, making the compilation time increase with
10333 probably small improvement in executable size.
10335 @item min-crossjump-insns
10336 The minimum number of instructions that must be matched at the end
10337 of two blocks before cross-jumping is performed on them. This
10338 value is ignored in the case where all instructions in the block being
10339 cross-jumped from are matched. The default value is 5.
10341 @item max-grow-copy-bb-insns
10342 The maximum code size expansion factor when copying basic blocks
10343 instead of jumping. The expansion is relative to a jump instruction.
10344 The default value is 8.
10346 @item max-goto-duplication-insns
10347 The maximum number of instructions to duplicate to a block that jumps
10348 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
10349 passes, GCC factors computed gotos early in the compilation process,
10350 and unfactors them as late as possible. Only computed jumps at the
10351 end of a basic blocks with no more than max-goto-duplication-insns are
10352 unfactored. The default value is 8.
10354 @item max-delay-slot-insn-search
10355 The maximum number of instructions to consider when looking for an
10356 instruction to fill a delay slot. If more than this arbitrary number of
10357 instructions are searched, the time savings from filling the delay slot
10358 are minimal, so stop searching. Increasing values mean more
10359 aggressive optimization, making the compilation time increase with probably
10360 small improvement in execution time.
10362 @item max-delay-slot-live-search
10363 When trying to fill delay slots, the maximum number of instructions to
10364 consider when searching for a block with valid live register
10365 information. Increasing this arbitrarily chosen value means more
10366 aggressive optimization, increasing the compilation time. This parameter
10367 should be removed when the delay slot code is rewritten to maintain the
10368 control-flow graph.
10370 @item max-gcse-memory
10371 The approximate maximum amount of memory that can be allocated in
10372 order to perform the global common subexpression elimination
10373 optimization. If more memory than specified is required, the
10374 optimization is not done.
10376 @item max-gcse-insertion-ratio
10377 If the ratio of expression insertions to deletions is larger than this value
10378 for any expression, then RTL PRE inserts or removes the expression and thus
10379 leaves partially redundant computations in the instruction stream. The default value is 20.
10381 @item max-pending-list-length
10382 The maximum number of pending dependencies scheduling allows
10383 before flushing the current state and starting over. Large functions
10384 with few branches or calls can create excessively large lists which
10385 needlessly consume memory and resources.
10387 @item max-modulo-backtrack-attempts
10388 The maximum number of backtrack attempts the scheduler should make
10389 when modulo scheduling a loop. Larger values can exponentially increase
10392 @item max-inline-insns-single
10393 Several parameters control the tree inliner used in GCC@.
10394 This number sets the maximum number of instructions (counted in GCC's
10395 internal representation) in a single function that the tree inliner
10396 considers for inlining. This only affects functions declared
10397 inline and methods implemented in a class declaration (C++).
10398 The default value is 400.
10400 @item max-inline-insns-auto
10401 When you use @option{-finline-functions} (included in @option{-O3}),
10402 a lot of functions that would otherwise not be considered for inlining
10403 by the compiler are investigated. To those functions, a different
10404 (more restrictive) limit compared to functions declared inline can
10406 The default value is 30.
10408 @item inline-min-speedup
10409 When estimated performance improvement of caller + callee runtime exceeds this
10410 threshold (in percent), the function can be inlined regardless of the limit on
10411 @option{--param max-inline-insns-single} and @option{--param
10412 max-inline-insns-auto}.
10413 The default value is 15.
10415 @item large-function-insns
10416 The limit specifying really large functions. For functions larger than this
10417 limit after inlining, inlining is constrained by
10418 @option{--param large-function-growth}. This parameter is useful primarily
10419 to avoid extreme compilation time caused by non-linear algorithms used by the
10421 The default value is 2700.
10423 @item large-function-growth
10424 Specifies maximal growth of large function caused by inlining in percents.
10425 The default value is 100 which limits large function growth to 2.0 times
10428 @item large-unit-insns
10429 The limit specifying large translation unit. Growth caused by inlining of
10430 units larger than this limit is limited by @option{--param inline-unit-growth}.
10431 For small units this might be too tight.
10432 For example, consider a unit consisting of function A
10433 that is inline and B that just calls A three times. If B is small relative to
10434 A, the growth of unit is 300\% and yet such inlining is very sane. For very
10435 large units consisting of small inlineable functions, however, the overall unit
10436 growth limit is needed to avoid exponential explosion of code size. Thus for
10437 smaller units, the size is increased to @option{--param large-unit-insns}
10438 before applying @option{--param inline-unit-growth}. The default is 10000.
10440 @item inline-unit-growth
10441 Specifies maximal overall growth of the compilation unit caused by inlining.
10442 The default value is 20 which limits unit growth to 1.2 times the original
10443 size. Cold functions (either marked cold via an attribute or by profile
10444 feedback) are not accounted into the unit size.
10446 @item ipcp-unit-growth
10447 Specifies maximal overall growth of the compilation unit caused by
10448 interprocedural constant propagation. The default value is 10 which limits
10449 unit growth to 1.1 times the original size.
10451 @item large-stack-frame
10452 The limit specifying large stack frames. While inlining the algorithm is trying
10453 to not grow past this limit too much. The default value is 256 bytes.
10455 @item large-stack-frame-growth
10456 Specifies maximal growth of large stack frames caused by inlining in percents.
10457 The default value is 1000 which limits large stack frame growth to 11 times
10460 @item max-inline-insns-recursive
10461 @itemx max-inline-insns-recursive-auto
10462 Specifies the maximum number of instructions an out-of-line copy of a
10463 self-recursive inline
10464 function can grow into by performing recursive inlining.
10466 @option{--param max-inline-insns-recursive} applies to functions
10468 For functions not declared inline, recursive inlining
10469 happens only when @option{-finline-functions} (included in @option{-O3}) is
10470 enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The
10471 default value is 450.
10473 @item max-inline-recursive-depth
10474 @itemx max-inline-recursive-depth-auto
10475 Specifies the maximum recursion depth used for recursive inlining.
10477 @option{--param max-inline-recursive-depth} applies to functions
10478 declared inline. For functions not declared inline, recursive inlining
10479 happens only when @option{-finline-functions} (included in @option{-O3}) is
10480 enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The
10481 default value is 8.
10483 @item min-inline-recursive-probability
10484 Recursive inlining is profitable only for function having deep recursion
10485 in average and can hurt for function having little recursion depth by
10486 increasing the prologue size or complexity of function body to other
10489 When profile feedback is available (see @option{-fprofile-generate}) the actual
10490 recursion depth can be guessed from the probability that function recurses
10491 via a given call expression. This parameter limits inlining only to call
10492 expressions whose probability exceeds the given threshold (in percents).
10493 The default value is 10.
10495 @item early-inlining-insns
10496 Specify growth that the early inliner can make. In effect it increases
10497 the amount of inlining for code having a large abstraction penalty.
10498 The default value is 14.
10500 @item max-early-inliner-iterations
10501 Limit of iterations of the early inliner. This basically bounds
10502 the number of nested indirect calls the early inliner can resolve.
10503 Deeper chains are still handled by late inlining.
10505 @item comdat-sharing-probability
10506 Probability (in percent) that C++ inline function with comdat visibility
10507 are shared across multiple compilation units. The default value is 20.
10509 @item profile-func-internal-id
10510 A parameter to control whether to use function internal id in profile
10511 database lookup. If the value is 0, the compiler uses an id that
10512 is based on function assembler name and filename, which makes old profile
10513 data more tolerant to source changes such as function reordering etc.
10514 The default value is 0.
10516 @item min-vect-loop-bound
10517 The minimum number of iterations under which loops are not vectorized
10518 when @option{-ftree-vectorize} is used. The number of iterations after
10519 vectorization needs to be greater than the value specified by this option
10520 to allow vectorization. The default value is 0.
10522 @item gcse-cost-distance-ratio
10523 Scaling factor in calculation of maximum distance an expression
10524 can be moved by GCSE optimizations. This is currently supported only in the
10525 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
10526 is with simple expressions, i.e., the expressions that have cost
10527 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
10528 hoisting of simple expressions. The default value is 10.
10530 @item gcse-unrestricted-cost
10531 Cost, roughly measured as the cost of a single typical machine
10532 instruction, at which GCSE optimizations do not constrain
10533 the distance an expression can travel. This is currently
10534 supported only in the code hoisting pass. The lesser the cost,
10535 the more aggressive code hoisting is. Specifying 0
10536 allows all expressions to travel unrestricted distances.
10537 The default value is 3.
10539 @item max-hoist-depth
10540 The depth of search in the dominator tree for expressions to hoist.
10541 This is used to avoid quadratic behavior in hoisting algorithm.
10542 The value of 0 does not limit on the search, but may slow down compilation
10543 of huge functions. The default value is 30.
10545 @item max-tail-merge-comparisons
10546 The maximum amount of similar bbs to compare a bb with. This is used to
10547 avoid quadratic behavior in tree tail merging. The default value is 10.
10549 @item max-tail-merge-iterations
10550 The maximum amount of iterations of the pass over the function. This is used to
10551 limit compilation time in tree tail merging. The default value is 2.
10553 @item store-merging-allow-unaligned
10554 Allow the store merging pass to introduce unaligned stores if it is legal to
10555 do so. The default value is 1.
10557 @item max-stores-to-merge
10558 The maximum number of stores to attempt to merge into wider stores in the store
10559 merging pass. The minimum value is 2 and the default is 64.
10561 @item max-unrolled-insns
10562 The maximum number of instructions that a loop may have to be unrolled.
10563 If a loop is unrolled, this parameter also determines how many times
10564 the loop code is unrolled.
10566 @item max-average-unrolled-insns
10567 The maximum number of instructions biased by probabilities of their execution
10568 that a loop may have to be unrolled. If a loop is unrolled,
10569 this parameter also determines how many times the loop code is unrolled.
10571 @item max-unroll-times
10572 The maximum number of unrollings of a single loop.
10574 @item max-peeled-insns
10575 The maximum number of instructions that a loop may have to be peeled.
10576 If a loop is peeled, this parameter also determines how many times
10577 the loop code is peeled.
10579 @item max-peel-times
10580 The maximum number of peelings of a single loop.
10582 @item max-peel-branches
10583 The maximum number of branches on the hot path through the peeled sequence.
10585 @item max-completely-peeled-insns
10586 The maximum number of insns of a completely peeled loop.
10588 @item max-completely-peel-times
10589 The maximum number of iterations of a loop to be suitable for complete peeling.
10591 @item max-completely-peel-loop-nest-depth
10592 The maximum depth of a loop nest suitable for complete peeling.
10594 @item max-unswitch-insns
10595 The maximum number of insns of an unswitched loop.
10597 @item max-unswitch-level
10598 The maximum number of branches unswitched in a single loop.
10600 @item max-loop-headers-insns
10601 The maximum number of insns in loop header duplicated by the copy loop headers
10604 @item lim-expensive
10605 The minimum cost of an expensive expression in the loop invariant motion.
10607 @item iv-consider-all-candidates-bound
10608 Bound on number of candidates for induction variables, below which
10609 all candidates are considered for each use in induction variable
10610 optimizations. If there are more candidates than this,
10611 only the most relevant ones are considered to avoid quadratic time complexity.
10613 @item iv-max-considered-uses
10614 The induction variable optimizations give up on loops that contain more
10615 induction variable uses.
10617 @item iv-always-prune-cand-set-bound
10618 If the number of candidates in the set is smaller than this value,
10619 always try to remove unnecessary ivs from the set
10620 when adding a new one.
10622 @item avg-loop-niter
10623 Average number of iterations of a loop.
10625 @item dse-max-object-size
10626 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
10627 Larger values may result in larger compilation times.
10629 @item dse-max-alias-queries-per-store
10630 Maximum number of queries into the alias oracle per store.
10631 Larger values result in larger compilation times and may result in more
10632 removed dead stores.
10634 @item scev-max-expr-size
10635 Bound on size of expressions used in the scalar evolutions analyzer.
10636 Large expressions slow the analyzer.
10638 @item scev-max-expr-complexity
10639 Bound on the complexity of the expressions in the scalar evolutions analyzer.
10640 Complex expressions slow the analyzer.
10642 @item max-tree-if-conversion-phi-args
10643 Maximum number of arguments in a PHI supported by TREE if conversion
10644 unless the loop is marked with simd pragma.
10646 @item vect-max-version-for-alignment-checks
10647 The maximum number of run-time checks that can be performed when
10648 doing loop versioning for alignment in the vectorizer.
10650 @item vect-max-version-for-alias-checks
10651 The maximum number of run-time checks that can be performed when
10652 doing loop versioning for alias in the vectorizer.
10654 @item vect-max-peeling-for-alignment
10655 The maximum number of loop peels to enhance access alignment
10656 for vectorizer. Value -1 means no limit.
10658 @item max-iterations-to-track
10659 The maximum number of iterations of a loop the brute-force algorithm
10660 for analysis of the number of iterations of the loop tries to evaluate.
10662 @item hot-bb-count-ws-permille
10663 A basic block profile count is considered hot if it contributes to
10664 the given permillage (i.e. 0...1000) of the entire profiled execution.
10666 @item hot-bb-frequency-fraction
10667 Select fraction of the entry block frequency of executions of basic block in
10668 function given basic block needs to have to be considered hot.
10670 @item max-predicted-iterations
10671 The maximum number of loop iterations we predict statically. This is useful
10672 in cases where a function contains a single loop with known bound and
10673 another loop with unknown bound.
10674 The known number of iterations is predicted correctly, while
10675 the unknown number of iterations average to roughly 10. This means that the
10676 loop without bounds appears artificially cold relative to the other one.
10678 @item builtin-expect-probability
10679 Control the probability of the expression having the specified value. This
10680 parameter takes a percentage (i.e. 0 ... 100) as input.
10681 The default probability of 90 is obtained empirically.
10683 @item builtin-string-cmp-inline-length
10684 The maximum length of a constant string for a builtin string cmp call
10685 eligible for inlining.
10686 The default value is 3.
10688 @item align-threshold
10690 Select fraction of the maximal frequency of executions of a basic block in
10691 a function to align the basic block.
10693 @item align-loop-iterations
10695 A loop expected to iterate at least the selected number of iterations is
10698 @item tracer-dynamic-coverage
10699 @itemx tracer-dynamic-coverage-feedback
10701 This value is used to limit superblock formation once the given percentage of
10702 executed instructions is covered. This limits unnecessary code size
10705 The @option{tracer-dynamic-coverage-feedback} parameter
10706 is used only when profile
10707 feedback is available. The real profiles (as opposed to statically estimated
10708 ones) are much less balanced allowing the threshold to be larger value.
10710 @item tracer-max-code-growth
10711 Stop tail duplication once code growth has reached given percentage. This is
10712 a rather artificial limit, as most of the duplicates are eliminated later in
10713 cross jumping, so it may be set to much higher values than is the desired code
10716 @item tracer-min-branch-ratio
10718 Stop reverse growth when the reverse probability of best edge is less than this
10719 threshold (in percent).
10721 @item tracer-min-branch-probability
10722 @itemx tracer-min-branch-probability-feedback
10724 Stop forward growth if the best edge has probability lower than this
10727 Similarly to @option{tracer-dynamic-coverage} two parameters are
10728 provided. @option{tracer-min-branch-probability-feedback} is used for
10729 compilation with profile feedback and @option{tracer-min-branch-probability}
10730 compilation without. The value for compilation with profile feedback
10731 needs to be more conservative (higher) in order to make tracer
10734 @item stack-clash-protection-guard-size
10735 Specify the size of the operating system provided stack guard as
10736 2 raised to @var{num} bytes. The default value is 12 (4096 bytes).
10737 Acceptable values are between 12 and 30. Higher values may reduce the
10738 number of explicit probes, but a value larger than the operating system
10739 provided guard will leave code vulnerable to stack clash style attacks.
10741 @item stack-clash-protection-probe-interval
10742 Stack clash protection involves probing stack space as it is allocated. This
10743 param controls the maximum distance between probes into the stack as 2 raised
10744 to @var{num} bytes. Acceptable values are between 10 and 16 and defaults to
10745 12. Higher values may reduce the number of explicit probes, but a value
10746 larger than the operating system provided guard will leave code vulnerable to
10747 stack clash style attacks.
10749 @item max-cse-path-length
10751 The maximum number of basic blocks on path that CSE considers.
10754 @item max-cse-insns
10755 The maximum number of instructions CSE processes before flushing.
10756 The default is 1000.
10758 @item ggc-min-expand
10760 GCC uses a garbage collector to manage its own memory allocation. This
10761 parameter specifies the minimum percentage by which the garbage
10762 collector's heap should be allowed to expand between collections.
10763 Tuning this may improve compilation speed; it has no effect on code
10766 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
10767 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
10768 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
10769 GCC is not able to calculate RAM on a particular platform, the lower
10770 bound of 30% is used. Setting this parameter and
10771 @option{ggc-min-heapsize} to zero causes a full collection to occur at
10772 every opportunity. This is extremely slow, but can be useful for
10775 @item ggc-min-heapsize
10777 Minimum size of the garbage collector's heap before it begins bothering
10778 to collect garbage. The first collection occurs after the heap expands
10779 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
10780 tuning this may improve compilation speed, and has no effect on code
10783 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
10784 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
10785 with a lower bound of 4096 (four megabytes) and an upper bound of
10786 131072 (128 megabytes). If GCC is not able to calculate RAM on a
10787 particular platform, the lower bound is used. Setting this parameter
10788 very large effectively disables garbage collection. Setting this
10789 parameter and @option{ggc-min-expand} to zero causes a full collection
10790 to occur at every opportunity.
10792 @item max-reload-search-insns
10793 The maximum number of instruction reload should look backward for equivalent
10794 register. Increasing values mean more aggressive optimization, making the
10795 compilation time increase with probably slightly better performance.
10796 The default value is 100.
10798 @item max-cselib-memory-locations
10799 The maximum number of memory locations cselib should take into account.
10800 Increasing values mean more aggressive optimization, making the compilation time
10801 increase with probably slightly better performance. The default value is 500.
10803 @item max-sched-ready-insns
10804 The maximum number of instructions ready to be issued the scheduler should
10805 consider at any given time during the first scheduling pass. Increasing
10806 values mean more thorough searches, making the compilation time increase
10807 with probably little benefit. The default value is 100.
10809 @item max-sched-region-blocks
10810 The maximum number of blocks in a region to be considered for
10811 interblock scheduling. The default value is 10.
10813 @item max-pipeline-region-blocks
10814 The maximum number of blocks in a region to be considered for
10815 pipelining in the selective scheduler. The default value is 15.
10817 @item max-sched-region-insns
10818 The maximum number of insns in a region to be considered for
10819 interblock scheduling. The default value is 100.
10821 @item max-pipeline-region-insns
10822 The maximum number of insns in a region to be considered for
10823 pipelining in the selective scheduler. The default value is 200.
10825 @item min-spec-prob
10826 The minimum probability (in percents) of reaching a source block
10827 for interblock speculative scheduling. The default value is 40.
10829 @item max-sched-extend-regions-iters
10830 The maximum number of iterations through CFG to extend regions.
10831 A value of 0 (the default) disables region extensions.
10833 @item max-sched-insn-conflict-delay
10834 The maximum conflict delay for an insn to be considered for speculative motion.
10835 The default value is 3.
10837 @item sched-spec-prob-cutoff
10838 The minimal probability of speculation success (in percents), so that
10839 speculative insns are scheduled.
10840 The default value is 40.
10842 @item sched-state-edge-prob-cutoff
10843 The minimum probability an edge must have for the scheduler to save its
10845 The default value is 10.
10847 @item sched-mem-true-dep-cost
10848 Minimal distance (in CPU cycles) between store and load targeting same
10849 memory locations. The default value is 1.
10851 @item selsched-max-lookahead
10852 The maximum size of the lookahead window of selective scheduling. It is a
10853 depth of search for available instructions.
10854 The default value is 50.
10856 @item selsched-max-sched-times
10857 The maximum number of times that an instruction is scheduled during
10858 selective scheduling. This is the limit on the number of iterations
10859 through which the instruction may be pipelined. The default value is 2.
10861 @item selsched-insns-to-rename
10862 The maximum number of best instructions in the ready list that are considered
10863 for renaming in the selective scheduler. The default value is 2.
10866 The minimum value of stage count that swing modulo scheduler
10867 generates. The default value is 2.
10869 @item max-last-value-rtl
10870 The maximum size measured as number of RTLs that can be recorded in an expression
10871 in combiner for a pseudo register as last known value of that register. The default
10874 @item max-combine-insns
10875 The maximum number of instructions the RTL combiner tries to combine.
10876 The default value is 2 at @option{-Og} and 4 otherwise.
10878 @item integer-share-limit
10879 Small integer constants can use a shared data structure, reducing the
10880 compiler's memory usage and increasing its speed. This sets the maximum
10881 value of a shared integer constant. The default value is 256.
10883 @item ssp-buffer-size
10884 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
10885 protection when @option{-fstack-protection} is used.
10887 @item min-size-for-stack-sharing
10888 The minimum size of variables taking part in stack slot sharing when not
10889 optimizing. The default value is 32.
10891 @item max-jump-thread-duplication-stmts
10892 Maximum number of statements allowed in a block that needs to be
10893 duplicated when threading jumps.
10895 @item max-fields-for-field-sensitive
10896 Maximum number of fields in a structure treated in
10897 a field sensitive manner during pointer analysis. The default is zero
10898 for @option{-O0} and @option{-O1},
10899 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
10901 @item prefetch-latency
10902 Estimate on average number of instructions that are executed before
10903 prefetch finishes. The distance prefetched ahead is proportional
10904 to this constant. Increasing this number may also lead to less
10905 streams being prefetched (see @option{simultaneous-prefetches}).
10907 @item simultaneous-prefetches
10908 Maximum number of prefetches that can run at the same time.
10910 @item l1-cache-line-size
10911 The size of cache line in L1 cache, in bytes.
10913 @item l1-cache-size
10914 The size of L1 cache, in kilobytes.
10916 @item l2-cache-size
10917 The size of L2 cache, in kilobytes.
10919 @item prefetch-dynamic-strides
10920 Whether the loop array prefetch pass should issue software prefetch hints
10921 for strides that are non-constant. In some cases this may be
10922 beneficial, though the fact the stride is non-constant may make it
10923 hard to predict when there is clear benefit to issuing these hints.
10925 Set to 1, the default, if the prefetch hints should be issued for non-constant
10926 strides. Set to 0 if prefetch hints should be issued only for strides that
10927 are known to be constant and below @option{prefetch-minimum-stride}.
10929 @item prefetch-minimum-stride
10930 Minimum constant stride, in bytes, to start using prefetch hints for. If
10931 the stride is less than this threshold, prefetch hints will not be issued.
10933 This setting is useful for processors that have hardware prefetchers, in
10934 which case there may be conflicts between the hardware prefetchers and
10935 the software prefetchers. If the hardware prefetchers have a maximum
10936 stride they can handle, it should be used here to improve the use of
10937 software prefetchers.
10939 A value of -1, the default, means we don't have a threshold and therefore
10940 prefetch hints can be issued for any constant stride.
10942 This setting is only useful for strides that are known and constant.
10944 @item loop-interchange-max-num-stmts
10945 The maximum number of stmts in a loop to be interchanged.
10947 @item loop-interchange-stride-ratio
10948 The minimum ratio between stride of two loops for interchange to be profitable.
10950 @item min-insn-to-prefetch-ratio
10951 The minimum ratio between the number of instructions and the
10952 number of prefetches to enable prefetching in a loop.
10954 @item prefetch-min-insn-to-mem-ratio
10955 The minimum ratio between the number of instructions and the
10956 number of memory references to enable prefetching in a loop.
10958 @item use-canonical-types
10959 Whether the compiler should use the ``canonical'' type system. By
10960 default, this should always be 1, which uses a more efficient internal
10961 mechanism for comparing types in C++ and Objective-C++. However, if
10962 bugs in the canonical type system are causing compilation failures,
10963 set this value to 0 to disable canonical types.
10965 @item switch-conversion-max-branch-ratio
10966 Switch initialization conversion refuses to create arrays that are
10967 bigger than @option{switch-conversion-max-branch-ratio} times the number of
10968 branches in the switch.
10970 @item max-partial-antic-length
10971 Maximum length of the partial antic set computed during the tree
10972 partial redundancy elimination optimization (@option{-ftree-pre}) when
10973 optimizing at @option{-O3} and above. For some sorts of source code
10974 the enhanced partial redundancy elimination optimization can run away,
10975 consuming all of the memory available on the host machine. This
10976 parameter sets a limit on the length of the sets that are computed,
10977 which prevents the runaway behavior. Setting a value of 0 for
10978 this parameter allows an unlimited set length.
10980 @item sccvn-max-scc-size
10981 Maximum size of a strongly connected component (SCC) during SCCVN
10982 processing. If this limit is hit, SCCVN processing for the whole
10983 function is not done and optimizations depending on it are
10984 disabled. The default maximum SCC size is 10000.
10986 @item sccvn-max-alias-queries-per-access
10987 Maximum number of alias-oracle queries we perform when looking for
10988 redundancies for loads and stores. If this limit is hit the search
10989 is aborted and the load or store is not considered redundant. The
10990 number of queries is algorithmically limited to the number of
10991 stores on all paths from the load to the function entry.
10992 The default maximum number of queries is 1000.
10994 @item ira-max-loops-num
10995 IRA uses regional register allocation by default. If a function
10996 contains more loops than the number given by this parameter, only at most
10997 the given number of the most frequently-executed loops form regions
10998 for regional register allocation. The default value of the
11001 @item ira-max-conflict-table-size
11002 Although IRA uses a sophisticated algorithm to compress the conflict
11003 table, the table can still require excessive amounts of memory for
11004 huge functions. If the conflict table for a function could be more
11005 than the size in MB given by this parameter, the register allocator
11006 instead uses a faster, simpler, and lower-quality
11007 algorithm that does not require building a pseudo-register conflict table.
11008 The default value of the parameter is 2000.
11010 @item ira-loop-reserved-regs
11011 IRA can be used to evaluate more accurate register pressure in loops
11012 for decisions to move loop invariants (see @option{-O3}). The number
11013 of available registers reserved for some other purposes is given
11014 by this parameter. The default value of the parameter is 2, which is
11015 the minimal number of registers needed by typical instructions.
11016 This value is the best found from numerous experiments.
11018 @item lra-inheritance-ebb-probability-cutoff
11019 LRA tries to reuse values reloaded in registers in subsequent insns.
11020 This optimization is called inheritance. EBB is used as a region to
11021 do this optimization. The parameter defines a minimal fall-through
11022 edge probability in percentage used to add BB to inheritance EBB in
11023 LRA. The default value of the parameter is 40. The value was chosen
11024 from numerous runs of SPEC2000 on x86-64.
11026 @item loop-invariant-max-bbs-in-loop
11027 Loop invariant motion can be very expensive, both in compilation time and
11028 in amount of needed compile-time memory, with very large loops. Loops
11029 with more basic blocks than this parameter won't have loop invariant
11030 motion optimization performed on them. The default value of the
11031 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
11033 @item loop-max-datarefs-for-datadeps
11034 Building data dependencies is expensive for very large loops. This
11035 parameter limits the number of data references in loops that are
11036 considered for data dependence analysis. These large loops are no
11037 handled by the optimizations using loop data dependencies.
11038 The default value is 1000.
11040 @item max-vartrack-size
11041 Sets a maximum number of hash table slots to use during variable
11042 tracking dataflow analysis of any function. If this limit is exceeded
11043 with variable tracking at assignments enabled, analysis for that
11044 function is retried without it, after removing all debug insns from
11045 the function. If the limit is exceeded even without debug insns, var
11046 tracking analysis is completely disabled for the function. Setting
11047 the parameter to zero makes it unlimited.
11049 @item max-vartrack-expr-depth
11050 Sets a maximum number of recursion levels when attempting to map
11051 variable names or debug temporaries to value expressions. This trades
11052 compilation time for more complete debug information. If this is set too
11053 low, value expressions that are available and could be represented in
11054 debug information may end up not being used; setting this higher may
11055 enable the compiler to find more complex debug expressions, but compile
11056 time and memory use may grow. The default is 12.
11058 @item max-debug-marker-count
11059 Sets a threshold on the number of debug markers (e.g. begin stmt
11060 markers) to avoid complexity explosion at inlining or expanding to RTL.
11061 If a function has more such gimple stmts than the set limit, such stmts
11062 will be dropped from the inlined copy of a function, and from its RTL
11063 expansion. The default is 100000.
11065 @item min-nondebug-insn-uid
11066 Use uids starting at this parameter for nondebug insns. The range below
11067 the parameter is reserved exclusively for debug insns created by
11068 @option{-fvar-tracking-assignments}, but debug insns may get
11069 (non-overlapping) uids above it if the reserved range is exhausted.
11071 @item ipa-sra-ptr-growth-factor
11072 IPA-SRA replaces a pointer to an aggregate with one or more new
11073 parameters only when their cumulative size is less or equal to
11074 @option{ipa-sra-ptr-growth-factor} times the size of the original
11077 @item sra-max-scalarization-size-Ospeed
11078 @itemx sra-max-scalarization-size-Osize
11079 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11080 replace scalar parts of aggregates with uses of independent scalar
11081 variables. These parameters control the maximum size, in storage units,
11082 of aggregate which is considered for replacement when compiling for
11084 (@option{sra-max-scalarization-size-Ospeed}) or size
11085 (@option{sra-max-scalarization-size-Osize}) respectively.
11087 @item tm-max-aggregate-size
11088 When making copies of thread-local variables in a transaction, this
11089 parameter specifies the size in bytes after which variables are
11090 saved with the logging functions as opposed to save/restore code
11091 sequence pairs. This option only applies when using
11094 @item graphite-max-nb-scop-params
11095 To avoid exponential effects in the Graphite loop transforms, the
11096 number of parameters in a Static Control Part (SCoP) is bounded. The
11097 default value is 10 parameters, a value of zero can be used to lift
11098 the bound. A variable whose value is unknown at compilation time and
11099 defined outside a SCoP is a parameter of the SCoP.
11101 @item loop-block-tile-size
11102 Loop blocking or strip mining transforms, enabled with
11103 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11104 loop in the loop nest by a given number of iterations. The strip
11105 length can be changed using the @option{loop-block-tile-size}
11106 parameter. The default value is 51 iterations.
11108 @item loop-unroll-jam-size
11109 Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The
11110 default value is 4.
11112 @item loop-unroll-jam-depth
11113 Specify the dimension to be unrolled (counting from the most inner loop)
11114 for the @option{-floop-unroll-and-jam}. The default value is 2.
11116 @item ipa-cp-value-list-size
11117 IPA-CP attempts to track all possible values and types passed to a function's
11118 parameter in order to propagate them and perform devirtualization.
11119 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11120 stores per one formal parameter of a function.
11122 @item ipa-cp-eval-threshold
11123 IPA-CP calculates its own score of cloning profitability heuristics
11124 and performs those cloning opportunities with scores that exceed
11125 @option{ipa-cp-eval-threshold}.
11127 @item ipa-cp-recursion-penalty
11128 Percentage penalty the recursive functions will receive when they
11129 are evaluated for cloning.
11131 @item ipa-cp-single-call-penalty
11132 Percentage penalty functions containing a single call to another
11133 function will receive when they are evaluated for cloning.
11136 @item ipa-max-agg-items
11137 IPA-CP is also capable to propagate a number of scalar values passed
11138 in an aggregate. @option{ipa-max-agg-items} controls the maximum
11139 number of such values per one parameter.
11141 @item ipa-cp-loop-hint-bonus
11142 When IPA-CP determines that a cloning candidate would make the number
11143 of iterations of a loop known, it adds a bonus of
11144 @option{ipa-cp-loop-hint-bonus} to the profitability score of
11147 @item ipa-cp-array-index-hint-bonus
11148 When IPA-CP determines that a cloning candidate would make the index of
11149 an array access known, it adds a bonus of
11150 @option{ipa-cp-array-index-hint-bonus} to the profitability
11151 score of the candidate.
11153 @item ipa-max-aa-steps
11154 During its analysis of function bodies, IPA-CP employs alias analysis
11155 in order to track values pointed to by function parameters. In order
11156 not spend too much time analyzing huge functions, it gives up and
11157 consider all memory clobbered after examining
11158 @option{ipa-max-aa-steps} statements modifying memory.
11160 @item lto-partitions
11161 Specify desired number of partitions produced during WHOPR compilation.
11162 The number of partitions should exceed the number of CPUs used for compilation.
11163 The default value is 32.
11165 @item lto-min-partition
11166 Size of minimal partition for WHOPR (in estimated instructions).
11167 This prevents expenses of splitting very small programs into too many
11170 @item lto-max-partition
11171 Size of max partition for WHOPR (in estimated instructions).
11172 to provide an upper bound for individual size of partition.
11173 Meant to be used only with balanced partitioning.
11175 @item cxx-max-namespaces-for-diagnostic-help
11176 The maximum number of namespaces to consult for suggestions when C++
11177 name lookup fails for an identifier. The default is 1000.
11179 @item sink-frequency-threshold
11180 The maximum relative execution frequency (in percents) of the target block
11181 relative to a statement's original block to allow statement sinking of a
11182 statement. Larger numbers result in more aggressive statement sinking.
11183 The default value is 75. A small positive adjustment is applied for
11184 statements with memory operands as those are even more profitable so sink.
11186 @item max-stores-to-sink
11187 The maximum number of conditional store pairs that can be sunk. Set to 0
11188 if either vectorization (@option{-ftree-vectorize}) or if-conversion
11189 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
11191 @item allow-store-data-races
11192 Allow optimizers to introduce new data races on stores.
11193 Set to 1 to allow, otherwise to 0. This option is enabled by default
11194 at optimization level @option{-Ofast}.
11196 @item case-values-threshold
11197 The smallest number of different values for which it is best to use a
11198 jump-table instead of a tree of conditional branches. If the value is
11199 0, use the default for the machine. The default is 0.
11201 @item tree-reassoc-width
11202 Set the maximum number of instructions executed in parallel in
11203 reassociated tree. This parameter overrides target dependent
11204 heuristics used by default if has non zero value.
11206 @item sched-pressure-algorithm
11207 Choose between the two available implementations of
11208 @option{-fsched-pressure}. Algorithm 1 is the original implementation
11209 and is the more likely to prevent instructions from being reordered.
11210 Algorithm 2 was designed to be a compromise between the relatively
11211 conservative approach taken by algorithm 1 and the rather aggressive
11212 approach taken by the default scheduler. It relies more heavily on
11213 having a regular register file and accurate register pressure classes.
11214 See @file{haifa-sched.c} in the GCC sources for more details.
11216 The default choice depends on the target.
11218 @item max-slsr-cand-scan
11219 Set the maximum number of existing candidates that are considered when
11220 seeking a basis for a new straight-line strength reduction candidate.
11223 Enable buffer overflow detection for global objects. This kind
11224 of protection is enabled by default if you are using
11225 @option{-fsanitize=address} option.
11226 To disable global objects protection use @option{--param asan-globals=0}.
11229 Enable buffer overflow detection for stack objects. This kind of
11230 protection is enabled by default when using @option{-fsanitize=address}.
11231 To disable stack protection use @option{--param asan-stack=0} option.
11233 @item asan-instrument-reads
11234 Enable buffer overflow detection for memory reads. This kind of
11235 protection is enabled by default when using @option{-fsanitize=address}.
11236 To disable memory reads protection use
11237 @option{--param asan-instrument-reads=0}.
11239 @item asan-instrument-writes
11240 Enable buffer overflow detection for memory writes. This kind of
11241 protection is enabled by default when using @option{-fsanitize=address}.
11242 To disable memory writes protection use
11243 @option{--param asan-instrument-writes=0} option.
11245 @item asan-memintrin
11246 Enable detection for built-in functions. This kind of protection
11247 is enabled by default when using @option{-fsanitize=address}.
11248 To disable built-in functions protection use
11249 @option{--param asan-memintrin=0}.
11251 @item asan-use-after-return
11252 Enable detection of use-after-return. This kind of protection
11253 is enabled by default when using the @option{-fsanitize=address} option.
11254 To disable it use @option{--param asan-use-after-return=0}.
11256 Note: By default the check is disabled at run time. To enable it,
11257 add @code{detect_stack_use_after_return=1} to the environment variable
11258 @env{ASAN_OPTIONS}.
11260 @item asan-instrumentation-with-call-threshold
11261 If number of memory accesses in function being instrumented
11262 is greater or equal to this number, use callbacks instead of inline checks.
11263 E.g. to disable inline code use
11264 @option{--param asan-instrumentation-with-call-threshold=0}.
11266 @item use-after-scope-direct-emission-threshold
11267 If the size of a local variable in bytes is smaller or equal to this
11268 number, directly poison (or unpoison) shadow memory instead of using
11269 run-time callbacks. The default value is 256.
11271 @item max-fsm-thread-path-insns
11272 Maximum number of instructions to copy when duplicating blocks on a
11273 finite state automaton jump thread path. The default is 100.
11275 @item max-fsm-thread-length
11276 Maximum number of basic blocks on a finite state automaton jump thread
11277 path. The default is 10.
11279 @item max-fsm-thread-paths
11280 Maximum number of new jump thread paths to create for a finite state
11281 automaton. The default is 50.
11283 @item parloops-chunk-size
11284 Chunk size of omp schedule for loops parallelized by parloops. The default
11287 @item parloops-schedule
11288 Schedule type of omp schedule for loops parallelized by parloops (static,
11289 dynamic, guided, auto, runtime). The default is static.
11291 @item parloops-min-per-thread
11292 The minimum number of iterations per thread of an innermost parallelized
11293 loop for which the parallelized variant is prefered over the single threaded
11294 one. The default is 100. Note that for a parallelized loop nest the
11295 minimum number of iterations of the outermost loop per thread is two.
11297 @item max-ssa-name-query-depth
11298 Maximum depth of recursion when querying properties of SSA names in things
11299 like fold routines. One level of recursion corresponds to following a
11302 @item hsa-gen-debug-stores
11303 Enable emission of special debug stores within HSA kernels which are
11304 then read and reported by libgomp plugin. Generation of these stores
11305 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
11308 @item max-speculative-devirt-maydefs
11309 The maximum number of may-defs we analyze when looking for a must-def
11310 specifying the dynamic type of an object that invokes a virtual call
11311 we may be able to devirtualize speculatively.
11313 @item max-vrp-switch-assertions
11314 The maximum number of assertions to add along the default edge of a switch
11315 statement during VRP. The default is 10.
11317 @item unroll-jam-min-percent
11318 The minimum percentage of memory references that must be optimized
11319 away for the unroll-and-jam transformation to be considered profitable.
11321 @item unroll-jam-max-unroll
11322 The maximum number of times the outer loop should be unrolled by
11323 the unroll-and-jam transformation.
11327 @node Instrumentation Options
11328 @section Program Instrumentation Options
11329 @cindex instrumentation options
11330 @cindex program instrumentation options
11331 @cindex run-time error checking options
11332 @cindex profiling options
11333 @cindex options, program instrumentation
11334 @cindex options, run-time error checking
11335 @cindex options, profiling
11337 GCC supports a number of command-line options that control adding
11338 run-time instrumentation to the code it normally generates.
11339 For example, one purpose of instrumentation is collect profiling
11340 statistics for use in finding program hot spots, code coverage
11341 analysis, or profile-guided optimizations.
11342 Another class of program instrumentation is adding run-time checking
11343 to detect programming errors like invalid pointer
11344 dereferences or out-of-bounds array accesses, as well as deliberately
11345 hostile attacks such as stack smashing or C++ vtable hijacking.
11346 There is also a general hook which can be used to implement other
11347 forms of tracing or function-level instrumentation for debug or
11348 program analysis purposes.
11351 @cindex @command{prof}
11354 Generate extra code to write profile information suitable for the
11355 analysis program @command{prof}. You must use this option when compiling
11356 the source files you want data about, and you must also use it when
11359 @cindex @command{gprof}
11362 Generate extra code to write profile information suitable for the
11363 analysis program @command{gprof}. You must use this option when compiling
11364 the source files you want data about, and you must also use it when
11367 @item -fprofile-arcs
11368 @opindex fprofile-arcs
11369 Add code so that program flow @dfn{arcs} are instrumented. During
11370 execution the program records how many times each branch and call is
11371 executed and how many times it is taken or returns. On targets that support
11372 constructors with priority support, profiling properly handles constructors,
11373 destructors and C++ constructors (and destructors) of classes which are used
11374 as a type of a global variable.
11377 program exits it saves this data to a file called
11378 @file{@var{auxname}.gcda} for each source file. The data may be used for
11379 profile-directed optimizations (@option{-fbranch-probabilities}), or for
11380 test coverage analysis (@option{-ftest-coverage}). Each object file's
11381 @var{auxname} is generated from the name of the output file, if
11382 explicitly specified and it is not the final executable, otherwise it is
11383 the basename of the source file. In both cases any suffix is removed
11384 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
11385 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
11386 @xref{Cross-profiling}.
11388 @cindex @command{gcov}
11392 This option is used to compile and link code instrumented for coverage
11393 analysis. The option is a synonym for @option{-fprofile-arcs}
11394 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
11395 linking). See the documentation for those options for more details.
11400 Compile the source files with @option{-fprofile-arcs} plus optimization
11401 and code generation options. For test coverage analysis, use the
11402 additional @option{-ftest-coverage} option. You do not need to profile
11403 every source file in a program.
11406 Compile the source files additionally with @option{-fprofile-abs-path}
11407 to create absolute path names in the @file{.gcno} files. This allows
11408 @command{gcov} to find the correct sources in projects where compilations
11409 occur with different working directories.
11412 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
11413 (the latter implies the former).
11416 Run the program on a representative workload to generate the arc profile
11417 information. This may be repeated any number of times. You can run
11418 concurrent instances of your program, and provided that the file system
11419 supports locking, the data files will be correctly updated. Unless
11420 a strict ISO C dialect option is in effect, @code{fork} calls are
11421 detected and correctly handled without double counting.
11424 For profile-directed optimizations, compile the source files again with
11425 the same optimization and code generation options plus
11426 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
11427 Control Optimization}).
11430 For test coverage analysis, use @command{gcov} to produce human readable
11431 information from the @file{.gcno} and @file{.gcda} files. Refer to the
11432 @command{gcov} documentation for further information.
11436 With @option{-fprofile-arcs}, for each function of your program GCC
11437 creates a program flow graph, then finds a spanning tree for the graph.
11438 Only arcs that are not on the spanning tree have to be instrumented: the
11439 compiler adds code to count the number of times that these arcs are
11440 executed. When an arc is the only exit or only entrance to a block, the
11441 instrumentation code can be added to the block; otherwise, a new basic
11442 block must be created to hold the instrumentation code.
11445 @item -ftest-coverage
11446 @opindex ftest-coverage
11447 Produce a notes file that the @command{gcov} code-coverage utility
11448 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
11449 show program coverage. Each source file's note file is called
11450 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
11451 above for a description of @var{auxname} and instructions on how to
11452 generate test coverage data. Coverage data matches the source files
11453 more closely if you do not optimize.
11455 @item -fprofile-abs-path
11456 @opindex fprofile-abs-path
11457 Automatically convert relative source file names to absolute path names
11458 in the @file{.gcno} files. This allows @command{gcov} to find the correct
11459 sources in projects where compilations occur with different working
11462 @item -fprofile-dir=@var{path}
11463 @opindex fprofile-dir
11465 Set the directory to search for the profile data files in to @var{path}.
11466 This option affects only the profile data generated by
11467 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
11468 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
11469 and its related options. Both absolute and relative paths can be used.
11470 By default, GCC uses the current directory as @var{path}, thus the
11471 profile data file appears in the same directory as the object file.
11472 In order to prevent the file name clashing, if the object file name is
11473 not an absolute path, we mangle the absolute path of the
11474 @file{@var{sourcename}.gcda} file and use it as the file name of a
11477 When an executable is run in a massive parallel environment, it is recommended
11478 to save profile to different folders. That can be done with variables
11479 in @var{path} that are exported during run-time:
11487 value of environment variable @var{VAR}
11491 @item -fprofile-generate
11492 @itemx -fprofile-generate=@var{path}
11493 @opindex fprofile-generate
11495 Enable options usually used for instrumenting application to produce
11496 profile useful for later recompilation with profile feedback based
11497 optimization. You must use @option{-fprofile-generate} both when
11498 compiling and when linking your program.
11500 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
11502 If @var{path} is specified, GCC looks at the @var{path} to find
11503 the profile feedback data files. See @option{-fprofile-dir}.
11505 To optimize the program based on the collected profile information, use
11506 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
11508 @item -fprofile-update=@var{method}
11509 @opindex fprofile-update
11511 Alter the update method for an application instrumented for profile
11512 feedback based optimization. The @var{method} argument should be one of
11513 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
11514 The first one is useful for single-threaded applications,
11515 while the second one prevents profile corruption by emitting thread-safe code.
11517 @strong{Warning:} When an application does not properly join all threads
11518 (or creates an detached thread), a profile file can be still corrupted.
11520 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
11521 when supported by a target, or to @samp{single} otherwise. The GCC driver
11522 automatically selects @samp{prefer-atomic} when @option{-pthread}
11523 is present in the command line.
11525 @item -fsanitize=address
11526 @opindex fsanitize=address
11527 Enable AddressSanitizer, a fast memory error detector.
11528 Memory access instructions are instrumented to detect
11529 out-of-bounds and use-after-free bugs.
11530 The option enables @option{-fsanitize-address-use-after-scope}.
11531 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
11532 more details. The run-time behavior can be influenced using the
11533 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
11534 the available options are shown at startup of the instrumented program. See
11535 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
11536 for a list of supported options.
11537 The option cannot be combined with @option{-fsanitize=thread}.
11539 @item -fsanitize=kernel-address
11540 @opindex fsanitize=kernel-address
11541 Enable AddressSanitizer for Linux kernel.
11542 See @uref{https://github.com/google/kasan/wiki} for more details.
11544 @item -fsanitize=pointer-compare
11545 @opindex fsanitize=pointer-compare
11546 Instrument comparison operation (<, <=, >, >=) with pointer operands.
11547 The option must be combined with either @option{-fsanitize=kernel-address} or
11548 @option{-fsanitize=address}
11549 The option cannot be combined with @option{-fsanitize=thread}.
11550 Note: By default the check is disabled at run time. To enable it,
11551 add @code{detect_invalid_pointer_pairs=2} to the environment variable
11552 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
11553 invalid operation only when both pointers are non-null.
11555 @item -fsanitize=pointer-subtract
11556 @opindex fsanitize=pointer-subtract
11557 Instrument subtraction with pointer operands.
11558 The option must be combined with either @option{-fsanitize=kernel-address} or
11559 @option{-fsanitize=address}
11560 The option cannot be combined with @option{-fsanitize=thread}.
11561 Note: By default the check is disabled at run time. To enable it,
11562 add @code{detect_invalid_pointer_pairs=2} to the environment variable
11563 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
11564 invalid operation only when both pointers are non-null.
11566 @item -fsanitize=thread
11567 @opindex fsanitize=thread
11568 Enable ThreadSanitizer, a fast data race detector.
11569 Memory access instructions are instrumented to detect
11570 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
11571 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
11572 environment variable; see
11573 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
11575 The option cannot be combined with @option{-fsanitize=address},
11576 @option{-fsanitize=leak}.
11578 Note that sanitized atomic builtins cannot throw exceptions when
11579 operating on invalid memory addresses with non-call exceptions
11580 (@option{-fnon-call-exceptions}).
11582 @item -fsanitize=leak
11583 @opindex fsanitize=leak
11584 Enable LeakSanitizer, a memory leak detector.
11585 This option only matters for linking of executables and
11586 the executable is linked against a library that overrides @code{malloc}
11587 and other allocator functions. See
11588 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
11589 details. The run-time behavior can be influenced using the
11590 @env{LSAN_OPTIONS} environment variable.
11591 The option cannot be combined with @option{-fsanitize=thread}.
11593 @item -fsanitize=undefined
11594 @opindex fsanitize=undefined
11595 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
11596 Various computations are instrumented to detect undefined behavior
11597 at runtime. Current suboptions are:
11601 @item -fsanitize=shift
11602 @opindex fsanitize=shift
11603 This option enables checking that the result of a shift operation is
11604 not undefined. Note that what exactly is considered undefined differs
11605 slightly between C and C++, as well as between ISO C90 and C99, etc.
11606 This option has two suboptions, @option{-fsanitize=shift-base} and
11607 @option{-fsanitize=shift-exponent}.
11609 @item -fsanitize=shift-exponent
11610 @opindex fsanitize=shift-exponent
11611 This option enables checking that the second argument of a shift operation
11612 is not negative and is smaller than the precision of the promoted first
11615 @item -fsanitize=shift-base
11616 @opindex fsanitize=shift-base
11617 If the second argument of a shift operation is within range, check that the
11618 result of a shift operation is not undefined. Note that what exactly is
11619 considered undefined differs slightly between C and C++, as well as between
11620 ISO C90 and C99, etc.
11622 @item -fsanitize=integer-divide-by-zero
11623 @opindex fsanitize=integer-divide-by-zero
11624 Detect integer division by zero as well as @code{INT_MIN / -1} division.
11626 @item -fsanitize=unreachable
11627 @opindex fsanitize=unreachable
11628 With this option, the compiler turns the @code{__builtin_unreachable}
11629 call into a diagnostics message call instead. When reaching the
11630 @code{__builtin_unreachable} call, the behavior is undefined.
11632 @item -fsanitize=vla-bound
11633 @opindex fsanitize=vla-bound
11634 This option instructs the compiler to check that the size of a variable
11635 length array is positive.
11637 @item -fsanitize=null
11638 @opindex fsanitize=null
11639 This option enables pointer checking. Particularly, the application
11640 built with this option turned on will issue an error message when it
11641 tries to dereference a NULL pointer, or if a reference (possibly an
11642 rvalue reference) is bound to a NULL pointer, or if a method is invoked
11643 on an object pointed by a NULL pointer.
11645 @item -fsanitize=return
11646 @opindex fsanitize=return
11647 This option enables return statement checking. Programs
11648 built with this option turned on will issue an error message
11649 when the end of a non-void function is reached without actually
11650 returning a value. This option works in C++ only.
11652 @item -fsanitize=signed-integer-overflow
11653 @opindex fsanitize=signed-integer-overflow
11654 This option enables signed integer overflow checking. We check that
11655 the result of @code{+}, @code{*}, and both unary and binary @code{-}
11656 does not overflow in the signed arithmetics. Note, integer promotion
11657 rules must be taken into account. That is, the following is not an
11660 signed char a = SCHAR_MAX;
11664 @item -fsanitize=bounds
11665 @opindex fsanitize=bounds
11666 This option enables instrumentation of array bounds. Various out of bounds
11667 accesses are detected. Flexible array members, flexible array member-like
11668 arrays, and initializers of variables with static storage are not instrumented.
11670 @item -fsanitize=bounds-strict
11671 @opindex fsanitize=bounds-strict
11672 This option enables strict instrumentation of array bounds. Most out of bounds
11673 accesses are detected, including flexible array members and flexible array
11674 member-like arrays. Initializers of variables with static storage are not
11677 @item -fsanitize=alignment
11678 @opindex fsanitize=alignment
11680 This option enables checking of alignment of pointers when they are
11681 dereferenced, or when a reference is bound to insufficiently aligned target,
11682 or when a method or constructor is invoked on insufficiently aligned object.
11684 @item -fsanitize=object-size
11685 @opindex fsanitize=object-size
11686 This option enables instrumentation of memory references using the
11687 @code{__builtin_object_size} function. Various out of bounds pointer
11688 accesses are detected.
11690 @item -fsanitize=float-divide-by-zero
11691 @opindex fsanitize=float-divide-by-zero
11692 Detect floating-point division by zero. Unlike other similar options,
11693 @option{-fsanitize=float-divide-by-zero} is not enabled by
11694 @option{-fsanitize=undefined}, since floating-point division by zero can
11695 be a legitimate way of obtaining infinities and NaNs.
11697 @item -fsanitize=float-cast-overflow
11698 @opindex fsanitize=float-cast-overflow
11699 This option enables floating-point type to integer conversion checking.
11700 We check that the result of the conversion does not overflow.
11701 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
11702 not enabled by @option{-fsanitize=undefined}.
11703 This option does not work well with @code{FE_INVALID} exceptions enabled.
11705 @item -fsanitize=nonnull-attribute
11706 @opindex fsanitize=nonnull-attribute
11708 This option enables instrumentation of calls, checking whether null values
11709 are not passed to arguments marked as requiring a non-null value by the
11710 @code{nonnull} function attribute.
11712 @item -fsanitize=returns-nonnull-attribute
11713 @opindex fsanitize=returns-nonnull-attribute
11715 This option enables instrumentation of return statements in functions
11716 marked with @code{returns_nonnull} function attribute, to detect returning
11717 of null values from such functions.
11719 @item -fsanitize=bool
11720 @opindex fsanitize=bool
11722 This option enables instrumentation of loads from bool. If a value other
11723 than 0/1 is loaded, a run-time error is issued.
11725 @item -fsanitize=enum
11726 @opindex fsanitize=enum
11728 This option enables instrumentation of loads from an enum type. If
11729 a value outside the range of values for the enum type is loaded,
11730 a run-time error is issued.
11732 @item -fsanitize=vptr
11733 @opindex fsanitize=vptr
11735 This option enables instrumentation of C++ member function calls, member
11736 accesses and some conversions between pointers to base and derived classes,
11737 to verify the referenced object has the correct dynamic type.
11739 @item -fsanitize=pointer-overflow
11740 @opindex fsanitize=pointer-overflow
11742 This option enables instrumentation of pointer arithmetics. If the pointer
11743 arithmetics overflows, a run-time error is issued.
11745 @item -fsanitize=builtin
11746 @opindex fsanitize=builtin
11748 This option enables instrumentation of arguments to selected builtin
11749 functions. If an invalid value is passed to such arguments, a run-time
11750 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
11751 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
11756 While @option{-ftrapv} causes traps for signed overflows to be emitted,
11757 @option{-fsanitize=undefined} gives a diagnostic message.
11758 This currently works only for the C family of languages.
11760 @item -fno-sanitize=all
11761 @opindex fno-sanitize=all
11763 This option disables all previously enabled sanitizers.
11764 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
11767 @item -fasan-shadow-offset=@var{number}
11768 @opindex fasan-shadow-offset
11769 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
11770 It is useful for experimenting with different shadow memory layouts in
11771 Kernel AddressSanitizer.
11773 @item -fsanitize-sections=@var{s1},@var{s2},...
11774 @opindex fsanitize-sections
11775 Sanitize global variables in selected user-defined sections. @var{si} may
11778 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
11779 @opindex fsanitize-recover
11780 @opindex fno-sanitize-recover
11781 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
11782 mentioned in comma-separated list of @var{opts}. Enabling this option
11783 for a sanitizer component causes it to attempt to continue
11784 running the program as if no error happened. This means multiple
11785 runtime errors can be reported in a single program run, and the exit
11786 code of the program may indicate success even when errors
11787 have been reported. The @option{-fno-sanitize-recover=} option
11788 can be used to alter
11789 this behavior: only the first detected error is reported
11790 and program then exits with a non-zero exit code.
11792 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
11793 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
11794 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
11795 @option{-fsanitize=bounds-strict},
11796 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
11797 For these sanitizers error recovery is turned on by default,
11798 except @option{-fsanitize=address}, for which this feature is experimental.
11799 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
11800 accepted, the former enables recovery for all sanitizers that support it,
11801 the latter disables recovery for all sanitizers that support it.
11803 Even if a recovery mode is turned on the compiler side, it needs to be also
11804 enabled on the runtime library side, otherwise the failures are still fatal.
11805 The runtime library defaults to @code{halt_on_error=0} for
11806 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
11807 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
11808 setting the @code{halt_on_error} flag in the corresponding environment variable.
11810 Syntax without an explicit @var{opts} parameter is deprecated. It is
11811 equivalent to specifying an @var{opts} list of:
11814 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
11817 @item -fsanitize-address-use-after-scope
11818 @opindex fsanitize-address-use-after-scope
11819 Enable sanitization of local variables to detect use-after-scope bugs.
11820 The option sets @option{-fstack-reuse} to @samp{none}.
11822 @item -fsanitize-undefined-trap-on-error
11823 @opindex fsanitize-undefined-trap-on-error
11824 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
11825 report undefined behavior using @code{__builtin_trap} rather than
11826 a @code{libubsan} library routine. The advantage of this is that the
11827 @code{libubsan} library is not needed and is not linked in, so this
11828 is usable even in freestanding environments.
11830 @item -fsanitize-coverage=trace-pc
11831 @opindex fsanitize-coverage=trace-pc
11832 Enable coverage-guided fuzzing code instrumentation.
11833 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
11835 @item -fsanitize-coverage=trace-cmp
11836 @opindex fsanitize-coverage=trace-cmp
11837 Enable dataflow guided fuzzing code instrumentation.
11838 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
11839 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
11840 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
11841 variable or @code{__sanitizer_cov_trace_const_cmp1},
11842 @code{__sanitizer_cov_trace_const_cmp2},
11843 @code{__sanitizer_cov_trace_const_cmp4} or
11844 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
11845 operand constant, @code{__sanitizer_cov_trace_cmpf} or
11846 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
11847 @code{__sanitizer_cov_trace_switch} for switch statements.
11849 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
11850 @opindex fcf-protection
11851 Enable code instrumentation of control-flow transfers to increase
11852 program security by checking that target addresses of control-flow
11853 transfer instructions (such as indirect function call, function return,
11854 indirect jump) are valid. This prevents diverting the flow of control
11855 to an unexpected target. This is intended to protect against such
11856 threats as Return-oriented Programming (ROP), and similarly
11857 call/jmp-oriented programming (COP/JOP).
11859 The value @code{branch} tells the compiler to implement checking of
11860 validity of control-flow transfer at the point of indirect branch
11861 instructions, i.e. call/jmp instructions. The value @code{return}
11862 implements checking of validity at the point of returning from a
11863 function. The value @code{full} is an alias for specifying both
11864 @code{branch} and @code{return}. The value @code{none} turns off
11867 The macro @code{__CET__} is defined when @option{-fcf-protection} is
11868 used. The first bit of @code{__CET__} is set to 1 for the value
11869 @code{branch} and the second bit of @code{__CET__} is set to 1 for
11872 You can also use the @code{nocf_check} attribute to identify
11873 which functions and calls should be skipped from instrumentation
11874 (@pxref{Function Attributes}).
11876 Currently the x86 GNU/Linux target provides an implementation based
11877 on Intel Control-flow Enforcement Technology (CET).
11879 @item -fstack-protector
11880 @opindex fstack-protector
11881 Emit extra code to check for buffer overflows, such as stack smashing
11882 attacks. This is done by adding a guard variable to functions with
11883 vulnerable objects. This includes functions that call @code{alloca}, and
11884 functions with buffers larger than 8 bytes. The guards are initialized
11885 when a function is entered and then checked when the function exits.
11886 If a guard check fails, an error message is printed and the program exits.
11888 @item -fstack-protector-all
11889 @opindex fstack-protector-all
11890 Like @option{-fstack-protector} except that all functions are protected.
11892 @item -fstack-protector-strong
11893 @opindex fstack-protector-strong
11894 Like @option{-fstack-protector} but includes additional functions to
11895 be protected --- those that have local array definitions, or have
11896 references to local frame addresses.
11898 @item -fstack-protector-explicit
11899 @opindex fstack-protector-explicit
11900 Like @option{-fstack-protector} but only protects those functions which
11901 have the @code{stack_protect} attribute.
11903 @item -fstack-check
11904 @opindex fstack-check
11905 Generate code to verify that you do not go beyond the boundary of the
11906 stack. You should specify this flag if you are running in an
11907 environment with multiple threads, but you only rarely need to specify it in
11908 a single-threaded environment since stack overflow is automatically
11909 detected on nearly all systems if there is only one stack.
11911 Note that this switch does not actually cause checking to be done; the
11912 operating system or the language runtime must do that. The switch causes
11913 generation of code to ensure that they see the stack being extended.
11915 You can additionally specify a string parameter: @samp{no} means no
11916 checking, @samp{generic} means force the use of old-style checking,
11917 @samp{specific} means use the best checking method and is equivalent
11918 to bare @option{-fstack-check}.
11920 Old-style checking is a generic mechanism that requires no specific
11921 target support in the compiler but comes with the following drawbacks:
11925 Modified allocation strategy for large objects: they are always
11926 allocated dynamically if their size exceeds a fixed threshold. Note this
11927 may change the semantics of some code.
11930 Fixed limit on the size of the static frame of functions: when it is
11931 topped by a particular function, stack checking is not reliable and
11932 a warning is issued by the compiler.
11935 Inefficiency: because of both the modified allocation strategy and the
11936 generic implementation, code performance is hampered.
11939 Note that old-style stack checking is also the fallback method for
11940 @samp{specific} if no target support has been added in the compiler.
11942 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
11943 and stack overflows. @samp{specific} is an excellent choice when compiling
11944 Ada code. It is not generally sufficient to protect against stack-clash
11945 attacks. To protect against those you want @samp{-fstack-clash-protection}.
11947 @item -fstack-clash-protection
11948 @opindex fstack-clash-protection
11949 Generate code to prevent stack clash style attacks. When this option is
11950 enabled, the compiler will only allocate one page of stack space at a time
11951 and each page is accessed immediately after allocation. Thus, it prevents
11952 allocations from jumping over any stack guard page provided by the
11955 Most targets do not fully support stack clash protection. However, on
11956 those targets @option{-fstack-clash-protection} will protect dynamic stack
11957 allocations. @option{-fstack-clash-protection} may also provide limited
11958 protection for static stack allocations if the target supports
11959 @option{-fstack-check=specific}.
11961 @item -fstack-limit-register=@var{reg}
11962 @itemx -fstack-limit-symbol=@var{sym}
11963 @itemx -fno-stack-limit
11964 @opindex fstack-limit-register
11965 @opindex fstack-limit-symbol
11966 @opindex fno-stack-limit
11967 Generate code to ensure that the stack does not grow beyond a certain value,
11968 either the value of a register or the address of a symbol. If a larger
11969 stack is required, a signal is raised at run time. For most targets,
11970 the signal is raised before the stack overruns the boundary, so
11971 it is possible to catch the signal without taking special precautions.
11973 For instance, if the stack starts at absolute address @samp{0x80000000}
11974 and grows downwards, you can use the flags
11975 @option{-fstack-limit-symbol=__stack_limit} and
11976 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
11977 of 128KB@. Note that this may only work with the GNU linker.
11979 You can locally override stack limit checking by using the
11980 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
11982 @item -fsplit-stack
11983 @opindex fsplit-stack
11984 Generate code to automatically split the stack before it overflows.
11985 The resulting program has a discontiguous stack which can only
11986 overflow if the program is unable to allocate any more memory. This
11987 is most useful when running threaded programs, as it is no longer
11988 necessary to calculate a good stack size to use for each thread. This
11989 is currently only implemented for the x86 targets running
11992 When code compiled with @option{-fsplit-stack} calls code compiled
11993 without @option{-fsplit-stack}, there may not be much stack space
11994 available for the latter code to run. If compiling all code,
11995 including library code, with @option{-fsplit-stack} is not an option,
11996 then the linker can fix up these calls so that the code compiled
11997 without @option{-fsplit-stack} always has a large stack. Support for
11998 this is implemented in the gold linker in GNU binutils release 2.21
12001 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
12002 @opindex fvtable-verify
12003 This option is only available when compiling C++ code.
12004 It turns on (or off, if using @option{-fvtable-verify=none}) the security
12005 feature that verifies at run time, for every virtual call, that
12006 the vtable pointer through which the call is made is valid for the type of
12007 the object, and has not been corrupted or overwritten. If an invalid vtable
12008 pointer is detected at run time, an error is reported and execution of the
12009 program is immediately halted.
12011 This option causes run-time data structures to be built at program startup,
12012 which are used for verifying the vtable pointers.
12013 The options @samp{std} and @samp{preinit}
12014 control the timing of when these data structures are built. In both cases the
12015 data structures are built before execution reaches @code{main}. Using
12016 @option{-fvtable-verify=std} causes the data structures to be built after
12017 shared libraries have been loaded and initialized.
12018 @option{-fvtable-verify=preinit} causes them to be built before shared
12019 libraries have been loaded and initialized.
12021 If this option appears multiple times in the command line with different
12022 values specified, @samp{none} takes highest priority over both @samp{std} and
12023 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
12026 @opindex fvtv-debug
12027 When used in conjunction with @option{-fvtable-verify=std} or
12028 @option{-fvtable-verify=preinit}, causes debug versions of the
12029 runtime functions for the vtable verification feature to be called.
12030 This flag also causes the compiler to log information about which
12031 vtable pointers it finds for each class.
12032 This information is written to a file named @file{vtv_set_ptr_data.log}
12033 in the directory named by the environment variable @env{VTV_LOGS_DIR}
12034 if that is defined or the current working directory otherwise.
12036 Note: This feature @emph{appends} data to the log file. If you want a fresh log
12037 file, be sure to delete any existing one.
12040 @opindex fvtv-counts
12041 This is a debugging flag. When used in conjunction with
12042 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
12043 causes the compiler to keep track of the total number of virtual calls
12044 it encounters and the number of verifications it inserts. It also
12045 counts the number of calls to certain run-time library functions
12046 that it inserts and logs this information for each compilation unit.
12047 The compiler writes this information to a file named
12048 @file{vtv_count_data.log} in the directory named by the environment
12049 variable @env{VTV_LOGS_DIR} if that is defined or the current working
12050 directory otherwise. It also counts the size of the vtable pointer sets
12051 for each class, and writes this information to @file{vtv_class_set_sizes.log}
12052 in the same directory.
12054 Note: This feature @emph{appends} data to the log files. To get fresh log
12055 files, be sure to delete any existing ones.
12057 @item -finstrument-functions
12058 @opindex finstrument-functions
12059 Generate instrumentation calls for entry and exit to functions. Just
12060 after function entry and just before function exit, the following
12061 profiling functions are called with the address of the current
12062 function and its call site. (On some platforms,
12063 @code{__builtin_return_address} does not work beyond the current
12064 function, so the call site information may not be available to the
12065 profiling functions otherwise.)
12068 void __cyg_profile_func_enter (void *this_fn,
12070 void __cyg_profile_func_exit (void *this_fn,
12074 The first argument is the address of the start of the current function,
12075 which may be looked up exactly in the symbol table.
12077 This instrumentation is also done for functions expanded inline in other
12078 functions. The profiling calls indicate where, conceptually, the
12079 inline function is entered and exited. This means that addressable
12080 versions of such functions must be available. If all your uses of a
12081 function are expanded inline, this may mean an additional expansion of
12082 code size. If you use @code{extern inline} in your C code, an
12083 addressable version of such functions must be provided. (This is
12084 normally the case anyway, but if you get lucky and the optimizer always
12085 expands the functions inline, you might have gotten away without
12086 providing static copies.)
12088 A function may be given the attribute @code{no_instrument_function}, in
12089 which case this instrumentation is not done. This can be used, for
12090 example, for the profiling functions listed above, high-priority
12091 interrupt routines, and any functions from which the profiling functions
12092 cannot safely be called (perhaps signal handlers, if the profiling
12093 routines generate output or allocate memory).
12095 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
12096 @opindex finstrument-functions-exclude-file-list
12098 Set the list of functions that are excluded from instrumentation (see
12099 the description of @option{-finstrument-functions}). If the file that
12100 contains a function definition matches with one of @var{file}, then
12101 that function is not instrumented. The match is done on substrings:
12102 if the @var{file} parameter is a substring of the file name, it is
12103 considered to be a match.
12108 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
12112 excludes any inline function defined in files whose pathnames
12113 contain @file{/bits/stl} or @file{include/sys}.
12115 If, for some reason, you want to include letter @samp{,} in one of
12116 @var{sym}, write @samp{\,}. For example,
12117 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
12118 (note the single quote surrounding the option).
12120 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
12121 @opindex finstrument-functions-exclude-function-list
12123 This is similar to @option{-finstrument-functions-exclude-file-list},
12124 but this option sets the list of function names to be excluded from
12125 instrumentation. The function name to be matched is its user-visible
12126 name, such as @code{vector<int> blah(const vector<int> &)}, not the
12127 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
12128 match is done on substrings: if the @var{sym} parameter is a substring
12129 of the function name, it is considered to be a match. For C99 and C++
12130 extended identifiers, the function name must be given in UTF-8, not
12131 using universal character names.
12133 @item -fpatchable-function-entry=@var{N}[,@var{M}]
12134 @opindex fpatchable-function-entry
12135 Generate @var{N} NOPs right at the beginning
12136 of each function, with the function entry point before the @var{M}th NOP.
12137 If @var{M} is omitted, it defaults to @code{0} so the
12138 function entry points to the address just at the first NOP.
12139 The NOP instructions reserve extra space which can be used to patch in
12140 any desired instrumentation at run time, provided that the code segment
12141 is writable. The amount of space is controllable indirectly via
12142 the number of NOPs; the NOP instruction used corresponds to the instruction
12143 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
12144 is target-specific and may also depend on the architecture variant and/or
12145 other compilation options.
12147 For run-time identification, the starting addresses of these areas,
12148 which correspond to their respective function entries minus @var{M},
12149 are additionally collected in the @code{__patchable_function_entries}
12150 section of the resulting binary.
12152 Note that the value of @code{__attribute__ ((patchable_function_entry
12153 (N,M)))} takes precedence over command-line option
12154 @option{-fpatchable-function-entry=N,M}. This can be used to increase
12155 the area size or to remove it completely on a single function.
12156 If @code{N=0}, no pad location is recorded.
12158 The NOP instructions are inserted at---and maybe before, depending on
12159 @var{M}---the function entry address, even before the prologue.
12164 @node Preprocessor Options
12165 @section Options Controlling the Preprocessor
12166 @cindex preprocessor options
12167 @cindex options, preprocessor
12169 These options control the C preprocessor, which is run on each C source
12170 file before actual compilation.
12172 If you use the @option{-E} option, nothing is done except preprocessing.
12173 Some of these options make sense only together with @option{-E} because
12174 they cause the preprocessor output to be unsuitable for actual
12177 In addition to the options listed here, there are a number of options
12178 to control search paths for include files documented in
12179 @ref{Directory Options}.
12180 Options to control preprocessor diagnostics are listed in
12181 @ref{Warning Options}.
12184 @include cppopts.texi
12186 @item -Wp,@var{option}
12188 You can use @option{-Wp,@var{option}} to bypass the compiler driver
12189 and pass @var{option} directly through to the preprocessor. If
12190 @var{option} contains commas, it is split into multiple options at the
12191 commas. However, many options are modified, translated or interpreted
12192 by the compiler driver before being passed to the preprocessor, and
12193 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
12194 interface is undocumented and subject to change, so whenever possible
12195 you should avoid using @option{-Wp} and let the driver handle the
12198 @item -Xpreprocessor @var{option}
12199 @opindex Xpreprocessor
12200 Pass @var{option} as an option to the preprocessor. You can use this to
12201 supply system-specific preprocessor options that GCC does not
12204 If you want to pass an option that takes an argument, you must use
12205 @option{-Xpreprocessor} twice, once for the option and once for the argument.
12207 @item -no-integrated-cpp
12208 @opindex no-integrated-cpp
12209 Perform preprocessing as a separate pass before compilation.
12210 By default, GCC performs preprocessing as an integrated part of
12211 input tokenization and parsing.
12212 If this option is provided, the appropriate language front end
12213 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
12214 and Objective-C, respectively) is instead invoked twice,
12215 once for preprocessing only and once for actual compilation
12216 of the preprocessed input.
12217 This option may be useful in conjunction with the @option{-B} or
12218 @option{-wrapper} options to specify an alternate preprocessor or
12219 perform additional processing of the program source between
12220 normal preprocessing and compilation.
12224 @node Assembler Options
12225 @section Passing Options to the Assembler
12227 @c prevent bad page break with this line
12228 You can pass options to the assembler.
12231 @item -Wa,@var{option}
12233 Pass @var{option} as an option to the assembler. If @var{option}
12234 contains commas, it is split into multiple options at the commas.
12236 @item -Xassembler @var{option}
12237 @opindex Xassembler
12238 Pass @var{option} as an option to the assembler. You can use this to
12239 supply system-specific assembler options that GCC does not
12242 If you want to pass an option that takes an argument, you must use
12243 @option{-Xassembler} twice, once for the option and once for the argument.
12248 @section Options for Linking
12249 @cindex link options
12250 @cindex options, linking
12252 These options come into play when the compiler links object files into
12253 an executable output file. They are meaningless if the compiler is
12254 not doing a link step.
12258 @item @var{object-file-name}
12259 A file name that does not end in a special recognized suffix is
12260 considered to name an object file or library. (Object files are
12261 distinguished from libraries by the linker according to the file
12262 contents.) If linking is done, these object files are used as input
12271 If any of these options is used, then the linker is not run, and
12272 object file names should not be used as arguments. @xref{Overall
12275 @item -flinker-output=@var{type}
12276 @opindex -flinker-output
12277 This option controls the code generation of the link time optimizer. By
12278 default the linker output is determined by the linker plugin automatically. For
12279 debugging the compiler and in the case of incremental linking to non-lto object
12280 file is desired, it may be useful to control the type manually.
12282 If @var{type} is @samp{exec} the code generation is configured to produce static
12283 binary. In this case @option{-fpic} and @option{-fpie} are both disabled.
12285 If @var{type} is @samp{dyn} the code generation is configured to produce shared
12286 library. In this case @option{-fpic} or @option{-fPIC} is preserved, but not
12287 enabled automatically. This makes it possible to build shared libraries without
12288 position independent code on architectures this is possible, i.e. on x86.
12290 If @var{type} is @samp{pie} the code generation is configured to produce
12291 @option{-fpie} executable. This result in similar optimizations as @samp{exec}
12292 except that @option{-fpie} is not disabled if specified at compilation time.
12294 If @var{type} is @samp{rel} the compiler assumes that incremental linking is
12295 done. The sections containing intermediate code for link-time optimization are
12296 merged, pre-optimized, and output to the resulting object file. In addition, if
12297 @option{-ffat-lto-objects} is specified the binary code is produced for future
12298 non-lto linking. The object file produced by incremental linking will be smaller
12299 than a static library produced from the same object files. At link-time the
12300 result of incremental linking will also load faster to compiler than a static
12301 library assuming that majority of objects in the library are used.
12303 Finally @samp{nolto-rel} configure compiler to for incremental linking where
12304 code generation is forced, final binary is produced and the intermediate code
12305 for later link-time optimization is stripped. When multiple object files are
12306 linked together the resulting code will be optimized better than with link time
12307 optimizations disabled (for example, the cross-module inlining will happen),
12308 most of benefits of whole program optimizations are however lost.
12310 During the incremental link (by @option{-r}) the linker plugin will default to
12311 @option{rel}. With current interfaces to GNU Binutils it is however not
12312 possible to link incrementally LTO objects and non-LTO objects into a single
12313 mixed object file. In the case any of object files in incremental link can not
12314 be used for link-time optimization the linker plugin will output warning and
12315 use @samp{nolto-rel}. To maintain the whole program optimization it is
12316 recommended to link such objects into static library instead. Alternatively it
12317 is possible to use H.J. Lu's binutils with support for mixed objects.
12320 @opindex fuse-ld=bfd
12321 Use the @command{bfd} linker instead of the default linker.
12323 @item -fuse-ld=gold
12324 @opindex fuse-ld=gold
12325 Use the @command{gold} linker instead of the default linker.
12328 @item -l@var{library}
12329 @itemx -l @var{library}
12331 Search the library named @var{library} when linking. (The second
12332 alternative with the library as a separate argument is only for
12333 POSIX compliance and is not recommended.)
12335 It makes a difference where in the command you write this option; the
12336 linker searches and processes libraries and object files in the order they
12337 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
12338 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
12339 to functions in @samp{z}, those functions may not be loaded.
12341 The linker searches a standard list of directories for the library,
12342 which is actually a file named @file{lib@var{library}.a}. The linker
12343 then uses this file as if it had been specified precisely by name.
12345 The directories searched include several standard system directories
12346 plus any that you specify with @option{-L}.
12348 Normally the files found this way are library files---archive files
12349 whose members are object files. The linker handles an archive file by
12350 scanning through it for members which define symbols that have so far
12351 been referenced but not defined. But if the file that is found is an
12352 ordinary object file, it is linked in the usual fashion. The only
12353 difference between using an @option{-l} option and specifying a file name
12354 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
12355 and searches several directories.
12359 You need this special case of the @option{-l} option in order to
12360 link an Objective-C or Objective-C++ program.
12362 @item -nostartfiles
12363 @opindex nostartfiles
12364 Do not use the standard system startup files when linking.
12365 The standard system libraries are used normally, unless @option{-nostdlib},
12366 @option{-nolibc}, or @option{-nodefaultlibs} is used.
12368 @item -nodefaultlibs
12369 @opindex nodefaultlibs
12370 Do not use the standard system libraries when linking.
12371 Only the libraries you specify are passed to the linker, and options
12372 specifying linkage of the system libraries, such as @option{-static-libgcc}
12373 or @option{-shared-libgcc}, are ignored.
12374 The standard startup files are used normally, unless @option{-nostartfiles}
12377 The compiler may generate calls to @code{memcmp},
12378 @code{memset}, @code{memcpy} and @code{memmove}.
12379 These entries are usually resolved by entries in
12380 libc. These entry points should be supplied through some other
12381 mechanism when this option is specified.
12385 Do not use the C library or system libraries tightly coupled with it when
12386 linking. Still link with the startup files, @file{libgcc} or toolchain
12387 provided language support libraries such as @file{libgnat}, @file{libgfortran}
12388 or @file{libstdc++} unless options preventing their inclusion are used as
12389 well. This typically removes @option{-lc} from the link command line, as well
12390 as system libraries that normally go with it and become meaningless when
12391 absence of a C library is assumed, for example @option{-lpthread} or
12392 @option{-lm} in some configurations. This is intended for bare-board
12393 targets when there is indeed no C library available.
12397 Do not use the standard system startup files or libraries when linking.
12398 No startup files and only the libraries you specify are passed to
12399 the linker, and options specifying linkage of the system libraries, such as
12400 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
12402 The compiler may generate calls to @code{memcmp}, @code{memset},
12403 @code{memcpy} and @code{memmove}.
12404 These entries are usually resolved by entries in
12405 libc. These entry points should be supplied through some other
12406 mechanism when this option is specified.
12408 @cindex @option{-lgcc}, use with @option{-nostdlib}
12409 @cindex @option{-nostdlib} and unresolved references
12410 @cindex unresolved references and @option{-nostdlib}
12411 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
12412 @cindex @option{-nodefaultlibs} and unresolved references
12413 @cindex unresolved references and @option{-nodefaultlibs}
12414 One of the standard libraries bypassed by @option{-nostdlib} and
12415 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
12416 which GCC uses to overcome shortcomings of particular machines, or special
12417 needs for some languages.
12418 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
12419 Collection (GCC) Internals},
12420 for more discussion of @file{libgcc.a}.)
12421 In most cases, you need @file{libgcc.a} even when you want to avoid
12422 other standard libraries. In other words, when you specify @option{-nostdlib}
12423 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
12424 This ensures that you have no unresolved references to internal GCC
12425 library subroutines.
12426 (An example of such an internal subroutine is @code{__main}, used to ensure C++
12427 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
12428 GNU Compiler Collection (GCC) Internals}.)
12432 Produce a dynamically linked position independent executable on targets
12433 that support it. For predictable results, you must also specify the same
12434 set of options used for compilation (@option{-fpie}, @option{-fPIE},
12435 or model suboptions) when you specify this linker option.
12439 Don't produce a dynamically linked position independent executable.
12442 @opindex static-pie
12443 Produce a static position independent executable on targets that support
12444 it. A static position independent executable is similar to a static
12445 executable, but can be loaded at any address without a dynamic linker.
12446 For predictable results, you must also specify the same set of options
12447 used for compilation (@option{-fpie}, @option{-fPIE}, or model
12448 suboptions) when you specify this linker option.
12452 Link with the POSIX threads library. This option is supported on
12453 GNU/Linux targets, most other Unix derivatives, and also on
12454 x86 Cygwin and MinGW targets. On some targets this option also sets
12455 flags for the preprocessor, so it should be used consistently for both
12456 compilation and linking.
12460 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
12461 that support it. This instructs the linker to add all symbols, not
12462 only used ones, to the dynamic symbol table. This option is needed
12463 for some uses of @code{dlopen} or to allow obtaining backtraces
12464 from within a program.
12468 Remove all symbol table and relocation information from the executable.
12472 On systems that support dynamic linking, this overrides @option{-pie}
12473 and prevents linking with the shared libraries. On other systems, this
12474 option has no effect.
12478 Produce a shared object which can then be linked with other objects to
12479 form an executable. Not all systems support this option. For predictable
12480 results, you must also specify the same set of options used for compilation
12481 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
12482 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
12483 needs to build supplementary stub code for constructors to work. On
12484 multi-libbed systems, @samp{gcc -shared} must select the correct support
12485 libraries to link against. Failing to supply the correct flags may lead
12486 to subtle defects. Supplying them in cases where they are not necessary
12489 @item -shared-libgcc
12490 @itemx -static-libgcc
12491 @opindex shared-libgcc
12492 @opindex static-libgcc
12493 On systems that provide @file{libgcc} as a shared library, these options
12494 force the use of either the shared or static version, respectively.
12495 If no shared version of @file{libgcc} was built when the compiler was
12496 configured, these options have no effect.
12498 There are several situations in which an application should use the
12499 shared @file{libgcc} instead of the static version. The most common
12500 of these is when the application wishes to throw and catch exceptions
12501 across different shared libraries. In that case, each of the libraries
12502 as well as the application itself should use the shared @file{libgcc}.
12504 Therefore, the G++ and driver automatically adds @option{-shared-libgcc}
12505 whenever you build a shared library or a main executable, because C++
12506 programs typically use exceptions, so this is the right thing to do.
12508 If, instead, you use the GCC driver to create shared libraries, you may
12509 find that they are not always linked with the shared @file{libgcc}.
12510 If GCC finds, at its configuration time, that you have a non-GNU linker
12511 or a GNU linker that does not support option @option{--eh-frame-hdr},
12512 it links the shared version of @file{libgcc} into shared libraries
12513 by default. Otherwise, it takes advantage of the linker and optimizes
12514 away the linking with the shared version of @file{libgcc}, linking with
12515 the static version of libgcc by default. This allows exceptions to
12516 propagate through such shared libraries, without incurring relocation
12517 costs at library load time.
12519 However, if a library or main executable is supposed to throw or catch
12520 exceptions, you must link it using the G++ driver, as appropriate
12521 for the languages used in the program, or using the option
12522 @option{-shared-libgcc}, such that it is linked with the shared
12525 @item -static-libasan
12526 @opindex static-libasan
12527 When the @option{-fsanitize=address} option is used to link a program,
12528 the GCC driver automatically links against @option{libasan}. If
12529 @file{libasan} is available as a shared library, and the @option{-static}
12530 option is not used, then this links against the shared version of
12531 @file{libasan}. The @option{-static-libasan} option directs the GCC
12532 driver to link @file{libasan} statically, without necessarily linking
12533 other libraries statically.
12535 @item -static-libtsan
12536 @opindex static-libtsan
12537 When the @option{-fsanitize=thread} option is used to link a program,
12538 the GCC driver automatically links against @option{libtsan}. If
12539 @file{libtsan} is available as a shared library, and the @option{-static}
12540 option is not used, then this links against the shared version of
12541 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
12542 driver to link @file{libtsan} statically, without necessarily linking
12543 other libraries statically.
12545 @item -static-liblsan
12546 @opindex static-liblsan
12547 When the @option{-fsanitize=leak} option is used to link a program,
12548 the GCC driver automatically links against @option{liblsan}. If
12549 @file{liblsan} is available as a shared library, and the @option{-static}
12550 option is not used, then this links against the shared version of
12551 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
12552 driver to link @file{liblsan} statically, without necessarily linking
12553 other libraries statically.
12555 @item -static-libubsan
12556 @opindex static-libubsan
12557 When the @option{-fsanitize=undefined} option is used to link a program,
12558 the GCC driver automatically links against @option{libubsan}. If
12559 @file{libubsan} is available as a shared library, and the @option{-static}
12560 option is not used, then this links against the shared version of
12561 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
12562 driver to link @file{libubsan} statically, without necessarily linking
12563 other libraries statically.
12565 @item -static-libstdc++
12566 @opindex static-libstdc++
12567 When the @command{g++} program is used to link a C++ program, it
12568 normally automatically links against @option{libstdc++}. If
12569 @file{libstdc++} is available as a shared library, and the
12570 @option{-static} option is not used, then this links against the
12571 shared version of @file{libstdc++}. That is normally fine. However, it
12572 is sometimes useful to freeze the version of @file{libstdc++} used by
12573 the program without going all the way to a fully static link. The
12574 @option{-static-libstdc++} option directs the @command{g++} driver to
12575 link @file{libstdc++} statically, without necessarily linking other
12576 libraries statically.
12580 Bind references to global symbols when building a shared object. Warn
12581 about any unresolved references (unless overridden by the link editor
12582 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
12585 @item -T @var{script}
12587 @cindex linker script
12588 Use @var{script} as the linker script. This option is supported by most
12589 systems using the GNU linker. On some targets, such as bare-board
12590 targets without an operating system, the @option{-T} option may be required
12591 when linking to avoid references to undefined symbols.
12593 @item -Xlinker @var{option}
12595 Pass @var{option} as an option to the linker. You can use this to
12596 supply system-specific linker options that GCC does not recognize.
12598 If you want to pass an option that takes a separate argument, you must use
12599 @option{-Xlinker} twice, once for the option and once for the argument.
12600 For example, to pass @option{-assert definitions}, you must write
12601 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
12602 @option{-Xlinker "-assert definitions"}, because this passes the entire
12603 string as a single argument, which is not what the linker expects.
12605 When using the GNU linker, it is usually more convenient to pass
12606 arguments to linker options using the @option{@var{option}=@var{value}}
12607 syntax than as separate arguments. For example, you can specify
12608 @option{-Xlinker -Map=output.map} rather than
12609 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
12610 this syntax for command-line options.
12612 @item -Wl,@var{option}
12614 Pass @var{option} as an option to the linker. If @var{option} contains
12615 commas, it is split into multiple options at the commas. You can use this
12616 syntax to pass an argument to the option.
12617 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
12618 linker. When using the GNU linker, you can also get the same effect with
12619 @option{-Wl,-Map=output.map}.
12621 @item -u @var{symbol}
12623 Pretend the symbol @var{symbol} is undefined, to force linking of
12624 library modules to define it. You can use @option{-u} multiple times with
12625 different symbols to force loading of additional library modules.
12627 @item -z @var{keyword}
12629 @option{-z} is passed directly on to the linker along with the keyword
12630 @var{keyword}. See the section in the documentation of your linker for
12631 permitted values and their meanings.
12634 @node Directory Options
12635 @section Options for Directory Search
12636 @cindex directory options
12637 @cindex options, directory search
12638 @cindex search path
12640 These options specify directories to search for header files, for
12641 libraries and for parts of the compiler:
12644 @include cppdiropts.texi
12646 @item -iplugindir=@var{dir}
12647 @opindex iplugindir=
12648 Set the directory to search for plugins that are passed
12649 by @option{-fplugin=@var{name}} instead of
12650 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
12651 to be used by the user, but only passed by the driver.
12655 Add directory @var{dir} to the list of directories to be searched
12658 @item -B@var{prefix}
12660 This option specifies where to find the executables, libraries,
12661 include files, and data files of the compiler itself.
12663 The compiler driver program runs one or more of the subprograms
12664 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
12665 @var{prefix} as a prefix for each program it tries to run, both with and
12666 without @samp{@var{machine}/@var{version}/} for the corresponding target
12667 machine and compiler version.
12669 For each subprogram to be run, the compiler driver first tries the
12670 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
12671 is not specified, the driver tries two standard prefixes,
12672 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
12673 those results in a file name that is found, the unmodified program
12674 name is searched for using the directories specified in your
12675 @env{PATH} environment variable.
12677 The compiler checks to see if the path provided by @option{-B}
12678 refers to a directory, and if necessary it adds a directory
12679 separator character at the end of the path.
12681 @option{-B} prefixes that effectively specify directory names also apply
12682 to libraries in the linker, because the compiler translates these
12683 options into @option{-L} options for the linker. They also apply to
12684 include files in the preprocessor, because the compiler translates these
12685 options into @option{-isystem} options for the preprocessor. In this case,
12686 the compiler appends @samp{include} to the prefix.
12688 The runtime support file @file{libgcc.a} can also be searched for using
12689 the @option{-B} prefix, if needed. If it is not found there, the two
12690 standard prefixes above are tried, and that is all. The file is left
12691 out of the link if it is not found by those means.
12693 Another way to specify a prefix much like the @option{-B} prefix is to use
12694 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
12697 As a special kludge, if the path provided by @option{-B} is
12698 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
12699 9, then it is replaced by @file{[dir/]include}. This is to help
12700 with boot-strapping the compiler.
12702 @item -no-canonical-prefixes
12703 @opindex no-canonical-prefixes
12704 Do not expand any symbolic links, resolve references to @samp{/../}
12705 or @samp{/./}, or make the path absolute when generating a relative
12708 @item --sysroot=@var{dir}
12710 Use @var{dir} as the logical root directory for headers and libraries.
12711 For example, if the compiler normally searches for headers in
12712 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
12713 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
12715 If you use both this option and the @option{-isysroot} option, then
12716 the @option{--sysroot} option applies to libraries, but the
12717 @option{-isysroot} option applies to header files.
12719 The GNU linker (beginning with version 2.16) has the necessary support
12720 for this option. If your linker does not support this option, the
12721 header file aspect of @option{--sysroot} still works, but the
12722 library aspect does not.
12724 @item --no-sysroot-suffix
12725 @opindex no-sysroot-suffix
12726 For some targets, a suffix is added to the root directory specified
12727 with @option{--sysroot}, depending on the other options used, so that
12728 headers may for example be found in
12729 @file{@var{dir}/@var{suffix}/usr/include} instead of
12730 @file{@var{dir}/usr/include}. This option disables the addition of
12735 @node Code Gen Options
12736 @section Options for Code Generation Conventions
12737 @cindex code generation conventions
12738 @cindex options, code generation
12739 @cindex run-time options
12741 These machine-independent options control the interface conventions
12742 used in code generation.
12744 Most of them have both positive and negative forms; the negative form
12745 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
12746 one of the forms is listed---the one that is not the default. You
12747 can figure out the other form by either removing @samp{no-} or adding
12751 @item -fstack-reuse=@var{reuse-level}
12752 @opindex fstack_reuse
12753 This option controls stack space reuse for user declared local/auto variables
12754 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
12755 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
12756 local variables and temporaries, @samp{named_vars} enables the reuse only for
12757 user defined local variables with names, and @samp{none} disables stack reuse
12758 completely. The default value is @samp{all}. The option is needed when the
12759 program extends the lifetime of a scoped local variable or a compiler generated
12760 temporary beyond the end point defined by the language. When a lifetime of
12761 a variable ends, and if the variable lives in memory, the optimizing compiler
12762 has the freedom to reuse its stack space with other temporaries or scoped
12763 local variables whose live range does not overlap with it. Legacy code extending
12764 local lifetime is likely to break with the stack reuse optimization.
12783 if (*p == 10) // out of scope use of local1
12794 A(int k) : i(k), j(k) @{ @}
12801 void foo(const A& ar)
12808 foo(A(10)); // temp object's lifetime ends when foo returns
12814 ap->i+= 10; // ap references out of scope temp whose space
12815 // is reused with a. What is the value of ap->i?
12820 The lifetime of a compiler generated temporary is well defined by the C++
12821 standard. When a lifetime of a temporary ends, and if the temporary lives
12822 in memory, the optimizing compiler has the freedom to reuse its stack
12823 space with other temporaries or scoped local variables whose live range
12824 does not overlap with it. However some of the legacy code relies on
12825 the behavior of older compilers in which temporaries' stack space is
12826 not reused, the aggressive stack reuse can lead to runtime errors. This
12827 option is used to control the temporary stack reuse optimization.
12831 This option generates traps for signed overflow on addition, subtraction,
12832 multiplication operations.
12833 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
12834 @option{-ftrapv} @option{-fwrapv} on the command-line results in
12835 @option{-fwrapv} being effective. Note that only active options override, so
12836 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
12837 results in @option{-ftrapv} being effective.
12841 This option instructs the compiler to assume that signed arithmetic
12842 overflow of addition, subtraction and multiplication wraps around
12843 using twos-complement representation. This flag enables some optimizations
12844 and disables others.
12845 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
12846 @option{-ftrapv} @option{-fwrapv} on the command-line results in
12847 @option{-fwrapv} being effective. Note that only active options override, so
12848 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
12849 results in @option{-ftrapv} being effective.
12851 @item -fwrapv-pointer
12852 @opindex fwrapv-pointer
12853 This option instructs the compiler to assume that pointer arithmetic
12854 overflow on addition and subtraction wraps around using twos-complement
12855 representation. This flag disables some optimizations which assume
12856 pointer overflow is invalid.
12858 @item -fstrict-overflow
12859 @opindex fstrict-overflow
12860 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
12861 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
12864 @opindex fexceptions
12865 Enable exception handling. Generates extra code needed to propagate
12866 exceptions. For some targets, this implies GCC generates frame
12867 unwind information for all functions, which can produce significant data
12868 size overhead, although it does not affect execution. If you do not
12869 specify this option, GCC enables it by default for languages like
12870 C++ that normally require exception handling, and disables it for
12871 languages like C that do not normally require it. However, you may need
12872 to enable this option when compiling C code that needs to interoperate
12873 properly with exception handlers written in C++. You may also wish to
12874 disable this option if you are compiling older C++ programs that don't
12875 use exception handling.
12877 @item -fnon-call-exceptions
12878 @opindex fnon-call-exceptions
12879 Generate code that allows trapping instructions to throw exceptions.
12880 Note that this requires platform-specific runtime support that does
12881 not exist everywhere. Moreover, it only allows @emph{trapping}
12882 instructions to throw exceptions, i.e.@: memory references or floating-point
12883 instructions. It does not allow exceptions to be thrown from
12884 arbitrary signal handlers such as @code{SIGALRM}.
12886 @item -fdelete-dead-exceptions
12887 @opindex fdelete-dead-exceptions
12888 Consider that instructions that may throw exceptions but don't otherwise
12889 contribute to the execution of the program can be optimized away.
12890 This option is enabled by default for the Ada front end, as permitted by
12891 the Ada language specification.
12892 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
12894 @item -funwind-tables
12895 @opindex funwind-tables
12896 Similar to @option{-fexceptions}, except that it just generates any needed
12897 static data, but does not affect the generated code in any other way.
12898 You normally do not need to enable this option; instead, a language processor
12899 that needs this handling enables it on your behalf.
12901 @item -fasynchronous-unwind-tables
12902 @opindex fasynchronous-unwind-tables
12903 Generate unwind table in DWARF format, if supported by target machine. The
12904 table is exact at each instruction boundary, so it can be used for stack
12905 unwinding from asynchronous events (such as debugger or garbage collector).
12907 @item -fno-gnu-unique
12908 @opindex fno-gnu-unique
12909 On systems with recent GNU assembler and C library, the C++ compiler
12910 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
12911 of template static data members and static local variables in inline
12912 functions are unique even in the presence of @code{RTLD_LOCAL}; this
12913 is necessary to avoid problems with a library used by two different
12914 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
12915 therefore disagreeing with the other one about the binding of the
12916 symbol. But this causes @code{dlclose} to be ignored for affected
12917 DSOs; if your program relies on reinitialization of a DSO via
12918 @code{dlclose} and @code{dlopen}, you can use
12919 @option{-fno-gnu-unique}.
12921 @item -fpcc-struct-return
12922 @opindex fpcc-struct-return
12923 Return ``short'' @code{struct} and @code{union} values in memory like
12924 longer ones, rather than in registers. This convention is less
12925 efficient, but it has the advantage of allowing intercallability between
12926 GCC-compiled files and files compiled with other compilers, particularly
12927 the Portable C Compiler (pcc).
12929 The precise convention for returning structures in memory depends
12930 on the target configuration macros.
12932 Short structures and unions are those whose size and alignment match
12933 that of some integer type.
12935 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
12936 switch is not binary compatible with code compiled with the
12937 @option{-freg-struct-return} switch.
12938 Use it to conform to a non-default application binary interface.
12940 @item -freg-struct-return
12941 @opindex freg-struct-return
12942 Return @code{struct} and @code{union} values in registers when possible.
12943 This is more efficient for small structures than
12944 @option{-fpcc-struct-return}.
12946 If you specify neither @option{-fpcc-struct-return} nor
12947 @option{-freg-struct-return}, GCC defaults to whichever convention is
12948 standard for the target. If there is no standard convention, GCC
12949 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
12950 the principal compiler. In those cases, we can choose the standard, and
12951 we chose the more efficient register return alternative.
12953 @strong{Warning:} code compiled with the @option{-freg-struct-return}
12954 switch is not binary compatible with code compiled with the
12955 @option{-fpcc-struct-return} switch.
12956 Use it to conform to a non-default application binary interface.
12958 @item -fshort-enums
12959 @opindex fshort-enums
12960 Allocate to an @code{enum} type only as many bytes as it needs for the
12961 declared range of possible values. Specifically, the @code{enum} type
12962 is equivalent to the smallest integer type that has enough room.
12964 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
12965 code that is not binary compatible with code generated without that switch.
12966 Use it to conform to a non-default application binary interface.
12968 @item -fshort-wchar
12969 @opindex fshort-wchar
12970 Override the underlying type for @code{wchar_t} to be @code{short
12971 unsigned int} instead of the default for the target. This option is
12972 useful for building programs to run under WINE@.
12974 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
12975 code that is not binary compatible with code generated without that switch.
12976 Use it to conform to a non-default application binary interface.
12979 @opindex fno-common
12980 @cindex tentative definitions
12981 In C code, this option controls the placement of global variables
12982 defined without an initializer, known as @dfn{tentative definitions}
12983 in the C standard. Tentative definitions are distinct from declarations
12984 of a variable with the @code{extern} keyword, which do not allocate storage.
12986 Unix C compilers have traditionally allocated storage for
12987 uninitialized global variables in a common block. This allows the
12988 linker to resolve all tentative definitions of the same variable
12989 in different compilation units to the same object, or to a non-tentative
12991 This is the behavior specified by @option{-fcommon}, and is the default for
12992 GCC on most targets.
12993 On the other hand, this behavior is not required by ISO
12994 C, and on some targets may carry a speed or code size penalty on
12995 variable references.
12997 The @option{-fno-common} option specifies that the compiler should instead
12998 place uninitialized global variables in the data section of the object file.
12999 This inhibits the merging of tentative definitions by the linker so
13000 you get a multiple-definition error if the same
13001 variable is defined in more than one compilation unit.
13002 Compiling with @option{-fno-common} is useful on targets for which
13003 it provides better performance, or if you wish to verify that the
13004 program will work on other systems that always treat uninitialized
13005 variable definitions this way.
13009 Ignore the @code{#ident} directive.
13011 @item -finhibit-size-directive
13012 @opindex finhibit-size-directive
13013 Don't output a @code{.size} assembler directive, or anything else that
13014 would cause trouble if the function is split in the middle, and the
13015 two halves are placed at locations far apart in memory. This option is
13016 used when compiling @file{crtstuff.c}; you should not need to use it
13019 @item -fverbose-asm
13020 @opindex fverbose-asm
13021 Put extra commentary information in the generated assembly code to
13022 make it more readable. This option is generally only of use to those
13023 who actually need to read the generated assembly code (perhaps while
13024 debugging the compiler itself).
13026 @option{-fno-verbose-asm}, the default, causes the
13027 extra information to be omitted and is useful when comparing two assembler
13030 The added comments include:
13035 information on the compiler version and command-line options,
13038 the source code lines associated with the assembly instructions,
13039 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
13042 hints on which high-level expressions correspond to
13043 the various assembly instruction operands.
13047 For example, given this C source file:
13055 for (i = 0; i < n; i++)
13062 compiling to (x86_64) assembly via @option{-S} and emitting the result
13063 direct to stdout via @option{-o} @option{-}
13066 gcc -S test.c -fverbose-asm -Os -o -
13069 gives output similar to this:
13073 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
13080 .type test, @@function
13084 # test.c:4: int total = 0;
13085 xorl %eax, %eax # <retval>
13086 # test.c:6: for (i = 0; i < n; i++)
13087 xorl %edx, %edx # i
13089 # test.c:6: for (i = 0; i < n; i++)
13090 cmpl %edi, %edx # n, i
13092 # test.c:7: total += i * i;
13093 movl %edx, %ecx # i, tmp92
13094 imull %edx, %ecx # i, tmp92
13095 # test.c:6: for (i = 0; i < n; i++)
13097 # test.c:7: total += i * i;
13098 addl %ecx, %eax # tmp92, <retval>
13106 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
13107 .section .note.GNU-stack,"",@@progbits
13110 The comments are intended for humans rather than machines and hence the
13111 precise format of the comments is subject to change.
13113 @item -frecord-gcc-switches
13114 @opindex frecord-gcc-switches
13115 This switch causes the command line used to invoke the
13116 compiler to be recorded into the object file that is being created.
13117 This switch is only implemented on some targets and the exact format
13118 of the recording is target and binary file format dependent, but it
13119 usually takes the form of a section containing ASCII text. This
13120 switch is related to the @option{-fverbose-asm} switch, but that
13121 switch only records information in the assembler output file as
13122 comments, so it never reaches the object file.
13123 See also @option{-grecord-gcc-switches} for another
13124 way of storing compiler options into the object file.
13128 @cindex global offset table
13130 Generate position-independent code (PIC) suitable for use in a shared
13131 library, if supported for the target machine. Such code accesses all
13132 constant addresses through a global offset table (GOT)@. The dynamic
13133 loader resolves the GOT entries when the program starts (the dynamic
13134 loader is not part of GCC; it is part of the operating system). If
13135 the GOT size for the linked executable exceeds a machine-specific
13136 maximum size, you get an error message from the linker indicating that
13137 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
13138 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
13139 on the m68k and RS/6000. The x86 has no such limit.)
13141 Position-independent code requires special support, and therefore works
13142 only on certain machines. For the x86, GCC supports PIC for System V
13143 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
13144 position-independent.
13146 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13151 If supported for the target machine, emit position-independent code,
13152 suitable for dynamic linking and avoiding any limit on the size of the
13153 global offset table. This option makes a difference on AArch64, m68k,
13154 PowerPC and SPARC@.
13156 Position-independent code requires special support, and therefore works
13157 only on certain machines.
13159 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13166 These options are similar to @option{-fpic} and @option{-fPIC}, but the
13167 generated position-independent code can be only linked into executables.
13168 Usually these options are used to compile code that will be linked using
13169 the @option{-pie} GCC option.
13171 @option{-fpie} and @option{-fPIE} both define the macros
13172 @code{__pie__} and @code{__PIE__}. The macros have the value 1
13173 for @option{-fpie} and 2 for @option{-fPIE}.
13177 Do not use the PLT for external function calls in position-independent code.
13178 Instead, load the callee address at call sites from the GOT and branch to it.
13179 This leads to more efficient code by eliminating PLT stubs and exposing
13180 GOT loads to optimizations. On architectures such as 32-bit x86 where
13181 PLT stubs expect the GOT pointer in a specific register, this gives more
13182 register allocation freedom to the compiler.
13183 Lazy binding requires use of the PLT;
13184 with @option{-fno-plt} all external symbols are resolved at load time.
13186 Alternatively, the function attribute @code{noplt} can be used to avoid calls
13187 through the PLT for specific external functions.
13189 In position-dependent code, a few targets also convert calls to
13190 functions that are marked to not use the PLT to use the GOT instead.
13192 @item -fno-jump-tables
13193 @opindex fno-jump-tables
13194 Do not use jump tables for switch statements even where it would be
13195 more efficient than other code generation strategies. This option is
13196 of use in conjunction with @option{-fpic} or @option{-fPIC} for
13197 building code that forms part of a dynamic linker and cannot
13198 reference the address of a jump table. On some targets, jump tables
13199 do not require a GOT and this option is not needed.
13201 @item -ffixed-@var{reg}
13203 Treat the register named @var{reg} as a fixed register; generated code
13204 should never refer to it (except perhaps as a stack pointer, frame
13205 pointer or in some other fixed role).
13207 @var{reg} must be the name of a register. The register names accepted
13208 are machine-specific and are defined in the @code{REGISTER_NAMES}
13209 macro in the machine description macro file.
13211 This flag does not have a negative form, because it specifies a
13214 @item -fcall-used-@var{reg}
13215 @opindex fcall-used
13216 Treat the register named @var{reg} as an allocable register that is
13217 clobbered by function calls. It may be allocated for temporaries or
13218 variables that do not live across a call. Functions compiled this way
13219 do not save and restore the register @var{reg}.
13221 It is an error to use this flag with the frame pointer or stack pointer.
13222 Use of this flag for other registers that have fixed pervasive roles in
13223 the machine's execution model produces disastrous results.
13225 This flag does not have a negative form, because it specifies a
13228 @item -fcall-saved-@var{reg}
13229 @opindex fcall-saved
13230 Treat the register named @var{reg} as an allocable register saved by
13231 functions. It may be allocated even for temporaries or variables that
13232 live across a call. Functions compiled this way save and restore
13233 the register @var{reg} if they use it.
13235 It is an error to use this flag with the frame pointer or stack pointer.
13236 Use of this flag for other registers that have fixed pervasive roles in
13237 the machine's execution model produces disastrous results.
13239 A different sort of disaster results from the use of this flag for
13240 a register in which function values may be returned.
13242 This flag does not have a negative form, because it specifies a
13245 @item -fpack-struct[=@var{n}]
13246 @opindex fpack-struct
13247 Without a value specified, pack all structure members together without
13248 holes. When a value is specified (which must be a small power of two), pack
13249 structure members according to this value, representing the maximum
13250 alignment (that is, objects with default alignment requirements larger than
13251 this are output potentially unaligned at the next fitting location.
13253 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
13254 code that is not binary compatible with code generated without that switch.
13255 Additionally, it makes the code suboptimal.
13256 Use it to conform to a non-default application binary interface.
13258 @item -fleading-underscore
13259 @opindex fleading-underscore
13260 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
13261 change the way C symbols are represented in the object file. One use
13262 is to help link with legacy assembly code.
13264 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
13265 generate code that is not binary compatible with code generated without that
13266 switch. Use it to conform to a non-default application binary interface.
13267 Not all targets provide complete support for this switch.
13269 @item -ftls-model=@var{model}
13270 @opindex ftls-model
13271 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
13272 The @var{model} argument should be one of @samp{global-dynamic},
13273 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
13274 Note that the choice is subject to optimization: the compiler may use
13275 a more efficient model for symbols not visible outside of the translation
13276 unit, or if @option{-fpic} is not given on the command line.
13278 The default without @option{-fpic} is @samp{initial-exec}; with
13279 @option{-fpic} the default is @samp{global-dynamic}.
13281 @item -ftrampolines
13282 @opindex ftrampolines
13283 For targets that normally need trampolines for nested functions, always
13284 generate them instead of using descriptors. Otherwise, for targets that
13285 do not need them, like for example HP-PA or IA-64, do nothing.
13287 A trampoline is a small piece of code that is created at run time on the
13288 stack when the address of a nested function is taken, and is used to call
13289 the nested function indirectly. Therefore, it requires the stack to be
13290 made executable in order for the program to work properly.
13292 @option{-fno-trampolines} is enabled by default on a language by language
13293 basis to let the compiler avoid generating them, if it computes that this
13294 is safe, and replace them with descriptors. Descriptors are made up of data
13295 only, but the generated code must be prepared to deal with them. As of this
13296 writing, @option{-fno-trampolines} is enabled by default only for Ada.
13298 Moreover, code compiled with @option{-ftrampolines} and code compiled with
13299 @option{-fno-trampolines} are not binary compatible if nested functions are
13300 present. This option must therefore be used on a program-wide basis and be
13301 manipulated with extreme care.
13303 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
13304 @opindex fvisibility
13305 Set the default ELF image symbol visibility to the specified option---all
13306 symbols are marked with this unless overridden within the code.
13307 Using this feature can very substantially improve linking and
13308 load times of shared object libraries, produce more optimized
13309 code, provide near-perfect API export and prevent symbol clashes.
13310 It is @strong{strongly} recommended that you use this in any shared objects
13313 Despite the nomenclature, @samp{default} always means public; i.e.,
13314 available to be linked against from outside the shared object.
13315 @samp{protected} and @samp{internal} are pretty useless in real-world
13316 usage so the only other commonly used option is @samp{hidden}.
13317 The default if @option{-fvisibility} isn't specified is
13318 @samp{default}, i.e., make every symbol public.
13320 A good explanation of the benefits offered by ensuring ELF
13321 symbols have the correct visibility is given by ``How To Write
13322 Shared Libraries'' by Ulrich Drepper (which can be found at
13323 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
13324 solution made possible by this option to marking things hidden when
13325 the default is public is to make the default hidden and mark things
13326 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
13327 and @code{__attribute__ ((visibility("default")))} instead of
13328 @code{__declspec(dllexport)} you get almost identical semantics with
13329 identical syntax. This is a great boon to those working with
13330 cross-platform projects.
13332 For those adding visibility support to existing code, you may find
13333 @code{#pragma GCC visibility} of use. This works by you enclosing
13334 the declarations you wish to set visibility for with (for example)
13335 @code{#pragma GCC visibility push(hidden)} and
13336 @code{#pragma GCC visibility pop}.
13337 Bear in mind that symbol visibility should be viewed @strong{as
13338 part of the API interface contract} and thus all new code should
13339 always specify visibility when it is not the default; i.e., declarations
13340 only for use within the local DSO should @strong{always} be marked explicitly
13341 as hidden as so to avoid PLT indirection overheads---making this
13342 abundantly clear also aids readability and self-documentation of the code.
13343 Note that due to ISO C++ specification requirements, @code{operator new} and
13344 @code{operator delete} must always be of default visibility.
13346 Be aware that headers from outside your project, in particular system
13347 headers and headers from any other library you use, may not be
13348 expecting to be compiled with visibility other than the default. You
13349 may need to explicitly say @code{#pragma GCC visibility push(default)}
13350 before including any such headers.
13352 @code{extern} declarations are not affected by @option{-fvisibility}, so
13353 a lot of code can be recompiled with @option{-fvisibility=hidden} with
13354 no modifications. However, this means that calls to @code{extern}
13355 functions with no explicit visibility use the PLT, so it is more
13356 effective to use @code{__attribute ((visibility))} and/or
13357 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
13358 declarations should be treated as hidden.
13360 Note that @option{-fvisibility} does affect C++ vague linkage
13361 entities. This means that, for instance, an exception class that is
13362 be thrown between DSOs must be explicitly marked with default
13363 visibility so that the @samp{type_info} nodes are unified between
13366 An overview of these techniques, their benefits and how to use them
13367 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
13369 @item -fstrict-volatile-bitfields
13370 @opindex fstrict-volatile-bitfields
13371 This option should be used if accesses to volatile bit-fields (or other
13372 structure fields, although the compiler usually honors those types
13373 anyway) should use a single access of the width of the
13374 field's type, aligned to a natural alignment if possible. For
13375 example, targets with memory-mapped peripheral registers might require
13376 all such accesses to be 16 bits wide; with this flag you can
13377 declare all peripheral bit-fields as @code{unsigned short} (assuming short
13378 is 16 bits on these targets) to force GCC to use 16-bit accesses
13379 instead of, perhaps, a more efficient 32-bit access.
13381 If this option is disabled, the compiler uses the most efficient
13382 instruction. In the previous example, that might be a 32-bit load
13383 instruction, even though that accesses bytes that do not contain
13384 any portion of the bit-field, or memory-mapped registers unrelated to
13385 the one being updated.
13387 In some cases, such as when the @code{packed} attribute is applied to a
13388 structure field, it may not be possible to access the field with a single
13389 read or write that is correctly aligned for the target machine. In this
13390 case GCC falls back to generating multiple accesses rather than code that
13391 will fault or truncate the result at run time.
13393 Note: Due to restrictions of the C/C++11 memory model, write accesses are
13394 not allowed to touch non bit-field members. It is therefore recommended
13395 to define all bits of the field's type as bit-field members.
13397 The default value of this option is determined by the application binary
13398 interface for the target processor.
13400 @item -fsync-libcalls
13401 @opindex fsync-libcalls
13402 This option controls whether any out-of-line instance of the @code{__sync}
13403 family of functions may be used to implement the C++11 @code{__atomic}
13404 family of functions.
13406 The default value of this option is enabled, thus the only useful form
13407 of the option is @option{-fno-sync-libcalls}. This option is used in
13408 the implementation of the @file{libatomic} runtime library.
13412 @node Developer Options
13413 @section GCC Developer Options
13414 @cindex developer options
13415 @cindex debugging GCC
13416 @cindex debug dump options
13417 @cindex dump options
13418 @cindex compilation statistics
13420 This section describes command-line options that are primarily of
13421 interest to GCC developers, including options to support compiler
13422 testing and investigation of compiler bugs and compile-time
13423 performance problems. This includes options that produce debug dumps
13424 at various points in the compilation; that print statistics such as
13425 memory use and execution time; and that print information about GCC's
13426 configuration, such as where it searches for libraries. You should
13427 rarely need to use any of these options for ordinary compilation and
13430 Many developer options that cause GCC to dump output to a file take an
13431 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
13432 or @samp{-} to dump to standard output, and @samp{stderr} for standard
13435 If @samp{=@var{filename}} is omitted, a default dump file name is
13436 constructed by concatenating the base dump file name, a pass number,
13437 phase letter, and pass name. The base dump file name is the name of
13438 output file produced by the compiler if explicitly specified and not
13439 an executable; otherwise it is the source file name.
13440 The pass number is determined by the order passes are registered with
13441 the compiler's pass manager.
13442 This is generally the same as the order of execution, but passes
13443 registered by plugins, target-specific passes, or passes that are
13444 otherwise registered late are numbered higher than the pass named
13445 @samp{final}, even if they are executed earlier. The phase letter is
13446 one of @samp{i} (inter-procedural analysis), @samp{l}
13447 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
13448 The files are created in the directory of the output file.
13452 @item -d@var{letters}
13453 @itemx -fdump-rtl-@var{pass}
13454 @itemx -fdump-rtl-@var{pass}=@var{filename}
13456 @opindex fdump-rtl-@var{pass}
13457 Says to make debugging dumps during compilation at times specified by
13458 @var{letters}. This is used for debugging the RTL-based passes of the
13461 Some @option{-d@var{letters}} switches have different meaning when
13462 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
13463 for information about preprocessor-specific dump options.
13465 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
13466 @option{-d} option @var{letters}. Here are the possible
13467 letters for use in @var{pass} and @var{letters}, and their meanings:
13471 @item -fdump-rtl-alignments
13472 @opindex fdump-rtl-alignments
13473 Dump after branch alignments have been computed.
13475 @item -fdump-rtl-asmcons
13476 @opindex fdump-rtl-asmcons
13477 Dump after fixing rtl statements that have unsatisfied in/out constraints.
13479 @item -fdump-rtl-auto_inc_dec
13480 @opindex fdump-rtl-auto_inc_dec
13481 Dump after auto-inc-dec discovery. This pass is only run on
13482 architectures that have auto inc or auto dec instructions.
13484 @item -fdump-rtl-barriers
13485 @opindex fdump-rtl-barriers
13486 Dump after cleaning up the barrier instructions.
13488 @item -fdump-rtl-bbpart
13489 @opindex fdump-rtl-bbpart
13490 Dump after partitioning hot and cold basic blocks.
13492 @item -fdump-rtl-bbro
13493 @opindex fdump-rtl-bbro
13494 Dump after block reordering.
13496 @item -fdump-rtl-btl1
13497 @itemx -fdump-rtl-btl2
13498 @opindex fdump-rtl-btl2
13499 @opindex fdump-rtl-btl2
13500 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
13501 after the two branch
13502 target load optimization passes.
13504 @item -fdump-rtl-bypass
13505 @opindex fdump-rtl-bypass
13506 Dump after jump bypassing and control flow optimizations.
13508 @item -fdump-rtl-combine
13509 @opindex fdump-rtl-combine
13510 Dump after the RTL instruction combination pass.
13512 @item -fdump-rtl-compgotos
13513 @opindex fdump-rtl-compgotos
13514 Dump after duplicating the computed gotos.
13516 @item -fdump-rtl-ce1
13517 @itemx -fdump-rtl-ce2
13518 @itemx -fdump-rtl-ce3
13519 @opindex fdump-rtl-ce1
13520 @opindex fdump-rtl-ce2
13521 @opindex fdump-rtl-ce3
13522 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
13523 @option{-fdump-rtl-ce3} enable dumping after the three
13524 if conversion passes.
13526 @item -fdump-rtl-cprop_hardreg
13527 @opindex fdump-rtl-cprop_hardreg
13528 Dump after hard register copy propagation.
13530 @item -fdump-rtl-csa
13531 @opindex fdump-rtl-csa
13532 Dump after combining stack adjustments.
13534 @item -fdump-rtl-cse1
13535 @itemx -fdump-rtl-cse2
13536 @opindex fdump-rtl-cse1
13537 @opindex fdump-rtl-cse2
13538 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
13539 the two common subexpression elimination passes.
13541 @item -fdump-rtl-dce
13542 @opindex fdump-rtl-dce
13543 Dump after the standalone dead code elimination passes.
13545 @item -fdump-rtl-dbr
13546 @opindex fdump-rtl-dbr
13547 Dump after delayed branch scheduling.
13549 @item -fdump-rtl-dce1
13550 @itemx -fdump-rtl-dce2
13551 @opindex fdump-rtl-dce1
13552 @opindex fdump-rtl-dce2
13553 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
13554 the two dead store elimination passes.
13556 @item -fdump-rtl-eh
13557 @opindex fdump-rtl-eh
13558 Dump after finalization of EH handling code.
13560 @item -fdump-rtl-eh_ranges
13561 @opindex fdump-rtl-eh_ranges
13562 Dump after conversion of EH handling range regions.
13564 @item -fdump-rtl-expand
13565 @opindex fdump-rtl-expand
13566 Dump after RTL generation.
13568 @item -fdump-rtl-fwprop1
13569 @itemx -fdump-rtl-fwprop2
13570 @opindex fdump-rtl-fwprop1
13571 @opindex fdump-rtl-fwprop2
13572 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
13573 dumping after the two forward propagation passes.
13575 @item -fdump-rtl-gcse1
13576 @itemx -fdump-rtl-gcse2
13577 @opindex fdump-rtl-gcse1
13578 @opindex fdump-rtl-gcse2
13579 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
13580 after global common subexpression elimination.
13582 @item -fdump-rtl-init-regs
13583 @opindex fdump-rtl-init-regs
13584 Dump after the initialization of the registers.
13586 @item -fdump-rtl-initvals
13587 @opindex fdump-rtl-initvals
13588 Dump after the computation of the initial value sets.
13590 @item -fdump-rtl-into_cfglayout
13591 @opindex fdump-rtl-into_cfglayout
13592 Dump after converting to cfglayout mode.
13594 @item -fdump-rtl-ira
13595 @opindex fdump-rtl-ira
13596 Dump after iterated register allocation.
13598 @item -fdump-rtl-jump
13599 @opindex fdump-rtl-jump
13600 Dump after the second jump optimization.
13602 @item -fdump-rtl-loop2
13603 @opindex fdump-rtl-loop2
13604 @option{-fdump-rtl-loop2} enables dumping after the rtl
13605 loop optimization passes.
13607 @item -fdump-rtl-mach
13608 @opindex fdump-rtl-mach
13609 Dump after performing the machine dependent reorganization pass, if that
13612 @item -fdump-rtl-mode_sw
13613 @opindex fdump-rtl-mode_sw
13614 Dump after removing redundant mode switches.
13616 @item -fdump-rtl-rnreg
13617 @opindex fdump-rtl-rnreg
13618 Dump after register renumbering.
13620 @item -fdump-rtl-outof_cfglayout
13621 @opindex fdump-rtl-outof_cfglayout
13622 Dump after converting from cfglayout mode.
13624 @item -fdump-rtl-peephole2
13625 @opindex fdump-rtl-peephole2
13626 Dump after the peephole pass.
13628 @item -fdump-rtl-postreload
13629 @opindex fdump-rtl-postreload
13630 Dump after post-reload optimizations.
13632 @item -fdump-rtl-pro_and_epilogue
13633 @opindex fdump-rtl-pro_and_epilogue
13634 Dump after generating the function prologues and epilogues.
13636 @item -fdump-rtl-sched1
13637 @itemx -fdump-rtl-sched2
13638 @opindex fdump-rtl-sched1
13639 @opindex fdump-rtl-sched2
13640 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
13641 after the basic block scheduling passes.
13643 @item -fdump-rtl-ree
13644 @opindex fdump-rtl-ree
13645 Dump after sign/zero extension elimination.
13647 @item -fdump-rtl-seqabstr
13648 @opindex fdump-rtl-seqabstr
13649 Dump after common sequence discovery.
13651 @item -fdump-rtl-shorten
13652 @opindex fdump-rtl-shorten
13653 Dump after shortening branches.
13655 @item -fdump-rtl-sibling
13656 @opindex fdump-rtl-sibling
13657 Dump after sibling call optimizations.
13659 @item -fdump-rtl-split1
13660 @itemx -fdump-rtl-split2
13661 @itemx -fdump-rtl-split3
13662 @itemx -fdump-rtl-split4
13663 @itemx -fdump-rtl-split5
13664 @opindex fdump-rtl-split1
13665 @opindex fdump-rtl-split2
13666 @opindex fdump-rtl-split3
13667 @opindex fdump-rtl-split4
13668 @opindex fdump-rtl-split5
13669 These options enable dumping after five rounds of
13670 instruction splitting.
13672 @item -fdump-rtl-sms
13673 @opindex fdump-rtl-sms
13674 Dump after modulo scheduling. This pass is only run on some
13677 @item -fdump-rtl-stack
13678 @opindex fdump-rtl-stack
13679 Dump after conversion from GCC's ``flat register file'' registers to the
13680 x87's stack-like registers. This pass is only run on x86 variants.
13682 @item -fdump-rtl-subreg1
13683 @itemx -fdump-rtl-subreg2
13684 @opindex fdump-rtl-subreg1
13685 @opindex fdump-rtl-subreg2
13686 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
13687 the two subreg expansion passes.
13689 @item -fdump-rtl-unshare
13690 @opindex fdump-rtl-unshare
13691 Dump after all rtl has been unshared.
13693 @item -fdump-rtl-vartrack
13694 @opindex fdump-rtl-vartrack
13695 Dump after variable tracking.
13697 @item -fdump-rtl-vregs
13698 @opindex fdump-rtl-vregs
13699 Dump after converting virtual registers to hard registers.
13701 @item -fdump-rtl-web
13702 @opindex fdump-rtl-web
13703 Dump after live range splitting.
13705 @item -fdump-rtl-regclass
13706 @itemx -fdump-rtl-subregs_of_mode_init
13707 @itemx -fdump-rtl-subregs_of_mode_finish
13708 @itemx -fdump-rtl-dfinit
13709 @itemx -fdump-rtl-dfinish
13710 @opindex fdump-rtl-regclass
13711 @opindex fdump-rtl-subregs_of_mode_init
13712 @opindex fdump-rtl-subregs_of_mode_finish
13713 @opindex fdump-rtl-dfinit
13714 @opindex fdump-rtl-dfinish
13715 These dumps are defined but always produce empty files.
13718 @itemx -fdump-rtl-all
13720 @opindex fdump-rtl-all
13721 Produce all the dumps listed above.
13725 Annotate the assembler output with miscellaneous debugging information.
13729 Dump all macro definitions, at the end of preprocessing, in addition to
13734 Produce a core dump whenever an error occurs.
13738 Annotate the assembler output with a comment indicating which
13739 pattern and alternative is used. The length and cost of each instruction are
13744 Dump the RTL in the assembler output as a comment before each instruction.
13745 Also turns on @option{-dp} annotation.
13749 Just generate RTL for a function instead of compiling it. Usually used
13750 with @option{-fdump-rtl-expand}.
13753 @item -fdump-noaddr
13754 @opindex fdump-noaddr
13755 When doing debugging dumps, suppress address output. This makes it more
13756 feasible to use diff on debugging dumps for compiler invocations with
13757 different compiler binaries and/or different
13758 text / bss / data / heap / stack / dso start locations.
13761 @opindex freport-bug
13762 Collect and dump debug information into a temporary file if an
13763 internal compiler error (ICE) occurs.
13765 @item -fdump-unnumbered
13766 @opindex fdump-unnumbered
13767 When doing debugging dumps, suppress instruction numbers and address output.
13768 This makes it more feasible to use diff on debugging dumps for compiler
13769 invocations with different options, in particular with and without
13772 @item -fdump-unnumbered-links
13773 @opindex fdump-unnumbered-links
13774 When doing debugging dumps (see @option{-d} option above), suppress
13775 instruction numbers for the links to the previous and next instructions
13778 @item -fdump-ipa-@var{switch}
13780 Control the dumping at various stages of inter-procedural analysis
13781 language tree to a file. The file name is generated by appending a
13782 switch specific suffix to the source file name, and the file is created
13783 in the same directory as the output file. The following dumps are
13788 Enables all inter-procedural analysis dumps.
13791 Dumps information about call-graph optimization, unused function removal,
13792 and inlining decisions.
13795 Dump after function inlining.
13799 @item -fdump-lang-all
13800 @itemx -fdump-lang-@var{switch}
13801 @itemx -fdump-lang-@var{switch}-@var{options}
13802 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
13803 @opindex fdump-lang-all
13804 @opindex fdump-lang
13805 Control the dumping of language-specific information. The @var{options}
13806 and @var{filename} portions behave as described in the
13807 @option{-fdump-tree} option. The following @var{switch} values are
13813 Enable all language-specific dumps.
13816 Dump class hierarchy information. Virtual table information is emitted
13817 unless '@option{slim}' is specified. This option is applicable to C++ only.
13820 Dump the raw internal tree data. This option is applicable to C++ only.
13824 @item -fdump-passes
13825 @opindex fdump-passes
13826 Print on @file{stderr} the list of optimization passes that are turned
13827 on and off by the current command-line options.
13829 @item -fdump-statistics-@var{option}
13830 @opindex fdump-statistics
13831 Enable and control dumping of pass statistics in a separate file. The
13832 file name is generated by appending a suffix ending in
13833 @samp{.statistics} to the source file name, and the file is created in
13834 the same directory as the output file. If the @samp{-@var{option}}
13835 form is used, @samp{-stats} causes counters to be summed over the
13836 whole compilation unit while @samp{-details} dumps every event as
13837 the passes generate them. The default with no option is to sum
13838 counters for each function compiled.
13840 @item -fdump-tree-all
13841 @itemx -fdump-tree-@var{switch}
13842 @itemx -fdump-tree-@var{switch}-@var{options}
13843 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
13844 @opindex fdump-tree-all
13845 @opindex fdump-tree
13846 Control the dumping at various stages of processing the intermediate
13847 language tree to a file. If the @samp{-@var{options}}
13848 form is used, @var{options} is a list of @samp{-} separated options
13849 which control the details of the dump. Not all options are applicable
13850 to all dumps; those that are not meaningful are ignored. The
13851 following options are available
13855 Print the address of each node. Usually this is not meaningful as it
13856 changes according to the environment and source file. Its primary use
13857 is for tying up a dump file with a debug environment.
13859 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
13860 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
13861 use working backward from mangled names in the assembly file.
13863 When dumping front-end intermediate representations, inhibit dumping
13864 of members of a scope or body of a function merely because that scope
13865 has been reached. Only dump such items when they are directly reachable
13866 by some other path.
13868 When dumping pretty-printed trees, this option inhibits dumping the
13869 bodies of control structures.
13871 When dumping RTL, print the RTL in slim (condensed) form instead of
13872 the default LISP-like representation.
13874 Print a raw representation of the tree. By default, trees are
13875 pretty-printed into a C-like representation.
13877 Enable more detailed dumps (not honored by every dump option). Also
13878 include information from the optimization passes.
13880 Enable dumping various statistics about the pass (not honored by every dump
13883 Enable showing basic block boundaries (disabled in raw dumps).
13885 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
13886 dump a representation of the control flow graph suitable for viewing with
13887 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
13888 the file is pretty-printed as a subgraph, so that GraphViz can render them
13889 all in a single plot.
13891 This option currently only works for RTL dumps, and the RTL is always
13892 dumped in slim form.
13894 Enable showing virtual operands for every statement.
13896 Enable showing line numbers for statements.
13898 Enable showing the unique ID (@code{DECL_UID}) for each variable.
13900 Enable showing the tree dump for each statement.
13902 Enable showing the EH region number holding each statement.
13904 Enable showing scalar evolution analysis details.
13906 Enable showing optimization information (only available in certain
13909 Enable showing missed optimization information (only available in certain
13912 Enable other detailed optimization information (only available in
13915 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
13916 and @option{lineno}.
13918 Turn on all optimization options, i.e., @option{optimized},
13919 @option{missed}, and @option{note}.
13922 To determine what tree dumps are available or find the dump for a pass
13923 of interest follow the steps below.
13927 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
13928 look for a code that corresponds to the pass you are interested in.
13929 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
13930 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
13931 The number at the end distinguishes distinct invocations of the same pass.
13933 To enable the creation of the dump file, append the pass code to
13934 the @option{-fdump-} option prefix and invoke GCC with it. For example,
13935 to enable the dump from the Early Value Range Propagation pass, invoke
13936 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
13937 specify the name of the dump file. If you don't specify one, GCC
13938 creates as described below.
13940 Find the pass dump in a file whose name is composed of three components
13941 separated by a period: the name of the source file GCC was invoked to
13942 compile, a numeric suffix indicating the pass number followed by the
13943 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
13944 and finally the pass code. For example, the Early VRP pass dump might
13945 be in a file named @file{myfile.c.038t.evrp} in the current working
13946 directory. Note that the numeric codes are not stable and may change
13947 from one version of GCC to another.
13951 @itemx -fopt-info-@var{options}
13952 @itemx -fopt-info-@var{options}=@var{filename}
13954 Controls optimization dumps from various optimization passes. If the
13955 @samp{-@var{options}} form is used, @var{options} is a list of
13956 @samp{-} separated option keywords to select the dump details and
13959 The @var{options} can be divided into two groups: options describing the
13960 verbosity of the dump, and options describing which optimizations
13961 should be included. The options from both the groups can be freely
13962 mixed as they are non-overlapping. However, in case of any conflicts,
13963 the later options override the earlier options on the command
13966 The following options control the dump verbosity:
13970 Print information when an optimization is successfully applied. It is
13971 up to a pass to decide which information is relevant. For example, the
13972 vectorizer passes print the source location of loops which are
13973 successfully vectorized.
13975 Print information about missed optimizations. Individual passes
13976 control which information to include in the output.
13978 Print verbose information about optimizations, such as certain
13979 transformations, more detailed messages about decisions etc.
13981 Print detailed optimization information. This includes
13982 @samp{optimized}, @samp{missed}, and @samp{note}.
13985 One or more of the following option keywords can be used to describe a
13986 group of optimizations:
13990 Enable dumps from all interprocedural optimizations.
13992 Enable dumps from all loop optimizations.
13994 Enable dumps from all inlining optimizations.
13996 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
13998 Enable dumps from all vectorization optimizations.
14000 Enable dumps from all optimizations. This is a superset of
14001 the optimization groups listed above.
14004 If @var{options} is
14005 omitted, it defaults to @samp{optimized-optall}, which means to dump all
14006 info about successful optimizations from all the passes.
14008 If the @var{filename} is provided, then the dumps from all the
14009 applicable optimizations are concatenated into the @var{filename}.
14010 Otherwise the dump is output onto @file{stderr}. Though multiple
14011 @option{-fopt-info} options are accepted, only one of them can include
14012 a @var{filename}. If other filenames are provided then all but the
14013 first such option are ignored.
14015 Note that the output @var{filename} is overwritten
14016 in case of multiple translation units. If a combined output from
14017 multiple translation units is desired, @file{stderr} should be used
14020 In the following example, the optimization info is output to
14029 gcc -O3 -fopt-info-missed=missed.all
14033 outputs missed optimization report from all the passes into
14034 @file{missed.all}, and this one:
14037 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
14041 prints information about missed optimization opportunities from
14042 vectorization passes on @file{stderr}.
14043 Note that @option{-fopt-info-vec-missed} is equivalent to
14044 @option{-fopt-info-missed-vec}. The order of the optimization group
14045 names and message types listed after @option{-fopt-info} does not matter.
14047 As another example,
14049 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
14053 outputs information about missed optimizations as well as
14054 optimized locations from all the inlining passes into
14060 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
14064 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
14065 in conflict since only one output file is allowed. In this case, only
14066 the first option takes effect and the subsequent options are
14067 ignored. Thus only @file{vec.miss} is produced which contains
14068 dumps from the vectorizer about missed opportunities.
14070 @item -fsave-optimization-record
14071 @opindex fsave-optimization-record
14072 Write a SRCFILE.opt-record.json file detailing what optimizations
14073 were performed, for those optimizations that support @option{-fopt-info}.
14075 This option is experimental and the format of the data within the JSON
14076 file is subject to change.
14078 It is roughly equivalent to a machine-readable version of
14079 @option{-fopt-info-all}, as a collection of messages with source file,
14080 line number and column number, with the following additional data for
14086 the execution count of the code being optimized, along with metadata about
14087 whether this was from actual profile data, or just an estimate, allowing
14088 consumers to prioritize messages by code hotness,
14091 the function name of the code being optimized, where applicable,
14094 the ``inlining chain'' for the code being optimized, so that when
14095 a function is inlined into several different places (which might
14096 themselves be inlined), the reader can distinguish between the copies,
14099 objects identifying those parts of the message that refer to expressions,
14100 statements or symbol-table nodes, which of these categories they are, and,
14101 when available, their source code location,
14104 the GCC pass that emitted the message, and
14107 the location in GCC's own code from which the message was emitted
14111 Additionally, some messages are logically nested within other
14112 messages, reflecting implementation details of the optimization
14115 @item -fsched-verbose=@var{n}
14116 @opindex fsched-verbose
14117 On targets that use instruction scheduling, this option controls the
14118 amount of debugging output the scheduler prints to the dump files.
14120 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
14121 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
14122 For @var{n} greater than one, it also output basic block probabilities,
14123 detailed ready list information and unit/insn info. For @var{n} greater
14124 than two, it includes RTL at abort point, control-flow and regions info.
14125 And for @var{n} over four, @option{-fsched-verbose} also includes
14130 @item -fenable-@var{kind}-@var{pass}
14131 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
14135 This is a set of options that are used to explicitly disable/enable
14136 optimization passes. These options are intended for use for debugging GCC.
14137 Compiler users should use regular options for enabling/disabling
14142 @item -fdisable-ipa-@var{pass}
14143 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
14144 statically invoked in the compiler multiple times, the pass name should be
14145 appended with a sequential number starting from 1.
14147 @item -fdisable-rtl-@var{pass}
14148 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
14149 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
14150 statically invoked in the compiler multiple times, the pass name should be
14151 appended with a sequential number starting from 1. @var{range-list} is a
14152 comma-separated list of function ranges or assembler names. Each range is a number
14153 pair separated by a colon. The range is inclusive in both ends. If the range
14154 is trivial, the number pair can be simplified as a single number. If the
14155 function's call graph node's @var{uid} falls within one of the specified ranges,
14156 the @var{pass} is disabled for that function. The @var{uid} is shown in the
14157 function header of a dump file, and the pass names can be dumped by using
14158 option @option{-fdump-passes}.
14160 @item -fdisable-tree-@var{pass}
14161 @itemx -fdisable-tree-@var{pass}=@var{range-list}
14162 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
14165 @item -fenable-ipa-@var{pass}
14166 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
14167 statically invoked in the compiler multiple times, the pass name should be
14168 appended with a sequential number starting from 1.
14170 @item -fenable-rtl-@var{pass}
14171 @itemx -fenable-rtl-@var{pass}=@var{range-list}
14172 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
14173 description and examples.
14175 @item -fenable-tree-@var{pass}
14176 @itemx -fenable-tree-@var{pass}=@var{range-list}
14177 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
14178 of option arguments.
14182 Here are some examples showing uses of these options.
14186 # disable ccp1 for all functions
14187 -fdisable-tree-ccp1
14188 # disable complete unroll for function whose cgraph node uid is 1
14189 -fenable-tree-cunroll=1
14190 # disable gcse2 for functions at the following ranges [1,1],
14191 # [300,400], and [400,1000]
14192 # disable gcse2 for functions foo and foo2
14193 -fdisable-rtl-gcse2=foo,foo2
14194 # disable early inlining
14195 -fdisable-tree-einline
14196 # disable ipa inlining
14197 -fdisable-ipa-inline
14198 # enable tree full unroll
14199 -fenable-tree-unroll
14204 @itemx -fchecking=@var{n}
14206 @opindex fno-checking
14207 Enable internal consistency checking. The default depends on
14208 the compiler configuration. @option{-fchecking=2} enables further
14209 internal consistency checking that might affect code generation.
14211 @item -frandom-seed=@var{string}
14212 @opindex frandom-seed
14213 This option provides a seed that GCC uses in place of
14214 random numbers in generating certain symbol names
14215 that have to be different in every compiled file. It is also used to
14216 place unique stamps in coverage data files and the object files that
14217 produce them. You can use the @option{-frandom-seed} option to produce
14218 reproducibly identical object files.
14220 The @var{string} can either be a number (decimal, octal or hex) or an
14221 arbitrary string (in which case it's converted to a number by
14224 The @var{string} should be different for every file you compile.
14227 @itemx -save-temps=cwd
14228 @opindex save-temps
14229 Store the usual ``temporary'' intermediate files permanently; place them
14230 in the current directory and name them based on the source file. Thus,
14231 compiling @file{foo.c} with @option{-c -save-temps} produces files
14232 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
14233 preprocessed @file{foo.i} output file even though the compiler now
14234 normally uses an integrated preprocessor.
14236 When used in combination with the @option{-x} command-line option,
14237 @option{-save-temps} is sensible enough to avoid over writing an
14238 input source file with the same extension as an intermediate file.
14239 The corresponding intermediate file may be obtained by renaming the
14240 source file before using @option{-save-temps}.
14242 If you invoke GCC in parallel, compiling several different source
14243 files that share a common base name in different subdirectories or the
14244 same source file compiled for multiple output destinations, it is
14245 likely that the different parallel compilers will interfere with each
14246 other, and overwrite the temporary files. For instance:
14249 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
14250 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
14253 may result in @file{foo.i} and @file{foo.o} being written to
14254 simultaneously by both compilers.
14256 @item -save-temps=obj
14257 @opindex save-temps=obj
14258 Store the usual ``temporary'' intermediate files permanently. If the
14259 @option{-o} option is used, the temporary files are based on the
14260 object file. If the @option{-o} option is not used, the
14261 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
14266 gcc -save-temps=obj -c foo.c
14267 gcc -save-temps=obj -c bar.c -o dir/xbar.o
14268 gcc -save-temps=obj foobar.c -o dir2/yfoobar
14272 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
14273 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
14274 @file{dir2/yfoobar.o}.
14276 @item -time@r{[}=@var{file}@r{]}
14278 Report the CPU time taken by each subprocess in the compilation
14279 sequence. For C source files, this is the compiler proper and assembler
14280 (plus the linker if linking is done).
14282 Without the specification of an output file, the output looks like this:
14289 The first number on each line is the ``user time'', that is time spent
14290 executing the program itself. The second number is ``system time'',
14291 time spent executing operating system routines on behalf of the program.
14292 Both numbers are in seconds.
14294 With the specification of an output file, the output is appended to the
14295 named file, and it looks like this:
14298 0.12 0.01 cc1 @var{options}
14299 0.00 0.01 as @var{options}
14302 The ``user time'' and the ``system time'' are moved before the program
14303 name, and the options passed to the program are displayed, so that one
14304 can later tell what file was being compiled, and with which options.
14306 @item -fdump-final-insns@r{[}=@var{file}@r{]}
14307 @opindex fdump-final-insns
14308 Dump the final internal representation (RTL) to @var{file}. If the
14309 optional argument is omitted (or if @var{file} is @code{.}), the name
14310 of the dump file is determined by appending @code{.gkd} to the
14311 compilation output file name.
14313 @item -fcompare-debug@r{[}=@var{opts}@r{]}
14314 @opindex fcompare-debug
14315 @opindex fno-compare-debug
14316 If no error occurs during compilation, run the compiler a second time,
14317 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
14318 passed to the second compilation. Dump the final internal
14319 representation in both compilations, and print an error if they differ.
14321 If the equal sign is omitted, the default @option{-gtoggle} is used.
14323 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
14324 and nonzero, implicitly enables @option{-fcompare-debug}. If
14325 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
14326 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
14329 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
14330 is equivalent to @option{-fno-compare-debug}, which disables the dumping
14331 of the final representation and the second compilation, preventing even
14332 @env{GCC_COMPARE_DEBUG} from taking effect.
14334 To verify full coverage during @option{-fcompare-debug} testing, set
14335 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
14336 which GCC rejects as an invalid option in any actual compilation
14337 (rather than preprocessing, assembly or linking). To get just a
14338 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
14339 not overridden} will do.
14341 @item -fcompare-debug-second
14342 @opindex fcompare-debug-second
14343 This option is implicitly passed to the compiler for the second
14344 compilation requested by @option{-fcompare-debug}, along with options to
14345 silence warnings, and omitting other options that would cause the compiler
14346 to produce output to files or to standard output as a side effect. Dump
14347 files and preserved temporary files are renamed so as to contain the
14348 @code{.gk} additional extension during the second compilation, to avoid
14349 overwriting those generated by the first.
14351 When this option is passed to the compiler driver, it causes the
14352 @emph{first} compilation to be skipped, which makes it useful for little
14353 other than debugging the compiler proper.
14357 Turn off generation of debug info, if leaving out this option
14358 generates it, or turn it on at level 2 otherwise. The position of this
14359 argument in the command line does not matter; it takes effect after all
14360 other options are processed, and it does so only once, no matter how
14361 many times it is given. This is mainly intended to be used with
14362 @option{-fcompare-debug}.
14364 @item -fvar-tracking-assignments-toggle
14365 @opindex fvar-tracking-assignments-toggle
14366 @opindex fno-var-tracking-assignments-toggle
14367 Toggle @option{-fvar-tracking-assignments}, in the same way that
14368 @option{-gtoggle} toggles @option{-g}.
14372 Makes the compiler print out each function name as it is compiled, and
14373 print some statistics about each pass when it finishes.
14375 @item -ftime-report
14376 @opindex ftime-report
14377 Makes the compiler print some statistics about the time consumed by each
14378 pass when it finishes.
14380 @item -ftime-report-details
14381 @opindex ftime-report-details
14382 Record the time consumed by infrastructure parts separately for each pass.
14384 @item -fira-verbose=@var{n}
14385 @opindex fira-verbose
14386 Control the verbosity of the dump file for the integrated register allocator.
14387 The default value is 5. If the value @var{n} is greater or equal to 10,
14388 the dump output is sent to stderr using the same format as @var{n} minus 10.
14391 @opindex flto-report
14392 Prints a report with internal details on the workings of the link-time
14393 optimizer. The contents of this report vary from version to version.
14394 It is meant to be useful to GCC developers when processing object
14395 files in LTO mode (via @option{-flto}).
14397 Disabled by default.
14399 @item -flto-report-wpa
14400 @opindex flto-report-wpa
14401 Like @option{-flto-report}, but only print for the WPA phase of Link
14405 @opindex fmem-report
14406 Makes the compiler print some statistics about permanent memory
14407 allocation when it finishes.
14409 @item -fmem-report-wpa
14410 @opindex fmem-report-wpa
14411 Makes the compiler print some statistics about permanent memory
14412 allocation for the WPA phase only.
14414 @item -fpre-ipa-mem-report
14415 @opindex fpre-ipa-mem-report
14416 @item -fpost-ipa-mem-report
14417 @opindex fpost-ipa-mem-report
14418 Makes the compiler print some statistics about permanent memory
14419 allocation before or after interprocedural optimization.
14421 @item -fprofile-report
14422 @opindex fprofile-report
14423 Makes the compiler print some statistics about consistency of the
14424 (estimated) profile and effect of individual passes.
14426 @item -fstack-usage
14427 @opindex fstack-usage
14428 Makes the compiler output stack usage information for the program, on a
14429 per-function basis. The filename for the dump is made by appending
14430 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
14431 the output file, if explicitly specified and it is not an executable,
14432 otherwise it is the basename of the source file. An entry is made up
14437 The name of the function.
14441 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
14444 The qualifier @code{static} means that the function manipulates the stack
14445 statically: a fixed number of bytes are allocated for the frame on function
14446 entry and released on function exit; no stack adjustments are otherwise made
14447 in the function. The second field is this fixed number of bytes.
14449 The qualifier @code{dynamic} means that the function manipulates the stack
14450 dynamically: in addition to the static allocation described above, stack
14451 adjustments are made in the body of the function, for example to push/pop
14452 arguments around function calls. If the qualifier @code{bounded} is also
14453 present, the amount of these adjustments is bounded at compile time and
14454 the second field is an upper bound of the total amount of stack used by
14455 the function. If it is not present, the amount of these adjustments is
14456 not bounded at compile time and the second field only represents the
14461 Emit statistics about front-end processing at the end of the compilation.
14462 This option is supported only by the C++ front end, and
14463 the information is generally only useful to the G++ development team.
14465 @item -fdbg-cnt-list
14466 @opindex fdbg-cnt-list
14467 Print the name and the counter upper bound for all debug counters.
14470 @item -fdbg-cnt=@var{counter-value-list}
14472 Set the internal debug counter lower and upper bound. @var{counter-value-list}
14473 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
14474 tuples which sets the lower and the upper bound of each debug
14475 counter @var{name}. The @var{lower_bound} is optional and is zero
14476 initialized if not set.
14477 All debug counters have the initial upper bound of @code{UINT_MAX};
14478 thus @code{dbg_cnt} returns true always unless the upper bound
14479 is set by this option.
14480 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
14481 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
14482 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
14484 @item -print-file-name=@var{library}
14485 @opindex print-file-name
14486 Print the full absolute name of the library file @var{library} that
14487 would be used when linking---and don't do anything else. With this
14488 option, GCC does not compile or link anything; it just prints the
14491 @item -print-multi-directory
14492 @opindex print-multi-directory
14493 Print the directory name corresponding to the multilib selected by any
14494 other switches present in the command line. This directory is supposed
14495 to exist in @env{GCC_EXEC_PREFIX}.
14497 @item -print-multi-lib
14498 @opindex print-multi-lib
14499 Print the mapping from multilib directory names to compiler switches
14500 that enable them. The directory name is separated from the switches by
14501 @samp{;}, and each switch starts with an @samp{@@} instead of the
14502 @samp{-}, without spaces between multiple switches. This is supposed to
14503 ease shell processing.
14505 @item -print-multi-os-directory
14506 @opindex print-multi-os-directory
14507 Print the path to OS libraries for the selected
14508 multilib, relative to some @file{lib} subdirectory. If OS libraries are
14509 present in the @file{lib} subdirectory and no multilibs are used, this is
14510 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
14511 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
14512 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
14513 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
14515 @item -print-multiarch
14516 @opindex print-multiarch
14517 Print the path to OS libraries for the selected multiarch,
14518 relative to some @file{lib} subdirectory.
14520 @item -print-prog-name=@var{program}
14521 @opindex print-prog-name
14522 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
14524 @item -print-libgcc-file-name
14525 @opindex print-libgcc-file-name
14526 Same as @option{-print-file-name=libgcc.a}.
14528 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
14529 but you do want to link with @file{libgcc.a}. You can do:
14532 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
14535 @item -print-search-dirs
14536 @opindex print-search-dirs
14537 Print the name of the configured installation directory and a list of
14538 program and library directories @command{gcc} searches---and don't do anything else.
14540 This is useful when @command{gcc} prints the error message
14541 @samp{installation problem, cannot exec cpp0: No such file or directory}.
14542 To resolve this you either need to put @file{cpp0} and the other compiler
14543 components where @command{gcc} expects to find them, or you can set the environment
14544 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
14545 Don't forget the trailing @samp{/}.
14546 @xref{Environment Variables}.
14548 @item -print-sysroot
14549 @opindex print-sysroot
14550 Print the target sysroot directory that is used during
14551 compilation. This is the target sysroot specified either at configure
14552 time or using the @option{--sysroot} option, possibly with an extra
14553 suffix that depends on compilation options. If no target sysroot is
14554 specified, the option prints nothing.
14556 @item -print-sysroot-headers-suffix
14557 @opindex print-sysroot-headers-suffix
14558 Print the suffix added to the target sysroot when searching for
14559 headers, or give an error if the compiler is not configured with such
14560 a suffix---and don't do anything else.
14563 @opindex dumpmachine
14564 Print the compiler's target machine (for example,
14565 @samp{i686-pc-linux-gnu})---and don't do anything else.
14568 @opindex dumpversion
14569 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
14570 anything else. This is the compiler version used in filesystem paths,
14571 specs, can be depending on how the compiler has been configured just
14572 a single number (major version), two numbers separated by dot (major and
14573 minor version) or three numbers separated by dots (major, minor and patchlevel
14576 @item -dumpfullversion
14577 @opindex dumpfullversion
14578 Print the full compiler version, always 3 numbers separated by dots,
14579 major, minor and patchlevel version.
14583 Print the compiler's built-in specs---and don't do anything else. (This
14584 is used when GCC itself is being built.) @xref{Spec Files}.
14587 @node Submodel Options
14588 @section Machine-Dependent Options
14589 @cindex submodel options
14590 @cindex specifying hardware config
14591 @cindex hardware models and configurations, specifying
14592 @cindex target-dependent options
14593 @cindex machine-dependent options
14595 Each target machine supported by GCC can have its own options---for
14596 example, to allow you to compile for a particular processor variant or
14597 ABI, or to control optimizations specific to that machine. By
14598 convention, the names of machine-specific options start with
14601 Some configurations of the compiler also support additional target-specific
14602 options, usually for compatibility with other compilers on the same
14605 @c This list is ordered alphanumerically by subsection name.
14606 @c It should be the same order and spelling as these options are listed
14607 @c in Machine Dependent Options
14610 * AArch64 Options::
14611 * Adapteva Epiphany Options::
14615 * Blackfin Options::
14620 * DEC Alpha Options::
14624 * GNU/Linux Options::
14634 * MicroBlaze Options::
14637 * MN10300 Options::
14641 * Nios II Options::
14642 * Nvidia PTX Options::
14644 * picoChip Options::
14645 * PowerPC Options::
14646 * PowerPC SPE Options::
14649 * RS/6000 and PowerPC Options::
14651 * S/390 and zSeries Options::
14654 * Solaris 2 Options::
14657 * System V Options::
14658 * TILE-Gx Options::
14659 * TILEPro Options::
14664 * VxWorks Options::
14666 * x86 Windows Options::
14667 * Xstormy16 Options::
14669 * zSeries Options::
14672 @node AArch64 Options
14673 @subsection AArch64 Options
14674 @cindex AArch64 Options
14676 These options are defined for AArch64 implementations:
14680 @item -mabi=@var{name}
14682 Generate code for the specified data model. Permissible values
14683 are @samp{ilp32} for SysV-like data model where int, long int and pointers
14684 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
14685 but long int and pointers are 64 bits.
14687 The default depends on the specific target configuration. Note that
14688 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
14689 entire program with the same ABI, and link with a compatible set of libraries.
14692 @opindex mbig-endian
14693 Generate big-endian code. This is the default when GCC is configured for an
14694 @samp{aarch64_be-*-*} target.
14696 @item -mgeneral-regs-only
14697 @opindex mgeneral-regs-only
14698 Generate code which uses only the general-purpose registers. This will prevent
14699 the compiler from using floating-point and Advanced SIMD registers but will not
14700 impose any restrictions on the assembler.
14702 @item -mlittle-endian
14703 @opindex mlittle-endian
14704 Generate little-endian code. This is the default when GCC is configured for an
14705 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
14707 @item -mcmodel=tiny
14708 @opindex mcmodel=tiny
14709 Generate code for the tiny code model. The program and its statically defined
14710 symbols must be within 1MB of each other. Programs can be statically or
14711 dynamically linked.
14713 @item -mcmodel=small
14714 @opindex mcmodel=small
14715 Generate code for the small code model. The program and its statically defined
14716 symbols must be within 4GB of each other. Programs can be statically or
14717 dynamically linked. This is the default code model.
14719 @item -mcmodel=large
14720 @opindex mcmodel=large
14721 Generate code for the large code model. This makes no assumptions about
14722 addresses and sizes of sections. Programs can be statically linked only.
14724 @item -mstrict-align
14725 @itemx -mno-strict-align
14726 @opindex mstrict-align
14727 @opindex mno-strict-align
14728 Avoid or allow generating memory accesses that may not be aligned on a natural
14729 object boundary as described in the architecture specification.
14731 @item -momit-leaf-frame-pointer
14732 @itemx -mno-omit-leaf-frame-pointer
14733 @opindex momit-leaf-frame-pointer
14734 @opindex mno-omit-leaf-frame-pointer
14735 Omit or keep the frame pointer in leaf functions. The former behavior is the
14738 @item -mtls-dialect=desc
14739 @opindex mtls-dialect=desc
14740 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
14741 of TLS variables. This is the default.
14743 @item -mtls-dialect=traditional
14744 @opindex mtls-dialect=traditional
14745 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
14748 @item -mtls-size=@var{size}
14750 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
14751 This option requires binutils 2.26 or newer.
14753 @item -mfix-cortex-a53-835769
14754 @itemx -mno-fix-cortex-a53-835769
14755 @opindex mfix-cortex-a53-835769
14756 @opindex mno-fix-cortex-a53-835769
14757 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
14758 This involves inserting a NOP instruction between memory instructions and
14759 64-bit integer multiply-accumulate instructions.
14761 @item -mfix-cortex-a53-843419
14762 @itemx -mno-fix-cortex-a53-843419
14763 @opindex mfix-cortex-a53-843419
14764 @opindex mno-fix-cortex-a53-843419
14765 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
14766 This erratum workaround is made at link time and this will only pass the
14767 corresponding flag to the linker.
14769 @item -mlow-precision-recip-sqrt
14770 @itemx -mno-low-precision-recip-sqrt
14771 @opindex mlow-precision-recip-sqrt
14772 @opindex mno-low-precision-recip-sqrt
14773 Enable or disable the reciprocal square root approximation.
14774 This option only has an effect if @option{-ffast-math} or
14775 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14776 precision of reciprocal square root results to about 16 bits for
14777 single precision and to 32 bits for double precision.
14779 @item -mlow-precision-sqrt
14780 @itemx -mno-low-precision-sqrt
14781 @opindex -mlow-precision-sqrt
14782 @opindex -mno-low-precision-sqrt
14783 Enable or disable the square root approximation.
14784 This option only has an effect if @option{-ffast-math} or
14785 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14786 precision of square root results to about 16 bits for
14787 single precision and to 32 bits for double precision.
14788 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
14790 @item -mlow-precision-div
14791 @itemx -mno-low-precision-div
14792 @opindex -mlow-precision-div
14793 @opindex -mno-low-precision-div
14794 Enable or disable the division approximation.
14795 This option only has an effect if @option{-ffast-math} or
14796 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14797 precision of division results to about 16 bits for
14798 single precision and to 32 bits for double precision.
14800 @item -mtrack-speculation
14801 @itemx -mno-track-speculation
14802 Enable or disable generation of additional code to track speculative
14803 execution through conditional branches. The tracking state can then
14804 be used by the compiler when expanding calls to
14805 @code{__builtin_speculation_safe_copy} to permit a more efficient code
14806 sequence to be generated.
14808 @item -march=@var{name}
14810 Specify the name of the target architecture and, optionally, one or
14811 more feature modifiers. This option has the form
14812 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
14814 The permissible values for @var{arch} are @samp{armv8-a},
14815 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a} or @samp{armv8.4-a}
14818 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
14819 support for the ARMv8.4-A architecture extensions.
14821 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
14822 support for the ARMv8.3-A architecture extensions.
14824 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
14825 support for the ARMv8.2-A architecture extensions.
14827 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
14828 support for the ARMv8.1-A architecture extension. In particular, it
14829 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
14831 The value @samp{native} is available on native AArch64 GNU/Linux and
14832 causes the compiler to pick the architecture of the host system. This
14833 option has no effect if the compiler is unable to recognize the
14834 architecture of the host system,
14836 The permissible values for @var{feature} are listed in the sub-section
14837 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
14838 Feature Modifiers}. Where conflicting feature modifiers are
14839 specified, the right-most feature is used.
14841 GCC uses @var{name} to determine what kind of instructions it can emit
14842 when generating assembly code. If @option{-march} is specified
14843 without either of @option{-mtune} or @option{-mcpu} also being
14844 specified, the code is tuned to perform well across a range of target
14845 processors implementing the target architecture.
14847 @item -mtune=@var{name}
14849 Specify the name of the target processor for which GCC should tune the
14850 performance of the code. Permissible values for this option are:
14851 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
14852 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
14853 @samp{cortex-a76}, @samp{exynos-m1}, @samp{falkor}, @samp{qdf24xx},
14854 @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{thunderx},
14855 @samp{thunderxt88}, @samp{thunderxt88p1}, @samp{thunderxt81},
14856 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{cortex-a57.cortex-a53},
14857 @samp{cortex-a72.cortex-a53}, @samp{cortex-a73.cortex-a35},
14858 @samp{cortex-a73.cortex-a53}, @samp{cortex-a75.cortex-a55},
14859 @samp{cortex-a76.cortex-a55}
14862 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
14863 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
14864 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
14865 should tune for a big.LITTLE system.
14867 Additionally on native AArch64 GNU/Linux systems the value
14868 @samp{native} tunes performance to the host system. This option has no effect
14869 if the compiler is unable to recognize the processor of the host system.
14871 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
14872 are specified, the code is tuned to perform well across a range
14873 of target processors.
14875 This option cannot be suffixed by feature modifiers.
14877 @item -mcpu=@var{name}
14879 Specify the name of the target processor, optionally suffixed by one
14880 or more feature modifiers. This option has the form
14881 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
14882 the permissible values for @var{cpu} are the same as those available
14883 for @option{-mtune}. The permissible values for @var{feature} are
14884 documented in the sub-section on
14885 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
14886 Feature Modifiers}. Where conflicting feature modifiers are
14887 specified, the right-most feature is used.
14889 GCC uses @var{name} to determine what kind of instructions it can emit when
14890 generating assembly code (as if by @option{-march}) and to determine
14891 the target processor for which to tune for performance (as if
14892 by @option{-mtune}). Where this option is used in conjunction
14893 with @option{-march} or @option{-mtune}, those options take precedence
14894 over the appropriate part of this option.
14896 @item -moverride=@var{string}
14898 Override tuning decisions made by the back-end in response to a
14899 @option{-mtune=} switch. The syntax, semantics, and accepted values
14900 for @var{string} in this option are not guaranteed to be consistent
14903 This option is only intended to be useful when developing GCC.
14905 @item -mverbose-cost-dump
14906 @opindex mverbose-cost-dump
14907 Enable verbose cost model dumping in the debug dump files. This option is
14908 provided for use in debugging the compiler.
14910 @item -mpc-relative-literal-loads
14911 @itemx -mno-pc-relative-literal-loads
14912 @opindex mpc-relative-literal-loads
14913 @opindex mno-pc-relative-literal-loads
14914 Enable or disable PC-relative literal loads. With this option literal pools are
14915 accessed using a single instruction and emitted after each function. This
14916 limits the maximum size of functions to 1MB. This is enabled by default for
14917 @option{-mcmodel=tiny}.
14919 @item -msign-return-address=@var{scope}
14920 @opindex msign-return-address
14921 Select the function scope on which return address signing will be applied.
14922 Permissible values are @samp{none}, which disables return address signing,
14923 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
14924 functions, and @samp{all}, which enables pointer signing for all functions. The
14925 default value is @samp{none}.
14927 @item -msve-vector-bits=@var{bits}
14928 @opindex msve-vector-bits
14929 Specify the number of bits in an SVE vector register. This option only has
14930 an effect when SVE is enabled.
14932 GCC supports two forms of SVE code generation: ``vector-length
14933 agnostic'' output that works with any size of vector register and
14934 ``vector-length specific'' output that only works when the vector
14935 registers are a particular size. Replacing @var{bits} with
14936 @samp{scalable} selects vector-length agnostic output while
14937 replacing it with a number selects vector-length specific output.
14938 The possible lengths in the latter case are: 128, 256, 512, 1024
14939 and 2048. @samp{scalable} is the default.
14941 At present, @samp{-msve-vector-bits=128} produces the same output
14942 as @samp{-msve-vector-bits=scalable}.
14946 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
14947 @anchor{aarch64-feature-modifiers}
14948 @cindex @option{-march} feature modifiers
14949 @cindex @option{-mcpu} feature modifiers
14950 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
14951 the following and their inverses @option{no@var{feature}}:
14955 Enable CRC extension. This is on by default for
14956 @option{-march=armv8.1-a}.
14958 Enable Crypto extension. This also enables Advanced SIMD and floating-point
14961 Enable floating-point instructions. This is on by default for all possible
14962 values for options @option{-march} and @option{-mcpu}.
14964 Enable Advanced SIMD instructions. This also enables floating-point
14965 instructions. This is on by default for all possible values for options
14966 @option{-march} and @option{-mcpu}.
14968 Enable Scalable Vector Extension instructions. This also enables Advanced
14969 SIMD and floating-point instructions.
14971 Enable Large System Extension instructions. This is on by default for
14972 @option{-march=armv8.1-a}.
14974 Enable Round Double Multiply Accumulate instructions. This is on by default
14975 for @option{-march=armv8.1-a}.
14977 Enable FP16 extension. This also enables floating-point instructions.
14979 Enable FP16 fmla extension. This also enables FP16 extensions and
14980 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.
14983 Enable the RcPc extension. This does not change code generation from GCC,
14984 but is passed on to the assembler, enabling inline asm statements to use
14985 instructions from the RcPc extension.
14987 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
14989 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
14992 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
14994 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
14995 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
14997 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
14998 Use of this option with architectures prior to Armv8.2-A is not supported.
15000 Enable the Statistical Profiling extension. This option is only to enable the
15001 extension at the assembler level and does not affect code generation.
15005 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
15006 which implies @option{fp}.
15007 Conversely, @option{nofp} implies @option{nosimd}, which implies
15008 @option{nocrypto}, @option{noaes} and @option{nosha2}.
15010 @node Adapteva Epiphany Options
15011 @subsection Adapteva Epiphany Options
15013 These @samp{-m} options are defined for Adapteva Epiphany:
15016 @item -mhalf-reg-file
15017 @opindex mhalf-reg-file
15018 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
15019 That allows code to run on hardware variants that lack these registers.
15021 @item -mprefer-short-insn-regs
15022 @opindex mprefer-short-insn-regs
15023 Preferentially allocate registers that allow short instruction generation.
15024 This can result in increased instruction count, so this may either reduce or
15025 increase overall code size.
15027 @item -mbranch-cost=@var{num}
15028 @opindex mbranch-cost
15029 Set the cost of branches to roughly @var{num} ``simple'' instructions.
15030 This cost is only a heuristic and is not guaranteed to produce
15031 consistent results across releases.
15035 Enable the generation of conditional moves.
15037 @item -mnops=@var{num}
15039 Emit @var{num} NOPs before every other generated instruction.
15041 @item -mno-soft-cmpsf
15042 @opindex mno-soft-cmpsf
15043 For single-precision floating-point comparisons, emit an @code{fsub} instruction
15044 and test the flags. This is faster than a software comparison, but can
15045 get incorrect results in the presence of NaNs, or when two different small
15046 numbers are compared such that their difference is calculated as zero.
15047 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
15048 software comparisons.
15050 @item -mstack-offset=@var{num}
15051 @opindex mstack-offset
15052 Set the offset between the top of the stack and the stack pointer.
15053 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
15054 can be used by leaf functions without stack allocation.
15055 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
15056 Note also that this option changes the ABI; compiling a program with a
15057 different stack offset than the libraries have been compiled with
15058 generally does not work.
15059 This option can be useful if you want to evaluate if a different stack
15060 offset would give you better code, but to actually use a different stack
15061 offset to build working programs, it is recommended to configure the
15062 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
15064 @item -mno-round-nearest
15065 @opindex mno-round-nearest
15066 Make the scheduler assume that the rounding mode has been set to
15067 truncating. The default is @option{-mround-nearest}.
15070 @opindex mlong-calls
15071 If not otherwise specified by an attribute, assume all calls might be beyond
15072 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
15073 function address into a register before performing a (otherwise direct) call.
15074 This is the default.
15076 @item -mshort-calls
15077 @opindex short-calls
15078 If not otherwise specified by an attribute, assume all direct calls are
15079 in the range of the @code{b} / @code{bl} instructions, so use these instructions
15080 for direct calls. The default is @option{-mlong-calls}.
15084 Assume addresses can be loaded as 16-bit unsigned values. This does not
15085 apply to function addresses for which @option{-mlong-calls} semantics
15088 @item -mfp-mode=@var{mode}
15090 Set the prevailing mode of the floating-point unit.
15091 This determines the floating-point mode that is provided and expected
15092 at function call and return time. Making this mode match the mode you
15093 predominantly need at function start can make your programs smaller and
15094 faster by avoiding unnecessary mode switches.
15096 @var{mode} can be set to one the following values:
15100 Any mode at function entry is valid, and retained or restored when
15101 the function returns, and when it calls other functions.
15102 This mode is useful for compiling libraries or other compilation units
15103 you might want to incorporate into different programs with different
15104 prevailing FPU modes, and the convenience of being able to use a single
15105 object file outweighs the size and speed overhead for any extra
15106 mode switching that might be needed, compared with what would be needed
15107 with a more specific choice of prevailing FPU mode.
15110 This is the mode used for floating-point calculations with
15111 truncating (i.e.@: round towards zero) rounding mode. That includes
15112 conversion from floating point to integer.
15114 @item round-nearest
15115 This is the mode used for floating-point calculations with
15116 round-to-nearest-or-even rounding mode.
15119 This is the mode used to perform integer calculations in the FPU, e.g.@:
15120 integer multiply, or integer multiply-and-accumulate.
15123 The default is @option{-mfp-mode=caller}
15125 @item -mnosplit-lohi
15126 @itemx -mno-postinc
15127 @itemx -mno-postmodify
15128 @opindex mnosplit-lohi
15129 @opindex mno-postinc
15130 @opindex mno-postmodify
15131 Code generation tweaks that disable, respectively, splitting of 32-bit
15132 loads, generation of post-increment addresses, and generation of
15133 post-modify addresses. The defaults are @option{msplit-lohi},
15134 @option{-mpost-inc}, and @option{-mpost-modify}.
15136 @item -mnovect-double
15137 @opindex mno-vect-double
15138 Change the preferred SIMD mode to SImode. The default is
15139 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
15141 @item -max-vect-align=@var{num}
15142 @opindex max-vect-align
15143 The maximum alignment for SIMD vector mode types.
15144 @var{num} may be 4 or 8. The default is 8.
15145 Note that this is an ABI change, even though many library function
15146 interfaces are unaffected if they don't use SIMD vector modes
15147 in places that affect size and/or alignment of relevant types.
15149 @item -msplit-vecmove-early
15150 @opindex msplit-vecmove-early
15151 Split vector moves into single word moves before reload. In theory this
15152 can give better register allocation, but so far the reverse seems to be
15153 generally the case.
15155 @item -m1reg-@var{reg}
15157 Specify a register to hold the constant @minus{}1, which makes loading small negative
15158 constants and certain bitmasks faster.
15159 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
15160 which specify use of that register as a fixed register,
15161 and @samp{none}, which means that no register is used for this
15162 purpose. The default is @option{-m1reg-none}.
15167 @subsection ARC Options
15168 @cindex ARC options
15170 The following options control the architecture variant for which code
15173 @c architecture variants
15176 @item -mbarrel-shifter
15177 @opindex mbarrel-shifter
15178 Generate instructions supported by barrel shifter. This is the default
15179 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
15182 @opindex mjli-alawys
15183 Force to call a function using jli_s instruction. This option is
15184 valid only for ARCv2 architecture.
15186 @item -mcpu=@var{cpu}
15188 Set architecture type, register usage, and instruction scheduling
15189 parameters for @var{cpu}. There are also shortcut alias options
15190 available for backward compatibility and convenience. Supported
15191 values for @var{cpu} are
15197 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
15201 Compile for ARC601. Alias: @option{-mARC601}.
15206 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
15207 This is the default when configured with @option{--with-cpu=arc700}@.
15210 Compile for ARC EM.
15213 Compile for ARC HS.
15216 Compile for ARC EM CPU with no hardware extensions.
15219 Compile for ARC EM4 CPU.
15222 Compile for ARC EM4 DMIPS CPU.
15225 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
15229 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
15230 double assist instructions.
15233 Compile for ARC HS CPU with no hardware extensions except the atomic
15237 Compile for ARC HS34 CPU.
15240 Compile for ARC HS38 CPU.
15243 Compile for ARC HS38 CPU with all hardware extensions on.
15246 Compile for ARC 600 CPU with @code{norm} instructions enabled.
15248 @item arc600_mul32x16
15249 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
15250 instructions enabled.
15253 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
15254 instructions enabled.
15257 Compile for ARC 601 CPU with @code{norm} instructions enabled.
15259 @item arc601_mul32x16
15260 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
15261 instructions enabled.
15264 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
15265 instructions enabled.
15268 Compile for ARC 700 on NPS400 chip.
15271 Compile for ARC EM minimalist configuration featuring reduced register
15278 @itemx -mdpfp-compact
15279 @opindex mdpfp-compact
15280 Generate double-precision FPX instructions, tuned for the compact
15284 @opindex mdpfp-fast
15285 Generate double-precision FPX instructions, tuned for the fast
15288 @item -mno-dpfp-lrsr
15289 @opindex mno-dpfp-lrsr
15290 Disable @code{lr} and @code{sr} instructions from using FPX extension
15295 Generate extended arithmetic instructions. Currently only
15296 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
15297 supported. This is always enabled for @option{-mcpu=ARC700}.
15301 Do not generate @code{mpy}-family instructions for ARC700. This option is
15306 Generate 32x16-bit multiply and multiply-accumulate instructions.
15310 Generate @code{mul64} and @code{mulu64} instructions.
15311 Only valid for @option{-mcpu=ARC600}.
15315 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
15320 @itemx -mspfp-compact
15321 @opindex mspfp-compact
15322 Generate single-precision FPX instructions, tuned for the compact
15326 @opindex mspfp-fast
15327 Generate single-precision FPX instructions, tuned for the fast
15332 Enable generation of ARC SIMD instructions via target-specific
15333 builtins. Only valid for @option{-mcpu=ARC700}.
15336 @opindex msoft-float
15337 This option ignored; it is provided for compatibility purposes only.
15338 Software floating-point code is emitted by default, and this default
15339 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
15340 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
15341 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
15345 Generate @code{swap} instructions.
15349 This enables use of the locked load/store conditional extension to implement
15350 atomic memory built-in functions. Not available for ARC 6xx or ARC
15355 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
15357 @item -mcode-density
15358 @opindex mcode-density
15359 Enable code density instructions for ARC EM.
15360 This option is on by default for ARC HS.
15364 Enable double load/store operations for ARC HS cores.
15366 @item -mtp-regno=@var{regno}
15368 Specify thread pointer register number.
15370 @item -mmpy-option=@var{multo}
15371 @opindex mmpy-option
15372 Compile ARCv2 code with a multiplier design option. You can specify
15373 the option using either a string or numeric value for @var{multo}.
15374 @samp{wlh1} is the default value. The recognized values are:
15379 No multiplier available.
15383 16x16 multiplier, fully pipelined.
15384 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
15388 32x32 multiplier, fully
15389 pipelined (1 stage). The following instructions are additionally
15390 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15394 32x32 multiplier, fully pipelined
15395 (2 stages). The following instructions are additionally enabled: @code{mpy},
15396 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15400 Two 16x16 multipliers, blocking,
15401 sequential. The following instructions are additionally enabled: @code{mpy},
15402 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15406 One 16x16 multiplier, blocking,
15407 sequential. The following instructions are additionally enabled: @code{mpy},
15408 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15412 One 32x4 multiplier, blocking,
15413 sequential. The following instructions are additionally enabled: @code{mpy},
15414 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15418 ARC HS SIMD support.
15422 ARC HS SIMD support.
15426 ARC HS SIMD support.
15430 This option is only available for ARCv2 cores@.
15432 @item -mfpu=@var{fpu}
15434 Enables support for specific floating-point hardware extensions for ARCv2
15435 cores. Supported values for @var{fpu} are:
15440 Enables support for single-precision floating-point hardware
15444 Enables support for double-precision floating-point hardware
15445 extensions. The single-precision floating-point extension is also
15446 enabled. Not available for ARC EM@.
15449 Enables support for double-precision floating-point hardware
15450 extensions using double-precision assist instructions. The single-precision
15451 floating-point extension is also enabled. This option is
15452 only available for ARC EM@.
15455 Enables support for double-precision floating-point hardware
15456 extensions using double-precision assist instructions.
15457 The single-precision floating-point, square-root, and divide
15458 extensions are also enabled. This option is
15459 only available for ARC EM@.
15462 Enables support for double-precision floating-point hardware
15463 extensions using double-precision assist instructions.
15464 The single-precision floating-point and fused multiply and add
15465 hardware extensions are also enabled. This option is
15466 only available for ARC EM@.
15469 Enables support for double-precision floating-point hardware
15470 extensions using double-precision assist instructions.
15471 All single-precision floating-point hardware extensions are also
15472 enabled. This option is only available for ARC EM@.
15475 Enables support for single-precision floating-point, square-root and divide
15476 hardware extensions@.
15479 Enables support for double-precision floating-point, square-root and divide
15480 hardware extensions. This option
15481 includes option @samp{fpus_div}. Not available for ARC EM@.
15484 Enables support for single-precision floating-point and
15485 fused multiply and add hardware extensions@.
15488 Enables support for double-precision floating-point and
15489 fused multiply and add hardware extensions. This option
15490 includes option @samp{fpus_fma}. Not available for ARC EM@.
15493 Enables support for all single-precision floating-point hardware
15497 Enables support for all single- and double-precision floating-point
15498 hardware extensions. Not available for ARC EM@.
15502 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
15503 @opindex mirq-ctrl-saved
15504 Specifies general-purposes registers that the processor automatically
15505 saves/restores on interrupt entry and exit. @var{register-range} is
15506 specified as two registers separated by a dash. The register range
15507 always starts with @code{r0}, the upper limit is @code{fp} register.
15508 @var{blink} and @var{lp_count} are optional. This option is only
15509 valid for ARC EM and ARC HS cores.
15511 @item -mrgf-banked-regs=@var{number}
15512 @opindex mrgf-banked-regs
15513 Specifies the number of registers replicated in second register bank
15514 on entry to fast interrupt. Fast interrupts are interrupts with the
15515 highest priority level P0. These interrupts save only PC and STATUS32
15516 registers to avoid memory transactions during interrupt entry and exit
15517 sequences. Use this option when you are using fast interrupts in an
15518 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
15520 @item -mlpc-width=@var{width}
15521 @opindex mlpc-width
15522 Specify the width of the @code{lp_count} register. Valid values for
15523 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
15524 fixed to 32 bits. If the width is less than 32, the compiler does not
15525 attempt to transform loops in your program to use the zero-delay loop
15526 mechanism unless it is known that the @code{lp_count} register can
15527 hold the required loop-counter value. Depending on the width
15528 specified, the compiler and run-time library might continue to use the
15529 loop mechanism for various needs. This option defines macro
15530 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
15534 This option instructs the compiler to generate code for a 16-entry
15535 register file. This option defines the @code{__ARC_RF16__}
15536 preprocessor macro.
15540 The following options are passed through to the assembler, and also
15541 define preprocessor macro symbols.
15543 @c Flags used by the assembler, but for which we define preprocessor
15544 @c macro symbols as well.
15547 @opindex mdsp-packa
15548 Passed down to the assembler to enable the DSP Pack A extensions.
15549 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
15554 Passed down to the assembler to enable the dual Viterbi butterfly
15555 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
15556 option is deprecated.
15558 @c ARC700 4.10 extension instruction
15561 Passed down to the assembler to enable the locked load/store
15562 conditional extension. Also sets the preprocessor symbol
15567 Passed down to the assembler. Also sets the preprocessor symbol
15568 @code{__Xxmac_d16}. This option is deprecated.
15572 Passed down to the assembler. Also sets the preprocessor symbol
15573 @code{__Xxmac_24}. This option is deprecated.
15575 @c ARC700 4.10 extension instruction
15578 Passed down to the assembler to enable the 64-bit time-stamp counter
15579 extension instruction. Also sets the preprocessor symbol
15580 @code{__Xrtsc}. This option is deprecated.
15582 @c ARC700 4.10 extension instruction
15585 Passed down to the assembler to enable the swap byte ordering
15586 extension instruction. Also sets the preprocessor symbol
15590 @opindex mtelephony
15591 Passed down to the assembler to enable dual- and single-operand
15592 instructions for telephony. Also sets the preprocessor symbol
15593 @code{__Xtelephony}. This option is deprecated.
15597 Passed down to the assembler to enable the XY memory extension. Also
15598 sets the preprocessor symbol @code{__Xxy}.
15602 The following options control how the assembly code is annotated:
15604 @c Assembly annotation options
15608 Annotate assembler instructions with estimated addresses.
15610 @item -mannotate-align
15611 @opindex mannotate-align
15612 Explain what alignment considerations lead to the decision to make an
15613 instruction short or long.
15617 The following options are passed through to the linker:
15619 @c options passed through to the linker
15623 Passed through to the linker, to specify use of the @code{arclinux} emulation.
15624 This option is enabled by default in tool chains built for
15625 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
15626 when profiling is not requested.
15628 @item -marclinux_prof
15629 @opindex marclinux_prof
15630 Passed through to the linker, to specify use of the
15631 @code{arclinux_prof} emulation. This option is enabled by default in
15632 tool chains built for @w{@code{arc-linux-uclibc}} and
15633 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
15637 The following options control the semantics of generated code:
15639 @c semantically relevant code generation options
15642 @opindex mlong-calls
15643 Generate calls as register indirect calls, thus providing access
15644 to the full 32-bit address range.
15646 @item -mmedium-calls
15647 @opindex mmedium-calls
15648 Don't use less than 25-bit addressing range for calls, which is the
15649 offset available for an unconditional branch-and-link
15650 instruction. Conditional execution of function calls is suppressed, to
15651 allow use of the 25-bit range, rather than the 21-bit range with
15652 conditional branch-and-link. This is the default for tool chains built
15653 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
15657 Put definitions of externally-visible data in a small data section if
15658 that data is no bigger than @var{num} bytes. The default value of
15659 @var{num} is 4 for any ARC configuration, or 8 when we have double
15660 load/store operations.
15664 Do not generate sdata references. This is the default for tool chains
15665 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
15668 @item -mvolatile-cache
15669 @opindex mvolatile-cache
15670 Use ordinarily cached memory accesses for volatile references. This is the
15673 @item -mno-volatile-cache
15674 @opindex mno-volatile-cache
15675 Enable cache bypass for volatile references.
15679 The following options fine tune code generation:
15680 @c code generation tuning options
15683 @opindex malign-call
15684 Do alignment optimizations for call instructions.
15686 @item -mauto-modify-reg
15687 @opindex mauto-modify-reg
15688 Enable the use of pre/post modify with register displacement.
15690 @item -mbbit-peephole
15691 @opindex mbbit-peephole
15692 Enable bbit peephole2.
15696 This option disables a target-specific pass in @file{arc_reorg} to
15697 generate compare-and-branch (@code{br@var{cc}}) instructions.
15698 It has no effect on
15699 generation of these instructions driven by the combiner pass.
15701 @item -mcase-vector-pcrel
15702 @opindex mcase-vector-pcrel
15703 Use PC-relative switch case tables to enable case table shortening.
15704 This is the default for @option{-Os}.
15706 @item -mcompact-casesi
15707 @opindex mcompact-casesi
15708 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
15709 and only available for ARCv1 cores.
15711 @item -mno-cond-exec
15712 @opindex mno-cond-exec
15713 Disable the ARCompact-specific pass to generate conditional
15714 execution instructions.
15716 Due to delay slot scheduling and interactions between operand numbers,
15717 literal sizes, instruction lengths, and the support for conditional execution,
15718 the target-independent pass to generate conditional execution is often lacking,
15719 so the ARC port has kept a special pass around that tries to find more
15720 conditional execution generation opportunities after register allocation,
15721 branch shortening, and delay slot scheduling have been done. This pass
15722 generally, but not always, improves performance and code size, at the cost of
15723 extra compilation time, which is why there is an option to switch it off.
15724 If you have a problem with call instructions exceeding their allowable
15725 offset range because they are conditionalized, you should consider using
15726 @option{-mmedium-calls} instead.
15728 @item -mearly-cbranchsi
15729 @opindex mearly-cbranchsi
15730 Enable pre-reload use of the @code{cbranchsi} pattern.
15732 @item -mexpand-adddi
15733 @opindex mexpand-adddi
15734 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
15735 @code{add.f}, @code{adc} etc. This option is deprecated.
15737 @item -mindexed-loads
15738 @opindex mindexed-loads
15739 Enable the use of indexed loads. This can be problematic because some
15740 optimizers then assume that indexed stores exist, which is not
15745 Enable Local Register Allocation. This is still experimental for ARC,
15746 so by default the compiler uses standard reload
15747 (i.e. @option{-mno-lra}).
15749 @item -mlra-priority-none
15750 @opindex mlra-priority-none
15751 Don't indicate any priority for target registers.
15753 @item -mlra-priority-compact
15754 @opindex mlra-priority-compact
15755 Indicate target register priority for r0..r3 / r12..r15.
15757 @item -mlra-priority-noncompact
15758 @opindex mlra-priority-noncompact
15759 Reduce target register priority for r0..r3 / r12..r15.
15761 @item -mno-millicode
15762 @opindex mno-millicode
15763 When optimizing for size (using @option{-Os}), prologues and epilogues
15764 that have to save or restore a large number of registers are often
15765 shortened by using call to a special function in libgcc; this is
15766 referred to as a @emph{millicode} call. As these calls can pose
15767 performance issues, and/or cause linking issues when linking in a
15768 nonstandard way, this option is provided to turn off millicode call
15772 @opindex mmixed-code
15773 Tweak register allocation to help 16-bit instruction generation.
15774 This generally has the effect of decreasing the average instruction size
15775 while increasing the instruction count.
15779 Enable @samp{q} instruction alternatives.
15780 This is the default for @option{-Os}.
15784 Enable @samp{Rcq} constraint handling.
15785 Most short code generation depends on this.
15786 This is the default.
15790 Enable @samp{Rcw} constraint handling.
15791 Most ccfsm condexec mostly depends on this.
15792 This is the default.
15794 @item -msize-level=@var{level}
15795 @opindex msize-level
15796 Fine-tune size optimization with regards to instruction lengths and alignment.
15797 The recognized values for @var{level} are:
15800 No size optimization. This level is deprecated and treated like @samp{1}.
15803 Short instructions are used opportunistically.
15806 In addition, alignment of loops and of code after barriers are dropped.
15809 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
15813 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
15814 the behavior when this is not set is equivalent to level @samp{1}.
15816 @item -mtune=@var{cpu}
15818 Set instruction scheduling parameters for @var{cpu}, overriding any implied
15819 by @option{-mcpu=}.
15821 Supported values for @var{cpu} are
15825 Tune for ARC600 CPU.
15828 Tune for ARC601 CPU.
15831 Tune for ARC700 CPU with standard multiplier block.
15834 Tune for ARC700 CPU with XMAC block.
15837 Tune for ARC725D CPU.
15840 Tune for ARC750D CPU.
15844 @item -mmultcost=@var{num}
15846 Cost to assume for a multiply instruction, with @samp{4} being equal to a
15847 normal instruction.
15849 @item -munalign-prob-threshold=@var{probability}
15850 @opindex munalign-prob-threshold
15851 Set probability threshold for unaligning branches.
15852 When tuning for @samp{ARC700} and optimizing for speed, branches without
15853 filled delay slot are preferably emitted unaligned and long, unless
15854 profiling indicates that the probability for the branch to be taken
15855 is below @var{probability}. @xref{Cross-profiling}.
15856 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
15860 The following options are maintained for backward compatibility, but
15861 are now deprecated and will be removed in a future release:
15863 @c Deprecated options
15871 @opindex mbig-endian
15874 Compile code for big-endian targets. Use of these options is now
15875 deprecated. Big-endian code is supported by configuring GCC to build
15876 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
15877 for which big endian is the default.
15879 @item -mlittle-endian
15880 @opindex mlittle-endian
15883 Compile code for little-endian targets. Use of these options is now
15884 deprecated. Little-endian code is supported by configuring GCC to build
15885 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
15886 for which little endian is the default.
15888 @item -mbarrel_shifter
15889 @opindex mbarrel_shifter
15890 Replaced by @option{-mbarrel-shifter}.
15892 @item -mdpfp_compact
15893 @opindex mdpfp_compact
15894 Replaced by @option{-mdpfp-compact}.
15897 @opindex mdpfp_fast
15898 Replaced by @option{-mdpfp-fast}.
15901 @opindex mdsp_packa
15902 Replaced by @option{-mdsp-packa}.
15906 Replaced by @option{-mea}.
15910 Replaced by @option{-mmac-24}.
15914 Replaced by @option{-mmac-d16}.
15916 @item -mspfp_compact
15917 @opindex mspfp_compact
15918 Replaced by @option{-mspfp-compact}.
15921 @opindex mspfp_fast
15922 Replaced by @option{-mspfp-fast}.
15924 @item -mtune=@var{cpu}
15926 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
15927 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
15928 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
15930 @item -multcost=@var{num}
15932 Replaced by @option{-mmultcost}.
15937 @subsection ARM Options
15938 @cindex ARM options
15940 These @samp{-m} options are defined for the ARM port:
15943 @item -mabi=@var{name}
15945 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
15946 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
15949 @opindex mapcs-frame
15950 Generate a stack frame that is compliant with the ARM Procedure Call
15951 Standard for all functions, even if this is not strictly necessary for
15952 correct execution of the code. Specifying @option{-fomit-frame-pointer}
15953 with this option causes the stack frames not to be generated for
15954 leaf functions. The default is @option{-mno-apcs-frame}.
15955 This option is deprecated.
15959 This is a synonym for @option{-mapcs-frame} and is deprecated.
15962 @c not currently implemented
15963 @item -mapcs-stack-check
15964 @opindex mapcs-stack-check
15965 Generate code to check the amount of stack space available upon entry to
15966 every function (that actually uses some stack space). If there is
15967 insufficient space available then either the function
15968 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
15969 called, depending upon the amount of stack space required. The runtime
15970 system is required to provide these functions. The default is
15971 @option{-mno-apcs-stack-check}, since this produces smaller code.
15973 @c not currently implemented
15974 @item -mapcs-reentrant
15975 @opindex mapcs-reentrant
15976 Generate reentrant, position-independent code. The default is
15977 @option{-mno-apcs-reentrant}.
15980 @item -mthumb-interwork
15981 @opindex mthumb-interwork
15982 Generate code that supports calling between the ARM and Thumb
15983 instruction sets. Without this option, on pre-v5 architectures, the
15984 two instruction sets cannot be reliably used inside one program. The
15985 default is @option{-mno-thumb-interwork}, since slightly larger code
15986 is generated when @option{-mthumb-interwork} is specified. In AAPCS
15987 configurations this option is meaningless.
15989 @item -mno-sched-prolog
15990 @opindex mno-sched-prolog
15991 Prevent the reordering of instructions in the function prologue, or the
15992 merging of those instruction with the instructions in the function's
15993 body. This means that all functions start with a recognizable set
15994 of instructions (or in fact one of a choice from a small set of
15995 different function prologues), and this information can be used to
15996 locate the start of functions inside an executable piece of code. The
15997 default is @option{-msched-prolog}.
15999 @item -mfloat-abi=@var{name}
16000 @opindex mfloat-abi
16001 Specifies which floating-point ABI to use. Permissible values
16002 are: @samp{soft}, @samp{softfp} and @samp{hard}.
16004 Specifying @samp{soft} causes GCC to generate output containing
16005 library calls for floating-point operations.
16006 @samp{softfp} allows the generation of code using hardware floating-point
16007 instructions, but still uses the soft-float calling conventions.
16008 @samp{hard} allows generation of floating-point instructions
16009 and uses FPU-specific calling conventions.
16011 The default depends on the specific target configuration. Note that
16012 the hard-float and soft-float ABIs are not link-compatible; you must
16013 compile your entire program with the same ABI, and link with a
16014 compatible set of libraries.
16016 @item -mlittle-endian
16017 @opindex mlittle-endian
16018 Generate code for a processor running in little-endian mode. This is
16019 the default for all standard configurations.
16022 @opindex mbig-endian
16023 Generate code for a processor running in big-endian mode; the default is
16024 to compile code for a little-endian processor.
16029 When linking a big-endian image select between BE8 and BE32 formats.
16030 The option has no effect for little-endian images and is ignored. The
16031 default is dependent on the selected target architecture. For ARMv6
16032 and later architectures the default is BE8, for older architectures
16033 the default is BE32. BE32 format has been deprecated by ARM.
16035 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
16037 This specifies the name of the target ARM architecture. GCC uses this
16038 name to determine what kind of instructions it can emit when generating
16039 assembly code. This option can be used in conjunction with or instead
16040 of the @option{-mcpu=} option.
16042 Permissible names are:
16044 @samp{armv5t}, @samp{armv5te},
16045 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
16046 @samp{armv6z}, @samp{armv6zk},
16047 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
16048 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
16052 @samp{armv6-m}, @samp{armv6s-m},
16053 @samp{armv7-m}, @samp{armv7e-m},
16054 @samp{armv8-m.base}, @samp{armv8-m.main},
16055 @samp{iwmmxt} and @samp{iwmmxt2}.
16057 Additionally, the following architectures, which lack support for the
16058 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
16060 Many of the architectures support extensions. These can be added by
16061 appending @samp{+@var{extension}} to the architecture name. Extension
16062 options are processed in order and capabilities accumulate. An extension
16063 will also enable any necessary base extensions
16064 upon which it depends. For example, the @samp{+crypto} extension
16065 will always enable the @samp{+simd} extension. The exception to the
16066 additive construction is for extensions that are prefixed with
16067 @samp{+no@dots{}}: these extensions disable the specified option and
16068 any other extensions that may depend on the presence of that
16071 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
16072 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
16073 entirely disabled by the @samp{+nofp} option that follows it.
16075 Most extension names are generically named, but have an effect that is
16076 dependent upon the architecture to which it is applied. For example,
16077 the @samp{+simd} option can be applied to both @samp{armv7-a} and
16078 @samp{armv8-a} architectures, but will enable the original ARMv7-A
16079 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
16080 variant for @samp{armv8-a}.
16082 The table below lists the supported extensions for each architecture.
16083 Architectures not mentioned do not support any extensions.
16096 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
16097 used as an alias for this extension.
16100 Disable the floating-point instructions.
16104 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
16107 The VFPv3 floating-point instructions, with 16 double-precision
16108 registers. The extension @samp{+vfpv3-d16} can be used as an alias
16109 for this extension. Note that floating-point is not supported by the
16110 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
16111 ARMv7-R architectures.
16114 Disable the floating-point instructions.
16120 The VFPv3 floating-point instructions, with 16 double-precision
16121 registers. The extension @samp{+vfpv3-d16} can be used as an alias
16122 for this extension.
16125 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
16126 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
16127 for this extension.
16130 The VFPv3 floating-point instructions, with 32 double-precision
16133 @item +vfpv3-d16-fp16
16134 The VFPv3 floating-point instructions, with 16 double-precision
16135 registers and the half-precision floating-point conversion operations.
16138 The VFPv3 floating-point instructions, with 32 double-precision
16139 registers and the half-precision floating-point conversion operations.
16142 The VFPv4 floating-point instructions, with 16 double-precision
16146 The VFPv4 floating-point instructions, with 32 double-precision
16150 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
16151 the half-precision floating-point conversion operations.
16154 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
16157 Disable the Advanced SIMD instructions (does not disable floating point).
16160 Disable the floating-point and Advanced SIMD instructions.
16164 The extended version of the ARMv7-A architecture with support for
16168 The VFPv4 floating-point instructions, with 16 double-precision registers.
16169 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
16172 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
16173 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
16176 The VFPv3 floating-point instructions, with 16 double-precision
16180 The VFPv3 floating-point instructions, with 32 double-precision
16183 @item +vfpv3-d16-fp16
16184 The VFPv3 floating-point instructions, with 16 double-precision
16185 registers and the half-precision floating-point conversion operations.
16188 The VFPv3 floating-point instructions, with 32 double-precision
16189 registers and the half-precision floating-point conversion operations.
16192 The VFPv4 floating-point instructions, with 16 double-precision
16196 The VFPv4 floating-point instructions, with 32 double-precision
16200 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
16201 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
16204 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
16205 the half-precision floating-point conversion operations.
16208 Disable the Advanced SIMD instructions (does not disable floating point).
16211 Disable the floating-point and Advanced SIMD instructions.
16217 The Cyclic Redundancy Check (CRC) instructions.
16219 The ARMv8-A Advanced SIMD and floating-point instructions.
16221 The cryptographic instructions.
16223 Disable the cryptographic instructions.
16225 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16231 The ARMv8.1-A Advanced SIMD and floating-point instructions.
16234 The cryptographic instructions. This also enables the Advanced SIMD and
16235 floating-point instructions.
16238 Disable the cryptographic instructions.
16241 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16248 The half-precision floating-point data processing instructions.
16249 This also enables the Advanced SIMD and floating-point instructions.
16252 The half-precision floating-point fmla extension. This also enables
16253 the half-precision floating-point extension and Advanced SIMD and
16254 floating-point instructions.
16257 The ARMv8.1-A Advanced SIMD and floating-point instructions.
16260 The cryptographic instructions. This also enables the Advanced SIMD and
16261 floating-point instructions.
16264 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
16267 Disable the cryptographic extension.
16270 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16276 The half-precision floating-point data processing instructions.
16277 This also enables the Advanced SIMD and floating-point instructions as well
16278 as the Dot Product extension and the half-precision floating-point fmla
16282 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
16283 Dot Product extension.
16286 The cryptographic instructions. This also enables the Advanced SIMD and
16287 floating-point instructions as well as the Dot Product extension.
16290 Disable the cryptographic extension.
16293 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16299 The single-precision VFPv3 floating-point instructions. The extension
16300 @samp{+vfpv3xd} can be used as an alias for this extension.
16303 The VFPv3 floating-point instructions with 16 double-precision registers.
16304 The extension +vfpv3-d16 can be used as an alias for this extension.
16307 Disable the floating-point extension.
16310 The ARM-state integer division instructions.
16313 Disable the ARM-state integer division extension.
16319 The single-precision VFPv4 floating-point instructions.
16322 The single-precision FPv5 floating-point instructions.
16325 The single- and double-precision FPv5 floating-point instructions.
16328 Disable the floating-point extensions.
16334 The DSP instructions.
16337 Disable the DSP extension.
16340 The single-precision floating-point instructions.
16343 The single- and double-precision floating-point instructions.
16346 Disable the floating-point extension.
16352 The Cyclic Redundancy Check (CRC) instructions.
16354 The single-precision FPv5 floating-point instructions.
16356 The ARMv8-A Advanced SIMD and floating-point instructions.
16358 The cryptographic instructions.
16360 Disable the cryptographic instructions.
16362 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16367 @option{-march=native} causes the compiler to auto-detect the architecture
16368 of the build computer. At present, this feature is only supported on
16369 GNU/Linux, and not all architectures are recognized. If the auto-detect
16370 is unsuccessful the option has no effect.
16372 @item -mtune=@var{name}
16374 This option specifies the name of the target ARM processor for
16375 which GCC should tune the performance of the code.
16376 For some ARM implementations better performance can be obtained by using
16378 Permissible names are: @samp{arm2}, @samp{arm250},
16379 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
16380 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
16381 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
16382 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
16384 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
16385 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
16386 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
16387 @samp{strongarm1110},
16388 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
16389 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
16390 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
16391 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
16392 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
16393 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
16394 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
16395 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
16396 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
16397 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
16398 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
16399 @samp{cortex-a76}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5},
16400 @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
16408 @samp{cortex-m0plus},
16409 @samp{cortex-m1.small-multiply},
16410 @samp{cortex-m0.small-multiply},
16411 @samp{cortex-m0plus.small-multiply},
16413 @samp{marvell-pj4},
16414 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
16415 @samp{fa526}, @samp{fa626},
16416 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
16419 Additionally, this option can specify that GCC should tune the performance
16420 of the code for a big.LITTLE system. Permissible names are:
16421 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
16422 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16423 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
16424 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
16426 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
16427 performance for a blend of processors within architecture @var{arch}.
16428 The aim is to generate code that run well on the current most popular
16429 processors, balancing between optimizations that benefit some CPUs in the
16430 range, and avoiding performance pitfalls of other CPUs. The effects of
16431 this option may change in future GCC versions as CPU models come and go.
16433 @option{-mtune} permits the same extension options as @option{-mcpu}, but
16434 the extension options do not affect the tuning of the generated code.
16436 @option{-mtune=native} causes the compiler to auto-detect the CPU
16437 of the build computer. At present, this feature is only supported on
16438 GNU/Linux, and not all architectures are recognized. If the auto-detect is
16439 unsuccessful the option has no effect.
16441 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
16443 This specifies the name of the target ARM processor. GCC uses this name
16444 to derive the name of the target ARM architecture (as if specified
16445 by @option{-march}) and the ARM processor type for which to tune for
16446 performance (as if specified by @option{-mtune}). Where this option
16447 is used in conjunction with @option{-march} or @option{-mtune},
16448 those options take precedence over the appropriate part of this option.
16450 Many of the supported CPUs implement optional architectural
16451 extensions. Where this is so the architectural extensions are
16452 normally enabled by default. If implementations that lack the
16453 extension exist, then the extension syntax can be used to disable
16454 those extensions that have been omitted. For floating-point and
16455 Advanced SIMD (Neon) instructions, the settings of the options
16456 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
16457 floating-point and Advanced SIMD instructions will only be used if
16458 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
16459 @option{-mfpu} other than @samp{auto} will override the available
16460 floating-point and SIMD extension instructions.
16462 For example, @samp{cortex-a9} can be found in three major
16463 configurations: integer only, with just a floating-point unit or with
16464 floating-point and Advanced SIMD. The default is to enable all the
16465 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
16466 be used to disable just the SIMD or both the SIMD and floating-point
16467 instructions respectively.
16469 Permissible names for this option are the same as those for
16472 The following extension options are common to the listed CPUs:
16476 Disable the DSP instructions on @samp{cortex-m33}.
16479 Disables the floating-point instructions on @samp{arm9e},
16480 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
16481 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
16482 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
16483 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
16484 Disables the floating-point and SIMD instructions on
16485 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
16486 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
16487 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
16488 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
16489 @samp{cortex-a53} and @samp{cortex-a55}.
16492 Disables the double-precision component of the floating-point instructions
16493 on @samp{cortex-r5}, @samp{cortex-r52} and @samp{cortex-m7}.
16496 Disables the SIMD (but not floating-point) instructions on
16497 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
16498 and @samp{cortex-a9}.
16501 Enables the cryptographic instructions on @samp{cortex-a32},
16502 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
16503 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
16504 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16505 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
16506 @samp{cortex-a75.cortex-a55}.
16509 Additionally the @samp{generic-armv7-a} pseudo target defaults to
16510 VFPv3 with 16 double-precision registers. It supports the following
16511 extension options: @samp{vfpv3-d16}, @samp{vfpv3},
16512 @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16}, @samp{vfpv4-d16},
16513 @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3}, @samp{neon-fp16},
16514 @samp{neon-vfpv4}. The meanings are the same as for the extensions to
16515 @option{-march=armv7-a}.
16517 @option{-mcpu=generic-@var{arch}} is also permissible, and is
16518 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
16519 See @option{-mtune} for more information.
16521 @option{-mcpu=native} causes the compiler to auto-detect the CPU
16522 of the build computer. At present, this feature is only supported on
16523 GNU/Linux, and not all architectures are recognized. If the auto-detect
16524 is unsuccessful the option has no effect.
16526 @item -mfpu=@var{name}
16528 This specifies what floating-point hardware (or hardware emulation) is
16529 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
16531 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
16532 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
16533 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
16534 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
16535 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
16536 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
16537 is an alias for @samp{vfpv2}.
16539 The setting @samp{auto} is the default and is special. It causes the
16540 compiler to select the floating-point and Advanced SIMD instructions
16541 based on the settings of @option{-mcpu} and @option{-march}.
16543 If the selected floating-point hardware includes the NEON extension
16544 (e.g. @option{-mfpu=neon}), note that floating-point
16545 operations are not generated by GCC's auto-vectorization pass unless
16546 @option{-funsafe-math-optimizations} is also specified. This is
16547 because NEON hardware does not fully implement the IEEE 754 standard for
16548 floating-point arithmetic (in particular denormal values are treated as
16549 zero), so the use of NEON instructions may lead to a loss of precision.
16551 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}).
16553 @item -mfp16-format=@var{name}
16554 @opindex mfp16-format
16555 Specify the format of the @code{__fp16} half-precision floating-point type.
16556 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
16557 the default is @samp{none}, in which case the @code{__fp16} type is not
16558 defined. @xref{Half-Precision}, for more information.
16560 @item -mstructure-size-boundary=@var{n}
16561 @opindex mstructure-size-boundary
16562 The sizes of all structures and unions are rounded up to a multiple
16563 of the number of bits set by this option. Permissible values are 8, 32
16564 and 64. The default value varies for different toolchains. For the COFF
16565 targeted toolchain the default value is 8. A value of 64 is only allowed
16566 if the underlying ABI supports it.
16568 Specifying a larger number can produce faster, more efficient code, but
16569 can also increase the size of the program. Different values are potentially
16570 incompatible. Code compiled with one value cannot necessarily expect to
16571 work with code or libraries compiled with another value, if they exchange
16572 information using structures or unions.
16574 This option is deprecated.
16576 @item -mabort-on-noreturn
16577 @opindex mabort-on-noreturn
16578 Generate a call to the function @code{abort} at the end of a
16579 @code{noreturn} function. It is executed if the function tries to
16583 @itemx -mno-long-calls
16584 @opindex mlong-calls
16585 @opindex mno-long-calls
16586 Tells the compiler to perform function calls by first loading the
16587 address of the function into a register and then performing a subroutine
16588 call on this register. This switch is needed if the target function
16589 lies outside of the 64-megabyte addressing range of the offset-based
16590 version of subroutine call instruction.
16592 Even if this switch is enabled, not all function calls are turned
16593 into long calls. The heuristic is that static functions, functions
16594 that have the @code{short_call} attribute, functions that are inside
16595 the scope of a @code{#pragma no_long_calls} directive, and functions whose
16596 definitions have already been compiled within the current compilation
16597 unit are not turned into long calls. The exceptions to this rule are
16598 that weak function definitions, functions with the @code{long_call}
16599 attribute or the @code{section} attribute, and functions that are within
16600 the scope of a @code{#pragma long_calls} directive are always
16601 turned into long calls.
16603 This feature is not enabled by default. Specifying
16604 @option{-mno-long-calls} restores the default behavior, as does
16605 placing the function calls within the scope of a @code{#pragma
16606 long_calls_off} directive. Note these switches have no effect on how
16607 the compiler generates code to handle function calls via function
16610 @item -msingle-pic-base
16611 @opindex msingle-pic-base
16612 Treat the register used for PIC addressing as read-only, rather than
16613 loading it in the prologue for each function. The runtime system is
16614 responsible for initializing this register with an appropriate value
16615 before execution begins.
16617 @item -mpic-register=@var{reg}
16618 @opindex mpic-register
16619 Specify the register to be used for PIC addressing.
16620 For standard PIC base case, the default is any suitable register
16621 determined by compiler. For single PIC base case, the default is
16622 @samp{R9} if target is EABI based or stack-checking is enabled,
16623 otherwise the default is @samp{R10}.
16625 @item -mpic-data-is-text-relative
16626 @opindex mpic-data-is-text-relative
16627 Assume that the displacement between the text and data segments is fixed
16628 at static link time. This permits using PC-relative addressing
16629 operations to access data known to be in the data segment. For
16630 non-VxWorks RTP targets, this option is enabled by default. When
16631 disabled on such targets, it will enable @option{-msingle-pic-base} by
16634 @item -mpoke-function-name
16635 @opindex mpoke-function-name
16636 Write the name of each function into the text section, directly
16637 preceding the function prologue. The generated code is similar to this:
16641 .ascii "arm_poke_function_name", 0
16644 .word 0xff000000 + (t1 - t0)
16645 arm_poke_function_name
16647 stmfd sp!, @{fp, ip, lr, pc@}
16651 When performing a stack backtrace, code can inspect the value of
16652 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
16653 location @code{pc - 12} and the top 8 bits are set, then we know that
16654 there is a function name embedded immediately preceding this location
16655 and has length @code{((pc[-3]) & 0xff000000)}.
16662 Select between generating code that executes in ARM and Thumb
16663 states. The default for most configurations is to generate code
16664 that executes in ARM state, but the default can be changed by
16665 configuring GCC with the @option{--with-mode=}@var{state}
16668 You can also override the ARM and Thumb mode for each function
16669 by using the @code{target("thumb")} and @code{target("arm")} function attributes
16670 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
16673 @opindex mflip-thumb
16674 Switch ARM/Thumb modes on alternating functions.
16675 This option is provided for regression testing of mixed Thumb/ARM code
16676 generation, and is not intended for ordinary use in compiling code.
16679 @opindex mtpcs-frame
16680 Generate a stack frame that is compliant with the Thumb Procedure Call
16681 Standard for all non-leaf functions. (A leaf function is one that does
16682 not call any other functions.) The default is @option{-mno-tpcs-frame}.
16684 @item -mtpcs-leaf-frame
16685 @opindex mtpcs-leaf-frame
16686 Generate a stack frame that is compliant with the Thumb Procedure Call
16687 Standard for all leaf functions. (A leaf function is one that does
16688 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
16690 @item -mcallee-super-interworking
16691 @opindex mcallee-super-interworking
16692 Gives all externally visible functions in the file being compiled an ARM
16693 instruction set header which switches to Thumb mode before executing the
16694 rest of the function. This allows these functions to be called from
16695 non-interworking code. This option is not valid in AAPCS configurations
16696 because interworking is enabled by default.
16698 @item -mcaller-super-interworking
16699 @opindex mcaller-super-interworking
16700 Allows calls via function pointers (including virtual functions) to
16701 execute correctly regardless of whether the target code has been
16702 compiled for interworking or not. There is a small overhead in the cost
16703 of executing a function pointer if this option is enabled. This option
16704 is not valid in AAPCS configurations because interworking is enabled
16707 @item -mtp=@var{name}
16709 Specify the access model for the thread local storage pointer. The valid
16710 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
16711 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
16712 (supported in the arm6k architecture), and @samp{auto}, which uses the
16713 best available method for the selected processor. The default setting is
16716 @item -mtls-dialect=@var{dialect}
16717 @opindex mtls-dialect
16718 Specify the dialect to use for accessing thread local storage. Two
16719 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
16720 @samp{gnu} dialect selects the original GNU scheme for supporting
16721 local and global dynamic TLS models. The @samp{gnu2} dialect
16722 selects the GNU descriptor scheme, which provides better performance
16723 for shared libraries. The GNU descriptor scheme is compatible with
16724 the original scheme, but does require new assembler, linker and
16725 library support. Initial and local exec TLS models are unaffected by
16726 this option and always use the original scheme.
16728 @item -mword-relocations
16729 @opindex mword-relocations
16730 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
16731 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
16732 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
16735 @item -mfix-cortex-m3-ldrd
16736 @opindex mfix-cortex-m3-ldrd
16737 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
16738 with overlapping destination and base registers are used. This option avoids
16739 generating these instructions. This option is enabled by default when
16740 @option{-mcpu=cortex-m3} is specified.
16742 @item -munaligned-access
16743 @itemx -mno-unaligned-access
16744 @opindex munaligned-access
16745 @opindex mno-unaligned-access
16746 Enables (or disables) reading and writing of 16- and 32- bit values
16747 from addresses that are not 16- or 32- bit aligned. By default
16748 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
16749 ARMv8-M Baseline architectures, and enabled for all other
16750 architectures. If unaligned access is not enabled then words in packed
16751 data structures are accessed a byte at a time.
16753 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
16754 generated object file to either true or false, depending upon the
16755 setting of this option. If unaligned access is enabled then the
16756 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
16759 @item -mneon-for-64bits
16760 @opindex mneon-for-64bits
16761 Enables using Neon to handle scalar 64-bits operations. This is
16762 disabled by default since the cost of moving data from core registers
16765 @item -mslow-flash-data
16766 @opindex mslow-flash-data
16767 Assume loading data from flash is slower than fetching instruction.
16768 Therefore literal load is minimized for better performance.
16769 This option is only supported when compiling for ARMv7 M-profile and
16772 @item -masm-syntax-unified
16773 @opindex masm-syntax-unified
16774 Assume inline assembler is using unified asm syntax. The default is
16775 currently off which implies divided syntax. This option has no impact
16776 on Thumb2. However, this may change in future releases of GCC.
16777 Divided syntax should be considered deprecated.
16779 @item -mrestrict-it
16780 @opindex mrestrict-it
16781 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
16782 IT blocks can only contain a single 16-bit instruction from a select
16783 set of instructions. This option is on by default for ARMv8-A Thumb mode.
16785 @item -mprint-tune-info
16786 @opindex mprint-tune-info
16787 Print CPU tuning information as comment in assembler file. This is
16788 an option used only for regression testing of the compiler and not
16789 intended for ordinary use in compiling code. This option is disabled
16792 @item -mverbose-cost-dump
16793 @opindex mverbose-cost-dump
16794 Enable verbose cost model dumping in the debug dump files. This option is
16795 provided for use in debugging the compiler.
16798 @opindex mpure-code
16799 Do not allow constant data to be placed in code sections.
16800 Additionally, when compiling for ELF object format give all text sections the
16801 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
16802 is only available when generating non-pic code for M-profile targets with the
16807 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
16808 Development Tools Engineering Specification", which can be found on
16809 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
16813 @subsection AVR Options
16814 @cindex AVR Options
16816 These options are defined for AVR implementations:
16819 @item -mmcu=@var{mcu}
16821 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
16823 The default for this option is@tie{}@samp{avr2}.
16825 GCC supports the following AVR devices and ISAs:
16827 @include avr-mmcu.texi
16832 Assume that all data in static storage can be accessed by LDS / STS
16833 instructions. This option has only an effect on reduced Tiny devices like
16834 ATtiny40. See also the @code{absdata}
16835 @ref{AVR Variable Attributes,variable attribute}.
16837 @item -maccumulate-args
16838 @opindex maccumulate-args
16839 Accumulate outgoing function arguments and acquire/release the needed
16840 stack space for outgoing function arguments once in function
16841 prologue/epilogue. Without this option, outgoing arguments are pushed
16842 before calling a function and popped afterwards.
16844 Popping the arguments after the function call can be expensive on
16845 AVR so that accumulating the stack space might lead to smaller
16846 executables because arguments need not be removed from the
16847 stack after such a function call.
16849 This option can lead to reduced code size for functions that perform
16850 several calls to functions that get their arguments on the stack like
16851 calls to printf-like functions.
16853 @item -mbranch-cost=@var{cost}
16854 @opindex mbranch-cost
16855 Set the branch costs for conditional branch instructions to
16856 @var{cost}. Reasonable values for @var{cost} are small, non-negative
16857 integers. The default branch cost is 0.
16859 @item -mcall-prologues
16860 @opindex mcall-prologues
16861 Functions prologues/epilogues are expanded as calls to appropriate
16862 subroutines. Code size is smaller.
16864 @item -mgas-isr-prologues
16865 @opindex mgas-isr-prologues
16866 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
16867 instruction supported by GNU Binutils.
16868 If this option is on, the feature can still be disabled for individual
16869 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
16870 function attribute. This feature is activated per default
16871 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
16872 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
16876 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
16877 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
16878 and @code{long long} is 4 bytes. Please note that this option does not
16879 conform to the C standards, but it results in smaller code
16882 @item -mmain-is-OS_task
16883 @opindex mmain-is-OS_task
16884 Do not save registers in @code{main}. The effect is the same like
16885 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
16886 to @code{main}. It is activated per default if optimization is on.
16888 @item -mn-flash=@var{num}
16890 Assume that the flash memory has a size of
16891 @var{num} times 64@tie{}KiB.
16893 @item -mno-interrupts
16894 @opindex mno-interrupts
16895 Generated code is not compatible with hardware interrupts.
16896 Code size is smaller.
16900 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
16901 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
16902 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
16903 the assembler's command line and the @option{--relax} option to the
16904 linker's command line.
16906 Jump relaxing is performed by the linker because jump offsets are not
16907 known before code is located. Therefore, the assembler code generated by the
16908 compiler is the same, but the instructions in the executable may
16909 differ from instructions in the assembler code.
16911 Relaxing must be turned on if linker stubs are needed, see the
16912 section on @code{EIND} and linker stubs below.
16916 Assume that the device supports the Read-Modify-Write
16917 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
16919 @item -mshort-calls
16920 @opindex mshort-calls
16922 Assume that @code{RJMP} and @code{RCALL} can target the whole
16925 This option is used internally for multilib selection. It is
16926 not an optimization option, and you don't need to set it by hand.
16930 Treat the stack pointer register as an 8-bit register,
16931 i.e.@: assume the high byte of the stack pointer is zero.
16932 In general, you don't need to set this option by hand.
16934 This option is used internally by the compiler to select and
16935 build multilibs for architectures @code{avr2} and @code{avr25}.
16936 These architectures mix devices with and without @code{SPH}.
16937 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
16938 the compiler driver adds or removes this option from the compiler
16939 proper's command line, because the compiler then knows if the device
16940 or architecture has an 8-bit stack pointer and thus no @code{SPH}
16945 Use address register @code{X} in a way proposed by the hardware. This means
16946 that @code{X} is only used in indirect, post-increment or
16947 pre-decrement addressing.
16949 Without this option, the @code{X} register may be used in the same way
16950 as @code{Y} or @code{Z} which then is emulated by additional
16952 For example, loading a value with @code{X+const} addressing with a
16953 small non-negative @code{const < 64} to a register @var{Rn} is
16957 adiw r26, const ; X += const
16958 ld @var{Rn}, X ; @var{Rn} = *X
16959 sbiw r26, const ; X -= const
16963 @opindex mtiny-stack
16964 Only change the lower 8@tie{}bits of the stack pointer.
16966 @item -mfract-convert-truncate
16967 @opindex mfract-convert-truncate
16968 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
16971 @opindex nodevicelib
16972 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
16974 @item -Waddr-space-convert
16975 @opindex Waddr-space-convert
16976 @opindex Wno-addr-space-convert
16977 Warn about conversions between address spaces in the case where the
16978 resulting address space is not contained in the incoming address space.
16980 @item -Wmisspelled-isr
16981 @opindex Wmisspelled-isr
16982 @opindex Wno-misspelled-isr
16983 Warn if the ISR is misspelled, i.e. without __vector prefix.
16984 Enabled by default.
16987 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
16988 @cindex @code{EIND}
16989 Pointers in the implementation are 16@tie{}bits wide.
16990 The address of a function or label is represented as word address so
16991 that indirect jumps and calls can target any code address in the
16992 range of 64@tie{}Ki words.
16994 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
16995 bytes of program memory space, there is a special function register called
16996 @code{EIND} that serves as most significant part of the target address
16997 when @code{EICALL} or @code{EIJMP} instructions are used.
16999 Indirect jumps and calls on these devices are handled as follows by
17000 the compiler and are subject to some limitations:
17005 The compiler never sets @code{EIND}.
17008 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
17009 instructions or might read @code{EIND} directly in order to emulate an
17010 indirect call/jump by means of a @code{RET} instruction.
17013 The compiler assumes that @code{EIND} never changes during the startup
17014 code or during the application. In particular, @code{EIND} is not
17015 saved/restored in function or interrupt service routine
17019 For indirect calls to functions and computed goto, the linker
17020 generates @emph{stubs}. Stubs are jump pads sometimes also called
17021 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
17022 The stub contains a direct jump to the desired address.
17025 Linker relaxation must be turned on so that the linker generates
17026 the stubs correctly in all situations. See the compiler option
17027 @option{-mrelax} and the linker option @option{--relax}.
17028 There are corner cases where the linker is supposed to generate stubs
17029 but aborts without relaxation and without a helpful error message.
17032 The default linker script is arranged for code with @code{EIND = 0}.
17033 If code is supposed to work for a setup with @code{EIND != 0}, a custom
17034 linker script has to be used in order to place the sections whose
17035 name start with @code{.trampolines} into the segment where @code{EIND}
17039 The startup code from libgcc never sets @code{EIND}.
17040 Notice that startup code is a blend of code from libgcc and AVR-LibC.
17041 For the impact of AVR-LibC on @code{EIND}, see the
17042 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
17045 It is legitimate for user-specific startup code to set up @code{EIND}
17046 early, for example by means of initialization code located in
17047 section @code{.init3}. Such code runs prior to general startup code
17048 that initializes RAM and calls constructors, but after the bit
17049 of startup code from AVR-LibC that sets @code{EIND} to the segment
17050 where the vector table is located.
17052 #include <avr/io.h>
17055 __attribute__((section(".init3"),naked,used,no_instrument_function))
17056 init3_set_eind (void)
17058 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
17059 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
17064 The @code{__trampolines_start} symbol is defined in the linker script.
17067 Stubs are generated automatically by the linker if
17068 the following two conditions are met:
17071 @item The address of a label is taken by means of the @code{gs} modifier
17072 (short for @emph{generate stubs}) like so:
17074 LDI r24, lo8(gs(@var{func}))
17075 LDI r25, hi8(gs(@var{func}))
17077 @item The final location of that label is in a code segment
17078 @emph{outside} the segment where the stubs are located.
17082 The compiler emits such @code{gs} modifiers for code labels in the
17083 following situations:
17085 @item Taking address of a function or code label.
17086 @item Computed goto.
17087 @item If prologue-save function is used, see @option{-mcall-prologues}
17088 command-line option.
17089 @item Switch/case dispatch tables. If you do not want such dispatch
17090 tables you can specify the @option{-fno-jump-tables} command-line option.
17091 @item C and C++ constructors/destructors called during startup/shutdown.
17092 @item If the tools hit a @code{gs()} modifier explained above.
17096 Jumping to non-symbolic addresses like so is @emph{not} supported:
17101 /* Call function at word address 0x2 */
17102 return ((int(*)(void)) 0x2)();
17106 Instead, a stub has to be set up, i.e.@: the function has to be called
17107 through a symbol (@code{func_4} in the example):
17112 extern int func_4 (void);
17114 /* Call function at byte address 0x4 */
17119 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
17120 Alternatively, @code{func_4} can be defined in the linker script.
17123 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
17124 @cindex @code{RAMPD}
17125 @cindex @code{RAMPX}
17126 @cindex @code{RAMPY}
17127 @cindex @code{RAMPZ}
17128 Some AVR devices support memories larger than the 64@tie{}KiB range
17129 that can be accessed with 16-bit pointers. To access memory locations
17130 outside this 64@tie{}KiB range, the content of a @code{RAMP}
17131 register is used as high part of the address:
17132 The @code{X}, @code{Y}, @code{Z} address register is concatenated
17133 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
17134 register, respectively, to get a wide address. Similarly,
17135 @code{RAMPD} is used together with direct addressing.
17139 The startup code initializes the @code{RAMP} special function
17140 registers with zero.
17143 If a @ref{AVR Named Address Spaces,named address space} other than
17144 generic or @code{__flash} is used, then @code{RAMPZ} is set
17145 as needed before the operation.
17148 If the device supports RAM larger than 64@tie{}KiB and the compiler
17149 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
17150 is reset to zero after the operation.
17153 If the device comes with a specific @code{RAMP} register, the ISR
17154 prologue/epilogue saves/restores that SFR and initializes it with
17155 zero in case the ISR code might (implicitly) use it.
17158 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
17159 If you use inline assembler to read from locations outside the
17160 16-bit address range and change one of the @code{RAMP} registers,
17161 you must reset it to zero after the access.
17165 @subsubsection AVR Built-in Macros
17167 GCC defines several built-in macros so that the user code can test
17168 for the presence or absence of features. Almost any of the following
17169 built-in macros are deduced from device capabilities and thus
17170 triggered by the @option{-mmcu=} command-line option.
17172 For even more AVR-specific built-in macros see
17173 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
17178 Build-in macro that resolves to a decimal number that identifies the
17179 architecture and depends on the @option{-mmcu=@var{mcu}} option.
17180 Possible values are:
17182 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
17183 @code{4}, @code{5}, @code{51}, @code{6}
17185 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
17186 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
17191 @code{102}, @code{103}, @code{104},
17192 @code{105}, @code{106}, @code{107}
17194 for @var{mcu}=@code{avrtiny},
17195 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
17196 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
17197 If @var{mcu} specifies a device, this built-in macro is set
17198 accordingly. For example, with @option{-mmcu=atmega8} the macro is
17199 defined to @code{4}.
17201 @item __AVR_@var{Device}__
17202 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
17203 the device's name. For example, @option{-mmcu=atmega8} defines the
17204 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
17205 @code{__AVR_ATtiny261A__}, etc.
17207 The built-in macros' names follow
17208 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
17209 the device name as from the AVR user manual. The difference between
17210 @var{Device} in the built-in macro and @var{device} in
17211 @option{-mmcu=@var{device}} is that the latter is always lowercase.
17213 If @var{device} is not a device but only a core architecture like
17214 @samp{avr51}, this macro is not defined.
17216 @item __AVR_DEVICE_NAME__
17217 Setting @option{-mmcu=@var{device}} defines this built-in macro to
17218 the device's name. For example, with @option{-mmcu=atmega8} the macro
17219 is defined to @code{atmega8}.
17221 If @var{device} is not a device but only a core architecture like
17222 @samp{avr51}, this macro is not defined.
17224 @item __AVR_XMEGA__
17225 The device / architecture belongs to the XMEGA family of devices.
17227 @item __AVR_HAVE_ELPM__
17228 The device has the @code{ELPM} instruction.
17230 @item __AVR_HAVE_ELPMX__
17231 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
17232 R@var{n},Z+} instructions.
17234 @item __AVR_HAVE_MOVW__
17235 The device has the @code{MOVW} instruction to perform 16-bit
17236 register-register moves.
17238 @item __AVR_HAVE_LPMX__
17239 The device has the @code{LPM R@var{n},Z} and
17240 @code{LPM R@var{n},Z+} instructions.
17242 @item __AVR_HAVE_MUL__
17243 The device has a hardware multiplier.
17245 @item __AVR_HAVE_JMP_CALL__
17246 The device has the @code{JMP} and @code{CALL} instructions.
17247 This is the case for devices with more than 8@tie{}KiB of program
17250 @item __AVR_HAVE_EIJMP_EICALL__
17251 @itemx __AVR_3_BYTE_PC__
17252 The device has the @code{EIJMP} and @code{EICALL} instructions.
17253 This is the case for devices with more than 128@tie{}KiB of program memory.
17254 This also means that the program counter
17255 (PC) is 3@tie{}bytes wide.
17257 @item __AVR_2_BYTE_PC__
17258 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
17259 with up to 128@tie{}KiB of program memory.
17261 @item __AVR_HAVE_8BIT_SP__
17262 @itemx __AVR_HAVE_16BIT_SP__
17263 The stack pointer (SP) register is treated as 8-bit respectively
17264 16-bit register by the compiler.
17265 The definition of these macros is affected by @option{-mtiny-stack}.
17267 @item __AVR_HAVE_SPH__
17269 The device has the SPH (high part of stack pointer) special function
17270 register or has an 8-bit stack pointer, respectively.
17271 The definition of these macros is affected by @option{-mmcu=} and
17272 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
17275 @item __AVR_HAVE_RAMPD__
17276 @itemx __AVR_HAVE_RAMPX__
17277 @itemx __AVR_HAVE_RAMPY__
17278 @itemx __AVR_HAVE_RAMPZ__
17279 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
17280 @code{RAMPZ} special function register, respectively.
17282 @item __NO_INTERRUPTS__
17283 This macro reflects the @option{-mno-interrupts} command-line option.
17285 @item __AVR_ERRATA_SKIP__
17286 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
17287 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
17288 instructions because of a hardware erratum. Skip instructions are
17289 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
17290 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
17293 @item __AVR_ISA_RMW__
17294 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
17296 @item __AVR_SFR_OFFSET__=@var{offset}
17297 Instructions that can address I/O special function registers directly
17298 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
17299 address as if addressed by an instruction to access RAM like @code{LD}
17300 or @code{STS}. This offset depends on the device architecture and has
17301 to be subtracted from the RAM address in order to get the
17302 respective I/O@tie{}address.
17304 @item __AVR_SHORT_CALLS__
17305 The @option{-mshort-calls} command line option is set.
17307 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
17308 Some devices support reading from flash memory by means of @code{LD*}
17309 instructions. The flash memory is seen in the data address space
17310 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
17311 is not defined, this feature is not available. If defined,
17312 the address space is linear and there is no need to put
17313 @code{.rodata} into RAM. This is handled by the default linker
17314 description file, and is currently available for
17315 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
17316 there is no need to use address spaces like @code{__flash} or
17317 features like attribute @code{progmem} and @code{pgm_read_*}.
17319 @item __WITH_AVRLIBC__
17320 The compiler is configured to be used together with AVR-Libc.
17321 See the @option{--with-avrlibc} configure option.
17325 @node Blackfin Options
17326 @subsection Blackfin Options
17327 @cindex Blackfin Options
17330 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
17332 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
17333 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
17334 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
17335 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
17336 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
17337 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
17338 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
17339 @samp{bf561}, @samp{bf592}.
17341 The optional @var{sirevision} specifies the silicon revision of the target
17342 Blackfin processor. Any workarounds available for the targeted silicon revision
17343 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
17344 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
17345 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
17346 hexadecimal digits representing the major and minor numbers in the silicon
17347 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
17348 is not defined. If @var{sirevision} is @samp{any}, the
17349 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
17350 If this optional @var{sirevision} is not used, GCC assumes the latest known
17351 silicon revision of the targeted Blackfin processor.
17353 GCC defines a preprocessor macro for the specified @var{cpu}.
17354 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
17355 provided by libgloss to be linked in if @option{-msim} is not given.
17357 Without this option, @samp{bf532} is used as the processor by default.
17359 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
17360 only the preprocessor macro is defined.
17364 Specifies that the program will be run on the simulator. This causes
17365 the simulator BSP provided by libgloss to be linked in. This option
17366 has effect only for @samp{bfin-elf} toolchain.
17367 Certain other options, such as @option{-mid-shared-library} and
17368 @option{-mfdpic}, imply @option{-msim}.
17370 @item -momit-leaf-frame-pointer
17371 @opindex momit-leaf-frame-pointer
17372 Don't keep the frame pointer in a register for leaf functions. This
17373 avoids the instructions to save, set up and restore frame pointers and
17374 makes an extra register available in leaf functions.
17376 @item -mspecld-anomaly
17377 @opindex mspecld-anomaly
17378 When enabled, the compiler ensures that the generated code does not
17379 contain speculative loads after jump instructions. If this option is used,
17380 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
17382 @item -mno-specld-anomaly
17383 @opindex mno-specld-anomaly
17384 Don't generate extra code to prevent speculative loads from occurring.
17386 @item -mcsync-anomaly
17387 @opindex mcsync-anomaly
17388 When enabled, the compiler ensures that the generated code does not
17389 contain CSYNC or SSYNC instructions too soon after conditional branches.
17390 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
17392 @item -mno-csync-anomaly
17393 @opindex mno-csync-anomaly
17394 Don't generate extra code to prevent CSYNC or SSYNC instructions from
17395 occurring too soon after a conditional branch.
17399 When enabled, the compiler is free to take advantage of the knowledge that
17400 the entire program fits into the low 64k of memory.
17403 @opindex mno-low-64k
17404 Assume that the program is arbitrarily large. This is the default.
17406 @item -mstack-check-l1
17407 @opindex mstack-check-l1
17408 Do stack checking using information placed into L1 scratchpad memory by the
17411 @item -mid-shared-library
17412 @opindex mid-shared-library
17413 Generate code that supports shared libraries via the library ID method.
17414 This allows for execute in place and shared libraries in an environment
17415 without virtual memory management. This option implies @option{-fPIC}.
17416 With a @samp{bfin-elf} target, this option implies @option{-msim}.
17418 @item -mno-id-shared-library
17419 @opindex mno-id-shared-library
17420 Generate code that doesn't assume ID-based shared libraries are being used.
17421 This is the default.
17423 @item -mleaf-id-shared-library
17424 @opindex mleaf-id-shared-library
17425 Generate code that supports shared libraries via the library ID method,
17426 but assumes that this library or executable won't link against any other
17427 ID shared libraries. That allows the compiler to use faster code for jumps
17430 @item -mno-leaf-id-shared-library
17431 @opindex mno-leaf-id-shared-library
17432 Do not assume that the code being compiled won't link against any ID shared
17433 libraries. Slower code is generated for jump and call insns.
17435 @item -mshared-library-id=n
17436 @opindex mshared-library-id
17437 Specifies the identification number of the ID-based shared library being
17438 compiled. Specifying a value of 0 generates more compact code; specifying
17439 other values forces the allocation of that number to the current
17440 library but is no more space- or time-efficient than omitting this option.
17444 Generate code that allows the data segment to be located in a different
17445 area of memory from the text segment. This allows for execute in place in
17446 an environment without virtual memory management by eliminating relocations
17447 against the text section.
17449 @item -mno-sep-data
17450 @opindex mno-sep-data
17451 Generate code that assumes that the data segment follows the text segment.
17452 This is the default.
17455 @itemx -mno-long-calls
17456 @opindex mlong-calls
17457 @opindex mno-long-calls
17458 Tells the compiler to perform function calls by first loading the
17459 address of the function into a register and then performing a subroutine
17460 call on this register. This switch is needed if the target function
17461 lies outside of the 24-bit addressing range of the offset-based
17462 version of subroutine call instruction.
17464 This feature is not enabled by default. Specifying
17465 @option{-mno-long-calls} restores the default behavior. Note these
17466 switches have no effect on how the compiler generates code to handle
17467 function calls via function pointers.
17471 Link with the fast floating-point library. This library relaxes some of
17472 the IEEE floating-point standard's rules for checking inputs against
17473 Not-a-Number (NAN), in the interest of performance.
17476 @opindex minline-plt
17477 Enable inlining of PLT entries in function calls to functions that are
17478 not known to bind locally. It has no effect without @option{-mfdpic}.
17481 @opindex mmulticore
17482 Build a standalone application for multicore Blackfin processors.
17483 This option causes proper start files and link scripts supporting
17484 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
17485 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
17487 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
17488 selects the one-application-per-core programming model. Without
17489 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
17490 programming model is used. In this model, the main function of Core B
17491 should be named as @code{coreb_main}.
17493 If this option is not used, the single-core application programming
17498 Build a standalone application for Core A of BF561 when using
17499 the one-application-per-core programming model. Proper start files
17500 and link scripts are used to support Core A, and the macro
17501 @code{__BFIN_COREA} is defined.
17502 This option can only be used in conjunction with @option{-mmulticore}.
17506 Build a standalone application for Core B of BF561 when using
17507 the one-application-per-core programming model. Proper start files
17508 and link scripts are used to support Core B, and the macro
17509 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
17510 should be used instead of @code{main}.
17511 This option can only be used in conjunction with @option{-mmulticore}.
17515 Build a standalone application for SDRAM. Proper start files and
17516 link scripts are used to put the application into SDRAM, and the macro
17517 @code{__BFIN_SDRAM} is defined.
17518 The loader should initialize SDRAM before loading the application.
17522 Assume that ICPLBs are enabled at run time. This has an effect on certain
17523 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
17524 are enabled; for standalone applications the default is off.
17528 @subsection C6X Options
17529 @cindex C6X Options
17532 @item -march=@var{name}
17534 This specifies the name of the target architecture. GCC uses this
17535 name to determine what kind of instructions it can emit when generating
17536 assembly code. Permissible names are: @samp{c62x},
17537 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
17540 @opindex mbig-endian
17541 Generate code for a big-endian target.
17543 @item -mlittle-endian
17544 @opindex mlittle-endian
17545 Generate code for a little-endian target. This is the default.
17549 Choose startup files and linker script suitable for the simulator.
17551 @item -msdata=default
17552 @opindex msdata=default
17553 Put small global and static data in the @code{.neardata} section,
17554 which is pointed to by register @code{B14}. Put small uninitialized
17555 global and static data in the @code{.bss} section, which is adjacent
17556 to the @code{.neardata} section. Put small read-only data into the
17557 @code{.rodata} section. The corresponding sections used for large
17558 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
17561 @opindex msdata=all
17562 Put all data, not just small objects, into the sections reserved for
17563 small data, and use addressing relative to the @code{B14} register to
17567 @opindex msdata=none
17568 Make no use of the sections reserved for small data, and use absolute
17569 addresses to access all data. Put all initialized global and static
17570 data in the @code{.fardata} section, and all uninitialized data in the
17571 @code{.far} section. Put all constant data into the @code{.const}
17576 @subsection CRIS Options
17577 @cindex CRIS Options
17579 These options are defined specifically for the CRIS ports.
17582 @item -march=@var{architecture-type}
17583 @itemx -mcpu=@var{architecture-type}
17586 Generate code for the specified architecture. The choices for
17587 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
17588 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
17589 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
17592 @item -mtune=@var{architecture-type}
17594 Tune to @var{architecture-type} everything applicable about the generated
17595 code, except for the ABI and the set of available instructions. The
17596 choices for @var{architecture-type} are the same as for
17597 @option{-march=@var{architecture-type}}.
17599 @item -mmax-stack-frame=@var{n}
17600 @opindex mmax-stack-frame
17601 Warn when the stack frame of a function exceeds @var{n} bytes.
17607 The options @option{-metrax4} and @option{-metrax100} are synonyms for
17608 @option{-march=v3} and @option{-march=v8} respectively.
17610 @item -mmul-bug-workaround
17611 @itemx -mno-mul-bug-workaround
17612 @opindex mmul-bug-workaround
17613 @opindex mno-mul-bug-workaround
17614 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
17615 models where it applies. This option is active by default.
17619 Enable CRIS-specific verbose debug-related information in the assembly
17620 code. This option also has the effect of turning off the @samp{#NO_APP}
17621 formatted-code indicator to the assembler at the beginning of the
17626 Do not use condition-code results from previous instruction; always emit
17627 compare and test instructions before use of condition codes.
17629 @item -mno-side-effects
17630 @opindex mno-side-effects
17631 Do not emit instructions with side effects in addressing modes other than
17634 @item -mstack-align
17635 @itemx -mno-stack-align
17636 @itemx -mdata-align
17637 @itemx -mno-data-align
17638 @itemx -mconst-align
17639 @itemx -mno-const-align
17640 @opindex mstack-align
17641 @opindex mno-stack-align
17642 @opindex mdata-align
17643 @opindex mno-data-align
17644 @opindex mconst-align
17645 @opindex mno-const-align
17646 These options (@samp{no-} options) arrange (eliminate arrangements) for the
17647 stack frame, individual data and constants to be aligned for the maximum
17648 single data access size for the chosen CPU model. The default is to
17649 arrange for 32-bit alignment. ABI details such as structure layout are
17650 not affected by these options.
17658 Similar to the stack- data- and const-align options above, these options
17659 arrange for stack frame, writable data and constants to all be 32-bit,
17660 16-bit or 8-bit aligned. The default is 32-bit alignment.
17662 @item -mno-prologue-epilogue
17663 @itemx -mprologue-epilogue
17664 @opindex mno-prologue-epilogue
17665 @opindex mprologue-epilogue
17666 With @option{-mno-prologue-epilogue}, the normal function prologue and
17667 epilogue which set up the stack frame are omitted and no return
17668 instructions or return sequences are generated in the code. Use this
17669 option only together with visual inspection of the compiled code: no
17670 warnings or errors are generated when call-saved registers must be saved,
17671 or storage for local variables needs to be allocated.
17675 @opindex mno-gotplt
17677 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
17678 instruction sequences that load addresses for functions from the PLT part
17679 of the GOT rather than (traditional on other architectures) calls to the
17680 PLT@. The default is @option{-mgotplt}.
17684 Legacy no-op option only recognized with the cris-axis-elf and
17685 cris-axis-linux-gnu targets.
17689 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
17693 This option, recognized for the cris-axis-elf, arranges
17694 to link with input-output functions from a simulator library. Code,
17695 initialized data and zero-initialized data are allocated consecutively.
17699 Like @option{-sim}, but pass linker options to locate initialized data at
17700 0x40000000 and zero-initialized data at 0x80000000.
17704 @subsection CR16 Options
17705 @cindex CR16 Options
17707 These options are defined specifically for the CR16 ports.
17713 Enable the use of multiply-accumulate instructions. Disabled by default.
17717 @opindex mcr16cplus
17719 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
17724 Links the library libsim.a which is in compatible with simulator. Applicable
17725 to ELF compiler only.
17729 Choose integer type as 32-bit wide.
17733 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
17735 @item -mdata-model=@var{model}
17736 @opindex mdata-model
17737 Choose a data model. The choices for @var{model} are @samp{near},
17738 @samp{far} or @samp{medium}. @samp{medium} is default.
17739 However, @samp{far} is not valid with @option{-mcr16c}, as the
17740 CR16C architecture does not support the far data model.
17743 @node Darwin Options
17744 @subsection Darwin Options
17745 @cindex Darwin options
17747 These options are defined for all architectures running the Darwin operating
17750 FSF GCC on Darwin does not create ``fat'' object files; it creates
17751 an object file for the single architecture that GCC was built to
17752 target. Apple's GCC on Darwin does create ``fat'' files if multiple
17753 @option{-arch} options are used; it does so by running the compiler or
17754 linker multiple times and joining the results together with
17757 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
17758 @samp{i686}) is determined by the flags that specify the ISA
17759 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
17760 @option{-force_cpusubtype_ALL} option can be used to override this.
17762 The Darwin tools vary in their behavior when presented with an ISA
17763 mismatch. The assembler, @file{as}, only permits instructions to
17764 be used that are valid for the subtype of the file it is generating,
17765 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
17766 The linker for shared libraries, @file{/usr/bin/libtool}, fails
17767 and prints an error if asked to create a shared library with a less
17768 restrictive subtype than its input files (for instance, trying to put
17769 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
17770 for executables, @command{ld}, quietly gives the executable the most
17771 restrictive subtype of any of its input files.
17776 Add the framework directory @var{dir} to the head of the list of
17777 directories to be searched for header files. These directories are
17778 interleaved with those specified by @option{-I} options and are
17779 scanned in a left-to-right order.
17781 A framework directory is a directory with frameworks in it. A
17782 framework is a directory with a @file{Headers} and/or
17783 @file{PrivateHeaders} directory contained directly in it that ends
17784 in @file{.framework}. The name of a framework is the name of this
17785 directory excluding the @file{.framework}. Headers associated with
17786 the framework are found in one of those two directories, with
17787 @file{Headers} being searched first. A subframework is a framework
17788 directory that is in a framework's @file{Frameworks} directory.
17789 Includes of subframework headers can only appear in a header of a
17790 framework that contains the subframework, or in a sibling subframework
17791 header. Two subframeworks are siblings if they occur in the same
17792 framework. A subframework should not have the same name as a
17793 framework; a warning is issued if this is violated. Currently a
17794 subframework cannot have subframeworks; in the future, the mechanism
17795 may be extended to support this. The standard frameworks can be found
17796 in @file{/System/Library/Frameworks} and
17797 @file{/Library/Frameworks}. An example include looks like
17798 @code{#include <Framework/header.h>}, where @file{Framework} denotes
17799 the name of the framework and @file{header.h} is found in the
17800 @file{PrivateHeaders} or @file{Headers} directory.
17802 @item -iframework@var{dir}
17803 @opindex iframework
17804 Like @option{-F} except the directory is a treated as a system
17805 directory. The main difference between this @option{-iframework} and
17806 @option{-F} is that with @option{-iframework} the compiler does not
17807 warn about constructs contained within header files found via
17808 @var{dir}. This option is valid only for the C family of languages.
17812 Emit debugging information for symbols that are used. For stabs
17813 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
17814 This is by default ON@.
17818 Emit debugging information for all symbols and types.
17820 @item -mmacosx-version-min=@var{version}
17821 The earliest version of MacOS X that this executable will run on
17822 is @var{version}. Typical values of @var{version} include @code{10.1},
17823 @code{10.2}, and @code{10.3.9}.
17825 If the compiler was built to use the system's headers by default,
17826 then the default for this option is the system version on which the
17827 compiler is running, otherwise the default is to make choices that
17828 are compatible with as many systems and code bases as possible.
17832 Enable kernel development mode. The @option{-mkernel} option sets
17833 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
17834 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
17835 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
17836 applicable. This mode also sets @option{-mno-altivec},
17837 @option{-msoft-float}, @option{-fno-builtin} and
17838 @option{-mlong-branch} for PowerPC targets.
17840 @item -mone-byte-bool
17841 @opindex mone-byte-bool
17842 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
17843 By default @code{sizeof(bool)} is @code{4} when compiling for
17844 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
17845 option has no effect on x86.
17847 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
17848 to generate code that is not binary compatible with code generated
17849 without that switch. Using this switch may require recompiling all
17850 other modules in a program, including system libraries. Use this
17851 switch to conform to a non-default data model.
17853 @item -mfix-and-continue
17854 @itemx -ffix-and-continue
17855 @itemx -findirect-data
17856 @opindex mfix-and-continue
17857 @opindex ffix-and-continue
17858 @opindex findirect-data
17859 Generate code suitable for fast turnaround development, such as to
17860 allow GDB to dynamically load @file{.o} files into already-running
17861 programs. @option{-findirect-data} and @option{-ffix-and-continue}
17862 are provided for backwards compatibility.
17866 Loads all members of static archive libraries.
17867 See man ld(1) for more information.
17869 @item -arch_errors_fatal
17870 @opindex arch_errors_fatal
17871 Cause the errors having to do with files that have the wrong architecture
17874 @item -bind_at_load
17875 @opindex bind_at_load
17876 Causes the output file to be marked such that the dynamic linker will
17877 bind all undefined references when the file is loaded or launched.
17881 Produce a Mach-o bundle format file.
17882 See man ld(1) for more information.
17884 @item -bundle_loader @var{executable}
17885 @opindex bundle_loader
17886 This option specifies the @var{executable} that will load the build
17887 output file being linked. See man ld(1) for more information.
17890 @opindex dynamiclib
17891 When passed this option, GCC produces a dynamic library instead of
17892 an executable when linking, using the Darwin @file{libtool} command.
17894 @item -force_cpusubtype_ALL
17895 @opindex force_cpusubtype_ALL
17896 This causes GCC's output file to have the @samp{ALL} subtype, instead of
17897 one controlled by the @option{-mcpu} or @option{-march} option.
17899 @item -allowable_client @var{client_name}
17900 @itemx -client_name
17901 @itemx -compatibility_version
17902 @itemx -current_version
17904 @itemx -dependency-file
17906 @itemx -dylinker_install_name
17908 @itemx -exported_symbols_list
17911 @itemx -flat_namespace
17912 @itemx -force_flat_namespace
17913 @itemx -headerpad_max_install_names
17916 @itemx -install_name
17917 @itemx -keep_private_externs
17918 @itemx -multi_module
17919 @itemx -multiply_defined
17920 @itemx -multiply_defined_unused
17923 @itemx -no_dead_strip_inits_and_terms
17924 @itemx -nofixprebinding
17925 @itemx -nomultidefs
17927 @itemx -noseglinkedit
17928 @itemx -pagezero_size
17930 @itemx -prebind_all_twolevel_modules
17931 @itemx -private_bundle
17933 @itemx -read_only_relocs
17935 @itemx -sectobjectsymbols
17939 @itemx -sectobjectsymbols
17942 @itemx -segs_read_only_addr
17944 @itemx -segs_read_write_addr
17945 @itemx -seg_addr_table
17946 @itemx -seg_addr_table_filename
17947 @itemx -seglinkedit
17949 @itemx -segs_read_only_addr
17950 @itemx -segs_read_write_addr
17951 @itemx -single_module
17953 @itemx -sub_library
17955 @itemx -sub_umbrella
17956 @itemx -twolevel_namespace
17959 @itemx -unexported_symbols_list
17960 @itemx -weak_reference_mismatches
17961 @itemx -whatsloaded
17962 @opindex allowable_client
17963 @opindex client_name
17964 @opindex compatibility_version
17965 @opindex current_version
17966 @opindex dead_strip
17967 @opindex dependency-file
17968 @opindex dylib_file
17969 @opindex dylinker_install_name
17971 @opindex exported_symbols_list
17973 @opindex flat_namespace
17974 @opindex force_flat_namespace
17975 @opindex headerpad_max_install_names
17976 @opindex image_base
17978 @opindex install_name
17979 @opindex keep_private_externs
17980 @opindex multi_module
17981 @opindex multiply_defined
17982 @opindex multiply_defined_unused
17983 @opindex noall_load
17984 @opindex no_dead_strip_inits_and_terms
17985 @opindex nofixprebinding
17986 @opindex nomultidefs
17988 @opindex noseglinkedit
17989 @opindex pagezero_size
17991 @opindex prebind_all_twolevel_modules
17992 @opindex private_bundle
17993 @opindex read_only_relocs
17995 @opindex sectobjectsymbols
17998 @opindex sectcreate
17999 @opindex sectobjectsymbols
18002 @opindex segs_read_only_addr
18003 @opindex segs_read_write_addr
18004 @opindex seg_addr_table
18005 @opindex seg_addr_table_filename
18006 @opindex seglinkedit
18008 @opindex segs_read_only_addr
18009 @opindex segs_read_write_addr
18010 @opindex single_module
18012 @opindex sub_library
18013 @opindex sub_umbrella
18014 @opindex twolevel_namespace
18017 @opindex unexported_symbols_list
18018 @opindex weak_reference_mismatches
18019 @opindex whatsloaded
18020 These options are passed to the Darwin linker. The Darwin linker man page
18021 describes them in detail.
18024 @node DEC Alpha Options
18025 @subsection DEC Alpha Options
18027 These @samp{-m} options are defined for the DEC Alpha implementations:
18030 @item -mno-soft-float
18031 @itemx -msoft-float
18032 @opindex mno-soft-float
18033 @opindex msoft-float
18034 Use (do not use) the hardware floating-point instructions for
18035 floating-point operations. When @option{-msoft-float} is specified,
18036 functions in @file{libgcc.a} are used to perform floating-point
18037 operations. Unless they are replaced by routines that emulate the
18038 floating-point operations, or compiled in such a way as to call such
18039 emulations routines, these routines issue floating-point
18040 operations. If you are compiling for an Alpha without floating-point
18041 operations, you must ensure that the library is built so as not to call
18044 Note that Alpha implementations without floating-point operations are
18045 required to have floating-point registers.
18048 @itemx -mno-fp-regs
18050 @opindex mno-fp-regs
18051 Generate code that uses (does not use) the floating-point register set.
18052 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
18053 register set is not used, floating-point operands are passed in integer
18054 registers as if they were integers and floating-point results are passed
18055 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
18056 so any function with a floating-point argument or return value called by code
18057 compiled with @option{-mno-fp-regs} must also be compiled with that
18060 A typical use of this option is building a kernel that does not use,
18061 and hence need not save and restore, any floating-point registers.
18065 The Alpha architecture implements floating-point hardware optimized for
18066 maximum performance. It is mostly compliant with the IEEE floating-point
18067 standard. However, for full compliance, software assistance is
18068 required. This option generates code fully IEEE-compliant code
18069 @emph{except} that the @var{inexact-flag} is not maintained (see below).
18070 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
18071 defined during compilation. The resulting code is less efficient but is
18072 able to correctly support denormalized numbers and exceptional IEEE
18073 values such as not-a-number and plus/minus infinity. Other Alpha
18074 compilers call this option @option{-ieee_with_no_inexact}.
18076 @item -mieee-with-inexact
18077 @opindex mieee-with-inexact
18078 This is like @option{-mieee} except the generated code also maintains
18079 the IEEE @var{inexact-flag}. Turning on this option causes the
18080 generated code to implement fully-compliant IEEE math. In addition to
18081 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
18082 macro. On some Alpha implementations the resulting code may execute
18083 significantly slower than the code generated by default. Since there is
18084 very little code that depends on the @var{inexact-flag}, you should
18085 normally not specify this option. Other Alpha compilers call this
18086 option @option{-ieee_with_inexact}.
18088 @item -mfp-trap-mode=@var{trap-mode}
18089 @opindex mfp-trap-mode
18090 This option controls what floating-point related traps are enabled.
18091 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
18092 The trap mode can be set to one of four values:
18096 This is the default (normal) setting. The only traps that are enabled
18097 are the ones that cannot be disabled in software (e.g., division by zero
18101 In addition to the traps enabled by @samp{n}, underflow traps are enabled
18105 Like @samp{u}, but the instructions are marked to be safe for software
18106 completion (see Alpha architecture manual for details).
18109 Like @samp{su}, but inexact traps are enabled as well.
18112 @item -mfp-rounding-mode=@var{rounding-mode}
18113 @opindex mfp-rounding-mode
18114 Selects the IEEE rounding mode. Other Alpha compilers call this option
18115 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
18120 Normal IEEE rounding mode. Floating-point numbers are rounded towards
18121 the nearest machine number or towards the even machine number in case
18125 Round towards minus infinity.
18128 Chopped rounding mode. Floating-point numbers are rounded towards zero.
18131 Dynamic rounding mode. A field in the floating-point control register
18132 (@var{fpcr}, see Alpha architecture reference manual) controls the
18133 rounding mode in effect. The C library initializes this register for
18134 rounding towards plus infinity. Thus, unless your program modifies the
18135 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
18138 @item -mtrap-precision=@var{trap-precision}
18139 @opindex mtrap-precision
18140 In the Alpha architecture, floating-point traps are imprecise. This
18141 means without software assistance it is impossible to recover from a
18142 floating trap and program execution normally needs to be terminated.
18143 GCC can generate code that can assist operating system trap handlers
18144 in determining the exact location that caused a floating-point trap.
18145 Depending on the requirements of an application, different levels of
18146 precisions can be selected:
18150 Program precision. This option is the default and means a trap handler
18151 can only identify which program caused a floating-point exception.
18154 Function precision. The trap handler can determine the function that
18155 caused a floating-point exception.
18158 Instruction precision. The trap handler can determine the exact
18159 instruction that caused a floating-point exception.
18162 Other Alpha compilers provide the equivalent options called
18163 @option{-scope_safe} and @option{-resumption_safe}.
18165 @item -mieee-conformant
18166 @opindex mieee-conformant
18167 This option marks the generated code as IEEE conformant. You must not
18168 use this option unless you also specify @option{-mtrap-precision=i} and either
18169 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
18170 is to emit the line @samp{.eflag 48} in the function prologue of the
18171 generated assembly file.
18173 @item -mbuild-constants
18174 @opindex mbuild-constants
18175 Normally GCC examines a 32- or 64-bit integer constant to
18176 see if it can construct it from smaller constants in two or three
18177 instructions. If it cannot, it outputs the constant as a literal and
18178 generates code to load it from the data segment at run time.
18180 Use this option to require GCC to construct @emph{all} integer constants
18181 using code, even if it takes more instructions (the maximum is six).
18183 You typically use this option to build a shared library dynamic
18184 loader. Itself a shared library, it must relocate itself in memory
18185 before it can find the variables and constants in its own data segment.
18203 Indicate whether GCC should generate code to use the optional BWX,
18204 CIX, FIX and MAX instruction sets. The default is to use the instruction
18205 sets supported by the CPU type specified via @option{-mcpu=} option or that
18206 of the CPU on which GCC was built if none is specified.
18209 @itemx -mfloat-ieee
18210 @opindex mfloat-vax
18211 @opindex mfloat-ieee
18212 Generate code that uses (does not use) VAX F and G floating-point
18213 arithmetic instead of IEEE single and double precision.
18215 @item -mexplicit-relocs
18216 @itemx -mno-explicit-relocs
18217 @opindex mexplicit-relocs
18218 @opindex mno-explicit-relocs
18219 Older Alpha assemblers provided no way to generate symbol relocations
18220 except via assembler macros. Use of these macros does not allow
18221 optimal instruction scheduling. GNU binutils as of version 2.12
18222 supports a new syntax that allows the compiler to explicitly mark
18223 which relocations should apply to which instructions. This option
18224 is mostly useful for debugging, as GCC detects the capabilities of
18225 the assembler when it is built and sets the default accordingly.
18228 @itemx -mlarge-data
18229 @opindex msmall-data
18230 @opindex mlarge-data
18231 When @option{-mexplicit-relocs} is in effect, static data is
18232 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
18233 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
18234 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
18235 16-bit relocations off of the @code{$gp} register. This limits the
18236 size of the small data area to 64KB, but allows the variables to be
18237 directly accessed via a single instruction.
18239 The default is @option{-mlarge-data}. With this option the data area
18240 is limited to just below 2GB@. Programs that require more than 2GB of
18241 data must use @code{malloc} or @code{mmap} to allocate the data in the
18242 heap instead of in the program's data segment.
18244 When generating code for shared libraries, @option{-fpic} implies
18245 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
18248 @itemx -mlarge-text
18249 @opindex msmall-text
18250 @opindex mlarge-text
18251 When @option{-msmall-text} is used, the compiler assumes that the
18252 code of the entire program (or shared library) fits in 4MB, and is
18253 thus reachable with a branch instruction. When @option{-msmall-data}
18254 is used, the compiler can assume that all local symbols share the
18255 same @code{$gp} value, and thus reduce the number of instructions
18256 required for a function call from 4 to 1.
18258 The default is @option{-mlarge-text}.
18260 @item -mcpu=@var{cpu_type}
18262 Set the instruction set and instruction scheduling parameters for
18263 machine type @var{cpu_type}. You can specify either the @samp{EV}
18264 style name or the corresponding chip number. GCC supports scheduling
18265 parameters for the EV4, EV5 and EV6 family of processors and
18266 chooses the default values for the instruction set from the processor
18267 you specify. If you do not specify a processor type, GCC defaults
18268 to the processor on which the compiler was built.
18270 Supported values for @var{cpu_type} are
18276 Schedules as an EV4 and has no instruction set extensions.
18280 Schedules as an EV5 and has no instruction set extensions.
18284 Schedules as an EV5 and supports the BWX extension.
18289 Schedules as an EV5 and supports the BWX and MAX extensions.
18293 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
18297 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
18300 Native toolchains also support the value @samp{native},
18301 which selects the best architecture option for the host processor.
18302 @option{-mcpu=native} has no effect if GCC does not recognize
18305 @item -mtune=@var{cpu_type}
18307 Set only the instruction scheduling parameters for machine type
18308 @var{cpu_type}. The instruction set is not changed.
18310 Native toolchains also support the value @samp{native},
18311 which selects the best architecture option for the host processor.
18312 @option{-mtune=native} has no effect if GCC does not recognize
18315 @item -mmemory-latency=@var{time}
18316 @opindex mmemory-latency
18317 Sets the latency the scheduler should assume for typical memory
18318 references as seen by the application. This number is highly
18319 dependent on the memory access patterns used by the application
18320 and the size of the external cache on the machine.
18322 Valid options for @var{time} are
18326 A decimal number representing clock cycles.
18332 The compiler contains estimates of the number of clock cycles for
18333 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
18334 (also called Dcache, Scache, and Bcache), as well as to main memory.
18335 Note that L3 is only valid for EV5.
18341 @subsection FR30 Options
18342 @cindex FR30 Options
18344 These options are defined specifically for the FR30 port.
18348 @item -msmall-model
18349 @opindex msmall-model
18350 Use the small address space model. This can produce smaller code, but
18351 it does assume that all symbolic values and addresses fit into a
18356 Assume that runtime support has been provided and so there is no need
18357 to include the simulator library (@file{libsim.a}) on the linker
18363 @subsection FT32 Options
18364 @cindex FT32 Options
18366 These options are defined specifically for the FT32 port.
18372 Specifies that the program will be run on the simulator. This causes
18373 an alternate runtime startup and library to be linked.
18374 You must not use this option when generating programs that will run on
18375 real hardware; you must provide your own runtime library for whatever
18376 I/O functions are needed.
18380 Enable Local Register Allocation. This is still experimental for FT32,
18381 so by default the compiler uses standard reload.
18385 Do not use div and mod instructions.
18389 Enable use of the extended instructions of the FT32B processor.
18393 Compress all code using the Ft32B code compression scheme.
18397 Do not generate code that reads program memory.
18402 @subsection FRV Options
18403 @cindex FRV Options
18409 Only use the first 32 general-purpose registers.
18414 Use all 64 general-purpose registers.
18419 Use only the first 32 floating-point registers.
18424 Use all 64 floating-point registers.
18427 @opindex mhard-float
18429 Use hardware instructions for floating-point operations.
18432 @opindex msoft-float
18434 Use library routines for floating-point operations.
18439 Dynamically allocate condition code registers.
18444 Do not try to dynamically allocate condition code registers, only
18445 use @code{icc0} and @code{fcc0}.
18450 Change ABI to use double word insns.
18455 Do not use double word instructions.
18460 Use floating-point double instructions.
18463 @opindex mno-double
18465 Do not use floating-point double instructions.
18470 Use media instructions.
18475 Do not use media instructions.
18480 Use multiply and add/subtract instructions.
18483 @opindex mno-muladd
18485 Do not use multiply and add/subtract instructions.
18490 Select the FDPIC ABI, which uses function descriptors to represent
18491 pointers to functions. Without any PIC/PIE-related options, it
18492 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
18493 assumes GOT entries and small data are within a 12-bit range from the
18494 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
18495 are computed with 32 bits.
18496 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18499 @opindex minline-plt
18501 Enable inlining of PLT entries in function calls to functions that are
18502 not known to bind locally. It has no effect without @option{-mfdpic}.
18503 It's enabled by default if optimizing for speed and compiling for
18504 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
18505 optimization option such as @option{-O3} or above is present in the
18511 Assume a large TLS segment when generating thread-local code.
18516 Do not assume a large TLS segment when generating thread-local code.
18521 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
18522 that is known to be in read-only sections. It's enabled by default,
18523 except for @option{-fpic} or @option{-fpie}: even though it may help
18524 make the global offset table smaller, it trades 1 instruction for 4.
18525 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
18526 one of which may be shared by multiple symbols, and it avoids the need
18527 for a GOT entry for the referenced symbol, so it's more likely to be a
18528 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
18530 @item -multilib-library-pic
18531 @opindex multilib-library-pic
18533 Link with the (library, not FD) pic libraries. It's implied by
18534 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
18535 @option{-fpic} without @option{-mfdpic}. You should never have to use
18539 @opindex mlinked-fp
18541 Follow the EABI requirement of always creating a frame pointer whenever
18542 a stack frame is allocated. This option is enabled by default and can
18543 be disabled with @option{-mno-linked-fp}.
18546 @opindex mlong-calls
18548 Use indirect addressing to call functions outside the current
18549 compilation unit. This allows the functions to be placed anywhere
18550 within the 32-bit address space.
18552 @item -malign-labels
18553 @opindex malign-labels
18555 Try to align labels to an 8-byte boundary by inserting NOPs into the
18556 previous packet. This option only has an effect when VLIW packing
18557 is enabled. It doesn't create new packets; it merely adds NOPs to
18560 @item -mlibrary-pic
18561 @opindex mlibrary-pic
18563 Generate position-independent EABI code.
18568 Use only the first four media accumulator registers.
18573 Use all eight media accumulator registers.
18578 Pack VLIW instructions.
18583 Do not pack VLIW instructions.
18586 @opindex mno-eflags
18588 Do not mark ABI switches in e_flags.
18591 @opindex mcond-move
18593 Enable the use of conditional-move instructions (default).
18595 This switch is mainly for debugging the compiler and will likely be removed
18596 in a future version.
18598 @item -mno-cond-move
18599 @opindex mno-cond-move
18601 Disable the use of conditional-move instructions.
18603 This switch is mainly for debugging the compiler and will likely be removed
18604 in a future version.
18609 Enable the use of conditional set instructions (default).
18611 This switch is mainly for debugging the compiler and will likely be removed
18612 in a future version.
18617 Disable the use of conditional set instructions.
18619 This switch is mainly for debugging the compiler and will likely be removed
18620 in a future version.
18623 @opindex mcond-exec
18625 Enable the use of conditional execution (default).
18627 This switch is mainly for debugging the compiler and will likely be removed
18628 in a future version.
18630 @item -mno-cond-exec
18631 @opindex mno-cond-exec
18633 Disable the use of conditional execution.
18635 This switch is mainly for debugging the compiler and will likely be removed
18636 in a future version.
18638 @item -mvliw-branch
18639 @opindex mvliw-branch
18641 Run a pass to pack branches into VLIW instructions (default).
18643 This switch is mainly for debugging the compiler and will likely be removed
18644 in a future version.
18646 @item -mno-vliw-branch
18647 @opindex mno-vliw-branch
18649 Do not run a pass to pack branches into VLIW instructions.
18651 This switch is mainly for debugging the compiler and will likely be removed
18652 in a future version.
18654 @item -mmulti-cond-exec
18655 @opindex mmulti-cond-exec
18657 Enable optimization of @code{&&} and @code{||} in conditional execution
18660 This switch is mainly for debugging the compiler and will likely be removed
18661 in a future version.
18663 @item -mno-multi-cond-exec
18664 @opindex mno-multi-cond-exec
18666 Disable optimization of @code{&&} and @code{||} in conditional execution.
18668 This switch is mainly for debugging the compiler and will likely be removed
18669 in a future version.
18671 @item -mnested-cond-exec
18672 @opindex mnested-cond-exec
18674 Enable nested conditional execution optimizations (default).
18676 This switch is mainly for debugging the compiler and will likely be removed
18677 in a future version.
18679 @item -mno-nested-cond-exec
18680 @opindex mno-nested-cond-exec
18682 Disable nested conditional execution optimizations.
18684 This switch is mainly for debugging the compiler and will likely be removed
18685 in a future version.
18687 @item -moptimize-membar
18688 @opindex moptimize-membar
18690 This switch removes redundant @code{membar} instructions from the
18691 compiler-generated code. It is enabled by default.
18693 @item -mno-optimize-membar
18694 @opindex mno-optimize-membar
18696 This switch disables the automatic removal of redundant @code{membar}
18697 instructions from the generated code.
18699 @item -mtomcat-stats
18700 @opindex mtomcat-stats
18702 Cause gas to print out tomcat statistics.
18704 @item -mcpu=@var{cpu}
18707 Select the processor type for which to generate code. Possible values are
18708 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
18709 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
18713 @node GNU/Linux Options
18714 @subsection GNU/Linux Options
18716 These @samp{-m} options are defined for GNU/Linux targets:
18721 Use the GNU C library. This is the default except
18722 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
18723 @samp{*-*-linux-*android*} targets.
18727 Use uClibc C library. This is the default on
18728 @samp{*-*-linux-*uclibc*} targets.
18732 Use the musl C library. This is the default on
18733 @samp{*-*-linux-*musl*} targets.
18737 Use Bionic C library. This is the default on
18738 @samp{*-*-linux-*android*} targets.
18742 Compile code compatible with Android platform. This is the default on
18743 @samp{*-*-linux-*android*} targets.
18745 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
18746 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
18747 this option makes the GCC driver pass Android-specific options to the linker.
18748 Finally, this option causes the preprocessor macro @code{__ANDROID__}
18751 @item -tno-android-cc
18752 @opindex tno-android-cc
18753 Disable compilation effects of @option{-mandroid}, i.e., do not enable
18754 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
18755 @option{-fno-rtti} by default.
18757 @item -tno-android-ld
18758 @opindex tno-android-ld
18759 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
18760 linking options to the linker.
18764 @node H8/300 Options
18765 @subsection H8/300 Options
18767 These @samp{-m} options are defined for the H8/300 implementations:
18772 Shorten some address references at link time, when possible; uses the
18773 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
18774 ld, Using ld}, for a fuller description.
18778 Generate code for the H8/300H@.
18782 Generate code for the H8S@.
18786 Generate code for the H8S and H8/300H in the normal mode. This switch
18787 must be used either with @option{-mh} or @option{-ms}.
18791 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
18795 Extended registers are stored on stack before execution of function
18796 with monitor attribute. Default option is @option{-mexr}.
18797 This option is valid only for H8S targets.
18801 Extended registers are not stored on stack before execution of function
18802 with monitor attribute. Default option is @option{-mno-exr}.
18803 This option is valid only for H8S targets.
18807 Make @code{int} data 32 bits by default.
18810 @opindex malign-300
18811 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
18812 The default for the H8/300H and H8S is to align longs and floats on
18814 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
18815 This option has no effect on the H8/300.
18819 @subsection HPPA Options
18820 @cindex HPPA Options
18822 These @samp{-m} options are defined for the HPPA family of computers:
18825 @item -march=@var{architecture-type}
18827 Generate code for the specified architecture. The choices for
18828 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
18829 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
18830 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
18831 architecture option for your machine. Code compiled for lower numbered
18832 architectures runs on higher numbered architectures, but not the
18835 @item -mpa-risc-1-0
18836 @itemx -mpa-risc-1-1
18837 @itemx -mpa-risc-2-0
18838 @opindex mpa-risc-1-0
18839 @opindex mpa-risc-1-1
18840 @opindex mpa-risc-2-0
18841 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
18843 @item -mcaller-copies
18844 @opindex mcaller-copies
18845 The caller copies function arguments passed by hidden reference. This
18846 option should be used with care as it is not compatible with the default
18847 32-bit runtime. However, only aggregates larger than eight bytes are
18848 passed by hidden reference and the option provides better compatibility
18851 @item -mjump-in-delay
18852 @opindex mjump-in-delay
18853 This option is ignored and provided for compatibility purposes only.
18855 @item -mdisable-fpregs
18856 @opindex mdisable-fpregs
18857 Prevent floating-point registers from being used in any manner. This is
18858 necessary for compiling kernels that perform lazy context switching of
18859 floating-point registers. If you use this option and attempt to perform
18860 floating-point operations, the compiler aborts.
18862 @item -mdisable-indexing
18863 @opindex mdisable-indexing
18864 Prevent the compiler from using indexing address modes. This avoids some
18865 rather obscure problems when compiling MIG generated code under MACH@.
18867 @item -mno-space-regs
18868 @opindex mno-space-regs
18869 Generate code that assumes the target has no space registers. This allows
18870 GCC to generate faster indirect calls and use unscaled index address modes.
18872 Such code is suitable for level 0 PA systems and kernels.
18874 @item -mfast-indirect-calls
18875 @opindex mfast-indirect-calls
18876 Generate code that assumes calls never cross space boundaries. This
18877 allows GCC to emit code that performs faster indirect calls.
18879 This option does not work in the presence of shared libraries or nested
18882 @item -mfixed-range=@var{register-range}
18883 @opindex mfixed-range
18884 Generate code treating the given register range as fixed registers.
18885 A fixed register is one that the register allocator cannot use. This is
18886 useful when compiling kernel code. A register range is specified as
18887 two registers separated by a dash. Multiple register ranges can be
18888 specified separated by a comma.
18890 @item -mlong-load-store
18891 @opindex mlong-load-store
18892 Generate 3-instruction load and store sequences as sometimes required by
18893 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
18896 @item -mportable-runtime
18897 @opindex mportable-runtime
18898 Use the portable calling conventions proposed by HP for ELF systems.
18902 Enable the use of assembler directives only GAS understands.
18904 @item -mschedule=@var{cpu-type}
18906 Schedule code according to the constraints for the machine type
18907 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
18908 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
18909 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
18910 proper scheduling option for your machine. The default scheduling is
18914 @opindex mlinker-opt
18915 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
18916 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
18917 linkers in which they give bogus error messages when linking some programs.
18920 @opindex msoft-float
18921 Generate output containing library calls for floating point.
18922 @strong{Warning:} the requisite libraries are not available for all HPPA
18923 targets. Normally the facilities of the machine's usual C compiler are
18924 used, but this cannot be done directly in cross-compilation. You must make
18925 your own arrangements to provide suitable library functions for
18928 @option{-msoft-float} changes the calling convention in the output file;
18929 therefore, it is only useful if you compile @emph{all} of a program with
18930 this option. In particular, you need to compile @file{libgcc.a}, the
18931 library that comes with GCC, with @option{-msoft-float} in order for
18936 Generate the predefine, @code{_SIO}, for server IO@. The default is
18937 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
18938 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
18939 options are available under HP-UX and HI-UX@.
18943 Use options specific to GNU @command{ld}.
18944 This passes @option{-shared} to @command{ld} when
18945 building a shared library. It is the default when GCC is configured,
18946 explicitly or implicitly, with the GNU linker. This option does not
18947 affect which @command{ld} is called; it only changes what parameters
18948 are passed to that @command{ld}.
18949 The @command{ld} that is called is determined by the
18950 @option{--with-ld} configure option, GCC's program search path, and
18951 finally by the user's @env{PATH}. The linker used by GCC can be printed
18952 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
18953 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
18957 Use options specific to HP @command{ld}.
18958 This passes @option{-b} to @command{ld} when building
18959 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
18960 links. It is the default when GCC is configured, explicitly or
18961 implicitly, with the HP linker. This option does not affect
18962 which @command{ld} is called; it only changes what parameters are passed to that
18964 The @command{ld} that is called is determined by the @option{--with-ld}
18965 configure option, GCC's program search path, and finally by the user's
18966 @env{PATH}. The linker used by GCC can be printed using @samp{which
18967 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
18968 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
18971 @opindex mno-long-calls
18972 Generate code that uses long call sequences. This ensures that a call
18973 is always able to reach linker generated stubs. The default is to generate
18974 long calls only when the distance from the call site to the beginning
18975 of the function or translation unit, as the case may be, exceeds a
18976 predefined limit set by the branch type being used. The limits for
18977 normal calls are 7,600,000 and 240,000 bytes, respectively for the
18978 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
18981 Distances are measured from the beginning of functions when using the
18982 @option{-ffunction-sections} option, or when using the @option{-mgas}
18983 and @option{-mno-portable-runtime} options together under HP-UX with
18986 It is normally not desirable to use this option as it degrades
18987 performance. However, it may be useful in large applications,
18988 particularly when partial linking is used to build the application.
18990 The types of long calls used depends on the capabilities of the
18991 assembler and linker, and the type of code being generated. The
18992 impact on systems that support long absolute calls, and long pic
18993 symbol-difference or pc-relative calls should be relatively small.
18994 However, an indirect call is used on 32-bit ELF systems in pic code
18995 and it is quite long.
18997 @item -munix=@var{unix-std}
18999 Generate compiler predefines and select a startfile for the specified
19000 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
19001 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
19002 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
19003 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
19004 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
19007 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
19008 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
19009 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
19010 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
19011 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
19012 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
19014 It is @emph{important} to note that this option changes the interfaces
19015 for various library routines. It also affects the operational behavior
19016 of the C library. Thus, @emph{extreme} care is needed in using this
19019 Library code that is intended to operate with more than one UNIX
19020 standard must test, set and restore the variable @code{__xpg4_extended_mask}
19021 as appropriate. Most GNU software doesn't provide this capability.
19025 Suppress the generation of link options to search libdld.sl when the
19026 @option{-static} option is specified on HP-UX 10 and later.
19030 The HP-UX implementation of setlocale in libc has a dependency on
19031 libdld.sl. There isn't an archive version of libdld.sl. Thus,
19032 when the @option{-static} option is specified, special link options
19033 are needed to resolve this dependency.
19035 On HP-UX 10 and later, the GCC driver adds the necessary options to
19036 link with libdld.sl when the @option{-static} option is specified.
19037 This causes the resulting binary to be dynamic. On the 64-bit port,
19038 the linkers generate dynamic binaries by default in any case. The
19039 @option{-nolibdld} option can be used to prevent the GCC driver from
19040 adding these link options.
19044 Add support for multithreading with the @dfn{dce thread} library
19045 under HP-UX@. This option sets flags for both the preprocessor and
19049 @node IA-64 Options
19050 @subsection IA-64 Options
19051 @cindex IA-64 Options
19053 These are the @samp{-m} options defined for the Intel IA-64 architecture.
19057 @opindex mbig-endian
19058 Generate code for a big-endian target. This is the default for HP-UX@.
19060 @item -mlittle-endian
19061 @opindex mlittle-endian
19062 Generate code for a little-endian target. This is the default for AIX5
19068 @opindex mno-gnu-as
19069 Generate (or don't) code for the GNU assembler. This is the default.
19070 @c Also, this is the default if the configure option @option{--with-gnu-as}
19076 @opindex mno-gnu-ld
19077 Generate (or don't) code for the GNU linker. This is the default.
19078 @c Also, this is the default if the configure option @option{--with-gnu-ld}
19083 Generate code that does not use a global pointer register. The result
19084 is not position independent code, and violates the IA-64 ABI@.
19086 @item -mvolatile-asm-stop
19087 @itemx -mno-volatile-asm-stop
19088 @opindex mvolatile-asm-stop
19089 @opindex mno-volatile-asm-stop
19090 Generate (or don't) a stop bit immediately before and after volatile asm
19093 @item -mregister-names
19094 @itemx -mno-register-names
19095 @opindex mregister-names
19096 @opindex mno-register-names
19097 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
19098 the stacked registers. This may make assembler output more readable.
19104 Disable (or enable) optimizations that use the small data section. This may
19105 be useful for working around optimizer bugs.
19107 @item -mconstant-gp
19108 @opindex mconstant-gp
19109 Generate code that uses a single constant global pointer value. This is
19110 useful when compiling kernel code.
19114 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
19115 This is useful when compiling firmware code.
19117 @item -minline-float-divide-min-latency
19118 @opindex minline-float-divide-min-latency
19119 Generate code for inline divides of floating-point values
19120 using the minimum latency algorithm.
19122 @item -minline-float-divide-max-throughput
19123 @opindex minline-float-divide-max-throughput
19124 Generate code for inline divides of floating-point values
19125 using the maximum throughput algorithm.
19127 @item -mno-inline-float-divide
19128 @opindex mno-inline-float-divide
19129 Do not generate inline code for divides of floating-point values.
19131 @item -minline-int-divide-min-latency
19132 @opindex minline-int-divide-min-latency
19133 Generate code for inline divides of integer values
19134 using the minimum latency algorithm.
19136 @item -minline-int-divide-max-throughput
19137 @opindex minline-int-divide-max-throughput
19138 Generate code for inline divides of integer values
19139 using the maximum throughput algorithm.
19141 @item -mno-inline-int-divide
19142 @opindex mno-inline-int-divide
19143 Do not generate inline code for divides of integer values.
19145 @item -minline-sqrt-min-latency
19146 @opindex minline-sqrt-min-latency
19147 Generate code for inline square roots
19148 using the minimum latency algorithm.
19150 @item -minline-sqrt-max-throughput
19151 @opindex minline-sqrt-max-throughput
19152 Generate code for inline square roots
19153 using the maximum throughput algorithm.
19155 @item -mno-inline-sqrt
19156 @opindex mno-inline-sqrt
19157 Do not generate inline code for @code{sqrt}.
19160 @itemx -mno-fused-madd
19161 @opindex mfused-madd
19162 @opindex mno-fused-madd
19163 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
19164 instructions. The default is to use these instructions.
19166 @item -mno-dwarf2-asm
19167 @itemx -mdwarf2-asm
19168 @opindex mno-dwarf2-asm
19169 @opindex mdwarf2-asm
19170 Don't (or do) generate assembler code for the DWARF line number debugging
19171 info. This may be useful when not using the GNU assembler.
19173 @item -mearly-stop-bits
19174 @itemx -mno-early-stop-bits
19175 @opindex mearly-stop-bits
19176 @opindex mno-early-stop-bits
19177 Allow stop bits to be placed earlier than immediately preceding the
19178 instruction that triggered the stop bit. This can improve instruction
19179 scheduling, but does not always do so.
19181 @item -mfixed-range=@var{register-range}
19182 @opindex mfixed-range
19183 Generate code treating the given register range as fixed registers.
19184 A fixed register is one that the register allocator cannot use. This is
19185 useful when compiling kernel code. A register range is specified as
19186 two registers separated by a dash. Multiple register ranges can be
19187 specified separated by a comma.
19189 @item -mtls-size=@var{tls-size}
19191 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
19194 @item -mtune=@var{cpu-type}
19196 Tune the instruction scheduling for a particular CPU, Valid values are
19197 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
19198 and @samp{mckinley}.
19204 Generate code for a 32-bit or 64-bit environment.
19205 The 32-bit environment sets int, long and pointer to 32 bits.
19206 The 64-bit environment sets int to 32 bits and long and pointer
19207 to 64 bits. These are HP-UX specific flags.
19209 @item -mno-sched-br-data-spec
19210 @itemx -msched-br-data-spec
19211 @opindex mno-sched-br-data-spec
19212 @opindex msched-br-data-spec
19213 (Dis/En)able data speculative scheduling before reload.
19214 This results in generation of @code{ld.a} instructions and
19215 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
19216 The default setting is disabled.
19218 @item -msched-ar-data-spec
19219 @itemx -mno-sched-ar-data-spec
19220 @opindex msched-ar-data-spec
19221 @opindex mno-sched-ar-data-spec
19222 (En/Dis)able data speculative scheduling after reload.
19223 This results in generation of @code{ld.a} instructions and
19224 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
19225 The default setting is enabled.
19227 @item -mno-sched-control-spec
19228 @itemx -msched-control-spec
19229 @opindex mno-sched-control-spec
19230 @opindex msched-control-spec
19231 (Dis/En)able control speculative scheduling. This feature is
19232 available only during region scheduling (i.e.@: before reload).
19233 This results in generation of the @code{ld.s} instructions and
19234 the corresponding check instructions @code{chk.s}.
19235 The default setting is disabled.
19237 @item -msched-br-in-data-spec
19238 @itemx -mno-sched-br-in-data-spec
19239 @opindex msched-br-in-data-spec
19240 @opindex mno-sched-br-in-data-spec
19241 (En/Dis)able speculative scheduling of the instructions that
19242 are dependent on the data speculative loads before reload.
19243 This is effective only with @option{-msched-br-data-spec} enabled.
19244 The default setting is enabled.
19246 @item -msched-ar-in-data-spec
19247 @itemx -mno-sched-ar-in-data-spec
19248 @opindex msched-ar-in-data-spec
19249 @opindex mno-sched-ar-in-data-spec
19250 (En/Dis)able speculative scheduling of the instructions that
19251 are dependent on the data speculative loads after reload.
19252 This is effective only with @option{-msched-ar-data-spec} enabled.
19253 The default setting is enabled.
19255 @item -msched-in-control-spec
19256 @itemx -mno-sched-in-control-spec
19257 @opindex msched-in-control-spec
19258 @opindex mno-sched-in-control-spec
19259 (En/Dis)able speculative scheduling of the instructions that
19260 are dependent on the control speculative loads.
19261 This is effective only with @option{-msched-control-spec} enabled.
19262 The default setting is enabled.
19264 @item -mno-sched-prefer-non-data-spec-insns
19265 @itemx -msched-prefer-non-data-spec-insns
19266 @opindex mno-sched-prefer-non-data-spec-insns
19267 @opindex msched-prefer-non-data-spec-insns
19268 If enabled, data-speculative instructions are chosen for schedule
19269 only if there are no other choices at the moment. This makes
19270 the use of the data speculation much more conservative.
19271 The default setting is disabled.
19273 @item -mno-sched-prefer-non-control-spec-insns
19274 @itemx -msched-prefer-non-control-spec-insns
19275 @opindex mno-sched-prefer-non-control-spec-insns
19276 @opindex msched-prefer-non-control-spec-insns
19277 If enabled, control-speculative instructions are chosen for schedule
19278 only if there are no other choices at the moment. This makes
19279 the use of the control speculation much more conservative.
19280 The default setting is disabled.
19282 @item -mno-sched-count-spec-in-critical-path
19283 @itemx -msched-count-spec-in-critical-path
19284 @opindex mno-sched-count-spec-in-critical-path
19285 @opindex msched-count-spec-in-critical-path
19286 If enabled, speculative dependencies are considered during
19287 computation of the instructions priorities. This makes the use of the
19288 speculation a bit more conservative.
19289 The default setting is disabled.
19291 @item -msched-spec-ldc
19292 @opindex msched-spec-ldc
19293 Use a simple data speculation check. This option is on by default.
19295 @item -msched-control-spec-ldc
19296 @opindex msched-spec-ldc
19297 Use a simple check for control speculation. This option is on by default.
19299 @item -msched-stop-bits-after-every-cycle
19300 @opindex msched-stop-bits-after-every-cycle
19301 Place a stop bit after every cycle when scheduling. This option is on
19304 @item -msched-fp-mem-deps-zero-cost
19305 @opindex msched-fp-mem-deps-zero-cost
19306 Assume that floating-point stores and loads are not likely to cause a conflict
19307 when placed into the same instruction group. This option is disabled by
19310 @item -msel-sched-dont-check-control-spec
19311 @opindex msel-sched-dont-check-control-spec
19312 Generate checks for control speculation in selective scheduling.
19313 This flag is disabled by default.
19315 @item -msched-max-memory-insns=@var{max-insns}
19316 @opindex msched-max-memory-insns
19317 Limit on the number of memory insns per instruction group, giving lower
19318 priority to subsequent memory insns attempting to schedule in the same
19319 instruction group. Frequently useful to prevent cache bank conflicts.
19320 The default value is 1.
19322 @item -msched-max-memory-insns-hard-limit
19323 @opindex msched-max-memory-insns-hard-limit
19324 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
19325 disallowing more than that number in an instruction group.
19326 Otherwise, the limit is ``soft'', meaning that non-memory operations
19327 are preferred when the limit is reached, but memory operations may still
19333 @subsection LM32 Options
19334 @cindex LM32 options
19336 These @option{-m} options are defined for the LatticeMico32 architecture:
19339 @item -mbarrel-shift-enabled
19340 @opindex mbarrel-shift-enabled
19341 Enable barrel-shift instructions.
19343 @item -mdivide-enabled
19344 @opindex mdivide-enabled
19345 Enable divide and modulus instructions.
19347 @item -mmultiply-enabled
19348 @opindex multiply-enabled
19349 Enable multiply instructions.
19351 @item -msign-extend-enabled
19352 @opindex msign-extend-enabled
19353 Enable sign extend instructions.
19355 @item -muser-enabled
19356 @opindex muser-enabled
19357 Enable user-defined instructions.
19362 @subsection M32C Options
19363 @cindex M32C options
19366 @item -mcpu=@var{name}
19368 Select the CPU for which code is generated. @var{name} may be one of
19369 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
19370 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
19371 the M32C/80 series.
19375 Specifies that the program will be run on the simulator. This causes
19376 an alternate runtime library to be linked in which supports, for
19377 example, file I/O@. You must not use this option when generating
19378 programs that will run on real hardware; you must provide your own
19379 runtime library for whatever I/O functions are needed.
19381 @item -memregs=@var{number}
19383 Specifies the number of memory-based pseudo-registers GCC uses
19384 during code generation. These pseudo-registers are used like real
19385 registers, so there is a tradeoff between GCC's ability to fit the
19386 code into available registers, and the performance penalty of using
19387 memory instead of registers. Note that all modules in a program must
19388 be compiled with the same value for this option. Because of that, you
19389 must not use this option with GCC's default runtime libraries.
19393 @node M32R/D Options
19394 @subsection M32R/D Options
19395 @cindex M32R/D options
19397 These @option{-m} options are defined for Renesas M32R/D architectures:
19402 Generate code for the M32R/2@.
19406 Generate code for the M32R/X@.
19410 Generate code for the M32R@. This is the default.
19412 @item -mmodel=small
19413 @opindex mmodel=small
19414 Assume all objects live in the lower 16MB of memory (so that their addresses
19415 can be loaded with the @code{ld24} instruction), and assume all subroutines
19416 are reachable with the @code{bl} instruction.
19417 This is the default.
19419 The addressability of a particular object can be set with the
19420 @code{model} attribute.
19422 @item -mmodel=medium
19423 @opindex mmodel=medium
19424 Assume objects may be anywhere in the 32-bit address space (the compiler
19425 generates @code{seth/add3} instructions to load their addresses), and
19426 assume all subroutines are reachable with the @code{bl} instruction.
19428 @item -mmodel=large
19429 @opindex mmodel=large
19430 Assume objects may be anywhere in the 32-bit address space (the compiler
19431 generates @code{seth/add3} instructions to load their addresses), and
19432 assume subroutines may not be reachable with the @code{bl} instruction
19433 (the compiler generates the much slower @code{seth/add3/jl}
19434 instruction sequence).
19437 @opindex msdata=none
19438 Disable use of the small data area. Variables are put into
19439 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
19440 @code{section} attribute has been specified).
19441 This is the default.
19443 The small data area consists of sections @code{.sdata} and @code{.sbss}.
19444 Objects may be explicitly put in the small data area with the
19445 @code{section} attribute using one of these sections.
19447 @item -msdata=sdata
19448 @opindex msdata=sdata
19449 Put small global and static data in the small data area, but do not
19450 generate special code to reference them.
19453 @opindex msdata=use
19454 Put small global and static data in the small data area, and generate
19455 special instructions to reference them.
19459 @cindex smaller data references
19460 Put global and static objects less than or equal to @var{num} bytes
19461 into the small data or BSS sections instead of the normal data or BSS
19462 sections. The default value of @var{num} is 8.
19463 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
19464 for this option to have any effect.
19466 All modules should be compiled with the same @option{-G @var{num}} value.
19467 Compiling with different values of @var{num} may or may not work; if it
19468 doesn't the linker gives an error message---incorrect code is not
19473 Makes the M32R-specific code in the compiler display some statistics
19474 that might help in debugging programs.
19476 @item -malign-loops
19477 @opindex malign-loops
19478 Align all loops to a 32-byte boundary.
19480 @item -mno-align-loops
19481 @opindex mno-align-loops
19482 Do not enforce a 32-byte alignment for loops. This is the default.
19484 @item -missue-rate=@var{number}
19485 @opindex missue-rate=@var{number}
19486 Issue @var{number} instructions per cycle. @var{number} can only be 1
19489 @item -mbranch-cost=@var{number}
19490 @opindex mbranch-cost=@var{number}
19491 @var{number} can only be 1 or 2. If it is 1 then branches are
19492 preferred over conditional code, if it is 2, then the opposite applies.
19494 @item -mflush-trap=@var{number}
19495 @opindex mflush-trap=@var{number}
19496 Specifies the trap number to use to flush the cache. The default is
19497 12. Valid numbers are between 0 and 15 inclusive.
19499 @item -mno-flush-trap
19500 @opindex mno-flush-trap
19501 Specifies that the cache cannot be flushed by using a trap.
19503 @item -mflush-func=@var{name}
19504 @opindex mflush-func=@var{name}
19505 Specifies the name of the operating system function to call to flush
19506 the cache. The default is @samp{_flush_cache}, but a function call
19507 is only used if a trap is not available.
19509 @item -mno-flush-func
19510 @opindex mno-flush-func
19511 Indicates that there is no OS function for flushing the cache.
19515 @node M680x0 Options
19516 @subsection M680x0 Options
19517 @cindex M680x0 options
19519 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
19520 The default settings depend on which architecture was selected when
19521 the compiler was configured; the defaults for the most common choices
19525 @item -march=@var{arch}
19527 Generate code for a specific M680x0 or ColdFire instruction set
19528 architecture. Permissible values of @var{arch} for M680x0
19529 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
19530 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
19531 architectures are selected according to Freescale's ISA classification
19532 and the permissible values are: @samp{isaa}, @samp{isaaplus},
19533 @samp{isab} and @samp{isac}.
19535 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
19536 code for a ColdFire target. The @var{arch} in this macro is one of the
19537 @option{-march} arguments given above.
19539 When used together, @option{-march} and @option{-mtune} select code
19540 that runs on a family of similar processors but that is optimized
19541 for a particular microarchitecture.
19543 @item -mcpu=@var{cpu}
19545 Generate code for a specific M680x0 or ColdFire processor.
19546 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
19547 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
19548 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
19549 below, which also classifies the CPUs into families:
19551 @multitable @columnfractions 0.20 0.80
19552 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
19553 @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}
19554 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
19555 @item @samp{5206e} @tab @samp{5206e}
19556 @item @samp{5208} @tab @samp{5207} @samp{5208}
19557 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
19558 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
19559 @item @samp{5216} @tab @samp{5214} @samp{5216}
19560 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
19561 @item @samp{5225} @tab @samp{5224} @samp{5225}
19562 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
19563 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
19564 @item @samp{5249} @tab @samp{5249}
19565 @item @samp{5250} @tab @samp{5250}
19566 @item @samp{5271} @tab @samp{5270} @samp{5271}
19567 @item @samp{5272} @tab @samp{5272}
19568 @item @samp{5275} @tab @samp{5274} @samp{5275}
19569 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
19570 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
19571 @item @samp{5307} @tab @samp{5307}
19572 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
19573 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
19574 @item @samp{5407} @tab @samp{5407}
19575 @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}
19578 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
19579 @var{arch} is compatible with @var{cpu}. Other combinations of
19580 @option{-mcpu} and @option{-march} are rejected.
19582 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
19583 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
19584 where the value of @var{family} is given by the table above.
19586 @item -mtune=@var{tune}
19588 Tune the code for a particular microarchitecture within the
19589 constraints set by @option{-march} and @option{-mcpu}.
19590 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
19591 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
19592 and @samp{cpu32}. The ColdFire microarchitectures
19593 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
19595 You can also use @option{-mtune=68020-40} for code that needs
19596 to run relatively well on 68020, 68030 and 68040 targets.
19597 @option{-mtune=68020-60} is similar but includes 68060 targets
19598 as well. These two options select the same tuning decisions as
19599 @option{-m68020-40} and @option{-m68020-60} respectively.
19601 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
19602 when tuning for 680x0 architecture @var{arch}. It also defines
19603 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
19604 option is used. If GCC is tuning for a range of architectures,
19605 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
19606 it defines the macros for every architecture in the range.
19608 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
19609 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
19610 of the arguments given above.
19616 Generate output for a 68000. This is the default
19617 when the compiler is configured for 68000-based systems.
19618 It is equivalent to @option{-march=68000}.
19620 Use this option for microcontrollers with a 68000 or EC000 core,
19621 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
19625 Generate output for a 68010. This is the default
19626 when the compiler is configured for 68010-based systems.
19627 It is equivalent to @option{-march=68010}.
19633 Generate output for a 68020. This is the default
19634 when the compiler is configured for 68020-based systems.
19635 It is equivalent to @option{-march=68020}.
19639 Generate output for a 68030. This is the default when the compiler is
19640 configured for 68030-based systems. It is equivalent to
19641 @option{-march=68030}.
19645 Generate output for a 68040. This is the default when the compiler is
19646 configured for 68040-based systems. It is equivalent to
19647 @option{-march=68040}.
19649 This option inhibits the use of 68881/68882 instructions that have to be
19650 emulated by software on the 68040. Use this option if your 68040 does not
19651 have code to emulate those instructions.
19655 Generate output for a 68060. This is the default when the compiler is
19656 configured for 68060-based systems. It is equivalent to
19657 @option{-march=68060}.
19659 This option inhibits the use of 68020 and 68881/68882 instructions that
19660 have to be emulated by software on the 68060. Use this option if your 68060
19661 does not have code to emulate those instructions.
19665 Generate output for a CPU32. This is the default
19666 when the compiler is configured for CPU32-based systems.
19667 It is equivalent to @option{-march=cpu32}.
19669 Use this option for microcontrollers with a
19670 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
19671 68336, 68340, 68341, 68349 and 68360.
19675 Generate output for a 520X ColdFire CPU@. This is the default
19676 when the compiler is configured for 520X-based systems.
19677 It is equivalent to @option{-mcpu=5206}, and is now deprecated
19678 in favor of that option.
19680 Use this option for microcontroller with a 5200 core, including
19681 the MCF5202, MCF5203, MCF5204 and MCF5206.
19685 Generate output for a 5206e ColdFire CPU@. The option is now
19686 deprecated in favor of the equivalent @option{-mcpu=5206e}.
19690 Generate output for a member of the ColdFire 528X family.
19691 The option is now deprecated in favor of the equivalent
19692 @option{-mcpu=528x}.
19696 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
19697 in favor of the equivalent @option{-mcpu=5307}.
19701 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
19702 in favor of the equivalent @option{-mcpu=5407}.
19706 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
19707 This includes use of hardware floating-point instructions.
19708 The option is equivalent to @option{-mcpu=547x}, and is now
19709 deprecated in favor of that option.
19713 Generate output for a 68040, without using any of the new instructions.
19714 This results in code that can run relatively efficiently on either a
19715 68020/68881 or a 68030 or a 68040. The generated code does use the
19716 68881 instructions that are emulated on the 68040.
19718 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
19722 Generate output for a 68060, without using any of the new instructions.
19723 This results in code that can run relatively efficiently on either a
19724 68020/68881 or a 68030 or a 68040. The generated code does use the
19725 68881 instructions that are emulated on the 68060.
19727 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
19731 @opindex mhard-float
19733 Generate floating-point instructions. This is the default for 68020
19734 and above, and for ColdFire devices that have an FPU@. It defines the
19735 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
19736 on ColdFire targets.
19739 @opindex msoft-float
19740 Do not generate floating-point instructions; use library calls instead.
19741 This is the default for 68000, 68010, and 68832 targets. It is also
19742 the default for ColdFire devices that have no FPU.
19748 Generate (do not generate) ColdFire hardware divide and remainder
19749 instructions. If @option{-march} is used without @option{-mcpu},
19750 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
19751 architectures. Otherwise, the default is taken from the target CPU
19752 (either the default CPU, or the one specified by @option{-mcpu}). For
19753 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
19754 @option{-mcpu=5206e}.
19756 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
19760 Consider type @code{int} to be 16 bits wide, like @code{short int}.
19761 Additionally, parameters passed on the stack are also aligned to a
19762 16-bit boundary even on targets whose API mandates promotion to 32-bit.
19766 Do not consider type @code{int} to be 16 bits wide. This is the default.
19769 @itemx -mno-bitfield
19770 @opindex mnobitfield
19771 @opindex mno-bitfield
19772 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
19773 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
19777 Do use the bit-field instructions. The @option{-m68020} option implies
19778 @option{-mbitfield}. This is the default if you use a configuration
19779 designed for a 68020.
19783 Use a different function-calling convention, in which functions
19784 that take a fixed number of arguments return with the @code{rtd}
19785 instruction, which pops their arguments while returning. This
19786 saves one instruction in the caller since there is no need to pop
19787 the arguments there.
19789 This calling convention is incompatible with the one normally
19790 used on Unix, so you cannot use it if you need to call libraries
19791 compiled with the Unix compiler.
19793 Also, you must provide function prototypes for all functions that
19794 take variable numbers of arguments (including @code{printf});
19795 otherwise incorrect code is generated for calls to those
19798 In addition, seriously incorrect code results if you call a
19799 function with too many arguments. (Normally, extra arguments are
19800 harmlessly ignored.)
19802 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
19803 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
19807 Do not use the calling conventions selected by @option{-mrtd}.
19808 This is the default.
19811 @itemx -mno-align-int
19812 @opindex malign-int
19813 @opindex mno-align-int
19814 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
19815 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
19816 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
19817 Aligning variables on 32-bit boundaries produces code that runs somewhat
19818 faster on processors with 32-bit busses at the expense of more memory.
19820 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
19821 aligns structures containing the above types differently than
19822 most published application binary interface specifications for the m68k.
19826 Use the pc-relative addressing mode of the 68000 directly, instead of
19827 using a global offset table. At present, this option implies @option{-fpic},
19828 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
19829 not presently supported with @option{-mpcrel}, though this could be supported for
19830 68020 and higher processors.
19832 @item -mno-strict-align
19833 @itemx -mstrict-align
19834 @opindex mno-strict-align
19835 @opindex mstrict-align
19836 Do not (do) assume that unaligned memory references are handled by
19840 Generate code that allows the data segment to be located in a different
19841 area of memory from the text segment. This allows for execute-in-place in
19842 an environment without virtual memory management. This option implies
19845 @item -mno-sep-data
19846 Generate code that assumes that the data segment follows the text segment.
19847 This is the default.
19849 @item -mid-shared-library
19850 Generate code that supports shared libraries via the library ID method.
19851 This allows for execute-in-place and shared libraries in an environment
19852 without virtual memory management. This option implies @option{-fPIC}.
19854 @item -mno-id-shared-library
19855 Generate code that doesn't assume ID-based shared libraries are being used.
19856 This is the default.
19858 @item -mshared-library-id=n
19859 Specifies the identification number of the ID-based shared library being
19860 compiled. Specifying a value of 0 generates more compact code; specifying
19861 other values forces the allocation of that number to the current
19862 library, but is no more space- or time-efficient than omitting this option.
19868 When generating position-independent code for ColdFire, generate code
19869 that works if the GOT has more than 8192 entries. This code is
19870 larger and slower than code generated without this option. On M680x0
19871 processors, this option is not needed; @option{-fPIC} suffices.
19873 GCC normally uses a single instruction to load values from the GOT@.
19874 While this is relatively efficient, it only works if the GOT
19875 is smaller than about 64k. Anything larger causes the linker
19876 to report an error such as:
19878 @cindex relocation truncated to fit (ColdFire)
19880 relocation truncated to fit: R_68K_GOT16O foobar
19883 If this happens, you should recompile your code with @option{-mxgot}.
19884 It should then work with very large GOTs. However, code generated with
19885 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
19886 the value of a global symbol.
19888 Note that some linkers, including newer versions of the GNU linker,
19889 can create multiple GOTs and sort GOT entries. If you have such a linker,
19890 you should only need to use @option{-mxgot} when compiling a single
19891 object file that accesses more than 8192 GOT entries. Very few do.
19893 These options have no effect unless GCC is generating
19894 position-independent code.
19896 @item -mlong-jump-table-offsets
19897 @opindex mlong-jump-table-offsets
19898 Use 32-bit offsets in @code{switch} tables. The default is to use
19903 @node MCore Options
19904 @subsection MCore Options
19905 @cindex MCore options
19907 These are the @samp{-m} options defined for the Motorola M*Core
19913 @itemx -mno-hardlit
19915 @opindex mno-hardlit
19916 Inline constants into the code stream if it can be done in two
19917 instructions or less.
19923 Use the divide instruction. (Enabled by default).
19925 @item -mrelax-immediate
19926 @itemx -mno-relax-immediate
19927 @opindex mrelax-immediate
19928 @opindex mno-relax-immediate
19929 Allow arbitrary-sized immediates in bit operations.
19931 @item -mwide-bitfields
19932 @itemx -mno-wide-bitfields
19933 @opindex mwide-bitfields
19934 @opindex mno-wide-bitfields
19935 Always treat bit-fields as @code{int}-sized.
19937 @item -m4byte-functions
19938 @itemx -mno-4byte-functions
19939 @opindex m4byte-functions
19940 @opindex mno-4byte-functions
19941 Force all functions to be aligned to a 4-byte boundary.
19943 @item -mcallgraph-data
19944 @itemx -mno-callgraph-data
19945 @opindex mcallgraph-data
19946 @opindex mno-callgraph-data
19947 Emit callgraph information.
19950 @itemx -mno-slow-bytes
19951 @opindex mslow-bytes
19952 @opindex mno-slow-bytes
19953 Prefer word access when reading byte quantities.
19955 @item -mlittle-endian
19956 @itemx -mbig-endian
19957 @opindex mlittle-endian
19958 @opindex mbig-endian
19959 Generate code for a little-endian target.
19965 Generate code for the 210 processor.
19969 Assume that runtime support has been provided and so omit the
19970 simulator library (@file{libsim.a)} from the linker command line.
19972 @item -mstack-increment=@var{size}
19973 @opindex mstack-increment
19974 Set the maximum amount for a single stack increment operation. Large
19975 values can increase the speed of programs that contain functions
19976 that need a large amount of stack space, but they can also trigger a
19977 segmentation fault if the stack is extended too much. The default
19983 @subsection MeP Options
19984 @cindex MeP options
19990 Enables the @code{abs} instruction, which is the absolute difference
19991 between two registers.
19995 Enables all the optional instructions---average, multiply, divide, bit
19996 operations, leading zero, absolute difference, min/max, clip, and
20002 Enables the @code{ave} instruction, which computes the average of two
20005 @item -mbased=@var{n}
20007 Variables of size @var{n} bytes or smaller are placed in the
20008 @code{.based} section by default. Based variables use the @code{$tp}
20009 register as a base register, and there is a 128-byte limit to the
20010 @code{.based} section.
20014 Enables the bit operation instructions---bit test (@code{btstm}), set
20015 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
20016 test-and-set (@code{tas}).
20018 @item -mc=@var{name}
20020 Selects which section constant data is placed in. @var{name} may
20021 be @samp{tiny}, @samp{near}, or @samp{far}.
20025 Enables the @code{clip} instruction. Note that @option{-mclip} is not
20026 useful unless you also provide @option{-mminmax}.
20028 @item -mconfig=@var{name}
20030 Selects one of the built-in core configurations. Each MeP chip has
20031 one or more modules in it; each module has a core CPU and a variety of
20032 coprocessors, optional instructions, and peripherals. The
20033 @code{MeP-Integrator} tool, not part of GCC, provides these
20034 configurations through this option; using this option is the same as
20035 using all the corresponding command-line options. The default
20036 configuration is @samp{default}.
20040 Enables the coprocessor instructions. By default, this is a 32-bit
20041 coprocessor. Note that the coprocessor is normally enabled via the
20042 @option{-mconfig=} option.
20046 Enables the 32-bit coprocessor's instructions.
20050 Enables the 64-bit coprocessor's instructions.
20054 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
20058 Causes constant variables to be placed in the @code{.near} section.
20062 Enables the @code{div} and @code{divu} instructions.
20066 Generate big-endian code.
20070 Generate little-endian code.
20072 @item -mio-volatile
20073 @opindex mio-volatile
20074 Tells the compiler that any variable marked with the @code{io}
20075 attribute is to be considered volatile.
20079 Causes variables to be assigned to the @code{.far} section by default.
20083 Enables the @code{leadz} (leading zero) instruction.
20087 Causes variables to be assigned to the @code{.near} section by default.
20091 Enables the @code{min} and @code{max} instructions.
20095 Enables the multiplication and multiply-accumulate instructions.
20099 Disables all the optional instructions enabled by @option{-mall-opts}.
20103 Enables the @code{repeat} and @code{erepeat} instructions, used for
20104 low-overhead looping.
20108 Causes all variables to default to the @code{.tiny} section. Note
20109 that there is a 65536-byte limit to this section. Accesses to these
20110 variables use the @code{%gp} base register.
20114 Enables the saturation instructions. Note that the compiler does not
20115 currently generate these itself, but this option is included for
20116 compatibility with other tools, like @code{as}.
20120 Link the SDRAM-based runtime instead of the default ROM-based runtime.
20124 Link the simulator run-time libraries.
20128 Link the simulator runtime libraries, excluding built-in support
20129 for reset and exception vectors and tables.
20133 Causes all functions to default to the @code{.far} section. Without
20134 this option, functions default to the @code{.near} section.
20136 @item -mtiny=@var{n}
20138 Variables that are @var{n} bytes or smaller are allocated to the
20139 @code{.tiny} section. These variables use the @code{$gp} base
20140 register. The default for this option is 4, but note that there's a
20141 65536-byte limit to the @code{.tiny} section.
20145 @node MicroBlaze Options
20146 @subsection MicroBlaze Options
20147 @cindex MicroBlaze Options
20152 @opindex msoft-float
20153 Use software emulation for floating point (default).
20156 @opindex mhard-float
20157 Use hardware floating-point instructions.
20161 Do not optimize block moves, use @code{memcpy}.
20163 @item -mno-clearbss
20164 @opindex mno-clearbss
20165 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
20167 @item -mcpu=@var{cpu-type}
20169 Use features of, and schedule code for, the given CPU.
20170 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
20171 where @var{X} is a major version, @var{YY} is the minor version, and
20172 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
20173 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
20175 @item -mxl-soft-mul
20176 @opindex mxl-soft-mul
20177 Use software multiply emulation (default).
20179 @item -mxl-soft-div
20180 @opindex mxl-soft-div
20181 Use software emulation for divides (default).
20183 @item -mxl-barrel-shift
20184 @opindex mxl-barrel-shift
20185 Use the hardware barrel shifter.
20187 @item -mxl-pattern-compare
20188 @opindex mxl-pattern-compare
20189 Use pattern compare instructions.
20191 @item -msmall-divides
20192 @opindex msmall-divides
20193 Use table lookup optimization for small signed integer divisions.
20195 @item -mxl-stack-check
20196 @opindex mxl-stack-check
20197 This option is deprecated. Use @option{-fstack-check} instead.
20200 @opindex mxl-gp-opt
20201 Use GP-relative @code{.sdata}/@code{.sbss} sections.
20203 @item -mxl-multiply-high
20204 @opindex mxl-multiply-high
20205 Use multiply high instructions for high part of 32x32 multiply.
20207 @item -mxl-float-convert
20208 @opindex mxl-float-convert
20209 Use hardware floating-point conversion instructions.
20211 @item -mxl-float-sqrt
20212 @opindex mxl-float-sqrt
20213 Use hardware floating-point square root instruction.
20216 @opindex mbig-endian
20217 Generate code for a big-endian target.
20219 @item -mlittle-endian
20220 @opindex mlittle-endian
20221 Generate code for a little-endian target.
20224 @opindex mxl-reorder
20225 Use reorder instructions (swap and byte reversed load/store).
20227 @item -mxl-mode-@var{app-model}
20228 Select application model @var{app-model}. Valid models are
20231 normal executable (default), uses startup code @file{crt0.o}.
20233 @item -mpic-data-is-text-relative
20234 @opindex mpic-data-is-text-relative
20235 Assume that the displacement between the text and data segments is fixed
20236 at static link time. This allows data to be referenced by offset from start of
20237 text address instead of GOT since PC-relative addressing is not supported.
20240 for use with Xilinx Microprocessor Debugger (XMD) based
20241 software intrusive debug agent called xmdstub. This uses startup file
20242 @file{crt1.o} and sets the start address of the program to 0x800.
20245 for applications that are loaded using a bootloader.
20246 This model uses startup file @file{crt2.o} which does not contain a processor
20247 reset vector handler. This is suitable for transferring control on a
20248 processor reset to the bootloader rather than the application.
20251 for applications that do not require any of the
20252 MicroBlaze vectors. This option may be useful for applications running
20253 within a monitoring application. This model uses @file{crt3.o} as a startup file.
20256 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
20257 @option{-mxl-mode-@var{app-model}}.
20262 @subsection MIPS Options
20263 @cindex MIPS options
20269 Generate big-endian code.
20273 Generate little-endian code. This is the default for @samp{mips*el-*-*}
20276 @item -march=@var{arch}
20278 Generate code that runs on @var{arch}, which can be the name of a
20279 generic MIPS ISA, or the name of a particular processor.
20281 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
20282 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
20283 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
20284 @samp{mips64r5} and @samp{mips64r6}.
20285 The processor names are:
20286 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
20287 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
20288 @samp{5kc}, @samp{5kf},
20290 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
20291 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
20292 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
20293 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
20294 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
20295 @samp{i6400}, @samp{i6500},
20297 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
20299 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
20300 @samp{m5100}, @samp{m5101},
20301 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
20303 @samp{p5600}, @samp{p6600},
20304 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
20305 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
20306 @samp{rm7000}, @samp{rm9000},
20307 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
20310 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
20311 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
20312 @samp{xlr} and @samp{xlp}.
20313 The special value @samp{from-abi} selects the
20314 most compatible architecture for the selected ABI (that is,
20315 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
20317 The native Linux/GNU toolchain also supports the value @samp{native},
20318 which selects the best architecture option for the host processor.
20319 @option{-march=native} has no effect if GCC does not recognize
20322 In processor names, a final @samp{000} can be abbreviated as @samp{k}
20323 (for example, @option{-march=r2k}). Prefixes are optional, and
20324 @samp{vr} may be written @samp{r}.
20326 Names of the form @samp{@var{n}f2_1} refer to processors with
20327 FPUs clocked at half the rate of the core, names of the form
20328 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
20329 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
20330 processors with FPUs clocked a ratio of 3:2 with respect to the core.
20331 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
20332 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
20333 accepted as synonyms for @samp{@var{n}f1_1}.
20335 GCC defines two macros based on the value of this option. The first
20336 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
20337 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
20338 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
20339 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
20340 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
20342 Note that the @code{_MIPS_ARCH} macro uses the processor names given
20343 above. In other words, it has the full prefix and does not
20344 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
20345 the macro names the resolved architecture (either @code{"mips1"} or
20346 @code{"mips3"}). It names the default architecture when no
20347 @option{-march} option is given.
20349 @item -mtune=@var{arch}
20351 Optimize for @var{arch}. Among other things, this option controls
20352 the way instructions are scheduled, and the perceived cost of arithmetic
20353 operations. The list of @var{arch} values is the same as for
20356 When this option is not used, GCC optimizes for the processor
20357 specified by @option{-march}. By using @option{-march} and
20358 @option{-mtune} together, it is possible to generate code that
20359 runs on a family of processors, but optimize the code for one
20360 particular member of that family.
20362 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
20363 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
20364 @option{-march} ones described above.
20368 Equivalent to @option{-march=mips1}.
20372 Equivalent to @option{-march=mips2}.
20376 Equivalent to @option{-march=mips3}.
20380 Equivalent to @option{-march=mips4}.
20384 Equivalent to @option{-march=mips32}.
20388 Equivalent to @option{-march=mips32r3}.
20392 Equivalent to @option{-march=mips32r5}.
20396 Equivalent to @option{-march=mips32r6}.
20400 Equivalent to @option{-march=mips64}.
20404 Equivalent to @option{-march=mips64r2}.
20408 Equivalent to @option{-march=mips64r3}.
20412 Equivalent to @option{-march=mips64r5}.
20416 Equivalent to @option{-march=mips64r6}.
20421 @opindex mno-mips16
20422 Generate (do not generate) MIPS16 code. If GCC is targeting a
20423 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
20425 MIPS16 code generation can also be controlled on a per-function basis
20426 by means of @code{mips16} and @code{nomips16} attributes.
20427 @xref{Function Attributes}, for more information.
20429 @item -mflip-mips16
20430 @opindex mflip-mips16
20431 Generate MIPS16 code on alternating functions. This option is provided
20432 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
20433 not intended for ordinary use in compiling user code.
20435 @item -minterlink-compressed
20436 @itemx -mno-interlink-compressed
20437 @opindex minterlink-compressed
20438 @opindex mno-interlink-compressed
20439 Require (do not require) that code using the standard (uncompressed) MIPS ISA
20440 be link-compatible with MIPS16 and microMIPS code, and vice versa.
20442 For example, code using the standard ISA encoding cannot jump directly
20443 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
20444 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
20445 knows that the target of the jump is not compressed.
20447 @item -minterlink-mips16
20448 @itemx -mno-interlink-mips16
20449 @opindex minterlink-mips16
20450 @opindex mno-interlink-mips16
20451 Aliases of @option{-minterlink-compressed} and
20452 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
20453 and are retained for backwards compatibility.
20465 Generate code for the given ABI@.
20467 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
20468 generates 64-bit code when you select a 64-bit architecture, but you
20469 can use @option{-mgp32} to get 32-bit code instead.
20471 For information about the O64 ABI, see
20472 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
20474 GCC supports a variant of the o32 ABI in which floating-point registers
20475 are 64 rather than 32 bits wide. You can select this combination with
20476 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
20477 and @code{mfhc1} instructions and is therefore only supported for
20478 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
20480 The register assignments for arguments and return values remain the
20481 same, but each scalar value is passed in a single 64-bit register
20482 rather than a pair of 32-bit registers. For example, scalar
20483 floating-point values are returned in @samp{$f0} only, not a
20484 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
20485 remains the same in that the even-numbered double-precision registers
20488 Two additional variants of the o32 ABI are supported to enable
20489 a transition from 32-bit to 64-bit registers. These are FPXX
20490 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
20491 The FPXX extension mandates that all code must execute correctly
20492 when run using 32-bit or 64-bit registers. The code can be interlinked
20493 with either FP32 or FP64, but not both.
20494 The FP64A extension is similar to the FP64 extension but forbids the
20495 use of odd-numbered single-precision registers. This can be used
20496 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
20497 processors and allows both FP32 and FP64A code to interlink and
20498 run in the same process without changing FPU modes.
20501 @itemx -mno-abicalls
20503 @opindex mno-abicalls
20504 Generate (do not generate) code that is suitable for SVR4-style
20505 dynamic objects. @option{-mabicalls} is the default for SVR4-based
20510 Generate (do not generate) code that is fully position-independent,
20511 and that can therefore be linked into shared libraries. This option
20512 only affects @option{-mabicalls}.
20514 All @option{-mabicalls} code has traditionally been position-independent,
20515 regardless of options like @option{-fPIC} and @option{-fpic}. However,
20516 as an extension, the GNU toolchain allows executables to use absolute
20517 accesses for locally-binding symbols. It can also use shorter GP
20518 initialization sequences and generate direct calls to locally-defined
20519 functions. This mode is selected by @option{-mno-shared}.
20521 @option{-mno-shared} depends on binutils 2.16 or higher and generates
20522 objects that can only be linked by the GNU linker. However, the option
20523 does not affect the ABI of the final executable; it only affects the ABI
20524 of relocatable objects. Using @option{-mno-shared} generally makes
20525 executables both smaller and quicker.
20527 @option{-mshared} is the default.
20533 Assume (do not assume) that the static and dynamic linkers
20534 support PLTs and copy relocations. This option only affects
20535 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
20536 has no effect without @option{-msym32}.
20538 You can make @option{-mplt} the default by configuring
20539 GCC with @option{--with-mips-plt}. The default is
20540 @option{-mno-plt} otherwise.
20546 Lift (do not lift) the usual restrictions on the size of the global
20549 GCC normally uses a single instruction to load values from the GOT@.
20550 While this is relatively efficient, it only works if the GOT
20551 is smaller than about 64k. Anything larger causes the linker
20552 to report an error such as:
20554 @cindex relocation truncated to fit (MIPS)
20556 relocation truncated to fit: R_MIPS_GOT16 foobar
20559 If this happens, you should recompile your code with @option{-mxgot}.
20560 This works with very large GOTs, although the code is also
20561 less efficient, since it takes three instructions to fetch the
20562 value of a global symbol.
20564 Note that some linkers can create multiple GOTs. If you have such a
20565 linker, you should only need to use @option{-mxgot} when a single object
20566 file accesses more than 64k's worth of GOT entries. Very few do.
20568 These options have no effect unless GCC is generating position
20573 Assume that general-purpose registers are 32 bits wide.
20577 Assume that general-purpose registers are 64 bits wide.
20581 Assume that floating-point registers are 32 bits wide.
20585 Assume that floating-point registers are 64 bits wide.
20589 Do not assume the width of floating-point registers.
20592 @opindex mhard-float
20593 Use floating-point coprocessor instructions.
20596 @opindex msoft-float
20597 Do not use floating-point coprocessor instructions. Implement
20598 floating-point calculations using library calls instead.
20602 Equivalent to @option{-msoft-float}, but additionally asserts that the
20603 program being compiled does not perform any floating-point operations.
20604 This option is presently supported only by some bare-metal MIPS
20605 configurations, where it may select a special set of libraries
20606 that lack all floating-point support (including, for example, the
20607 floating-point @code{printf} formats).
20608 If code compiled with @option{-mno-float} accidentally contains
20609 floating-point operations, it is likely to suffer a link-time
20610 or run-time failure.
20612 @item -msingle-float
20613 @opindex msingle-float
20614 Assume that the floating-point coprocessor only supports single-precision
20617 @item -mdouble-float
20618 @opindex mdouble-float
20619 Assume that the floating-point coprocessor supports double-precision
20620 operations. This is the default.
20623 @itemx -mno-odd-spreg
20624 @opindex modd-spreg
20625 @opindex mno-odd-spreg
20626 Enable the use of odd-numbered single-precision floating-point registers
20627 for the o32 ABI. This is the default for processors that are known to
20628 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
20632 @itemx -mabs=legacy
20634 @opindex mabs=legacy
20635 These options control the treatment of the special not-a-number (NaN)
20636 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
20637 @code{neg.@i{fmt}} machine instructions.
20639 By default or when @option{-mabs=legacy} is used the legacy
20640 treatment is selected. In this case these instructions are considered
20641 arithmetic and avoided where correct operation is required and the
20642 input operand might be a NaN. A longer sequence of instructions that
20643 manipulate the sign bit of floating-point datum manually is used
20644 instead unless the @option{-ffinite-math-only} option has also been
20647 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
20648 this case these instructions are considered non-arithmetic and therefore
20649 operating correctly in all cases, including in particular where the
20650 input operand is a NaN. These instructions are therefore always used
20651 for the respective operations.
20654 @itemx -mnan=legacy
20656 @opindex mnan=legacy
20657 These options control the encoding of the special not-a-number (NaN)
20658 IEEE 754 floating-point data.
20660 The @option{-mnan=legacy} option selects the legacy encoding. In this
20661 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
20662 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
20663 by the first bit of their trailing significand field being 1.
20665 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
20666 this case qNaNs are denoted by the first bit of their trailing
20667 significand field being 1, whereas sNaNs are denoted by the first bit of
20668 their trailing significand field being 0.
20670 The default is @option{-mnan=legacy} unless GCC has been configured with
20671 @option{--with-nan=2008}.
20677 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
20678 implement atomic memory built-in functions. When neither option is
20679 specified, GCC uses the instructions if the target architecture
20682 @option{-mllsc} is useful if the runtime environment can emulate the
20683 instructions and @option{-mno-llsc} can be useful when compiling for
20684 nonstandard ISAs. You can make either option the default by
20685 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
20686 respectively. @option{--with-llsc} is the default for some
20687 configurations; see the installation documentation for details.
20693 Use (do not use) revision 1 of the MIPS DSP ASE@.
20694 @xref{MIPS DSP Built-in Functions}. This option defines the
20695 preprocessor macro @code{__mips_dsp}. It also defines
20696 @code{__mips_dsp_rev} to 1.
20702 Use (do not use) revision 2 of the MIPS DSP ASE@.
20703 @xref{MIPS DSP Built-in Functions}. This option defines the
20704 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
20705 It also defines @code{__mips_dsp_rev} to 2.
20708 @itemx -mno-smartmips
20709 @opindex msmartmips
20710 @opindex mno-smartmips
20711 Use (do not use) the MIPS SmartMIPS ASE.
20713 @item -mpaired-single
20714 @itemx -mno-paired-single
20715 @opindex mpaired-single
20716 @opindex mno-paired-single
20717 Use (do not use) paired-single floating-point instructions.
20718 @xref{MIPS Paired-Single Support}. This option requires
20719 hardware floating-point support to be enabled.
20725 Use (do not use) MIPS Digital Media Extension instructions.
20726 This option can only be used when generating 64-bit code and requires
20727 hardware floating-point support to be enabled.
20732 @opindex mno-mips3d
20733 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
20734 The option @option{-mips3d} implies @option{-mpaired-single}.
20737 @itemx -mno-micromips
20738 @opindex mmicromips
20739 @opindex mno-mmicromips
20740 Generate (do not generate) microMIPS code.
20742 MicroMIPS code generation can also be controlled on a per-function basis
20743 by means of @code{micromips} and @code{nomicromips} attributes.
20744 @xref{Function Attributes}, for more information.
20750 Use (do not use) MT Multithreading instructions.
20756 Use (do not use) the MIPS MCU ASE instructions.
20762 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
20768 Use (do not use) the MIPS Virtualization (VZ) instructions.
20774 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
20780 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
20786 Use (do not use) the MIPS Global INValidate (GINV) instructions.
20790 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
20791 an explanation of the default and the way that the pointer size is
20796 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
20798 The default size of @code{int}s, @code{long}s and pointers depends on
20799 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
20800 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
20801 32-bit @code{long}s. Pointers are the same size as @code{long}s,
20802 or the same size as integer registers, whichever is smaller.
20808 Assume (do not assume) that all symbols have 32-bit values, regardless
20809 of the selected ABI@. This option is useful in combination with
20810 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
20811 to generate shorter and faster references to symbolic addresses.
20815 Put definitions of externally-visible data in a small data section
20816 if that data is no bigger than @var{num} bytes. GCC can then generate
20817 more efficient accesses to the data; see @option{-mgpopt} for details.
20819 The default @option{-G} option depends on the configuration.
20821 @item -mlocal-sdata
20822 @itemx -mno-local-sdata
20823 @opindex mlocal-sdata
20824 @opindex mno-local-sdata
20825 Extend (do not extend) the @option{-G} behavior to local data too,
20826 such as to static variables in C@. @option{-mlocal-sdata} is the
20827 default for all configurations.
20829 If the linker complains that an application is using too much small data,
20830 you might want to try rebuilding the less performance-critical parts with
20831 @option{-mno-local-sdata}. You might also want to build large
20832 libraries with @option{-mno-local-sdata}, so that the libraries leave
20833 more room for the main program.
20835 @item -mextern-sdata
20836 @itemx -mno-extern-sdata
20837 @opindex mextern-sdata
20838 @opindex mno-extern-sdata
20839 Assume (do not assume) that externally-defined data is in
20840 a small data section if the size of that data is within the @option{-G} limit.
20841 @option{-mextern-sdata} is the default for all configurations.
20843 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
20844 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
20845 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
20846 is placed in a small data section. If @var{Var} is defined by another
20847 module, you must either compile that module with a high-enough
20848 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
20849 definition. If @var{Var} is common, you must link the application
20850 with a high-enough @option{-G} setting.
20852 The easiest way of satisfying these restrictions is to compile
20853 and link every module with the same @option{-G} option. However,
20854 you may wish to build a library that supports several different
20855 small data limits. You can do this by compiling the library with
20856 the highest supported @option{-G} setting and additionally using
20857 @option{-mno-extern-sdata} to stop the library from making assumptions
20858 about externally-defined data.
20864 Use (do not use) GP-relative accesses for symbols that are known to be
20865 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
20866 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
20869 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
20870 might not hold the value of @code{_gp}. For example, if the code is
20871 part of a library that might be used in a boot monitor, programs that
20872 call boot monitor routines pass an unknown value in @code{$gp}.
20873 (In such situations, the boot monitor itself is usually compiled
20874 with @option{-G0}.)
20876 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
20877 @option{-mno-extern-sdata}.
20879 @item -membedded-data
20880 @itemx -mno-embedded-data
20881 @opindex membedded-data
20882 @opindex mno-embedded-data
20883 Allocate variables to the read-only data section first if possible, then
20884 next in the small data section if possible, otherwise in data. This gives
20885 slightly slower code than the default, but reduces the amount of RAM required
20886 when executing, and thus may be preferred for some embedded systems.
20888 @item -muninit-const-in-rodata
20889 @itemx -mno-uninit-const-in-rodata
20890 @opindex muninit-const-in-rodata
20891 @opindex mno-uninit-const-in-rodata
20892 Put uninitialized @code{const} variables in the read-only data section.
20893 This option is only meaningful in conjunction with @option{-membedded-data}.
20895 @item -mcode-readable=@var{setting}
20896 @opindex mcode-readable
20897 Specify whether GCC may generate code that reads from executable sections.
20898 There are three possible settings:
20901 @item -mcode-readable=yes
20902 Instructions may freely access executable sections. This is the
20905 @item -mcode-readable=pcrel
20906 MIPS16 PC-relative load instructions can access executable sections,
20907 but other instructions must not do so. This option is useful on 4KSc
20908 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
20909 It is also useful on processors that can be configured to have a dual
20910 instruction/data SRAM interface and that, like the M4K, automatically
20911 redirect PC-relative loads to the instruction RAM.
20913 @item -mcode-readable=no
20914 Instructions must not access executable sections. This option can be
20915 useful on targets that are configured to have a dual instruction/data
20916 SRAM interface but that (unlike the M4K) do not automatically redirect
20917 PC-relative loads to the instruction RAM.
20920 @item -msplit-addresses
20921 @itemx -mno-split-addresses
20922 @opindex msplit-addresses
20923 @opindex mno-split-addresses
20924 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
20925 relocation operators. This option has been superseded by
20926 @option{-mexplicit-relocs} but is retained for backwards compatibility.
20928 @item -mexplicit-relocs
20929 @itemx -mno-explicit-relocs
20930 @opindex mexplicit-relocs
20931 @opindex mno-explicit-relocs
20932 Use (do not use) assembler relocation operators when dealing with symbolic
20933 addresses. The alternative, selected by @option{-mno-explicit-relocs},
20934 is to use assembler macros instead.
20936 @option{-mexplicit-relocs} is the default if GCC was configured
20937 to use an assembler that supports relocation operators.
20939 @item -mcheck-zero-division
20940 @itemx -mno-check-zero-division
20941 @opindex mcheck-zero-division
20942 @opindex mno-check-zero-division
20943 Trap (do not trap) on integer division by zero.
20945 The default is @option{-mcheck-zero-division}.
20947 @item -mdivide-traps
20948 @itemx -mdivide-breaks
20949 @opindex mdivide-traps
20950 @opindex mdivide-breaks
20951 MIPS systems check for division by zero by generating either a
20952 conditional trap or a break instruction. Using traps results in
20953 smaller code, but is only supported on MIPS II and later. Also, some
20954 versions of the Linux kernel have a bug that prevents trap from
20955 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
20956 allow conditional traps on architectures that support them and
20957 @option{-mdivide-breaks} to force the use of breaks.
20959 The default is usually @option{-mdivide-traps}, but this can be
20960 overridden at configure time using @option{--with-divide=breaks}.
20961 Divide-by-zero checks can be completely disabled using
20962 @option{-mno-check-zero-division}.
20964 @item -mload-store-pairs
20965 @itemx -mno-load-store-pairs
20966 @opindex mload-store-pairs
20967 @opindex mno-load-store-pairs
20968 Enable (disable) an optimization that pairs consecutive load or store
20969 instructions to enable load/store bonding. This option is enabled by
20970 default but only takes effect when the selected architecture is known
20971 to support bonding.
20976 @opindex mno-memcpy
20977 Force (do not force) the use of @code{memcpy} for non-trivial block
20978 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
20979 most constant-sized copies.
20982 @itemx -mno-long-calls
20983 @opindex mlong-calls
20984 @opindex mno-long-calls
20985 Disable (do not disable) use of the @code{jal} instruction. Calling
20986 functions using @code{jal} is more efficient but requires the caller
20987 and callee to be in the same 256 megabyte segment.
20989 This option has no effect on abicalls code. The default is
20990 @option{-mno-long-calls}.
20996 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
20997 instructions, as provided by the R4650 ISA@.
21003 Enable (disable) use of the @code{madd} and @code{msub} integer
21004 instructions. The default is @option{-mimadd} on architectures
21005 that support @code{madd} and @code{msub} except for the 74k
21006 architecture where it was found to generate slower code.
21009 @itemx -mno-fused-madd
21010 @opindex mfused-madd
21011 @opindex mno-fused-madd
21012 Enable (disable) use of the floating-point multiply-accumulate
21013 instructions, when they are available. The default is
21014 @option{-mfused-madd}.
21016 On the R8000 CPU when multiply-accumulate instructions are used,
21017 the intermediate product is calculated to infinite precision
21018 and is not subject to the FCSR Flush to Zero bit. This may be
21019 undesirable in some circumstances. On other processors the result
21020 is numerically identical to the equivalent computation using
21021 separate multiply, add, subtract and negate instructions.
21025 Tell the MIPS assembler to not run its preprocessor over user
21026 assembler files (with a @samp{.s} suffix) when assembling them.
21029 @itemx -mno-fix-24k
21031 @opindex mno-fix-24k
21032 Work around the 24K E48 (lost data on stores during refill) errata.
21033 The workarounds are implemented by the assembler rather than by GCC@.
21036 @itemx -mno-fix-r4000
21037 @opindex mfix-r4000
21038 @opindex mno-fix-r4000
21039 Work around certain R4000 CPU errata:
21042 A double-word or a variable shift may give an incorrect result if executed
21043 immediately after starting an integer division.
21045 A double-word or a variable shift may give an incorrect result if executed
21046 while an integer multiplication is in progress.
21048 An integer division may give an incorrect result if started in a delay slot
21049 of a taken branch or a jump.
21053 @itemx -mno-fix-r4400
21054 @opindex mfix-r4400
21055 @opindex mno-fix-r4400
21056 Work around certain R4400 CPU errata:
21059 A double-word or a variable shift may give an incorrect result if executed
21060 immediately after starting an integer division.
21064 @itemx -mno-fix-r10000
21065 @opindex mfix-r10000
21066 @opindex mno-fix-r10000
21067 Work around certain R10000 errata:
21070 @code{ll}/@code{sc} sequences may not behave atomically on revisions
21071 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
21074 This option can only be used if the target architecture supports
21075 branch-likely instructions. @option{-mfix-r10000} is the default when
21076 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
21080 @itemx -mno-fix-rm7000
21081 @opindex mfix-rm7000
21082 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
21083 workarounds are implemented by the assembler rather than by GCC@.
21086 @itemx -mno-fix-vr4120
21087 @opindex mfix-vr4120
21088 Work around certain VR4120 errata:
21091 @code{dmultu} does not always produce the correct result.
21093 @code{div} and @code{ddiv} do not always produce the correct result if one
21094 of the operands is negative.
21096 The workarounds for the division errata rely on special functions in
21097 @file{libgcc.a}. At present, these functions are only provided by
21098 the @code{mips64vr*-elf} configurations.
21100 Other VR4120 errata require a NOP to be inserted between certain pairs of
21101 instructions. These errata are handled by the assembler, not by GCC itself.
21104 @opindex mfix-vr4130
21105 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
21106 workarounds are implemented by the assembler rather than by GCC,
21107 although GCC avoids using @code{mflo} and @code{mfhi} if the
21108 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
21109 instructions are available instead.
21112 @itemx -mno-fix-sb1
21114 Work around certain SB-1 CPU core errata.
21115 (This flag currently works around the SB-1 revision 2
21116 ``F1'' and ``F2'' floating-point errata.)
21118 @item -mr10k-cache-barrier=@var{setting}
21119 @opindex mr10k-cache-barrier
21120 Specify whether GCC should insert cache barriers to avoid the
21121 side effects of speculation on R10K processors.
21123 In common with many processors, the R10K tries to predict the outcome
21124 of a conditional branch and speculatively executes instructions from
21125 the ``taken'' branch. It later aborts these instructions if the
21126 predicted outcome is wrong. However, on the R10K, even aborted
21127 instructions can have side effects.
21129 This problem only affects kernel stores and, depending on the system,
21130 kernel loads. As an example, a speculatively-executed store may load
21131 the target memory into cache and mark the cache line as dirty, even if
21132 the store itself is later aborted. If a DMA operation writes to the
21133 same area of memory before the ``dirty'' line is flushed, the cached
21134 data overwrites the DMA-ed data. See the R10K processor manual
21135 for a full description, including other potential problems.
21137 One workaround is to insert cache barrier instructions before every memory
21138 access that might be speculatively executed and that might have side
21139 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
21140 controls GCC's implementation of this workaround. It assumes that
21141 aborted accesses to any byte in the following regions does not have
21146 the memory occupied by the current function's stack frame;
21149 the memory occupied by an incoming stack argument;
21152 the memory occupied by an object with a link-time-constant address.
21155 It is the kernel's responsibility to ensure that speculative
21156 accesses to these regions are indeed safe.
21158 If the input program contains a function declaration such as:
21164 then the implementation of @code{foo} must allow @code{j foo} and
21165 @code{jal foo} to be executed speculatively. GCC honors this
21166 restriction for functions it compiles itself. It expects non-GCC
21167 functions (such as hand-written assembly code) to do the same.
21169 The option has three forms:
21172 @item -mr10k-cache-barrier=load-store
21173 Insert a cache barrier before a load or store that might be
21174 speculatively executed and that might have side effects even
21177 @item -mr10k-cache-barrier=store
21178 Insert a cache barrier before a store that might be speculatively
21179 executed and that might have side effects even if aborted.
21181 @item -mr10k-cache-barrier=none
21182 Disable the insertion of cache barriers. This is the default setting.
21185 @item -mflush-func=@var{func}
21186 @itemx -mno-flush-func
21187 @opindex mflush-func
21188 Specifies the function to call to flush the I and D caches, or to not
21189 call any such function. If called, the function must take the same
21190 arguments as the common @code{_flush_func}, that is, the address of the
21191 memory range for which the cache is being flushed, the size of the
21192 memory range, and the number 3 (to flush both caches). The default
21193 depends on the target GCC was configured for, but commonly is either
21194 @code{_flush_func} or @code{__cpu_flush}.
21196 @item mbranch-cost=@var{num}
21197 @opindex mbranch-cost
21198 Set the cost of branches to roughly @var{num} ``simple'' instructions.
21199 This cost is only a heuristic and is not guaranteed to produce
21200 consistent results across releases. A zero cost redundantly selects
21201 the default, which is based on the @option{-mtune} setting.
21203 @item -mbranch-likely
21204 @itemx -mno-branch-likely
21205 @opindex mbranch-likely
21206 @opindex mno-branch-likely
21207 Enable or disable use of Branch Likely instructions, regardless of the
21208 default for the selected architecture. By default, Branch Likely
21209 instructions may be generated if they are supported by the selected
21210 architecture. An exception is for the MIPS32 and MIPS64 architectures
21211 and processors that implement those architectures; for those, Branch
21212 Likely instructions are not be generated by default because the MIPS32
21213 and MIPS64 architectures specifically deprecate their use.
21215 @item -mcompact-branches=never
21216 @itemx -mcompact-branches=optimal
21217 @itemx -mcompact-branches=always
21218 @opindex mcompact-branches=never
21219 @opindex mcompact-branches=optimal
21220 @opindex mcompact-branches=always
21221 These options control which form of branches will be generated. The
21222 default is @option{-mcompact-branches=optimal}.
21224 The @option{-mcompact-branches=never} option ensures that compact branch
21225 instructions will never be generated.
21227 The @option{-mcompact-branches=always} option ensures that a compact
21228 branch instruction will be generated if available. If a compact branch
21229 instruction is not available, a delay slot form of the branch will be
21232 This option is supported from MIPS Release 6 onwards.
21234 The @option{-mcompact-branches=optimal} option will cause a delay slot
21235 branch to be used if one is available in the current ISA and the delay
21236 slot is successfully filled. If the delay slot is not filled, a compact
21237 branch will be chosen if one is available.
21239 @item -mfp-exceptions
21240 @itemx -mno-fp-exceptions
21241 @opindex mfp-exceptions
21242 Specifies whether FP exceptions are enabled. This affects how
21243 FP instructions are scheduled for some processors.
21244 The default is that FP exceptions are
21247 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
21248 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
21251 @item -mvr4130-align
21252 @itemx -mno-vr4130-align
21253 @opindex mvr4130-align
21254 The VR4130 pipeline is two-way superscalar, but can only issue two
21255 instructions together if the first one is 8-byte aligned. When this
21256 option is enabled, GCC aligns pairs of instructions that it
21257 thinks should execute in parallel.
21259 This option only has an effect when optimizing for the VR4130.
21260 It normally makes code faster, but at the expense of making it bigger.
21261 It is enabled by default at optimization level @option{-O3}.
21266 Enable (disable) generation of @code{synci} instructions on
21267 architectures that support it. The @code{synci} instructions (if
21268 enabled) are generated when @code{__builtin___clear_cache} is
21271 This option defaults to @option{-mno-synci}, but the default can be
21272 overridden by configuring GCC with @option{--with-synci}.
21274 When compiling code for single processor systems, it is generally safe
21275 to use @code{synci}. However, on many multi-core (SMP) systems, it
21276 does not invalidate the instruction caches on all cores and may lead
21277 to undefined behavior.
21279 @item -mrelax-pic-calls
21280 @itemx -mno-relax-pic-calls
21281 @opindex mrelax-pic-calls
21282 Try to turn PIC calls that are normally dispatched via register
21283 @code{$25} into direct calls. This is only possible if the linker can
21284 resolve the destination at link time and if the destination is within
21285 range for a direct call.
21287 @option{-mrelax-pic-calls} is the default if GCC was configured to use
21288 an assembler and a linker that support the @code{.reloc} assembly
21289 directive and @option{-mexplicit-relocs} is in effect. With
21290 @option{-mno-explicit-relocs}, this optimization can be performed by the
21291 assembler and the linker alone without help from the compiler.
21293 @item -mmcount-ra-address
21294 @itemx -mno-mcount-ra-address
21295 @opindex mmcount-ra-address
21296 @opindex mno-mcount-ra-address
21297 Emit (do not emit) code that allows @code{_mcount} to modify the
21298 calling function's return address. When enabled, this option extends
21299 the usual @code{_mcount} interface with a new @var{ra-address}
21300 parameter, which has type @code{intptr_t *} and is passed in register
21301 @code{$12}. @code{_mcount} can then modify the return address by
21302 doing both of the following:
21305 Returning the new address in register @code{$31}.
21307 Storing the new address in @code{*@var{ra-address}},
21308 if @var{ra-address} is nonnull.
21311 The default is @option{-mno-mcount-ra-address}.
21313 @item -mframe-header-opt
21314 @itemx -mno-frame-header-opt
21315 @opindex mframe-header-opt
21316 Enable (disable) frame header optimization in the o32 ABI. When using the
21317 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
21318 function to write out register arguments. When enabled, this optimization
21319 will suppress the allocation of the frame header if it can be determined that
21322 This optimization is off by default at all optimization levels.
21325 @itemx -mno-lxc1-sxc1
21326 @opindex mlxc1-sxc1
21327 When applicable, enable (disable) the generation of @code{lwxc1},
21328 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
21333 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
21334 @code{madd.d} and related instructions. Enabled by default.
21339 @subsection MMIX Options
21340 @cindex MMIX Options
21342 These options are defined for the MMIX:
21346 @itemx -mno-libfuncs
21348 @opindex mno-libfuncs
21349 Specify that intrinsic library functions are being compiled, passing all
21350 values in registers, no matter the size.
21353 @itemx -mno-epsilon
21355 @opindex mno-epsilon
21356 Generate floating-point comparison instructions that compare with respect
21357 to the @code{rE} epsilon register.
21359 @item -mabi=mmixware
21361 @opindex mabi=mmixware
21363 Generate code that passes function parameters and return values that (in
21364 the called function) are seen as registers @code{$0} and up, as opposed to
21365 the GNU ABI which uses global registers @code{$231} and up.
21367 @item -mzero-extend
21368 @itemx -mno-zero-extend
21369 @opindex mzero-extend
21370 @opindex mno-zero-extend
21371 When reading data from memory in sizes shorter than 64 bits, use (do not
21372 use) zero-extending load instructions by default, rather than
21373 sign-extending ones.
21376 @itemx -mno-knuthdiv
21378 @opindex mno-knuthdiv
21379 Make the result of a division yielding a remainder have the same sign as
21380 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
21381 remainder follows the sign of the dividend. Both methods are
21382 arithmetically valid, the latter being almost exclusively used.
21384 @item -mtoplevel-symbols
21385 @itemx -mno-toplevel-symbols
21386 @opindex mtoplevel-symbols
21387 @opindex mno-toplevel-symbols
21388 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
21389 code can be used with the @code{PREFIX} assembly directive.
21393 Generate an executable in the ELF format, rather than the default
21394 @samp{mmo} format used by the @command{mmix} simulator.
21396 @item -mbranch-predict
21397 @itemx -mno-branch-predict
21398 @opindex mbranch-predict
21399 @opindex mno-branch-predict
21400 Use (do not use) the probable-branch instructions, when static branch
21401 prediction indicates a probable branch.
21403 @item -mbase-addresses
21404 @itemx -mno-base-addresses
21405 @opindex mbase-addresses
21406 @opindex mno-base-addresses
21407 Generate (do not generate) code that uses @emph{base addresses}. Using a
21408 base address automatically generates a request (handled by the assembler
21409 and the linker) for a constant to be set up in a global register. The
21410 register is used for one or more base address requests within the range 0
21411 to 255 from the value held in the register. The generally leads to short
21412 and fast code, but the number of different data items that can be
21413 addressed is limited. This means that a program that uses lots of static
21414 data may require @option{-mno-base-addresses}.
21416 @item -msingle-exit
21417 @itemx -mno-single-exit
21418 @opindex msingle-exit
21419 @opindex mno-single-exit
21420 Force (do not force) generated code to have a single exit point in each
21424 @node MN10300 Options
21425 @subsection MN10300 Options
21426 @cindex MN10300 options
21428 These @option{-m} options are defined for Matsushita MN10300 architectures:
21433 Generate code to avoid bugs in the multiply instructions for the MN10300
21434 processors. This is the default.
21436 @item -mno-mult-bug
21437 @opindex mno-mult-bug
21438 Do not generate code to avoid bugs in the multiply instructions for the
21439 MN10300 processors.
21443 Generate code using features specific to the AM33 processor.
21447 Do not generate code using features specific to the AM33 processor. This
21452 Generate code using features specific to the AM33/2.0 processor.
21456 Generate code using features specific to the AM34 processor.
21458 @item -mtune=@var{cpu-type}
21460 Use the timing characteristics of the indicated CPU type when
21461 scheduling instructions. This does not change the targeted processor
21462 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
21463 @samp{am33-2} or @samp{am34}.
21465 @item -mreturn-pointer-on-d0
21466 @opindex mreturn-pointer-on-d0
21467 When generating a function that returns a pointer, return the pointer
21468 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
21469 only in @code{a0}, and attempts to call such functions without a prototype
21470 result in errors. Note that this option is on by default; use
21471 @option{-mno-return-pointer-on-d0} to disable it.
21475 Do not link in the C run-time initialization object file.
21479 Indicate to the linker that it should perform a relaxation optimization pass
21480 to shorten branches, calls and absolute memory addresses. This option only
21481 has an effect when used on the command line for the final link step.
21483 This option makes symbolic debugging impossible.
21487 Allow the compiler to generate @emph{Long Instruction Word}
21488 instructions if the target is the @samp{AM33} or later. This is the
21489 default. This option defines the preprocessor macro @code{__LIW__}.
21493 Do not allow the compiler to generate @emph{Long Instruction Word}
21494 instructions. This option defines the preprocessor macro
21499 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
21500 instructions if the target is the @samp{AM33} or later. This is the
21501 default. This option defines the preprocessor macro @code{__SETLB__}.
21505 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
21506 instructions. This option defines the preprocessor macro
21507 @code{__NO_SETLB__}.
21511 @node Moxie Options
21512 @subsection Moxie Options
21513 @cindex Moxie Options
21519 Generate big-endian code. This is the default for @samp{moxie-*-*}
21524 Generate little-endian code.
21528 Generate mul.x and umul.x instructions. This is the default for
21529 @samp{moxiebox-*-*} configurations.
21533 Do not link in the C run-time initialization object file.
21537 @node MSP430 Options
21538 @subsection MSP430 Options
21539 @cindex MSP430 Options
21541 These options are defined for the MSP430:
21547 Force assembly output to always use hex constants. Normally such
21548 constants are signed decimals, but this option is available for
21549 testsuite and/or aesthetic purposes.
21553 Select the MCU to target. This is used to create a C preprocessor
21554 symbol based upon the MCU name, converted to upper case and pre- and
21555 post-fixed with @samp{__}. This in turn is used by the
21556 @file{msp430.h} header file to select an MCU-specific supplementary
21559 The option also sets the ISA to use. If the MCU name is one that is
21560 known to only support the 430 ISA then that is selected, otherwise the
21561 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
21562 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
21563 name selects the 430X ISA.
21565 In addition an MCU-specific linker script is added to the linker
21566 command line. The script's name is the name of the MCU with
21567 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
21568 command line defines the C preprocessor symbol @code{__XXX__} and
21569 cause the linker to search for a script called @file{xxx.ld}.
21571 This option is also passed on to the assembler.
21574 @itemx -mno-warn-mcu
21576 @opindex mno-warn-mcu
21577 This option enables or disables warnings about conflicts between the
21578 MCU name specified by the @option{-mmcu} option and the ISA set by the
21579 @option{-mcpu} option and/or the hardware multiply support set by the
21580 @option{-mhwmult} option. It also toggles warnings about unrecognized
21581 MCU names. This option is on by default.
21585 Specifies the ISA to use. Accepted values are @samp{msp430},
21586 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
21587 @option{-mmcu=} option should be used to select the ISA.
21591 Link to the simulator runtime libraries and linker script. Overrides
21592 any scripts that would be selected by the @option{-mmcu=} option.
21596 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
21600 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
21604 This option is passed to the assembler and linker, and allows the
21605 linker to perform certain optimizations that cannot be done until
21610 Describes the type of hardware multiply supported by the target.
21611 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
21612 for the original 16-bit-only multiply supported by early MCUs.
21613 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
21614 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
21615 A value of @samp{auto} can also be given. This tells GCC to deduce
21616 the hardware multiply support based upon the MCU name provided by the
21617 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
21618 the MCU name is not recognized then no hardware multiply support is
21619 assumed. @code{auto} is the default setting.
21621 Hardware multiplies are normally performed by calling a library
21622 routine. This saves space in the generated code. When compiling at
21623 @option{-O3} or higher however the hardware multiplier is invoked
21624 inline. This makes for bigger, but faster code.
21626 The hardware multiply routines disable interrupts whilst running and
21627 restore the previous interrupt state when they finish. This makes
21628 them safe to use inside interrupt handlers as well as in normal code.
21632 Enable the use of a minimum runtime environment - no static
21633 initializers or constructors. This is intended for memory-constrained
21634 devices. The compiler includes special symbols in some objects
21635 that tell the linker and runtime which code fragments are required.
21637 @item -mcode-region=
21638 @itemx -mdata-region=
21639 @opindex mcode-region
21640 @opindex mdata-region
21641 These options tell the compiler where to place functions and data that
21642 do not have one of the @code{lower}, @code{upper}, @code{either} or
21643 @code{section} attributes. Possible values are @code{lower},
21644 @code{upper}, @code{either} or @code{any}. The first three behave
21645 like the corresponding attribute. The fourth possible value -
21646 @code{any} - is the default. It leaves placement entirely up to the
21647 linker script and how it assigns the standard sections
21648 (@code{.text}, @code{.data}, etc) to the memory regions.
21650 @item -msilicon-errata=
21651 @opindex msilicon-errata
21652 This option passes on a request to assembler to enable the fixes for
21653 the named silicon errata.
21655 @item -msilicon-errata-warn=
21656 @opindex msilicon-errata-warn
21657 This option passes on a request to the assembler to enable warning
21658 messages when a silicon errata might need to be applied.
21662 @node NDS32 Options
21663 @subsection NDS32 Options
21664 @cindex NDS32 Options
21666 These options are defined for NDS32 implementations:
21671 @opindex mbig-endian
21672 Generate code in big-endian mode.
21674 @item -mlittle-endian
21675 @opindex mlittle-endian
21676 Generate code in little-endian mode.
21678 @item -mreduced-regs
21679 @opindex mreduced-regs
21680 Use reduced-set registers for register allocation.
21683 @opindex mfull-regs
21684 Use full-set registers for register allocation.
21688 Generate conditional move instructions.
21692 Do not generate conditional move instructions.
21696 Generate performance extension instructions.
21698 @item -mno-ext-perf
21699 @opindex mno-perf-ext
21700 Do not generate performance extension instructions.
21704 Generate performance extension 2 instructions.
21706 @item -mno-ext-perf2
21707 @opindex mno-perf-ext
21708 Do not generate performance extension 2 instructions.
21712 Generate string extension instructions.
21714 @item -mno-ext-string
21715 @opindex mno-perf-ext
21716 Do not generate string extension instructions.
21720 Generate v3 push25/pop25 instructions.
21723 @opindex mno-v3push
21724 Do not generate v3 push25/pop25 instructions.
21728 Generate 16-bit instructions.
21731 @opindex mno-16-bit
21732 Do not generate 16-bit instructions.
21734 @item -misr-vector-size=@var{num}
21735 @opindex misr-vector-size
21736 Specify the size of each interrupt vector, which must be 4 or 16.
21738 @item -mcache-block-size=@var{num}
21739 @opindex mcache-block-size
21740 Specify the size of each cache block,
21741 which must be a power of 2 between 4 and 512.
21743 @item -march=@var{arch}
21745 Specify the name of the target architecture.
21747 @item -mcmodel=@var{code-model}
21749 Set the code model to one of
21752 All the data and read-only data segments must be within 512KB addressing space.
21753 The text segment must be within 16MB addressing space.
21754 @item @samp{medium}
21755 The data segment must be within 512KB while the read-only data segment can be
21756 within 4GB addressing space. The text segment should be still within 16MB
21759 All the text and data segments can be within 4GB addressing space.
21763 @opindex mctor-dtor
21764 Enable constructor/destructor feature.
21768 Guide linker to relax instructions.
21772 @node Nios II Options
21773 @subsection Nios II Options
21774 @cindex Nios II options
21775 @cindex Altera Nios II options
21777 These are the options defined for the Altera Nios II processor.
21783 @cindex smaller data references
21784 Put global and static objects less than or equal to @var{num} bytes
21785 into the small data or BSS sections instead of the normal data or BSS
21786 sections. The default value of @var{num} is 8.
21788 @item -mgpopt=@var{option}
21793 Generate (do not generate) GP-relative accesses. The following
21794 @var{option} names are recognized:
21799 Do not generate GP-relative accesses.
21802 Generate GP-relative accesses for small data objects that are not
21803 external, weak, or uninitialized common symbols.
21804 Also use GP-relative addressing for objects that
21805 have been explicitly placed in a small data section via a @code{section}
21809 As for @samp{local}, but also generate GP-relative accesses for
21810 small data objects that are external, weak, or common. If you use this option,
21811 you must ensure that all parts of your program (including libraries) are
21812 compiled with the same @option{-G} setting.
21815 Generate GP-relative accesses for all data objects in the program. If you
21816 use this option, the entire data and BSS segments
21817 of your program must fit in 64K of memory and you must use an appropriate
21818 linker script to allocate them within the addressable range of the
21822 Generate GP-relative addresses for function pointers as well as data
21823 pointers. If you use this option, the entire text, data, and BSS segments
21824 of your program must fit in 64K of memory and you must use an appropriate
21825 linker script to allocate them within the addressable range of the
21830 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
21831 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
21833 The default is @option{-mgpopt} except when @option{-fpic} or
21834 @option{-fPIC} is specified to generate position-independent code.
21835 Note that the Nios II ABI does not permit GP-relative accesses from
21838 You may need to specify @option{-mno-gpopt} explicitly when building
21839 programs that include large amounts of small data, including large
21840 GOT data sections. In this case, the 16-bit offset for GP-relative
21841 addressing may not be large enough to allow access to the entire
21842 small data section.
21844 @item -mgprel-sec=@var{regexp}
21845 @opindex mgprel-sec
21846 This option specifies additional section names that can be accessed via
21847 GP-relative addressing. It is most useful in conjunction with
21848 @code{section} attributes on variable declarations
21849 (@pxref{Common Variable Attributes}) and a custom linker script.
21850 The @var{regexp} is a POSIX Extended Regular Expression.
21852 This option does not affect the behavior of the @option{-G} option, and
21853 the specified sections are in addition to the standard @code{.sdata}
21854 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
21856 @item -mr0rel-sec=@var{regexp}
21857 @opindex mr0rel-sec
21858 This option specifies names of sections that can be accessed via a
21859 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
21860 of the 32-bit address space. It is most useful in conjunction with
21861 @code{section} attributes on variable declarations
21862 (@pxref{Common Variable Attributes}) and a custom linker script.
21863 The @var{regexp} is a POSIX Extended Regular Expression.
21865 In contrast to the use of GP-relative addressing for small data,
21866 zero-based addressing is never generated by default and there are no
21867 conventional section names used in standard linker scripts for sections
21868 in the low or high areas of memory.
21874 Generate little-endian (default) or big-endian (experimental) code,
21877 @item -march=@var{arch}
21879 This specifies the name of the target Nios II architecture. GCC uses this
21880 name to determine what kind of instructions it can emit when generating
21881 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
21883 The preprocessor macro @code{__nios2_arch__} is available to programs,
21884 with value 1 or 2, indicating the targeted ISA level.
21886 @item -mbypass-cache
21887 @itemx -mno-bypass-cache
21888 @opindex mno-bypass-cache
21889 @opindex mbypass-cache
21890 Force all load and store instructions to always bypass cache by
21891 using I/O variants of the instructions. The default is not to
21894 @item -mno-cache-volatile
21895 @itemx -mcache-volatile
21896 @opindex mcache-volatile
21897 @opindex mno-cache-volatile
21898 Volatile memory access bypass the cache using the I/O variants of
21899 the load and store instructions. The default is not to bypass the cache.
21901 @item -mno-fast-sw-div
21902 @itemx -mfast-sw-div
21903 @opindex mno-fast-sw-div
21904 @opindex mfast-sw-div
21905 Do not use table-based fast divide for small numbers. The default
21906 is to use the fast divide at @option{-O3} and above.
21910 @itemx -mno-hw-mulx
21914 @opindex mno-hw-mul
21916 @opindex mno-hw-mulx
21918 @opindex mno-hw-div
21920 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
21921 instructions by the compiler. The default is to emit @code{mul}
21922 and not emit @code{div} and @code{mulx}.
21928 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
21929 CDX (code density) instructions. Enabling these instructions also
21930 requires @option{-march=r2}. Since these instructions are optional
21931 extensions to the R2 architecture, the default is not to emit them.
21933 @item -mcustom-@var{insn}=@var{N}
21934 @itemx -mno-custom-@var{insn}
21935 @opindex mcustom-@var{insn}
21936 @opindex mno-custom-@var{insn}
21937 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
21938 custom instruction with encoding @var{N} when generating code that uses
21939 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
21940 instruction 253 for single-precision floating-point add operations instead
21941 of the default behavior of using a library call.
21943 The following values of @var{insn} are supported. Except as otherwise
21944 noted, floating-point operations are expected to be implemented with
21945 normal IEEE 754 semantics and correspond directly to the C operators or the
21946 equivalent GCC built-in functions (@pxref{Other Builtins}).
21948 Single-precision floating point:
21951 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
21952 Binary arithmetic operations.
21958 Unary absolute value.
21960 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
21961 Comparison operations.
21963 @item @samp{fmins}, @samp{fmaxs}
21964 Floating-point minimum and maximum. These instructions are only
21965 generated if @option{-ffinite-math-only} is specified.
21967 @item @samp{fsqrts}
21968 Unary square root operation.
21970 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
21971 Floating-point trigonometric and exponential functions. These instructions
21972 are only generated if @option{-funsafe-math-optimizations} is also specified.
21976 Double-precision floating point:
21979 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
21980 Binary arithmetic operations.
21986 Unary absolute value.
21988 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
21989 Comparison operations.
21991 @item @samp{fmind}, @samp{fmaxd}
21992 Double-precision minimum and maximum. These instructions are only
21993 generated if @option{-ffinite-math-only} is specified.
21995 @item @samp{fsqrtd}
21996 Unary square root operation.
21998 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
21999 Double-precision trigonometric and exponential functions. These instructions
22000 are only generated if @option{-funsafe-math-optimizations} is also specified.
22006 @item @samp{fextsd}
22007 Conversion from single precision to double precision.
22009 @item @samp{ftruncds}
22010 Conversion from double precision to single precision.
22012 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
22013 Conversion from floating point to signed or unsigned integer types, with
22014 truncation towards zero.
22017 Conversion from single-precision floating point to signed integer,
22018 rounding to the nearest integer and ties away from zero.
22019 This corresponds to the @code{__builtin_lroundf} function when
22020 @option{-fno-math-errno} is used.
22022 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
22023 Conversion from signed or unsigned integer types to floating-point types.
22027 In addition, all of the following transfer instructions for internal
22028 registers X and Y must be provided to use any of the double-precision
22029 floating-point instructions. Custom instructions taking two
22030 double-precision source operands expect the first operand in the
22031 64-bit register X. The other operand (or only operand of a unary
22032 operation) is given to the custom arithmetic instruction with the
22033 least significant half in source register @var{src1} and the most
22034 significant half in @var{src2}. A custom instruction that returns a
22035 double-precision result returns the most significant 32 bits in the
22036 destination register and the other half in 32-bit register Y.
22037 GCC automatically generates the necessary code sequences to write
22038 register X and/or read register Y when double-precision floating-point
22039 instructions are used.
22044 Write @var{src1} into the least significant half of X and @var{src2} into
22045 the most significant half of X.
22048 Write @var{src1} into Y.
22050 @item @samp{frdxhi}, @samp{frdxlo}
22051 Read the most or least (respectively) significant half of X and store it in
22055 Read the value of Y and store it into @var{dest}.
22058 Note that you can gain more local control over generation of Nios II custom
22059 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
22060 and @code{target("no-custom-@var{insn}")} function attributes
22061 (@pxref{Function Attributes})
22062 or pragmas (@pxref{Function Specific Option Pragmas}).
22064 @item -mcustom-fpu-cfg=@var{name}
22065 @opindex mcustom-fpu-cfg
22067 This option enables a predefined, named set of custom instruction encodings
22068 (see @option{-mcustom-@var{insn}} above).
22069 Currently, the following sets are defined:
22071 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
22072 @gccoptlist{-mcustom-fmuls=252 @gol
22073 -mcustom-fadds=253 @gol
22074 -mcustom-fsubs=254 @gol
22075 -fsingle-precision-constant}
22077 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
22078 @gccoptlist{-mcustom-fmuls=252 @gol
22079 -mcustom-fadds=253 @gol
22080 -mcustom-fsubs=254 @gol
22081 -mcustom-fdivs=255 @gol
22082 -fsingle-precision-constant}
22084 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
22085 @gccoptlist{-mcustom-floatus=243 @gol
22086 -mcustom-fixsi=244 @gol
22087 -mcustom-floatis=245 @gol
22088 -mcustom-fcmpgts=246 @gol
22089 -mcustom-fcmples=249 @gol
22090 -mcustom-fcmpeqs=250 @gol
22091 -mcustom-fcmpnes=251 @gol
22092 -mcustom-fmuls=252 @gol
22093 -mcustom-fadds=253 @gol
22094 -mcustom-fsubs=254 @gol
22095 -mcustom-fdivs=255 @gol
22096 -fsingle-precision-constant}
22098 Custom instruction assignments given by individual
22099 @option{-mcustom-@var{insn}=} options override those given by
22100 @option{-mcustom-fpu-cfg=}, regardless of the
22101 order of the options on the command line.
22103 Note that you can gain more local control over selection of a FPU
22104 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
22105 function attribute (@pxref{Function Attributes})
22106 or pragma (@pxref{Function Specific Option Pragmas}).
22110 These additional @samp{-m} options are available for the Altera Nios II
22111 ELF (bare-metal) target:
22117 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
22118 startup and termination code, and is typically used in conjunction with
22119 @option{-msys-crt0=} to specify the location of the alternate startup code
22120 provided by the HAL BSP.
22124 Link with a limited version of the C library, @option{-lsmallc}, rather than
22127 @item -msys-crt0=@var{startfile}
22129 @var{startfile} is the file name of the startfile (crt0) to use
22130 when linking. This option is only useful in conjunction with @option{-mhal}.
22132 @item -msys-lib=@var{systemlib}
22134 @var{systemlib} is the library name of the library that provides
22135 low-level system calls required by the C library,
22136 e.g. @code{read} and @code{write}.
22137 This option is typically used to link with a library provided by a HAL BSP.
22141 @node Nvidia PTX Options
22142 @subsection Nvidia PTX Options
22143 @cindex Nvidia PTX options
22144 @cindex nvptx options
22146 These options are defined for Nvidia PTX:
22154 Generate code for 32-bit or 64-bit ABI.
22157 @opindex mmainkernel
22158 Link in code for a __main kernel. This is for stand-alone instead of
22159 offloading execution.
22163 Apply partitioned execution optimizations. This is the default when any
22164 level of optimization is selected.
22167 @opindex msoft-stack
22168 Generate code that does not use @code{.local} memory
22169 directly for stack storage. Instead, a per-warp stack pointer is
22170 maintained explicitly. This enables variable-length stack allocation (with
22171 variable-length arrays or @code{alloca}), and when global memory is used for
22172 underlying storage, makes it possible to access automatic variables from other
22173 threads, or with atomic instructions. This code generation variant is used
22174 for OpenMP offloading, but the option is exposed on its own for the purpose
22175 of testing the compiler; to generate code suitable for linking into programs
22176 using OpenMP offloading, use option @option{-mgomp}.
22178 @item -muniform-simt
22179 @opindex muniform-simt
22180 Switch to code generation variant that allows to execute all threads in each
22181 warp, while maintaining memory state and side effects as if only one thread
22182 in each warp was active outside of OpenMP SIMD regions. All atomic operations
22183 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
22184 current lane index equals the master lane index), and the register being
22185 assigned is copied via a shuffle instruction from the master lane. Outside of
22186 SIMD regions lane 0 is the master; inside, each thread sees itself as the
22187 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
22188 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
22189 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
22190 with current lane index to compute the master lane index.
22194 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
22195 @option{-muniform-simt} options, and selects corresponding multilib variant.
22199 @node PDP-11 Options
22200 @subsection PDP-11 Options
22201 @cindex PDP-11 Options
22203 These options are defined for the PDP-11:
22208 Use hardware FPP floating point. This is the default. (FIS floating
22209 point on the PDP-11/40 is not supported.) Implies -m45.
22212 @opindex msoft-float
22213 Do not use hardware floating point.
22217 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
22221 Return floating-point results in memory. This is the default.
22225 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
22229 Generate code for a PDP-11/45. This is the default.
22233 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
22239 Use 16-bit @code{int}. This is the default.
22245 Use 32-bit @code{int}.
22248 @itemx -mno-float32
22250 @opindex mno-float32
22251 Use 64-bit @code{float}. This is the default.
22254 @itemx -mno-float64
22256 @opindex mno-float64
22257 Use 32-bit @code{float}.
22261 Target has split instruction and data space. Implies -m45.
22265 Use Unix assembler syntax.
22269 Use DEC assembler syntax.
22273 Use GNU assembler syntax. This is the default.
22276 @node picoChip Options
22277 @subsection picoChip Options
22278 @cindex picoChip options
22280 These @samp{-m} options are defined for picoChip implementations:
22284 @item -mae=@var{ae_type}
22286 Set the instruction set, register set, and instruction scheduling
22287 parameters for array element type @var{ae_type}. Supported values
22288 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
22290 @option{-mae=ANY} selects a completely generic AE type. Code
22291 generated with this option runs on any of the other AE types. The
22292 code is not as efficient as it would be if compiled for a specific
22293 AE type, and some types of operation (e.g., multiplication) do not
22294 work properly on all types of AE.
22296 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
22297 for compiled code, and is the default.
22299 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
22300 option may suffer from poor performance of byte (char) manipulation,
22301 since the DSP AE does not provide hardware support for byte load/stores.
22303 @item -msymbol-as-address
22304 Enable the compiler to directly use a symbol name as an address in a
22305 load/store instruction, without first loading it into a
22306 register. Typically, the use of this option generates larger
22307 programs, which run faster than when the option isn't used. However, the
22308 results vary from program to program, so it is left as a user option,
22309 rather than being permanently enabled.
22311 @item -mno-inefficient-warnings
22312 Disables warnings about the generation of inefficient code. These
22313 warnings can be generated, for example, when compiling code that
22314 performs byte-level memory operations on the MAC AE type. The MAC AE has
22315 no hardware support for byte-level memory operations, so all byte
22316 load/stores must be synthesized from word load/store operations. This is
22317 inefficient and a warning is generated to indicate
22318 that you should rewrite the code to avoid byte operations, or to target
22319 an AE type that has the necessary hardware support. This option disables
22324 @node PowerPC Options
22325 @subsection PowerPC Options
22326 @cindex PowerPC options
22328 These are listed under @xref{RS/6000 and PowerPC Options}.
22330 @node PowerPC SPE Options
22331 @subsection PowerPC SPE Options
22332 @cindex PowerPC SPE options
22334 These @samp{-m} options are defined for PowerPC SPE:
22339 @itemx -mno-popcntb
22343 @opindex mno-popcntb
22344 You use these options to specify which instructions are available on the
22345 processor you are using. The default value of these options is
22346 determined when configuring GCC@. Specifying the
22347 @option{-mcpu=@var{cpu_type}} overrides the specification of these
22348 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
22349 rather than the options listed above.
22351 The @option{-mmfcrf} option allows GCC to generate the move from
22352 condition register field instruction implemented on the POWER4
22353 processor and other processors that support the PowerPC V2.01
22355 The @option{-mpopcntb} option allows GCC to generate the popcount and
22356 double-precision FP reciprocal estimate instruction implemented on the
22357 POWER5 processor and other processors that support the PowerPC V2.02
22360 @item -mcpu=@var{cpu_type}
22362 Set architecture type, register usage, and
22363 instruction scheduling parameters for machine type @var{cpu_type}.
22364 Supported values for @var{cpu_type} are @samp{8540}, @samp{8548},
22367 @option{-mcpu=powerpc} specifies pure 32-bit PowerPC (either
22368 endian), with an appropriate, generic processor model assumed for
22369 scheduling purposes.
22371 Specifying @samp{native} as cpu type detects and selects the
22372 architecture option that corresponds to the host processor of the
22373 system performing the compilation.
22374 @option{-mcpu=native} has no effect if GCC does not recognize the
22377 The other options specify a specific processor. Code generated under
22378 those options runs best on that processor, and may not run at all on
22381 The @option{-mcpu} options automatically enable or disable the
22384 @gccoptlist{-mhard-float -mmfcrf -mmultiple @gol
22385 -mpopcntb -mpopcntd @gol
22386 -msingle-float -mdouble-float @gol
22389 The particular options set for any particular CPU varies between
22390 compiler versions, depending on what setting seems to produce optimal
22391 code for that CPU; it doesn't necessarily reflect the actual hardware's
22392 capabilities. If you wish to set an individual option to a particular
22393 value, you may specify it after the @option{-mcpu} option, like
22394 @option{-mcpu=8548}.
22396 @item -mtune=@var{cpu_type}
22398 Set the instruction scheduling parameters for machine type
22399 @var{cpu_type}, but do not set the architecture type or register usage,
22400 as @option{-mcpu=@var{cpu_type}} does. The same
22401 values for @var{cpu_type} are used for @option{-mtune} as for
22402 @option{-mcpu}. If both are specified, the code generated uses the
22403 architecture and registers set by @option{-mcpu}, but the
22404 scheduling parameters set by @option{-mtune}.
22407 @opindex msecure-plt
22408 Generate code that allows @command{ld} and @command{ld.so}
22409 to build executables and shared
22410 libraries with non-executable @code{.plt} and @code{.got} sections.
22412 32-bit SYSV ABI option.
22416 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
22418 requires @code{.plt} and @code{.got}
22419 sections that are both writable and executable.
22420 This is a PowerPC 32-bit SYSV ABI option.
22426 This switch enables or disables the generation of ISEL instructions.
22428 @item -misel=@var{yes/no}
22429 This switch has been deprecated. Use @option{-misel} and
22430 @option{-mno-isel} instead.
22436 This switch enables or disables the generation of SPE simd
22439 @item -mspe=@var{yes/no}
22440 This option has been deprecated. Use @option{-mspe} and
22441 @option{-mno-spe} instead.
22444 @itemx -mno-float128
22446 @opindex mno-float128
22447 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
22448 and use either software emulation for IEEE 128-bit floating point or
22449 hardware instructions.
22451 @item -mfloat-gprs=@var{yes/single/double/no}
22452 @itemx -mfloat-gprs
22453 @opindex mfloat-gprs
22454 This switch enables or disables the generation of floating-point
22455 operations on the general-purpose registers for architectures that
22458 The argument @samp{yes} or @samp{single} enables the use of
22459 single-precision floating-point operations.
22461 The argument @samp{double} enables the use of single and
22462 double-precision floating-point operations.
22464 The argument @samp{no} disables floating-point operations on the
22465 general-purpose registers.
22467 This option is currently only available on the MPC854x.
22470 @itemx -mno-fp-in-toc
22471 @itemx -mno-sum-in-toc
22472 @itemx -mminimal-toc
22474 @opindex mno-fp-in-toc
22475 @opindex mno-sum-in-toc
22476 @opindex mminimal-toc
22477 Modify generation of the TOC (Table Of Contents), which is created for
22478 every executable file. The @option{-mfull-toc} option is selected by
22479 default. In that case, GCC allocates at least one TOC entry for
22480 each unique non-automatic variable reference in your program. GCC
22481 also places floating-point constants in the TOC@. However, only
22482 16,384 entries are available in the TOC@.
22484 If you receive a linker error message that saying you have overflowed
22485 the available TOC space, you can reduce the amount of TOC space used
22486 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
22487 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
22488 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
22489 generate code to calculate the sum of an address and a constant at
22490 run time instead of putting that sum into the TOC@. You may specify one
22491 or both of these options. Each causes GCC to produce very slightly
22492 slower and larger code at the expense of conserving TOC space.
22494 If you still run out of space in the TOC even when you specify both of
22495 these options, specify @option{-mminimal-toc} instead. This option causes
22496 GCC to make only one TOC entry for every file. When you specify this
22497 option, GCC produces code that is slower and larger but which
22498 uses extremely little TOC space. You may wish to use this option
22499 only on files that contain less frequently-executed code.
22503 Disables the 64-bit ABI. GCC defaults to @option{-maix32}.
22506 @itemx -mno-xl-compat
22507 @opindex mxl-compat
22508 @opindex mno-xl-compat
22509 Produce code that conforms more closely to IBM XL compiler semantics
22510 when using AIX-compatible ABI@. Pass floating-point arguments to
22511 prototyped functions beyond the register save area (RSA) on the stack
22512 in addition to argument FPRs. Do not assume that most significant
22513 double in 128-bit long double value is properly rounded when comparing
22514 values and converting to double. Use XL symbol names for long double
22517 The AIX calling convention was extended but not initially documented to
22518 handle an obscure K&R C case of calling a function that takes the
22519 address of its arguments with fewer arguments than declared. IBM XL
22520 compilers access floating-point arguments that do not fit in the
22521 RSA from the stack when a subroutine is compiled without
22522 optimization. Because always storing floating-point arguments on the
22523 stack is inefficient and rarely needed, this option is not enabled by
22524 default and only is necessary when calling subroutines compiled by IBM
22525 XL compilers without optimization.
22527 @item -malign-natural
22528 @itemx -malign-power
22529 @opindex malign-natural
22530 @opindex malign-power
22531 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
22532 @option{-malign-natural} overrides the ABI-defined alignment of larger
22533 types, such as floating-point doubles, on their natural size-based boundary.
22534 The option @option{-malign-power} instructs GCC to follow the ABI-specified
22535 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
22537 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
22541 @itemx -mhard-float
22542 @opindex msoft-float
22543 @opindex mhard-float
22544 Generate code that does not use (uses) the floating-point register set.
22545 Software floating-point emulation is provided if you use the
22546 @option{-msoft-float} option, and pass the option to GCC when linking.
22548 @item -msingle-float
22549 @itemx -mdouble-float
22550 @opindex msingle-float
22551 @opindex mdouble-float
22552 Generate code for single- or double-precision floating-point operations.
22553 @option{-mdouble-float} implies @option{-msingle-float}.
22556 @itemx -mno-multiple
22558 @opindex mno-multiple
22559 Generate code that uses (does not use) the load multiple word
22560 instructions and the store multiple word instructions. These
22561 instructions are generated by default on POWER systems, and not
22562 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
22563 PowerPC systems, since those instructions do not work when the
22564 processor is in little-endian mode. The exceptions are PPC740 and
22565 PPC750 which permit these instructions in little-endian mode.
22570 @opindex mno-update
22571 Generate code that uses (does not use) the load or store instructions
22572 that update the base register to the address of the calculated memory
22573 location. These instructions are generated by default. If you use
22574 @option{-mno-update}, there is a small window between the time that the
22575 stack pointer is updated and the address of the previous frame is
22576 stored, which means code that walks the stack frame across interrupts or
22577 signals may get corrupted data.
22579 @item -mavoid-indexed-addresses
22580 @itemx -mno-avoid-indexed-addresses
22581 @opindex mavoid-indexed-addresses
22582 @opindex mno-avoid-indexed-addresses
22583 Generate code that tries to avoid (not avoid) the use of indexed load
22584 or store instructions. These instructions can incur a performance
22585 penalty on Power6 processors in certain situations, such as when
22586 stepping through large arrays that cross a 16M boundary. This option
22587 is enabled by default when targeting Power6 and disabled otherwise.
22590 @itemx -mno-fused-madd
22591 @opindex mfused-madd
22592 @opindex mno-fused-madd
22593 Generate code that uses (does not use) the floating-point multiply and
22594 accumulate instructions. These instructions are generated by default
22595 if hardware floating point is used. The machine-dependent
22596 @option{-mfused-madd} option is now mapped to the machine-independent
22597 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
22598 mapped to @option{-ffp-contract=off}.
22600 @item -mno-strict-align
22601 @itemx -mstrict-align
22602 @opindex mno-strict-align
22603 @opindex mstrict-align
22604 On System V.4 and embedded PowerPC systems do not (do) assume that
22605 unaligned memory references are handled by the system.
22607 @item -mrelocatable
22608 @itemx -mno-relocatable
22609 @opindex mrelocatable
22610 @opindex mno-relocatable
22611 Generate code that allows (does not allow) a static executable to be
22612 relocated to a different address at run time. A simple embedded
22613 PowerPC system loader should relocate the entire contents of
22614 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
22615 a table of 32-bit addresses generated by this option. For this to
22616 work, all objects linked together must be compiled with
22617 @option{-mrelocatable} or @option{-mrelocatable-lib}.
22618 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
22620 @item -mrelocatable-lib
22621 @itemx -mno-relocatable-lib
22622 @opindex mrelocatable-lib
22623 @opindex mno-relocatable-lib
22624 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
22625 @code{.fixup} section to allow static executables to be relocated at
22626 run time, but @option{-mrelocatable-lib} does not use the smaller stack
22627 alignment of @option{-mrelocatable}. Objects compiled with
22628 @option{-mrelocatable-lib} may be linked with objects compiled with
22629 any combination of the @option{-mrelocatable} options.
22635 On System V.4 and embedded PowerPC systems do not (do) assume that
22636 register 2 contains a pointer to a global area pointing to the addresses
22637 used in the program.
22640 @itemx -mlittle-endian
22642 @opindex mlittle-endian
22643 On System V.4 and embedded PowerPC systems compile code for the
22644 processor in little-endian mode. The @option{-mlittle-endian} option is
22645 the same as @option{-mlittle}.
22648 @itemx -mbig-endian
22650 @opindex mbig-endian
22651 On System V.4 and embedded PowerPC systems compile code for the
22652 processor in big-endian mode. The @option{-mbig-endian} option is
22653 the same as @option{-mbig}.
22655 @item -mdynamic-no-pic
22656 @opindex mdynamic-no-pic
22657 On Darwin and Mac OS X systems, compile code so that it is not
22658 relocatable, but that its external references are relocatable. The
22659 resulting code is suitable for applications, but not shared
22662 @item -msingle-pic-base
22663 @opindex msingle-pic-base
22664 Treat the register used for PIC addressing as read-only, rather than
22665 loading it in the prologue for each function. The runtime system is
22666 responsible for initializing this register with an appropriate value
22667 before execution begins.
22669 @item -mprioritize-restricted-insns=@var{priority}
22670 @opindex mprioritize-restricted-insns
22671 This option controls the priority that is assigned to
22672 dispatch-slot restricted instructions during the second scheduling
22673 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
22674 or @samp{2} to assign no, highest, or second-highest (respectively)
22675 priority to dispatch-slot restricted
22678 @item -msched-costly-dep=@var{dependence_type}
22679 @opindex msched-costly-dep
22680 This option controls which dependences are considered costly
22681 by the target during instruction scheduling. The argument
22682 @var{dependence_type} takes one of the following values:
22686 No dependence is costly.
22689 All dependences are costly.
22691 @item @samp{true_store_to_load}
22692 A true dependence from store to load is costly.
22694 @item @samp{store_to_load}
22695 Any dependence from store to load is costly.
22698 Any dependence for which the latency is greater than or equal to
22699 @var{number} is costly.
22702 @item -minsert-sched-nops=@var{scheme}
22703 @opindex minsert-sched-nops
22704 This option controls which NOP insertion scheme is used during
22705 the second scheduling pass. The argument @var{scheme} takes one of the
22713 Pad with NOPs any dispatch group that has vacant issue slots,
22714 according to the scheduler's grouping.
22716 @item @samp{regroup_exact}
22717 Insert NOPs to force costly dependent insns into
22718 separate groups. Insert exactly as many NOPs as needed to force an insn
22719 to a new group, according to the estimated processor grouping.
22722 Insert NOPs to force costly dependent insns into
22723 separate groups. Insert @var{number} NOPs to force an insn to a new group.
22727 @opindex mcall-sysv
22728 On System V.4 and embedded PowerPC systems compile code using calling
22729 conventions that adhere to the March 1995 draft of the System V
22730 Application Binary Interface, PowerPC processor supplement. This is the
22731 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
22733 @item -mcall-sysv-eabi
22735 @opindex mcall-sysv-eabi
22736 @opindex mcall-eabi
22737 Specify both @option{-mcall-sysv} and @option{-meabi} options.
22739 @item -mcall-sysv-noeabi
22740 @opindex mcall-sysv-noeabi
22741 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
22743 @item -mcall-aixdesc
22745 On System V.4 and embedded PowerPC systems compile code for the AIX
22749 @opindex mcall-linux
22750 On System V.4 and embedded PowerPC systems compile code for the
22751 Linux-based GNU system.
22753 @item -mcall-freebsd
22754 @opindex mcall-freebsd
22755 On System V.4 and embedded PowerPC systems compile code for the
22756 FreeBSD operating system.
22758 @item -mcall-netbsd
22759 @opindex mcall-netbsd
22760 On System V.4 and embedded PowerPC systems compile code for the
22761 NetBSD operating system.
22763 @item -mcall-openbsd
22764 @opindex mcall-netbsd
22765 On System V.4 and embedded PowerPC systems compile code for the
22766 OpenBSD operating system.
22768 @item -maix-struct-return
22769 @opindex maix-struct-return
22770 Return all structures in memory (as specified by the AIX ABI)@.
22772 @item -msvr4-struct-return
22773 @opindex msvr4-struct-return
22774 Return structures smaller than 8 bytes in registers (as specified by the
22777 @item -mabi=@var{abi-type}
22779 Extend the current ABI with a particular extension, or remove such extension.
22780 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
22781 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
22782 @samp{elfv1}, @samp{elfv2}@.
22786 Extend the current ABI with SPE ABI extensions. This does not change
22787 the default ABI, instead it adds the SPE ABI extensions to the current
22791 @opindex mabi=no-spe
22792 Disable Book-E SPE ABI extensions for the current ABI@.
22794 @item -mabi=ibmlongdouble
22795 @opindex mabi=ibmlongdouble
22796 Change the current ABI to use IBM extended-precision long double.
22797 This is not likely to work if your system defaults to using IEEE
22798 extended-precision long double. If you change the long double type
22799 from IEEE extended-precision, the compiler will issue a warning unless
22800 you use the @option{-Wno-psabi} option.
22802 @item -mabi=ieeelongdouble
22803 @opindex mabi=ieeelongdouble
22804 Change the current ABI to use IEEE extended-precision long double.
22805 This is not likely to work if your system defaults to using IBM
22806 extended-precision long double. If you change the long double type
22807 from IBM extended-precision, the compiler will issue a warning unless
22808 you use the @option{-Wno-psabi} option.
22811 @opindex mabi=elfv1
22812 Change the current ABI to use the ELFv1 ABI.
22813 This is the default ABI for big-endian PowerPC 64-bit Linux.
22814 Overriding the default ABI requires special system support and is
22815 likely to fail in spectacular ways.
22818 @opindex mabi=elfv2
22819 Change the current ABI to use the ELFv2 ABI.
22820 This is the default ABI for little-endian PowerPC 64-bit Linux.
22821 Overriding the default ABI requires special system support and is
22822 likely to fail in spectacular ways.
22824 @item -mgnu-attribute
22825 @itemx -mno-gnu-attribute
22826 @opindex mgnu-attribute
22827 @opindex mno-gnu-attribute
22828 Emit .gnu_attribute assembly directives to set tag/value pairs in a
22829 .gnu.attributes section that specify ABI variations in function
22830 parameters or return values.
22833 @itemx -mno-prototype
22834 @opindex mprototype
22835 @opindex mno-prototype
22836 On System V.4 and embedded PowerPC systems assume that all calls to
22837 variable argument functions are properly prototyped. Otherwise, the
22838 compiler must insert an instruction before every non-prototyped call to
22839 set or clear bit 6 of the condition code register (@code{CR}) to
22840 indicate whether floating-point values are passed in the floating-point
22841 registers in case the function takes variable arguments. With
22842 @option{-mprototype}, only calls to prototyped variable argument functions
22843 set or clear the bit.
22847 On embedded PowerPC systems, assume that the startup module is called
22848 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
22849 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
22854 On embedded PowerPC systems, assume that the startup module is called
22855 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
22860 On embedded PowerPC systems, assume that the startup module is called
22861 @file{crt0.o} and the standard C libraries are @file{libads.a} and
22864 @item -myellowknife
22865 @opindex myellowknife
22866 On embedded PowerPC systems, assume that the startup module is called
22867 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
22872 On System V.4 and embedded PowerPC systems, specify that you are
22873 compiling for a VxWorks system.
22877 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
22878 header to indicate that @samp{eabi} extended relocations are used.
22884 On System V.4 and embedded PowerPC systems do (do not) adhere to the
22885 Embedded Applications Binary Interface (EABI), which is a set of
22886 modifications to the System V.4 specifications. Selecting @option{-meabi}
22887 means that the stack is aligned to an 8-byte boundary, a function
22888 @code{__eabi} is called from @code{main} to set up the EABI
22889 environment, and the @option{-msdata} option can use both @code{r2} and
22890 @code{r13} to point to two separate small data areas. Selecting
22891 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
22892 no EABI initialization function is called from @code{main}, and the
22893 @option{-msdata} option only uses @code{r13} to point to a single
22894 small data area. The @option{-meabi} option is on by default if you
22895 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
22898 @opindex msdata=eabi
22899 On System V.4 and embedded PowerPC systems, put small initialized
22900 @code{const} global and static data in the @code{.sdata2} section, which
22901 is pointed to by register @code{r2}. Put small initialized
22902 non-@code{const} global and static data in the @code{.sdata} section,
22903 which is pointed to by register @code{r13}. Put small uninitialized
22904 global and static data in the @code{.sbss} section, which is adjacent to
22905 the @code{.sdata} section. The @option{-msdata=eabi} option is
22906 incompatible with the @option{-mrelocatable} option. The
22907 @option{-msdata=eabi} option also sets the @option{-memb} option.
22910 @opindex msdata=sysv
22911 On System V.4 and embedded PowerPC systems, put small global and static
22912 data in the @code{.sdata} section, which is pointed to by register
22913 @code{r13}. Put small uninitialized global and static data in the
22914 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
22915 The @option{-msdata=sysv} option is incompatible with the
22916 @option{-mrelocatable} option.
22918 @item -msdata=default
22920 @opindex msdata=default
22922 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
22923 compile code the same as @option{-msdata=eabi}, otherwise compile code the
22924 same as @option{-msdata=sysv}.
22927 @opindex msdata=data
22928 On System V.4 and embedded PowerPC systems, put small global
22929 data in the @code{.sdata} section. Put small uninitialized global
22930 data in the @code{.sbss} section. Do not use register @code{r13}
22931 to address small data however. This is the default behavior unless
22932 other @option{-msdata} options are used.
22936 @opindex msdata=none
22938 On embedded PowerPC systems, put all initialized global and static data
22939 in the @code{.data} section, and all uninitialized data in the
22940 @code{.bss} section.
22942 @item -mblock-move-inline-limit=@var{num}
22943 @opindex mblock-move-inline-limit
22944 Inline all block moves (such as calls to @code{memcpy} or structure
22945 copies) less than or equal to @var{num} bytes. The minimum value for
22946 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
22947 targets. The default value is target-specific.
22951 @cindex smaller data references (PowerPC)
22952 @cindex .sdata/.sdata2 references (PowerPC)
22953 On embedded PowerPC systems, put global and static items less than or
22954 equal to @var{num} bytes into the small data or BSS sections instead of
22955 the normal data or BSS section. By default, @var{num} is 8. The
22956 @option{-G @var{num}} switch is also passed to the linker.
22957 All modules should be compiled with the same @option{-G @var{num}} value.
22960 @itemx -mno-regnames
22962 @opindex mno-regnames
22963 On System V.4 and embedded PowerPC systems do (do not) emit register
22964 names in the assembly language output using symbolic forms.
22967 @itemx -mno-longcall
22969 @opindex mno-longcall
22970 By default assume that all calls are far away so that a longer and more
22971 expensive calling sequence is required. This is required for calls
22972 farther than 32 megabytes (33,554,432 bytes) from the current location.
22973 A short call is generated if the compiler knows
22974 the call cannot be that far away. This setting can be overridden by
22975 the @code{shortcall} function attribute, or by @code{#pragma
22978 Some linkers are capable of detecting out-of-range calls and generating
22979 glue code on the fly. On these systems, long calls are unnecessary and
22980 generate slower code. As of this writing, the AIX linker can do this,
22981 as can the GNU linker for PowerPC/64. It is planned to add this feature
22982 to the GNU linker for 32-bit PowerPC systems as well.
22984 In the future, GCC may ignore all longcall specifications
22985 when the linker is known to generate glue.
22987 @item -mtls-markers
22988 @itemx -mno-tls-markers
22989 @opindex mtls-markers
22990 @opindex mno-tls-markers
22991 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
22992 specifying the function argument. The relocation allows the linker to
22993 reliably associate function call with argument setup instructions for
22994 TLS optimization, which in turn allows GCC to better schedule the
23000 This option enables use of the reciprocal estimate and
23001 reciprocal square root estimate instructions with additional
23002 Newton-Raphson steps to increase precision instead of doing a divide or
23003 square root and divide for floating-point arguments. You should use
23004 the @option{-ffast-math} option when using @option{-mrecip} (or at
23005 least @option{-funsafe-math-optimizations},
23006 @option{-ffinite-math-only}, @option{-freciprocal-math} and
23007 @option{-fno-trapping-math}). Note that while the throughput of the
23008 sequence is generally higher than the throughput of the non-reciprocal
23009 instruction, the precision of the sequence can be decreased by up to 2
23010 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
23013 @item -mrecip=@var{opt}
23014 @opindex mrecip=opt
23015 This option controls which reciprocal estimate instructions
23016 may be used. @var{opt} is a comma-separated list of options, which may
23017 be preceded by a @code{!} to invert the option:
23022 Enable all estimate instructions.
23025 Enable the default instructions, equivalent to @option{-mrecip}.
23028 Disable all estimate instructions, equivalent to @option{-mno-recip}.
23031 Enable the reciprocal approximation instructions for both
23032 single and double precision.
23035 Enable the single-precision reciprocal approximation instructions.
23038 Enable the double-precision reciprocal approximation instructions.
23041 Enable the reciprocal square root approximation instructions for both
23042 single and double precision.
23045 Enable the single-precision reciprocal square root approximation instructions.
23048 Enable the double-precision reciprocal square root approximation instructions.
23052 So, for example, @option{-mrecip=all,!rsqrtd} enables
23053 all of the reciprocal estimate instructions, except for the
23054 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
23055 which handle the double-precision reciprocal square root calculations.
23057 @item -mrecip-precision
23058 @itemx -mno-recip-precision
23059 @opindex mrecip-precision
23060 Assume (do not assume) that the reciprocal estimate instructions
23061 provide higher-precision estimates than is mandated by the PowerPC
23062 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
23063 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
23064 The double-precision square root estimate instructions are not generated by
23065 default on low-precision machines, since they do not provide an
23066 estimate that converges after three steps.
23068 @item -mpointers-to-nested-functions
23069 @itemx -mno-pointers-to-nested-functions
23070 @opindex mpointers-to-nested-functions
23071 Generate (do not generate) code to load up the static chain register
23072 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
23073 systems where a function pointer points to a 3-word descriptor giving
23074 the function address, TOC value to be loaded in register @code{r2}, and
23075 static chain value to be loaded in register @code{r11}. The
23076 @option{-mpointers-to-nested-functions} is on by default. You cannot
23077 call through pointers to nested functions or pointers
23078 to functions compiled in other languages that use the static chain if
23079 you use @option{-mno-pointers-to-nested-functions}.
23081 @item -msave-toc-indirect
23082 @itemx -mno-save-toc-indirect
23083 @opindex msave-toc-indirect
23084 Generate (do not generate) code to save the TOC value in the reserved
23085 stack location in the function prologue if the function calls through
23086 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
23087 saved in the prologue, it is saved just before the call through the
23088 pointer. The @option{-mno-save-toc-indirect} option is the default.
23090 @item -mcompat-align-parm
23091 @itemx -mno-compat-align-parm
23092 @opindex mcompat-align-parm
23093 Generate (do not generate) code to pass structure parameters with a
23094 maximum alignment of 64 bits, for compatibility with older versions
23097 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
23098 structure parameter on a 128-bit boundary when that structure contained
23099 a member requiring 128-bit alignment. This is corrected in more
23100 recent versions of GCC. This option may be used to generate code
23101 that is compatible with functions compiled with older versions of
23104 The @option{-mno-compat-align-parm} option is the default.
23106 @item -mstack-protector-guard=@var{guard}
23107 @itemx -mstack-protector-guard-reg=@var{reg}
23108 @itemx -mstack-protector-guard-offset=@var{offset}
23109 @itemx -mstack-protector-guard-symbol=@var{symbol}
23110 @opindex mstack-protector-guard
23111 @opindex mstack-protector-guard-reg
23112 @opindex mstack-protector-guard-offset
23113 @opindex mstack-protector-guard-symbol
23114 Generate stack protection code using canary at @var{guard}. Supported
23115 locations are @samp{global} for global canary or @samp{tls} for per-thread
23116 canary in the TLS block (the default with GNU libc version 2.4 or later).
23118 With the latter choice the options
23119 @option{-mstack-protector-guard-reg=@var{reg}} and
23120 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
23121 which register to use as base register for reading the canary, and from what
23122 offset from that base register. The default for those is as specified in the
23123 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
23124 the offset with a symbol reference to a canary in the TLS block.
23128 @node RISC-V Options
23129 @subsection RISC-V Options
23130 @cindex RISC-V Options
23132 These command-line options are defined for RISC-V targets:
23135 @item -mbranch-cost=@var{n}
23136 @opindex mbranch-cost
23137 Set the cost of branches to roughly @var{n} instructions.
23142 When generating PIC code, do or don't allow the use of PLTs. Ignored for
23143 non-PIC. The default is @option{-mplt}.
23145 @item -mabi=@var{ABI-string}
23147 Specify integer and floating-point calling convention. @var{ABI-string}
23148 contains two parts: the size of integer types and the registers used for
23149 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
23150 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
23151 32-bit), and that floating-point values up to 64 bits wide are passed in F
23152 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
23153 allows the compiler to generate code that uses the F and D extensions but only
23154 allows floating-point values up to 32 bits long to be passed in registers; or
23155 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
23156 passed in registers.
23158 The default for this argument is system dependent, users who want a specific
23159 calling convention should specify one explicitly. The valid calling
23160 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
23161 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
23162 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
23163 invalid because the ABI requires 64-bit values be passed in F registers, but F
23164 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
23165 only be used with the @samp{rv32e} architecture. This ABI is not well
23166 specified at present, and is subject to change.
23171 Do or don't use hardware floating-point divide and square root instructions.
23172 This requires the F or D extensions for floating-point registers. The default
23173 is to use them if the specified architecture has these instructions.
23178 Do or don't use hardware instructions for integer division. This requires the
23179 M extension. The default is to use them if the specified architecture has
23180 these instructions.
23182 @item -march=@var{ISA-string}
23184 Generate code for given RISC-V ISA (e.g.@ @samp{rv64im}). ISA strings must be
23185 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
23188 @item -mtune=@var{processor-string}
23190 Optimize the output for the given processor, specified by microarchitecture
23193 @item -mpreferred-stack-boundary=@var{num}
23194 @opindex mpreferred-stack-boundary
23195 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
23196 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
23197 the default is 4 (16 bytes or 128-bits).
23199 @strong{Warning:} If you use this switch, then you must build all modules with
23200 the same value, including any libraries. This includes the system libraries
23201 and startup modules.
23203 @item -msmall-data-limit=@var{n}
23204 @opindex msmall-data-limit
23205 Put global and static data smaller than @var{n} bytes into a special section
23208 @item -msave-restore
23209 @itemx -mno-save-restore
23210 @opindex msave-restore
23211 Do or don't use smaller but slower prologue and epilogue code that uses
23212 library function calls. The default is to use fast inline prologues and
23215 @item -mstrict-align
23216 @itemx -mno-strict-align
23217 @opindex mstrict-align
23218 Do not or do generate unaligned memory accesses. The default is set depending
23219 on whether the processor we are optimizing for supports fast unaligned access
23222 @item -mcmodel=medlow
23223 @opindex mcmodel=medlow
23224 Generate code for the medium-low code model. The program and its statically
23225 defined symbols must lie within a single 2 GiB address range and must lie
23226 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
23227 statically or dynamically linked. This is the default code model.
23229 @item -mcmodel=medany
23230 @opindex mcmodel=medany
23231 Generate code for the medium-any code model. The program and its statically
23232 defined symbols must be within any single 2 GiB address range. Programs can be
23233 statically or dynamically linked.
23235 @item -mexplicit-relocs
23236 @itemx -mno-exlicit-relocs
23237 Use or do not use assembler relocation operators when dealing with symbolic
23238 addresses. The alternative is to use assembler macros instead, which may
23239 limit optimization.
23243 Take advantage of linker relaxations to reduce the number of instructions
23244 required to materialize symbol addresses. The default is to take advantage of
23245 linker relaxations.
23250 @subsection RL78 Options
23251 @cindex RL78 Options
23257 Links in additional target libraries to support operation within a
23266 Specifies the type of hardware multiplication and division support to
23267 be used. The simplest is @code{none}, which uses software for both
23268 multiplication and division. This is the default. The @code{g13}
23269 value is for the hardware multiply/divide peripheral found on the
23270 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
23271 the multiplication and division instructions supported by the RL78/G14
23272 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
23273 the value @code{mg10} is an alias for @code{none}.
23275 In addition a C preprocessor macro is defined, based upon the setting
23276 of this option. Possible values are: @code{__RL78_MUL_NONE__},
23277 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
23284 Specifies the RL78 core to target. The default is the G14 core, also
23285 known as an S3 core or just RL78. The G13 or S2 core does not have
23286 multiply or divide instructions, instead it uses a hardware peripheral
23287 for these operations. The G10 or S1 core does not have register
23288 banks, so it uses a different calling convention.
23290 If this option is set it also selects the type of hardware multiply
23291 support to use, unless this is overridden by an explicit
23292 @option{-mmul=none} option on the command line. Thus specifying
23293 @option{-mcpu=g13} enables the use of the G13 hardware multiply
23294 peripheral and specifying @option{-mcpu=g10} disables the use of
23295 hardware multiplications altogether.
23297 Note, although the RL78/G14 core is the default target, specifying
23298 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
23299 change the behavior of the toolchain since it also enables G14
23300 hardware multiply support. If these options are not specified on the
23301 command line then software multiplication routines will be used even
23302 though the code targets the RL78 core. This is for backwards
23303 compatibility with older toolchains which did not have hardware
23304 multiply and divide support.
23306 In addition a C preprocessor macro is defined, based upon the setting
23307 of this option. Possible values are: @code{__RL78_G10__},
23308 @code{__RL78_G13__} or @code{__RL78_G14__}.
23318 These are aliases for the corresponding @option{-mcpu=} option. They
23319 are provided for backwards compatibility.
23323 Allow the compiler to use all of the available registers. By default
23324 registers @code{r24..r31} are reserved for use in interrupt handlers.
23325 With this option enabled these registers can be used in ordinary
23328 @item -m64bit-doubles
23329 @itemx -m32bit-doubles
23330 @opindex m64bit-doubles
23331 @opindex m32bit-doubles
23332 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
23333 or 32 bits (@option{-m32bit-doubles}) in size. The default is
23334 @option{-m32bit-doubles}.
23336 @item -msave-mduc-in-interrupts
23337 @itemx -mno-save-mduc-in-interrupts
23338 @opindex msave-mduc-in-interrupts
23339 @opindex mno-save-mduc-in-interrupts
23340 Specifies that interrupt handler functions should preserve the
23341 MDUC registers. This is only necessary if normal code might use
23342 the MDUC registers, for example because it performs multiplication
23343 and division operations. The default is to ignore the MDUC registers
23344 as this makes the interrupt handlers faster. The target option -mg13
23345 needs to be passed for this to work as this feature is only available
23346 on the G13 target (S2 core). The MDUC registers will only be saved
23347 if the interrupt handler performs a multiplication or division
23348 operation or it calls another function.
23352 @node RS/6000 and PowerPC Options
23353 @subsection IBM RS/6000 and PowerPC Options
23354 @cindex RS/6000 and PowerPC Options
23355 @cindex IBM RS/6000 and PowerPC Options
23357 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
23359 @item -mpowerpc-gpopt
23360 @itemx -mno-powerpc-gpopt
23361 @itemx -mpowerpc-gfxopt
23362 @itemx -mno-powerpc-gfxopt
23365 @itemx -mno-powerpc64
23369 @itemx -mno-popcntb
23371 @itemx -mno-popcntd
23380 @itemx -mno-hard-dfp
23381 @opindex mpowerpc-gpopt
23382 @opindex mno-powerpc-gpopt
23383 @opindex mpowerpc-gfxopt
23384 @opindex mno-powerpc-gfxopt
23385 @opindex mpowerpc64
23386 @opindex mno-powerpc64
23390 @opindex mno-popcntb
23392 @opindex mno-popcntd
23398 @opindex mno-mfpgpr
23400 @opindex mno-hard-dfp
23401 You use these options to specify which instructions are available on the
23402 processor you are using. The default value of these options is
23403 determined when configuring GCC@. Specifying the
23404 @option{-mcpu=@var{cpu_type}} overrides the specification of these
23405 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
23406 rather than the options listed above.
23408 Specifying @option{-mpowerpc-gpopt} allows
23409 GCC to use the optional PowerPC architecture instructions in the
23410 General Purpose group, including floating-point square root. Specifying
23411 @option{-mpowerpc-gfxopt} allows GCC to
23412 use the optional PowerPC architecture instructions in the Graphics
23413 group, including floating-point select.
23415 The @option{-mmfcrf} option allows GCC to generate the move from
23416 condition register field instruction implemented on the POWER4
23417 processor and other processors that support the PowerPC V2.01
23419 The @option{-mpopcntb} option allows GCC to generate the popcount and
23420 double-precision FP reciprocal estimate instruction implemented on the
23421 POWER5 processor and other processors that support the PowerPC V2.02
23423 The @option{-mpopcntd} option allows GCC to generate the popcount
23424 instruction implemented on the POWER7 processor and other processors
23425 that support the PowerPC V2.06 architecture.
23426 The @option{-mfprnd} option allows GCC to generate the FP round to
23427 integer instructions implemented on the POWER5+ processor and other
23428 processors that support the PowerPC V2.03 architecture.
23429 The @option{-mcmpb} option allows GCC to generate the compare bytes
23430 instruction implemented on the POWER6 processor and other processors
23431 that support the PowerPC V2.05 architecture.
23432 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
23433 general-purpose register instructions implemented on the POWER6X
23434 processor and other processors that support the extended PowerPC V2.05
23436 The @option{-mhard-dfp} option allows GCC to generate the decimal
23437 floating-point instructions implemented on some POWER processors.
23439 The @option{-mpowerpc64} option allows GCC to generate the additional
23440 64-bit instructions that are found in the full PowerPC64 architecture
23441 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
23442 @option{-mno-powerpc64}.
23444 @item -mcpu=@var{cpu_type}
23446 Set architecture type, register usage, and
23447 instruction scheduling parameters for machine type @var{cpu_type}.
23448 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
23449 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
23450 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
23451 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
23452 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
23453 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
23454 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
23455 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
23456 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
23457 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
23458 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
23459 @samp{rs64}, and @samp{native}.
23461 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
23462 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
23463 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
23464 architecture machine types, with an appropriate, generic processor
23465 model assumed for scheduling purposes.
23467 Specifying @samp{native} as cpu type detects and selects the
23468 architecture option that corresponds to the host processor of the
23469 system performing the compilation.
23470 @option{-mcpu=native} has no effect if GCC does not recognize the
23473 The other options specify a specific processor. Code generated under
23474 those options runs best on that processor, and may not run at all on
23477 The @option{-mcpu} options automatically enable or disable the
23480 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
23481 -mpopcntb -mpopcntd -mpowerpc64 @gol
23482 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
23483 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
23484 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
23485 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
23487 The particular options set for any particular CPU varies between
23488 compiler versions, depending on what setting seems to produce optimal
23489 code for that CPU; it doesn't necessarily reflect the actual hardware's
23490 capabilities. If you wish to set an individual option to a particular
23491 value, you may specify it after the @option{-mcpu} option, like
23492 @option{-mcpu=970 -mno-altivec}.
23494 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
23495 not enabled or disabled by the @option{-mcpu} option at present because
23496 AIX does not have full support for these options. You may still
23497 enable or disable them individually if you're sure it'll work in your
23500 @item -mtune=@var{cpu_type}
23502 Set the instruction scheduling parameters for machine type
23503 @var{cpu_type}, but do not set the architecture type or register usage,
23504 as @option{-mcpu=@var{cpu_type}} does. The same
23505 values for @var{cpu_type} are used for @option{-mtune} as for
23506 @option{-mcpu}. If both are specified, the code generated uses the
23507 architecture and registers set by @option{-mcpu}, but the
23508 scheduling parameters set by @option{-mtune}.
23510 @item -mcmodel=small
23511 @opindex mcmodel=small
23512 Generate PowerPC64 code for the small model: The TOC is limited to
23515 @item -mcmodel=medium
23516 @opindex mcmodel=medium
23517 Generate PowerPC64 code for the medium model: The TOC and other static
23518 data may be up to a total of 4G in size. This is the default for 64-bit
23521 @item -mcmodel=large
23522 @opindex mcmodel=large
23523 Generate PowerPC64 code for the large model: The TOC may be up to 4G
23524 in size. Other data and code is only limited by the 64-bit address
23528 @itemx -mno-altivec
23530 @opindex mno-altivec
23531 Generate code that uses (does not use) AltiVec instructions, and also
23532 enable the use of built-in functions that allow more direct access to
23533 the AltiVec instruction set. You may also need to set
23534 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
23537 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
23538 @option{-maltivec=be}, the element order for AltiVec intrinsics such
23539 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
23540 match array element order corresponding to the endianness of the
23541 target. That is, element zero identifies the leftmost element in a
23542 vector register when targeting a big-endian platform, and identifies
23543 the rightmost element in a vector register when targeting a
23544 little-endian platform.
23547 @opindex maltivec=be
23548 Generate AltiVec instructions using big-endian element order,
23549 regardless of whether the target is big- or little-endian. This is
23550 the default when targeting a big-endian platform. Using this option
23551 is currently deprecated. Support for this feature will be removed in
23554 The element order is used to interpret element numbers in AltiVec
23555 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
23556 @code{vec_insert}. By default, these match array element order
23557 corresponding to the endianness for the target.
23560 @opindex maltivec=le
23561 Generate AltiVec instructions using little-endian element order,
23562 regardless of whether the target is big- or little-endian. This is
23563 the default when targeting a little-endian platform. This option is
23564 currently ignored when targeting a big-endian platform.
23566 The element order is used to interpret element numbers in AltiVec
23567 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
23568 @code{vec_insert}. By default, these match array element order
23569 corresponding to the endianness for the target.
23574 @opindex mno-vrsave
23575 Generate VRSAVE instructions when generating AltiVec code.
23578 @opindex msecure-plt
23579 Generate code that allows @command{ld} and @command{ld.so}
23580 to build executables and shared
23581 libraries with non-executable @code{.plt} and @code{.got} sections.
23583 32-bit SYSV ABI option.
23587 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
23589 requires @code{.plt} and @code{.got}
23590 sections that are both writable and executable.
23591 This is a PowerPC 32-bit SYSV ABI option.
23597 This switch enables or disables the generation of ISEL instructions.
23599 @item -misel=@var{yes/no}
23600 This switch has been deprecated. Use @option{-misel} and
23601 @option{-mno-isel} instead.
23607 Generate code that uses (does not use) vector/scalar (VSX)
23608 instructions, and also enable the use of built-in functions that allow
23609 more direct access to the VSX instruction set.
23614 @opindex mno-crypto
23615 Enable the use (disable) of the built-in functions that allow direct
23616 access to the cryptographic instructions that were added in version
23617 2.07 of the PowerPC ISA.
23623 Enable (disable) the use of the built-in functions that allow direct
23624 access to the Hardware Transactional Memory (HTM) instructions that
23625 were added in version 2.07 of the PowerPC ISA.
23627 @item -mpower8-fusion
23628 @itemx -mno-power8-fusion
23629 @opindex mpower8-fusion
23630 @opindex mno-power8-fusion
23631 Generate code that keeps (does not keeps) some integer operations
23632 adjacent so that the instructions can be fused together on power8 and
23635 @item -mpower8-vector
23636 @itemx -mno-power8-vector
23637 @opindex mpower8-vector
23638 @opindex mno-power8-vector
23639 Generate code that uses (does not use) the vector and scalar
23640 instructions that were added in version 2.07 of the PowerPC ISA. Also
23641 enable the use of built-in functions that allow more direct access to
23642 the vector instructions.
23644 @item -mquad-memory
23645 @itemx -mno-quad-memory
23646 @opindex mquad-memory
23647 @opindex mno-quad-memory
23648 Generate code that uses (does not use) the non-atomic quad word memory
23649 instructions. The @option{-mquad-memory} option requires use of
23652 @item -mquad-memory-atomic
23653 @itemx -mno-quad-memory-atomic
23654 @opindex mquad-memory-atomic
23655 @opindex mno-quad-memory-atomic
23656 Generate code that uses (does not use) the atomic quad word memory
23657 instructions. The @option{-mquad-memory-atomic} option requires use of
23661 @itemx -mno-float128
23663 @opindex mno-float128
23664 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
23665 and use either software emulation for IEEE 128-bit floating point or
23666 hardware instructions.
23668 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
23669 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
23670 use the IEEE 128-bit floating point support. The IEEE 128-bit
23671 floating point support only works on PowerPC Linux systems.
23673 The default for @option{-mfloat128} is enabled on PowerPC Linux
23674 systems using the VSX instruction set, and disabled on other systems.
23676 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
23677 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
23678 point support will also enable the generation of ISA 3.0 IEEE 128-bit
23679 floating point instructions. Otherwise, if you do not specify to
23680 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
23681 system, IEEE 128-bit floating point will be done with software
23684 @item -mfloat128-hardware
23685 @itemx -mno-float128-hardware
23686 @opindex mfloat128-hardware
23687 @opindex mno-float128-hardware
23688 Enable/disable using ISA 3.0 hardware instructions to support the
23689 @var{__float128} data type.
23691 The default for @option{-mfloat128-hardware} is enabled on PowerPC
23692 Linux systems using the ISA 3.0 instruction set, and disabled on other
23699 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
23700 targets (including GNU/Linux). The 32-bit environment sets int, long
23701 and pointer to 32 bits and generates code that runs on any PowerPC
23702 variant. The 64-bit environment sets int to 32 bits and long and
23703 pointer to 64 bits, and generates code for PowerPC64, as for
23704 @option{-mpowerpc64}.
23707 @itemx -mno-fp-in-toc
23708 @itemx -mno-sum-in-toc
23709 @itemx -mminimal-toc
23711 @opindex mno-fp-in-toc
23712 @opindex mno-sum-in-toc
23713 @opindex mminimal-toc
23714 Modify generation of the TOC (Table Of Contents), which is created for
23715 every executable file. The @option{-mfull-toc} option is selected by
23716 default. In that case, GCC allocates at least one TOC entry for
23717 each unique non-automatic variable reference in your program. GCC
23718 also places floating-point constants in the TOC@. However, only
23719 16,384 entries are available in the TOC@.
23721 If you receive a linker error message that saying you have overflowed
23722 the available TOC space, you can reduce the amount of TOC space used
23723 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
23724 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
23725 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
23726 generate code to calculate the sum of an address and a constant at
23727 run time instead of putting that sum into the TOC@. You may specify one
23728 or both of these options. Each causes GCC to produce very slightly
23729 slower and larger code at the expense of conserving TOC space.
23731 If you still run out of space in the TOC even when you specify both of
23732 these options, specify @option{-mminimal-toc} instead. This option causes
23733 GCC to make only one TOC entry for every file. When you specify this
23734 option, GCC produces code that is slower and larger but which
23735 uses extremely little TOC space. You may wish to use this option
23736 only on files that contain less frequently-executed code.
23742 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
23743 @code{long} type, and the infrastructure needed to support them.
23744 Specifying @option{-maix64} implies @option{-mpowerpc64},
23745 while @option{-maix32} disables the 64-bit ABI and
23746 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
23749 @itemx -mno-xl-compat
23750 @opindex mxl-compat
23751 @opindex mno-xl-compat
23752 Produce code that conforms more closely to IBM XL compiler semantics
23753 when using AIX-compatible ABI@. Pass floating-point arguments to
23754 prototyped functions beyond the register save area (RSA) on the stack
23755 in addition to argument FPRs. Do not assume that most significant
23756 double in 128-bit long double value is properly rounded when comparing
23757 values and converting to double. Use XL symbol names for long double
23760 The AIX calling convention was extended but not initially documented to
23761 handle an obscure K&R C case of calling a function that takes the
23762 address of its arguments with fewer arguments than declared. IBM XL
23763 compilers access floating-point arguments that do not fit in the
23764 RSA from the stack when a subroutine is compiled without
23765 optimization. Because always storing floating-point arguments on the
23766 stack is inefficient and rarely needed, this option is not enabled by
23767 default and only is necessary when calling subroutines compiled by IBM
23768 XL compilers without optimization.
23772 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
23773 application written to use message passing with special startup code to
23774 enable the application to run. The system must have PE installed in the
23775 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
23776 must be overridden with the @option{-specs=} option to specify the
23777 appropriate directory location. The Parallel Environment does not
23778 support threads, so the @option{-mpe} option and the @option{-pthread}
23779 option are incompatible.
23781 @item -malign-natural
23782 @itemx -malign-power
23783 @opindex malign-natural
23784 @opindex malign-power
23785 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
23786 @option{-malign-natural} overrides the ABI-defined alignment of larger
23787 types, such as floating-point doubles, on their natural size-based boundary.
23788 The option @option{-malign-power} instructs GCC to follow the ABI-specified
23789 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
23791 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
23795 @itemx -mhard-float
23796 @opindex msoft-float
23797 @opindex mhard-float
23798 Generate code that does not use (uses) the floating-point register set.
23799 Software floating-point emulation is provided if you use the
23800 @option{-msoft-float} option, and pass the option to GCC when linking.
23803 @itemx -mno-multiple
23805 @opindex mno-multiple
23806 Generate code that uses (does not use) the load multiple word
23807 instructions and the store multiple word instructions. These
23808 instructions are generated by default on POWER systems, and not
23809 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
23810 PowerPC systems, since those instructions do not work when the
23811 processor is in little-endian mode. The exceptions are PPC740 and
23812 PPC750 which permit these instructions in little-endian mode.
23817 @opindex mno-update
23818 Generate code that uses (does not use) the load or store instructions
23819 that update the base register to the address of the calculated memory
23820 location. These instructions are generated by default. If you use
23821 @option{-mno-update}, there is a small window between the time that the
23822 stack pointer is updated and the address of the previous frame is
23823 stored, which means code that walks the stack frame across interrupts or
23824 signals may get corrupted data.
23826 @item -mavoid-indexed-addresses
23827 @itemx -mno-avoid-indexed-addresses
23828 @opindex mavoid-indexed-addresses
23829 @opindex mno-avoid-indexed-addresses
23830 Generate code that tries to avoid (not avoid) the use of indexed load
23831 or store instructions. These instructions can incur a performance
23832 penalty on Power6 processors in certain situations, such as when
23833 stepping through large arrays that cross a 16M boundary. This option
23834 is enabled by default when targeting Power6 and disabled otherwise.
23837 @itemx -mno-fused-madd
23838 @opindex mfused-madd
23839 @opindex mno-fused-madd
23840 Generate code that uses (does not use) the floating-point multiply and
23841 accumulate instructions. These instructions are generated by default
23842 if hardware floating point is used. The machine-dependent
23843 @option{-mfused-madd} option is now mapped to the machine-independent
23844 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
23845 mapped to @option{-ffp-contract=off}.
23851 Generate code that uses (does not use) the half-word multiply and
23852 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
23853 These instructions are generated by default when targeting those
23860 Generate code that uses (does not use) the string-search @samp{dlmzb}
23861 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
23862 generated by default when targeting those processors.
23864 @item -mno-bit-align
23866 @opindex mno-bit-align
23867 @opindex mbit-align
23868 On System V.4 and embedded PowerPC systems do not (do) force structures
23869 and unions that contain bit-fields to be aligned to the base type of the
23872 For example, by default a structure containing nothing but 8
23873 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
23874 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
23875 the structure is aligned to a 1-byte boundary and is 1 byte in
23878 @item -mno-strict-align
23879 @itemx -mstrict-align
23880 @opindex mno-strict-align
23881 @opindex mstrict-align
23882 On System V.4 and embedded PowerPC systems do not (do) assume that
23883 unaligned memory references are handled by the system.
23885 @item -mrelocatable
23886 @itemx -mno-relocatable
23887 @opindex mrelocatable
23888 @opindex mno-relocatable
23889 Generate code that allows (does not allow) a static executable to be
23890 relocated to a different address at run time. A simple embedded
23891 PowerPC system loader should relocate the entire contents of
23892 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
23893 a table of 32-bit addresses generated by this option. For this to
23894 work, all objects linked together must be compiled with
23895 @option{-mrelocatable} or @option{-mrelocatable-lib}.
23896 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
23898 @item -mrelocatable-lib
23899 @itemx -mno-relocatable-lib
23900 @opindex mrelocatable-lib
23901 @opindex mno-relocatable-lib
23902 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
23903 @code{.fixup} section to allow static executables to be relocated at
23904 run time, but @option{-mrelocatable-lib} does not use the smaller stack
23905 alignment of @option{-mrelocatable}. Objects compiled with
23906 @option{-mrelocatable-lib} may be linked with objects compiled with
23907 any combination of the @option{-mrelocatable} options.
23913 On System V.4 and embedded PowerPC systems do not (do) assume that
23914 register 2 contains a pointer to a global area pointing to the addresses
23915 used in the program.
23918 @itemx -mlittle-endian
23920 @opindex mlittle-endian
23921 On System V.4 and embedded PowerPC systems compile code for the
23922 processor in little-endian mode. The @option{-mlittle-endian} option is
23923 the same as @option{-mlittle}.
23926 @itemx -mbig-endian
23928 @opindex mbig-endian
23929 On System V.4 and embedded PowerPC systems compile code for the
23930 processor in big-endian mode. The @option{-mbig-endian} option is
23931 the same as @option{-mbig}.
23933 @item -mdynamic-no-pic
23934 @opindex mdynamic-no-pic
23935 On Darwin and Mac OS X systems, compile code so that it is not
23936 relocatable, but that its external references are relocatable. The
23937 resulting code is suitable for applications, but not shared
23940 @item -msingle-pic-base
23941 @opindex msingle-pic-base
23942 Treat the register used for PIC addressing as read-only, rather than
23943 loading it in the prologue for each function. The runtime system is
23944 responsible for initializing this register with an appropriate value
23945 before execution begins.
23947 @item -mprioritize-restricted-insns=@var{priority}
23948 @opindex mprioritize-restricted-insns
23949 This option controls the priority that is assigned to
23950 dispatch-slot restricted instructions during the second scheduling
23951 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
23952 or @samp{2} to assign no, highest, or second-highest (respectively)
23953 priority to dispatch-slot restricted
23956 @item -msched-costly-dep=@var{dependence_type}
23957 @opindex msched-costly-dep
23958 This option controls which dependences are considered costly
23959 by the target during instruction scheduling. The argument
23960 @var{dependence_type} takes one of the following values:
23964 No dependence is costly.
23967 All dependences are costly.
23969 @item @samp{true_store_to_load}
23970 A true dependence from store to load is costly.
23972 @item @samp{store_to_load}
23973 Any dependence from store to load is costly.
23976 Any dependence for which the latency is greater than or equal to
23977 @var{number} is costly.
23980 @item -minsert-sched-nops=@var{scheme}
23981 @opindex minsert-sched-nops
23982 This option controls which NOP insertion scheme is used during
23983 the second scheduling pass. The argument @var{scheme} takes one of the
23991 Pad with NOPs any dispatch group that has vacant issue slots,
23992 according to the scheduler's grouping.
23994 @item @samp{regroup_exact}
23995 Insert NOPs to force costly dependent insns into
23996 separate groups. Insert exactly as many NOPs as needed to force an insn
23997 to a new group, according to the estimated processor grouping.
24000 Insert NOPs to force costly dependent insns into
24001 separate groups. Insert @var{number} NOPs to force an insn to a new group.
24005 @opindex mcall-sysv
24006 On System V.4 and embedded PowerPC systems compile code using calling
24007 conventions that adhere to the March 1995 draft of the System V
24008 Application Binary Interface, PowerPC processor supplement. This is the
24009 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
24011 @item -mcall-sysv-eabi
24013 @opindex mcall-sysv-eabi
24014 @opindex mcall-eabi
24015 Specify both @option{-mcall-sysv} and @option{-meabi} options.
24017 @item -mcall-sysv-noeabi
24018 @opindex mcall-sysv-noeabi
24019 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
24021 @item -mcall-aixdesc
24023 On System V.4 and embedded PowerPC systems compile code for the AIX
24027 @opindex mcall-linux
24028 On System V.4 and embedded PowerPC systems compile code for the
24029 Linux-based GNU system.
24031 @item -mcall-freebsd
24032 @opindex mcall-freebsd
24033 On System V.4 and embedded PowerPC systems compile code for the
24034 FreeBSD operating system.
24036 @item -mcall-netbsd
24037 @opindex mcall-netbsd
24038 On System V.4 and embedded PowerPC systems compile code for the
24039 NetBSD operating system.
24041 @item -mcall-openbsd
24042 @opindex mcall-netbsd
24043 On System V.4 and embedded PowerPC systems compile code for the
24044 OpenBSD operating system.
24046 @item -mtraceback=@var{traceback_type}
24047 @opindex mtraceback
24048 Select the type of traceback table. Valid values for @var{traceback_type}
24049 are @samp{full}, @samp{part}, and @samp{no}.
24051 @item -maix-struct-return
24052 @opindex maix-struct-return
24053 Return all structures in memory (as specified by the AIX ABI)@.
24055 @item -msvr4-struct-return
24056 @opindex msvr4-struct-return
24057 Return structures smaller than 8 bytes in registers (as specified by the
24060 @item -mabi=@var{abi-type}
24062 Extend the current ABI with a particular extension, or remove such extension.
24063 Valid values are @samp{altivec}, @samp{no-altivec},
24064 @samp{ibmlongdouble}, @samp{ieeelongdouble},
24065 @samp{elfv1}, @samp{elfv2}@.
24067 @item -mabi=ibmlongdouble
24068 @opindex mabi=ibmlongdouble
24069 Change the current ABI to use IBM extended-precision long double.
24070 This is not likely to work if your system defaults to using IEEE
24071 extended-precision long double. If you change the long double type
24072 from IEEE extended-precision, the compiler will issue a warning unless
24073 you use the @option{-Wno-psabi} option.
24075 @item -mabi=ieeelongdouble
24076 @opindex mabi=ieeelongdouble
24077 Change the current ABI to use IEEE extended-precision long double.
24078 This is not likely to work if your system defaults to using IBM
24079 extended-precision long double. If you change the long double type
24080 from IBM extended-precision, the compiler will issue a warning unless
24081 you use the @option{-Wno-psabi} option.
24084 @opindex mabi=elfv1
24085 Change the current ABI to use the ELFv1 ABI.
24086 This is the default ABI for big-endian PowerPC 64-bit Linux.
24087 Overriding the default ABI requires special system support and is
24088 likely to fail in spectacular ways.
24091 @opindex mabi=elfv2
24092 Change the current ABI to use the ELFv2 ABI.
24093 This is the default ABI for little-endian PowerPC 64-bit Linux.
24094 Overriding the default ABI requires special system support and is
24095 likely to fail in spectacular ways.
24097 @item -mgnu-attribute
24098 @itemx -mno-gnu-attribute
24099 @opindex mgnu-attribute
24100 @opindex mno-gnu-attribute
24101 Emit .gnu_attribute assembly directives to set tag/value pairs in a
24102 .gnu.attributes section that specify ABI variations in function
24103 parameters or return values.
24106 @itemx -mno-prototype
24107 @opindex mprototype
24108 @opindex mno-prototype
24109 On System V.4 and embedded PowerPC systems assume that all calls to
24110 variable argument functions are properly prototyped. Otherwise, the
24111 compiler must insert an instruction before every non-prototyped call to
24112 set or clear bit 6 of the condition code register (@code{CR}) to
24113 indicate whether floating-point values are passed in the floating-point
24114 registers in case the function takes variable arguments. With
24115 @option{-mprototype}, only calls to prototyped variable argument functions
24116 set or clear the bit.
24120 On embedded PowerPC systems, assume that the startup module is called
24121 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
24122 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
24127 On embedded PowerPC systems, assume that the startup module is called
24128 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
24133 On embedded PowerPC systems, assume that the startup module is called
24134 @file{crt0.o} and the standard C libraries are @file{libads.a} and
24137 @item -myellowknife
24138 @opindex myellowknife
24139 On embedded PowerPC systems, assume that the startup module is called
24140 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
24145 On System V.4 and embedded PowerPC systems, specify that you are
24146 compiling for a VxWorks system.
24150 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
24151 header to indicate that @samp{eabi} extended relocations are used.
24157 On System V.4 and embedded PowerPC systems do (do not) adhere to the
24158 Embedded Applications Binary Interface (EABI), which is a set of
24159 modifications to the System V.4 specifications. Selecting @option{-meabi}
24160 means that the stack is aligned to an 8-byte boundary, a function
24161 @code{__eabi} is called from @code{main} to set up the EABI
24162 environment, and the @option{-msdata} option can use both @code{r2} and
24163 @code{r13} to point to two separate small data areas. Selecting
24164 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
24165 no EABI initialization function is called from @code{main}, and the
24166 @option{-msdata} option only uses @code{r13} to point to a single
24167 small data area. The @option{-meabi} option is on by default if you
24168 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
24171 @opindex msdata=eabi
24172 On System V.4 and embedded PowerPC systems, put small initialized
24173 @code{const} global and static data in the @code{.sdata2} section, which
24174 is pointed to by register @code{r2}. Put small initialized
24175 non-@code{const} global and static data in the @code{.sdata} section,
24176 which is pointed to by register @code{r13}. Put small uninitialized
24177 global and static data in the @code{.sbss} section, which is adjacent to
24178 the @code{.sdata} section. The @option{-msdata=eabi} option is
24179 incompatible with the @option{-mrelocatable} option. The
24180 @option{-msdata=eabi} option also sets the @option{-memb} option.
24183 @opindex msdata=sysv
24184 On System V.4 and embedded PowerPC systems, put small global and static
24185 data in the @code{.sdata} section, which is pointed to by register
24186 @code{r13}. Put small uninitialized global and static data in the
24187 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
24188 The @option{-msdata=sysv} option is incompatible with the
24189 @option{-mrelocatable} option.
24191 @item -msdata=default
24193 @opindex msdata=default
24195 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
24196 compile code the same as @option{-msdata=eabi}, otherwise compile code the
24197 same as @option{-msdata=sysv}.
24200 @opindex msdata=data
24201 On System V.4 and embedded PowerPC systems, put small global
24202 data in the @code{.sdata} section. Put small uninitialized global
24203 data in the @code{.sbss} section. Do not use register @code{r13}
24204 to address small data however. This is the default behavior unless
24205 other @option{-msdata} options are used.
24209 @opindex msdata=none
24211 On embedded PowerPC systems, put all initialized global and static data
24212 in the @code{.data} section, and all uninitialized data in the
24213 @code{.bss} section.
24215 @item -mreadonly-in-sdata
24216 @opindex mreadonly-in-sdata
24217 @opindex mno-readonly-in-sdata
24218 Put read-only objects in the @code{.sdata} section as well. This is the
24221 @item -mblock-move-inline-limit=@var{num}
24222 @opindex mblock-move-inline-limit
24223 Inline all block moves (such as calls to @code{memcpy} or structure
24224 copies) less than or equal to @var{num} bytes. The minimum value for
24225 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
24226 targets. The default value is target-specific.
24228 @item -mblock-compare-inline-limit=@var{num}
24229 @opindex mblock-compare-inline-limit
24230 Generate non-looping inline code for all block compares (such as calls
24231 to @code{memcmp} or structure compares) less than or equal to @var{num}
24232 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
24233 block compare is disabled. The default value is target-specific.
24235 @item -mblock-compare-inline-loop-limit=@var{num}
24236 @opindex mblock-compare-inline-loop-limit
24237 Generate an inline expansion using loop code for all block compares that
24238 are less than or equal to @var{num} bytes, but greater than the limit
24239 for non-loop inline block compare expansion. If the block length is not
24240 constant, at most @var{num} bytes will be compared before @code{memcmp}
24241 is called to compare the remainder of the block. The default value is
24244 @item -mstring-compare-inline-limit=@var{num}
24245 @opindex mstring-compare-inline-limit
24246 Generate at most @var{num} pairs of load instructions to compare the
24247 string inline. If the difference or end of string is not found at the
24248 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
24249 take care of the rest of the comparison. The default is 8 pairs of
24250 loads, which will compare 64 bytes on a 64-bit target and 32 bytes on a
24255 @cindex smaller data references (PowerPC)
24256 @cindex .sdata/.sdata2 references (PowerPC)
24257 On embedded PowerPC systems, put global and static items less than or
24258 equal to @var{num} bytes into the small data or BSS sections instead of
24259 the normal data or BSS section. By default, @var{num} is 8. The
24260 @option{-G @var{num}} switch is also passed to the linker.
24261 All modules should be compiled with the same @option{-G @var{num}} value.
24264 @itemx -mno-regnames
24266 @opindex mno-regnames
24267 On System V.4 and embedded PowerPC systems do (do not) emit register
24268 names in the assembly language output using symbolic forms.
24271 @itemx -mno-longcall
24273 @opindex mno-longcall
24274 By default assume that all calls are far away so that a longer and more
24275 expensive calling sequence is required. This is required for calls
24276 farther than 32 megabytes (33,554,432 bytes) from the current location.
24277 A short call is generated if the compiler knows
24278 the call cannot be that far away. This setting can be overridden by
24279 the @code{shortcall} function attribute, or by @code{#pragma
24282 Some linkers are capable of detecting out-of-range calls and generating
24283 glue code on the fly. On these systems, long calls are unnecessary and
24284 generate slower code. As of this writing, the AIX linker can do this,
24285 as can the GNU linker for PowerPC/64. It is planned to add this feature
24286 to the GNU linker for 32-bit PowerPC systems as well.
24288 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
24289 callee, L42}, plus a @dfn{branch island} (glue code). The two target
24290 addresses represent the callee and the branch island. The
24291 Darwin/PPC linker prefers the first address and generates a @code{bl
24292 callee} if the PPC @code{bl} instruction reaches the callee directly;
24293 otherwise, the linker generates @code{bl L42} to call the branch
24294 island. The branch island is appended to the body of the
24295 calling function; it computes the full 32-bit address of the callee
24298 On Mach-O (Darwin) systems, this option directs the compiler emit to
24299 the glue for every direct call, and the Darwin linker decides whether
24300 to use or discard it.
24302 In the future, GCC may ignore all longcall specifications
24303 when the linker is known to generate glue.
24305 @item -mtls-markers
24306 @itemx -mno-tls-markers
24307 @opindex mtls-markers
24308 @opindex mno-tls-markers
24309 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
24310 specifying the function argument. The relocation allows the linker to
24311 reliably associate function call with argument setup instructions for
24312 TLS optimization, which in turn allows GCC to better schedule the
24318 This option enables use of the reciprocal estimate and
24319 reciprocal square root estimate instructions with additional
24320 Newton-Raphson steps to increase precision instead of doing a divide or
24321 square root and divide for floating-point arguments. You should use
24322 the @option{-ffast-math} option when using @option{-mrecip} (or at
24323 least @option{-funsafe-math-optimizations},
24324 @option{-ffinite-math-only}, @option{-freciprocal-math} and
24325 @option{-fno-trapping-math}). Note that while the throughput of the
24326 sequence is generally higher than the throughput of the non-reciprocal
24327 instruction, the precision of the sequence can be decreased by up to 2
24328 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
24331 @item -mrecip=@var{opt}
24332 @opindex mrecip=opt
24333 This option controls which reciprocal estimate instructions
24334 may be used. @var{opt} is a comma-separated list of options, which may
24335 be preceded by a @code{!} to invert the option:
24340 Enable all estimate instructions.
24343 Enable the default instructions, equivalent to @option{-mrecip}.
24346 Disable all estimate instructions, equivalent to @option{-mno-recip}.
24349 Enable the reciprocal approximation instructions for both
24350 single and double precision.
24353 Enable the single-precision reciprocal approximation instructions.
24356 Enable the double-precision reciprocal approximation instructions.
24359 Enable the reciprocal square root approximation instructions for both
24360 single and double precision.
24363 Enable the single-precision reciprocal square root approximation instructions.
24366 Enable the double-precision reciprocal square root approximation instructions.
24370 So, for example, @option{-mrecip=all,!rsqrtd} enables
24371 all of the reciprocal estimate instructions, except for the
24372 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
24373 which handle the double-precision reciprocal square root calculations.
24375 @item -mrecip-precision
24376 @itemx -mno-recip-precision
24377 @opindex mrecip-precision
24378 Assume (do not assume) that the reciprocal estimate instructions
24379 provide higher-precision estimates than is mandated by the PowerPC
24380 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
24381 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
24382 The double-precision square root estimate instructions are not generated by
24383 default on low-precision machines, since they do not provide an
24384 estimate that converges after three steps.
24386 @item -mveclibabi=@var{type}
24387 @opindex mveclibabi
24388 Specifies the ABI type to use for vectorizing intrinsics using an
24389 external library. The only type supported at present is @samp{mass},
24390 which specifies to use IBM's Mathematical Acceleration Subsystem
24391 (MASS) libraries for vectorizing intrinsics using external libraries.
24392 GCC currently emits calls to @code{acosd2}, @code{acosf4},
24393 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
24394 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
24395 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
24396 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
24397 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
24398 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
24399 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
24400 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
24401 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
24402 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
24403 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
24404 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
24405 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
24406 for power7. Both @option{-ftree-vectorize} and
24407 @option{-funsafe-math-optimizations} must also be enabled. The MASS
24408 libraries must be specified at link time.
24413 Generate (do not generate) the @code{friz} instruction when the
24414 @option{-funsafe-math-optimizations} option is used to optimize
24415 rounding of floating-point values to 64-bit integer and back to floating
24416 point. The @code{friz} instruction does not return the same value if
24417 the floating-point number is too large to fit in an integer.
24419 @item -mpointers-to-nested-functions
24420 @itemx -mno-pointers-to-nested-functions
24421 @opindex mpointers-to-nested-functions
24422 Generate (do not generate) code to load up the static chain register
24423 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
24424 systems where a function pointer points to a 3-word descriptor giving
24425 the function address, TOC value to be loaded in register @code{r2}, and
24426 static chain value to be loaded in register @code{r11}. The
24427 @option{-mpointers-to-nested-functions} is on by default. You cannot
24428 call through pointers to nested functions or pointers
24429 to functions compiled in other languages that use the static chain if
24430 you use @option{-mno-pointers-to-nested-functions}.
24432 @item -msave-toc-indirect
24433 @itemx -mno-save-toc-indirect
24434 @opindex msave-toc-indirect
24435 Generate (do not generate) code to save the TOC value in the reserved
24436 stack location in the function prologue if the function calls through
24437 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
24438 saved in the prologue, it is saved just before the call through the
24439 pointer. The @option{-mno-save-toc-indirect} option is the default.
24441 @item -mcompat-align-parm
24442 @itemx -mno-compat-align-parm
24443 @opindex mcompat-align-parm
24444 Generate (do not generate) code to pass structure parameters with a
24445 maximum alignment of 64 bits, for compatibility with older versions
24448 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
24449 structure parameter on a 128-bit boundary when that structure contained
24450 a member requiring 128-bit alignment. This is corrected in more
24451 recent versions of GCC. This option may be used to generate code
24452 that is compatible with functions compiled with older versions of
24455 The @option{-mno-compat-align-parm} option is the default.
24457 @item -mstack-protector-guard=@var{guard}
24458 @itemx -mstack-protector-guard-reg=@var{reg}
24459 @itemx -mstack-protector-guard-offset=@var{offset}
24460 @itemx -mstack-protector-guard-symbol=@var{symbol}
24461 @opindex mstack-protector-guard
24462 @opindex mstack-protector-guard-reg
24463 @opindex mstack-protector-guard-offset
24464 @opindex mstack-protector-guard-symbol
24465 Generate stack protection code using canary at @var{guard}. Supported
24466 locations are @samp{global} for global canary or @samp{tls} for per-thread
24467 canary in the TLS block (the default with GNU libc version 2.4 or later).
24469 With the latter choice the options
24470 @option{-mstack-protector-guard-reg=@var{reg}} and
24471 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
24472 which register to use as base register for reading the canary, and from what
24473 offset from that base register. The default for those is as specified in the
24474 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
24475 the offset with a symbol reference to a canary in the TLS block.
24479 @subsection RX Options
24482 These command-line options are defined for RX targets:
24485 @item -m64bit-doubles
24486 @itemx -m32bit-doubles
24487 @opindex m64bit-doubles
24488 @opindex m32bit-doubles
24489 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24490 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24491 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
24492 works on 32-bit values, which is why the default is
24493 @option{-m32bit-doubles}.
24499 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
24500 floating-point hardware. The default is enabled for the RX600
24501 series and disabled for the RX200 series.
24503 Floating-point instructions are only generated for 32-bit floating-point
24504 values, however, so the FPU hardware is not used for doubles if the
24505 @option{-m64bit-doubles} option is used.
24507 @emph{Note} If the @option{-fpu} option is enabled then
24508 @option{-funsafe-math-optimizations} is also enabled automatically.
24509 This is because the RX FPU instructions are themselves unsafe.
24511 @item -mcpu=@var{name}
24513 Selects the type of RX CPU to be targeted. Currently three types are
24514 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
24515 the specific @samp{RX610} CPU. The default is @samp{RX600}.
24517 The only difference between @samp{RX600} and @samp{RX610} is that the
24518 @samp{RX610} does not support the @code{MVTIPL} instruction.
24520 The @samp{RX200} series does not have a hardware floating-point unit
24521 and so @option{-nofpu} is enabled by default when this type is
24524 @item -mbig-endian-data
24525 @itemx -mlittle-endian-data
24526 @opindex mbig-endian-data
24527 @opindex mlittle-endian-data
24528 Store data (but not code) in the big-endian format. The default is
24529 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
24532 @item -msmall-data-limit=@var{N}
24533 @opindex msmall-data-limit
24534 Specifies the maximum size in bytes of global and static variables
24535 which can be placed into the small data area. Using the small data
24536 area can lead to smaller and faster code, but the size of area is
24537 limited and it is up to the programmer to ensure that the area does
24538 not overflow. Also when the small data area is used one of the RX's
24539 registers (usually @code{r13}) is reserved for use pointing to this
24540 area, so it is no longer available for use by the compiler. This
24541 could result in slower and/or larger code if variables are pushed onto
24542 the stack instead of being held in this register.
24544 Note, common variables (variables that have not been initialized) and
24545 constants are not placed into the small data area as they are assigned
24546 to other sections in the output executable.
24548 The default value is zero, which disables this feature. Note, this
24549 feature is not enabled by default with higher optimization levels
24550 (@option{-O2} etc) because of the potentially detrimental effects of
24551 reserving a register. It is up to the programmer to experiment and
24552 discover whether this feature is of benefit to their program. See the
24553 description of the @option{-mpid} option for a description of how the
24554 actual register to hold the small data area pointer is chosen.
24560 Use the simulator runtime. The default is to use the libgloss
24561 board-specific runtime.
24563 @item -mas100-syntax
24564 @itemx -mno-as100-syntax
24565 @opindex mas100-syntax
24566 @opindex mno-as100-syntax
24567 When generating assembler output use a syntax that is compatible with
24568 Renesas's AS100 assembler. This syntax can also be handled by the GAS
24569 assembler, but it has some restrictions so it is not generated by default.
24571 @item -mmax-constant-size=@var{N}
24572 @opindex mmax-constant-size
24573 Specifies the maximum size, in bytes, of a constant that can be used as
24574 an operand in a RX instruction. Although the RX instruction set does
24575 allow constants of up to 4 bytes in length to be used in instructions,
24576 a longer value equates to a longer instruction. Thus in some
24577 circumstances it can be beneficial to restrict the size of constants
24578 that are used in instructions. Constants that are too big are instead
24579 placed into a constant pool and referenced via register indirection.
24581 The value @var{N} can be between 0 and 4. A value of 0 (the default)
24582 or 4 means that constants of any size are allowed.
24586 Enable linker relaxation. Linker relaxation is a process whereby the
24587 linker attempts to reduce the size of a program by finding shorter
24588 versions of various instructions. Disabled by default.
24590 @item -mint-register=@var{N}
24591 @opindex mint-register
24592 Specify the number of registers to reserve for fast interrupt handler
24593 functions. The value @var{N} can be between 0 and 4. A value of 1
24594 means that register @code{r13} is reserved for the exclusive use
24595 of fast interrupt handlers. A value of 2 reserves @code{r13} and
24596 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
24597 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
24598 A value of 0, the default, does not reserve any registers.
24600 @item -msave-acc-in-interrupts
24601 @opindex msave-acc-in-interrupts
24602 Specifies that interrupt handler functions should preserve the
24603 accumulator register. This is only necessary if normal code might use
24604 the accumulator register, for example because it performs 64-bit
24605 multiplications. The default is to ignore the accumulator as this
24606 makes the interrupt handlers faster.
24612 Enables the generation of position independent data. When enabled any
24613 access to constant data is done via an offset from a base address
24614 held in a register. This allows the location of constant data to be
24615 determined at run time without requiring the executable to be
24616 relocated, which is a benefit to embedded applications with tight
24617 memory constraints. Data that can be modified is not affected by this
24620 Note, using this feature reserves a register, usually @code{r13}, for
24621 the constant data base address. This can result in slower and/or
24622 larger code, especially in complicated functions.
24624 The actual register chosen to hold the constant data base address
24625 depends upon whether the @option{-msmall-data-limit} and/or the
24626 @option{-mint-register} command-line options are enabled. Starting
24627 with register @code{r13} and proceeding downwards, registers are
24628 allocated first to satisfy the requirements of @option{-mint-register},
24629 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
24630 is possible for the small data area register to be @code{r8} if both
24631 @option{-mint-register=4} and @option{-mpid} are specified on the
24634 By default this feature is not enabled. The default can be restored
24635 via the @option{-mno-pid} command-line option.
24637 @item -mno-warn-multiple-fast-interrupts
24638 @itemx -mwarn-multiple-fast-interrupts
24639 @opindex mno-warn-multiple-fast-interrupts
24640 @opindex mwarn-multiple-fast-interrupts
24641 Prevents GCC from issuing a warning message if it finds more than one
24642 fast interrupt handler when it is compiling a file. The default is to
24643 issue a warning for each extra fast interrupt handler found, as the RX
24644 only supports one such interrupt.
24646 @item -mallow-string-insns
24647 @itemx -mno-allow-string-insns
24648 @opindex mallow-string-insns
24649 @opindex mno-allow-string-insns
24650 Enables or disables the use of the string manipulation instructions
24651 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
24652 @code{SWHILE} and also the @code{RMPA} instruction. These
24653 instructions may prefetch data, which is not safe to do if accessing
24654 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
24655 for more information).
24657 The default is to allow these instructions, but it is not possible for
24658 GCC to reliably detect all circumstances where a string instruction
24659 might be used to access an I/O register, so their use cannot be
24660 disabled automatically. Instead it is reliant upon the programmer to
24661 use the @option{-mno-allow-string-insns} option if their program
24662 accesses I/O space.
24664 When the instructions are enabled GCC defines the C preprocessor
24665 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
24666 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
24672 Use only (or not only) @code{JSR} instructions to access functions.
24673 This option can be used when code size exceeds the range of @code{BSR}
24674 instructions. Note that @option{-mno-jsr} does not mean to not use
24675 @code{JSR} but instead means that any type of branch may be used.
24678 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
24679 has special significance to the RX port when used with the
24680 @code{interrupt} function attribute. This attribute indicates a
24681 function intended to process fast interrupts. GCC ensures
24682 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
24683 and/or @code{r13} and only provided that the normal use of the
24684 corresponding registers have been restricted via the
24685 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
24688 @node S/390 and zSeries Options
24689 @subsection S/390 and zSeries Options
24690 @cindex S/390 and zSeries Options
24692 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
24696 @itemx -msoft-float
24697 @opindex mhard-float
24698 @opindex msoft-float
24699 Use (do not use) the hardware floating-point instructions and registers
24700 for floating-point operations. When @option{-msoft-float} is specified,
24701 functions in @file{libgcc.a} are used to perform floating-point
24702 operations. When @option{-mhard-float} is specified, the compiler
24703 generates IEEE floating-point instructions. This is the default.
24706 @itemx -mno-hard-dfp
24708 @opindex mno-hard-dfp
24709 Use (do not use) the hardware decimal-floating-point instructions for
24710 decimal-floating-point operations. When @option{-mno-hard-dfp} is
24711 specified, functions in @file{libgcc.a} are used to perform
24712 decimal-floating-point operations. When @option{-mhard-dfp} is
24713 specified, the compiler generates decimal-floating-point hardware
24714 instructions. This is the default for @option{-march=z9-ec} or higher.
24716 @item -mlong-double-64
24717 @itemx -mlong-double-128
24718 @opindex mlong-double-64
24719 @opindex mlong-double-128
24720 These switches control the size of @code{long double} type. A size
24721 of 64 bits makes the @code{long double} type equivalent to the @code{double}
24722 type. This is the default.
24725 @itemx -mno-backchain
24726 @opindex mbackchain
24727 @opindex mno-backchain
24728 Store (do not store) the address of the caller's frame as backchain pointer
24729 into the callee's stack frame.
24730 A backchain may be needed to allow debugging using tools that do not understand
24731 DWARF call frame information.
24732 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
24733 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
24734 the backchain is placed into the topmost word of the 96/160 byte register
24737 In general, code compiled with @option{-mbackchain} is call-compatible with
24738 code compiled with @option{-mmo-backchain}; however, use of the backchain
24739 for debugging purposes usually requires that the whole binary is built with
24740 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
24741 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
24742 to build a linux kernel use @option{-msoft-float}.
24744 The default is to not maintain the backchain.
24746 @item -mpacked-stack
24747 @itemx -mno-packed-stack
24748 @opindex mpacked-stack
24749 @opindex mno-packed-stack
24750 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
24751 specified, the compiler uses the all fields of the 96/160 byte register save
24752 area only for their default purpose; unused fields still take up stack space.
24753 When @option{-mpacked-stack} is specified, register save slots are densely
24754 packed at the top of the register save area; unused space is reused for other
24755 purposes, allowing for more efficient use of the available stack space.
24756 However, when @option{-mbackchain} is also in effect, the topmost word of
24757 the save area is always used to store the backchain, and the return address
24758 register is always saved two words below the backchain.
24760 As long as the stack frame backchain is not used, code generated with
24761 @option{-mpacked-stack} is call-compatible with code generated with
24762 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
24763 S/390 or zSeries generated code that uses the stack frame backchain at run
24764 time, not just for debugging purposes. Such code is not call-compatible
24765 with code compiled with @option{-mpacked-stack}. Also, note that the
24766 combination of @option{-mbackchain},
24767 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
24768 to build a linux kernel use @option{-msoft-float}.
24770 The default is to not use the packed stack layout.
24773 @itemx -mno-small-exec
24774 @opindex msmall-exec
24775 @opindex mno-small-exec
24776 Generate (or do not generate) code using the @code{bras} instruction
24777 to do subroutine calls.
24778 This only works reliably if the total executable size does not
24779 exceed 64k. The default is to use the @code{basr} instruction instead,
24780 which does not have this limitation.
24786 When @option{-m31} is specified, generate code compliant to the
24787 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
24788 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
24789 particular to generate 64-bit instructions. For the @samp{s390}
24790 targets, the default is @option{-m31}, while the @samp{s390x}
24791 targets default to @option{-m64}.
24797 When @option{-mzarch} is specified, generate code using the
24798 instructions available on z/Architecture.
24799 When @option{-mesa} is specified, generate code using the
24800 instructions available on ESA/390. Note that @option{-mesa} is
24801 not possible with @option{-m64}.
24802 When generating code compliant to the GNU/Linux for S/390 ABI,
24803 the default is @option{-mesa}. When generating code compliant
24804 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
24810 The @option{-mhtm} option enables a set of builtins making use of
24811 instructions available with the transactional execution facility
24812 introduced with the IBM zEnterprise EC12 machine generation
24813 @ref{S/390 System z Built-in Functions}.
24814 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
24820 When @option{-mvx} is specified, generate code using the instructions
24821 available with the vector extension facility introduced with the IBM
24822 z13 machine generation.
24823 This option changes the ABI for some vector type values with regard to
24824 alignment and calling conventions. In case vector type values are
24825 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
24826 command will be added to mark the resulting binary with the ABI used.
24827 @option{-mvx} is enabled by default when using @option{-march=z13}.
24830 @itemx -mno-zvector
24832 @opindex mno-zvector
24833 The @option{-mzvector} option enables vector language extensions and
24834 builtins using instructions available with the vector extension
24835 facility introduced with the IBM z13 machine generation.
24836 This option adds support for @samp{vector} to be used as a keyword to
24837 define vector type variables and arguments. @samp{vector} is only
24838 available when GNU extensions are enabled. It will not be expanded
24839 when requesting strict standard compliance e.g. with @option{-std=c99}.
24840 In addition to the GCC low-level builtins @option{-mzvector} enables
24841 a set of builtins added for compatibility with AltiVec-style
24842 implementations like Power and Cell. In order to make use of these
24843 builtins the header file @file{vecintrin.h} needs to be included.
24844 @option{-mzvector} is disabled by default.
24850 Generate (or do not generate) code using the @code{mvcle} instruction
24851 to perform block moves. When @option{-mno-mvcle} is specified,
24852 use a @code{mvc} loop instead. This is the default unless optimizing for
24859 Print (or do not print) additional debug information when compiling.
24860 The default is to not print debug information.
24862 @item -march=@var{cpu-type}
24864 Generate code that runs on @var{cpu-type}, which is the name of a
24865 system representing a certain processor type. Possible values for
24866 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
24867 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
24868 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11}, and
24871 The default is @option{-march=z900}.
24873 Specifying @samp{native} as cpu type can be used to select the best
24874 architecture option for the host processor.
24875 @option{-march=native} has no effect if GCC does not recognize the
24878 @item -mtune=@var{cpu-type}
24880 Tune to @var{cpu-type} everything applicable about the generated code,
24881 except for the ABI and the set of available instructions.
24882 The list of @var{cpu-type} values is the same as for @option{-march}.
24883 The default is the value used for @option{-march}.
24886 @itemx -mno-tpf-trace
24887 @opindex mtpf-trace
24888 @opindex mno-tpf-trace
24889 Generate code that adds (does not add) in TPF OS specific branches to trace
24890 routines in the operating system. This option is off by default, even
24891 when compiling for the TPF OS@.
24894 @itemx -mno-fused-madd
24895 @opindex mfused-madd
24896 @opindex mno-fused-madd
24897 Generate code that uses (does not use) the floating-point multiply and
24898 accumulate instructions. These instructions are generated by default if
24899 hardware floating point is used.
24901 @item -mwarn-framesize=@var{framesize}
24902 @opindex mwarn-framesize
24903 Emit a warning if the current function exceeds the given frame size. Because
24904 this is a compile-time check it doesn't need to be a real problem when the program
24905 runs. It is intended to identify functions that most probably cause
24906 a stack overflow. It is useful to be used in an environment with limited stack
24907 size e.g.@: the linux kernel.
24909 @item -mwarn-dynamicstack
24910 @opindex mwarn-dynamicstack
24911 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
24912 arrays. This is generally a bad idea with a limited stack size.
24914 @item -mstack-guard=@var{stack-guard}
24915 @itemx -mstack-size=@var{stack-size}
24916 @opindex mstack-guard
24917 @opindex mstack-size
24918 If these options are provided the S/390 back end emits additional instructions in
24919 the function prologue that trigger a trap if the stack size is @var{stack-guard}
24920 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
24921 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
24922 the frame size of the compiled function is chosen.
24923 These options are intended to be used to help debugging stack overflow problems.
24924 The additionally emitted code causes only little overhead and hence can also be
24925 used in production-like systems without greater performance degradation. The given
24926 values have to be exact powers of 2 and @var{stack-size} has to be greater than
24927 @var{stack-guard} without exceeding 64k.
24928 In order to be efficient the extra code makes the assumption that the stack starts
24929 at an address aligned to the value given by @var{stack-size}.
24930 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
24932 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
24934 If the hotpatch option is enabled, a ``hot-patching'' function
24935 prologue is generated for all functions in the compilation unit.
24936 The funtion label is prepended with the given number of two-byte
24937 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
24938 the label, 2 * @var{post-halfwords} bytes are appended, using the
24939 largest NOP like instructions the architecture allows (maximum
24942 If both arguments are zero, hotpatching is disabled.
24944 This option can be overridden for individual functions with the
24945 @code{hotpatch} attribute.
24948 @node Score Options
24949 @subsection Score Options
24950 @cindex Score Options
24952 These options are defined for Score implementations:
24957 Compile code for big-endian mode. This is the default.
24961 Compile code for little-endian mode.
24965 Disable generation of @code{bcnz} instructions.
24969 Enable generation of unaligned load and store instructions.
24973 Enable the use of multiply-accumulate instructions. Disabled by default.
24977 Specify the SCORE5 as the target architecture.
24981 Specify the SCORE5U of the target architecture.
24985 Specify the SCORE7 as the target architecture. This is the default.
24989 Specify the SCORE7D as the target architecture.
24993 @subsection SH Options
24995 These @samp{-m} options are defined for the SH implementations:
25000 Generate code for the SH1.
25004 Generate code for the SH2.
25007 Generate code for the SH2e.
25011 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
25012 that the floating-point unit is not used.
25014 @item -m2a-single-only
25015 @opindex m2a-single-only
25016 Generate code for the SH2a-FPU, in such a way that no double-precision
25017 floating-point operations are used.
25020 @opindex m2a-single
25021 Generate code for the SH2a-FPU assuming the floating-point unit is in
25022 single-precision mode by default.
25026 Generate code for the SH2a-FPU assuming the floating-point unit is in
25027 double-precision mode by default.
25031 Generate code for the SH3.
25035 Generate code for the SH3e.
25039 Generate code for the SH4 without a floating-point unit.
25041 @item -m4-single-only
25042 @opindex m4-single-only
25043 Generate code for the SH4 with a floating-point unit that only
25044 supports single-precision arithmetic.
25048 Generate code for the SH4 assuming the floating-point unit is in
25049 single-precision mode by default.
25053 Generate code for the SH4.
25057 Generate code for SH4-100.
25059 @item -m4-100-nofpu
25060 @opindex m4-100-nofpu
25061 Generate code for SH4-100 in such a way that the
25062 floating-point unit is not used.
25064 @item -m4-100-single
25065 @opindex m4-100-single
25066 Generate code for SH4-100 assuming the floating-point unit is in
25067 single-precision mode by default.
25069 @item -m4-100-single-only
25070 @opindex m4-100-single-only
25071 Generate code for SH4-100 in such a way that no double-precision
25072 floating-point operations are used.
25076 Generate code for SH4-200.
25078 @item -m4-200-nofpu
25079 @opindex m4-200-nofpu
25080 Generate code for SH4-200 without in such a way that the
25081 floating-point unit is not used.
25083 @item -m4-200-single
25084 @opindex m4-200-single
25085 Generate code for SH4-200 assuming the floating-point unit is in
25086 single-precision mode by default.
25088 @item -m4-200-single-only
25089 @opindex m4-200-single-only
25090 Generate code for SH4-200 in such a way that no double-precision
25091 floating-point operations are used.
25095 Generate code for SH4-300.
25097 @item -m4-300-nofpu
25098 @opindex m4-300-nofpu
25099 Generate code for SH4-300 without in such a way that the
25100 floating-point unit is not used.
25102 @item -m4-300-single
25103 @opindex m4-300-single
25104 Generate code for SH4-300 in such a way that no double-precision
25105 floating-point operations are used.
25107 @item -m4-300-single-only
25108 @opindex m4-300-single-only
25109 Generate code for SH4-300 in such a way that no double-precision
25110 floating-point operations are used.
25114 Generate code for SH4-340 (no MMU, no FPU).
25118 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
25123 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
25124 floating-point unit is not used.
25126 @item -m4a-single-only
25127 @opindex m4a-single-only
25128 Generate code for the SH4a, in such a way that no double-precision
25129 floating-point operations are used.
25132 @opindex m4a-single
25133 Generate code for the SH4a assuming the floating-point unit is in
25134 single-precision mode by default.
25138 Generate code for the SH4a.
25142 Same as @option{-m4a-nofpu}, except that it implicitly passes
25143 @option{-dsp} to the assembler. GCC doesn't generate any DSP
25144 instructions at the moment.
25148 Compile code for the processor in big-endian mode.
25152 Compile code for the processor in little-endian mode.
25156 Align doubles at 64-bit boundaries. Note that this changes the calling
25157 conventions, and thus some functions from the standard C library do
25158 not work unless you recompile it first with @option{-mdalign}.
25162 Shorten some address references at link time, when possible; uses the
25163 linker option @option{-relax}.
25167 Use 32-bit offsets in @code{switch} tables. The default is to use
25172 Enable the use of bit manipulation instructions on SH2A.
25176 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
25177 alignment constraints.
25181 Comply with the calling conventions defined by Renesas.
25184 @opindex mno-renesas
25185 Comply with the calling conventions defined for GCC before the Renesas
25186 conventions were available. This option is the default for all
25187 targets of the SH toolchain.
25190 @opindex mnomacsave
25191 Mark the @code{MAC} register as call-clobbered, even if
25192 @option{-mrenesas} is given.
25198 Control the IEEE compliance of floating-point comparisons, which affects the
25199 handling of cases where the result of a comparison is unordered. By default
25200 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
25201 enabled @option{-mno-ieee} is implicitly set, which results in faster
25202 floating-point greater-equal and less-equal comparisons. The implicit settings
25203 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
25205 @item -minline-ic_invalidate
25206 @opindex minline-ic_invalidate
25207 Inline code to invalidate instruction cache entries after setting up
25208 nested function trampolines.
25209 This option has no effect if @option{-musermode} is in effect and the selected
25210 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
25212 If the selected code generation option does not allow the use of the @code{icbi}
25213 instruction, and @option{-musermode} is not in effect, the inlined code
25214 manipulates the instruction cache address array directly with an associative
25215 write. This not only requires privileged mode at run time, but it also
25216 fails if the cache line had been mapped via the TLB and has become unmapped.
25220 Dump instruction size and location in the assembly code.
25223 @opindex mpadstruct
25224 This option is deprecated. It pads structures to multiple of 4 bytes,
25225 which is incompatible with the SH ABI@.
25227 @item -matomic-model=@var{model}
25228 @opindex matomic-model=@var{model}
25229 Sets the model of atomic operations and additional parameters as a comma
25230 separated list. For details on the atomic built-in functions see
25231 @ref{__atomic Builtins}. The following models and parameters are supported:
25236 Disable compiler generated atomic sequences and emit library calls for atomic
25237 operations. This is the default if the target is not @code{sh*-*-linux*}.
25240 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
25241 built-in functions. The generated atomic sequences require additional support
25242 from the interrupt/exception handling code of the system and are only suitable
25243 for SH3* and SH4* single-core systems. This option is enabled by default when
25244 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
25245 this option also partially utilizes the hardware atomic instructions
25246 @code{movli.l} and @code{movco.l} to create more efficient code, unless
25247 @samp{strict} is specified.
25250 Generate software atomic sequences that use a variable in the thread control
25251 block. This is a variation of the gUSA sequences which can also be used on
25252 SH1* and SH2* targets. The generated atomic sequences require additional
25253 support from the interrupt/exception handling code of the system and are only
25254 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
25255 parameter has to be specified as well.
25258 Generate software atomic sequences that temporarily disable interrupts by
25259 setting @code{SR.IMASK = 1111}. This model works only when the program runs
25260 in privileged mode and is only suitable for single-core systems. Additional
25261 support from the interrupt/exception handling code of the system is not
25262 required. This model is enabled by default when the target is
25263 @code{sh*-*-linux*} and SH1* or SH2*.
25266 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
25267 instructions only. This is only available on SH4A and is suitable for
25268 multi-core systems. Since the hardware instructions support only 32 bit atomic
25269 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
25270 Code compiled with this option is also compatible with other software
25271 atomic model interrupt/exception handling systems if executed on an SH4A
25272 system. Additional support from the interrupt/exception handling code of the
25273 system is not required for this model.
25276 This parameter specifies the offset in bytes of the variable in the thread
25277 control block structure that should be used by the generated atomic sequences
25278 when the @samp{soft-tcb} model has been selected. For other models this
25279 parameter is ignored. The specified value must be an integer multiple of four
25280 and in the range 0-1020.
25283 This parameter prevents mixed usage of multiple atomic models, even if they
25284 are compatible, and makes the compiler generate atomic sequences of the
25285 specified model only.
25291 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
25292 Notice that depending on the particular hardware and software configuration
25293 this can degrade overall performance due to the operand cache line flushes
25294 that are implied by the @code{tas.b} instruction. On multi-core SH4A
25295 processors the @code{tas.b} instruction must be used with caution since it
25296 can result in data corruption for certain cache configurations.
25299 @opindex mprefergot
25300 When generating position-independent code, emit function calls using
25301 the Global Offset Table instead of the Procedure Linkage Table.
25304 @itemx -mno-usermode
25306 @opindex mno-usermode
25307 Don't allow (allow) the compiler generating privileged mode code. Specifying
25308 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
25309 inlined code would not work in user mode. @option{-musermode} is the default
25310 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
25311 @option{-musermode} has no effect, since there is no user mode.
25313 @item -multcost=@var{number}
25314 @opindex multcost=@var{number}
25315 Set the cost to assume for a multiply insn.
25317 @item -mdiv=@var{strategy}
25318 @opindex mdiv=@var{strategy}
25319 Set the division strategy to be used for integer division operations.
25320 @var{strategy} can be one of:
25325 Calls a library function that uses the single-step division instruction
25326 @code{div1} to perform the operation. Division by zero calculates an
25327 unspecified result and does not trap. This is the default except for SH4,
25328 SH2A and SHcompact.
25331 Calls a library function that performs the operation in double precision
25332 floating point. Division by zero causes a floating-point exception. This is
25333 the default for SHcompact with FPU. Specifying this for targets that do not
25334 have a double precision FPU defaults to @code{call-div1}.
25337 Calls a library function that uses a lookup table for small divisors and
25338 the @code{div1} instruction with case distinction for larger divisors. Division
25339 by zero calculates an unspecified result and does not trap. This is the default
25340 for SH4. Specifying this for targets that do not have dynamic shift
25341 instructions defaults to @code{call-div1}.
25345 When a division strategy has not been specified the default strategy is
25346 selected based on the current target. For SH2A the default strategy is to
25347 use the @code{divs} and @code{divu} instructions instead of library function
25350 @item -maccumulate-outgoing-args
25351 @opindex maccumulate-outgoing-args
25352 Reserve space once for outgoing arguments in the function prologue rather
25353 than around each call. Generally beneficial for performance and size. Also
25354 needed for unwinding to avoid changing the stack frame around conditional code.
25356 @item -mdivsi3_libfunc=@var{name}
25357 @opindex mdivsi3_libfunc=@var{name}
25358 Set the name of the library function used for 32-bit signed division to
25360 This only affects the name used in the @samp{call} division strategies, and
25361 the compiler still expects the same sets of input/output/clobbered registers as
25362 if this option were not present.
25364 @item -mfixed-range=@var{register-range}
25365 @opindex mfixed-range
25366 Generate code treating the given register range as fixed registers.
25367 A fixed register is one that the register allocator can not use. This is
25368 useful when compiling kernel code. A register range is specified as
25369 two registers separated by a dash. Multiple register ranges can be
25370 specified separated by a comma.
25372 @item -mbranch-cost=@var{num}
25373 @opindex mbranch-cost=@var{num}
25374 Assume @var{num} to be the cost for a branch instruction. Higher numbers
25375 make the compiler try to generate more branch-free code if possible.
25376 If not specified the value is selected depending on the processor type that
25377 is being compiled for.
25380 @itemx -mno-zdcbranch
25381 @opindex mzdcbranch
25382 @opindex mno-zdcbranch
25383 Assume (do not assume) that zero displacement conditional branch instructions
25384 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
25385 compiler prefers zero displacement branch code sequences. This is
25386 enabled by default when generating code for SH4 and SH4A. It can be explicitly
25387 disabled by specifying @option{-mno-zdcbranch}.
25389 @item -mcbranch-force-delay-slot
25390 @opindex mcbranch-force-delay-slot
25391 Force the usage of delay slots for conditional branches, which stuffs the delay
25392 slot with a @code{nop} if a suitable instruction cannot be found. By default
25393 this option is disabled. It can be enabled to work around hardware bugs as
25394 found in the original SH7055.
25397 @itemx -mno-fused-madd
25398 @opindex mfused-madd
25399 @opindex mno-fused-madd
25400 Generate code that uses (does not use) the floating-point multiply and
25401 accumulate instructions. These instructions are generated by default
25402 if hardware floating point is used. The machine-dependent
25403 @option{-mfused-madd} option is now mapped to the machine-independent
25404 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
25405 mapped to @option{-ffp-contract=off}.
25411 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
25412 and cosine approximations. The option @option{-mfsca} must be used in
25413 combination with @option{-funsafe-math-optimizations}. It is enabled by default
25414 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
25415 approximations even if @option{-funsafe-math-optimizations} is in effect.
25421 Allow or disallow the compiler to emit the @code{fsrra} instruction for
25422 reciprocal square root approximations. The option @option{-mfsrra} must be used
25423 in combination with @option{-funsafe-math-optimizations} and
25424 @option{-ffinite-math-only}. It is enabled by default when generating code for
25425 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
25426 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
25429 @item -mpretend-cmove
25430 @opindex mpretend-cmove
25431 Prefer zero-displacement conditional branches for conditional move instruction
25432 patterns. This can result in faster code on the SH4 processor.
25436 Generate code using the FDPIC ABI.
25440 @node Solaris 2 Options
25441 @subsection Solaris 2 Options
25442 @cindex Solaris 2 options
25444 These @samp{-m} options are supported on Solaris 2:
25447 @item -mclear-hwcap
25448 @opindex mclear-hwcap
25449 @option{-mclear-hwcap} tells the compiler to remove the hardware
25450 capabilities generated by the Solaris assembler. This is only necessary
25451 when object files use ISA extensions not supported by the current
25452 machine, but check at runtime whether or not to use them.
25454 @item -mimpure-text
25455 @opindex mimpure-text
25456 @option{-mimpure-text}, used in addition to @option{-shared}, tells
25457 the compiler to not pass @option{-z text} to the linker when linking a
25458 shared object. Using this option, you can link position-dependent
25459 code into a shared object.
25461 @option{-mimpure-text} suppresses the ``relocations remain against
25462 allocatable but non-writable sections'' linker error message.
25463 However, the necessary relocations trigger copy-on-write, and the
25464 shared object is not actually shared across processes. Instead of
25465 using @option{-mimpure-text}, you should compile all source code with
25466 @option{-fpic} or @option{-fPIC}.
25470 These switches are supported in addition to the above on Solaris 2:
25475 This is a synonym for @option{-pthread}.
25478 @node SPARC Options
25479 @subsection SPARC Options
25480 @cindex SPARC options
25482 These @samp{-m} options are supported on the SPARC:
25485 @item -mno-app-regs
25487 @opindex mno-app-regs
25489 Specify @option{-mapp-regs} to generate output using the global registers
25490 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
25491 global register 1, each global register 2 through 4 is then treated as an
25492 allocable register that is clobbered by function calls. This is the default.
25494 To be fully SVR4 ABI-compliant at the cost of some performance loss,
25495 specify @option{-mno-app-regs}. You should compile libraries and system
25496 software with this option.
25502 With @option{-mflat}, the compiler does not generate save/restore instructions
25503 and uses a ``flat'' or single register window model. This model is compatible
25504 with the regular register window model. The local registers and the input
25505 registers (0--5) are still treated as ``call-saved'' registers and are
25506 saved on the stack as needed.
25508 With @option{-mno-flat} (the default), the compiler generates save/restore
25509 instructions (except for leaf functions). This is the normal operating mode.
25512 @itemx -mhard-float
25514 @opindex mhard-float
25515 Generate output containing floating-point instructions. This is the
25519 @itemx -msoft-float
25521 @opindex msoft-float
25522 Generate output containing library calls for floating point.
25523 @strong{Warning:} the requisite libraries are not available for all SPARC
25524 targets. Normally the facilities of the machine's usual C compiler are
25525 used, but this cannot be done directly in cross-compilation. You must make
25526 your own arrangements to provide suitable library functions for
25527 cross-compilation. The embedded targets @samp{sparc-*-aout} and
25528 @samp{sparclite-*-*} do provide software floating-point support.
25530 @option{-msoft-float} changes the calling convention in the output file;
25531 therefore, it is only useful if you compile @emph{all} of a program with
25532 this option. In particular, you need to compile @file{libgcc.a}, the
25533 library that comes with GCC, with @option{-msoft-float} in order for
25536 @item -mhard-quad-float
25537 @opindex mhard-quad-float
25538 Generate output containing quad-word (long double) floating-point
25541 @item -msoft-quad-float
25542 @opindex msoft-quad-float
25543 Generate output containing library calls for quad-word (long double)
25544 floating-point instructions. The functions called are those specified
25545 in the SPARC ABI@. This is the default.
25547 As of this writing, there are no SPARC implementations that have hardware
25548 support for the quad-word floating-point instructions. They all invoke
25549 a trap handler for one of these instructions, and then the trap handler
25550 emulates the effect of the instruction. Because of the trap handler overhead,
25551 this is much slower than calling the ABI library routines. Thus the
25552 @option{-msoft-quad-float} option is the default.
25554 @item -mno-unaligned-doubles
25555 @itemx -munaligned-doubles
25556 @opindex mno-unaligned-doubles
25557 @opindex munaligned-doubles
25558 Assume that doubles have 8-byte alignment. This is the default.
25560 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
25561 alignment only if they are contained in another type, or if they have an
25562 absolute address. Otherwise, it assumes they have 4-byte alignment.
25563 Specifying this option avoids some rare compatibility problems with code
25564 generated by other compilers. It is not the default because it results
25565 in a performance loss, especially for floating-point code.
25568 @itemx -mno-user-mode
25569 @opindex muser-mode
25570 @opindex mno-user-mode
25571 Do not generate code that can only run in supervisor mode. This is relevant
25572 only for the @code{casa} instruction emitted for the LEON3 processor. This
25575 @item -mfaster-structs
25576 @itemx -mno-faster-structs
25577 @opindex mfaster-structs
25578 @opindex mno-faster-structs
25579 With @option{-mfaster-structs}, the compiler assumes that structures
25580 should have 8-byte alignment. This enables the use of pairs of
25581 @code{ldd} and @code{std} instructions for copies in structure
25582 assignment, in place of twice as many @code{ld} and @code{st} pairs.
25583 However, the use of this changed alignment directly violates the SPARC
25584 ABI@. Thus, it's intended only for use on targets where the developer
25585 acknowledges that their resulting code is not directly in line with
25586 the rules of the ABI@.
25588 @item -mstd-struct-return
25589 @itemx -mno-std-struct-return
25590 @opindex mstd-struct-return
25591 @opindex mno-std-struct-return
25592 With @option{-mstd-struct-return}, the compiler generates checking code
25593 in functions returning structures or unions to detect size mismatches
25594 between the two sides of function calls, as per the 32-bit ABI@.
25596 The default is @option{-mno-std-struct-return}. This option has no effect
25603 Enable Local Register Allocation. This is the default for SPARC since GCC 7
25604 so @option{-mno-lra} needs to be passed to get old Reload.
25606 @item -mcpu=@var{cpu_type}
25608 Set the instruction set, register set, and instruction scheduling parameters
25609 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
25610 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
25611 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
25612 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
25613 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
25614 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
25616 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
25617 which selects the best architecture option for the host processor.
25618 @option{-mcpu=native} has no effect if GCC does not recognize
25621 Default instruction scheduling parameters are used for values that select
25622 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
25623 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
25625 Here is a list of each supported architecture and their supported
25633 supersparc, hypersparc, leon, leon3
25636 f930, f934, sparclite86x
25642 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
25646 By default (unless configured otherwise), GCC generates code for the V7
25647 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
25648 additionally optimizes it for the Cypress CY7C602 chip, as used in the
25649 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
25650 SPARCStation 1, 2, IPX etc.
25652 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
25653 architecture. The only difference from V7 code is that the compiler emits
25654 the integer multiply and integer divide instructions which exist in SPARC-V8
25655 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
25656 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
25659 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
25660 the SPARC architecture. This adds the integer multiply, integer divide step
25661 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
25662 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
25663 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
25664 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
25665 MB86934 chip, which is the more recent SPARClite with FPU@.
25667 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
25668 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
25669 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
25670 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
25671 optimizes it for the TEMIC SPARClet chip.
25673 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
25674 architecture. This adds 64-bit integer and floating-point move instructions,
25675 3 additional floating-point condition code registers and conditional move
25676 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
25677 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
25678 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
25679 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
25680 @option{-mcpu=niagara}, the compiler additionally optimizes it for
25681 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
25682 additionally optimizes it for Sun UltraSPARC T2 chips. With
25683 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
25684 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
25685 additionally optimizes it for Sun UltraSPARC T4 chips. With
25686 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
25687 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
25688 additionally optimizes it for Oracle M8 chips.
25690 @item -mtune=@var{cpu_type}
25692 Set the instruction scheduling parameters for machine type
25693 @var{cpu_type}, but do not set the instruction set or register set that the
25694 option @option{-mcpu=@var{cpu_type}} does.
25696 The same values for @option{-mcpu=@var{cpu_type}} can be used for
25697 @option{-mtune=@var{cpu_type}}, but the only useful values are those
25698 that select a particular CPU implementation. Those are
25699 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
25700 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
25701 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
25702 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
25703 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
25704 and GNU/Linux toolchains, @samp{native} can also be used.
25709 @opindex mno-v8plus
25710 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
25711 difference from the V8 ABI is that the global and out registers are
25712 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
25713 mode for all SPARC-V9 processors.
25719 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
25720 Visual Instruction Set extensions. The default is @option{-mno-vis}.
25726 With @option{-mvis2}, GCC generates code that takes advantage of
25727 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
25728 default is @option{-mvis2} when targeting a cpu that supports such
25729 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
25730 also sets @option{-mvis}.
25736 With @option{-mvis3}, GCC generates code that takes advantage of
25737 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
25738 default is @option{-mvis3} when targeting a cpu that supports such
25739 instructions, such as niagara-3 and later. Setting @option{-mvis3}
25740 also sets @option{-mvis2} and @option{-mvis}.
25746 With @option{-mvis4}, GCC generates code that takes advantage of
25747 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
25748 default is @option{-mvis4} when targeting a cpu that supports such
25749 instructions, such as niagara-7 and later. Setting @option{-mvis4}
25750 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
25756 With @option{-mvis4b}, GCC generates code that takes advantage of
25757 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
25758 the additional VIS instructions introduced in the Oracle SPARC
25759 Architecture 2017. The default is @option{-mvis4b} when targeting a
25760 cpu that supports such instructions, such as m8 and later. Setting
25761 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
25762 @option{-mvis2} and @option{-mvis}.
25767 @opindex mno-cbcond
25768 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
25769 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
25770 when targeting a CPU that supports such instructions, such as Niagara-4 and
25777 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
25778 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
25779 when targeting a CPU that supports such instructions, such as Niagara-3 and
25785 @opindex mno-fsmuld
25786 With @option{-mfsmuld}, GCC generates code that takes advantage of the
25787 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
25788 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
25789 or V9 with FPU except @option{-mcpu=leon}.
25795 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
25796 Population Count instruction. The default is @option{-mpopc}
25797 when targeting a CPU that supports such an instruction, such as Niagara-2 and
25804 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
25805 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
25806 when targeting a CPU that supports such an instruction, such as Niagara-7 and
25810 @opindex mfix-at697f
25811 Enable the documented workaround for the single erratum of the Atmel AT697F
25812 processor (which corresponds to erratum #13 of the AT697E processor).
25815 @opindex mfix-ut699
25816 Enable the documented workarounds for the floating-point errata and the data
25817 cache nullify errata of the UT699 processor.
25820 @opindex mfix-ut700
25821 Enable the documented workaround for the back-to-back store errata of
25822 the UT699E/UT700 processor.
25824 @item -mfix-gr712rc
25825 @opindex mfix-gr712rc
25826 Enable the documented workaround for the back-to-back store errata of
25827 the GR712RC processor.
25830 These @samp{-m} options are supported in addition to the above
25831 on SPARC-V9 processors in 64-bit environments:
25838 Generate code for a 32-bit or 64-bit environment.
25839 The 32-bit environment sets int, long and pointer to 32 bits.
25840 The 64-bit environment sets int to 32 bits and long and pointer
25843 @item -mcmodel=@var{which}
25845 Set the code model to one of
25849 The Medium/Low code model: 64-bit addresses, programs
25850 must be linked in the low 32 bits of memory. Programs can be statically
25851 or dynamically linked.
25854 The Medium/Middle code model: 64-bit addresses, programs
25855 must be linked in the low 44 bits of memory, the text and data segments must
25856 be less than 2GB in size and the data segment must be located within 2GB of
25860 The Medium/Anywhere code model: 64-bit addresses, programs
25861 may be linked anywhere in memory, the text and data segments must be less
25862 than 2GB in size and the data segment must be located within 2GB of the
25866 The Medium/Anywhere code model for embedded systems:
25867 64-bit addresses, the text and data segments must be less than 2GB in
25868 size, both starting anywhere in memory (determined at link time). The
25869 global register %g4 points to the base of the data segment. Programs
25870 are statically linked and PIC is not supported.
25873 @item -mmemory-model=@var{mem-model}
25874 @opindex mmemory-model
25875 Set the memory model in force on the processor to one of
25879 The default memory model for the processor and operating system.
25882 Relaxed Memory Order
25885 Partial Store Order
25891 Sequential Consistency
25894 These memory models are formally defined in Appendix D of the SPARC-V9
25895 architecture manual, as set in the processor's @code{PSTATE.MM} field.
25898 @itemx -mno-stack-bias
25899 @opindex mstack-bias
25900 @opindex mno-stack-bias
25901 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
25902 frame pointer if present, are offset by @minus{}2047 which must be added back
25903 when making stack frame references. This is the default in 64-bit mode.
25904 Otherwise, assume no such offset is present.
25908 @subsection SPU Options
25909 @cindex SPU options
25911 These @samp{-m} options are supported on the SPU:
25915 @itemx -merror-reloc
25916 @opindex mwarn-reloc
25917 @opindex merror-reloc
25919 The loader for SPU does not handle dynamic relocations. By default, GCC
25920 gives an error when it generates code that requires a dynamic
25921 relocation. @option{-mno-error-reloc} disables the error,
25922 @option{-mwarn-reloc} generates a warning instead.
25925 @itemx -munsafe-dma
25927 @opindex munsafe-dma
25929 Instructions that initiate or test completion of DMA must not be
25930 reordered with respect to loads and stores of the memory that is being
25932 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
25933 memory accesses, but that can lead to inefficient code in places where the
25934 memory is known to not change. Rather than mark the memory as volatile,
25935 you can use @option{-msafe-dma} to tell the compiler to treat
25936 the DMA instructions as potentially affecting all memory.
25938 @item -mbranch-hints
25939 @opindex mbranch-hints
25941 By default, GCC generates a branch hint instruction to avoid
25942 pipeline stalls for always-taken or probably-taken branches. A hint
25943 is not generated closer than 8 instructions away from its branch.
25944 There is little reason to disable them, except for debugging purposes,
25945 or to make an object a little bit smaller.
25949 @opindex msmall-mem
25950 @opindex mlarge-mem
25952 By default, GCC generates code assuming that addresses are never larger
25953 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
25954 a full 32-bit address.
25959 By default, GCC links against startup code that assumes the SPU-style
25960 main function interface (which has an unconventional parameter list).
25961 With @option{-mstdmain}, GCC links your program against startup
25962 code that assumes a C99-style interface to @code{main}, including a
25963 local copy of @code{argv} strings.
25965 @item -mfixed-range=@var{register-range}
25966 @opindex mfixed-range
25967 Generate code treating the given register range as fixed registers.
25968 A fixed register is one that the register allocator cannot use. This is
25969 useful when compiling kernel code. A register range is specified as
25970 two registers separated by a dash. Multiple register ranges can be
25971 specified separated by a comma.
25977 Compile code assuming that pointers to the PPU address space accessed
25978 via the @code{__ea} named address space qualifier are either 32 or 64
25979 bits wide. The default is 32 bits. As this is an ABI-changing option,
25980 all object code in an executable must be compiled with the same setting.
25982 @item -maddress-space-conversion
25983 @itemx -mno-address-space-conversion
25984 @opindex maddress-space-conversion
25985 @opindex mno-address-space-conversion
25986 Allow/disallow treating the @code{__ea} address space as superset
25987 of the generic address space. This enables explicit type casts
25988 between @code{__ea} and generic pointer as well as implicit
25989 conversions of generic pointers to @code{__ea} pointers. The
25990 default is to allow address space pointer conversions.
25992 @item -mcache-size=@var{cache-size}
25993 @opindex mcache-size
25994 This option controls the version of libgcc that the compiler links to an
25995 executable and selects a software-managed cache for accessing variables
25996 in the @code{__ea} address space with a particular cache size. Possible
25997 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
25998 and @samp{128}. The default cache size is 64KB.
26000 @item -matomic-updates
26001 @itemx -mno-atomic-updates
26002 @opindex matomic-updates
26003 @opindex mno-atomic-updates
26004 This option controls the version of libgcc that the compiler links to an
26005 executable and selects whether atomic updates to the software-managed
26006 cache of PPU-side variables are used. If you use atomic updates, changes
26007 to a PPU variable from SPU code using the @code{__ea} named address space
26008 qualifier do not interfere with changes to other PPU variables residing
26009 in the same cache line from PPU code. If you do not use atomic updates,
26010 such interference may occur; however, writing back cache lines is
26011 more efficient. The default behavior is to use atomic updates.
26014 @itemx -mdual-nops=@var{n}
26015 @opindex mdual-nops
26016 By default, GCC inserts NOPs to increase dual issue when it expects
26017 it to increase performance. @var{n} can be a value from 0 to 10. A
26018 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
26019 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
26021 @item -mhint-max-nops=@var{n}
26022 @opindex mhint-max-nops
26023 Maximum number of NOPs to insert for a branch hint. A branch hint must
26024 be at least 8 instructions away from the branch it is affecting. GCC
26025 inserts up to @var{n} NOPs to enforce this, otherwise it does not
26026 generate the branch hint.
26028 @item -mhint-max-distance=@var{n}
26029 @opindex mhint-max-distance
26030 The encoding of the branch hint instruction limits the hint to be within
26031 256 instructions of the branch it is affecting. By default, GCC makes
26032 sure it is within 125.
26035 @opindex msafe-hints
26036 Work around a hardware bug that causes the SPU to stall indefinitely.
26037 By default, GCC inserts the @code{hbrp} instruction to make sure
26038 this stall won't happen.
26042 @node System V Options
26043 @subsection Options for System V
26045 These additional options are available on System V Release 4 for
26046 compatibility with other compilers on those systems:
26051 Create a shared object.
26052 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
26056 Identify the versions of each tool used by the compiler, in a
26057 @code{.ident} assembler directive in the output.
26061 Refrain from adding @code{.ident} directives to the output file (this is
26064 @item -YP,@var{dirs}
26066 Search the directories @var{dirs}, and no others, for libraries
26067 specified with @option{-l}.
26069 @item -Ym,@var{dir}
26071 Look in the directory @var{dir} to find the M4 preprocessor.
26072 The assembler uses this option.
26073 @c This is supposed to go with a -Yd for predefined M4 macro files, but
26074 @c the generic assembler that comes with Solaris takes just -Ym.
26077 @node TILE-Gx Options
26078 @subsection TILE-Gx Options
26079 @cindex TILE-Gx options
26081 These @samp{-m} options are supported on the TILE-Gx:
26084 @item -mcmodel=small
26085 @opindex mcmodel=small
26086 Generate code for the small model. The distance for direct calls is
26087 limited to 500M in either direction. PC-relative addresses are 32
26088 bits. Absolute addresses support the full address range.
26090 @item -mcmodel=large
26091 @opindex mcmodel=large
26092 Generate code for the large model. There is no limitation on call
26093 distance, pc-relative addresses, or absolute addresses.
26095 @item -mcpu=@var{name}
26097 Selects the type of CPU to be targeted. Currently the only supported
26098 type is @samp{tilegx}.
26104 Generate code for a 32-bit or 64-bit environment. The 32-bit
26105 environment sets int, long, and pointer to 32 bits. The 64-bit
26106 environment sets int to 32 bits and long and pointer to 64 bits.
26109 @itemx -mlittle-endian
26110 @opindex mbig-endian
26111 @opindex mlittle-endian
26112 Generate code in big/little endian mode, respectively.
26115 @node TILEPro Options
26116 @subsection TILEPro Options
26117 @cindex TILEPro options
26119 These @samp{-m} options are supported on the TILEPro:
26122 @item -mcpu=@var{name}
26124 Selects the type of CPU to be targeted. Currently the only supported
26125 type is @samp{tilepro}.
26129 Generate code for a 32-bit environment, which sets int, long, and
26130 pointer to 32 bits. This is the only supported behavior so the flag
26131 is essentially ignored.
26135 @subsection V850 Options
26136 @cindex V850 Options
26138 These @samp{-m} options are defined for V850 implementations:
26142 @itemx -mno-long-calls
26143 @opindex mlong-calls
26144 @opindex mno-long-calls
26145 Treat all calls as being far away (near). If calls are assumed to be
26146 far away, the compiler always loads the function's address into a
26147 register, and calls indirect through the pointer.
26153 Do not optimize (do optimize) basic blocks that use the same index
26154 pointer 4 or more times to copy pointer into the @code{ep} register, and
26155 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
26156 option is on by default if you optimize.
26158 @item -mno-prolog-function
26159 @itemx -mprolog-function
26160 @opindex mno-prolog-function
26161 @opindex mprolog-function
26162 Do not use (do use) external functions to save and restore registers
26163 at the prologue and epilogue of a function. The external functions
26164 are slower, but use less code space if more than one function saves
26165 the same number of registers. The @option{-mprolog-function} option
26166 is on by default if you optimize.
26170 Try to make the code as small as possible. At present, this just turns
26171 on the @option{-mep} and @option{-mprolog-function} options.
26173 @item -mtda=@var{n}
26175 Put static or global variables whose size is @var{n} bytes or less into
26176 the tiny data area that register @code{ep} points to. The tiny data
26177 area can hold up to 256 bytes in total (128 bytes for byte references).
26179 @item -msda=@var{n}
26181 Put static or global variables whose size is @var{n} bytes or less into
26182 the small data area that register @code{gp} points to. The small data
26183 area can hold up to 64 kilobytes.
26185 @item -mzda=@var{n}
26187 Put static or global variables whose size is @var{n} bytes or less into
26188 the first 32 kilobytes of memory.
26192 Specify that the target processor is the V850.
26196 Specify that the target processor is the V850E3V5. The preprocessor
26197 constant @code{__v850e3v5__} is defined if this option is used.
26201 Specify that the target processor is the V850E3V5. This is an alias for
26202 the @option{-mv850e3v5} option.
26206 Specify that the target processor is the V850E2V3. The preprocessor
26207 constant @code{__v850e2v3__} is defined if this option is used.
26211 Specify that the target processor is the V850E2. The preprocessor
26212 constant @code{__v850e2__} is defined if this option is used.
26216 Specify that the target processor is the V850E1. The preprocessor
26217 constants @code{__v850e1__} and @code{__v850e__} are defined if
26218 this option is used.
26222 Specify that the target processor is the V850ES. This is an alias for
26223 the @option{-mv850e1} option.
26227 Specify that the target processor is the V850E@. The preprocessor
26228 constant @code{__v850e__} is defined if this option is used.
26230 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
26231 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
26232 are defined then a default target processor is chosen and the
26233 relevant @samp{__v850*__} preprocessor constant is defined.
26235 The preprocessor constants @code{__v850} and @code{__v851__} are always
26236 defined, regardless of which processor variant is the target.
26238 @item -mdisable-callt
26239 @itemx -mno-disable-callt
26240 @opindex mdisable-callt
26241 @opindex mno-disable-callt
26242 This option suppresses generation of the @code{CALLT} instruction for the
26243 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
26246 This option is enabled by default when the RH850 ABI is
26247 in use (see @option{-mrh850-abi}), and disabled by default when the
26248 GCC ABI is in use. If @code{CALLT} instructions are being generated
26249 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
26255 Pass on (or do not pass on) the @option{-mrelax} command-line option
26259 @itemx -mno-long-jumps
26260 @opindex mlong-jumps
26261 @opindex mno-long-jumps
26262 Disable (or re-enable) the generation of PC-relative jump instructions.
26265 @itemx -mhard-float
26266 @opindex msoft-float
26267 @opindex mhard-float
26268 Disable (or re-enable) the generation of hardware floating point
26269 instructions. This option is only significant when the target
26270 architecture is @samp{V850E2V3} or higher. If hardware floating point
26271 instructions are being generated then the C preprocessor symbol
26272 @code{__FPU_OK__} is defined, otherwise the symbol
26273 @code{__NO_FPU__} is defined.
26277 Enables the use of the e3v5 LOOP instruction. The use of this
26278 instruction is not enabled by default when the e3v5 architecture is
26279 selected because its use is still experimental.
26283 @opindex mrh850-abi
26285 Enables support for the RH850 version of the V850 ABI. This is the
26286 default. With this version of the ABI the following rules apply:
26290 Integer sized structures and unions are returned via a memory pointer
26291 rather than a register.
26294 Large structures and unions (more than 8 bytes in size) are passed by
26298 Functions are aligned to 16-bit boundaries.
26301 The @option{-m8byte-align} command-line option is supported.
26304 The @option{-mdisable-callt} command-line option is enabled by
26305 default. The @option{-mno-disable-callt} command-line option is not
26309 When this version of the ABI is enabled the C preprocessor symbol
26310 @code{__V850_RH850_ABI__} is defined.
26314 Enables support for the old GCC version of the V850 ABI. With this
26315 version of the ABI the following rules apply:
26319 Integer sized structures and unions are returned in register @code{r10}.
26322 Large structures and unions (more than 8 bytes in size) are passed by
26326 Functions are aligned to 32-bit boundaries, unless optimizing for
26330 The @option{-m8byte-align} command-line option is not supported.
26333 The @option{-mdisable-callt} command-line option is supported but not
26334 enabled by default.
26337 When this version of the ABI is enabled the C preprocessor symbol
26338 @code{__V850_GCC_ABI__} is defined.
26340 @item -m8byte-align
26341 @itemx -mno-8byte-align
26342 @opindex m8byte-align
26343 @opindex mno-8byte-align
26344 Enables support for @code{double} and @code{long long} types to be
26345 aligned on 8-byte boundaries. The default is to restrict the
26346 alignment of all objects to at most 4-bytes. When
26347 @option{-m8byte-align} is in effect the C preprocessor symbol
26348 @code{__V850_8BYTE_ALIGN__} is defined.
26351 @opindex mbig-switch
26352 Generate code suitable for big switch tables. Use this option only if
26353 the assembler/linker complain about out of range branches within a switch
26358 This option causes r2 and r5 to be used in the code generated by
26359 the compiler. This setting is the default.
26361 @item -mno-app-regs
26362 @opindex mno-app-regs
26363 This option causes r2 and r5 to be treated as fixed registers.
26368 @subsection VAX Options
26369 @cindex VAX options
26371 These @samp{-m} options are defined for the VAX:
26376 Do not output certain jump instructions (@code{aobleq} and so on)
26377 that the Unix assembler for the VAX cannot handle across long
26382 Do output those jump instructions, on the assumption that the
26383 GNU assembler is being used.
26387 Output code for G-format floating-point numbers instead of D-format.
26390 @node Visium Options
26391 @subsection Visium Options
26392 @cindex Visium options
26398 A program which performs file I/O and is destined to run on an MCM target
26399 should be linked with this option. It causes the libraries libc.a and
26400 libdebug.a to be linked. The program should be run on the target under
26401 the control of the GDB remote debugging stub.
26405 A program which performs file I/O and is destined to run on the simulator
26406 should be linked with option. This causes libraries libc.a and libsim.a to
26410 @itemx -mhard-float
26412 @opindex mhard-float
26413 Generate code containing floating-point instructions. This is the
26417 @itemx -msoft-float
26419 @opindex msoft-float
26420 Generate code containing library calls for floating-point.
26422 @option{-msoft-float} changes the calling convention in the output file;
26423 therefore, it is only useful if you compile @emph{all} of a program with
26424 this option. In particular, you need to compile @file{libgcc.a}, the
26425 library that comes with GCC, with @option{-msoft-float} in order for
26428 @item -mcpu=@var{cpu_type}
26430 Set the instruction set, register set, and instruction scheduling parameters
26431 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26432 @samp{mcm}, @samp{gr5} and @samp{gr6}.
26434 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
26436 By default (unless configured otherwise), GCC generates code for the GR5
26437 variant of the Visium architecture.
26439 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
26440 architecture. The only difference from GR5 code is that the compiler will
26441 generate block move instructions.
26443 @item -mtune=@var{cpu_type}
26445 Set the instruction scheduling parameters for machine type @var{cpu_type},
26446 but do not set the instruction set or register set that the option
26447 @option{-mcpu=@var{cpu_type}} would.
26451 Generate code for the supervisor mode, where there are no restrictions on
26452 the access to general registers. This is the default.
26455 @opindex muser-mode
26456 Generate code for the user mode, where the access to some general registers
26457 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
26458 mode; on the GR6, only registers r29 to r31 are affected.
26462 @subsection VMS Options
26464 These @samp{-m} options are defined for the VMS implementations:
26467 @item -mvms-return-codes
26468 @opindex mvms-return-codes
26469 Return VMS condition codes from @code{main}. The default is to return POSIX-style
26470 condition (e.g.@ error) codes.
26472 @item -mdebug-main=@var{prefix}
26473 @opindex mdebug-main=@var{prefix}
26474 Flag the first routine whose name starts with @var{prefix} as the main
26475 routine for the debugger.
26479 Default to 64-bit memory allocation routines.
26481 @item -mpointer-size=@var{size}
26482 @opindex mpointer-size=@var{size}
26483 Set the default size of pointers. Possible options for @var{size} are
26484 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
26485 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
26486 The later option disables @code{pragma pointer_size}.
26489 @node VxWorks Options
26490 @subsection VxWorks Options
26491 @cindex VxWorks Options
26493 The options in this section are defined for all VxWorks targets.
26494 Options specific to the target hardware are listed with the other
26495 options for that target.
26500 GCC can generate code for both VxWorks kernels and real time processes
26501 (RTPs). This option switches from the former to the latter. It also
26502 defines the preprocessor macro @code{__RTP__}.
26505 @opindex non-static
26506 Link an RTP executable against shared libraries rather than static
26507 libraries. The options @option{-static} and @option{-shared} can
26508 also be used for RTPs (@pxref{Link Options}); @option{-static}
26515 These options are passed down to the linker. They are defined for
26516 compatibility with Diab.
26519 @opindex Xbind-lazy
26520 Enable lazy binding of function calls. This option is equivalent to
26521 @option{-Wl,-z,now} and is defined for compatibility with Diab.
26525 Disable lazy binding of function calls. This option is the default and
26526 is defined for compatibility with Diab.
26530 @subsection x86 Options
26531 @cindex x86 Options
26533 These @samp{-m} options are defined for the x86 family of computers.
26537 @item -march=@var{cpu-type}
26539 Generate instructions for the machine type @var{cpu-type}. In contrast to
26540 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
26541 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
26542 to generate code that may not run at all on processors other than the one
26543 indicated. Specifying @option{-march=@var{cpu-type}} implies
26544 @option{-mtune=@var{cpu-type}}.
26546 The choices for @var{cpu-type} are:
26550 This selects the CPU to generate code for at compilation time by determining
26551 the processor type of the compiling machine. Using @option{-march=native}
26552 enables all instruction subsets supported by the local machine (hence
26553 the result might not run on different machines). Using @option{-mtune=native}
26554 produces code optimized for the local machine under the constraints
26555 of the selected instruction set.
26558 A generic CPU with 64-bit extensions.
26561 Original Intel i386 CPU@.
26564 Intel i486 CPU@. (No scheduling is implemented for this chip.)
26568 Intel Pentium CPU with no MMX support.
26571 Intel Lakemont MCU, based on Intel Pentium CPU.
26574 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
26577 Intel Pentium Pro CPU@.
26580 When used with @option{-march}, the Pentium Pro
26581 instruction set is used, so the code runs on all i686 family chips.
26582 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
26585 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
26590 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
26594 Intel Pentium M; low-power version of Intel Pentium III CPU
26595 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
26599 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
26602 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
26606 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
26607 SSE2 and SSE3 instruction set support.
26610 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
26611 instruction set support.
26614 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26615 SSE4.1, SSE4.2 and POPCNT instruction set support.
26618 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26619 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
26622 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26623 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
26626 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26627 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
26628 instruction set support.
26631 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26632 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26633 BMI, BMI2 and F16C instruction set support.
26636 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26637 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26638 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
26641 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26642 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26643 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
26644 XSAVES instruction set support.
26647 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
26648 instruction set support.
26651 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26652 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
26655 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26656 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
26657 instruction set support.
26659 @item goldmont-plus
26660 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
26661 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
26662 PTWRITE, RDPID, SGX and UMIP instruction set support.
26665 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26666 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
26667 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
26670 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
26671 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26672 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
26673 AVX512CD instruction set support.
26676 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
26677 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26678 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
26679 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
26681 @item skylake-avx512
26682 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
26683 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26684 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
26685 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
26688 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
26689 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
26690 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
26691 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
26692 AVX512IFMA, SHA and UMIP instruction set support.
26694 @item icelake-client
26695 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
26696 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
26697 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
26698 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
26699 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
26700 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
26702 @item icelake-server
26703 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
26704 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
26705 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
26706 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
26707 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
26708 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
26712 AMD K6 CPU with MMX instruction set support.
26716 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
26719 @itemx athlon-tbird
26720 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
26726 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
26727 instruction set support.
26733 Processors based on the AMD K8 core with x86-64 instruction set support,
26734 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
26735 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
26736 instruction set extensions.)
26739 @itemx opteron-sse3
26740 @itemx athlon64-sse3
26741 Improved versions of AMD K8 cores with SSE3 instruction set support.
26745 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
26746 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
26747 instruction set extensions.)
26750 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
26751 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
26752 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
26754 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
26755 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
26756 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
26759 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
26760 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
26761 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
26762 64-bit instruction set extensions.
26764 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
26765 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
26766 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
26767 SSE4.2, ABM and 64-bit instruction set extensions.
26770 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
26771 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
26772 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
26773 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
26774 instruction set extensions.
26777 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
26778 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
26779 instruction set extensions.)
26782 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
26783 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
26784 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
26787 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
26791 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
26792 instruction set support.
26795 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
26796 (No scheduling is implemented for this chip.)
26799 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
26800 (No scheduling is implemented for this chip.)
26803 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
26804 (No scheduling is implemented for this chip.)
26807 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
26808 (No scheduling is implemented for this chip.)
26811 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
26812 (No scheduling is implemented for this chip.)
26815 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
26816 (No scheduling is implemented for this chip.)
26819 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
26820 (No scheduling is implemented for this chip.)
26823 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
26824 AVX and AVX2 instruction set support.
26825 (No scheduling is implemented for this chip.)
26828 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
26829 instruction set support.
26830 (No scheduling is implemented for this chip.)
26833 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
26834 instruction set support.
26835 (No scheduling is implemented for this chip.)
26838 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
26839 instruction set support.
26840 (No scheduling is implemented for this chip.)
26843 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
26844 instruction set support.
26845 (No scheduling is implemented for this chip.)
26848 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
26849 instruction set support.
26850 (No scheduling is implemented for this chip.)
26853 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
26854 instruction set support.
26855 (No scheduling is implemented for this chip.)
26858 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
26861 @item -mtune=@var{cpu-type}
26863 Tune to @var{cpu-type} everything applicable about the generated code, except
26864 for the ABI and the set of available instructions.
26865 While picking a specific @var{cpu-type} schedules things appropriately
26866 for that particular chip, the compiler does not generate any code that
26867 cannot run on the default machine type unless you use a
26868 @option{-march=@var{cpu-type}} option.
26869 For example, if GCC is configured for i686-pc-linux-gnu
26870 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
26871 but still runs on i686 machines.
26873 The choices for @var{cpu-type} are the same as for @option{-march}.
26874 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
26878 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
26879 If you know the CPU on which your code will run, then you should use
26880 the corresponding @option{-mtune} or @option{-march} option instead of
26881 @option{-mtune=generic}. But, if you do not know exactly what CPU users
26882 of your application will have, then you should use this option.
26884 As new processors are deployed in the marketplace, the behavior of this
26885 option will change. Therefore, if you upgrade to a newer version of
26886 GCC, code generation controlled by this option will change to reflect
26888 that are most common at the time that version of GCC is released.
26890 There is no @option{-march=generic} option because @option{-march}
26891 indicates the instruction set the compiler can use, and there is no
26892 generic instruction set applicable to all processors. In contrast,
26893 @option{-mtune} indicates the processor (or, in this case, collection of
26894 processors) for which the code is optimized.
26897 Produce code optimized for the most current Intel processors, which are
26898 Haswell and Silvermont for this version of GCC. If you know the CPU
26899 on which your code will run, then you should use the corresponding
26900 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
26901 But, if you want your application performs better on both Haswell and
26902 Silvermont, then you should use this option.
26904 As new Intel processors are deployed in the marketplace, the behavior of
26905 this option will change. Therefore, if you upgrade to a newer version of
26906 GCC, code generation controlled by this option will change to reflect
26907 the most current Intel processors at the time that version of GCC is
26910 There is no @option{-march=intel} option because @option{-march} indicates
26911 the instruction set the compiler can use, and there is no common
26912 instruction set applicable to all processors. In contrast,
26913 @option{-mtune} indicates the processor (or, in this case, collection of
26914 processors) for which the code is optimized.
26917 @item -mcpu=@var{cpu-type}
26919 A deprecated synonym for @option{-mtune}.
26921 @item -mfpmath=@var{unit}
26923 Generate floating-point arithmetic for selected unit @var{unit}. The choices
26924 for @var{unit} are:
26928 Use the standard 387 floating-point coprocessor present on the majority of chips and
26929 emulated otherwise. Code compiled with this option runs almost everywhere.
26930 The temporary results are computed in 80-bit precision instead of the precision
26931 specified by the type, resulting in slightly different results compared to most
26932 of other chips. See @option{-ffloat-store} for more detailed description.
26934 This is the default choice for non-Darwin x86-32 targets.
26937 Use scalar floating-point instructions present in the SSE instruction set.
26938 This instruction set is supported by Pentium III and newer chips,
26939 and in the AMD line
26940 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
26941 instruction set supports only single-precision arithmetic, thus the double and
26942 extended-precision arithmetic are still done using 387. A later version, present
26943 only in Pentium 4 and AMD x86-64 chips, supports double-precision
26946 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
26947 or @option{-msse2} switches to enable SSE extensions and make this option
26948 effective. For the x86-64 compiler, these extensions are enabled by default.
26950 The resulting code should be considerably faster in the majority of cases and avoid
26951 the numerical instability problems of 387 code, but may break some existing
26952 code that expects temporaries to be 80 bits.
26954 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
26955 and the default choice for x86-32 targets with the SSE2 instruction set
26956 when @option{-ffast-math} is enabled.
26961 Attempt to utilize both instruction sets at once. This effectively doubles the
26962 amount of available registers, and on chips with separate execution units for
26963 387 and SSE the execution resources too. Use this option with care, as it is
26964 still experimental, because the GCC register allocator does not model separate
26965 functional units well, resulting in unstable performance.
26968 @item -masm=@var{dialect}
26969 @opindex masm=@var{dialect}
26970 Output assembly instructions using selected @var{dialect}. Also affects
26971 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
26972 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
26973 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
26974 not support @samp{intel}.
26977 @itemx -mno-ieee-fp
26979 @opindex mno-ieee-fp
26980 Control whether or not the compiler uses IEEE floating-point
26981 comparisons. These correctly handle the case where the result of a
26982 comparison is unordered.
26985 @itemx -mhard-float
26987 @opindex mhard-float
26988 Generate output containing 80387 instructions for floating point.
26991 @itemx -msoft-float
26993 @opindex msoft-float
26994 Generate output containing library calls for floating point.
26996 @strong{Warning:} the requisite libraries are not part of GCC@.
26997 Normally the facilities of the machine's usual C compiler are used, but
26998 this cannot be done directly in cross-compilation. You must make your
26999 own arrangements to provide suitable library functions for
27002 On machines where a function returns floating-point results in the 80387
27003 register stack, some floating-point opcodes may be emitted even if
27004 @option{-msoft-float} is used.
27006 @item -mno-fp-ret-in-387
27007 @opindex mno-fp-ret-in-387
27008 Do not use the FPU registers for return values of functions.
27010 The usual calling convention has functions return values of types
27011 @code{float} and @code{double} in an FPU register, even if there
27012 is no FPU@. The idea is that the operating system should emulate
27015 The option @option{-mno-fp-ret-in-387} causes such values to be returned
27016 in ordinary CPU registers instead.
27018 @item -mno-fancy-math-387
27019 @opindex mno-fancy-math-387
27020 Some 387 emulators do not support the @code{sin}, @code{cos} and
27021 @code{sqrt} instructions for the 387. Specify this option to avoid
27022 generating those instructions.
27023 This option is overridden when @option{-march}
27024 indicates that the target CPU always has an FPU and so the
27025 instruction does not need emulation. These
27026 instructions are not generated unless you also use the
27027 @option{-funsafe-math-optimizations} switch.
27029 @item -malign-double
27030 @itemx -mno-align-double
27031 @opindex malign-double
27032 @opindex mno-align-double
27033 Control whether GCC aligns @code{double}, @code{long double}, and
27034 @code{long long} variables on a two-word boundary or a one-word
27035 boundary. Aligning @code{double} variables on a two-word boundary
27036 produces code that runs somewhat faster on a Pentium at the
27037 expense of more memory.
27039 On x86-64, @option{-malign-double} is enabled by default.
27041 @strong{Warning:} if you use the @option{-malign-double} switch,
27042 structures containing the above types are aligned differently than
27043 the published application binary interface specifications for the x86-32
27044 and are not binary compatible with structures in code compiled
27045 without that switch.
27047 @item -m96bit-long-double
27048 @itemx -m128bit-long-double
27049 @opindex m96bit-long-double
27050 @opindex m128bit-long-double
27051 These switches control the size of @code{long double} type. The x86-32
27052 application binary interface specifies the size to be 96 bits,
27053 so @option{-m96bit-long-double} is the default in 32-bit mode.
27055 Modern architectures (Pentium and newer) prefer @code{long double}
27056 to be aligned to an 8- or 16-byte boundary. In arrays or structures
27057 conforming to the ABI, this is not possible. So specifying
27058 @option{-m128bit-long-double} aligns @code{long double}
27059 to a 16-byte boundary by padding the @code{long double} with an additional
27062 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
27063 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
27065 Notice that neither of these options enable any extra precision over the x87
27066 standard of 80 bits for a @code{long double}.
27068 @strong{Warning:} if you override the default value for your target ABI, this
27069 changes the size of
27070 structures and arrays containing @code{long double} variables,
27071 as well as modifying the function calling convention for functions taking
27072 @code{long double}. Hence they are not binary-compatible
27073 with code compiled without that switch.
27075 @item -mlong-double-64
27076 @itemx -mlong-double-80
27077 @itemx -mlong-double-128
27078 @opindex mlong-double-64
27079 @opindex mlong-double-80
27080 @opindex mlong-double-128
27081 These switches control the size of @code{long double} type. A size
27082 of 64 bits makes the @code{long double} type equivalent to the @code{double}
27083 type. This is the default for 32-bit Bionic C library. A size
27084 of 128 bits makes the @code{long double} type equivalent to the
27085 @code{__float128} type. This is the default for 64-bit Bionic C library.
27087 @strong{Warning:} if you override the default value for your target ABI, this
27088 changes the size of
27089 structures and arrays containing @code{long double} variables,
27090 as well as modifying the function calling convention for functions taking
27091 @code{long double}. Hence they are not binary-compatible
27092 with code compiled without that switch.
27094 @item -malign-data=@var{type}
27095 @opindex malign-data
27096 Control how GCC aligns variables. Supported values for @var{type} are
27097 @samp{compat} uses increased alignment value compatible uses GCC 4.8
27098 and earlier, @samp{abi} uses alignment value as specified by the
27099 psABI, and @samp{cacheline} uses increased alignment value to match
27100 the cache line size. @samp{compat} is the default.
27102 @item -mlarge-data-threshold=@var{threshold}
27103 @opindex mlarge-data-threshold
27104 When @option{-mcmodel=medium} is specified, data objects larger than
27105 @var{threshold} are placed in the large data section. This value must be the
27106 same across all objects linked into the binary, and defaults to 65535.
27110 Use a different function-calling convention, in which functions that
27111 take a fixed number of arguments return with the @code{ret @var{num}}
27112 instruction, which pops their arguments while returning. This saves one
27113 instruction in the caller since there is no need to pop the arguments
27116 You can specify that an individual function is called with this calling
27117 sequence with the function attribute @code{stdcall}. You can also
27118 override the @option{-mrtd} option by using the function attribute
27119 @code{cdecl}. @xref{Function Attributes}.
27121 @strong{Warning:} this calling convention is incompatible with the one
27122 normally used on Unix, so you cannot use it if you need to call
27123 libraries compiled with the Unix compiler.
27125 Also, you must provide function prototypes for all functions that
27126 take variable numbers of arguments (including @code{printf});
27127 otherwise incorrect code is generated for calls to those
27130 In addition, seriously incorrect code results if you call a
27131 function with too many arguments. (Normally, extra arguments are
27132 harmlessly ignored.)
27134 @item -mregparm=@var{num}
27136 Control how many registers are used to pass integer arguments. By
27137 default, no registers are used to pass arguments, and at most 3
27138 registers can be used. You can control this behavior for a specific
27139 function by using the function attribute @code{regparm}.
27140 @xref{Function Attributes}.
27142 @strong{Warning:} if you use this switch, and
27143 @var{num} is nonzero, then you must build all modules with the same
27144 value, including any libraries. This includes the system libraries and
27148 @opindex msseregparm
27149 Use SSE register passing conventions for float and double arguments
27150 and return values. You can control this behavior for a specific
27151 function by using the function attribute @code{sseregparm}.
27152 @xref{Function Attributes}.
27154 @strong{Warning:} if you use this switch then you must build all
27155 modules with the same value, including any libraries. This includes
27156 the system libraries and startup modules.
27158 @item -mvect8-ret-in-mem
27159 @opindex mvect8-ret-in-mem
27160 Return 8-byte vectors in memory instead of MMX registers. This is the
27161 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
27162 Studio compilers until version 12. Later compiler versions (starting
27163 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
27164 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
27165 you need to remain compatible with existing code produced by those
27166 previous compiler versions or older versions of GCC@.
27175 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
27176 is specified, the significands of results of floating-point operations are
27177 rounded to 24 bits (single precision); @option{-mpc64} rounds the
27178 significands of results of floating-point operations to 53 bits (double
27179 precision) and @option{-mpc80} rounds the significands of results of
27180 floating-point operations to 64 bits (extended double precision), which is
27181 the default. When this option is used, floating-point operations in higher
27182 precisions are not available to the programmer without setting the FPU
27183 control word explicitly.
27185 Setting the rounding of floating-point operations to less than the default
27186 80 bits can speed some programs by 2% or more. Note that some mathematical
27187 libraries assume that extended-precision (80-bit) floating-point operations
27188 are enabled by default; routines in such libraries could suffer significant
27189 loss of accuracy, typically through so-called ``catastrophic cancellation'',
27190 when this option is used to set the precision to less than extended precision.
27192 @item -mstackrealign
27193 @opindex mstackrealign
27194 Realign the stack at entry. On the x86, the @option{-mstackrealign}
27195 option generates an alternate prologue and epilogue that realigns the
27196 run-time stack if necessary. This supports mixing legacy codes that keep
27197 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
27198 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
27199 applicable to individual functions.
27201 @item -mpreferred-stack-boundary=@var{num}
27202 @opindex mpreferred-stack-boundary
27203 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
27204 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
27205 the default is 4 (16 bytes or 128 bits).
27207 @strong{Warning:} When generating code for the x86-64 architecture with
27208 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
27209 used to keep the stack boundary aligned to 8 byte boundary. Since
27210 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
27211 intended to be used in controlled environment where stack space is
27212 important limitation. This option leads to wrong code when functions
27213 compiled with 16 byte stack alignment (such as functions from a standard
27214 library) are called with misaligned stack. In this case, SSE
27215 instructions may lead to misaligned memory access traps. In addition,
27216 variable arguments are handled incorrectly for 16 byte aligned
27217 objects (including x87 long double and __int128), leading to wrong
27218 results. You must build all modules with
27219 @option{-mpreferred-stack-boundary=3}, including any libraries. This
27220 includes the system libraries and startup modules.
27222 @item -mincoming-stack-boundary=@var{num}
27223 @opindex mincoming-stack-boundary
27224 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
27225 boundary. If @option{-mincoming-stack-boundary} is not specified,
27226 the one specified by @option{-mpreferred-stack-boundary} is used.
27228 On Pentium and Pentium Pro, @code{double} and @code{long double} values
27229 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
27230 suffer significant run time performance penalties. On Pentium III, the
27231 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
27232 properly if it is not 16-byte aligned.
27234 To ensure proper alignment of this values on the stack, the stack boundary
27235 must be as aligned as that required by any value stored on the stack.
27236 Further, every function must be generated such that it keeps the stack
27237 aligned. Thus calling a function compiled with a higher preferred
27238 stack boundary from a function compiled with a lower preferred stack
27239 boundary most likely misaligns the stack. It is recommended that
27240 libraries that use callbacks always use the default setting.
27242 This extra alignment does consume extra stack space, and generally
27243 increases code size. Code that is sensitive to stack space usage, such
27244 as embedded systems and operating system kernels, may want to reduce the
27245 preferred alignment to @option{-mpreferred-stack-boundary=2}.
27302 @itemx -mavx512ifma
27303 @opindex mavx512ifma
27305 @itemx -mavx512vbmi
27306 @opindex mavx512vbmi
27317 @itemx -mclflushopt
27318 @opindex mclflushopt
27341 @itemx -mprefetchwt1
27342 @opindex mprefetchwt1
27400 @itemx -mavx512vbmi2
27401 @opindex mavx512vbmi2
27412 @itemx -mvpclmulqdq
27413 @opindex mvpclmulqdq
27415 @itemx -mavx512bitalg
27416 @opindex mavx512bitalg
27422 @opindex mmovdir64b
27424 @itemx -mavx512vpopcntdq
27425 @opindex mavx512vpopcntdq
27429 These switches enable the use of instructions in the MMX, SSE,
27430 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27431 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
27432 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, BMI, BMI2, VAES, WAITPKG,
27433 FXSR, XSAVE, XSAVEOPT, LZCNT, RTM, MWAITX, PKU, IBT, SHSTK, AVX512VBMI2,
27434 GFNI, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B,
27435 AVX512VPOPCNTDQ, CLDEMOTE, 3DNow!@: or enhanced 3DNow!@: extended instruction
27436 sets. Each has a corresponding @option{-mno-} option to disable use of these
27439 These extensions are also available as built-in functions: see
27440 @ref{x86 Built-in Functions}, for details of the functions enabled and
27441 disabled by these switches.
27443 To generate SSE/SSE2 instructions automatically from floating-point
27444 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
27446 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
27447 generates new AVX instructions or AVX equivalence for all SSEx instructions
27450 These options enable GCC to use these extended instructions in
27451 generated code, even without @option{-mfpmath=sse}. Applications that
27452 perform run-time CPU detection must compile separate files for each
27453 supported architecture, using the appropriate flags. In particular,
27454 the file containing the CPU detection code should be compiled without
27457 @item -mdump-tune-features
27458 @opindex mdump-tune-features
27459 This option instructs GCC to dump the names of the x86 performance
27460 tuning features and default settings. The names can be used in
27461 @option{-mtune-ctrl=@var{feature-list}}.
27463 @item -mtune-ctrl=@var{feature-list}
27464 @opindex mtune-ctrl=@var{feature-list}
27465 This option is used to do fine grain control of x86 code generation features.
27466 @var{feature-list} is a comma separated list of @var{feature} names. See also
27467 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
27468 on if it is not preceded with @samp{^}, otherwise, it is turned off.
27469 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
27470 developers. Using it may lead to code paths not covered by testing and can
27471 potentially result in compiler ICEs or runtime errors.
27474 @opindex mno-default
27475 This option instructs GCC to turn off all tunable features. See also
27476 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
27480 This option instructs GCC to emit a @code{cld} instruction in the prologue
27481 of functions that use string instructions. String instructions depend on
27482 the DF flag to select between autoincrement or autodecrement mode. While the
27483 ABI specifies the DF flag to be cleared on function entry, some operating
27484 systems violate this specification by not clearing the DF flag in their
27485 exception dispatchers. The exception handler can be invoked with the DF flag
27486 set, which leads to wrong direction mode when string instructions are used.
27487 This option can be enabled by default on 32-bit x86 targets by configuring
27488 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
27489 instructions can be suppressed with the @option{-mno-cld} compiler option
27493 @opindex mvzeroupper
27494 This option instructs GCC to emit a @code{vzeroupper} instruction
27495 before a transfer of control flow out of the function to minimize
27496 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
27499 @item -mprefer-avx128
27500 @opindex mprefer-avx128
27501 This option instructs GCC to use 128-bit AVX instructions instead of
27502 256-bit AVX instructions in the auto-vectorizer.
27504 @item -mprefer-vector-width=@var{opt}
27505 @opindex mprefer-vector-width
27506 This option instructs GCC to use @var{opt}-bit vector width in instructions
27507 instead of default on the selected platform.
27511 No extra limitations applied to GCC other than defined by the selected platform.
27514 Prefer 128-bit vector width for instructions.
27517 Prefer 256-bit vector width for instructions.
27520 Prefer 512-bit vector width for instructions.
27525 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
27526 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
27527 objects. This is useful for atomic updates of data structures exceeding one
27528 machine word in size. The compiler uses this instruction to implement
27529 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
27530 128-bit integers, a library call is always used.
27534 This option enables generation of @code{SAHF} instructions in 64-bit code.
27535 Early Intel Pentium 4 CPUs with Intel 64 support,
27536 prior to the introduction of Pentium 4 G1 step in December 2005,
27537 lacked the @code{LAHF} and @code{SAHF} instructions
27538 which are supported by AMD64.
27539 These are load and store instructions, respectively, for certain status flags.
27540 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
27541 @code{drem}, and @code{remainder} built-in functions;
27542 see @ref{Other Builtins} for details.
27546 This option enables use of the @code{movbe} instruction to implement
27547 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
27551 The @option{-mshstk} option enables shadow stack built-in functions
27552 from x86 Control-flow Enforcement Technology (CET).
27556 This option enables built-in functions @code{__builtin_ia32_crc32qi},
27557 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
27558 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
27562 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
27563 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
27564 with an additional Newton-Raphson step
27565 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
27566 (and their vectorized
27567 variants) for single-precision floating-point arguments. These instructions
27568 are generated only when @option{-funsafe-math-optimizations} is enabled
27569 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
27570 Note that while the throughput of the sequence is higher than the throughput
27571 of the non-reciprocal instruction, the precision of the sequence can be
27572 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
27574 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
27575 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
27576 combination), and doesn't need @option{-mrecip}.
27578 Also note that GCC emits the above sequence with additional Newton-Raphson step
27579 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
27580 already with @option{-ffast-math} (or the above option combination), and
27581 doesn't need @option{-mrecip}.
27583 @item -mrecip=@var{opt}
27584 @opindex mrecip=opt
27585 This option controls which reciprocal estimate instructions
27586 may be used. @var{opt} is a comma-separated list of options, which may
27587 be preceded by a @samp{!} to invert the option:
27591 Enable all estimate instructions.
27594 Enable the default instructions, equivalent to @option{-mrecip}.
27597 Disable all estimate instructions, equivalent to @option{-mno-recip}.
27600 Enable the approximation for scalar division.
27603 Enable the approximation for vectorized division.
27606 Enable the approximation for scalar square root.
27609 Enable the approximation for vectorized square root.
27612 So, for example, @option{-mrecip=all,!sqrt} enables
27613 all of the reciprocal approximations, except for square root.
27615 @item -mveclibabi=@var{type}
27616 @opindex mveclibabi
27617 Specifies the ABI type to use for vectorizing intrinsics using an
27618 external library. Supported values for @var{type} are @samp{svml}
27619 for the Intel short
27620 vector math library and @samp{acml} for the AMD math core library.
27621 To use this option, both @option{-ftree-vectorize} and
27622 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
27623 ABI-compatible library must be specified at link time.
27625 GCC currently emits calls to @code{vmldExp2},
27626 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
27627 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
27628 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
27629 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
27630 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
27631 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
27632 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
27633 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
27634 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
27635 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
27636 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
27637 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
27638 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
27639 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
27640 when @option{-mveclibabi=acml} is used.
27642 @item -mabi=@var{name}
27644 Generate code for the specified calling convention. Permissible values
27645 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
27646 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
27647 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
27648 You can control this behavior for specific functions by
27649 using the function attributes @code{ms_abi} and @code{sysv_abi}.
27650 @xref{Function Attributes}.
27652 @item -mforce-indirect-call
27653 @opindex mforce-indirect-call
27654 Force all calls to functions to be indirect. This is useful
27655 when using Intel Processor Trace where it generates more precise timing
27656 information for function calls.
27658 @item -mcall-ms2sysv-xlogues
27659 @opindex mcall-ms2sysv-xlogues
27660 @opindex mno-call-ms2sysv-xlogues
27661 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
27662 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
27663 default, the code for saving and restoring these registers is emitted inline,
27664 resulting in fairly lengthy prologues and epilogues. Using
27665 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
27666 use stubs in the static portion of libgcc to perform these saves and restores,
27667 thus reducing function size at the cost of a few extra instructions.
27669 @item -mtls-dialect=@var{type}
27670 @opindex mtls-dialect
27671 Generate code to access thread-local storage using the @samp{gnu} or
27672 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
27673 @samp{gnu2} is more efficient, but it may add compile- and run-time
27674 requirements that cannot be satisfied on all systems.
27677 @itemx -mno-push-args
27678 @opindex mpush-args
27679 @opindex mno-push-args
27680 Use PUSH operations to store outgoing parameters. This method is shorter
27681 and usually equally fast as method using SUB/MOV operations and is enabled
27682 by default. In some cases disabling it may improve performance because of
27683 improved scheduling and reduced dependencies.
27685 @item -maccumulate-outgoing-args
27686 @opindex maccumulate-outgoing-args
27687 If enabled, the maximum amount of space required for outgoing arguments is
27688 computed in the function prologue. This is faster on most modern CPUs
27689 because of reduced dependencies, improved scheduling and reduced stack usage
27690 when the preferred stack boundary is not equal to 2. The drawback is a notable
27691 increase in code size. This switch implies @option{-mno-push-args}.
27695 Support thread-safe exception handling on MinGW. Programs that rely
27696 on thread-safe exception handling must compile and link all code with the
27697 @option{-mthreads} option. When compiling, @option{-mthreads} defines
27698 @option{-D_MT}; when linking, it links in a special thread helper library
27699 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
27701 @item -mms-bitfields
27702 @itemx -mno-ms-bitfields
27703 @opindex mms-bitfields
27704 @opindex mno-ms-bitfields
27706 Enable/disable bit-field layout compatible with the native Microsoft
27709 If @code{packed} is used on a structure, or if bit-fields are used,
27710 it may be that the Microsoft ABI lays out the structure differently
27711 than the way GCC normally does. Particularly when moving packed
27712 data between functions compiled with GCC and the native Microsoft compiler
27713 (either via function call or as data in a file), it may be necessary to access
27716 This option is enabled by default for Microsoft Windows
27717 targets. This behavior can also be controlled locally by use of variable
27718 or type attributes. For more information, see @ref{x86 Variable Attributes}
27719 and @ref{x86 Type Attributes}.
27721 The Microsoft structure layout algorithm is fairly simple with the exception
27722 of the bit-field packing.
27723 The padding and alignment of members of structures and whether a bit-field
27724 can straddle a storage-unit boundary are determine by these rules:
27727 @item Structure members are stored sequentially in the order in which they are
27728 declared: the first member has the lowest memory address and the last member
27731 @item Every data object has an alignment requirement. The alignment requirement
27732 for all data except structures, unions, and arrays is either the size of the
27733 object or the current packing size (specified with either the
27734 @code{aligned} attribute or the @code{pack} pragma),
27735 whichever is less. For structures, unions, and arrays,
27736 the alignment requirement is the largest alignment requirement of its members.
27737 Every object is allocated an offset so that:
27740 offset % alignment_requirement == 0
27743 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
27744 unit if the integral types are the same size and if the next bit-field fits
27745 into the current allocation unit without crossing the boundary imposed by the
27746 common alignment requirements of the bit-fields.
27749 MSVC interprets zero-length bit-fields in the following ways:
27752 @item If a zero-length bit-field is inserted between two bit-fields that
27753 are normally coalesced, the bit-fields are not coalesced.
27760 unsigned long bf_1 : 12;
27762 unsigned long bf_2 : 12;
27767 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
27768 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
27770 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
27771 alignment of the zero-length bit-field is greater than the member that follows it,
27772 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
27793 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
27794 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
27795 bit-field does not affect the alignment of @code{bar} or, as a result, the size
27798 Taking this into account, it is important to note the following:
27801 @item If a zero-length bit-field follows a normal bit-field, the type of the
27802 zero-length bit-field may affect the alignment of the structure as whole. For
27803 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
27804 normal bit-field, and is of type short.
27806 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
27807 still affect the alignment of the structure:
27818 Here, @code{t4} takes up 4 bytes.
27821 @item Zero-length bit-fields following non-bit-field members are ignored:
27833 Here, @code{t5} takes up 2 bytes.
27837 @item -mno-align-stringops
27838 @opindex mno-align-stringops
27839 Do not align the destination of inlined string operations. This switch reduces
27840 code size and improves performance in case the destination is already aligned,
27841 but GCC doesn't know about it.
27843 @item -minline-all-stringops
27844 @opindex minline-all-stringops
27845 By default GCC inlines string operations only when the destination is
27846 known to be aligned to least a 4-byte boundary.
27847 This enables more inlining and increases code
27848 size, but may improve performance of code that depends on fast
27849 @code{memcpy}, @code{strlen},
27850 and @code{memset} for short lengths.
27852 @item -minline-stringops-dynamically
27853 @opindex minline-stringops-dynamically
27854 For string operations of unknown size, use run-time checks with
27855 inline code for small blocks and a library call for large blocks.
27857 @item -mstringop-strategy=@var{alg}
27858 @opindex mstringop-strategy=@var{alg}
27859 Override the internal decision heuristic for the particular algorithm to use
27860 for inlining string operations. The allowed values for @var{alg} are:
27866 Expand using i386 @code{rep} prefix of the specified size.
27870 @itemx unrolled_loop
27871 Expand into an inline loop.
27874 Always use a library call.
27877 @item -mmemcpy-strategy=@var{strategy}
27878 @opindex mmemcpy-strategy=@var{strategy}
27879 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
27880 should be inlined and what inline algorithm to use when the expected size
27881 of the copy operation is known. @var{strategy}
27882 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
27883 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
27884 the max byte size with which inline algorithm @var{alg} is allowed. For the last
27885 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
27886 in the list must be specified in increasing order. The minimal byte size for
27887 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
27890 @item -mmemset-strategy=@var{strategy}
27891 @opindex mmemset-strategy=@var{strategy}
27892 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
27893 @code{__builtin_memset} expansion.
27895 @item -momit-leaf-frame-pointer
27896 @opindex momit-leaf-frame-pointer
27897 Don't keep the frame pointer in a register for leaf functions. This
27898 avoids the instructions to save, set up, and restore frame pointers and
27899 makes an extra register available in leaf functions. The option
27900 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
27901 which might make debugging harder.
27903 @item -mtls-direct-seg-refs
27904 @itemx -mno-tls-direct-seg-refs
27905 @opindex mtls-direct-seg-refs
27906 Controls whether TLS variables may be accessed with offsets from the
27907 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
27908 or whether the thread base pointer must be added. Whether or not this
27909 is valid depends on the operating system, and whether it maps the
27910 segment to cover the entire TLS area.
27912 For systems that use the GNU C Library, the default is on.
27915 @itemx -mno-sse2avx
27917 Specify that the assembler should encode SSE instructions with VEX
27918 prefix. The option @option{-mavx} turns this on by default.
27923 If profiling is active (@option{-pg}), put the profiling
27924 counter call before the prologue.
27925 Note: On x86 architectures the attribute @code{ms_hook_prologue}
27926 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
27928 @item -mrecord-mcount
27929 @itemx -mno-record-mcount
27930 @opindex mrecord-mcount
27931 If profiling is active (@option{-pg}), generate a __mcount_loc section
27932 that contains pointers to each profiling call. This is useful for
27933 automatically patching and out calls.
27936 @itemx -mno-nop-mcount
27937 @opindex mnop-mcount
27938 If profiling is active (@option{-pg}), generate the calls to
27939 the profiling functions as NOPs. This is useful when they
27940 should be patched in later dynamically. This is likely only
27941 useful together with @option{-mrecord-mcount}.
27943 @item -mskip-rax-setup
27944 @itemx -mno-skip-rax-setup
27945 @opindex mskip-rax-setup
27946 When generating code for the x86-64 architecture with SSE extensions
27947 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
27948 register when there are no variable arguments passed in vector registers.
27950 @strong{Warning:} Since RAX register is used to avoid unnecessarily
27951 saving vector registers on stack when passing variable arguments, the
27952 impacts of this option are callees may waste some stack space,
27953 misbehave or jump to a random location. GCC 4.4 or newer don't have
27954 those issues, regardless the RAX register value.
27957 @itemx -mno-8bit-idiv
27958 @opindex m8bit-idiv
27959 On some processors, like Intel Atom, 8-bit unsigned integer divide is
27960 much faster than 32-bit/64-bit integer divide. This option generates a
27961 run-time check. If both dividend and divisor are within range of 0
27962 to 255, 8-bit unsigned integer divide is used instead of
27963 32-bit/64-bit integer divide.
27965 @item -mavx256-split-unaligned-load
27966 @itemx -mavx256-split-unaligned-store
27967 @opindex mavx256-split-unaligned-load
27968 @opindex mavx256-split-unaligned-store
27969 Split 32-byte AVX unaligned load and store.
27971 @item -mstack-protector-guard=@var{guard}
27972 @itemx -mstack-protector-guard-reg=@var{reg}
27973 @itemx -mstack-protector-guard-offset=@var{offset}
27974 @opindex mstack-protector-guard
27975 @opindex mstack-protector-guard-reg
27976 @opindex mstack-protector-guard-offset
27977 Generate stack protection code using canary at @var{guard}. Supported
27978 locations are @samp{global} for global canary or @samp{tls} for per-thread
27979 canary in the TLS block (the default). This option has effect only when
27980 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
27982 With the latter choice the options
27983 @option{-mstack-protector-guard-reg=@var{reg}} and
27984 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
27985 which segment register (@code{%fs} or @code{%gs}) to use as base register
27986 for reading the canary, and from what offset from that base register.
27987 The default for those is as specified in the relevant ABI.
27989 @item -mmitigate-rop
27990 @opindex mmitigate-rop
27991 Try to avoid generating code sequences that contain unintended return
27992 opcodes, to mitigate against certain forms of attack. At the moment,
27993 this option is limited in what it can do and should not be relied
27994 on to provide serious protection.
27996 @item -mgeneral-regs-only
27997 @opindex mgeneral-regs-only
27998 Generate code that uses only the general-purpose registers. This
27999 prevents the compiler from using floating-point, vector, mask and bound
28002 @item -mindirect-branch=@var{choice}
28003 @opindex -mindirect-branch
28004 Convert indirect call and jump with @var{choice}. The default is
28005 @samp{keep}, which keeps indirect call and jump unmodified.
28006 @samp{thunk} converts indirect call and jump to call and return thunk.
28007 @samp{thunk-inline} converts indirect call and jump to inlined call
28008 and return thunk. @samp{thunk-extern} converts indirect call and jump
28009 to external call and return thunk provided in a separate object file.
28010 You can control this behavior for a specific function by using the
28011 function attribute @code{indirect_branch}. @xref{Function Attributes}.
28013 Note that @option{-mcmodel=large} is incompatible with
28014 @option{-mindirect-branch=thunk} and
28015 @option{-mindirect-branch=thunk-extern} since the thunk function may
28016 not be reachable in the large code model.
28018 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
28019 @option{-fcf-protection=branch} since the external thunk can not be modified
28020 to disable control-flow check.
28022 @item -mfunction-return=@var{choice}
28023 @opindex -mfunction-return
28024 Convert function return with @var{choice}. The default is @samp{keep},
28025 which keeps function return unmodified. @samp{thunk} converts function
28026 return to call and return thunk. @samp{thunk-inline} converts function
28027 return to inlined call and return thunk. @samp{thunk-extern} converts
28028 function return to external call and return thunk provided in a separate
28029 object file. You can control this behavior for a specific function by
28030 using the function attribute @code{function_return}.
28031 @xref{Function Attributes}.
28033 Note that @option{-mcmodel=large} is incompatible with
28034 @option{-mfunction-return=thunk} and
28035 @option{-mfunction-return=thunk-extern} since the thunk function may
28036 not be reachable in the large code model.
28039 @item -mindirect-branch-register
28040 @opindex -mindirect-branch-register
28041 Force indirect call and jump via register.
28045 These @samp{-m} switches are supported in addition to the above
28046 on x86-64 processors in 64-bit environments.
28059 Generate code for a 16-bit, 32-bit or 64-bit environment.
28060 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
28062 generates code that runs on any i386 system.
28064 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
28065 types to 64 bits, and generates code for the x86-64 architecture.
28066 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
28067 and @option{-mdynamic-no-pic} options.
28069 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
28071 generates code for the x86-64 architecture.
28073 The @option{-m16} option is the same as @option{-m32}, except for that
28074 it outputs the @code{.code16gcc} assembly directive at the beginning of
28075 the assembly output so that the binary can run in 16-bit mode.
28077 The @option{-miamcu} option generates code which conforms to Intel MCU
28078 psABI. It requires the @option{-m32} option to be turned on.
28080 @item -mno-red-zone
28081 @opindex mno-red-zone
28082 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
28083 by the x86-64 ABI; it is a 128-byte area beyond the location of the
28084 stack pointer that is not modified by signal or interrupt handlers
28085 and therefore can be used for temporary data without adjusting the stack
28086 pointer. The flag @option{-mno-red-zone} disables this red zone.
28088 @item -mcmodel=small
28089 @opindex mcmodel=small
28090 Generate code for the small code model: the program and its symbols must
28091 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
28092 Programs can be statically or dynamically linked. This is the default
28095 @item -mcmodel=kernel
28096 @opindex mcmodel=kernel
28097 Generate code for the kernel code model. The kernel runs in the
28098 negative 2 GB of the address space.
28099 This model has to be used for Linux kernel code.
28101 @item -mcmodel=medium
28102 @opindex mcmodel=medium
28103 Generate code for the medium model: the program is linked in the lower 2
28104 GB of the address space. Small symbols are also placed there. Symbols
28105 with sizes larger than @option{-mlarge-data-threshold} are put into
28106 large data or BSS sections and can be located above 2GB. Programs can
28107 be statically or dynamically linked.
28109 @item -mcmodel=large
28110 @opindex mcmodel=large
28111 Generate code for the large model. This model makes no assumptions
28112 about addresses and sizes of sections.
28114 @item -maddress-mode=long
28115 @opindex maddress-mode=long
28116 Generate code for long address mode. This is only supported for 64-bit
28117 and x32 environments. It is the default address mode for 64-bit
28120 @item -maddress-mode=short
28121 @opindex maddress-mode=short
28122 Generate code for short address mode. This is only supported for 32-bit
28123 and x32 environments. It is the default address mode for 32-bit and
28127 @node x86 Windows Options
28128 @subsection x86 Windows Options
28129 @cindex x86 Windows Options
28130 @cindex Windows Options for x86
28132 These additional options are available for Microsoft Windows targets:
28138 specifies that a console application is to be generated, by
28139 instructing the linker to set the PE header subsystem type
28140 required for console applications.
28141 This option is available for Cygwin and MinGW targets and is
28142 enabled by default on those targets.
28146 This option is available for Cygwin and MinGW targets. It
28147 specifies that a DLL---a dynamic link library---is to be
28148 generated, enabling the selection of the required runtime
28149 startup object and entry point.
28151 @item -mnop-fun-dllimport
28152 @opindex mnop-fun-dllimport
28153 This option is available for Cygwin and MinGW targets. It
28154 specifies that the @code{dllimport} attribute should be ignored.
28158 This option is available for MinGW targets. It specifies
28159 that MinGW-specific thread support is to be used.
28163 This option is available for MinGW-w64 targets. It causes
28164 the @code{UNICODE} preprocessor macro to be predefined, and
28165 chooses Unicode-capable runtime startup code.
28169 This option is available for Cygwin and MinGW targets. It
28170 specifies that the typical Microsoft Windows predefined macros are to
28171 be set in the pre-processor, but does not influence the choice
28172 of runtime library/startup code.
28176 This option is available for Cygwin and MinGW targets. It
28177 specifies that a GUI application is to be generated by
28178 instructing the linker to set the PE header subsystem type
28181 @item -fno-set-stack-executable
28182 @opindex fno-set-stack-executable
28183 This option is available for MinGW targets. It specifies that
28184 the executable flag for the stack used by nested functions isn't
28185 set. This is necessary for binaries running in kernel mode of
28186 Microsoft Windows, as there the User32 API, which is used to set executable
28187 privileges, isn't available.
28189 @item -fwritable-relocated-rdata
28190 @opindex fno-writable-relocated-rdata
28191 This option is available for MinGW and Cygwin targets. It specifies
28192 that relocated-data in read-only section is put into the @code{.data}
28193 section. This is a necessary for older runtimes not supporting
28194 modification of @code{.rdata} sections for pseudo-relocation.
28196 @item -mpe-aligned-commons
28197 @opindex mpe-aligned-commons
28198 This option is available for Cygwin and MinGW targets. It
28199 specifies that the GNU extension to the PE file format that
28200 permits the correct alignment of COMMON variables should be
28201 used when generating code. It is enabled by default if
28202 GCC detects that the target assembler found during configuration
28203 supports the feature.
28206 See also under @ref{x86 Options} for standard options.
28208 @node Xstormy16 Options
28209 @subsection Xstormy16 Options
28210 @cindex Xstormy16 Options
28212 These options are defined for Xstormy16:
28217 Choose startup files and linker script suitable for the simulator.
28220 @node Xtensa Options
28221 @subsection Xtensa Options
28222 @cindex Xtensa Options
28224 These options are supported for Xtensa targets:
28228 @itemx -mno-const16
28230 @opindex mno-const16
28231 Enable or disable use of @code{CONST16} instructions for loading
28232 constant values. The @code{CONST16} instruction is currently not a
28233 standard option from Tensilica. When enabled, @code{CONST16}
28234 instructions are always used in place of the standard @code{L32R}
28235 instructions. The use of @code{CONST16} is enabled by default only if
28236 the @code{L32R} instruction is not available.
28239 @itemx -mno-fused-madd
28240 @opindex mfused-madd
28241 @opindex mno-fused-madd
28242 Enable or disable use of fused multiply/add and multiply/subtract
28243 instructions in the floating-point option. This has no effect if the
28244 floating-point option is not also enabled. Disabling fused multiply/add
28245 and multiply/subtract instructions forces the compiler to use separate
28246 instructions for the multiply and add/subtract operations. This may be
28247 desirable in some cases where strict IEEE 754-compliant results are
28248 required: the fused multiply add/subtract instructions do not round the
28249 intermediate result, thereby producing results with @emph{more} bits of
28250 precision than specified by the IEEE standard. Disabling fused multiply
28251 add/subtract instructions also ensures that the program output is not
28252 sensitive to the compiler's ability to combine multiply and add/subtract
28255 @item -mserialize-volatile
28256 @itemx -mno-serialize-volatile
28257 @opindex mserialize-volatile
28258 @opindex mno-serialize-volatile
28259 When this option is enabled, GCC inserts @code{MEMW} instructions before
28260 @code{volatile} memory references to guarantee sequential consistency.
28261 The default is @option{-mserialize-volatile}. Use
28262 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
28264 @item -mforce-no-pic
28265 @opindex mforce-no-pic
28266 For targets, like GNU/Linux, where all user-mode Xtensa code must be
28267 position-independent code (PIC), this option disables PIC for compiling
28270 @item -mtext-section-literals
28271 @itemx -mno-text-section-literals
28272 @opindex mtext-section-literals
28273 @opindex mno-text-section-literals
28274 These options control the treatment of literal pools. The default is
28275 @option{-mno-text-section-literals}, which places literals in a separate
28276 section in the output file. This allows the literal pool to be placed
28277 in a data RAM/ROM, and it also allows the linker to combine literal
28278 pools from separate object files to remove redundant literals and
28279 improve code size. With @option{-mtext-section-literals}, the literals
28280 are interspersed in the text section in order to keep them as close as
28281 possible to their references. This may be necessary for large assembly
28282 files. Literals for each function are placed right before that function.
28284 @item -mauto-litpools
28285 @itemx -mno-auto-litpools
28286 @opindex mauto-litpools
28287 @opindex mno-auto-litpools
28288 These options control the treatment of literal pools. The default is
28289 @option{-mno-auto-litpools}, which places literals in a separate
28290 section in the output file unless @option{-mtext-section-literals} is
28291 used. With @option{-mauto-litpools} the literals are interspersed in
28292 the text section by the assembler. Compiler does not produce explicit
28293 @code{.literal} directives and loads literals into registers with
28294 @code{MOVI} instructions instead of @code{L32R} to let the assembler
28295 do relaxation and place literals as necessary. This option allows
28296 assembler to create several literal pools per function and assemble
28297 very big functions, which may not be possible with
28298 @option{-mtext-section-literals}.
28300 @item -mtarget-align
28301 @itemx -mno-target-align
28302 @opindex mtarget-align
28303 @opindex mno-target-align
28304 When this option is enabled, GCC instructs the assembler to
28305 automatically align instructions to reduce branch penalties at the
28306 expense of some code density. The assembler attempts to widen density
28307 instructions to align branch targets and the instructions following call
28308 instructions. If there are not enough preceding safe density
28309 instructions to align a target, no widening is performed. The
28310 default is @option{-mtarget-align}. These options do not affect the
28311 treatment of auto-aligned instructions like @code{LOOP}, which the
28312 assembler always aligns, either by widening density instructions or
28313 by inserting NOP instructions.
28316 @itemx -mno-longcalls
28317 @opindex mlongcalls
28318 @opindex mno-longcalls
28319 When this option is enabled, GCC instructs the assembler to translate
28320 direct calls to indirect calls unless it can determine that the target
28321 of a direct call is in the range allowed by the call instruction. This
28322 translation typically occurs for calls to functions in other source
28323 files. Specifically, the assembler translates a direct @code{CALL}
28324 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
28325 The default is @option{-mno-longcalls}. This option should be used in
28326 programs where the call target can potentially be out of range. This
28327 option is implemented in the assembler, not the compiler, so the
28328 assembly code generated by GCC still shows direct call
28329 instructions---look at the disassembled object code to see the actual
28330 instructions. Note that the assembler uses an indirect call for
28331 every cross-file call, not just those that really are out of range.
28334 @node zSeries Options
28335 @subsection zSeries Options
28336 @cindex zSeries options
28338 These are listed under @xref{S/390 and zSeries Options}.
28344 @section Specifying Subprocesses and the Switches to Pass to Them
28347 @command{gcc} is a driver program. It performs its job by invoking a
28348 sequence of other programs to do the work of compiling, assembling and
28349 linking. GCC interprets its command-line parameters and uses these to
28350 deduce which programs it should invoke, and which command-line options
28351 it ought to place on their command lines. This behavior is controlled
28352 by @dfn{spec strings}. In most cases there is one spec string for each
28353 program that GCC can invoke, but a few programs have multiple spec
28354 strings to control their behavior. The spec strings built into GCC can
28355 be overridden by using the @option{-specs=} command-line switch to specify
28358 @dfn{Spec files} are plain-text files that are used to construct spec
28359 strings. They consist of a sequence of directives separated by blank
28360 lines. The type of directive is determined by the first non-whitespace
28361 character on the line, which can be one of the following:
28364 @item %@var{command}
28365 Issues a @var{command} to the spec file processor. The commands that can
28369 @item %include <@var{file}>
28370 @cindex @code{%include}
28371 Search for @var{file} and insert its text at the current point in the
28374 @item %include_noerr <@var{file}>
28375 @cindex @code{%include_noerr}
28376 Just like @samp{%include}, but do not generate an error message if the include
28377 file cannot be found.
28379 @item %rename @var{old_name} @var{new_name}
28380 @cindex @code{%rename}
28381 Rename the spec string @var{old_name} to @var{new_name}.
28385 @item *[@var{spec_name}]:
28386 This tells the compiler to create, override or delete the named spec
28387 string. All lines after this directive up to the next directive or
28388 blank line are considered to be the text for the spec string. If this
28389 results in an empty string then the spec is deleted. (Or, if the
28390 spec did not exist, then nothing happens.) Otherwise, if the spec
28391 does not currently exist a new spec is created. If the spec does
28392 exist then its contents are overridden by the text of this
28393 directive, unless the first character of that text is the @samp{+}
28394 character, in which case the text is appended to the spec.
28396 @item [@var{suffix}]:
28397 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
28398 and up to the next directive or blank line are considered to make up the
28399 spec string for the indicated suffix. When the compiler encounters an
28400 input file with the named suffix, it processes the spec string in
28401 order to work out how to compile that file. For example:
28405 z-compile -input %i
28408 This says that any input file whose name ends in @samp{.ZZ} should be
28409 passed to the program @samp{z-compile}, which should be invoked with the
28410 command-line switch @option{-input} and with the result of performing the
28411 @samp{%i} substitution. (See below.)
28413 As an alternative to providing a spec string, the text following a
28414 suffix directive can be one of the following:
28417 @item @@@var{language}
28418 This says that the suffix is an alias for a known @var{language}. This is
28419 similar to using the @option{-x} command-line switch to GCC to specify a
28420 language explicitly. For example:
28427 Says that .ZZ files are, in fact, C++ source files.
28430 This causes an error messages saying:
28433 @var{name} compiler not installed on this system.
28437 GCC already has an extensive list of suffixes built into it.
28438 This directive adds an entry to the end of the list of suffixes, but
28439 since the list is searched from the end backwards, it is effectively
28440 possible to override earlier entries using this technique.
28444 GCC has the following spec strings built into it. Spec files can
28445 override these strings or create their own. Note that individual
28446 targets can also add their own spec strings to this list.
28449 asm Options to pass to the assembler
28450 asm_final Options to pass to the assembler post-processor
28451 cpp Options to pass to the C preprocessor
28452 cc1 Options to pass to the C compiler
28453 cc1plus Options to pass to the C++ compiler
28454 endfile Object files to include at the end of the link
28455 link Options to pass to the linker
28456 lib Libraries to include on the command line to the linker
28457 libgcc Decides which GCC support library to pass to the linker
28458 linker Sets the name of the linker
28459 predefines Defines to be passed to the C preprocessor
28460 signed_char Defines to pass to CPP to say whether @code{char} is signed
28462 startfile Object files to include at the start of the link
28465 Here is a small example of a spec file:
28468 %rename lib old_lib
28471 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
28474 This example renames the spec called @samp{lib} to @samp{old_lib} and
28475 then overrides the previous definition of @samp{lib} with a new one.
28476 The new definition adds in some extra command-line options before
28477 including the text of the old definition.
28479 @dfn{Spec strings} are a list of command-line options to be passed to their
28480 corresponding program. In addition, the spec strings can contain
28481 @samp{%}-prefixed sequences to substitute variable text or to
28482 conditionally insert text into the command line. Using these constructs
28483 it is possible to generate quite complex command lines.
28485 Here is a table of all defined @samp{%}-sequences for spec
28486 strings. Note that spaces are not generated automatically around the
28487 results of expanding these sequences. Therefore you can concatenate them
28488 together or combine them with constant text in a single argument.
28492 Substitute one @samp{%} into the program name or argument.
28495 Substitute the name of the input file being processed.
28498 Substitute the basename of the input file being processed.
28499 This is the substring up to (and not including) the last period
28500 and not including the directory.
28503 This is the same as @samp{%b}, but include the file suffix (text after
28507 Marks the argument containing or following the @samp{%d} as a
28508 temporary file name, so that that file is deleted if GCC exits
28509 successfully. Unlike @samp{%g}, this contributes no text to the
28512 @item %g@var{suffix}
28513 Substitute a file name that has suffix @var{suffix} and is chosen
28514 once per compilation, and mark the argument in the same way as
28515 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
28516 name is now chosen in a way that is hard to predict even when previously
28517 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
28518 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
28519 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
28520 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
28521 was simply substituted with a file name chosen once per compilation,
28522 without regard to any appended suffix (which was therefore treated
28523 just like ordinary text), making such attacks more likely to succeed.
28525 @item %u@var{suffix}
28526 Like @samp{%g}, but generates a new temporary file name
28527 each time it appears instead of once per compilation.
28529 @item %U@var{suffix}
28530 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
28531 new one if there is no such last file name. In the absence of any
28532 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
28533 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
28534 involves the generation of two distinct file names, one
28535 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
28536 simply substituted with a file name chosen for the previous @samp{%u},
28537 without regard to any appended suffix.
28539 @item %j@var{suffix}
28540 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
28541 writable, and if @option{-save-temps} is not used;
28542 otherwise, substitute the name
28543 of a temporary file, just like @samp{%u}. This temporary file is not
28544 meant for communication between processes, but rather as a junk
28545 disposal mechanism.
28547 @item %|@var{suffix}
28548 @itemx %m@var{suffix}
28549 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
28550 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
28551 all. These are the two most common ways to instruct a program that it
28552 should read from standard input or write to standard output. If you
28553 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
28554 construct: see for example @file{f/lang-specs.h}.
28556 @item %.@var{SUFFIX}
28557 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
28558 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
28559 terminated by the next space or %.
28562 Marks the argument containing or following the @samp{%w} as the
28563 designated output file of this compilation. This puts the argument
28564 into the sequence of arguments that @samp{%o} substitutes.
28567 Substitutes the names of all the output files, with spaces
28568 automatically placed around them. You should write spaces
28569 around the @samp{%o} as well or the results are undefined.
28570 @samp{%o} is for use in the specs for running the linker.
28571 Input files whose names have no recognized suffix are not compiled
28572 at all, but they are included among the output files, so they are
28576 Substitutes the suffix for object files. Note that this is
28577 handled specially when it immediately follows @samp{%g, %u, or %U},
28578 because of the need for those to form complete file names. The
28579 handling is such that @samp{%O} is treated exactly as if it had already
28580 been substituted, except that @samp{%g, %u, and %U} do not currently
28581 support additional @var{suffix} characters following @samp{%O} as they do
28582 following, for example, @samp{.o}.
28585 Substitutes the standard macro predefinitions for the
28586 current target machine. Use this when running @command{cpp}.
28589 Like @samp{%p}, but puts @samp{__} before and after the name of each
28590 predefined macro, except for macros that start with @samp{__} or with
28591 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
28595 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
28596 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
28597 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
28598 and @option{-imultilib} as necessary.
28601 Current argument is the name of a library or startup file of some sort.
28602 Search for that file in a standard list of directories and substitute
28603 the full name found. The current working directory is included in the
28604 list of directories scanned.
28607 Current argument is the name of a linker script. Search for that file
28608 in the current list of directories to scan for libraries. If the file
28609 is located insert a @option{--script} option into the command line
28610 followed by the full path name found. If the file is not found then
28611 generate an error message. Note: the current working directory is not
28615 Print @var{str} as an error message. @var{str} is terminated by a newline.
28616 Use this when inconsistent options are detected.
28618 @item %(@var{name})
28619 Substitute the contents of spec string @var{name} at this point.
28621 @item %x@{@var{option}@}
28622 Accumulate an option for @samp{%X}.
28625 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
28629 Output the accumulated assembler options specified by @option{-Wa}.
28632 Output the accumulated preprocessor options specified by @option{-Wp}.
28635 Process the @code{asm} spec. This is used to compute the
28636 switches to be passed to the assembler.
28639 Process the @code{asm_final} spec. This is a spec string for
28640 passing switches to an assembler post-processor, if such a program is
28644 Process the @code{link} spec. This is the spec for computing the
28645 command line passed to the linker. Typically it makes use of the
28646 @samp{%L %G %S %D and %E} sequences.
28649 Dump out a @option{-L} option for each directory that GCC believes might
28650 contain startup files. If the target supports multilibs then the
28651 current multilib directory is prepended to each of these paths.
28654 Process the @code{lib} spec. This is a spec string for deciding which
28655 libraries are included on the command line to the linker.
28658 Process the @code{libgcc} spec. This is a spec string for deciding
28659 which GCC support library is included on the command line to the linker.
28662 Process the @code{startfile} spec. This is a spec for deciding which
28663 object files are the first ones passed to the linker. Typically
28664 this might be a file named @file{crt0.o}.
28667 Process the @code{endfile} spec. This is a spec string that specifies
28668 the last object files that are passed to the linker.
28671 Process the @code{cpp} spec. This is used to construct the arguments
28672 to be passed to the C preprocessor.
28675 Process the @code{cc1} spec. This is used to construct the options to be
28676 passed to the actual C compiler (@command{cc1}).
28679 Process the @code{cc1plus} spec. This is used to construct the options to be
28680 passed to the actual C++ compiler (@command{cc1plus}).
28683 Substitute the variable part of a matched option. See below.
28684 Note that each comma in the substituted string is replaced by
28688 Remove all occurrences of @code{-S} from the command line. Note---this
28689 command is position dependent. @samp{%} commands in the spec string
28690 before this one see @code{-S}, @samp{%} commands in the spec string
28691 after this one do not.
28693 @item %:@var{function}(@var{args})
28694 Call the named function @var{function}, passing it @var{args}.
28695 @var{args} is first processed as a nested spec string, then split
28696 into an argument vector in the usual fashion. The function returns
28697 a string which is processed as if it had appeared literally as part
28698 of the current spec.
28700 The following built-in spec functions are provided:
28703 @item @code{getenv}
28704 The @code{getenv} spec function takes two arguments: an environment
28705 variable name and a string. If the environment variable is not
28706 defined, a fatal error is issued. Otherwise, the return value is the
28707 value of the environment variable concatenated with the string. For
28708 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
28711 %:getenv(TOPDIR /include)
28714 expands to @file{/path/to/top/include}.
28716 @item @code{if-exists}
28717 The @code{if-exists} spec function takes one argument, an absolute
28718 pathname to a file. If the file exists, @code{if-exists} returns the
28719 pathname. Here is a small example of its usage:
28723 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
28726 @item @code{if-exists-else}
28727 The @code{if-exists-else} spec function is similar to the @code{if-exists}
28728 spec function, except that it takes two arguments. The first argument is
28729 an absolute pathname to a file. If the file exists, @code{if-exists-else}
28730 returns the pathname. If it does not exist, it returns the second argument.
28731 This way, @code{if-exists-else} can be used to select one file or another,
28732 based on the existence of the first. Here is a small example of its usage:
28736 crt0%O%s %:if-exists(crti%O%s) \
28737 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
28740 @item @code{replace-outfile}
28741 The @code{replace-outfile} spec function takes two arguments. It looks for the
28742 first argument in the outfiles array and replaces it with the second argument. Here
28743 is a small example of its usage:
28746 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
28749 @item @code{remove-outfile}
28750 The @code{remove-outfile} spec function takes one argument. It looks for the
28751 first argument in the outfiles array and removes it. Here is a small example
28755 %:remove-outfile(-lm)
28758 @item @code{pass-through-libs}
28759 The @code{pass-through-libs} spec function takes any number of arguments. It
28760 finds any @option{-l} options and any non-options ending in @file{.a} (which it
28761 assumes are the names of linker input library archive files) and returns a
28762 result containing all the found arguments each prepended by
28763 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
28764 intended to be passed to the LTO linker plugin.
28767 %:pass-through-libs(%G %L %G)
28770 @item @code{print-asm-header}
28771 The @code{print-asm-header} function takes no arguments and simply
28772 prints a banner like:
28778 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
28781 It is used to separate compiler options from assembler options
28782 in the @option{--target-help} output.
28786 Substitutes the @code{-S} switch, if that switch is given to GCC@.
28787 If that switch is not specified, this substitutes nothing. Note that
28788 the leading dash is omitted when specifying this option, and it is
28789 automatically inserted if the substitution is performed. Thus the spec
28790 string @samp{%@{foo@}} matches the command-line option @option{-foo}
28791 and outputs the command-line option @option{-foo}.
28794 Like %@{@code{S}@} but mark last argument supplied within as a file to be
28795 deleted on failure.
28798 Substitutes all the switches specified to GCC whose names start
28799 with @code{-S}, but which also take an argument. This is used for
28800 switches like @option{-o}, @option{-D}, @option{-I}, etc.
28801 GCC considers @option{-o foo} as being
28802 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
28803 text, including the space. Thus two arguments are generated.
28806 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
28807 (the order of @code{S} and @code{T} in the spec is not significant).
28808 There can be any number of ampersand-separated variables; for each the
28809 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
28812 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
28815 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
28818 Substitutes @code{X} if one or more switches whose names start with
28819 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
28820 once, no matter how many such switches appeared. However, if @code{%*}
28821 appears somewhere in @code{X}, then @code{X} is substituted once
28822 for each matching switch, with the @code{%*} replaced by the part of
28823 that switch matching the @code{*}.
28825 If @code{%*} appears as the last part of a spec sequence then a space
28826 is added after the end of the last substitution. If there is more
28827 text in the sequence, however, then a space is not generated. This
28828 allows the @code{%*} substitution to be used as part of a larger
28829 string. For example, a spec string like this:
28832 %@{mcu=*:--script=%*/memory.ld@}
28836 when matching an option like @option{-mcu=newchip} produces:
28839 --script=newchip/memory.ld
28843 Substitutes @code{X}, if processing a file with suffix @code{S}.
28846 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
28849 Substitutes @code{X}, if processing a file for language @code{S}.
28852 Substitutes @code{X}, if not processing a file for language @code{S}.
28855 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
28856 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
28857 @code{*} sequences as well, although they have a stronger binding than
28858 the @samp{|}. If @code{%*} appears in @code{X}, all of the
28859 alternatives must be starred, and only the first matching alternative
28862 For example, a spec string like this:
28865 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
28869 outputs the following command-line options from the following input
28870 command-line options:
28875 -d fred.c -foo -baz -boggle
28876 -d jim.d -bar -baz -boggle
28879 @item %@{S:X; T:Y; :D@}
28881 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
28882 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
28883 be as many clauses as you need. This may be combined with @code{.},
28884 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
28889 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
28890 or similar construct can use a backslash to ignore the special meaning
28891 of the character following it, thus allowing literal matching of a
28892 character that is otherwise specially treated. For example,
28893 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
28894 @option{-std=iso9899:1999} option is given.
28896 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
28897 construct may contain other nested @samp{%} constructs or spaces, or
28898 even newlines. They are processed as usual, as described above.
28899 Trailing white space in @code{X} is ignored. White space may also
28900 appear anywhere on the left side of the colon in these constructs,
28901 except between @code{.} or @code{*} and the corresponding word.
28903 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
28904 handled specifically in these constructs. If another value of
28905 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
28906 @option{-W} switch is found later in the command line, the earlier
28907 switch value is ignored, except with @{@code{S}*@} where @code{S} is
28908 just one letter, which passes all matching options.
28910 The character @samp{|} at the beginning of the predicate text is used to
28911 indicate that a command should be piped to the following command, but
28912 only if @option{-pipe} is specified.
28914 It is built into GCC which switches take arguments and which do not.
28915 (You might think it would be useful to generalize this to allow each
28916 compiler's spec to say which switches take arguments. But this cannot
28917 be done in a consistent fashion. GCC cannot even decide which input
28918 files have been specified without knowing which switches take arguments,
28919 and it must know which input files to compile in order to tell which
28922 GCC also knows implicitly that arguments starting in @option{-l} are to be
28923 treated as compiler output files, and passed to the linker in their
28924 proper position among the other output files.
28926 @node Environment Variables
28927 @section Environment Variables Affecting GCC
28928 @cindex environment variables
28930 @c man begin ENVIRONMENT
28931 This section describes several environment variables that affect how GCC
28932 operates. Some of them work by specifying directories or prefixes to use
28933 when searching for various kinds of files. Some are used to specify other
28934 aspects of the compilation environment.
28936 Note that you can also specify places to search using options such as
28937 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
28938 take precedence over places specified using environment variables, which
28939 in turn take precedence over those specified by the configuration of GCC@.
28940 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
28941 GNU Compiler Collection (GCC) Internals}.
28946 @c @itemx LC_COLLATE
28948 @c @itemx LC_MONETARY
28949 @c @itemx LC_NUMERIC
28954 @c @findex LC_COLLATE
28955 @findex LC_MESSAGES
28956 @c @findex LC_MONETARY
28957 @c @findex LC_NUMERIC
28961 These environment variables control the way that GCC uses
28962 localization information which allows GCC to work with different
28963 national conventions. GCC inspects the locale categories
28964 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
28965 so. These locale categories can be set to any value supported by your
28966 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
28967 Kingdom encoded in UTF-8.
28969 The @env{LC_CTYPE} environment variable specifies character
28970 classification. GCC uses it to determine the character boundaries in
28971 a string; this is needed for some multibyte encodings that contain quote
28972 and escape characters that are otherwise interpreted as a string
28975 The @env{LC_MESSAGES} environment variable specifies the language to
28976 use in diagnostic messages.
28978 If the @env{LC_ALL} environment variable is set, it overrides the value
28979 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
28980 and @env{LC_MESSAGES} default to the value of the @env{LANG}
28981 environment variable. If none of these variables are set, GCC
28982 defaults to traditional C English behavior.
28986 If @env{TMPDIR} is set, it specifies the directory to use for temporary
28987 files. GCC uses temporary files to hold the output of one stage of
28988 compilation which is to be used as input to the next stage: for example,
28989 the output of the preprocessor, which is the input to the compiler
28992 @item GCC_COMPARE_DEBUG
28993 @findex GCC_COMPARE_DEBUG
28994 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
28995 @option{-fcompare-debug} to the compiler driver. See the documentation
28996 of this option for more details.
28998 @item GCC_EXEC_PREFIX
28999 @findex GCC_EXEC_PREFIX
29000 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
29001 names of the subprograms executed by the compiler. No slash is added
29002 when this prefix is combined with the name of a subprogram, but you can
29003 specify a prefix that ends with a slash if you wish.
29005 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
29006 an appropriate prefix to use based on the pathname it is invoked with.
29008 If GCC cannot find the subprogram using the specified prefix, it
29009 tries looking in the usual places for the subprogram.
29011 The default value of @env{GCC_EXEC_PREFIX} is
29012 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
29013 the installed compiler. In many cases @var{prefix} is the value
29014 of @code{prefix} when you ran the @file{configure} script.
29016 Other prefixes specified with @option{-B} take precedence over this prefix.
29018 This prefix is also used for finding files such as @file{crt0.o} that are
29021 In addition, the prefix is used in an unusual way in finding the
29022 directories to search for header files. For each of the standard
29023 directories whose name normally begins with @samp{/usr/local/lib/gcc}
29024 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
29025 replacing that beginning with the specified prefix to produce an
29026 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
29027 @file{foo/bar} just before it searches the standard directory
29028 @file{/usr/local/lib/bar}.
29029 If a standard directory begins with the configured
29030 @var{prefix} then the value of @var{prefix} is replaced by
29031 @env{GCC_EXEC_PREFIX} when looking for header files.
29033 @item COMPILER_PATH
29034 @findex COMPILER_PATH
29035 The value of @env{COMPILER_PATH} is a colon-separated list of
29036 directories, much like @env{PATH}. GCC tries the directories thus
29037 specified when searching for subprograms, if it cannot find the
29038 subprograms using @env{GCC_EXEC_PREFIX}.
29041 @findex LIBRARY_PATH
29042 The value of @env{LIBRARY_PATH} is a colon-separated list of
29043 directories, much like @env{PATH}. When configured as a native compiler,
29044 GCC tries the directories thus specified when searching for special
29045 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
29046 using GCC also uses these directories when searching for ordinary
29047 libraries for the @option{-l} option (but directories specified with
29048 @option{-L} come first).
29052 @cindex locale definition
29053 This variable is used to pass locale information to the compiler. One way in
29054 which this information is used is to determine the character set to be used
29055 when character literals, string literals and comments are parsed in C and C++.
29056 When the compiler is configured to allow multibyte characters,
29057 the following values for @env{LANG} are recognized:
29061 Recognize JIS characters.
29063 Recognize SJIS characters.
29065 Recognize EUCJP characters.
29068 If @env{LANG} is not defined, or if it has some other value, then the
29069 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
29070 recognize and translate multibyte characters.
29074 Some additional environment variables affect the behavior of the
29077 @include cppenv.texi
29081 @node Precompiled Headers
29082 @section Using Precompiled Headers
29083 @cindex precompiled headers
29084 @cindex speed of compilation
29086 Often large projects have many header files that are included in every
29087 source file. The time the compiler takes to process these header files
29088 over and over again can account for nearly all of the time required to
29089 build the project. To make builds faster, GCC allows you to
29090 @dfn{precompile} a header file.
29092 To create a precompiled header file, simply compile it as you would any
29093 other file, if necessary using the @option{-x} option to make the driver
29094 treat it as a C or C++ header file. You may want to use a
29095 tool like @command{make} to keep the precompiled header up-to-date when
29096 the headers it contains change.
29098 A precompiled header file is searched for when @code{#include} is
29099 seen in the compilation. As it searches for the included file
29100 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
29101 compiler looks for a precompiled header in each directory just before it
29102 looks for the include file in that directory. The name searched for is
29103 the name specified in the @code{#include} with @samp{.gch} appended. If
29104 the precompiled header file cannot be used, it is ignored.
29106 For instance, if you have @code{#include "all.h"}, and you have
29107 @file{all.h.gch} in the same directory as @file{all.h}, then the
29108 precompiled header file is used if possible, and the original
29109 header is used otherwise.
29111 Alternatively, you might decide to put the precompiled header file in a
29112 directory and use @option{-I} to ensure that directory is searched
29113 before (or instead of) the directory containing the original header.
29114 Then, if you want to check that the precompiled header file is always
29115 used, you can put a file of the same name as the original header in this
29116 directory containing an @code{#error} command.
29118 This also works with @option{-include}. So yet another way to use
29119 precompiled headers, good for projects not designed with precompiled
29120 header files in mind, is to simply take most of the header files used by
29121 a project, include them from another header file, precompile that header
29122 file, and @option{-include} the precompiled header. If the header files
29123 have guards against multiple inclusion, they are skipped because
29124 they've already been included (in the precompiled header).
29126 If you need to precompile the same header file for different
29127 languages, targets, or compiler options, you can instead make a
29128 @emph{directory} named like @file{all.h.gch}, and put each precompiled
29129 header in the directory, perhaps using @option{-o}. It doesn't matter
29130 what you call the files in the directory; every precompiled header in
29131 the directory is considered. The first precompiled header
29132 encountered in the directory that is valid for this compilation is
29133 used; they're searched in no particular order.
29135 There are many other possibilities, limited only by your imagination,
29136 good sense, and the constraints of your build system.
29138 A precompiled header file can be used only when these conditions apply:
29142 Only one precompiled header can be used in a particular compilation.
29145 A precompiled header cannot be used once the first C token is seen. You
29146 can have preprocessor directives before a precompiled header; you cannot
29147 include a precompiled header from inside another header.
29150 The precompiled header file must be produced for the same language as
29151 the current compilation. You cannot use a C precompiled header for a C++
29155 The precompiled header file must have been produced by the same compiler
29156 binary as the current compilation is using.
29159 Any macros defined before the precompiled header is included must
29160 either be defined in the same way as when the precompiled header was
29161 generated, or must not affect the precompiled header, which usually
29162 means that they don't appear in the precompiled header at all.
29164 The @option{-D} option is one way to define a macro before a
29165 precompiled header is included; using a @code{#define} can also do it.
29166 There are also some options that define macros implicitly, like
29167 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
29170 @item If debugging information is output when using the precompiled
29171 header, using @option{-g} or similar, the same kind of debugging information
29172 must have been output when building the precompiled header. However,
29173 a precompiled header built using @option{-g} can be used in a compilation
29174 when no debugging information is being output.
29176 @item The same @option{-m} options must generally be used when building
29177 and using the precompiled header. @xref{Submodel Options},
29178 for any cases where this rule is relaxed.
29180 @item Each of the following options must be the same when building and using
29181 the precompiled header:
29183 @gccoptlist{-fexceptions}
29186 Some other command-line options starting with @option{-f},
29187 @option{-p}, or @option{-O} must be defined in the same way as when
29188 the precompiled header was generated. At present, it's not clear
29189 which options are safe to change and which are not; the safest choice
29190 is to use exactly the same options when generating and using the
29191 precompiled header. The following are known to be safe:
29193 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
29194 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
29195 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
29200 For all of these except the last, the compiler automatically
29201 ignores the precompiled header if the conditions aren't met. If you
29202 find an option combination that doesn't work and doesn't cause the
29203 precompiled header to be ignored, please consider filing a bug report,
29206 If you do use differing options when generating and using the
29207 precompiled header, the actual behavior is a mixture of the
29208 behavior for the options. For instance, if you use @option{-g} to
29209 generate the precompiled header but not when using it, you may or may
29210 not get debugging information for routines in the precompiled header.