1GCC(1) GNU GCC(1)
2
3
4
6 gcc - GNU project C and C++ compiler
7
9 gcc [-c|-S|-E] [-std=standard]
10 [-g] [-pg] [-Olevel]
11 [-Wwarn...] [-Wpedantic]
12 [-Idir...] [-Ldir...]
13 [-Dmacro[=defn]...] [-Umacro]
14 [-foption...] [-mmachine-option...]
15 [-o outfile] [@file] infile...
16
17 Only the most useful options are listed here; see below for the
18 remainder. g++ accepts mostly the same options as gcc.
19
21 When you invoke GCC, it normally does preprocessing, compilation,
22 assembly and linking. The "overall options" allow you to stop this
23 process at an intermediate stage. For example, the -c option says not
24 to run the linker. Then the output consists of object files output by
25 the assembler.
26
27 Other options are passed on to one or more stages of processing. Some
28 options control the preprocessor and others the compiler itself. Yet
29 other options control the assembler and linker; most of these are not
30 documented here, since you rarely need to use any of them.
31
32 Most of the command-line options that you can use with GCC are useful
33 for C programs; when an option is only useful with another language
34 (usually C++), the explanation says so explicitly. If the description
35 for a particular option does not mention a source language, you can use
36 that option with all supported languages.
37
38 The usual way to run GCC is to run the executable called gcc, or
39 machine-gcc when cross-compiling, or machine-gcc-version to run a
40 specific version of GCC. When you compile C++ programs, you should
41 invoke GCC as g++ instead.
42
43 The gcc program accepts options and file names as operands. Many
44 options have multi-letter names; therefore multiple single-letter
45 options may not be grouped: -dv is very different from -d -v.
46
47 You can mix options and other arguments. For the most part, the order
48 you use doesn't matter. Order does matter when you use several options
49 of the same kind; for example, if you specify -L more than once, the
50 directories are searched in the order specified. Also, the placement
51 of the -l option is significant.
52
53 Many options have long names starting with -f or with -W---for example,
54 -fmove-loop-invariants, -Wformat and so on. Most of these have both
55 positive and negative forms; the negative form of -ffoo is -fno-foo.
56 This manual documents only one of these two forms, whichever one is not
57 the default.
58
59 Some options take one or more arguments typically separated either by a
60 space or by the equals sign (=) from the option name. Unless
61 documented otherwise, an argument can be either numeric or a string.
62 Numeric arguments must typically be small unsigned decimal or
63 hexadecimal integers. Hexadecimal arguments must begin with the 0x
64 prefix. Arguments to options that specify a size threshold of some
65 sort may be arbitrarily large decimal or hexadecimal integers followed
66 by a byte size suffix designating a multiple of bytes such as "kB" and
67 "KiB" for kilobyte and kibibyte, respectively, "MB" and "MiB" for
68 megabyte and mebibyte, "GB" and "GiB" for gigabyte and gigibyte, and so
69 on. Such arguments are designated by byte-size in the following text.
70 Refer to the NIST, IEC, and other relevant national and international
71 standards for the full listing and explanation of the binary and
72 decimal byte size prefixes.
73
75 Option Summary
76 Here is a summary of all the options, grouped by type. Explanations
77 are in the following sections.
78
79 Overall Options
80 -c -S -E -o file -dumpbase dumpbase -dumpbase-ext auxdropsuf
81 -dumpdir dumppfx -x language -v -### --help[=class[,...]]
82 --target-help --version -pass-exit-codes -pipe -specs=file
83 -wrapper @file -ffile-prefix-map=old=new -fcanon-prefix-map
84 -fplugin=file -fplugin-arg-name=arg -fdump-ada-spec[-slim]
85 -fada-spec-parent=unit -fdump-go-spec=file
86
87 C Language Options
88 -ansi -std=standard -aux-info filename -fno-asm -fno-builtin
89 -fno-builtin-function -fcond-mismatch -ffreestanding -fgimple
90 -fgnu-tm -fgnu89-inline -fhosted -flax-vector-conversions
91 -fms-extensions -foffload=arg -foffload-options=arg -fopenacc
92 -fopenacc-dim=geom -fopenmp -fopenmp-simd
93 -fopenmp-target-simd-clone[=device-type]
94 -fpermitted-flt-eval-methods=standard -fplan9-extensions
95 -fsigned-bitfields -funsigned-bitfields -fsigned-char
96 -funsigned-char -fstrict-flex-arrays[=n] -fsso-struct=endianness
97
98 C++ Language Options
99 -fabi-version=n -fno-access-control -faligned-new=n
100 -fargs-in-order=n -fchar8_t -fcheck-new -fconstexpr-depth=n
101 -fconstexpr-cache-depth=n -fconstexpr-loop-limit=n
102 -fconstexpr-ops-limit=n -fno-elide-constructors
103 -fno-enforce-eh-specs -fno-gnu-keywords -fno-implicit-templates
104 -fno-implicit-inline-templates -fno-implement-inlines
105 -fmodule-header[=kind] -fmodule-only -fmodules-ts
106 -fmodule-implicit-inline -fno-module-lazy
107 -fmodule-mapper=specification -fmodule-version-ignore
108 -fms-extensions -fnew-inheriting-ctors -fnew-ttp-matching
109 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names
110 -fno-optional-diags -fpermissive -fno-pretty-templates -fno-rtti
111 -fsized-deallocation -ftemplate-backtrace-limit=n
112 -ftemplate-depth=n -fno-threadsafe-statics -fuse-cxa-atexit
113 -fno-weak -nostdinc++ -fvisibility-inlines-hidden
114 -fvisibility-ms-compat -fext-numeric-literals
115 -flang-info-include-translate[=header]
116 -flang-info-include-translate-not -flang-info-module-cmi[=module]
117 -stdlib=libstdc++,libc++ -Wabi-tag -Wcatch-value -Wcatch-value=n
118 -Wno-class-conversion -Wclass-memaccess -Wcomma-subscript
119 -Wconditionally-supported -Wno-conversion-null
120 -Wctad-maybe-unsupported -Wctor-dtor-privacy -Wdangling-reference
121 -Wno-delete-incomplete -Wdelete-non-virtual-dtor
122 -Wno-deprecated-array-compare -Wdeprecated-copy
123 -Wdeprecated-copy-dtor -Wno-deprecated-enum-enum-conversion
124 -Wno-deprecated-enum-float-conversion -Weffc++ -Wno-exceptions
125 -Wextra-semi -Wno-inaccessible-base -Wno-inherited-variadic-ctor
126 -Wno-init-list-lifetime -Winvalid-constexpr
127 -Winvalid-imported-macros -Wno-invalid-offsetof
128 -Wno-literal-suffix -Wmismatched-new-delete -Wmismatched-tags
129 -Wmultiple-inheritance -Wnamespaces -Wnarrowing -Wnoexcept
130 -Wnoexcept-type -Wnon-virtual-dtor -Wpessimizing-move
131 -Wno-placement-new -Wplacement-new=n -Wrange-loop-construct
132 -Wredundant-move -Wredundant-tags -Wreorder -Wregister
133 -Wstrict-null-sentinel -Wno-subobject-linkage -Wtemplates
134 -Wno-non-template-friend -Wold-style-cast -Woverloaded-virtual
135 -Wno-pmf-conversions -Wself-move -Wsign-promo -Wsized-deallocation
136 -Wsuggest-final-methods -Wsuggest-final-types -Wsuggest-override
137 -Wno-terminate -Wuseless-cast -Wno-vexing-parse
138 -Wvirtual-inheritance -Wno-virtual-move-assign -Wvolatile
139 -Wzero-as-null-pointer-constant
140
141 Objective-C and Objective-C++ Language Options
142 -fconstant-string-class=class-name -fgnu-runtime -fnext-runtime
143 -fno-nil-receivers -fobjc-abi-version=n -fobjc-call-cxx-cdtors
144 -fobjc-direct-dispatch -fobjc-exceptions -fobjc-gc -fobjc-nilcheck
145 -fobjc-std=objc1 -fno-local-ivars
146 -fivar-visibility=[public|protected|private|package]
147 -freplace-objc-classes -fzero-link -gen-decls -Wassign-intercept
148 -Wno-property-assign-default -Wno-protocol -Wobjc-root-class
149 -Wselector -Wstrict-selector-match -Wundeclared-selector
150
151 Diagnostic Message Formatting Options
152 -fmessage-length=n -fdiagnostics-plain-output
153 -fdiagnostics-show-location=[once|every-line]
154 -fdiagnostics-color=[auto|never|always]
155 -fdiagnostics-urls=[auto|never|always]
156 -fdiagnostics-format=[text|sarif-stderr|sarif-file|json|json-
157 stderr|json-file] -fno-diagnostics-show-option
158 -fno-diagnostics-show-caret -fno-diagnostics-show-labels
159 -fno-diagnostics-show-line-numbers -fno-diagnostics-show-cwe
160 -fno-diagnostics-show-rule -fdiagnostics-minimum-margin-width=width
161 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch
162 -fdiagnostics-show-template-tree -fno-elide-type
163 -fdiagnostics-path-format=[none|separate-events|inline-events]
164 -fdiagnostics-show-path-depths -fno-show-column
165 -fdiagnostics-column-unit=[display|byte]
166 -fdiagnostics-column-origin=origin
167 -fdiagnostics-escape-format=[unicode|bytes]
168
169 Warning Options
170 -fsyntax-only -fmax-errors=n -Wpedantic -pedantic-errors -w
171 -Wextra -Wall -Wabi=n -Waddress -Wno-address-of-packed-member
172 -Waggregate-return -Walloc-size-larger-than=byte-size -Walloc-zero
173 -Walloca -Walloca-larger-than=byte-size
174 -Wno-aggressive-loop-optimizations -Warith-conversion
175 -Warray-bounds -Warray-bounds=n -Warray-compare -Wno-attributes
176 -Wattribute-alias=n -Wno-attribute-alias -Wno-attribute-warning
177 -Wbidi-chars=[none|unpaired|any|ucn] -Wbool-compare
178 -Wbool-operation -Wno-builtin-declaration-mismatch
179 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat
180 -Wc11-c2x-compat -Wc++-compat -Wc++11-compat -Wc++14-compat
181 -Wc++17-compat -Wc++20-compat -Wno-c++11-extensions
182 -Wno-c++14-extensions -Wno-c++17-extensions -Wno-c++20-extensions
183 -Wno-c++23-extensions -Wcast-align -Wcast-align=strict
184 -Wcast-function-type -Wcast-qual -Wchar-subscripts -Wclobbered
185 -Wcomment -Wno-complain-wrong-lang -Wconversion
186 -Wno-coverage-mismatch -Wno-cpp -Wdangling-else
187 -Wdangling-pointer -Wdangling-pointer=n -Wdate-time
188 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init
189 -Wdisabled-optimization -Wno-discarded-array-qualifiers
190 -Wno-discarded-qualifiers -Wno-div-by-zero -Wdouble-promotion
191 -Wduplicated-branches -Wduplicated-cond -Wempty-body
192 -Wno-endif-labels -Wenum-compare -Wenum-conversion
193 -Wenum-int-mismatch -Werror -Werror=* -Wexpansion-to-defined
194 -Wfatal-errors -Wfloat-conversion -Wfloat-equal -Wformat
195 -Wformat=2 -Wno-format-contains-nul -Wno-format-extra-args
196 -Wformat-nonliteral -Wformat-overflow=n -Wformat-security
197 -Wformat-signedness -Wformat-truncation=n -Wformat-y2k
198 -Wframe-address -Wframe-larger-than=byte-size
199 -Wno-free-nonheap-object -Wno-if-not-aligned
200 -Wno-ignored-attributes -Wignored-qualifiers
201 -Wno-incompatible-pointer-types -Wimplicit -Wimplicit-fallthrough
202 -Wimplicit-fallthrough=n -Wno-implicit-function-declaration
203 -Wno-implicit-int -Winfinite-recursion -Winit-self -Winline
204 -Wno-int-conversion -Wint-in-bool-context -Wno-int-to-pointer-cast
205 -Wno-invalid-memory-model -Winvalid-pch -Winvalid-utf8
206 -Wno-unicode -Wjump-misses-init -Wlarger-than=byte-size
207 -Wlogical-not-parentheses -Wlogical-op -Wlong-long
208 -Wno-lto-type-mismatch -Wmain -Wmaybe-uninitialized
209 -Wmemset-elt-size -Wmemset-transposed-args
210 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces
211 -Wmissing-field-initializers -Wmissing-format-attribute
212 -Wmissing-include-dirs -Wmissing-noreturn -Wno-missing-profile
213 -Wno-multichar -Wmultistatement-macros -Wnonnull
214 -Wnonnull-compare -Wnormalized=[none|id|nfc|nfkc]
215 -Wnull-dereference -Wno-odr -Wopenacc-parallelism -Wopenmp-simd
216 -Wno-overflow -Woverlength-strings
217 -Wno-override-init-side-effects -Wpacked
218 -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded
219 -Wparentheses -Wno-pedantic-ms-format -Wpointer-arith
220 -Wno-pointer-compare -Wno-pointer-to-int-cast -Wno-pragmas
221 -Wno-prio-ctor-dtor -Wredundant-decls -Wrestrict
222 -Wno-return-local-addr -Wreturn-type -Wno-scalar-storage-order
223 -Wsequence-point -Wshadow -Wshadow=global -Wshadow=local
224 -Wshadow=compatible-local -Wno-shadow-ivar
225 -Wno-shift-count-negative -Wno-shift-count-overflow
226 -Wshift-negative-value -Wno-shift-overflow -Wshift-overflow=n
227 -Wsign-compare -Wsign-conversion -Wno-sizeof-array-argument
228 -Wsizeof-array-div -Wsizeof-pointer-div -Wsizeof-pointer-memaccess
229 -Wstack-protector -Wstack-usage=byte-size -Wstrict-aliasing
230 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=n
231 -Wstring-compare -Wno-stringop-overflow -Wno-stringop-overread
232 -Wno-stringop-truncation -Wstrict-flex-arrays
233 -Wsuggest-attribute=[pure|const|noreturn|format|malloc] -Wswitch
234 -Wno-switch-bool -Wswitch-default -Wswitch-enum
235 -Wno-switch-outside-range -Wno-switch-unreachable -Wsync-nand
236 -Wsystem-headers -Wtautological-compare -Wtrampolines
237 -Wtrigraphs -Wtrivial-auto-var-init -Wtsan -Wtype-limits -Wundef
238 -Wuninitialized -Wunknown-pragmas -Wunsuffixed-float-constants
239 -Wunused -Wunused-but-set-parameter -Wunused-but-set-variable
240 -Wunused-const-variable -Wunused-const-variable=n
241 -Wunused-function -Wunused-label -Wunused-local-typedefs
242 -Wunused-macros -Wunused-parameter -Wno-unused-result
243 -Wunused-value -Wunused-variable -Wno-varargs -Wvariadic-macros
244 -Wvector-operation-performance -Wvla -Wvla-larger-than=byte-size
245 -Wno-vla-larger-than -Wvolatile-register-var -Wwrite-strings
246 -Wxor-used-as-pow -Wzero-length-bounds
247
248 Static Analyzer Options
249 -fanalyzer -fanalyzer-call-summaries -fanalyzer-checker=name
250 -fno-analyzer-feasibility -fanalyzer-fine-grained
251 -fno-analyzer-state-merge -fno-analyzer-state-purge
252 -fno-analyzer-suppress-followups -fanalyzer-transitivity
253 -fno-analyzer-undo-inlining -fanalyzer-verbose-edges
254 -fanalyzer-verbose-state-changes -fanalyzer-verbosity=level
255 -fdump-analyzer -fdump-analyzer-callgraph
256 -fdump-analyzer-exploded-graph -fdump-analyzer-exploded-nodes
257 -fdump-analyzer-exploded-nodes-2 -fdump-analyzer-exploded-nodes-3
258 -fdump-analyzer-exploded-paths -fdump-analyzer-feasibility
259 -fdump-analyzer-json -fdump-analyzer-state-purge
260 -fdump-analyzer-stderr -fdump-analyzer-supergraph
261 -fdump-analyzer-untracked -Wno-analyzer-double-fclose
262 -Wno-analyzer-double-free
263 -Wno-analyzer-exposure-through-output-file
264 -Wno-analyzer-exposure-through-uninit-copy
265 -Wno-analyzer-fd-access-mode-mismatch -Wno-analyzer-fd-double-close
266 -Wno-analyzer-fd-leak -Wno-analyzer-fd-phase-mismatch
267 -Wno-analyzer-fd-type-mismatch -Wno-analyzer-fd-use-after-close
268 -Wno-analyzer-fd-use-without-check -Wno-analyzer-file-leak
269 -Wno-analyzer-free-of-non-heap
270 -Wno-analyzer-imprecise-fp-arithmetic
271 -Wno-analyzer-infinite-recursion -Wno-analyzer-jump-through-null
272 -Wno-analyzer-malloc-leak -Wno-analyzer-mismatching-deallocation
273 -Wno-analyzer-null-argument -Wno-analyzer-null-dereference
274 -Wno-analyzer-out-of-bounds -Wno-analyzer-possible-null-argument
275 -Wno-analyzer-possible-null-dereference
276 -Wno-analyzer-putenv-of-auto-var -Wno-analyzer-shift-count-negative
277 -Wno-analyzer-shift-count-overflow
278 -Wno-analyzer-stale-setjmp-buffer
279 -Wno-analyzer-tainted-allocation-size
280 -Wno-analyzer-tainted-assertion -Wno-analyzer-tainted-array-index
281 -Wno-analyzer-tainted-divisor -Wno-analyzer-tainted-offset
282 -Wno-analyzer-tainted-size -Wanalyzer-too-complex
283 -Wno-analyzer-unsafe-call-within-signal-handler
284 -Wno-analyzer-use-after-free
285 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
286 -Wno-analyzer-use-of-uninitialized-value
287 -Wno-analyzer-va-arg-type-mismatch -Wno-analyzer-va-list-exhausted
288 -Wno-analyzer-va-list-leak -Wno-analyzer-va-list-use-after-va-end
289 -Wno-analyzer-write-to-const -Wno-analyzer-write-to-string-literal
290
291 C and Objective-C-only Warning Options
292 -Wbad-function-cast -Wmissing-declarations
293 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs
294 -Wold-style-declaration -Wold-style-definition -Wstrict-prototypes
295 -Wtraditional -Wtraditional-conversion
296 -Wdeclaration-after-statement -Wpointer-sign
297
298 Debugging Options
299 -g -glevel -gdwarf -gdwarf-version -gbtf -gctf -gctflevel -ggdb
300 -grecord-gcc-switches -gno-record-gcc-switches -gstrict-dwarf
301 -gno-strict-dwarf -gas-loc-support -gno-as-loc-support
302 -gas-locview-support -gno-as-locview-support -gcolumn-info
303 -gno-column-info -gdwarf32 -gdwarf64 -gstatement-frontiers
304 -gno-statement-frontiers -gvariable-location-views
305 -gno-variable-location-views -ginternal-reset-location-views
306 -gno-internal-reset-location-views -ginline-points
307 -gno-inline-points -gvms -gz[=type] -gsplit-dwarf -gdescribe-dies
308 -gno-describe-dies -fdebug-prefix-map=old=new
309 -fdebug-types-section -fno-eliminate-unused-debug-types
310 -femit-struct-debug-baseonly -femit-struct-debug-reduced
311 -femit-struct-debug-detailed[=spec-list]
312 -fno-eliminate-unused-debug-symbols -femit-class-debug-always
313 -fno-merge-debug-strings -fno-dwarf2-cfi-asm -fvar-tracking
314 -fvar-tracking-assignments
315
316 Optimization Options
317 -faggressive-loop-optimizations -falign-functions[=n[:m:[n2[:m2]]]]
318 -falign-jumps[=n[:m:[n2[:m2]]]] -falign-labels[=n[:m:[n2[:m2]]]]
319 -falign-loops[=n[:m:[n2[:m2]]]] -fno-allocation-dce
320 -fallow-store-data-races -fassociative-math -fauto-profile
321 -fauto-profile[=path] -fauto-inc-dec -fbranch-probabilities
322 -fcaller-saves -fcombine-stack-adjustments -fconserve-stack
323 -fcompare-elim -fcprop-registers -fcrossjumping
324 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules
325 -fcx-limited-range -fdata-sections -fdce -fdelayed-branch
326 -fdelete-null-pointer-checks -fdevirtualize
327 -fdevirtualize-speculatively -fdevirtualize-at-ltrans -fdse
328 -fearly-inlining -fipa-sra -fexpensive-optimizations
329 -ffat-lto-objects -ffast-math -ffinite-math-only -ffloat-store
330 -fexcess-precision=style -ffinite-loops -fforward-propagate
331 -ffp-contract=style -ffunction-sections -fgcse
332 -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity
333 -fgcse-sm -fhoist-adjacent-loads -fif-conversion -fif-conversion2
334 -findirect-inlining -finline-functions
335 -finline-functions-called-once -finline-limit=n
336 -finline-small-functions -fipa-modref -fipa-cp -fipa-cp-clone
337 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const
338 -fipa-reference -fipa-reference-addressable -fipa-stack-alignment
339 -fipa-icf -fira-algorithm=algorithm -flive-patching=level
340 -fira-region=region -fira-hoist-pressure -fira-loop-pressure
341 -fno-ira-share-save-slots -fno-ira-share-spill-slots
342 -fisolate-erroneous-paths-dereference
343 -fisolate-erroneous-paths-attribute -fivopts
344 -fkeep-inline-functions -fkeep-static-functions
345 -fkeep-static-consts -flimit-function-alignment
346 -flive-range-shrinkage -floop-block -floop-interchange
347 -floop-strip-mine -floop-unroll-and-jam -floop-nest-optimize
348 -floop-parallelize-all -flra-remat -flto -flto-compression-level
349 -flto-partition=alg -fmerge-all-constants -fmerge-constants
350 -fmodulo-sched -fmodulo-sched-allow-regmoves
351 -fmove-loop-invariants -fmove-loop-stores -fno-branch-count-reg
352 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse
353 -fno-guess-branch-probability -fno-inline -fno-math-errno
354 -fno-peephole -fno-peephole2 -fno-printf-return-value
355 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros
356 -fno-toplevel-reorder -fno-trapping-math
357 -fno-zero-initialized-in-bss -fomit-frame-pointer
358 -foptimize-sibling-calls -fpartial-inlining -fpeel-loops
359 -fpredictive-commoning -fprefetch-loop-arrays -fprofile-correction
360 -fprofile-use -fprofile-use=path -fprofile-partial-training
361 -fprofile-values -fprofile-reorder-functions -freciprocal-math
362 -free -frename-registers -freorder-blocks
363 -freorder-blocks-algorithm=algorithm -freorder-blocks-and-partition
364 -freorder-functions -frerun-cse-after-loop
365 -freschedule-modulo-scheduled-loops -frounding-math
366 -fsave-optimization-record -fsched2-use-superblocks
367 -fsched-pressure -fsched-spec-load -fsched-spec-load-dangerous
368 -fsched-stalled-insns-dep[=n] -fsched-stalled-insns[=n]
369 -fsched-group-heuristic -fsched-critical-path-heuristic
370 -fsched-spec-insn-heuristic -fsched-rank-heuristic
371 -fsched-last-insn-heuristic -fsched-dep-count-heuristic
372 -fschedule-fusion -fschedule-insns -fschedule-insns2
373 -fsection-anchors -fselective-scheduling -fselective-scheduling2
374 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops
375 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate
376 -fsignaling-nans -fsingle-precision-constant
377 -fsplit-ivs-in-unroller -fsplit-loops -fsplit-paths
378 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop
379 -fssa-phiopt -fstdarg-opt -fstore-merging -fstrict-aliasing
380 -fipa-strict-aliasing -fthread-jumps -ftracer -ftree-bit-ccp
381 -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-coalesce-vars
382 -ftree-copy-prop -ftree-dce -ftree-dominator-opts -ftree-dse
383 -ftree-forwprop -ftree-fre -fcode-hoisting -ftree-loop-if-convert
384 -ftree-loop-im -ftree-phiprop -ftree-loop-distribution
385 -ftree-loop-distribute-patterns -ftree-loop-ivcanon
386 -ftree-loop-linear -ftree-loop-optimize -ftree-loop-vectorize
387 -ftree-parallelize-loops=n -ftree-pre -ftree-partial-pre
388 -ftree-pta -ftree-reassoc -ftree-scev-cprop -ftree-sink
389 -ftree-slsr -ftree-sra -ftree-switch-conversion -ftree-tail-merge
390 -ftree-ter -ftree-vectorize -ftree-vrp -ftrivial-auto-var-init
391 -funconstrained-commons -funit-at-a-time -funroll-all-loops
392 -funroll-loops -funsafe-math-optimizations -funswitch-loops
393 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model
394 -fvpt -fweb -fwhole-program -fwpa -fuse-linker-plugin
395 -fzero-call-used-regs --param name=value -O -O0 -O1 -O2 -O3
396 -Os -Ofast -Og -Oz
397
398 Program Instrumentation Options
399 -p -pg -fprofile-arcs --coverage -ftest-coverage
400 -fprofile-abs-path -fprofile-dir=path -fprofile-generate
401 -fprofile-generate=path -fprofile-info-section
402 -fprofile-info-section=name -fprofile-note=path
403 -fprofile-prefix-path=path -fprofile-update=method
404 -fprofile-filter-files=regex -fprofile-exclude-files=regex
405 -fprofile-reproducible=[multithreaded|parallel-runs|serial]
406 -fsanitize=style -fsanitize-recover -fsanitize-recover=style
407 -fsanitize-trap -fsanitize-trap=style -fasan-shadow-offset=number
408 -fsanitize-sections=s1,s2,... -fsanitize-undefined-trap-on-error
409 -fbounds-check -fcf-protection=[full|branch|return|none|check]
410 -fharden-compares -fharden-conditional-branches -fstack-protector
411 -fstack-protector-all -fstack-protector-strong
412 -fstack-protector-explicit -fstack-check
413 -fstack-limit-register=reg -fstack-limit-symbol=sym
414 -fno-stack-limit -fsplit-stack -fvtable-verify=[std|preinit|none]
415 -fvtv-counts -fvtv-debug -finstrument-functions
416 -finstrument-functions-once
417 -finstrument-functions-exclude-function-list=sym,sym,...
418 -finstrument-functions-exclude-file-list=file,file,...
419 -fprofile-prefix-map=old=new
420
421 Preprocessor Options
422 -Aquestion=answer -A-question[=answer] -C -CC -Dmacro[=defn] -dD
423 -dI -dM -dN -dU -fdebug-cpp -fdirectives-only
424 -fdollars-in-identifiers -fexec-charset=charset
425 -fextended-identifiers -finput-charset=charset
426 -flarge-source-files -fmacro-prefix-map=old=new
427 -fmax-include-depth=depth -fno-canonical-system-headers -fpch-deps
428 -fpch-preprocess -fpreprocessed -ftabstop=width
429 -ftrack-macro-expansion -fwide-exec-charset=charset
430 -fworking-directory -H -imacros file -include file -M -MD -MF
431 -MG -MM -MMD -MP -MQ -MT -Mno-modules -no-integrated-cpp -P
432 -pthread -remap -traditional -traditional-cpp -trigraphs -Umacro
433 -undef -Wp,option -Xpreprocessor option
434
435 Assembler Options
436 -Wa,option -Xassembler option
437
438 Linker Options
439 object-file-name -fuse-ld=linker -llibrary -nostartfiles
440 -nodefaultlibs -nolibc -nostdlib -nostdlib++ -e entry
441 --entry=entry -pie -pthread -r -rdynamic -s -static
442 -static-pie -static-libgcc -static-libstdc++ -static-libasan
443 -static-libtsan -static-liblsan -static-libubsan -shared
444 -shared-libgcc -symbolic -T script -Wl,option -Xlinker option -u
445 symbol -z keyword
446
447 Directory Options
448 -Bprefix -Idir -I- -idirafter dir -imacros file -imultilib dir
449 -iplugindir=dir -iprefix file -iquote dir -isysroot dir -isystem
450 dir -iwithprefix dir -iwithprefixbefore dir -Ldir
451 -no-canonical-prefixes --no-sysroot-suffix -nostdinc -nostdinc++
452 --sysroot=dir
453
454 Code Generation Options
455 -fcall-saved-reg -fcall-used-reg -ffixed-reg -fexceptions
456 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables
457 -fasynchronous-unwind-tables -fno-gnu-unique
458 -finhibit-size-directive -fcommon -fno-ident -fpcc-struct-return
459 -fpic -fPIC -fpie -fPIE -fno-plt -fno-jump-tables
460 -fno-bit-tests -frecord-gcc-switches -freg-struct-return
461 -fshort-enums -fshort-wchar -fverbose-asm -fpack-struct[=n]
462 -fleading-underscore -ftls-model=model -fstack-reuse=reuse_level
463 -ftrampolines -ftrapv -fwrapv
464 -fvisibility=[default|internal|hidden|protected]
465 -fstrict-volatile-bitfields -fsync-libcalls
466
467 Developer Options
468 -dletters -dumpspecs -dumpmachine -dumpversion -dumpfullversion
469 -fcallgraph-info[=su,da] -fchecking -fchecking=n -fdbg-cnt-list
470 -fdbg-cnt=counter-value-list -fdisable-ipa-pass_name
471 -fdisable-rtl-pass_name -fdisable-rtl-pass-name=range-list
472 -fdisable-tree-pass_name -fdisable-tree-pass-name=range-list
473 -fdump-debug -fdump-earlydebug -fdump-noaddr -fdump-unnumbered
474 -fdump-unnumbered-links -fdump-final-insns[=file] -fdump-ipa-all
475 -fdump-ipa-cgraph -fdump-ipa-inline -fdump-lang-all
476 -fdump-lang-switch -fdump-lang-switch-options
477 -fdump-lang-switch-options=filename -fdump-passes -fdump-rtl-pass
478 -fdump-rtl-pass=filename -fdump-statistics -fdump-tree-all
479 -fdump-tree-switch -fdump-tree-switch-options
480 -fdump-tree-switch-options=filename -fcompare-debug[=opts]
481 -fcompare-debug-second -fenable-kind-pass -fenable-kind-pass=range-
482 list -fira-verbose=n -flto-report -flto-report-wpa
483 -fmem-report-wpa -fmem-report -fpre-ipa-mem-report
484 -fpost-ipa-mem-report -fopt-info -fopt-info-options[=file]
485 -fmultiflags -fprofile-report -frandom-seed=string
486 -fsched-verbose=n -fsel-sched-verbose -fsel-sched-dump-cfg
487 -fsel-sched-pipelining-verbose -fstats -fstack-usage
488 -ftime-report -ftime-report-details
489 -fvar-tracking-assignments-toggle -gtoggle
490 -print-file-name=library -print-libgcc-file-name
491 -print-multi-directory -print-multi-lib -print-multi-os-directory
492 -print-prog-name=program -print-search-dirs -Q -print-sysroot
493 -print-sysroot-headers-suffix -save-temps -save-temps=cwd
494 -save-temps=obj -time[=file]
495
496 Machine-Dependent Options
497 AArch64 Options -mabi=name -mbig-endian -mlittle-endian
498 -mgeneral-regs-only -mcmodel=tiny -mcmodel=small -mcmodel=large
499 -mstrict-align -mno-strict-align -momit-leaf-frame-pointer
500 -mtls-dialect=desc -mtls-dialect=traditional -mtls-size=size
501 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419
502 -mlow-precision-recip-sqrt -mlow-precision-sqrt
503 -mlow-precision-div -mpc-relative-literal-loads
504 -msign-return-address=scope -mbranch-protection=none|standard|pac-
505 ret[+leaf +b-key]|bti -mharden-sls=opts -march=name -mcpu=name
506 -mtune=name -moverride=string -mverbose-cost-dump
507 -mstack-protector-guard=guard -mstack-protector-guard-reg=sysreg
508 -mstack-protector-guard-offset=offset -mtrack-speculation
509 -moutline-atomics
510
511 Adapteva Epiphany Options -mhalf-reg-file -mprefer-short-insn-regs
512 -mbranch-cost=num -mcmove -mnops=num -msoft-cmpsf -msplit-lohi
513 -mpost-inc -mpost-modify -mstack-offset=num -mround-nearest
514 -mlong-calls -mshort-calls -msmall16 -mfp-mode=mode
515 -mvect-double -max-vect-align=num -msplit-vecmove-early
516 -m1reg-reg
517
518 AMD GCN Options -march=gpu -mtune=gpu -mstack-size=bytes
519
520 ARC Options -mbarrel-shifter -mjli-always -mcpu=cpu -mA6
521 -mARC600 -mA7 -mARC700 -mdpfp -mdpfp-compact -mdpfp-fast
522 -mno-dpfp-lrsr -mea -mno-mpy -mmul32x16 -mmul64 -matomic -mnorm
523 -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap
524 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc
525 -mswape -mtelephony -mxy -misize -mannotate-align -marclinux
526 -marclinux_prof -mlong-calls -mmedium-calls -msdata
527 -mirq-ctrl-saved -mrgf-banked-regs -mlpc-width=width -G num
528 -mvolatile-cache -mtp-regno=regno -malign-call -mauto-modify-reg
529 -mbbit-peephole -mno-brcc -mcase-vector-pcrel -mcompact-casesi
530 -mno-cond-exec -mearly-cbranchsi -mexpand-adddi -mindexed-loads
531 -mlra -mlra-priority-none -mlra-priority-compact
532 -mlra-priority-noncompact -mmillicode -mmixed-code -mq-class
533 -mRcq -mRcw -msize-level=level -mtune=cpu -mmultcost=num
534 -mcode-density-frame -munalign-prob-threshold=probability
535 -mmpy-option=multo -mdiv-rem -mcode-density -mll64 -mfpu=fpu
536 -mrf16 -mbranch-index
537
538 ARM Options -mapcs-frame -mno-apcs-frame -mabi=name
539 -mapcs-stack-check -mno-apcs-stack-check -mapcs-reentrant
540 -mno-apcs-reentrant -mgeneral-regs-only -msched-prolog
541 -mno-sched-prolog -mlittle-endian -mbig-endian -mbe8 -mbe32
542 -mfloat-abi=name -mfp16-format=name -mthumb-interwork
543 -mno-thumb-interwork -mcpu=name -march=name -mfpu=name
544 -mtune=name -mprint-tune-info -mstructure-size-boundary=n
545 -mabort-on-noreturn -mlong-calls -mno-long-calls -msingle-pic-base
546 -mno-single-pic-base -mpic-register=reg -mnop-fun-dllimport
547 -mpoke-function-name -mthumb -marm -mflip-thumb -mtpcs-frame
548 -mtpcs-leaf-frame -mcaller-super-interworking
549 -mcallee-super-interworking -mtp=name -mtls-dialect=dialect
550 -mword-relocations -mfix-cortex-m3-ldrd
551 -mfix-cortex-a57-aes-1742098 -mfix-cortex-a72-aes-1655431
552 -munaligned-access -mneon-for-64bits -mslow-flash-data
553 -masm-syntax-unified -mrestrict-it -mverbose-cost-dump -mpure-code
554 -mcmse -mfix-cmse-cve-2021-35465 -mstack-protector-guard=guard
555 -mstack-protector-guard-offset=offset -mfdpic
556 -mbranch-protection=none|standard|pac-ret[+leaf] [+bti]|bti[+pac-
557 ret[+leaf]]
558
559 AVR Options -mmcu=mcu -mabsdata -maccumulate-args
560 -mbranch-cost=cost -mcall-prologues -mgas-isr-prologues -mint8
561 -mdouble=bits -mlong-double=bits -mn_flash=size -mno-interrupts
562 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack
563 -mfract-convert-truncate -mshort-calls -nodevicelib
564 -nodevicespecs -Waddr-space-convert -Wmisspelled-isr
565
566 Blackfin Options -mcpu=cpu[-sirevision] -msim
567 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer
568 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly
569 -mno-csync-anomaly -mlow-64k -mno-low64k -mstack-check-l1
570 -mid-shared-library -mno-id-shared-library -mshared-library-id=n
571 -mleaf-id-shared-library -mno-leaf-id-shared-library -msep-data
572 -mno-sep-data -mlong-calls -mno-long-calls -mfast-fp
573 -minline-plt -mmulticore -mcorea -mcoreb -msdram -micplb
574
575 C6X Options -mbig-endian -mlittle-endian -march=cpu -msim
576 -msdata=sdata-type
577
578 CRIS Options -mcpu=cpu -march=cpu -mtune=cpu -mmax-stack-frame=n
579 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects
580 -mstack-align -mdata-align -mconst-align -m32-bit -m16-bit
581 -m8-bit -mno-prologue-epilogue -melf -maout -sim -sim2
582 -mmul-bug-workaround -mno-mul-bug-workaround
583
584 C-SKY Options -march=arch -mcpu=cpu -mbig-endian -EB
585 -mlittle-endian -EL -mhard-float -msoft-float -mfpu=fpu
586 -mdouble-float -mfdivdu -mfloat-abi=name -melrw -mistack -mmp
587 -mcp -mcache -msecurity -mtrust -mdsp -medsp -mvdsp -mdiv
588 -msmart -mhigh-registers -manchor -mpushpop -mmultiple-stld
589 -mconstpool -mstack-size -mccrt -mbranch-cost=n -mcse-cc
590 -msched-prolog -msim
591
592 Darwin Options -all_load -allowable_client -arch
593 -arch_errors_fatal -arch_only -bind_at_load -bundle
594 -bundle_loader -client_name -compatibility_version
595 -current_version -dead_strip -dependency-file -dylib_file
596 -dylinker_install_name -dynamic -dynamiclib
597 -exported_symbols_list -filelist -flat_namespace
598 -force_cpusubtype_ALL -force_flat_namespace
599 -headerpad_max_install_names -iframework -image_base -init
600 -install_name -keep_private_externs -multi_module
601 -multiply_defined -multiply_defined_unused -noall_load
602 -no_dead_strip_inits_and_terms -nofixprebinding -nomultidefs
603 -noprebind -noseglinkedit -pagezero_size -prebind
604 -prebind_all_twolevel_modules -private_bundle -read_only_relocs
605 -sectalign -sectobjectsymbols -whyload -seg1addr -sectcreate
606 -sectobjectsymbols -sectorder -segaddr -segs_read_only_addr
607 -segs_read_write_addr -seg_addr_table -seg_addr_table_filename
608 -seglinkedit -segprot -segs_read_only_addr -segs_read_write_addr
609 -single_module -static -sub_library -sub_umbrella
610 -twolevel_namespace -umbrella -undefined -unexported_symbols_list
611 -weak_reference_mismatches -whatsloaded -F -gused -gfull
612 -mmacosx-version-min=version -mkernel -mone-byte-bool
613
614 DEC Alpha Options -mno-fp-regs -msoft-float -mieee
615 -mieee-with-inexact -mieee-conformant -mfp-trap-mode=mode
616 -mfp-rounding-mode=mode -mtrap-precision=mode -mbuild-constants
617 -mcpu=cpu-type -mtune=cpu-type -mbwx -mmax -mfix -mcix
618 -mfloat-vax -mfloat-ieee -mexplicit-relocs -msmall-data
619 -mlarge-data -msmall-text -mlarge-text -mmemory-latency=time
620
621 eBPF Options -mbig-endian -mlittle-endian -mkernel=version
622 -mframe-limit=bytes -mxbpf -mco-re -mno-co-re -mjmpext -mjmp32
623 -malu32 -mcpu=version
624
625 FR30 Options -msmall-model -mno-lsim
626
627 FT32 Options -msim -mlra -mnodiv -mft32b -mcompress -mnopm
628
629 FRV Options -mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 -mhard-float
630 -msoft-float -malloc-cc -mfixed-cc -mdword -mno-dword -mdouble
631 -mno-double -mmedia -mno-media -mmuladd -mno-muladd -mfdpic
632 -minline-plt -mgprel-ro -multilib-library-pic -mlinked-fp
633 -mlong-calls -malign-labels -mlibrary-pic -macc-4 -macc-8 -mpack
634 -mno-pack -mno-eflags -mcond-move -mno-cond-move
635 -moptimize-membar -mno-optimize-membar -mscc -mno-scc
636 -mcond-exec -mno-cond-exec -mvliw-branch -mno-vliw-branch
637 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec
638 -mno-nested-cond-exec -mtomcat-stats -mTLS -mtls -mcpu=cpu
639
640 GNU/Linux Options -mglibc -muclibc -mmusl -mbionic -mandroid
641 -tno-android-cc -tno-android-ld
642
643 H8/300 Options -mrelax -mh -ms -mn -mexr -mno-exr -mint32
644 -malign-300
645
646 HPPA Options -march=architecture-type -matomic-libcalls
647 -mbig-switch -mcaller-copies -mdisable-fpregs -mdisable-indexing
648 -mordered -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld
649 -mfixed-range=register-range -mcoherent-ldcw -mjump-in-delay
650 -mlinker-opt -mlong-calls -mlong-load-store -mno-atomic-libcalls
651 -mno-disable-fpregs -mno-disable-indexing -mno-fast-indirect-calls
652 -mno-gas -mno-jump-in-delay -mno-long-load-store
653 -mno-portable-runtime -mno-soft-float -mno-space-regs
654 -msoft-float -mpa-risc-1-0 -mpa-risc-1-1 -mpa-risc-2-0
655 -mportable-runtime -mschedule=cpu-type -mspace-regs -msoft-mult
656 -msio -mwsio -munix=unix-std -nolibdld -static -threads
657
658 IA-64 Options -mbig-endian -mlittle-endian -mgnu-as -mgnu-ld
659 -mno-pic -mvolatile-asm-stop -mregister-names -msdata -mno-sdata
660 -mconstant-gp -mauto-pic -mfused-madd
661 -minline-float-divide-min-latency
662 -minline-float-divide-max-throughput -mno-inline-float-divide
663 -minline-int-divide-min-latency -minline-int-divide-max-throughput
664 -mno-inline-int-divide -minline-sqrt-min-latency
665 -minline-sqrt-max-throughput -mno-inline-sqrt -mdwarf2-asm
666 -mearly-stop-bits -mfixed-range=register-range -mtls-size=tls-size
667 -mtune=cpu-type -milp32 -mlp64 -msched-br-data-spec
668 -msched-ar-data-spec -msched-control-spec -msched-br-in-data-spec
669 -msched-ar-in-data-spec -msched-in-control-spec -msched-spec-ldc
670 -msched-spec-control-ldc -msched-prefer-non-data-spec-insns
671 -msched-prefer-non-control-spec-insns
672 -msched-stop-bits-after-every-cycle
673 -msched-count-spec-in-critical-path
674 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost
675 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=max-
676 insns
677
678 LM32 Options -mbarrel-shift-enabled -mdivide-enabled
679 -mmultiply-enabled -msign-extend-enabled -muser-enabled
680
681 LoongArch Options -march=cpu-type -mtune=cpu-type -mabi=base-abi-
682 type -mfpu=fpu-type -msoft-float -msingle-float -mdouble-float
683 -mbranch-cost=n -mcheck-zero-division -mno-check-zero-division
684 -mcond-move-int -mno-cond-move-int -mcond-move-float
685 -mno-cond-move-float -memcpy -mno-memcpy -mstrict-align
686 -mno-strict-align -mmax-inline-memcpy-size=n -mexplicit-relocs
687 -mno-explicit-relocs -mdirect-extern-access
688 -mno-direct-extern-access -mcmodel=code-model
689
690 M32R/D Options -m32r2 -m32rx -m32r -mdebug -malign-loops
691 -mno-align-loops -missue-rate=number -mbranch-cost=number
692 -mmodel=code-size-model-type -msdata=sdata-type -mno-flush-func
693 -mflush-func=name -mno-flush-trap -mflush-trap=number -G num
694
695 M32C Options -mcpu=cpu -msim -memregs=number
696
697 M680x0 Options -march=arch -mcpu=cpu -mtune=tune -m68000 -m68020
698 -m68020-40 -m68020-60 -m68030 -m68040 -m68060 -mcpu32 -m5200
699 -m5206e -m528x -m5307 -m5407 -mcfv4e -mbitfield -mno-bitfield
700 -mc68000 -mc68020 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div
701 -mshort -mno-short -mhard-float -m68881 -msoft-float -mpcrel
702 -malign-int -mstrict-align -msep-data -mno-sep-data
703 -mshared-library-id=n -mid-shared-library -mno-id-shared-library
704 -mxgot -mno-xgot -mlong-jump-table-offsets
705
706 MCore Options -mhardlit -mno-hardlit -mdiv -mno-div
707 -mrelax-immediates -mno-relax-immediates -mwide-bitfields
708 -mno-wide-bitfields -m4byte-functions -mno-4byte-functions
709 -mcallgraph-data -mno-callgraph-data -mslow-bytes -mno-slow-bytes
710 -mno-lsim -mlittle-endian -mbig-endian -m210 -m340
711 -mstack-increment
712
713 MicroBlaze Options -msoft-float -mhard-float -msmall-divides
714 -mcpu=cpu -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift
715 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss
716 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt
717 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-app-model
718 -mpic-data-is-text-relative
719
720 MIPS Options -EL -EB -march=arch -mtune=arch -mips1 -mips2
721 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 -mips32r6
722 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 -mips16
723 -mno-mips16 -mflip-mips16 -minterlink-compressed
724 -mno-interlink-compressed -minterlink-mips16 -mno-interlink-mips16
725 -mabi=abi -mabicalls -mno-abicalls -mshared -mno-shared -mplt
726 -mno-plt -mxgot -mno-xgot -mgp32 -mgp64 -mfp32 -mfpxx -mfp64
727 -mhard-float -msoft-float -mno-float -msingle-float
728 -mdouble-float -modd-spreg -mno-odd-spreg -mabs=mode
729 -mnan=encoding -mdsp -mno-dsp -mdspr2 -mno-dspr2 -mmcu
730 -mmno-mcu -meva -mno-eva -mvirt -mno-virt -mxpa -mno-xpa -mcrc
731 -mno-crc -mginv -mno-ginv -mmicromips -mno-micromips -mmsa
732 -mno-msa -mloongson-mmi -mno-loongson-mmi -mloongson-ext
733 -mno-loongson-ext -mloongson-ext2 -mno-loongson-ext2 -mfpu=fpu-
734 type -msmartmips -mno-smartmips -mpaired-single
735 -mno-paired-single -mdmx -mno-mdmx -mips3d -mno-mips3d -mmt
736 -mno-mt -mllsc -mno-llsc -mlong64 -mlong32 -msym32 -mno-sym32
737 -Gnum -mlocal-sdata -mno-local-sdata -mextern-sdata
738 -mno-extern-sdata -mgpopt -mno-gopt -membedded-data
739 -mno-embedded-data -muninit-const-in-rodata
740 -mno-uninit-const-in-rodata -mcode-readable=setting
741 -msplit-addresses -mno-split-addresses -mexplicit-relocs
742 -mno-explicit-relocs -mcheck-zero-division
743 -mno-check-zero-division -mdivide-traps -mdivide-breaks
744 -mload-store-pairs -mno-load-store-pairs -munaligned-access
745 -mno-unaligned-access -mmemcpy -mno-memcpy -mlong-calls
746 -mno-long-calls -mmad -mno-mad -mimadd -mno-imadd -mfused-madd
747 -mno-fused-madd -nocpp -mfix-24k -mno-fix-24k -mfix-r4000
748 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 -mfix-r5900
749 -mno-fix-r5900 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000
750 -mno-fix-rm7000 -mfix-vr4120 -mno-fix-vr4120 -mfix-vr4130
751 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 -mflush-func=func
752 -mno-flush-func -mbranch-cost=num -mbranch-likely
753 -mno-branch-likely -mcompact-branches=policy -mfp-exceptions
754 -mno-fp-exceptions -mvr4130-align -mno-vr4130-align -msynci
755 -mno-synci -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4
756 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address
757 -mframe-header-opt -mno-frame-header-opt
758
759 MMIX Options -mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon
760 -mabi=gnu -mabi=mmixware -mzero-extend -mknuthdiv
761 -mtoplevel-symbols -melf -mbranch-predict -mno-branch-predict
762 -mbase-addresses -mno-base-addresses -msingle-exit
763 -mno-single-exit
764
765 MN10300 Options -mmult-bug -mno-mult-bug -mno-am33 -mam33
766 -mam33-2 -mam34 -mtune=cpu-type -mreturn-pointer-on-d0 -mno-crt0
767 -mrelax -mliw -msetlb
768
769 Moxie Options -meb -mel -mmul.x -mno-crt0
770
771 MSP430 Options -msim -masm-hex -mmcu= -mcpu= -mlarge -msmall
772 -mrelax -mwarn-mcu -mcode-region= -mdata-region= -msilicon-errata=
773 -msilicon-errata-warn= -mhwmult= -minrt -mtiny-printf
774 -mmax-inline-shift=
775
776 NDS32 Options -mbig-endian -mlittle-endian -mreduced-regs
777 -mfull-regs -mcmov -mno-cmov -mext-perf -mno-ext-perf -mext-perf2
778 -mno-ext-perf2 -mext-string -mno-ext-string -mv3push -mno-v3push
779 -m16bit -mno-16bit -misr-vector-size=num -mcache-block-size=num
780 -march=arch -mcmodel=code-model -mctor-dtor -mrelax
781
782 Nios II Options -G num -mgpopt=option -mgpopt -mno-gpopt
783 -mgprel-sec=regexp -mr0rel-sec=regexp -mel -meb -mno-bypass-cache
784 -mbypass-cache -mno-cache-volatile -mcache-volatile
785 -mno-fast-sw-div -mfast-sw-div -mhw-mul -mno-hw-mul -mhw-mulx
786 -mno-hw-mulx -mno-hw-div -mhw-div -mcustom-insn=N
787 -mno-custom-insn -mcustom-fpu-cfg=name -mhal -msmallc
788 -msys-crt0=name -msys-lib=name -march=arch -mbmx -mno-bmx -mcdx
789 -mno-cdx
790
791 Nvidia PTX Options -m64 -mmainkernel -moptimize
792
793 OpenRISC Options -mboard=name -mnewlib -mhard-mul -mhard-div
794 -msoft-mul -msoft-div -msoft-float -mhard-float -mdouble-float
795 -munordered-float -mcmov -mror -mrori -msext -msfimm -mshftimm
796 -mcmodel=code-model
797
798 PDP-11 Options -mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45
799 -m10 -mint32 -mno-int16 -mint16 -mno-int32 -msplit -munix-asm
800 -mdec-asm -mgnu-asm -mlra
801
802 PowerPC Options See RS/6000 and PowerPC Options.
803
804 PRU Options -mmcu=mcu -minrt -mno-relax -mloop -mabi=variant
805
806 RISC-V Options -mbranch-cost=N-instruction -mplt -mno-plt
807 -mabi=ABI-string -mfdiv -mno-fdiv -mdiv -mno-div -misa-spec=ISA-
808 spec-string -march=ISA-string -mtune=processor-string
809 -mpreferred-stack-boundary=num -msmall-data-limit=N-bytes
810 -msave-restore -mno-save-restore -mshorten-memrefs
811 -mno-shorten-memrefs -mstrict-align -mno-strict-align
812 -mcmodel=medlow -mcmodel=medany -mexplicit-relocs
813 -mno-explicit-relocs -mrelax -mno-relax -mriscv-attribute
814 -mno-riscv-attribute -malign-data=type -mbig-endian
815 -mlittle-endian -mstack-protector-guard=guard
816 -mstack-protector-guard-reg=reg
817 -mstack-protector-guard-offset=offset -mcsr-check -mno-csr-check
818 -minline-atomics -mno-inline-atomics
819
820 RL78 Options -msim -mmul=none -mmul=g13 -mmul=g14 -mallregs
821 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14
822 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts
823
824 RS/6000 and PowerPC Options -mcpu=cpu-type -mtune=cpu-type
825 -mcmodel=code-model -mpowerpc64 -maltivec -mno-altivec
826 -mpowerpc-gpopt -mno-powerpc-gpopt -mpowerpc-gfxopt
827 -mno-powerpc-gfxopt -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb
828 -mpopcntd -mno-popcntd -mfprnd -mno-fprnd -mcmpb -mno-cmpb
829 -mhard-dfp -mno-hard-dfp -mfull-toc -mminimal-toc
830 -mno-fp-in-toc -mno-sum-in-toc -m64 -m32 -mxl-compat
831 -mno-xl-compat -mpe -malign-power -malign-natural -msoft-float
832 -mhard-float -mmultiple -mno-multiple -mupdate -mno-update
833 -mavoid-indexed-addresses -mno-avoid-indexed-addresses
834 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align
835 -mstrict-align -mno-strict-align -mrelocatable -mno-relocatable
836 -mrelocatable-lib -mno-relocatable-lib -mtoc -mno-toc -mlittle
837 -mlittle-endian -mbig -mbig-endian -mdynamic-no-pic -mswdiv
838 -msingle-pic-base -mprioritize-restricted-insns=priority
839 -msched-costly-dep=dependence_type -minsert-sched-nops=scheme
840 -mcall-aixdesc -mcall-eabi -mcall-freebsd -mcall-linux
841 -mcall-netbsd -mcall-openbsd -mcall-sysv -mcall-sysv-eabi
842 -mcall-sysv-noeabi -mtraceback=traceback_type -maix-struct-return
843 -msvr4-struct-return -mabi=abi-type -msecure-plt -mbss-plt
844 -mlongcall -mno-longcall -mpltseq -mno-pltseq
845 -mblock-move-inline-limit=num -mblock-compare-inline-limit=num
846 -mblock-compare-inline-loop-limit=num -mno-block-ops-unaligned-vsx
847 -mstring-compare-inline-limit=num -misel -mno-isel -mvrsave
848 -mno-vrsave -mmulhw -mno-mulhw -mdlmzb -mno-dlmzb -mprototype
849 -mno-prototype -msim -mmvme -mads -myellowknife -memb -msdata
850 -msdata=opt -mreadonly-in-sdata -mvxworks -G num -mrecip
851 -mrecip=opt -mno-recip -mrecip-precision -mno-recip-precision
852 -mveclibabi=type -mfriz -mno-friz -mpointers-to-nested-functions
853 -mno-pointers-to-nested-functions -msave-toc-indirect
854 -mno-save-toc-indirect -mpower8-fusion -mno-mpower8-fusion
855 -mpower8-vector -mno-power8-vector -mcrypto -mno-crypto -mhtm
856 -mno-htm -mquad-memory -mno-quad-memory -mquad-memory-atomic
857 -mno-quad-memory-atomic -mcompat-align-parm -mno-compat-align-parm
858 -mfloat128 -mno-float128 -mfloat128-hardware
859 -mno-float128-hardware -mgnu-attribute -mno-gnu-attribute
860 -mstack-protector-guard=guard -mstack-protector-guard-reg=reg
861 -mstack-protector-guard-offset=offset -mprefixed -mno-prefixed
862 -mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect
863 -mprivileged -mno-privileged
864
865 RX Options -m64bit-doubles -m32bit-doubles -fpu -nofpu -mcpu=
866 -mbig-endian-data -mlittle-endian-data -msmall-data -msim
867 -mno-sim -mas100-syntax -mno-as100-syntax -mrelax
868 -mmax-constant-size= -mint-register= -mpid -mallow-string-insns
869 -mno-allow-string-insns -mjsr -mno-warn-multiple-fast-interrupts
870 -msave-acc-in-interrupts
871
872 S/390 and zSeries Options -mtune=cpu-type -march=cpu-type
873 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp
874 -mlong-double-64 -mlong-double-128 -mbackchain -mno-backchain
875 -mpacked-stack -mno-packed-stack -msmall-exec -mno-small-exec
876 -mmvcle -mno-mvcle -m64 -m31 -mdebug -mno-debug -mesa -mzarch
877 -mhtm -mvx -mzvector -mtpf-trace -mno-tpf-trace
878 -mtpf-trace-skip -mno-tpf-trace-skip -mfused-madd -mno-fused-madd
879 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard
880 -mhotpatch=halfwords,halfwords
881
882 SH Options -m1 -m2 -m2e -m2a-nofpu -m2a-single-only -m2a-single
883 -m2a -m3 -m3e -m4-nofpu -m4-single-only -m4-single -m4
884 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al -mb -ml
885 -mdalign -mrelax -mbigtable -mfmovd -mrenesas -mno-renesas
886 -mnomacsave -mieee -mno-ieee -mbitops -misize
887 -minline-ic_invalidate -mpadstruct -mprefergot -musermode
888 -multcost=number -mdiv=strategy -mdivsi3_libfunc=name
889 -mfixed-range=register-range -maccumulate-outgoing-args
890 -matomic-model=atomic-model -mbranch-cost=num -mzdcbranch
891 -mno-zdcbranch -mcbranch-force-delay-slot -mfused-madd
892 -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra
893 -mpretend-cmove -mtas
894
895 Solaris 2 Options -mclear-hwcap -mno-clear-hwcap -mimpure-text
896 -mno-impure-text -pthreads
897
898 SPARC Options -mcpu=cpu-type -mtune=cpu-type -mcmodel=code-model
899 -mmemory-model=mem-model -m32 -m64 -mapp-regs -mno-app-regs
900 -mfaster-structs -mno-faster-structs -mflat -mno-flat -mfpu
901 -mno-fpu -mhard-float -msoft-float -mhard-quad-float
902 -msoft-quad-float -mstack-bias -mno-stack-bias -mstd-struct-return
903 -mno-std-struct-return -munaligned-doubles -mno-unaligned-doubles
904 -muser-mode -mno-user-mode -mv8plus -mno-v8plus -mvis -mno-vis
905 -mvis2 -mno-vis2 -mvis3 -mno-vis3 -mvis4 -mno-vis4 -mvis4b
906 -mno-vis4b -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld
907 -mno-fsmuld -mpopc -mno-popc -msubxc -mno-subxc -mfix-at697f
908 -mfix-ut699 -mfix-ut700 -mfix-gr712rc -mlra -mno-lra
909
910 System V Options -Qy -Qn -YP,paths -Ym,dir
911
912 V850 Options -mlong-calls -mno-long-calls -mep -mno-ep
913 -mprolog-function -mno-prolog-function -mspace -mtda=n -msda=n
914 -mzda=n -mapp-regs -mno-app-regs -mdisable-callt
915 -mno-disable-callt -mv850e2v3 -mv850e2 -mv850e1 -mv850es -mv850e
916 -mv850 -mv850e3v5 -mloop -mrelax -mlong-jumps -msoft-float
917 -mhard-float -mgcc-abi -mrh850-abi -mbig-switch
918
919 VAX Options -mg -mgnu -munix -mlra
920
921 Visium Options -mdebug -msim -mfpu -mno-fpu -mhard-float
922 -msoft-float -mcpu=cpu-type -mtune=cpu-type -msv-mode
923 -muser-mode
924
925 VMS Options -mvms-return-codes -mdebug-main=prefix -mmalloc64
926 -mpointer-size=size
927
928 VxWorks Options -mrtp -non-static -Bstatic -Bdynamic -Xbind-lazy
929 -Xbind-now
930
931 x86 Options -mtune=cpu-type -march=cpu-type -mtune-ctrl=feature-
932 list -mdump-tune-features -mno-default -mfpmath=unit
933 -masm=dialect -mno-fancy-math-387 -mno-fp-ret-in-387 -m80387
934 -mhard-float -msoft-float -mno-wide-multiply -mrtd
935 -malign-double -mpreferred-stack-boundary=num
936 -mincoming-stack-boundary=num -mcld -mcx16 -msahf -mmovbe
937 -mcrc32 -mmwait -mrecip -mrecip=opt -mvzeroupper -mprefer-avx128
938 -mprefer-vector-width=opt -mmove-max=bits -mstore-max=bits -mmmx
939 -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx
940 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl
941 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes
942 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd
943 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves
944 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4
945 -mxop -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm
946 -mhle -mlwp -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes
947 -mwaitpkg -mshstk -mmanual-endbr -mcet-switch -mforce-indirect-call
948 -mavx512vbmi2 -mavx512bf16 -menqcmd -mvpclmulqdq -mavx512bitalg
949 -mmovdiri -mmovdir64b -mavx512vpopcntdq -mavx5124fmaps
950 -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid -mrdseed -msgx
951 -mavx512vp2intersect -mserialize -mtsxldtrk -mamx-tile -mamx-int8
952 -mamx-bf16 -muintr -mhreset -mavxvnni -mavx512fp16 -mavxifma
953 -mavxvnniint8 -mavxneconvert -mcmpccxadd -mamx-fp16 -mprefetchi
954 -mraoint -mamx-complex -mcldemote -mms-bitfields
955 -mno-align-stringops -minline-all-stringops
956 -minline-stringops-dynamically -mstringop-strategy=alg -mkl
957 -mwidekl -mmemcpy-strategy=strategy -mmemset-strategy=strategy
958 -mpush-args -maccumulate-outgoing-args -m128bit-long-double
959 -m96bit-long-double -mlong-double-64 -mlong-double-80
960 -mlong-double-128 -mregparm=num -msseregparm -mveclibabi=type
961 -mvect8-ret-in-mem -mpc32 -mpc64 -mpc80 -mdaz-ftz -mstackrealign
962 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs
963 -mcmodel=code-model -mabi=name -maddress-mode=mode -m32 -m64
964 -mx32 -m16 -miamcu -mlarge-data-threshold=num -msse2avx
965 -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv
966 -minstrument-return=type -mfentry-name=name -mfentry-section=name
967 -mavx256-split-unaligned-load -mavx256-split-unaligned-store
968 -malign-data=type -mstack-protector-guard=guard
969 -mstack-protector-guard-reg=reg
970 -mstack-protector-guard-offset=offset
971 -mstack-protector-guard-symbol=symbol -mgeneral-regs-only
972 -mcall-ms2sysv-xlogues -mrelax-cmpxchg-loop
973 -mindirect-branch=choice -mfunction-return=choice
974 -mindirect-branch-register -mharden-sls=choice
975 -mindirect-branch-cs-prefix -mneeded -mno-direct-extern-access
976 -munroll-only-small-loops -mlam=choice
977
978 x86 Windows Options -mconsole -mcygwin -mno-cygwin -mdll
979 -mnop-fun-dllimport -mthread -municode -mwin32 -mwindows
980 -fno-set-stack-executable
981
982 Xstormy16 Options -msim
983
984 Xtensa Options -mconst16 -mno-const16 -mfused-madd
985 -mno-fused-madd -mforce-no-pic -mserialize-volatile
986 -mno-serialize-volatile -mtext-section-literals
987 -mno-text-section-literals -mauto-litpools -mno-auto-litpools
988 -mtarget-align -mno-target-align -mlongcalls -mno-longcalls
989 -mabi=abi-type -mextra-l32r-costs=cycles
990
991 zSeries Options See S/390 and zSeries Options.
992
993 Options Controlling the Kind of Output
994 Compilation can involve up to four stages: preprocessing, compilation
995 proper, assembly and linking, always in that order. GCC is capable of
996 preprocessing and compiling several files either into several assembler
997 input files, or into one assembler input file; then each assembler
998 input file produces an object file, and linking combines all the object
999 files (those newly compiled, and those specified as input) into an
1000 executable file.
1001
1002 For any given input file, the file name suffix determines what kind of
1003 compilation is done:
1004
1005 file.c
1006 C source code that must be preprocessed.
1007
1008 file.i
1009 C source code that should not be preprocessed.
1010
1011 file.ii
1012 C++ source code that should not be preprocessed.
1013
1014 file.m
1015 Objective-C source code. Note that you must link with the libobjc
1016 library to make an Objective-C program work.
1017
1018 file.mi
1019 Objective-C source code that should not be preprocessed.
1020
1021 file.mm
1022 file.M
1023 Objective-C++ source code. Note that you must link with the
1024 libobjc library to make an Objective-C++ program work. Note that
1025 .M refers to a literal capital M.
1026
1027 file.mii
1028 Objective-C++ source code that should not be preprocessed.
1029
1030 file.h
1031 C, C++, Objective-C or Objective-C++ header file to be turned into
1032 a precompiled header (default), or C, C++ header file to be turned
1033 into an Ada spec (via the -fdump-ada-spec switch).
1034
1035 file.cc
1036 file.cp
1037 file.cxx
1038 file.cpp
1039 file.CPP
1040 file.c++
1041 file.C
1042 C++ source code that must be preprocessed. Note that in .cxx, the
1043 last two letters must both be literally x. Likewise, .C refers to
1044 a literal capital C.
1045
1046 file.mm
1047 file.M
1048 Objective-C++ source code that must be preprocessed.
1049
1050 file.mii
1051 Objective-C++ source code that should not be preprocessed.
1052
1053 file.hh
1054 file.H
1055 file.hp
1056 file.hxx
1057 file.hpp
1058 file.HPP
1059 file.h++
1060 file.tcc
1061 C++ header file to be turned into a precompiled header or Ada spec.
1062
1063 file.f
1064 file.for
1065 file.ftn
1066 Fixed form Fortran source code that should not be preprocessed.
1067
1068 file.F
1069 file.FOR
1070 file.fpp
1071 file.FPP
1072 file.FTN
1073 Fixed form Fortran source code that must be preprocessed (with the
1074 traditional preprocessor).
1075
1076 file.f90
1077 file.f95
1078 file.f03
1079 file.f08
1080 Free form Fortran source code that should not be preprocessed.
1081
1082 file.F90
1083 file.F95
1084 file.F03
1085 file.F08
1086 Free form Fortran source code that must be preprocessed (with the
1087 traditional preprocessor).
1088
1089 file.go
1090 Go source code.
1091
1092 file.d
1093 D source code.
1094
1095 file.di
1096 D interface file.
1097
1098 file.dd
1099 D documentation code (Ddoc).
1100
1101 file.ads
1102 Ada source code file that contains a library unit declaration (a
1103 declaration of a package, subprogram, or generic, or a generic
1104 instantiation), or a library unit renaming declaration (a package,
1105 generic, or subprogram renaming declaration). Such files are also
1106 called specs.
1107
1108 file.adb
1109 Ada source code file containing a library unit body (a subprogram
1110 or package body). Such files are also called bodies.
1111
1112 file.s
1113 Assembler code.
1114
1115 file.S
1116 file.sx
1117 Assembler code that must be preprocessed.
1118
1119 other
1120 An object file to be fed straight into linking. Any file name with
1121 no recognized suffix is treated this way.
1122
1123 You can specify the input language explicitly with the -x option:
1124
1125 -x language
1126 Specify explicitly the language for the following input files
1127 (rather than letting the compiler choose a default based on the
1128 file name suffix). This option applies to all following input
1129 files until the next -x option. Possible values for language are:
1130
1131 c c-header cpp-output
1132 c++ c++-header c++-system-header c++-user-header c++-cpp-output
1133 objective-c objective-c-header objective-c-cpp-output
1134 objective-c++ objective-c++-header objective-c++-cpp-output
1135 assembler assembler-with-cpp
1136 ada
1137 d
1138 f77 f77-cpp-input f95 f95-cpp-input
1139 go
1140
1141 -x none
1142 Turn off any specification of a language, so that subsequent files
1143 are handled according to their file name suffixes (as they are if
1144 -x has not been used at all).
1145
1146 If you only want some of the stages of compilation, you can use -x (or
1147 filename suffixes) to tell gcc where to start, and one of the options
1148 -c, -S, or -E to say where gcc is to stop. Note that some combinations
1149 (for example, -x cpp-output -E) instruct gcc to do nothing at all.
1150
1151 -c Compile or assemble the source files, but do not link. The linking
1152 stage simply is not done. The ultimate output is in the form of an
1153 object file for each source file.
1154
1155 By default, the object file name for a source file is made by
1156 replacing the suffix .c, .i, .s, etc., with .o.
1157
1158 Unrecognized input files, not requiring compilation or assembly,
1159 are ignored.
1160
1161 -S Stop after the stage of compilation proper; do not assemble. The
1162 output is in the form of an assembler code file for each non-
1163 assembler input file specified.
1164
1165 By default, the assembler file name for a source file is made by
1166 replacing the suffix .c, .i, etc., with .s.
1167
1168 Input files that don't require compilation are ignored.
1169
1170 -E Stop after the preprocessing stage; do not run the compiler proper.
1171 The output is in the form of preprocessed source code, which is
1172 sent to the standard output.
1173
1174 Input files that don't require preprocessing are ignored.
1175
1176 -o file
1177 Place the primary output in file file. This applies to whatever
1178 sort of output is being produced, whether it be an executable file,
1179 an object file, an assembler file or preprocessed C code.
1180
1181 If -o is not specified, the default is to put an executable file in
1182 a.out, the object file for source.suffix in source.o, its assembler
1183 file in source.s, a precompiled header file in source.suffix.gch,
1184 and all preprocessed C source on standard output.
1185
1186 Though -o names only the primary output, it also affects the naming
1187 of auxiliary and dump outputs. See the examples below. Unless
1188 overridden, both auxiliary outputs and dump outputs are placed in
1189 the same directory as the primary output. In auxiliary outputs,
1190 the suffix of the input file is replaced with that of the auxiliary
1191 output file type; in dump outputs, the suffix of the dump file is
1192 appended to the input file suffix. In compilation commands, the
1193 base name of both auxiliary and dump outputs is that of the primary
1194 output; in compile and link commands, the primary output name,
1195 minus the executable suffix, is combined with the input file name.
1196 If both share the same base name, disregarding the suffix, the
1197 result of the combination is that base name, otherwise, they are
1198 concatenated, separated by a dash.
1199
1200 gcc -c foo.c ...
1201
1202 will use foo.o as the primary output, and place aux outputs and
1203 dumps next to it, e.g., aux file foo.dwo for -gsplit-dwarf, and
1204 dump file foo.c.???r.final for -fdump-rtl-final.
1205
1206 If a non-linker output file is explicitly specified, aux and dump
1207 files by default take the same base name:
1208
1209 gcc -c foo.c -o dir/foobar.o ...
1210
1211 will name aux outputs dir/foobar.* and dump outputs dir/foobar.c.*.
1212
1213 A linker output will instead prefix aux and dump outputs:
1214
1215 gcc foo.c bar.c -o dir/foobar ...
1216
1217 will generally name aux outputs dir/foobar-foo.* and
1218 dir/foobar-bar.*, and dump outputs dir/foobar-foo.c.* and
1219 dir/foobar-bar.c.*.
1220
1221 The one exception to the above is when the executable shares the
1222 base name with the single input:
1223
1224 gcc foo.c -o dir/foo ...
1225
1226 in which case aux outputs are named dir/foo.* and dump outputs
1227 named dir/foo.c.*.
1228
1229 The location and the names of auxiliary and dump outputs can be
1230 adjusted by the options -dumpbase, -dumpbase-ext, -dumpdir,
1231 -save-temps=cwd, and -save-temps=obj.
1232
1233 -dumpbase dumpbase
1234 This option sets the base name for auxiliary and dump output files.
1235 It does not affect the name of the primary output file.
1236 Intermediate outputs, when preserved, are not regarded as primary
1237 outputs, but as auxiliary outputs:
1238
1239 gcc -save-temps -S foo.c
1240
1241 saves the (no longer) temporary preprocessed file in foo.i, and
1242 then compiles to the (implied) output file foo.s, whereas:
1243
1244 gcc -save-temps -dumpbase save-foo -c foo.c
1245
1246 preprocesses to in save-foo.i, compiles to save-foo.s (now an
1247 intermediate, thus auxiliary output), and then assembles to the
1248 (implied) output file foo.o.
1249
1250 Absent this option, dump and aux files take their names from the
1251 input file, or from the (non-linker) output file, if one is
1252 explicitly specified: dump output files (e.g. those requested by
1253 -fdump-* options) with the input name suffix, and aux output files
1254 (those requested by other non-dump options, e.g. "-save-temps",
1255 "-gsplit-dwarf", "-fcallgraph-info") without it.
1256
1257 Similar suffix differentiation of dump and aux outputs can be
1258 attained for explicitly-given -dumpbase basename.suf by also
1259 specifying -dumpbase-ext .suf.
1260
1261 If dumpbase is explicitly specified with any directory component,
1262 any dumppfx specification (e.g. -dumpdir or -save-temps=*) is
1263 ignored, and instead of appending to it, dumpbase fully overrides
1264 it:
1265
1266 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1267 -dumpdir pfx- -save-temps=cwd ...
1268
1269 creates auxiliary and dump outputs named alt/foo.*, disregarding
1270 dir/ in -o, the ./ prefix implied by -save-temps=cwd, and pfx- in
1271 -dumpdir.
1272
1273 When -dumpbase is specified in a command that compiles multiple
1274 inputs, or that compiles and then links, it may be combined with
1275 dumppfx, as specified under -dumpdir. Then, each input file is
1276 compiled using the combined dumppfx, and default values for
1277 dumpbase and auxdropsuf are computed for each input file:
1278
1279 gcc foo.c bar.c -c -dumpbase main ...
1280
1281 creates foo.o and bar.o as primary outputs, and avoids overwriting
1282 the auxiliary and dump outputs by using the dumpbase as a prefix,
1283 creating auxiliary and dump outputs named main-foo.* and
1284 main-bar.*.
1285
1286 An empty string specified as dumpbase avoids the influence of the
1287 output basename in the naming of auxiliary and dump outputs during
1288 compilation, computing default values :
1289
1290 gcc -c foo.c -o dir/foobar.o -dumpbase " ...
1291
1292 will name aux outputs dir/foo.* and dump outputs dir/foo.c.*. Note
1293 how their basenames are taken from the input name, but the
1294 directory still defaults to that of the output.
1295
1296 The empty-string dumpbase does not prevent the use of the output
1297 basename for outputs during linking:
1298
1299 gcc foo.c bar.c -o dir/foobar -dumpbase " -flto ...
1300
1301 The compilation of the source files will name auxiliary outputs
1302 dir/foo.* and dir/bar.*, and dump outputs dir/foo.c.* and
1303 dir/bar.c.*. LTO recompilation during linking will use dir/foobar.
1304 as the prefix for dumps and auxiliary files.
1305
1306 -dumpbase-ext auxdropsuf
1307 When forming the name of an auxiliary (but not a dump) output file,
1308 drop trailing auxdropsuf from dumpbase before appending any
1309 suffixes. If not specified, this option defaults to the suffix of
1310 a default dumpbase, i.e., the suffix of the input file when
1311 -dumpbase is not present in the command line, or dumpbase is
1312 combined with dumppfx.
1313
1314 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1315
1316 creates dir/foo.o as the main output, and generates auxiliary
1317 outputs in dir/x-foo.*, taking the location of the primary output,
1318 and dropping the .c suffix from the dumpbase. Dump outputs retain
1319 the suffix: dir/x-foo.c.*.
1320
1321 This option is disregarded if it does not match the suffix of a
1322 specified dumpbase, except as an alternative to the executable
1323 suffix when appending the linker output base name to dumppfx, as
1324 specified below:
1325
1326 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1327
1328 creates main.out as the primary output, and avoids overwriting the
1329 auxiliary and dump outputs by using the executable name minus
1330 auxdropsuf as a prefix, creating auxiliary outputs named main-foo.*
1331 and main-bar.* and dump outputs named main-foo.c.* and
1332 main-bar.c.*.
1333
1334 -dumpdir dumppfx
1335 When forming the name of an auxiliary or dump output file, use
1336 dumppfx as a prefix:
1337
1338 gcc -dumpdir pfx- -c foo.c ...
1339
1340 creates foo.o as the primary output, and auxiliary outputs named
1341 pfx-foo.*, combining the given dumppfx with the default dumpbase
1342 derived from the default primary output, derived in turn from the
1343 input name. Dump outputs also take the input name suffix:
1344 pfx-foo.c.*.
1345
1346 If dumppfx is to be used as a directory name, it must end with a
1347 directory separator:
1348
1349 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1350
1351 creates obj/bar.o as the primary output, and auxiliary outputs
1352 named dir/bar.*, combining the given dumppfx with the default
1353 dumpbase derived from the primary output name. Dump outputs also
1354 take the input name suffix: dir/bar.c.*.
1355
1356 It defaults to the location of the output file, unless the output
1357 file is a special file like "/dev/null". Options -save-temps=cwd
1358 and -save-temps=obj override this default, just like an explicit
1359 -dumpdir option. In case multiple such options are given, the last
1360 one prevails:
1361
1362 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1363
1364 outputs foo.o, with auxiliary outputs named foo.* because
1365 -save-temps=* overrides the dumppfx given by the earlier -dumpdir
1366 option. It does not matter that =obj is the default for
1367 -save-temps, nor that the output directory is implicitly the
1368 current directory. Dump outputs are named foo.c.*.
1369
1370 When compiling from multiple input files, if -dumpbase is
1371 specified, dumpbase, minus a auxdropsuf suffix, and a dash are
1372 appended to (or override, if containing any directory components)
1373 an explicit or defaulted dumppfx, so that each of the multiple
1374 compilations gets differently-named aux and dump outputs.
1375
1376 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1377
1378 outputs auxiliary dumps to dir/pfx-main-foo.* and
1379 dir/pfx-main-bar.*, appending dumpbase- to dumppfx. Dump outputs
1380 retain the input file suffix: dir/pfx-main-foo.c.* and
1381 dir/pfx-main-bar.c.*, respectively. Contrast with the single-input
1382 compilation:
1383
1384 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1385
1386 that, applying -dumpbase to a single source, does not compute and
1387 append a separate dumpbase per input file. Its auxiliary and dump
1388 outputs go in dir/pfx-main.*.
1389
1390 When compiling and then linking from multiple input files, a
1391 defaulted or explicitly specified dumppfx also undergoes the
1392 dumpbase- transformation above (e.g. the compilation of foo.c and
1393 bar.c above, but without -c). If neither -dumpdir nor -dumpbase
1394 are given, the linker output base name, minus auxdropsuf, if
1395 specified, or the executable suffix otherwise, plus a dash is
1396 appended to the default dumppfx instead. Note, however, that
1397 unlike earlier cases of linking:
1398
1399 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1400
1401 does not append the output name main to dumppfx, because -dumpdir
1402 is explicitly specified. The goal is that the explicitly-specified
1403 dumppfx may contain the specified output name as part of the
1404 prefix, if desired; only an explicitly-specified -dumpbase would be
1405 combined with it, in order to avoid simply discarding a meaningful
1406 option.
1407
1408 When compiling and then linking from a single input file, the
1409 linker output base name will only be appended to the default
1410 dumppfx as above if it does not share the base name with the single
1411 input file name. This has been covered in single-input linking
1412 cases above, but not with an explicit -dumpdir that inhibits the
1413 combination, even if overridden by -save-temps=*:
1414
1415 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
1416
1417 Auxiliary outputs are named foo.*, and dump outputs foo.c.*, in the
1418 current working directory as ultimately requested by
1419 -save-temps=cwd.
1420
1421 Summing it all up for an intuitive though slightly imprecise data
1422 flow: the primary output name is broken into a directory part and a
1423 basename part; dumppfx is set to the former, unless overridden by
1424 -dumpdir or -save-temps=*, and dumpbase is set to the latter,
1425 unless overriden by -dumpbase. If there are multiple inputs or
1426 linking, this dumpbase may be combined with dumppfx and taken from
1427 each input file. Auxiliary output names for each input are formed
1428 by combining dumppfx, dumpbase minus suffix, and the auxiliary
1429 output suffix; dump output names are only different in that the
1430 suffix from dumpbase is retained.
1431
1432 When it comes to auxiliary and dump outputs created during LTO
1433 recompilation, a combination of dumppfx and dumpbase, as given or
1434 as derived from the linker output name but not from inputs, even in
1435 cases in which this combination would not otherwise be used as
1436 such, is passed down with a trailing period replacing the compiler-
1437 added dash, if any, as a -dumpdir option to lto-wrapper; being
1438 involved in linking, this program does not normally get any
1439 -dumpbase and -dumpbase-ext, and it ignores them.
1440
1441 When running sub-compilers, lto-wrapper appends LTO stage names to
1442 the received dumppfx, ensures it contains a directory component so
1443 that it overrides any -dumpdir, and passes that as -dumpbase to
1444 sub-compilers.
1445
1446 -v Print (on standard error output) the commands executed to run the
1447 stages of compilation. Also print the version number of the
1448 compiler driver program and of the preprocessor and the compiler
1449 proper.
1450
1451 -###
1452 Like -v except the commands are not executed and arguments are
1453 quoted unless they contain only alphanumeric characters or "./-_".
1454 This is useful for shell scripts to capture the driver-generated
1455 command lines.
1456
1457 --help
1458 Print (on the standard output) a description of the command-line
1459 options understood by gcc. If the -v option is also specified then
1460 --help is also passed on to the various processes invoked by gcc,
1461 so that they can display the command-line options they accept. If
1462 the -Wextra option has also been specified (prior to the --help
1463 option), then command-line options that have no documentation
1464 associated with them are also displayed.
1465
1466 --target-help
1467 Print (on the standard output) a description of target-specific
1468 command-line options for each tool. For some targets extra target-
1469 specific information may also be printed.
1470
1471 --help={class|[^]qualifier}[,...]
1472 Print (on the standard output) a description of the command-line
1473 options understood by the compiler that fit into all specified
1474 classes and qualifiers. These are the supported classes:
1475
1476 optimizers
1477 Display all of the optimization options supported by the
1478 compiler.
1479
1480 warnings
1481 Display all of the options controlling warning messages
1482 produced by the compiler.
1483
1484 target
1485 Display target-specific options. Unlike the --target-help
1486 option however, target-specific options of the linker and
1487 assembler are not displayed. This is because those tools do
1488 not currently support the extended --help= syntax.
1489
1490 params
1491 Display the values recognized by the --param option.
1492
1493 language
1494 Display the options supported for language, where language is
1495 the name of one of the languages supported in this version of
1496 GCC. If an option is supported by all languages, one needs to
1497 select common class.
1498
1499 common
1500 Display the options that are common to all languages.
1501
1502 These are the supported qualifiers:
1503
1504 undocumented
1505 Display only those options that are undocumented.
1506
1507 joined
1508 Display options taking an argument that appears after an equal
1509 sign in the same continuous piece of text, such as:
1510 --help=target.
1511
1512 separate
1513 Display options taking an argument that appears as a separate
1514 word following the original option, such as: -o output-file.
1515
1516 Thus for example to display all the undocumented target-specific
1517 switches supported by the compiler, use:
1518
1519 --help=target,undocumented
1520
1521 The sense of a qualifier can be inverted by prefixing it with the ^
1522 character, so for example to display all binary warning options
1523 (i.e., ones that are either on or off and that do not take an
1524 argument) that have a description, use:
1525
1526 --help=warnings,^joined,^undocumented
1527
1528 The argument to --help= should not consist solely of inverted
1529 qualifiers.
1530
1531 Combining several classes is possible, although this usually
1532 restricts the output so much that there is nothing to display. One
1533 case where it does work, however, is when one of the classes is
1534 target. For example, to display all the target-specific
1535 optimization options, use:
1536
1537 --help=target,optimizers
1538
1539 The --help= option can be repeated on the command line. Each
1540 successive use displays its requested class of options, skipping
1541 those that have already been displayed. If --help is also
1542 specified anywhere on the command line then this takes precedence
1543 over any --help= option.
1544
1545 If the -Q option appears on the command line before the --help=
1546 option, then the descriptive text displayed by --help= is changed.
1547 Instead of describing the displayed options, an indication is given
1548 as to whether the option is enabled, disabled or set to a specific
1549 value (assuming that the compiler knows this at the point where the
1550 --help= option is used).
1551
1552 Here is a truncated example from the ARM port of gcc:
1553
1554 % gcc -Q -mabi=2 --help=target -c
1555 The following options are target specific:
1556 -mabi= 2
1557 -mabort-on-noreturn [disabled]
1558 -mapcs [disabled]
1559
1560 The output is sensitive to the effects of previous command-line
1561 options, so for example it is possible to find out which
1562 optimizations are enabled at -O2 by using:
1563
1564 -Q -O2 --help=optimizers
1565
1566 Alternatively you can discover which binary optimizations are
1567 enabled by -O3 by using:
1568
1569 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1570 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1571 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1572
1573 --version
1574 Display the version number and copyrights of the invoked GCC.
1575
1576 -pass-exit-codes
1577 Normally the gcc program exits with the code of 1 if any phase of
1578 the compiler returns a non-success return code. If you specify
1579 -pass-exit-codes, the gcc program instead returns with the
1580 numerically highest error produced by any phase returning an error
1581 indication. The C, C++, and Fortran front ends return 4 if an
1582 internal compiler error is encountered.
1583
1584 -pipe
1585 Use pipes rather than temporary files for communication between the
1586 various stages of compilation. This fails to work on some systems
1587 where the assembler is unable to read from a pipe; but the GNU
1588 assembler has no trouble.
1589
1590 -specs=file
1591 Process file after the compiler reads in the standard specs file,
1592 in order to override the defaults which the gcc driver program uses
1593 when determining what switches to pass to cc1, cc1plus, as, ld,
1594 etc. More than one -specs=file can be specified on the command
1595 line, and they are processed in order, from left to right.
1596
1597 -wrapper
1598 Invoke all subcommands under a wrapper program. The name of the
1599 wrapper program and its parameters are passed as a comma separated
1600 list.
1601
1602 gcc -c t.c -wrapper gdb,--args
1603
1604 This invokes all subprograms of gcc under gdb --args, thus the
1605 invocation of cc1 is gdb --args cc1 ....
1606
1607 -ffile-prefix-map=old=new
1608 When compiling files residing in directory old, record any
1609 references to them in the result of the compilation as if the files
1610 resided in directory new instead. Specifying this option is
1611 equivalent to specifying all the individual -f*-prefix-map options.
1612 This can be used to make reproducible builds that are location
1613 independent. Directories referenced by directives are not affected
1614 by these options. See also -fmacro-prefix-map, -fdebug-prefix-map,
1615 -fprofile-prefix-map and -fcanon-prefix-map.
1616
1617 -fcanon-prefix-map
1618 For the -f*-prefix-map options normally comparison of old prefix
1619 against the filename that would be normally referenced in the
1620 result of the compilation is done using textual comparison of the
1621 prefixes, or ignoring character case for case insensitive
1622 filesystems and considering slashes and backslashes as equal on DOS
1623 based filesystems. The -fcanon-prefix-map causes such comparisons
1624 to be done on canonicalized paths of old and the referenced
1625 filename.
1626
1627 -fplugin=name.so
1628 Load the plugin code in file name.so, assumed to be a shared object
1629 to be dlopen'd by the compiler. The base name of the shared object
1630 file is used to identify the plugin for the purposes of argument
1631 parsing (See -fplugin-arg-name-key=value below). Each plugin
1632 should define the callback functions specified in the Plugins API.
1633
1634 -fplugin-arg-name-key=value
1635 Define an argument called key with a value of value for the plugin
1636 called name.
1637
1638 -fdump-ada-spec[-slim]
1639 For C and C++ source and include files, generate corresponding Ada
1640 specs.
1641
1642 -fada-spec-parent=unit
1643 In conjunction with -fdump-ada-spec[-slim] above, generate Ada
1644 specs as child units of parent unit.
1645
1646 -fdump-go-spec=file
1647 For input files in any language, generate corresponding Go
1648 declarations in file. This generates Go "const", "type", "var",
1649 and "func" declarations which may be a useful way to start writing
1650 a Go interface to code written in some other language.
1651
1652 @file
1653 Read command-line options from file. The options read are inserted
1654 in place of the original @file option. If file does not exist, or
1655 cannot be read, then the option will be treated literally, and not
1656 removed.
1657
1658 Options in file are separated by whitespace. A whitespace
1659 character may be included in an option by surrounding the entire
1660 option in either single or double quotes. Any character (including
1661 a backslash) may be included by prefixing the character to be
1662 included with a backslash. The file may itself contain additional
1663 @file options; any such options will be processed recursively.
1664
1665 Compiling C++ Programs
1666 C++ source files conventionally use one of the suffixes .C, .cc, .cpp,
1667 .CPP, .c++, .cp, or .cxx; C++ header files often use .hh, .hpp, .H, or
1668 (for shared template code) .tcc; and preprocessed C++ files use the
1669 suffix .ii. GCC recognizes files with these names and compiles them as
1670 C++ programs even if you call the compiler the same way as for
1671 compiling C programs (usually with the name gcc).
1672
1673 However, the use of gcc does not add the C++ library. g++ is a program
1674 that calls GCC and automatically specifies linking against the C++
1675 library. It treats .c, .h and .i files as C++ source files instead of
1676 C source files unless -x is used. This program is also useful when
1677 precompiling a C header file with a .h extension for use in C++
1678 compilations. On many systems, g++ is also installed with the name
1679 c++.
1680
1681 When you compile C++ programs, you may specify many of the same
1682 command-line options that you use for compiling programs in any
1683 language; or command-line options meaningful for C and related
1684 languages; or options that are meaningful only for C++ programs.
1685
1686 Options Controlling C Dialect
1687 The following options control the dialect of C (or languages derived
1688 from C, such as C++, Objective-C and Objective-C++) that the compiler
1689 accepts:
1690
1691 -ansi
1692 In C mode, this is equivalent to -std=c90. In C++ mode, it is
1693 equivalent to -std=c++98.
1694
1695 This turns off certain features of GCC that are incompatible with
1696 ISO C90 (when compiling C code), or of standard C++ (when compiling
1697 C++ code), such as the "asm" and "typeof" keywords, and predefined
1698 macros such as "unix" and "vax" that identify the type of system
1699 you are using. It also enables the undesirable and rarely used ISO
1700 trigraph feature. For the C compiler, it disables recognition of
1701 C++ style // comments as well as the "inline" keyword.
1702
1703 The alternate keywords "__asm__", "__extension__", "__inline__" and
1704 "__typeof__" continue to work despite -ansi. You would not want to
1705 use them in an ISO C program, of course, but it is useful to put
1706 them in header files that might be included in compilations done
1707 with -ansi. Alternate predefined macros such as "__unix__" and
1708 "__vax__" are also available, with or without -ansi.
1709
1710 The -ansi option does not cause non-ISO programs to be rejected
1711 gratuitously. For that, -Wpedantic is required in addition to
1712 -ansi.
1713
1714 The macro "__STRICT_ANSI__" is predefined when the -ansi option is
1715 used. Some header files may notice this macro and refrain from
1716 declaring certain functions or defining certain macros that the ISO
1717 standard doesn't call for; this is to avoid interfering with any
1718 programs that might use these names for other things.
1719
1720 Functions that are normally built in but do not have semantics
1721 defined by ISO C (such as "alloca" and "ffs") are not built-in
1722 functions when -ansi is used.
1723
1724 -std=
1725 Determine the language standard. This option is currently only
1726 supported when compiling C or C++.
1727
1728 The compiler can accept several base standards, such as c90 or
1729 c++98, and GNU dialects of those standards, such as gnu90 or
1730 gnu++98. When a base standard is specified, the compiler accepts
1731 all programs following that standard plus those using GNU
1732 extensions that do not contradict it. For example, -std=c90 turns
1733 off certain features of GCC that are incompatible with ISO C90,
1734 such as the "asm" and "typeof" keywords, but not other GNU
1735 extensions that do not have a meaning in ISO C90, such as omitting
1736 the middle term of a "?:" expression. On the other hand, when a GNU
1737 dialect of a standard is specified, all features supported by the
1738 compiler are enabled, even when those features change the meaning
1739 of the base standard. As a result, some strict-conforming programs
1740 may be rejected. The particular standard is used by -Wpedantic to
1741 identify which features are GNU extensions given that version of
1742 the standard. For example -std=gnu90 -Wpedantic warns about C++
1743 style // comments, while -std=gnu99 -Wpedantic does not.
1744
1745 A value for this option must be provided; possible values are
1746
1747 c90
1748 c89
1749 iso9899:1990
1750 Support all ISO C90 programs (certain GNU extensions that
1751 conflict with ISO C90 are disabled). Same as -ansi for C code.
1752
1753 iso9899:199409
1754 ISO C90 as modified in amendment 1.
1755
1756 c99
1757 c9x
1758 iso9899:1999
1759 iso9899:199x
1760 ISO C99. This standard is substantially completely supported,
1761 modulo bugs and floating-point issues (mainly but not entirely
1762 relating to optional C99 features from Annexes F and G). See
1763 <https://gcc.gnu.org/c99status.html> for more information. The
1764 names c9x and iso9899:199x are deprecated.
1765
1766 c11
1767 c1x
1768 iso9899:2011
1769 ISO C11, the 2011 revision of the ISO C standard. This
1770 standard is substantially completely supported, modulo bugs,
1771 floating-point issues (mainly but not entirely relating to
1772 optional C11 features from Annexes F and G) and the optional
1773 Annexes K (Bounds-checking interfaces) and L (Analyzability).
1774 The name c1x is deprecated.
1775
1776 c17
1777 c18
1778 iso9899:2017
1779 iso9899:2018
1780 ISO C17, the 2017 revision of the ISO C standard (published in
1781 2018). This standard is same as C11 except for corrections of
1782 defects (all of which are also applied with -std=c11) and a new
1783 value of "__STDC_VERSION__", and so is supported to the same
1784 extent as C11.
1785
1786 c2x The next version of the ISO C standard, still under
1787 development. The support for this version is experimental and
1788 incomplete.
1789
1790 gnu90
1791 gnu89
1792 GNU dialect of ISO C90 (including some C99 features).
1793
1794 gnu99
1795 gnu9x
1796 GNU dialect of ISO C99. The name gnu9x is deprecated.
1797
1798 gnu11
1799 gnu1x
1800 GNU dialect of ISO C11. The name gnu1x is deprecated.
1801
1802 gnu17
1803 gnu18
1804 GNU dialect of ISO C17. This is the default for C code.
1805
1806 gnu2x
1807 The next version of the ISO C standard, still under
1808 development, plus GNU extensions. The support for this version
1809 is experimental and incomplete.
1810
1811 c++98
1812 c++03
1813 The 1998 ISO C++ standard plus the 2003 technical corrigendum
1814 and some additional defect reports. Same as -ansi for C++ code.
1815
1816 gnu++98
1817 gnu++03
1818 GNU dialect of -std=c++98.
1819
1820 c++11
1821 c++0x
1822 The 2011 ISO C++ standard plus amendments. The name c++0x is
1823 deprecated.
1824
1825 gnu++11
1826 gnu++0x
1827 GNU dialect of -std=c++11. The name gnu++0x is deprecated.
1828
1829 c++14
1830 c++1y
1831 The 2014 ISO C++ standard plus amendments. The name c++1y is
1832 deprecated.
1833
1834 gnu++14
1835 gnu++1y
1836 GNU dialect of -std=c++14. The name gnu++1y is deprecated.
1837
1838 c++17
1839 c++1z
1840 The 2017 ISO C++ standard plus amendments. The name c++1z is
1841 deprecated.
1842
1843 gnu++17
1844 gnu++1z
1845 GNU dialect of -std=c++17. This is the default for C++ code.
1846 The name gnu++1z is deprecated.
1847
1848 c++20
1849 c++2a
1850 The 2020 ISO C++ standard plus amendments. Support is
1851 experimental, and could change in incompatible ways in future
1852 releases. The name c++2a is deprecated.
1853
1854 gnu++20
1855 gnu++2a
1856 GNU dialect of -std=c++20. Support is experimental, and could
1857 change in incompatible ways in future releases. The name
1858 gnu++2a is deprecated.
1859
1860 c++2b
1861 c++23
1862 The next revision of the ISO C++ standard, planned for 2023.
1863 Support is highly experimental, and will almost certainly
1864 change in incompatible ways in future releases.
1865
1866 gnu++2b
1867 gnu++23
1868 GNU dialect of -std=c++2b. Support is highly experimental, and
1869 will almost certainly change in incompatible ways in future
1870 releases.
1871
1872 -aux-info filename
1873 Output to the given filename prototyped declarations for all
1874 functions declared and/or defined in a translation unit, including
1875 those in header files. This option is silently ignored in any
1876 language other than C.
1877
1878 Besides declarations, the file indicates, in comments, the origin
1879 of each declaration (source file and line), whether the declaration
1880 was implicit, prototyped or unprototyped (I, N for new or O for
1881 old, respectively, in the first character after the line number and
1882 the colon), and whether it came from a declaration or a definition
1883 (C or F, respectively, in the following character). In the case of
1884 function definitions, a K&R-style list of arguments followed by
1885 their declarations is also provided, inside comments, after the
1886 declaration.
1887
1888 -fno-asm
1889 Do not recognize "asm", "inline" or "typeof" as a keyword, so that
1890 code can use these words as identifiers. You can use the keywords
1891 "__asm__", "__inline__" and "__typeof__" instead. In C, -ansi
1892 implies -fno-asm.
1893
1894 In C++, "inline" is a standard keyword and is not affected by this
1895 switch. You may want to use the -fno-gnu-keywords flag instead,
1896 which disables "typeof" but not "asm" and "inline". In C99 mode
1897 (-std=c99 or -std=gnu99), this switch only affects the "asm" and
1898 "typeof" keywords, since "inline" is a standard keyword in ISO C99.
1899 In C2X mode (-std=c2x or -std=gnu2x), this switch only affects the
1900 "asm" keyword, since "typeof" is a standard keyword in ISO C2X.
1901
1902 -fno-builtin
1903 -fno-builtin-function
1904 Don't recognize built-in functions that do not begin with
1905 __builtin_ as prefix.
1906
1907 GCC normally generates special code to handle certain built-in
1908 functions more efficiently; for instance, calls to "alloca" may
1909 become single instructions which adjust the stack directly, and
1910 calls to "memcpy" may become inline copy loops. The resulting code
1911 is often both smaller and faster, but since the function calls no
1912 longer appear as such, you cannot set a breakpoint on those calls,
1913 nor can you change the behavior of the functions by linking with a
1914 different library. In addition, when a function is recognized as a
1915 built-in function, GCC may use information about that function to
1916 warn about problems with calls to that function, or to generate
1917 more efficient code, even if the resulting code still contains
1918 calls to that function. For example, warnings are given with
1919 -Wformat for bad calls to "printf" when "printf" is built in and
1920 "strlen" is known not to modify global memory.
1921
1922 With the -fno-builtin-function option only the built-in function
1923 function is disabled. function must not begin with __builtin_. If
1924 a function is named that is not built-in in this version of GCC,
1925 this option is ignored. There is no corresponding
1926 -fbuiltin-function option; if you wish to enable built-in functions
1927 selectively when using -fno-builtin or -ffreestanding, you may
1928 define macros such as:
1929
1930 #define abs(n) __builtin_abs ((n))
1931 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1932
1933 -fcond-mismatch
1934 Allow conditional expressions with mismatched types in the second
1935 and third arguments. The value of such an expression is void.
1936 This option is not supported for C++.
1937
1938 -ffreestanding
1939 Assert that compilation targets a freestanding environment. This
1940 implies -fno-builtin. A freestanding environment is one in which
1941 the standard library may not exist, and program startup may not
1942 necessarily be at "main". The most obvious example is an OS
1943 kernel. This is equivalent to -fno-hosted.
1944
1945 -fgimple
1946 Enable parsing of function definitions marked with "__GIMPLE".
1947 This is an experimental feature that allows unit testing of GIMPLE
1948 passes.
1949
1950 -fgnu-tm
1951 When the option -fgnu-tm is specified, the compiler generates code
1952 for the Linux variant of Intel's current Transactional Memory ABI
1953 specification document (Revision 1.1, May 6 2009). This is an
1954 experimental feature whose interface may change in future versions
1955 of GCC, as the official specification changes. Please note that
1956 not all architectures are supported for this feature.
1957
1958 For more information on GCC's support for transactional memory,
1959
1960 Note that the transactional memory feature is not supported with
1961 non-call exceptions (-fnon-call-exceptions).
1962
1963 -fgnu89-inline
1964 The option -fgnu89-inline tells GCC to use the traditional GNU
1965 semantics for "inline" functions when in C99 mode.
1966
1967 Using this option is roughly equivalent to adding the "gnu_inline"
1968 function attribute to all inline functions.
1969
1970 The option -fno-gnu89-inline explicitly tells GCC to use the C99
1971 semantics for "inline" when in C99 or gnu99 mode (i.e., it
1972 specifies the default behavior). This option is not supported in
1973 -std=c90 or -std=gnu90 mode.
1974
1975 The preprocessor macros "__GNUC_GNU_INLINE__" and
1976 "__GNUC_STDC_INLINE__" may be used to check which semantics are in
1977 effect for "inline" functions.
1978
1979 -fhosted
1980 Assert that compilation targets a hosted environment. This implies
1981 -fbuiltin. A hosted environment is one in which the entire
1982 standard library is available, and in which "main" has a return
1983 type of "int". Examples are nearly everything except a kernel.
1984 This is equivalent to -fno-freestanding.
1985
1986 -flax-vector-conversions
1987 Allow implicit conversions between vectors with differing numbers
1988 of elements and/or incompatible element types. This option should
1989 not be used for new code.
1990
1991 -fms-extensions
1992 Accept some non-standard constructs used in Microsoft header files.
1993
1994 In C++ code, this allows member names in structures to be similar
1995 to previous types declarations.
1996
1997 typedef int UOW;
1998 struct ABC {
1999 UOW UOW;
2000 };
2001
2002 Some cases of unnamed fields in structures and unions are only
2003 accepted with this option.
2004
2005 Note that this option is off for all targets except for x86 targets
2006 using ms-abi.
2007
2008 -foffload=disable
2009 -foffload=default
2010 -foffload=target-list
2011 Specify for which OpenMP and OpenACC offload targets code should be
2012 generated. The default behavior, equivalent to -foffload=default,
2013 is to generate code for all supported offload targets. The
2014 -foffload=disable form generates code only for the host fallback,
2015 while -foffload=target-list generates code only for the specified
2016 comma-separated list of offload targets.
2017
2018 Offload targets are specified in GCC's internal target-triplet
2019 format. You can run the compiler with -v to show the list of
2020 configured offload targets under "OFFLOAD_TARGET_NAMES".
2021
2022 -foffload-options=options
2023 -foffload-options=target-triplet-list=options
2024 With -foffload-options=options, GCC passes the specified options to
2025 the compilers for all enabled offloading targets. You can specify
2026 options that apply only to a specific target or targets by using
2027 the -foffload-options=target-list=options form. The target-list is
2028 a comma-separated list in the same format as for the -foffload=
2029 option.
2030
2031 Typical command lines are
2032
2033 -foffload-options=-lgfortran -foffload-options=-lm
2034 -foffload-options="-lgfortran -lm" -foffload-options=nvptx-none=-latomic
2035 -foffload-options=amdgcn-amdhsa=-march=gfx906 -foffload-options=-lm
2036
2037 -fopenacc
2038 Enable handling of OpenACC directives "#pragma acc" in C/C++ and
2039 "!$acc" in Fortran. When -fopenacc is specified, the compiler
2040 generates accelerated code according to the OpenACC Application
2041 Programming Interface v2.6 <https://www.openacc.org>. This option
2042 implies -pthread, and thus is only supported on targets that have
2043 support for -pthread.
2044
2045 -fopenacc-dim=geom
2046 Specify default compute dimensions for parallel offload regions
2047 that do not explicitly specify. The geom value is a triple of
2048 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A
2049 size can be omitted, to use a target-specific default value.
2050
2051 -fopenmp
2052 Enable handling of OpenMP directives "#pragma omp" in C/C++,
2053 "[[omp::directive(...)]]" and "[[omp::sequence(...)]]" in C++ and
2054 "!$omp" in Fortran. When -fopenmp is specified, the compiler
2055 generates parallel code according to the OpenMP Application Program
2056 Interface v4.5 <https://www.openmp.org>. This option implies
2057 -pthread, and thus is only supported on targets that have support
2058 for -pthread. -fopenmp implies -fopenmp-simd.
2059
2060 -fopenmp-simd
2061 Enable handling of OpenMP's "simd", "declare simd", "declare
2062 reduction", "assume", "ordered", "scan", "loop" directives and
2063 combined or composite directives with "simd" as constituent with
2064 "#pragma omp" in C/C++, "[[omp::directive(...)]]" and
2065 "[[omp::sequence(...)]]" in C++ and "!$omp" in Fortran. Other
2066 OpenMP directives are ignored.
2067
2068 -fopenmp-target-simd-clone
2069 -fopenmp-target-simd-clone=device-type
2070 In addition to generating SIMD clones for functions marked with the
2071 "declare simd" directive, GCC also generates clones for functions
2072 marked with the OpenMP "declare target" directive that are suitable
2073 for vectorization when this option is in effect. The device-type
2074 may be one of "none", "host", "nohost", and "any", which correspond
2075 to keywords for the "device_type" clause of the "declare target"
2076 directive; clones are generated for the intersection of devices
2077 specified. -fopenmp-target-simd-clone is equivalent to
2078 -fopenmp-target-simd-clone=any and -fno-openmp-target-simd-clone is
2079 equivalent to -fopenmp-target-simd-clone=none.
2080
2081 At -O2 and higher (but not -Os or -Og) this optimization defaults
2082 to -fopenmp-target-simd-clone=nohost; otherwise it is disabled by
2083 default.
2084
2085 -fpermitted-flt-eval-methods=style
2086 ISO/IEC TS 18661-3 defines new permissible values for
2087 "FLT_EVAL_METHOD" that indicate that operations and constants with
2088 a semantic type that is an interchange or extended format should be
2089 evaluated to the precision and range of that type. These new
2090 values are a superset of those permitted under C99/C11, which does
2091 not specify the meaning of other positive values of
2092 "FLT_EVAL_METHOD". As such, code conforming to C11 may not have
2093 been written expecting the possibility of the new values.
2094
2095 -fpermitted-flt-eval-methods specifies whether the compiler should
2096 allow only the values of "FLT_EVAL_METHOD" specified in C99/C11, or
2097 the extended set of values specified in ISO/IEC TS 18661-3.
2098
2099 style is either "c11" or "ts-18661-3" as appropriate.
2100
2101 The default when in a standards compliant mode (-std=c11 or
2102 similar) is -fpermitted-flt-eval-methods=c11. The default when in
2103 a GNU dialect (-std=gnu11 or similar) is
2104 -fpermitted-flt-eval-methods=ts-18661-3.
2105
2106 -fplan9-extensions
2107 Accept some non-standard constructs used in Plan 9 code.
2108
2109 This enables -fms-extensions, permits passing pointers to
2110 structures with anonymous fields to functions that expect pointers
2111 to elements of the type of the field, and permits referring to
2112 anonymous fields declared using a typedef. This is only
2113 supported for C, not C++.
2114
2115 -fsigned-bitfields
2116 -funsigned-bitfields
2117 -fno-signed-bitfields
2118 -fno-unsigned-bitfields
2119 These options control whether a bit-field is signed or unsigned,
2120 when the declaration does not use either "signed" or "unsigned".
2121 By default, such a bit-field is signed, because this is consistent:
2122 the basic integer types such as "int" are signed types.
2123
2124 -fsigned-char
2125 Let the type "char" be signed, like "signed char".
2126
2127 Note that this is equivalent to -fno-unsigned-char, which is the
2128 negative form of -funsigned-char. Likewise, the option
2129 -fno-signed-char is equivalent to -funsigned-char.
2130
2131 -funsigned-char
2132 Let the type "char" be unsigned, like "unsigned char".
2133
2134 Each kind of machine has a default for what "char" should be. It
2135 is either like "unsigned char" by default or like "signed char" by
2136 default.
2137
2138 Ideally, a portable program should always use "signed char" or
2139 "unsigned char" when it depends on the signedness of an object.
2140 But many programs have been written to use plain "char" and expect
2141 it to be signed, or expect it to be unsigned, depending on the
2142 machines they were written for. This option, and its inverse, let
2143 you make such a program work with the opposite default.
2144
2145 The type "char" is always a distinct type from each of "signed
2146 char" or "unsigned char", even though its behavior is always just
2147 like one of those two.
2148
2149 -fstrict-flex-arrays
2150 Control when to treat the trailing array of a structure as a
2151 flexible array member for the purpose of accessing the elements of
2152 such an array. The positive form is equivalent to
2153 -fstrict-flex-arrays=3, which is the strictest. A trailing array
2154 is treated as a flexible array member only when it is declared as a
2155 flexible array member per C99 standard onwards. The negative form
2156 is equivalent to -fstrict-flex-arrays=0, which is the least strict.
2157 All trailing arrays of structures are treated as flexible array
2158 members.
2159
2160 -fstrict-flex-arrays=level
2161 Control when to treat the trailing array of a structure as a
2162 flexible array member for the purpose of accessing the elements of
2163 such an array. The value of level controls the level of
2164 strictness.
2165
2166 The possible values of level are the same as for the
2167 "strict_flex_array" attribute.
2168
2169 You can control this behavior for a specific trailing array field
2170 of a structure by using the variable attribute "strict_flex_array"
2171 attribute.
2172
2173 -fsso-struct=endianness
2174 Set the default scalar storage order of structures and unions to
2175 the specified endianness. The accepted values are big-endian,
2176 little-endian and native for the native endianness of the target
2177 (the default). This option is not supported for C++.
2178
2179 Warning: the -fsso-struct switch causes GCC to generate code that
2180 is not binary compatible with code generated without it if the
2181 specified endianness is not the native endianness of the target.
2182
2183 Options Controlling C++ Dialect
2184 This section describes the command-line options that are only
2185 meaningful for C++ programs. You can also use most of the GNU compiler
2186 options regardless of what language your program is in. For example,
2187 you might compile a file firstClass.C like this:
2188
2189 g++ -g -fstrict-enums -O -c firstClass.C
2190
2191 In this example, only -fstrict-enums is an option meant only for C++
2192 programs; you can use the other options with any language supported by
2193 GCC.
2194
2195 Some options for compiling C programs, such as -std, are also relevant
2196 for C++ programs.
2197
2198 Here is a list of options that are only for compiling C++ programs:
2199
2200 -fabi-version=n
2201 Use version n of the C++ ABI. The default is version 0.
2202
2203 Version 0 refers to the version conforming most closely to the C++
2204 ABI specification. Therefore, the ABI obtained using version 0
2205 will change in different versions of G++ as ABI bugs are fixed.
2206
2207 Version 1 is the version of the C++ ABI that first appeared in G++
2208 3.2.
2209
2210 Version 2 is the version of the C++ ABI that first appeared in G++
2211 3.4, and was the default through G++ 4.9.
2212
2213 Version 3 corrects an error in mangling a constant address as a
2214 template argument.
2215
2216 Version 4, which first appeared in G++ 4.5, implements a standard
2217 mangling for vector types.
2218
2219 Version 5, which first appeared in G++ 4.6, corrects the mangling
2220 of attribute const/volatile on function pointer types, decltype of
2221 a plain decl, and use of a function parameter in the declaration of
2222 another parameter.
2223
2224 Version 6, which first appeared in G++ 4.7, corrects the promotion
2225 behavior of C++11 scoped enums and the mangling of template
2226 argument packs, const/static_cast, prefix ++ and --, and a class
2227 scope function used as a template argument.
2228
2229 Version 7, which first appeared in G++ 4.8, that treats nullptr_t
2230 as a builtin type and corrects the mangling of lambdas in default
2231 argument scope.
2232
2233 Version 8, which first appeared in G++ 4.9, corrects the
2234 substitution behavior of function types with function-cv-
2235 qualifiers.
2236
2237 Version 9, which first appeared in G++ 5.2, corrects the alignment
2238 of "nullptr_t".
2239
2240 Version 10, which first appeared in G++ 6.1, adds mangling of
2241 attributes that affect type identity, such as ia32 calling
2242 convention attributes (e.g. stdcall).
2243
2244 Version 11, which first appeared in G++ 7, corrects the mangling of
2245 sizeof... expressions and operator names. For multiple entities
2246 with the same name within a function, that are declared in
2247 different scopes, the mangling now changes starting with the
2248 twelfth occurrence. It also implies -fnew-inheriting-ctors.
2249
2250 Version 12, which first appeared in G++ 8, corrects the calling
2251 conventions for empty classes on the x86_64 target and for classes
2252 with only deleted copy/move constructors. It accidentally changes
2253 the calling convention for classes with a deleted copy constructor
2254 and a trivial move constructor.
2255
2256 Version 13, which first appeared in G++ 8.2, fixes the accidental
2257 change in version 12.
2258
2259 Version 14, which first appeared in G++ 10, corrects the mangling
2260 of the nullptr expression.
2261
2262 Version 15, which first appeared in G++ 10.3, corrects G++ 10 ABI
2263 tag regression.
2264
2265 Version 16, which first appeared in G++ 11, changes the mangling of
2266 "__alignof__" to be distinct from that of "alignof", and dependent
2267 operator names.
2268
2269 Version 17, which first appeared in G++ 12, fixes layout of classes
2270 that inherit from aggregate classes with default member
2271 initializers in C++14 and up.
2272
2273 Version 18, which first appeard in G++ 13, fixes manglings of
2274 lambdas that have additional context.
2275
2276 See also -Wabi.
2277
2278 -fabi-compat-version=n
2279 On targets that support strong aliases, G++ works around mangling
2280 changes by creating an alias with the correct mangled name when
2281 defining a symbol with an incorrect mangled name. This switch
2282 specifies which ABI version to use for the alias.
2283
2284 With -fabi-version=0 (the default), this defaults to 13 (GCC 8.2
2285 compatibility). If another ABI version is explicitly selected,
2286 this defaults to 0. For compatibility with GCC versions 3.2
2287 through 4.9, use -fabi-compat-version=2.
2288
2289 If this option is not provided but -Wabi=n is, that version is used
2290 for compatibility aliases. If this option is provided along with
2291 -Wabi (without the version), the version from this option is used
2292 for the warning.
2293
2294 -fno-access-control
2295 Turn off all access checking. This switch is mainly useful for
2296 working around bugs in the access control code.
2297
2298 -faligned-new
2299 Enable support for C++17 "new" of types that require more alignment
2300 than "void* ::operator new(std::size_t)" provides. A numeric
2301 argument such as "-faligned-new=32" can be used to specify how much
2302 alignment (in bytes) is provided by that function, but few users
2303 will need to override the default of alignof(std::max_align_t).
2304
2305 This flag is enabled by default for -std=c++17.
2306
2307 -fchar8_t
2308 -fno-char8_t
2309 Enable support for "char8_t" as adopted for C++20. This includes
2310 the addition of a new "char8_t" fundamental type, changes to the
2311 types of UTF-8 string and character literals, new signatures for
2312 user-defined literals, associated standard library updates, and new
2313 "__cpp_char8_t" and "__cpp_lib_char8_t" feature test macros.
2314
2315 This option enables functions to be overloaded for ordinary and
2316 UTF-8 strings:
2317
2318 int f(const char *); // #1
2319 int f(const char8_t *); // #2
2320 int v1 = f("text"); // Calls #1
2321 int v2 = f(u8"text"); // Calls #2
2322
2323 and introduces new signatures for user-defined literals:
2324
2325 int operator""_udl1(char8_t);
2326 int v3 = u8'x'_udl1;
2327 int operator""_udl2(const char8_t*, std::size_t);
2328 int v4 = u8"text"_udl2;
2329 template<typename T, T...> int operator""_udl3();
2330 int v5 = u8"text"_udl3;
2331
2332 The change to the types of UTF-8 string and character literals
2333 introduces incompatibilities with ISO C++11 and later standards.
2334 For example, the following code is well-formed under ISO C++11, but
2335 is ill-formed when -fchar8_t is specified.
2336
2337 const char *cp = u8"xx";// error: invalid conversion from
2338 // `const char8_t*' to `const char*'
2339 int f(const char*);
2340 auto v = f(u8"xx"); // error: invalid conversion from
2341 // `const char8_t*' to `const char*'
2342 std::string s{u8"xx"}; // error: no matching function for call to
2343 // `std::basic_string<char>::basic_string()'
2344 using namespace std::literals;
2345 s = u8"xx"s; // error: conversion from
2346 // `basic_string<char8_t>' to non-scalar
2347 // type `basic_string<char>' requested
2348
2349 -fcheck-new
2350 Check that the pointer returned by "operator new" is non-null
2351 before attempting to modify the storage allocated. This check is
2352 normally unnecessary because the C++ standard specifies that
2353 "operator new" only returns 0 if it is declared throw(), in which
2354 case the compiler always checks the return value even without this
2355 option. In all other cases, when "operator new" has a non-empty
2356 exception specification, memory exhaustion is signalled by throwing
2357 "std::bad_alloc". See also new (nothrow).
2358
2359 -fconcepts
2360 -fconcepts-ts
2361 Enable support for the C++ Concepts feature for constraining
2362 template arguments. With -std=c++20 and above, Concepts are part
2363 of the language standard, so -fconcepts defaults to on.
2364
2365 Some constructs that were allowed by the earlier C++ Extensions for
2366 Concepts Technical Specification, ISO 19217 (2015), but didn't make
2367 it into the standard, can additionally be enabled by -fconcepts-ts.
2368
2369 -fconstexpr-depth=n
2370 Set the maximum nested evaluation depth for C++11 constexpr
2371 functions to n. A limit is needed to detect endless recursion
2372 during constant expression evaluation. The minimum specified by
2373 the standard is 512.
2374
2375 -fconstexpr-cache-depth=n
2376 Set the maximum level of nested evaluation depth for C++11
2377 constexpr functions that will be cached to n. This is a heuristic
2378 that trades off compilation speed (when the cache avoids repeated
2379 calculations) against memory consumption (when the cache grows very
2380 large from highly recursive evaluations). The default is 8. Very
2381 few users are likely to want to adjust it, but if your code does
2382 heavy constexpr calculations you might want to experiment to find
2383 which value works best for you.
2384
2385 -fconstexpr-fp-except
2386 Annex F of the C standard specifies that IEC559 floating point
2387 exceptions encountered at compile time should not stop compilation.
2388 C++ compilers have historically not followed this guidance, instead
2389 treating floating point division by zero as non-constant even
2390 though it has a well defined value. This flag tells the compiler
2391 to give Annex F priority over other rules saying that a particular
2392 operation is undefined.
2393
2394 constexpr float inf = 1./0.; // OK with -fconstexpr-fp-except
2395
2396 -fconstexpr-loop-limit=n
2397 Set the maximum number of iterations for a loop in C++14 constexpr
2398 functions to n. A limit is needed to detect infinite loops during
2399 constant expression evaluation. The default is 262144 (1<<18).
2400
2401 -fconstexpr-ops-limit=n
2402 Set the maximum number of operations during a single constexpr
2403 evaluation. Even when number of iterations of a single loop is
2404 limited with the above limit, if there are several nested loops and
2405 each of them has many iterations but still smaller than the above
2406 limit, or if in a body of some loop or even outside of a loop too
2407 many expressions need to be evaluated, the resulting constexpr
2408 evaluation might take too long. The default is 33554432 (1<<25).
2409
2410 -fcontracts
2411 Enable experimental support for the C++ Contracts feature, as
2412 briefly added to and then removed from the C++20 working paper
2413 (N4820). The implementation also includes proposed enhancements
2414 from papers P1290, P1332, and P1429. This functionality is
2415 intended mostly for those interested in experimentation towards
2416 refining the feature to get it into shape for a future C++
2417 standard.
2418
2419 On violation of a checked contract, the violation handler is
2420 called. Users can replace the violation handler by defining
2421
2422 void
2423 handle_contract_violation (const std::experimental::contract_violation&);
2424
2425 There are different sets of additional flags that can be used
2426 together to specify which contracts will be checked and how, for
2427 N4820 contracts, P1332 contracts, or P1429 contracts; these sets
2428 cannot be used together.
2429
2430 -fcontract-mode=[on|off]
2431 Control whether any contracts have any semantics at all.
2432 Defaults to on.
2433
2434 -fcontract-assumption-mode=[on|off]
2435 [N4820] Control whether contracts with level axiom should have
2436 the assume semantic. Defaults to on.
2437
2438 -fcontract-build-level=[off|default|audit]
2439 [N4820] Specify which level of contracts to generate checks
2440 for. Defaults to default.
2441
2442 -fcontract-continuation-mode=[on|off]
2443 [N4820] Control whether to allow the program to continue
2444 executing after a contract violation. That is, do checked
2445 contracts have the maybe semantic described below rather than
2446 the never semantic. Defaults to off.
2447
2448 -fcontract-role=<name>:<default>,<audit>,<axiom>
2449 [P1332] Specify the concrete semantics for each contract level
2450 of a particular contract role.
2451
2452 -fcontract-semantic=[default|audit|axiom]:<semantic>
2453 [P1429] Specify the concrete semantic for a particular contract
2454 level.
2455
2456 -fcontract-strict-declarations=[on|off]
2457 Control whether to reject adding contracts to a function after
2458 its first declaration. Defaults to off.
2459
2460 The possible concrete semantics for that can be specified with
2461 -fcontract-role or -fcontract-semantic are:
2462
2463 "ignore"
2464 This contract has no effect.
2465
2466 "assume"
2467 This contract is treated like C++23 "[[assume]]".
2468
2469 "check_never_continue"
2470 "never"
2471 "abort"
2472 This contract is checked. If it fails, the violation handler
2473 is called. If the handler returns, "std::terminate" is called.
2474
2475 "check_maybe_continue"
2476 "maybe"
2477 This contract is checked. If it fails, the violation handler
2478 is called. If the handler returns, execution continues
2479 normally.
2480
2481 -fcoroutines
2482 Enable support for the C++ coroutines extension (experimental).
2483
2484 -fno-elide-constructors
2485 The C++ standard allows an implementation to omit creating a
2486 temporary that is only used to initialize another object of the
2487 same type. Specifying this option disables that optimization, and
2488 forces G++ to call the copy constructor in all cases. This option
2489 also causes G++ to call trivial member functions which otherwise
2490 would be expanded inline.
2491
2492 In C++17, the compiler is required to omit these temporaries, but
2493 this option still affects trivial member functions.
2494
2495 -fno-enforce-eh-specs
2496 Don't generate code to check for violation of exception
2497 specifications at run time. This option violates the C++ standard,
2498 but may be useful for reducing code size in production builds, much
2499 like defining "NDEBUG". This does not give user code permission to
2500 throw exceptions in violation of the exception specifications; the
2501 compiler still optimizes based on the specifications, so throwing
2502 an unexpected exception results in undefined behavior at run time.
2503
2504 -fextern-tls-init
2505 -fno-extern-tls-init
2506 The C++11 and OpenMP standards allow "thread_local" and
2507 "threadprivate" variables to have dynamic (runtime) initialization.
2508 To support this, any use of such a variable goes through a wrapper
2509 function that performs any necessary initialization. When the use
2510 and definition of the variable are in the same translation unit,
2511 this overhead can be optimized away, but when the use is in a
2512 different translation unit there is significant overhead even if
2513 the variable doesn't actually need dynamic initialization. If the
2514 programmer can be sure that no use of the variable in a non-
2515 defining TU needs to trigger dynamic initialization (either because
2516 the variable is statically initialized, or a use of the variable in
2517 the defining TU will be executed before any uses in another TU),
2518 they can avoid this overhead with the -fno-extern-tls-init option.
2519
2520 On targets that support symbol aliases, the default is
2521 -fextern-tls-init. On targets that do not support symbol aliases,
2522 the default is -fno-extern-tls-init.
2523
2524 -ffold-simple-inlines
2525 -fno-fold-simple-inlines
2526 Permit the C++ frontend to fold calls to "std::move",
2527 "std::forward", "std::addressof" and "std::as_const". In contrast
2528 to inlining, this means no debug information will be generated for
2529 such calls. Since these functions are rarely interesting to debug,
2530 this flag is enabled by default unless -fno-inline is active.
2531
2532 -fno-gnu-keywords
2533 Do not recognize "typeof" as a keyword, so that code can use this
2534 word as an identifier. You can use the keyword "__typeof__"
2535 instead. This option is implied by the strict ISO C++ dialects:
2536 -ansi, -std=c++98, -std=c++11, etc.
2537
2538 -fimplicit-constexpr
2539 Make inline functions implicitly constexpr, if they satisfy the
2540 requirements for a constexpr function. This option can be used in
2541 C++14 mode or later. This can result in initialization changing
2542 from dynamic to static and other optimizations.
2543
2544 -fno-implicit-templates
2545 Never emit code for non-inline templates that are instantiated
2546 implicitly (i.e. by use); only emit code for explicit
2547 instantiations. If you use this option, you must take care to
2548 structure your code to include all the necessary explicit
2549 instantiations to avoid getting undefined symbols at link time.
2550
2551 -fno-implicit-inline-templates
2552 Don't emit code for implicit instantiations of inline templates,
2553 either. The default is to handle inlines differently so that
2554 compiles with and without optimization need the same set of
2555 explicit instantiations.
2556
2557 -fno-implement-inlines
2558 To save space, do not emit out-of-line copies of inline functions
2559 controlled by "#pragma implementation". This causes linker errors
2560 if these functions are not inlined everywhere they are called.
2561
2562 -fmodules-ts
2563 -fno-modules-ts
2564 Enable support for C++20 modules. The -fno-modules-ts is usually
2565 not needed, as that is the default. Even though this is a C++20
2566 feature, it is not currently implicitly enabled by selecting that
2567 standard version.
2568
2569 -fmodule-header
2570 -fmodule-header=user
2571 -fmodule-header=system
2572 Compile a header file to create an importable header unit.
2573
2574 -fmodule-implicit-inline
2575 Member functions defined in their class definitions are not
2576 implicitly inline for modular code. This is different to
2577 traditional C++ behavior, for good reasons. However, it may result
2578 in a difficulty during code porting. This option makes such
2579 function definitions implicitly inline. It does however generate
2580 an ABI incompatibility, so you must use it everywhere or nowhere.
2581 (Such definitions outside of a named module remain implicitly
2582 inline, regardless.)
2583
2584 -fno-module-lazy
2585 Disable lazy module importing and module mapper creation.
2586
2587 -fmodule-mapper=[hostname]:port[?ident]
2588 -fmodule-mapper=|program[?ident] args...
2589 -fmodule-mapper==socket[?ident]
2590 -fmodule-mapper=<>[inout][?ident]
2591 -fmodule-mapper=<in>out[?ident]
2592 -fmodule-mapper=file[?ident]
2593 An oracle to query for module name to filename mappings. If
2594 unspecified the CXX_MODULE_MAPPER environment variable is used, and
2595 if that is unset, an in-process default is provided.
2596
2597 -fmodule-only
2598 Only emit the Compiled Module Interface, inhibiting any object
2599 file.
2600
2601 -fms-extensions
2602 Disable Wpedantic warnings about constructs used in MFC, such as
2603 implicit int and getting a pointer to member function via non-
2604 standard syntax.
2605
2606 -fnew-inheriting-ctors
2607 Enable the P0136 adjustment to the semantics of C++11 constructor
2608 inheritance. This is part of C++17 but also considered to be a
2609 Defect Report against C++11 and C++14. This flag is enabled by
2610 default unless -fabi-version=10 or lower is specified.
2611
2612 -fnew-ttp-matching
2613 Enable the P0522 resolution to Core issue 150, template template
2614 parameters and default arguments: this allows a template with
2615 default template arguments as an argument for a template template
2616 parameter with fewer template parameters. This flag is enabled by
2617 default for -std=c++17.
2618
2619 -fno-nonansi-builtins
2620 Disable built-in declarations of functions that are not mandated by
2621 ANSI/ISO C. These include "ffs", "alloca", "_exit", "index",
2622 "bzero", "conjf", and other related functions.
2623
2624 -fnothrow-opt
2625 Treat a throw() exception specification as if it were a "noexcept"
2626 specification to reduce or eliminate the text size overhead
2627 relative to a function with no exception specification. If the
2628 function has local variables of types with non-trivial destructors,
2629 the exception specification actually makes the function smaller
2630 because the EH cleanups for those variables can be optimized away.
2631 The semantic effect is that an exception thrown out of a function
2632 with such an exception specification results in a call to
2633 "terminate" rather than "unexpected".
2634
2635 -fno-operator-names
2636 Do not treat the operator name keywords "and", "bitand", "bitor",
2637 "compl", "not", "or" and "xor" as synonyms as keywords.
2638
2639 -fno-optional-diags
2640 Disable diagnostics that the standard says a compiler does not need
2641 to issue. Currently, the only such diagnostic issued by G++ is the
2642 one for a name having multiple meanings within a class.
2643
2644 -fpermissive
2645 Downgrade some diagnostics about nonconformant code from errors to
2646 warnings. Thus, using -fpermissive allows some nonconforming code
2647 to compile.
2648
2649 -fno-pretty-templates
2650 When an error message refers to a specialization of a function
2651 template, the compiler normally prints the signature of the
2652 template followed by the template arguments and any typedefs or
2653 typenames in the signature (e.g. "void f(T) [with T = int]" rather
2654 than "void f(int)") so that it's clear which template is involved.
2655 When an error message refers to a specialization of a class
2656 template, the compiler omits any template arguments that match the
2657 default template arguments for that template. If either of these
2658 behaviors make it harder to understand the error message rather
2659 than easier, you can use -fno-pretty-templates to disable them.
2660
2661 -fno-rtti
2662 Disable generation of information about every class with virtual
2663 functions for use by the C++ run-time type identification features
2664 ("dynamic_cast" and "typeid"). If you don't use those parts of the
2665 language, you can save some space by using this flag. Note that
2666 exception handling uses the same information, but G++ generates it
2667 as needed. The "dynamic_cast" operator can still be used for casts
2668 that do not require run-time type information, i.e. casts to "void
2669 *" or to unambiguous base classes.
2670
2671 Mixing code compiled with -frtti with that compiled with -fno-rtti
2672 may not work. For example, programs may fail to link if a class
2673 compiled with -fno-rtti is used as a base for a class compiled with
2674 -frtti.
2675
2676 -fsized-deallocation
2677 Enable the built-in global declarations
2678
2679 void operator delete (void *, std::size_t) noexcept;
2680 void operator delete[] (void *, std::size_t) noexcept;
2681
2682 as introduced in C++14. This is useful for user-defined
2683 replacement deallocation functions that, for example, use the size
2684 of the object to make deallocation faster. Enabled by default
2685 under -std=c++14 and above. The flag -Wsized-deallocation warns
2686 about places that might want to add a definition.
2687
2688 -fstrict-enums
2689 Allow the compiler to optimize using the assumption that a value of
2690 enumerated type can only be one of the values of the enumeration
2691 (as defined in the C++ standard; basically, a value that can be
2692 represented in the minimum number of bits needed to represent all
2693 the enumerators). This assumption may not be valid if the program
2694 uses a cast to convert an arbitrary integer value to the enumerated
2695 type.
2696
2697 -fstrong-eval-order
2698 Evaluate member access, array subscripting, and shift expressions
2699 in left-to-right order, and evaluate assignment in right-to-left
2700 order, as adopted for C++17. Enabled by default with -std=c++17.
2701 -fstrong-eval-order=some enables just the ordering of member access
2702 and shift expressions, and is the default without -std=c++17.
2703
2704 -ftemplate-backtrace-limit=n
2705 Set the maximum number of template instantiation notes for a single
2706 warning or error to n. The default value is 10.
2707
2708 -ftemplate-depth=n
2709 Set the maximum instantiation depth for template classes to n. A
2710 limit on the template instantiation depth is needed to detect
2711 endless recursions during template class instantiation. ANSI/ISO
2712 C++ conforming programs must not rely on a maximum depth greater
2713 than 17 (changed to 1024 in C++11). The default value is 900, as
2714 the compiler can run out of stack space before hitting 1024 in some
2715 situations.
2716
2717 -fno-threadsafe-statics
2718 Do not emit the extra code to use the routines specified in the C++
2719 ABI for thread-safe initialization of local statics. You can use
2720 this option to reduce code size slightly in code that doesn't need
2721 to be thread-safe.
2722
2723 -fuse-cxa-atexit
2724 Register destructors for objects with static storage duration with
2725 the "__cxa_atexit" function rather than the "atexit" function.
2726 This option is required for fully standards-compliant handling of
2727 static destructors, but only works if your C library supports
2728 "__cxa_atexit".
2729
2730 -fno-use-cxa-get-exception-ptr
2731 Don't use the "__cxa_get_exception_ptr" runtime routine. This
2732 causes "std::uncaught_exception" to be incorrect, but is necessary
2733 if the runtime routine is not available.
2734
2735 -fvisibility-inlines-hidden
2736 This switch declares that the user does not attempt to compare
2737 pointers to inline functions or methods where the addresses of the
2738 two functions are taken in different shared objects.
2739
2740 The effect of this is that GCC may, effectively, mark inline
2741 methods with "__attribute__ ((visibility ("hidden")))" so that they
2742 do not appear in the export table of a DSO and do not require a PLT
2743 indirection when used within the DSO. Enabling this option can
2744 have a dramatic effect on load and link times of a DSO as it
2745 massively reduces the size of the dynamic export table when the
2746 library makes heavy use of templates.
2747
2748 The behavior of this switch is not quite the same as marking the
2749 methods as hidden directly, because it does not affect static
2750 variables local to the function or cause the compiler to deduce
2751 that the function is defined in only one shared object.
2752
2753 You may mark a method as having a visibility explicitly to negate
2754 the effect of the switch for that method. For example, if you do
2755 want to compare pointers to a particular inline method, you might
2756 mark it as having default visibility. Marking the enclosing class
2757 with explicit visibility has no effect.
2758
2759 Explicitly instantiated inline methods are unaffected by this
2760 option as their linkage might otherwise cross a shared library
2761 boundary.
2762
2763 -fvisibility-ms-compat
2764 This flag attempts to use visibility settings to make GCC's C++
2765 linkage model compatible with that of Microsoft Visual Studio.
2766
2767 The flag makes these changes to GCC's linkage model:
2768
2769 1. It sets the default visibility to "hidden", like
2770 -fvisibility=hidden.
2771
2772 2. Types, but not their members, are not hidden by default.
2773
2774 3. The One Definition Rule is relaxed for types without explicit
2775 visibility specifications that are defined in more than one
2776 shared object: those declarations are permitted if they are
2777 permitted when this option is not used.
2778
2779 In new code it is better to use -fvisibility=hidden and export
2780 those classes that are intended to be externally visible.
2781 Unfortunately it is possible for code to rely, perhaps
2782 accidentally, on the Visual Studio behavior.
2783
2784 Among the consequences of these changes are that static data
2785 members of the same type with the same name but defined in
2786 different shared objects are different, so changing one does not
2787 change the other; and that pointers to function members defined in
2788 different shared objects may not compare equal. When this flag is
2789 given, it is a violation of the ODR to define types with the same
2790 name differently.
2791
2792 -fno-weak
2793 Do not use weak symbol support, even if it is provided by the
2794 linker. By default, G++ uses weak symbols if they are available.
2795 This option exists only for testing, and should not be used by end-
2796 users; it results in inferior code and has no benefits. This
2797 option may be removed in a future release of G++.
2798
2799 -fext-numeric-literals (C++ and Objective-C++ only)
2800 Accept imaginary, fixed-point, or machine-defined literal number
2801 suffixes as GNU extensions. When this option is turned off these
2802 suffixes are treated as C++11 user-defined literal numeric
2803 suffixes. This is on by default for all pre-C++11 dialects and all
2804 GNU dialects: -std=c++98, -std=gnu++98, -std=gnu++11, -std=gnu++14.
2805 This option is off by default for ISO C++11 onwards (-std=c++11,
2806 ...).
2807
2808 -nostdinc++
2809 Do not search for header files in the standard directories specific
2810 to C++, but do still search the other standard directories. (This
2811 option is used when building the C++ library.)
2812
2813 -flang-info-include-translate
2814 -flang-info-include-translate-not
2815 -flang-info-include-translate=header
2816 Inform of include translation events. The first will note accepted
2817 include translations, the second will note declined include
2818 translations. The header form will inform of include translations
2819 relating to that specific header. If header is of the form "user"
2820 or "<system>" it will be resolved to a specific user or system
2821 header using the include path.
2822
2823 -flang-info-module-cmi
2824 -flang-info-module-cmi=module
2825 Inform of Compiled Module Interface pathnames. The first will note
2826 all read CMI pathnames. The module form will not reading a
2827 specific module's CMI. module may be a named module or a header-
2828 unit (the latter indicated by either being a pathname containing
2829 directory separators or enclosed in "<>" or "").
2830
2831 -stdlib=libstdc++,libc++
2832 When G++ is configured to support this option, it allows
2833 specification of alternate C++ runtime libraries. Two options are
2834 available: libstdc++ (the default, native C++ runtime for G++) and
2835 libc++ which is the C++ runtime installed on some operating systems
2836 (e.g. Darwin versions from Darwin11 onwards). The option switches
2837 G++ to use the headers from the specified library and to emit
2838 "-lstdc++" or "-lc++" respectively, when a C++ runtime is required
2839 for linking.
2840
2841 In addition, these warning options have meanings only for C++ programs:
2842
2843 -Wabi-tag (C++ and Objective-C++ only)
2844 Warn when a type with an ABI tag is used in a context that does not
2845 have that ABI tag. See C++ Attributes for more information about
2846 ABI tags.
2847
2848 -Wcomma-subscript (C++ and Objective-C++ only)
2849 Warn about uses of a comma expression within a subscripting
2850 expression. This usage was deprecated in C++20 and is going to be
2851 removed in C++23. However, a comma expression wrapped in "( )" is
2852 not deprecated. Example:
2853
2854 void f(int *a, int b, int c) {
2855 a[b,c]; // deprecated in C++20, invalid in C++23
2856 a[(b,c)]; // OK
2857 }
2858
2859 In C++23 it is valid to have comma separated expressions in a
2860 subscript when an overloaded subscript operator is found and
2861 supports the right number and types of arguments. G++ will accept
2862 the formerly valid syntax for code that is not valid in C++23 but
2863 used to be valid but deprecated in C++20 with a pedantic warning
2864 that can be disabled with -Wno-comma-subscript.
2865
2866 Enabled by default with -std=c++20 unless -Wno-deprecated, and with
2867 -std=c++23 regardless of -Wno-deprecated.
2868
2869 -Wctad-maybe-unsupported (C++ and Objective-C++ only)
2870 Warn when performing class template argument deduction (CTAD) on a
2871 type with no explicitly written deduction guides. This warning
2872 will point out cases where CTAD succeeded only because the compiler
2873 synthesized the implicit deduction guides, which might not be what
2874 the programmer intended. Certain style guides allow CTAD only on
2875 types that specifically "opt-in"; i.e., on types that are designed
2876 to support CTAD. This warning can be suppressed with the following
2877 pattern:
2878
2879 struct allow_ctad_t; // any name works
2880 template <typename T> struct S {
2881 S(T) { }
2882 };
2883 // Guide with incomplete parameter type will never be considered.
2884 S(allow_ctad_t) -> S<void>;
2885
2886 -Wctor-dtor-privacy (C++ and Objective-C++ only)
2887 Warn when a class seems unusable because all the constructors or
2888 destructors in that class are private, and it has neither friends
2889 nor public static member functions. Also warn if there are no non-
2890 private methods, and there's at least one private member function
2891 that isn't a constructor or destructor.
2892
2893 -Wdangling-reference (C++ and Objective-C++ only)
2894 Warn when a reference is bound to a temporary whose lifetime has
2895 ended. For example:
2896
2897 int n = 1;
2898 const int& r = std::max(n - 1, n + 1); // r is dangling
2899
2900 In the example above, two temporaries are created, one for each
2901 argument, and a reference to one of the temporaries is returned.
2902 However, both temporaries are destroyed at the end of the full
2903 expression, so the reference "r" is dangling. This warning also
2904 detects dangling references in member initializer lists:
2905
2906 const int& f(const int& i) { return i; }
2907 struct S {
2908 const int &r; // r is dangling
2909 S() : r(f(10)) { }
2910 };
2911
2912 Member functions are checked as well, but only their object
2913 argument:
2914
2915 struct S {
2916 const S& self () { return *this; }
2917 };
2918 const S& s = S().self(); // s is dangling
2919
2920 Certain functions are safe in this respect, for example
2921 "std::use_facet": they take and return a reference, but they don't
2922 return one of its arguments, which can fool the warning. Such
2923 functions can be excluded from the warning by wrapping them in a
2924 "#pragma":
2925
2926 #pragma GCC diagnostic push
2927 #pragma GCC diagnostic ignored "-Wdangling-reference"
2928 const T& foo (const T&) { ... }
2929 #pragma GCC diagnostic pop
2930
2931 -Wdangling-reference also warns about code like
2932
2933 auto p = std::minmax(1, 2);
2934
2935 where "std::minmax" returns "std::pair<const int&, const int&>",
2936 and both references dangle after the end of the full expression
2937 that contains the call to "std::minmax".
2938
2939 This warning is enabled by -Wextra.
2940
2941 -Wdelete-non-virtual-dtor (C++ and Objective-C++ only)
2942 Warn when "delete" is used to destroy an instance of a class that
2943 has virtual functions and non-virtual destructor. It is unsafe to
2944 delete an instance of a derived class through a pointer to a base
2945 class if the base class does not have a virtual destructor. This
2946 warning is enabled by -Wall.
2947
2948 -Wdeprecated-copy (C++ and Objective-C++ only)
2949 Warn that the implicit declaration of a copy constructor or copy
2950 assignment operator is deprecated if the class has a user-provided
2951 copy constructor or copy assignment operator, in C++11 and up.
2952 This warning is enabled by -Wextra. With -Wdeprecated-copy-dtor,
2953 also deprecate if the class has a user-provided destructor.
2954
2955 -Wno-deprecated-enum-enum-conversion (C++ and Objective-C++ only)
2956 Disable the warning about the case when the usual arithmetic
2957 conversions are applied on operands where one is of enumeration
2958 type and the other is of a different enumeration type. This
2959 conversion was deprecated in C++20. For example:
2960
2961 enum E1 { e };
2962 enum E2 { f };
2963 int k = f - e;
2964
2965 -Wdeprecated-enum-enum-conversion is enabled by default with
2966 -std=c++20. In pre-C++20 dialects, this warning can be enabled by
2967 -Wenum-conversion.
2968
2969 -Wno-deprecated-enum-float-conversion (C++ and Objective-C++ only)
2970 Disable the warning about the case when the usual arithmetic
2971 conversions are applied on operands where one is of enumeration
2972 type and the other is of a floating-point type. This conversion
2973 was deprecated in C++20. For example:
2974
2975 enum E1 { e };
2976 enum E2 { f };
2977 bool b = e <= 3.7;
2978
2979 -Wdeprecated-enum-float-conversion is enabled by default with
2980 -std=c++20. In pre-C++20 dialects, this warning can be enabled by
2981 -Wenum-conversion.
2982
2983 -Wno-init-list-lifetime (C++ and Objective-C++ only)
2984 Do not warn about uses of "std::initializer_list" that are likely
2985 to result in dangling pointers. Since the underlying array for an
2986 "initializer_list" is handled like a normal C++ temporary object,
2987 it is easy to inadvertently keep a pointer to the array past the
2988 end of the array's lifetime. For example:
2989
2990 * If a function returns a temporary "initializer_list", or a
2991 local "initializer_list" variable, the array's lifetime ends at
2992 the end of the return statement, so the value returned has a
2993 dangling pointer.
2994
2995 * If a new-expression creates an "initializer_list", the array
2996 only lives until the end of the enclosing full-expression, so
2997 the "initializer_list" in the heap has a dangling pointer.
2998
2999 * When an "initializer_list" variable is assigned from a brace-
3000 enclosed initializer list, the temporary array created for the
3001 right side of the assignment only lives until the end of the
3002 full-expression, so at the next statement the
3003 "initializer_list" variable has a dangling pointer.
3004
3005 // li's initial underlying array lives as long as li
3006 std::initializer_list<int> li = { 1,2,3 };
3007 // assignment changes li to point to a temporary array
3008 li = { 4, 5 };
3009 // now the temporary is gone and li has a dangling pointer
3010 int i = li.begin()[0] // undefined behavior
3011
3012 * When a list constructor stores the "begin" pointer from the
3013 "initializer_list" argument, this doesn't extend the lifetime
3014 of the array, so if a class variable is constructed from a
3015 temporary "initializer_list", the pointer is left dangling by
3016 the end of the variable declaration statement.
3017
3018 -Winvalid-constexpr
3019 Warn when a function never produces a constant expression. In
3020 C++20 and earlier, for every "constexpr" function and function
3021 template, there must be at least one set of function arguments in
3022 at least one instantiation such that an invocation of the function
3023 or constructor could be an evaluated subexpression of a core
3024 constant expression. C++23 removed this restriction, so it's
3025 possible to have a function or a function template marked
3026 "constexpr" for which no invocation satisfies the requirements of a
3027 core constant expression.
3028
3029 This warning is enabled as a pedantic warning by default in C++20
3030 and earlier. In C++23, -Winvalid-constexpr can be turned on, in
3031 which case it will be an ordinary warning. For example:
3032
3033 void f (int& i);
3034 constexpr void
3035 g (int& i)
3036 {
3037 // Warns by default in C++20, in C++23 only with -Winvalid-constexpr.
3038 f(i);
3039 }
3040
3041 -Winvalid-imported-macros
3042 Verify all imported macro definitions are valid at the end of
3043 compilation. This is not enabled by default, as it requires
3044 additional processing to determine. It may be useful when
3045 preparing sets of header-units to ensure consistent macros.
3046
3047 -Wno-literal-suffix (C++ and Objective-C++ only)
3048 Do not warn when a string or character literal is followed by a ud-
3049 suffix which does not begin with an underscore. As a conforming
3050 extension, GCC treats such suffixes as separate preprocessing
3051 tokens in order to maintain backwards compatibility with code that
3052 uses formatting macros from "<inttypes.h>". For example:
3053
3054 #define __STDC_FORMAT_MACROS
3055 #include <inttypes.h>
3056 #include <stdio.h>
3057
3058 int main() {
3059 int64_t i64 = 123;
3060 printf("My int64: %" PRId64"\n", i64);
3061 }
3062
3063 In this case, "PRId64" is treated as a separate preprocessing
3064 token.
3065
3066 This option also controls warnings when a user-defined literal
3067 operator is declared with a literal suffix identifier that doesn't
3068 begin with an underscore. Literal suffix identifiers that don't
3069 begin with an underscore are reserved for future standardization.
3070
3071 These warnings are enabled by default.
3072
3073 -Wno-narrowing (C++ and Objective-C++ only)
3074 For C++11 and later standards, narrowing conversions are diagnosed
3075 by default, as required by the standard. A narrowing conversion
3076 from a constant produces an error, and a narrowing conversion from
3077 a non-constant produces a warning, but -Wno-narrowing suppresses
3078 the diagnostic. Note that this does not affect the meaning of
3079 well-formed code; narrowing conversions are still considered ill-
3080 formed in SFINAE contexts.
3081
3082 With -Wnarrowing in C++98, warn when a narrowing conversion
3083 prohibited by C++11 occurs within { }, e.g.
3084
3085 int i = { 2.2 }; // error: narrowing from double to int
3086
3087 This flag is included in -Wall and -Wc++11-compat.
3088
3089 -Wnoexcept (C++ and Objective-C++ only)
3090 Warn when a noexcept-expression evaluates to false because of a
3091 call to a function that does not have a non-throwing exception
3092 specification (i.e. throw() or "noexcept") but is known by the
3093 compiler to never throw an exception.
3094
3095 -Wnoexcept-type (C++ and Objective-C++ only)
3096 Warn if the C++17 feature making "noexcept" part of a function type
3097 changes the mangled name of a symbol relative to C++14. Enabled by
3098 -Wabi and -Wc++17-compat.
3099
3100 As an example:
3101
3102 template <class T> void f(T t) { t(); };
3103 void g() noexcept;
3104 void h() { f(g); }
3105
3106 In C++14, "f" calls "f<void(*)()>", but in C++17 it calls
3107 "f<void(*)()noexcept>".
3108
3109 -Wclass-memaccess (C++ and Objective-C++ only)
3110 Warn when the destination of a call to a raw memory function such
3111 as "memset" or "memcpy" is an object of class type, and when
3112 writing into such an object might bypass the class non-trivial or
3113 deleted constructor or copy assignment, violate const-correctness
3114 or encapsulation, or corrupt virtual table pointers. Modifying the
3115 representation of such objects may violate invariants maintained by
3116 member functions of the class. For example, the call to "memset"
3117 below is undefined because it modifies a non-trivial class object
3118 and is, therefore, diagnosed. The safe way to either initialize or
3119 clear the storage of objects of such types is by using the
3120 appropriate constructor or assignment operator, if one is
3121 available.
3122
3123 std::string str = "abc";
3124 memset (&str, 0, sizeof str);
3125
3126 The -Wclass-memaccess option is enabled by -Wall. Explicitly
3127 casting the pointer to the class object to "void *" or to a type
3128 that can be safely accessed by the raw memory function suppresses
3129 the warning.
3130
3131 -Wnon-virtual-dtor (C++ and Objective-C++ only)
3132 Warn when a class has virtual functions and an accessible non-
3133 virtual destructor itself or in an accessible polymorphic base
3134 class, in which case it is possible but unsafe to delete an
3135 instance of a derived class through a pointer to the class itself
3136 or base class. This warning is automatically enabled if -Weffc++
3137 is specified. The -Wdelete-non-virtual-dtor option (enabled by
3138 -Wall) should be preferred because it warns about the unsafe cases
3139 without false positives.
3140
3141 -Wregister (C++ and Objective-C++ only)
3142 Warn on uses of the "register" storage class specifier, except when
3143 it is part of the GNU Explicit Register Variables extension. The
3144 use of the "register" keyword as storage class specifier has been
3145 deprecated in C++11 and removed in C++17. Enabled by default with
3146 -std=c++17.
3147
3148 -Wreorder (C++ and Objective-C++ only)
3149 Warn when the order of member initializers given in the code does
3150 not match the order in which they must be executed. For instance:
3151
3152 struct A {
3153 int i;
3154 int j;
3155 A(): j (0), i (1) { }
3156 };
3157
3158 The compiler rearranges the member initializers for "i" and "j" to
3159 match the declaration order of the members, emitting a warning to
3160 that effect. This warning is enabled by -Wall.
3161
3162 -Wno-pessimizing-move (C++ and Objective-C++ only)
3163 This warning warns when a call to "std::move" prevents copy
3164 elision. A typical scenario when copy elision can occur is when
3165 returning in a function with a class return type, when the
3166 expression being returned is the name of a non-volatile automatic
3167 object, and is not a function parameter, and has the same type as
3168 the function return type.
3169
3170 struct T {
3171 ...
3172 };
3173 T fn()
3174 {
3175 T t;
3176 ...
3177 return std::move (t);
3178 }
3179
3180 But in this example, the "std::move" call prevents copy elision.
3181
3182 This warning is enabled by -Wall.
3183
3184 -Wno-redundant-move (C++ and Objective-C++ only)
3185 This warning warns about redundant calls to "std::move"; that is,
3186 when a move operation would have been performed even without the
3187 "std::move" call. This happens because the compiler is forced to
3188 treat the object as if it were an rvalue in certain situations such
3189 as returning a local variable, where copy elision isn't applicable.
3190 Consider:
3191
3192 struct T {
3193 ...
3194 };
3195 T fn(T t)
3196 {
3197 ...
3198 return std::move (t);
3199 }
3200
3201 Here, the "std::move" call is redundant. Because G++ implements
3202 Core Issue 1579, another example is:
3203
3204 struct T { // convertible to U
3205 ...
3206 };
3207 struct U {
3208 ...
3209 };
3210 U fn()
3211 {
3212 T t;
3213 ...
3214 return std::move (t);
3215 }
3216
3217 In this example, copy elision isn't applicable because the type of
3218 the expression being returned and the function return type differ,
3219 yet G++ treats the return value as if it were designated by an
3220 rvalue.
3221
3222 This warning is enabled by -Wextra.
3223
3224 -Wrange-loop-construct (C++ and Objective-C++ only)
3225 This warning warns when a C++ range-based for-loop is creating an
3226 unnecessary copy. This can happen when the range declaration is
3227 not a reference, but probably should be. For example:
3228
3229 struct S { char arr[128]; };
3230 void fn () {
3231 S arr[5];
3232 for (const auto x : arr) { ... }
3233 }
3234
3235 It does not warn when the type being copied is a trivially-copyable
3236 type whose size is less than 64 bytes.
3237
3238 This warning also warns when a loop variable in a range-based for-
3239 loop is initialized with a value of a different type resulting in a
3240 copy. For example:
3241
3242 void fn() {
3243 int arr[10];
3244 for (const double &x : arr) { ... }
3245 }
3246
3247 In the example above, in every iteration of the loop a temporary
3248 value of type "double" is created and destroyed, to which the
3249 reference "const double &" is bound.
3250
3251 This warning is enabled by -Wall.
3252
3253 -Wredundant-tags (C++ and Objective-C++ only)
3254 Warn about redundant class-key and enum-key in references to class
3255 types and enumerated types in contexts where the key can be
3256 eliminated without causing an ambiguity. For example:
3257
3258 struct foo;
3259 struct foo *p; // warn that keyword struct can be eliminated
3260
3261 On the other hand, in this example there is no warning:
3262
3263 struct foo;
3264 void foo (); // "hides" struct foo
3265 void bar (struct foo&); // no warning, keyword struct is necessary
3266
3267 -Wno-subobject-linkage (C++ and Objective-C++ only)
3268 Do not warn if a class type has a base or a field whose type uses
3269 the anonymous namespace or depends on a type with no linkage. If a
3270 type A depends on a type B with no or internal linkage, defining it
3271 in multiple translation units would be an ODR violation because the
3272 meaning of B is different in each translation unit. If A only
3273 appears in a single translation unit, the best way to silence the
3274 warning is to give it internal linkage by putting it in an
3275 anonymous namespace as well. The compiler doesn't give this
3276 warning for types defined in the main .C file, as those are
3277 unlikely to have multiple definitions. -Wsubobject-linkage is
3278 enabled by default.
3279
3280 -Weffc++ (C++ and Objective-C++ only)
3281 Warn about violations of the following style guidelines from Scott
3282 Meyers' Effective C++ series of books:
3283
3284 * Define a copy constructor and an assignment operator for
3285 classes with dynamically-allocated memory.
3286
3287 * Prefer initialization to assignment in constructors.
3288
3289 * Have "operator=" return a reference to *this.
3290
3291 * Don't try to return a reference when you must return an object.
3292
3293 * Distinguish between prefix and postfix forms of increment and
3294 decrement operators.
3295
3296 * Never overload "&&", "||", or ",".
3297
3298 This option also enables -Wnon-virtual-dtor, which is also one of
3299 the effective C++ recommendations. However, the check is extended
3300 to warn about the lack of virtual destructor in accessible non-
3301 polymorphic bases classes too.
3302
3303 When selecting this option, be aware that the standard library
3304 headers do not obey all of these guidelines; use grep -v to filter
3305 out those warnings.
3306
3307 -Wno-exceptions (C++ and Objective-C++ only)
3308 Disable the warning about the case when an exception handler is
3309 shadowed by another handler, which can point out a wrong ordering
3310 of exception handlers.
3311
3312 -Wstrict-null-sentinel (C++ and Objective-C++ only)
3313 Warn about the use of an uncasted "NULL" as sentinel. When
3314 compiling only with GCC this is a valid sentinel, as "NULL" is
3315 defined to "__null". Although it is a null pointer constant rather
3316 than a null pointer, it is guaranteed to be of the same size as a
3317 pointer. But this use is not portable across different compilers.
3318
3319 -Wno-non-template-friend (C++ and Objective-C++ only)
3320 Disable warnings when non-template friend functions are declared
3321 within a template. In very old versions of GCC that predate
3322 implementation of the ISO standard, declarations such as friend int
3323 foo(int), where the name of the friend is an unqualified-id, could
3324 be interpreted as a particular specialization of a template
3325 function; the warning exists to diagnose compatibility problems,
3326 and is enabled by default.
3327
3328 -Wold-style-cast (C++ and Objective-C++ only)
3329 Warn if an old-style (C-style) cast to a non-void type is used
3330 within a C++ program. The new-style casts ("dynamic_cast",
3331 "static_cast", "reinterpret_cast", and "const_cast") are less
3332 vulnerable to unintended effects and much easier to search for.
3333
3334 -Woverloaded-virtual (C++ and Objective-C++ only)
3335 -Woverloaded-virtual=n
3336 Warn when a function declaration hides virtual functions from a
3337 base class. For example, in:
3338
3339 struct A {
3340 virtual void f();
3341 };
3342
3343 struct B: public A {
3344 void f(int); // does not override
3345 };
3346
3347 the "A" class version of "f" is hidden in "B", and code like:
3348
3349 B* b;
3350 b->f();
3351
3352 fails to compile.
3353
3354 In cases where the different signatures are not an accident, the
3355 simplest solution is to add a using-declaration to the derived
3356 class to un-hide the base function, e.g. add "using A::f;" to "B".
3357
3358 The optional level suffix controls the behavior when all the
3359 declarations in the derived class override virtual functions in the
3360 base class, even if not all of the base functions are overridden:
3361
3362 struct C {
3363 virtual void f();
3364 virtual void f(int);
3365 };
3366
3367 struct D: public C {
3368 void f(int); // does override
3369 }
3370
3371 This pattern is less likely to be a mistake; if D is only used
3372 virtually, the user might have decided that the base class
3373 semantics for some of the overloads are fine.
3374
3375 At level 1, this case does not warn; at level 2, it does.
3376 -Woverloaded-virtual by itself selects level 2. Level 1 is
3377 included in -Wall.
3378
3379 -Wno-pmf-conversions (C++ and Objective-C++ only)
3380 Disable the diagnostic for converting a bound pointer to member
3381 function to a plain pointer.
3382
3383 -Wsign-promo (C++ and Objective-C++ only)
3384 Warn when overload resolution chooses a promotion from unsigned or
3385 enumerated type to a signed type, over a conversion to an unsigned
3386 type of the same size. Previous versions of G++ tried to preserve
3387 unsignedness, but the standard mandates the current behavior.
3388
3389 -Wtemplates (C++ and Objective-C++ only)
3390 Warn when a primary template declaration is encountered. Some
3391 coding rules disallow templates, and this may be used to enforce
3392 that rule. The warning is inactive inside a system header file,
3393 such as the STL, so one can still use the STL. One may also
3394 instantiate or specialize templates.
3395
3396 -Wmismatched-new-delete (C++ and Objective-C++ only)
3397 Warn for mismatches between calls to "operator new" or "operator
3398 delete" and the corresponding call to the allocation or
3399 deallocation function. This includes invocations of C++ "operator
3400 delete" with pointers returned from either mismatched forms of
3401 "operator new", or from other functions that allocate objects for
3402 which the "operator delete" isn't a suitable deallocator, as well
3403 as calls to other deallocation functions with pointers returned
3404 from "operator new" for which the deallocation function isn't
3405 suitable.
3406
3407 For example, the "delete" expression in the function below is
3408 diagnosed because it doesn't match the array form of the "new"
3409 expression the pointer argument was returned from. Similarly, the
3410 call to "free" is also diagnosed.
3411
3412 void f ()
3413 {
3414 int *a = new int[n];
3415 delete a; // warning: mismatch in array forms of expressions
3416
3417 char *p = new char[n];
3418 free (p); // warning: mismatch between new and free
3419 }
3420
3421 The related option -Wmismatched-dealloc diagnoses mismatches
3422 involving allocation and deallocation functions other than
3423 "operator new" and "operator delete".
3424
3425 -Wmismatched-new-delete is included in -Wall.
3426
3427 -Wmismatched-tags (C++ and Objective-C++ only)
3428 Warn for declarations of structs, classes, and class templates and
3429 their specializations with a class-key that does not match either
3430 the definition or the first declaration if no definition is
3431 provided.
3432
3433 For example, the declaration of "struct Object" in the argument
3434 list of "draw" triggers the warning. To avoid it, either remove
3435 the redundant class-key "struct" or replace it with "class" to
3436 match its definition.
3437
3438 class Object {
3439 public:
3440 virtual ~Object () = 0;
3441 };
3442 void draw (struct Object*);
3443
3444 It is not wrong to declare a class with the class-key "struct" as
3445 the example above shows. The -Wmismatched-tags option is intended
3446 to help achieve a consistent style of class declarations. In code
3447 that is intended to be portable to Windows-based compilers the
3448 warning helps prevent unresolved references due to the difference
3449 in the mangling of symbols declared with different class-keys. The
3450 option can be used either on its own or in conjunction with
3451 -Wredundant-tags.
3452
3453 -Wmultiple-inheritance (C++ and Objective-C++ only)
3454 Warn when a class is defined with multiple direct base classes.
3455 Some coding rules disallow multiple inheritance, and this may be
3456 used to enforce that rule. The warning is inactive inside a system
3457 header file, such as the STL, so one can still use the STL. One
3458 may also define classes that indirectly use multiple inheritance.
3459
3460 -Wvirtual-inheritance
3461 Warn when a class is defined with a virtual direct base class.
3462 Some coding rules disallow multiple inheritance, and this may be
3463 used to enforce that rule. The warning is inactive inside a system
3464 header file, such as the STL, so one can still use the STL. One
3465 may also define classes that indirectly use virtual inheritance.
3466
3467 -Wno-virtual-move-assign
3468 Suppress warnings about inheriting from a virtual base with a non-
3469 trivial C++11 move assignment operator. This is dangerous because
3470 if the virtual base is reachable along more than one path, it is
3471 moved multiple times, which can mean both objects end up in the
3472 moved-from state. If the move assignment operator is written to
3473 avoid moving from a moved-from object, this warning can be
3474 disabled.
3475
3476 -Wnamespaces
3477 Warn when a namespace definition is opened. Some coding rules
3478 disallow namespaces, and this may be used to enforce that rule.
3479 The warning is inactive inside a system header file, such as the
3480 STL, so one can still use the STL. One may also use using
3481 directives and qualified names.
3482
3483 -Wno-terminate (C++ and Objective-C++ only)
3484 Disable the warning about a throw-expression that will immediately
3485 result in a call to "terminate".
3486
3487 -Wno-vexing-parse (C++ and Objective-C++ only)
3488 Warn about the most vexing parse syntactic ambiguity. This warns
3489 about the cases when a declaration looks like a variable
3490 definition, but the C++ language requires it to be interpreted as a
3491 function declaration. For instance:
3492
3493 void f(double a) {
3494 int i(); // extern int i (void);
3495 int n(int(a)); // extern int n (int);
3496 }
3497
3498 Another example:
3499
3500 struct S { S(int); };
3501 void f(double a) {
3502 S x(int(a)); // extern struct S x (int);
3503 S y(int()); // extern struct S y (int (*) (void));
3504 S z(); // extern struct S z (void);
3505 }
3506
3507 The warning will suggest options how to deal with such an
3508 ambiguity; e.g., it can suggest removing the parentheses or using
3509 braces instead.
3510
3511 This warning is enabled by default.
3512
3513 -Wno-class-conversion (C++ and Objective-C++ only)
3514 Do not warn when a conversion function converts an object to the
3515 same type, to a base class of that type, or to void; such a
3516 conversion function will never be called.
3517
3518 -Wvolatile (C++ and Objective-C++ only)
3519 Warn about deprecated uses of the "volatile" qualifier. This
3520 includes postfix and prefix "++" and "--" expressions of
3521 "volatile"-qualified types, using simple assignments where the left
3522 operand is a "volatile"-qualified non-class type for their value,
3523 compound assignments where the left operand is a
3524 "volatile"-qualified non-class type, "volatile"-qualified function
3525 return type, "volatile"-qualified parameter type, and structured
3526 bindings of a "volatile"-qualified type. This usage was deprecated
3527 in C++20.
3528
3529 Enabled by default with -std=c++20.
3530
3531 -Wzero-as-null-pointer-constant (C++ and Objective-C++ only)
3532 Warn when a literal 0 is used as null pointer constant. This can
3533 be useful to facilitate the conversion to "nullptr" in C++11.
3534
3535 -Waligned-new
3536 Warn about a new-expression of a type that requires greater
3537 alignment than the alignof(std::max_align_t) but uses an allocation
3538 function without an explicit alignment parameter. This option is
3539 enabled by -Wall.
3540
3541 Normally this only warns about global allocation functions, but
3542 -Waligned-new=all also warns about class member allocation
3543 functions.
3544
3545 -Wno-placement-new
3546 -Wplacement-new=n
3547 Warn about placement new expressions with undefined behavior, such
3548 as constructing an object in a buffer that is smaller than the type
3549 of the object. For example, the placement new expression below is
3550 diagnosed because it attempts to construct an array of 64 integers
3551 in a buffer only 64 bytes large.
3552
3553 char buf [64];
3554 new (buf) int[64];
3555
3556 This warning is enabled by default.
3557
3558 -Wplacement-new=1
3559 This is the default warning level of -Wplacement-new. At this
3560 level the warning is not issued for some strictly undefined
3561 constructs that GCC allows as extensions for compatibility with
3562 legacy code. For example, the following "new" expression is
3563 not diagnosed at this level even though it has undefined
3564 behavior according to the C++ standard because it writes past
3565 the end of the one-element array.
3566
3567 struct S { int n, a[1]; };
3568 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
3569 new (s->a)int [32]();
3570
3571 -Wplacement-new=2
3572 At this level, in addition to diagnosing all the same
3573 constructs as at level 1, a diagnostic is also issued for
3574 placement new expressions that construct an object in the last
3575 member of structure whose type is an array of a single element
3576 and whose size is less than the size of the object being
3577 constructed. While the previous example would be diagnosed,
3578 the following construct makes use of the flexible member array
3579 extension to avoid the warning at level 2.
3580
3581 struct S { int n, a[]; };
3582 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
3583 new (s->a)int [32]();
3584
3585 -Wcatch-value
3586 -Wcatch-value=n (C++ and Objective-C++ only)
3587 Warn about catch handlers that do not catch via reference. With
3588 -Wcatch-value=1 (or -Wcatch-value for short) warn about polymorphic
3589 class types that are caught by value. With -Wcatch-value=2 warn
3590 about all class types that are caught by value. With
3591 -Wcatch-value=3 warn about all types that are not caught by
3592 reference. -Wcatch-value is enabled by -Wall.
3593
3594 -Wconditionally-supported (C++ and Objective-C++ only)
3595 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
3596
3597 -Wno-delete-incomplete (C++ and Objective-C++ only)
3598 Do not warn when deleting a pointer to incomplete type, which may
3599 cause undefined behavior at runtime. This warning is enabled by
3600 default.
3601
3602 -Wextra-semi (C++, Objective-C++ only)
3603 Warn about redundant semicolons after in-class function
3604 definitions.
3605
3606 -Wno-inaccessible-base (C++, Objective-C++ only)
3607 This option controls warnings when a base class is inaccessible in
3608 a class derived from it due to ambiguity. The warning is enabled
3609 by default. Note that the warning for ambiguous virtual bases is
3610 enabled by the -Wextra option.
3611
3612 struct A { int a; };
3613
3614 struct B : A { };
3615
3616 struct C : B, A { };
3617
3618 -Wno-inherited-variadic-ctor
3619 Suppress warnings about use of C++11 inheriting constructors when
3620 the base class inherited from has a C variadic constructor; the
3621 warning is on by default because the ellipsis is not inherited.
3622
3623 -Wno-invalid-offsetof (C++ and Objective-C++ only)
3624 Suppress warnings from applying the "offsetof" macro to a non-POD
3625 type. According to the 2014 ISO C++ standard, applying "offsetof"
3626 to a non-standard-layout type is undefined. In existing C++
3627 implementations, however, "offsetof" typically gives meaningful
3628 results. This flag is for users who are aware that they are
3629 writing nonportable code and who have deliberately chosen to ignore
3630 the warning about it.
3631
3632 The restrictions on "offsetof" may be relaxed in a future version
3633 of the C++ standard.
3634
3635 -Wsized-deallocation (C++ and Objective-C++ only)
3636 Warn about a definition of an unsized deallocation function
3637
3638 void operator delete (void *) noexcept;
3639 void operator delete[] (void *) noexcept;
3640
3641 without a definition of the corresponding sized deallocation
3642 function
3643
3644 void operator delete (void *, std::size_t) noexcept;
3645 void operator delete[] (void *, std::size_t) noexcept;
3646
3647 or vice versa. Enabled by -Wextra along with -fsized-deallocation.
3648
3649 -Wsuggest-final-types
3650 Warn about types with virtual methods where code quality would be
3651 improved if the type were declared with the C++11 "final"
3652 specifier, or, if possible, declared in an anonymous namespace.
3653 This allows GCC to more aggressively devirtualize the polymorphic
3654 calls. This warning is more effective with link-time optimization,
3655 where the information about the class hierarchy graph is more
3656 complete.
3657
3658 -Wsuggest-final-methods
3659 Warn about virtual methods where code quality would be improved if
3660 the method were declared with the C++11 "final" specifier, or, if
3661 possible, its type were declared in an anonymous namespace or with
3662 the "final" specifier. This warning is more effective with link-
3663 time optimization, where the information about the class hierarchy
3664 graph is more complete. It is recommended to first consider
3665 suggestions of -Wsuggest-final-types and then rebuild with new
3666 annotations.
3667
3668 -Wsuggest-override
3669 Warn about overriding virtual functions that are not marked with
3670 the "override" keyword.
3671
3672 -Wuse-after-free
3673 -Wuse-after-free=n
3674 Warn about uses of pointers to dynamically allocated objects that
3675 have been rendered indeterminate by a call to a deallocation
3676 function. The warning is enabled at all optimization levels but
3677 may yield different results with optimization than without.
3678
3679 -Wuse-after-free=1
3680 At level 1 the warning attempts to diagnose only unconditional
3681 uses of pointers made indeterminate by a deallocation call or a
3682 successful call to "realloc", regardless of whether or not the
3683 call resulted in an actual reallocatio of memory. This
3684 includes double-"free" calls as well as uses in arithmetic and
3685 relational expressions. Although undefined, uses of
3686 indeterminate pointers in equality (or inequality) expressions
3687 are not diagnosed at this level.
3688
3689 -Wuse-after-free=2
3690 At level 2, in addition to unconditional uses, the warning also
3691 diagnoses conditional uses of pointers made indeterminate by a
3692 deallocation call. As at level 2, uses in equality (or
3693 inequality) expressions are not diagnosed. For example, the
3694 second call to "free" in the following function is diagnosed at
3695 this level:
3696
3697 struct A { int refcount; void *data; };
3698
3699 void release (struct A *p)
3700 {
3701 int refcount = --p->refcount;
3702 free (p);
3703 if (refcount == 0)
3704 free (p->data); // warning: p may be used after free
3705 }
3706
3707 -Wuse-after-free=3
3708 At level 3, the warning also diagnoses uses of indeterminate
3709 pointers in equality expressions. All uses of indeterminate
3710 pointers are undefined but equality tests sometimes appear
3711 after calls to "realloc" as an attempt to determine whether the
3712 call resulted in relocating the object to a different address.
3713 They are diagnosed at a separate level to aid legacy code
3714 gradually transition to safe alternatives. For example, the
3715 equality test in the function below is diagnosed at this level:
3716
3717 void adjust_pointers (int**, int);
3718
3719 void grow (int **p, int n)
3720 {
3721 int **q = (int**)realloc (p, n *= 2);
3722 if (q == p)
3723 return;
3724 adjust_pointers ((int**)q, n);
3725 }
3726
3727 To avoid the warning at this level, store offsets into
3728 allocated memory instead of pointers. This approach obviates
3729 needing to adjust the stored pointers after reallocation.
3730
3731 -Wuse-after-free=2 is included in -Wall.
3732
3733 -Wuseless-cast (C++ and Objective-C++ only)
3734 Warn when an expression is cast to its own type. This warning does
3735 not occur when a class object is converted to a non-reference type
3736 as that is a way to create a temporary:
3737
3738 struct S { };
3739 void g (S&&);
3740 void f (S&& arg)
3741 {
3742 g (S(arg)); // make arg prvalue so that it can bind to S&&
3743 }
3744
3745 -Wno-conversion-null (C++ and Objective-C++ only)
3746 Do not warn for conversions between "NULL" and non-pointer types.
3747 -Wconversion-null is enabled by default.
3748
3749 Options Controlling Objective-C and Objective-C++ Dialects
3750 (NOTE: This manual does not describe the Objective-C and Objective-C++
3751 languages themselves.
3752
3753 This section describes the command-line options that are only
3754 meaningful for Objective-C and Objective-C++ programs. You can also
3755 use most of the language-independent GNU compiler options. For
3756 example, you might compile a file some_class.m like this:
3757
3758 gcc -g -fgnu-runtime -O -c some_class.m
3759
3760 In this example, -fgnu-runtime is an option meant only for Objective-C
3761 and Objective-C++ programs; you can use the other options with any
3762 language supported by GCC.
3763
3764 Note that since Objective-C is an extension of the C language,
3765 Objective-C compilations may also use options specific to the C front-
3766 end (e.g., -Wtraditional). Similarly, Objective-C++ compilations may
3767 use C++-specific options (e.g., -Wabi).
3768
3769 Here is a list of options that are only for compiling Objective-C and
3770 Objective-C++ programs:
3771
3772 -fconstant-string-class=class-name
3773 Use class-name as the name of the class to instantiate for each
3774 literal string specified with the syntax "@"..."". The default
3775 class name is "NXConstantString" if the GNU runtime is being used,
3776 and "NSConstantString" if the NeXT runtime is being used (see
3777 below). On Darwin (macOS, MacOS X) platforms, the
3778 -fconstant-cfstrings option, if also present, overrides the
3779 -fconstant-string-class setting and cause "@"..."" literals to be
3780 laid out as constant CoreFoundation strings. Note that
3781 -fconstant-cfstrings is an alias for the target-specific
3782 -mconstant-cfstrings equivalent.
3783
3784 -fgnu-runtime
3785 Generate object code compatible with the standard GNU Objective-C
3786 runtime. This is the default for most types of systems.
3787
3788 -fnext-runtime
3789 Generate output compatible with the NeXT runtime. This is the
3790 default for NeXT-based systems, including Darwin and Mac OS X. The
3791 macro "__NEXT_RUNTIME__" is predefined if (and only if) this option
3792 is used.
3793
3794 -fno-nil-receivers
3795 Assume that all Objective-C message dispatches ("[receiver
3796 message:arg]") in this translation unit ensure that the receiver is
3797 not "nil". This allows for more efficient entry points in the
3798 runtime to be used. This option is only available in conjunction
3799 with the NeXT runtime and ABI version 0 or 1.
3800
3801 -fobjc-abi-version=n
3802 Use version n of the Objective-C ABI for the selected runtime.
3803 This option is currently supported only for the NeXT runtime. In
3804 that case, Version 0 is the traditional (32-bit) ABI without
3805 support for properties and other Objective-C 2.0 additions.
3806 Version 1 is the traditional (32-bit) ABI with support for
3807 properties and other Objective-C 2.0 additions. Version 2 is the
3808 modern (64-bit) ABI. If nothing is specified, the default is
3809 Version 0 on 32-bit target machines, and Version 2 on 64-bit target
3810 machines.
3811
3812 -fobjc-call-cxx-cdtors
3813 For each Objective-C class, check if any of its instance variables
3814 is a C++ object with a non-trivial default constructor. If so,
3815 synthesize a special "- (id) .cxx_construct" instance method which
3816 runs non-trivial default constructors on any such instance
3817 variables, in order, and then return "self". Similarly, check if
3818 any instance variable is a C++ object with a non-trivial
3819 destructor, and if so, synthesize a special "- (void)
3820 .cxx_destruct" method which runs all such default destructors, in
3821 reverse order.
3822
3823 The "- (id) .cxx_construct" and "- (void) .cxx_destruct" methods
3824 thusly generated only operate on instance variables declared in the
3825 current Objective-C class, and not those inherited from
3826 superclasses. It is the responsibility of the Objective-C runtime
3827 to invoke all such methods in an object's inheritance hierarchy.
3828 The "- (id) .cxx_construct" methods are invoked by the runtime
3829 immediately after a new object instance is allocated; the "- (void)
3830 .cxx_destruct" methods are invoked immediately before the runtime
3831 deallocates an object instance.
3832
3833 As of this writing, only the NeXT runtime on Mac OS X 10.4 and
3834 later has support for invoking the "- (id) .cxx_construct" and "-
3835 (void) .cxx_destruct" methods.
3836
3837 -fobjc-direct-dispatch
3838 Allow fast jumps to the message dispatcher. On Darwin this is
3839 accomplished via the comm page.
3840
3841 -fobjc-exceptions
3842 Enable syntactic support for structured exception handling in
3843 Objective-C, similar to what is offered by C++. This option is
3844 required to use the Objective-C keywords @try, @throw, @catch,
3845 @finally and @synchronized. This option is available with both the
3846 GNU runtime and the NeXT runtime (but not available in conjunction
3847 with the NeXT runtime on Mac OS X 10.2 and earlier).
3848
3849 -fobjc-gc
3850 Enable garbage collection (GC) in Objective-C and Objective-C++
3851 programs. This option is only available with the NeXT runtime; the
3852 GNU runtime has a different garbage collection implementation that
3853 does not require special compiler flags.
3854
3855 -fobjc-nilcheck
3856 For the NeXT runtime with version 2 of the ABI, check for a nil
3857 receiver in method invocations before doing the actual method call.
3858 This is the default and can be disabled using -fno-objc-nilcheck.
3859 Class methods and super calls are never checked for nil in this way
3860 no matter what this flag is set to. Currently this flag does
3861 nothing when the GNU runtime, or an older version of the NeXT
3862 runtime ABI, is used.
3863
3864 -fobjc-std=objc1
3865 Conform to the language syntax of Objective-C 1.0, the language
3866 recognized by GCC 4.0. This only affects the Objective-C additions
3867 to the C/C++ language; it does not affect conformance to C/C++
3868 standards, which is controlled by the separate C/C++ dialect option
3869 flags. When this option is used with the Objective-C or
3870 Objective-C++ compiler, any Objective-C syntax that is not
3871 recognized by GCC 4.0 is rejected. This is useful if you need to
3872 make sure that your Objective-C code can be compiled with older
3873 versions of GCC.
3874
3875 -freplace-objc-classes
3876 Emit a special marker instructing ld(1) not to statically link in
3877 the resulting object file, and allow dyld(1) to load it in at run
3878 time instead. This is used in conjunction with the Fix-and-
3879 Continue debugging mode, where the object file in question may be
3880 recompiled and dynamically reloaded in the course of program
3881 execution, without the need to restart the program itself.
3882 Currently, Fix-and-Continue functionality is only available in
3883 conjunction with the NeXT runtime on Mac OS X 10.3 and later.
3884
3885 -fzero-link
3886 When compiling for the NeXT runtime, the compiler ordinarily
3887 replaces calls to objc_getClass("...") (when the name of the class
3888 is known at compile time) with static class references that get
3889 initialized at load time, which improves run-time performance.
3890 Specifying the -fzero-link flag suppresses this behavior and causes
3891 calls to objc_getClass("...") to be retained. This is useful in
3892 Zero-Link debugging mode, since it allows for individual class
3893 implementations to be modified during program execution. The GNU
3894 runtime currently always retains calls to objc_get_class("...")
3895 regardless of command-line options.
3896
3897 -fno-local-ivars
3898 By default instance variables in Objective-C can be accessed as if
3899 they were local variables from within the methods of the class
3900 they're declared in. This can lead to shadowing between instance
3901 variables and other variables declared either locally inside a
3902 class method or globally with the same name. Specifying the
3903 -fno-local-ivars flag disables this behavior thus avoiding variable
3904 shadowing issues.
3905
3906 -fivar-visibility=[public|protected|private|package]
3907 Set the default instance variable visibility to the specified
3908 option so that instance variables declared outside the scope of any
3909 access modifier directives default to the specified visibility.
3910
3911 -gen-decls
3912 Dump interface declarations for all classes seen in the source file
3913 to a file named sourcename.decl.
3914
3915 -Wassign-intercept (Objective-C and Objective-C++ only)
3916 Warn whenever an Objective-C assignment is being intercepted by the
3917 garbage collector.
3918
3919 -Wno-property-assign-default (Objective-C and Objective-C++ only)
3920 Do not warn if a property for an Objective-C object has no assign
3921 semantics specified.
3922
3923 -Wno-protocol (Objective-C and Objective-C++ only)
3924 If a class is declared to implement a protocol, a warning is issued
3925 for every method in the protocol that is not implemented by the
3926 class. The default behavior is to issue a warning for every method
3927 not explicitly implemented in the class, even if a method
3928 implementation is inherited from the superclass. If you use the
3929 -Wno-protocol option, then methods inherited from the superclass
3930 are considered to be implemented, and no warning is issued for
3931 them.
3932
3933 -Wobjc-root-class (Objective-C and Objective-C++ only)
3934 Warn if a class interface lacks a superclass. Most classes will
3935 inherit from "NSObject" (or "Object") for example. When declaring
3936 classes intended to be root classes, the warning can be suppressed
3937 by marking their interfaces with
3938 "__attribute__((objc_root_class))".
3939
3940 -Wselector (Objective-C and Objective-C++ only)
3941 Warn if multiple methods of different types for the same selector
3942 are found during compilation. The check is performed on the list
3943 of methods in the final stage of compilation. Additionally, a
3944 check is performed for each selector appearing in a @selector(...)
3945 expression, and a corresponding method for that selector has been
3946 found during compilation. Because these checks scan the method
3947 table only at the end of compilation, these warnings are not
3948 produced if the final stage of compilation is not reached, for
3949 example because an error is found during compilation, or because
3950 the -fsyntax-only option is being used.
3951
3952 -Wstrict-selector-match (Objective-C and Objective-C++ only)
3953 Warn if multiple methods with differing argument and/or return
3954 types are found for a given selector when attempting to send a
3955 message using this selector to a receiver of type "id" or "Class".
3956 When this flag is off (which is the default behavior), the compiler
3957 omits such warnings if any differences found are confined to types
3958 that share the same size and alignment.
3959
3960 -Wundeclared-selector (Objective-C and Objective-C++ only)
3961 Warn if a @selector(...) expression referring to an undeclared
3962 selector is found. A selector is considered undeclared if no
3963 method with that name has been declared before the @selector(...)
3964 expression, either explicitly in an @interface or @protocol
3965 declaration, or implicitly in an @implementation section. This
3966 option always performs its checks as soon as a @selector(...)
3967 expression is found, while -Wselector only performs its checks in
3968 the final stage of compilation. This also enforces the coding
3969 style convention that methods and selectors must be declared before
3970 being used.
3971
3972 -print-objc-runtime-info
3973 Generate C header describing the largest structure that is passed
3974 by value, if any.
3975
3976 Options to Control Diagnostic Messages Formatting
3977 Traditionally, diagnostic messages have been formatted irrespective of
3978 the output device's aspect (e.g. its width, ...). You can use the
3979 options described below to control the formatting algorithm for
3980 diagnostic messages, e.g. how many characters per line, how often
3981 source location information should be reported. Note that some
3982 language front ends may not honor these options.
3983
3984 -fmessage-length=n
3985 Try to format error messages so that they fit on lines of about n
3986 characters. If n is zero, then no line-wrapping is done; each
3987 error message appears on a single line. This is the default for
3988 all front ends.
3989
3990 Note - this option also affects the display of the #error and
3991 #warning pre-processor directives, and the deprecated
3992 function/type/variable attribute. It does not however affect the
3993 pragma GCC warning and pragma GCC error pragmas.
3994
3995 -fdiagnostics-plain-output
3996 This option requests that diagnostic output look as plain as
3997 possible, which may be useful when running dejagnu or other
3998 utilities that need to parse diagnostics output and prefer that it
3999 remain more stable over time. -fdiagnostics-plain-output is
4000 currently equivalent to the following options:
4001 -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers
4002 -fdiagnostics-color=never -fdiagnostics-urls=never
4003 -fdiagnostics-path-format=separate-events In the future, if GCC
4004 changes the default appearance of its diagnostics, the
4005 corresponding option to disable the new behavior will be added to
4006 this list.
4007
4008 -fdiagnostics-show-location=once
4009 Only meaningful in line-wrapping mode. Instructs the diagnostic
4010 messages reporter to emit source location information once; that
4011 is, in case the message is too long to fit on a single physical
4012 line and has to be wrapped, the source location won't be emitted
4013 (as prefix) again, over and over, in subsequent continuation lines.
4014 This is the default behavior.
4015
4016 -fdiagnostics-show-location=every-line
4017 Only meaningful in line-wrapping mode. Instructs the diagnostic
4018 messages reporter to emit the same source location information (as
4019 prefix) for physical lines that result from the process of breaking
4020 a message which is too long to fit on a single line.
4021
4022 -fdiagnostics-color[=WHEN]
4023 -fno-diagnostics-color
4024 Use color in diagnostics. WHEN is never, always, or auto. The
4025 default depends on how the compiler has been configured, it can be
4026 any of the above WHEN options or also never if GCC_COLORS
4027 environment variable isn't present in the environment, and auto
4028 otherwise. auto makes GCC use color only when the standard error
4029 is a terminal, and when not executing in an emacs shell. The forms
4030 -fdiagnostics-color and -fno-diagnostics-color are aliases for
4031 -fdiagnostics-color=always and -fdiagnostics-color=never,
4032 respectively.
4033
4034 The colors are defined by the environment variable GCC_COLORS. Its
4035 value is a colon-separated list of capabilities and Select Graphic
4036 Rendition (SGR) substrings. SGR commands are interpreted by the
4037 terminal or terminal emulator. (See the section in the
4038 documentation of your text terminal for permitted values and their
4039 meanings as character attributes.) These substring values are
4040 integers in decimal representation and can be concatenated with
4041 semicolons. Common values to concatenate include 1 for bold, 4 for
4042 underline, 5 for blink, 7 for inverse, 39 for default foreground
4043 color, 30 to 37 for foreground colors, 90 to 97 for 16-color mode
4044 foreground colors, 38;5;0 to 38;5;255 for 88-color and 256-color
4045 modes foreground colors, 49 for default background color, 40 to 47
4046 for background colors, 100 to 107 for 16-color mode background
4047 colors, and 48;5;0 to 48;5;255 for 88-color and 256-color modes
4048 background colors.
4049
4050 The default GCC_COLORS is
4051
4052 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
4053 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
4054 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
4055 type-diff=01;32:fnname=01;32:targs=35
4056
4057 where 01;31 is bold red, 01;35 is bold magenta, 01;36 is bold cyan,
4058 32 is green, 34 is blue, 01 is bold, and 31 is red. Setting
4059 GCC_COLORS to the empty string disables colors. Supported
4060 capabilities are as follows.
4061
4062 "error="
4063 SGR substring for error: markers.
4064
4065 "warning="
4066 SGR substring for warning: markers.
4067
4068 "note="
4069 SGR substring for note: markers.
4070
4071 "path="
4072 SGR substring for colorizing paths of control-flow events as
4073 printed via -fdiagnostics-path-format=, such as the identifiers
4074 of individual events and lines indicating interprocedural calls
4075 and returns.
4076
4077 "range1="
4078 SGR substring for first additional range.
4079
4080 "range2="
4081 SGR substring for second additional range.
4082
4083 "locus="
4084 SGR substring for location information, file:line or
4085 file:line:column etc.
4086
4087 "quote="
4088 SGR substring for information printed within quotes.
4089
4090 "fnname="
4091 SGR substring for names of C++ functions.
4092
4093 "targs="
4094 SGR substring for C++ function template parameter bindings.
4095
4096 "fixit-insert="
4097 SGR substring for fix-it hints suggesting text to be inserted
4098 or replaced.
4099
4100 "fixit-delete="
4101 SGR substring for fix-it hints suggesting text to be deleted.
4102
4103 "diff-filename="
4104 SGR substring for filename headers within generated patches.
4105
4106 "diff-hunk="
4107 SGR substring for the starts of hunks within generated patches.
4108
4109 "diff-delete="
4110 SGR substring for deleted lines within generated patches.
4111
4112 "diff-insert="
4113 SGR substring for inserted lines within generated patches.
4114
4115 "type-diff="
4116 SGR substring for highlighting mismatching types within
4117 template arguments in the C++ frontend.
4118
4119 -fdiagnostics-urls[=WHEN]
4120 Use escape sequences to embed URLs in diagnostics. For example,
4121 when -fdiagnostics-show-option emits text showing the command-line
4122 option controlling a diagnostic, embed a URL for documentation of
4123 that option.
4124
4125 WHEN is never, always, or auto. auto makes GCC use URL escape
4126 sequences only when the standard error is a terminal, and when not
4127 executing in an emacs shell or any graphical terminal which is
4128 known to be incompatible with this feature, see below.
4129
4130 The default depends on how the compiler has been configured. It
4131 can be any of the above WHEN options.
4132
4133 GCC can also be configured (via the
4134 --with-diagnostics-urls=auto-if-env configure-time option) so that
4135 the default is affected by environment variables. Under such a
4136 configuration, GCC defaults to using auto if either GCC_URLS or
4137 TERM_URLS environment variables are present and non-empty in the
4138 environment of the compiler, or never if neither are.
4139
4140 However, even with -fdiagnostics-urls=always the behavior is
4141 dependent on those environment variables: If GCC_URLS is set to
4142 empty or no, do not embed URLs in diagnostics. If set to st, URLs
4143 use ST escape sequences. If set to bel, the default, URLs use BEL
4144 escape sequences. Any other non-empty value enables the feature.
4145 If GCC_URLS is not set, use TERM_URLS as a fallback. Note: ST is
4146 an ANSI escape sequence, string terminator ESC \, BEL is an ASCII
4147 character, CTRL-G that usually sounds like a beep.
4148
4149 At this time GCC tries to detect also a few terminals that are
4150 known to not implement the URL feature, and have bugs or at least
4151 had bugs in some versions that are still in use, where the URL
4152 escapes are likely to misbehave, i.e. print garbage on the screen.
4153 That list is currently xfce4-terminal, certain known to be buggy
4154 gnome-terminal versions, the linux console, and mingw. This check
4155 can be skipped with the -fdiagnostics-urls=always.
4156
4157 -fno-diagnostics-show-option
4158 By default, each diagnostic emitted includes text indicating the
4159 command-line option that directly controls the diagnostic (if such
4160 an option is known to the diagnostic machinery). Specifying the
4161 -fno-diagnostics-show-option flag suppresses that behavior.
4162
4163 -fno-diagnostics-show-caret
4164 By default, each diagnostic emitted includes the original source
4165 line and a caret ^ indicating the column. This option suppresses
4166 this information. The source line is truncated to n characters, if
4167 the -fmessage-length=n option is given. When the output is done to
4168 the terminal, the width is limited to the width given by the
4169 COLUMNS environment variable or, if not set, to the terminal width.
4170
4171 -fno-diagnostics-show-labels
4172 By default, when printing source code (via
4173 -fdiagnostics-show-caret), diagnostics can label ranges of source
4174 code with pertinent information, such as the types of expressions:
4175
4176 printf ("foo %s bar", long_i + long_j);
4177 ~^ ~~~~~~~~~~~~~~~
4178 | |
4179 char * long int
4180
4181 This option suppresses the printing of these labels (in the example
4182 above, the vertical bars and the "char *" and "long int" text).
4183
4184 -fno-diagnostics-show-cwe
4185 Diagnostic messages can optionally have an associated
4186 CWE ("https://cwe.mitre.org/index.html") identifier. GCC itself
4187 only provides such metadata for some of the -fanalyzer diagnostics.
4188 GCC plugins may also provide diagnostics with such metadata. By
4189 default, if this information is present, it will be printed with
4190 the diagnostic. This option suppresses the printing of this
4191 metadata.
4192
4193 -fno-diagnostics-show-rules
4194 Diagnostic messages can optionally have rules associated with them,
4195 such as from a coding standard, or a specification. GCC itself
4196 does not do this for any of its diagnostics, but plugins may do so.
4197 By default, if this information is present, it will be printed with
4198 the diagnostic. This option suppresses the printing of this
4199 metadata.
4200
4201 -fno-diagnostics-show-line-numbers
4202 By default, when printing source code (via
4203 -fdiagnostics-show-caret), a left margin is printed, showing line
4204 numbers. This option suppresses this left margin.
4205
4206 -fdiagnostics-minimum-margin-width=width
4207 This option controls the minimum width of the left margin printed
4208 by -fdiagnostics-show-line-numbers. It defaults to 6.
4209
4210 -fdiagnostics-parseable-fixits
4211 Emit fix-it hints in a machine-parseable format, suitable for
4212 consumption by IDEs. For each fix-it, a line will be printed after
4213 the relevant diagnostic, starting with the string "fix-it:". For
4214 example:
4215
4216 fix-it:"test.c":{45:3-45:21}:"gtk_widget_show_all"
4217
4218 The location is expressed as a half-open range, expressed as a
4219 count of bytes, starting at byte 1 for the initial column. In the
4220 above example, bytes 3 through 20 of line 45 of "test.c" are to be
4221 replaced with the given string:
4222
4223 00000000011111111112222222222
4224 12345678901234567890123456789
4225 gtk_widget_showall (dlg);
4226 ^^^^^^^^^^^^^^^^^^
4227 gtk_widget_show_all
4228
4229 The filename and replacement string escape backslash as "\\", tab
4230 as "\t", newline as "\n", double quotes as "\"", non-printable
4231 characters as octal (e.g. vertical tab as "\013").
4232
4233 An empty replacement string indicates that the given range is to be
4234 removed. An empty range (e.g. "45:3-45:3") indicates that the
4235 string is to be inserted at the given position.
4236
4237 -fdiagnostics-generate-patch
4238 Print fix-it hints to stderr in unified diff format, after any
4239 diagnostics are printed. For example:
4240
4241 --- test.c
4242 +++ test.c
4243 @ -42,5 +42,5 @
4244
4245 void show_cb(GtkDialog *dlg)
4246 {
4247 - gtk_widget_showall(dlg);
4248 + gtk_widget_show_all(dlg);
4249 }
4250
4251 The diff may or may not be colorized, following the same rules as
4252 for diagnostics (see -fdiagnostics-color).
4253
4254 -fdiagnostics-show-template-tree
4255 In the C++ frontend, when printing diagnostics showing mismatching
4256 template types, such as:
4257
4258 could not convert 'std::map<int, std::vector<double> >()'
4259 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4260
4261 the -fdiagnostics-show-template-tree flag enables printing a tree-
4262 like structure showing the common and differing parts of the types,
4263 such as:
4264
4265 map<
4266 [...],
4267 vector<
4268 [double != float]>>
4269
4270 The parts that differ are highlighted with color ("double" and
4271 "float" in this case).
4272
4273 -fno-elide-type
4274 By default when the C++ frontend prints diagnostics showing
4275 mismatching template types, common parts of the types are printed
4276 as "[...]" to simplify the error message. For example:
4277
4278 could not convert 'std::map<int, std::vector<double> >()'
4279 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4280
4281 Specifying the -fno-elide-type flag suppresses that behavior. This
4282 flag also affects the output of the
4283 -fdiagnostics-show-template-tree flag.
4284
4285 -fdiagnostics-path-format=KIND
4286 Specify how to print paths of control-flow events for diagnostics
4287 that have such a path associated with them.
4288
4289 KIND is none, separate-events, or inline-events, the default.
4290
4291 none means to not print diagnostic paths.
4292
4293 separate-events means to print a separate "note" diagnostic for
4294 each event within the diagnostic. For example:
4295
4296 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
4297 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
4298 test.c:27:3: note: (2) when 'i < count'
4299 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4300
4301 inline-events means to print the events "inline" within the source
4302 code. This view attempts to consolidate the events into runs of
4303 sufficiently-close events, printing them as labelled ranges within
4304 the source.
4305
4306 For example, the same events as above might be printed as:
4307
4308 'test': events 1-3
4309 |
4310 | 25 | list = PyList_New(0);
4311 | | ^~~~~~~~~~~~~
4312 | | |
4313 | | (1) when 'PyList_New' fails, returning NULL
4314 | 26 |
4315 | 27 | for (i = 0; i < count; i++) {
4316 | | ~~~
4317 | | |
4318 | | (2) when 'i < count'
4319 | 28 | item = PyLong_FromLong(random());
4320 | 29 | PyList_Append(list, item);
4321 | | ~~~~~~~~~~~~~~~~~~~~~~~~~
4322 | | |
4323 | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4324 |
4325
4326 Interprocedural control flow is shown by grouping the events by
4327 stack frame, and using indentation to show how stack frames are
4328 nested, pushed, and popped.
4329
4330 For example:
4331
4332 'test': events 1-2
4333 |
4334 | 133 | {
4335 | | ^
4336 | | |
4337 | | (1) entering 'test'
4338 | 134 | boxed_int *obj = make_boxed_int (i);
4339 | | ~~~~~~~~~~~~~~~~~~
4340 | | |
4341 | | (2) calling 'make_boxed_int'
4342 |
4343 +--> 'make_boxed_int': events 3-4
4344 |
4345 | 120 | {
4346 | | ^
4347 | | |
4348 | | (3) entering 'make_boxed_int'
4349 | 121 | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
4350 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4351 | | |
4352 | | (4) calling 'wrapped_malloc'
4353 |
4354 +--> 'wrapped_malloc': events 5-6
4355 |
4356 | 7 | {
4357 | | ^
4358 | | |
4359 | | (5) entering 'wrapped_malloc'
4360 | 8 | return malloc (size);
4361 | | ~~~~~~~~~~~~~
4362 | | |
4363 | | (6) calling 'malloc'
4364 |
4365 <-------------+
4366 |
4367 'test': event 7
4368 |
4369 | 138 | free_boxed_int (obj);
4370 | | ^~~~~~~~~~~~~~~~~~~~
4371 | | |
4372 | | (7) calling 'free_boxed_int'
4373 |
4374 (etc)
4375
4376 -fdiagnostics-show-path-depths
4377 This option provides additional information when printing control-
4378 flow paths associated with a diagnostic.
4379
4380 If this is option is provided then the stack depth will be printed
4381 for each run of events within
4382 -fdiagnostics-path-format=inline-events. If provided with
4383 -fdiagnostics-path-format=separate-events, then the stack depth and
4384 function declaration will be appended when printing each event.
4385
4386 This is intended for use by GCC developers and plugin developers
4387 when debugging diagnostics that report interprocedural control
4388 flow.
4389
4390 -fno-show-column
4391 Do not print column numbers in diagnostics. This may be necessary
4392 if diagnostics are being scanned by a program that does not
4393 understand the column numbers, such as dejagnu.
4394
4395 -fdiagnostics-column-unit=UNIT
4396 Select the units for the column number. This affects traditional
4397 diagnostics (in the absence of -fno-show-column), as well as JSON
4398 format diagnostics if requested.
4399
4400 The default UNIT, display, considers the number of display columns
4401 occupied by each character. This may be larger than the number of
4402 bytes required to encode the character, in the case of tab
4403 characters, or it may be smaller, in the case of multibyte
4404 characters. For example, the character "GREEK SMALL LETTER PI
4405 (U+03C0)" occupies one display column, and its UTF-8 encoding
4406 requires two bytes; the character "SLIGHTLY SMILING FACE (U+1F642)"
4407 occupies two display columns, and its UTF-8 encoding requires four
4408 bytes.
4409
4410 Setting UNIT to byte changes the column number to the raw byte
4411 count in all cases, as was traditionally output by GCC prior to
4412 version 11.1.0.
4413
4414 -fdiagnostics-column-origin=ORIGIN
4415 Select the origin for column numbers, i.e. the column number
4416 assigned to the first column. The default value of 1 corresponds
4417 to traditional GCC behavior and to the GNU style guide. Some
4418 utilities may perform better with an origin of 0; any non-negative
4419 value may be specified.
4420
4421 -fdiagnostics-escape-format=FORMAT
4422 When GCC prints pertinent source lines for a diagnostic it normally
4423 attempts to print the source bytes directly. However, some
4424 diagnostics relate to encoding issues in the source file, such as
4425 malformed UTF-8, or issues with Unicode normalization. These
4426 diagnostics are flagged so that GCC will escape bytes that are not
4427 printable ASCII when printing their pertinent source lines.
4428
4429 This option controls how such bytes should be escaped.
4430
4431 The default FORMAT, unicode displays Unicode characters that are
4432 not printable ASCII in the form <U+XXXX>, and bytes that do not
4433 correspond to a Unicode character validly-encoded in UTF-8-encoded
4434 will be displayed as hexadecimal in the form <XX>.
4435
4436 For example, a source line containing the string before followed by
4437 the Unicode character U+03C0 ("GREEK SMALL LETTER PI", with UTF-8
4438 encoding 0xCF 0x80) followed by the byte 0xBF (a stray UTF-8
4439 trailing byte), followed by the string after will be printed for
4440 such a diagnostic as:
4441
4442 before<U+03C0><BF>after
4443
4444 Setting FORMAT to bytes will display all non-printable-ASCII bytes
4445 in the form <XX>, thus showing the underlying encoding of non-ASCII
4446 Unicode characters. For the example above, the following will be
4447 printed:
4448
4449 before<CF><80><BF>after
4450
4451 -fdiagnostics-format=FORMAT
4452 Select a different format for printing diagnostics. FORMAT is
4453 text, sarif-stderr, sarif-file, json, json-stderr, or json-file.
4454
4455 The default is text.
4456
4457 The sarif-stderr and sarif-file formats both emit diagnostics in
4458 SARIF Version 2.1.0 format, either to stderr, or to a file named
4459 source.sarif, respectively.
4460
4461 The json format is a synonym for json-stderr. The json-stderr and
4462 json-file formats are identical, apart from where the JSON is
4463 emitted to - with the former, the JSON is emitted to stderr,
4464 whereas with json-file it is written to source.gcc.json.
4465
4466 The emitted JSON consists of a top-level JSON array containing JSON
4467 objects representing the diagnostics. The JSON is emitted as one
4468 line, without formatting; the examples below have been formatted
4469 for clarity.
4470
4471 Diagnostics can have child diagnostics. For example, this error
4472 and note:
4473
4474 misleading-indentation.c:15:3: warning: this 'if' clause does not
4475 guard... [-Wmisleading-indentation]
4476 15 | if (flag)
4477 | ^~
4478 misleading-indentation.c:17:5: note: ...this statement, but the latter
4479 is misleadingly indented as if it were guarded by the 'if'
4480 17 | y = 2;
4481 | ^
4482
4483 might be printed in JSON form (after formatting) like this:
4484
4485 [
4486 {
4487 "kind": "warning",
4488 "locations": [
4489 {
4490 "caret": {
4491 "display-column": 3,
4492 "byte-column": 3,
4493 "column": 3,
4494 "file": "misleading-indentation.c",
4495 "line": 15
4496 },
4497 "finish": {
4498 "display-column": 4,
4499 "byte-column": 4,
4500 "column": 4,
4501 "file": "misleading-indentation.c",
4502 "line": 15
4503 }
4504 }
4505 ],
4506 "message": "this \u2018if\u2019 clause does not guard...",
4507 "option": "-Wmisleading-indentation",
4508 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
4509 "children": [
4510 {
4511 "kind": "note",
4512 "locations": [
4513 {
4514 "caret": {
4515 "display-column": 5,
4516 "byte-column": 5,
4517 "column": 5,
4518 "file": "misleading-indentation.c",
4519 "line": 17
4520 }
4521 }
4522 ],
4523 "escape-source": false,
4524 "message": "...this statement, but the latter is ..."
4525 }
4526 ]
4527 "escape-source": false,
4528 "column-origin": 1,
4529 }
4530 ]
4531
4532 where the "note" is a child of the "warning".
4533
4534 A diagnostic has a "kind". If this is "warning", then there is an
4535 "option" key describing the command-line option controlling the
4536 warning.
4537
4538 A diagnostic can contain zero or more locations. Each location has
4539 an optional "label" string and up to three positions within it: a
4540 "caret" position and optional "start" and "finish" positions. A
4541 position is described by a "file" name, a "line" number, and three
4542 numbers indicating a column position:
4543
4544 * "display-column" counts display columns, accounting for tabs
4545 and multibyte characters.
4546
4547 * "byte-column" counts raw bytes.
4548
4549 * "column" is equal to one of the previous two, as dictated by
4550 the -fdiagnostics-column-unit option.
4551
4552 All three columns are relative to the origin specified by
4553 -fdiagnostics-column-origin, which is typically equal to 1 but may
4554 be set, for instance, to 0 for compatibility with other utilities
4555 that number columns from 0. The column origin is recorded in the
4556 JSON output in the "column-origin" tag. In the remaining examples
4557 below, the extra column number outputs have been omitted for
4558 brevity.
4559
4560 For example, this error:
4561
4562 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' {aka
4563 'struct s'} and 'T' {aka 'struct t'})
4564 64 | return callee_4a () + callee_4b ();
4565 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4566 | | |
4567 | | T {aka struct t}
4568 | S {aka struct s}
4569
4570 has three locations. Its primary location is at the "+" token at
4571 column 23. It has two secondary locations, describing the left and
4572 right-hand sides of the expression, which have labels. It might be
4573 printed in JSON form as:
4574
4575 {
4576 "children": [],
4577 "kind": "error",
4578 "locations": [
4579 {
4580 "caret": {
4581 "column": 23, "file": "bad-binary-ops.c", "line": 64
4582 }
4583 },
4584 {
4585 "caret": {
4586 "column": 10, "file": "bad-binary-ops.c", "line": 64
4587 },
4588 "finish": {
4589 "column": 21, "file": "bad-binary-ops.c", "line": 64
4590 },
4591 "label": "S {aka struct s}"
4592 },
4593 {
4594 "caret": {
4595 "column": 25, "file": "bad-binary-ops.c", "line": 64
4596 },
4597 "finish": {
4598 "column": 36, "file": "bad-binary-ops.c", "line": 64
4599 },
4600 "label": "T {aka struct t}"
4601 }
4602 ],
4603 "escape-source": false,
4604 "message": "invalid operands to binary + ..."
4605 }
4606
4607 If a diagnostic contains fix-it hints, it has a "fixits" array,
4608 consisting of half-open intervals, similar to the output of
4609 -fdiagnostics-parseable-fixits. For example, this diagnostic with
4610 a replacement fix-it hint:
4611
4612 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4613 mean 'color'?
4614 8 | return ptr->colour;
4615 | ^~~~~~
4616 | color
4617
4618 might be printed in JSON form as:
4619
4620 {
4621 "children": [],
4622 "fixits": [
4623 {
4624 "next": {
4625 "column": 21,
4626 "file": "demo.c",
4627 "line": 8
4628 },
4629 "start": {
4630 "column": 15,
4631 "file": "demo.c",
4632 "line": 8
4633 },
4634 "string": "color"
4635 }
4636 ],
4637 "kind": "error",
4638 "locations": [
4639 {
4640 "caret": {
4641 "column": 15,
4642 "file": "demo.c",
4643 "line": 8
4644 },
4645 "finish": {
4646 "column": 20,
4647 "file": "demo.c",
4648 "line": 8
4649 }
4650 }
4651 ],
4652 "escape-source": false,
4653 "message": "\u2018struct s\u2019 has no member named ..."
4654 }
4655
4656 where the fix-it hint suggests replacing the text from "start" up
4657 to but not including "next" with "string"'s value. Deletions are
4658 expressed via an empty value for "string", insertions by having
4659 "start" equal "next".
4660
4661 If the diagnostic has a path of control-flow events associated with
4662 it, it has a "path" array of objects representing the events. Each
4663 event object has a "description" string, a "location" object, along
4664 with a "function" string and a "depth" number for representing
4665 interprocedural paths. The "function" represents the current
4666 function at that event, and the "depth" represents the stack depth
4667 relative to some baseline: the higher, the more frames are within
4668 the stack.
4669
4670 For example, the intraprocedural example shown for
4671 -fdiagnostics-path-format= might have this JSON for its path:
4672
4673 "path": [
4674 {
4675 "depth": 0,
4676 "description": "when 'PyList_New' fails, returning NULL",
4677 "function": "test",
4678 "location": {
4679 "column": 10,
4680 "file": "test.c",
4681 "line": 25
4682 }
4683 },
4684 {
4685 "depth": 0,
4686 "description": "when 'i < count'",
4687 "function": "test",
4688 "location": {
4689 "column": 3,
4690 "file": "test.c",
4691 "line": 27
4692 }
4693 },
4694 {
4695 "depth": 0,
4696 "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
4697 "function": "test",
4698 "location": {
4699 "column": 5,
4700 "file": "test.c",
4701 "line": 29
4702 }
4703 }
4704 ]
4705
4706 Diagnostics have a boolean attribute "escape-source", hinting
4707 whether non-ASCII bytes should be escaped when printing the
4708 pertinent lines of source code ("true" for diagnostics involving
4709 source encoding issues).
4710
4711 Options to Request or Suppress Warnings
4712 Warnings are diagnostic messages that report constructions that are not
4713 inherently erroneous but that are risky or suggest there may have been
4714 an error.
4715
4716 The following language-independent options do not enable specific
4717 warnings but control the kinds of diagnostics produced by GCC.
4718
4719 -fsyntax-only
4720 Check the code for syntax errors, but don't do anything beyond
4721 that.
4722
4723 -fmax-errors=n
4724 Limits the maximum number of error messages to n, at which point
4725 GCC bails out rather than attempting to continue processing the
4726 source code. If n is 0 (the default), there is no limit on the
4727 number of error messages produced. If -Wfatal-errors is also
4728 specified, then -Wfatal-errors takes precedence over this option.
4729
4730 -w Inhibit all warning messages.
4731
4732 -Werror
4733 Make all warnings into errors.
4734
4735 -Werror=
4736 Make the specified warning into an error. The specifier for a
4737 warning is appended; for example -Werror=switch turns the warnings
4738 controlled by -Wswitch into errors. This switch takes a negative
4739 form, to be used to negate -Werror for specific warnings; for
4740 example -Wno-error=switch makes -Wswitch warnings not be errors,
4741 even when -Werror is in effect.
4742
4743 The warning message for each controllable warning includes the
4744 option that controls the warning. That option can then be used
4745 with -Werror= and -Wno-error= as described above. (Printing of the
4746 option in the warning message can be disabled using the
4747 -fno-diagnostics-show-option flag.)
4748
4749 Note that specifying -Werror=foo automatically implies -Wfoo.
4750 However, -Wno-error=foo does not imply anything.
4751
4752 -Wfatal-errors
4753 This option causes the compiler to abort compilation on the first
4754 error occurred rather than trying to keep going and printing
4755 further error messages.
4756
4757 You can request many specific warnings with options beginning with -W,
4758 for example -Wimplicit to request warnings on implicit declarations.
4759 Each of these specific warning options also has a negative form
4760 beginning -Wno- to turn off warnings; for example, -Wno-implicit. This
4761 manual lists only one of the two forms, whichever is not the default.
4762 For further language-specific options also refer to C++ Dialect Options
4763 and Objective-C and Objective-C++ Dialect Options. Additional warnings
4764 can be produced by enabling the static analyzer;
4765
4766 Some options, such as -Wall and -Wextra, turn on other options, such as
4767 -Wunused, which may turn on further options, such as -Wunused-value.
4768 The combined effect of positive and negative forms is that more
4769 specific options have priority over less specific ones, independently
4770 of their position in the command-line. For options of the same
4771 specificity, the last one takes effect. Options enabled or disabled via
4772 pragmas take effect as if they appeared at the end of the command-line.
4773
4774 When an unrecognized warning option is requested (e.g.,
4775 -Wunknown-warning), GCC emits a diagnostic stating that the option is
4776 not recognized. However, if the -Wno- form is used, the behavior is
4777 slightly different: no diagnostic is produced for -Wno-unknown-warning
4778 unless other diagnostics are being produced. This allows the use of
4779 new -Wno- options with old compilers, but if something goes wrong, the
4780 compiler warns that an unrecognized option is present.
4781
4782 The effectiveness of some warnings depends on optimizations also being
4783 enabled. For example -Wsuggest-final-types is more effective with link-
4784 time optimization and some instances of other warnings may not be
4785 issued at all unless optimization is enabled. While optimization in
4786 general improves the efficacy of control and data flow sensitive
4787 warnings, in some cases it may also cause false positives.
4788
4789 -Wpedantic
4790 -pedantic
4791 Issue all the warnings demanded by strict ISO C and ISO C++; reject
4792 all programs that use forbidden extensions, and some other programs
4793 that do not follow ISO C and ISO C++. For ISO C, follows the
4794 version of the ISO C standard specified by any -std option used.
4795
4796 Valid ISO C and ISO C++ programs should compile properly with or
4797 without this option (though a rare few require -ansi or a -std
4798 option specifying the required version of ISO C). However, without
4799 this option, certain GNU extensions and traditional C and C++
4800 features are supported as well. With this option, they are
4801 rejected.
4802
4803 -Wpedantic does not cause warning messages for use of the alternate
4804 keywords whose names begin and end with __. This alternate format
4805 can also be used to disable warnings for non-ISO __intN types, i.e.
4806 __intN__. Pedantic warnings are also disabled in the expression
4807 that follows "__extension__". However, only system header files
4808 should use these escape routes; application programs should avoid
4809 them.
4810
4811 Some users try to use -Wpedantic to check programs for strict ISO C
4812 conformance. They soon find that it does not do quite what they
4813 want: it finds some non-ISO practices, but not all---only those for
4814 which ISO C requires a diagnostic, and some others for which
4815 diagnostics have been added.
4816
4817 A feature to report any failure to conform to ISO C might be useful
4818 in some instances, but would require considerable additional work
4819 and would be quite different from -Wpedantic. We don't have plans
4820 to support such a feature in the near future.
4821
4822 Where the standard specified with -std represents a GNU extended
4823 dialect of C, such as gnu90 or gnu99, there is a corresponding base
4824 standard, the version of ISO C on which the GNU extended dialect is
4825 based. Warnings from -Wpedantic are given where they are required
4826 by the base standard. (It does not make sense for such warnings to
4827 be given only for features not in the specified GNU C dialect,
4828 since by definition the GNU dialects of C include all features the
4829 compiler supports with the given option, and there would be nothing
4830 to warn about.)
4831
4832 -pedantic-errors
4833 Give an error whenever the base standard (see -Wpedantic) requires
4834 a diagnostic, in some cases where there is undefined behavior at
4835 compile-time and in some other cases that do not prevent
4836 compilation of programs that are valid according to the standard.
4837 This is not equivalent to -Werror=pedantic, since there are errors
4838 enabled by this option and not enabled by the latter and vice
4839 versa.
4840
4841 -Wall
4842 This enables all the warnings about constructions that some users
4843 consider questionable, and that are easy to avoid (or modify to
4844 prevent the warning), even in conjunction with macros. This also
4845 enables some language-specific warnings described in C++ Dialect
4846 Options and Objective-C and Objective-C++ Dialect Options.
4847
4848 -Wall turns on the following warning flags:
4849
4850 -Waddress -Warray-bounds=1 (only with -O2) -Warray-compare
4851 -Warray-parameter=2 (C and Objective-C only) -Wbool-compare
4852 -Wbool-operation -Wc++11-compat -Wc++14-compat -Wcatch-value (C++
4853 and Objective-C++ only) -Wchar-subscripts -Wcomment
4854 -Wdangling-pointer=2 -Wduplicate-decl-specifier (C and Objective-C
4855 only) -Wenum-compare (in C/ObjC; this is on by default in C++)
4856 -Wenum-int-mismatch (C and Objective-C only) -Wformat
4857 -Wformat-overflow -Wformat-truncation -Wint-in-bool-context
4858 -Wimplicit (C and Objective-C only) -Wimplicit-int (C and
4859 Objective-C only) -Wimplicit-function-declaration (C and Objective-
4860 C only) -Winit-self (only for C++) -Wlogical-not-parentheses -Wmain
4861 (only for C/ObjC and unless -ffreestanding) -Wmaybe-uninitialized
4862 -Wmemset-elt-size -Wmemset-transposed-args -Wmisleading-indentation
4863 (only for C/C++) -Wmismatched-dealloc -Wmismatched-new-delete (only
4864 for C/C++) -Wmissing-attributes -Wmissing-braces (only for C/ObjC)
4865 -Wmultistatement-macros -Wnarrowing (only for C++) -Wnonnull
4866 -Wnonnull-compare -Wopenmp-simd -Wparentheses -Wpessimizing-move
4867 (only for C++) -Wpointer-sign -Wrange-loop-construct (only for C++)
4868 -Wreorder -Wrestrict -Wreturn-type -Wself-move (only for C++)
4869 -Wsequence-point -Wsign-compare (only in C++) -Wsizeof-array-div
4870 -Wsizeof-pointer-div -Wsizeof-pointer-memaccess -Wstrict-aliasing
4871 -Wstrict-overflow=1 -Wswitch -Wtautological-compare -Wtrigraphs
4872 -Wuninitialized -Wunknown-pragmas -Wunused-function -Wunused-label
4873 -Wunused-value -Wunused-variable -Wuse-after-free=2 -Wvla-parameter
4874 (C and Objective-C only) -Wvolatile-register-var
4875 -Wzero-length-bounds
4876
4877 Note that some warning flags are not implied by -Wall. Some of
4878 them warn about constructions that users generally do not consider
4879 questionable, but which occasionally you might wish to check for;
4880 others warn about constructions that are necessary or hard to avoid
4881 in some cases, and there is no simple way to modify the code to
4882 suppress the warning. Some of them are enabled by -Wextra but many
4883 of them must be enabled individually.
4884
4885 -Wextra
4886 This enables some extra warning flags that are not enabled by
4887 -Wall. (This option used to be called -W. The older name is still
4888 supported, but the newer name is more descriptive.)
4889
4890 -Wclobbered -Wcast-function-type -Wdangling-reference (C++ only)
4891 -Wdeprecated-copy (C++ only) -Wempty-body -Wenum-conversion (C
4892 only) -Wignored-qualifiers -Wimplicit-fallthrough=3
4893 -Wmissing-field-initializers -Wmissing-parameter-type (C only)
4894 -Wold-style-declaration (C only) -Woverride-init -Wsign-compare (C
4895 only) -Wstring-compare -Wredundant-move (only for C++)
4896 -Wtype-limits -Wuninitialized -Wshift-negative-value (in C++11 to
4897 C++17 and in C99 and newer) -Wunused-parameter (only with -Wunused
4898 or -Wall) -Wunused-but-set-parameter (only with -Wunused or -Wall)
4899
4900 The option -Wextra also prints warning messages for the following
4901 cases:
4902
4903 * A pointer is compared against integer zero with "<", "<=", ">",
4904 or ">=".
4905
4906 * (C++ only) An enumerator and a non-enumerator both appear in a
4907 conditional expression.
4908
4909 * (C++ only) Ambiguous virtual bases.
4910
4911 * (C++ only) Subscripting an array that has been declared
4912 "register".
4913
4914 * (C++ only) Taking the address of a variable that has been
4915 declared "register".
4916
4917 * (C++ only) A base class is not initialized in the copy
4918 constructor of a derived class.
4919
4920 -Wabi (C, Objective-C, C++ and Objective-C++ only)
4921 Warn about code affected by ABI changes. This includes code that
4922 may not be compatible with the vendor-neutral C++ ABI as well as
4923 the psABI for the particular target.
4924
4925 Since G++ now defaults to updating the ABI with each major release,
4926 normally -Wabi warns only about C++ ABI compatibility problems if
4927 there is a check added later in a release series for an ABI issue
4928 discovered since the initial release. -Wabi warns about more
4929 things if an older ABI version is selected (with -fabi-version=n).
4930
4931 -Wabi can also be used with an explicit version number to warn
4932 about C++ ABI compatibility with a particular -fabi-version level,
4933 e.g. -Wabi=2 to warn about changes relative to -fabi-version=2.
4934
4935 If an explicit version number is provided and -fabi-compat-version
4936 is not specified, the version number from this option is used for
4937 compatibility aliases. If no explicit version number is provided
4938 with this option, but -fabi-compat-version is specified, that
4939 version number is used for C++ ABI warnings.
4940
4941 Although an effort has been made to warn about all such cases,
4942 there are probably some cases that are not warned about, even
4943 though G++ is generating incompatible code. There may also be
4944 cases where warnings are emitted even though the code that is
4945 generated is compatible.
4946
4947 You should rewrite your code to avoid these warnings if you are
4948 concerned about the fact that code generated by G++ may not be
4949 binary compatible with code generated by other compilers.
4950
4951 Known incompatibilities in -fabi-version=2 (which was the default
4952 from GCC 3.4 to 4.9) include:
4953
4954 * A template with a non-type template parameter of reference type
4955 was mangled incorrectly:
4956
4957 extern int N;
4958 template <int &> struct S {};
4959 void n (S<N>) {2}
4960
4961 This was fixed in -fabi-version=3.
4962
4963 * SIMD vector types declared using "__attribute ((vector_size))"
4964 were mangled in a non-standard way that does not allow for
4965 overloading of functions taking vectors of different sizes.
4966
4967 The mangling was changed in -fabi-version=4.
4968
4969 * "__attribute ((const))" and "noreturn" were mangled as type
4970 qualifiers, and "decltype" of a plain declaration was folded
4971 away.
4972
4973 These mangling issues were fixed in -fabi-version=5.
4974
4975 * Scoped enumerators passed as arguments to a variadic function
4976 are promoted like unscoped enumerators, causing "va_arg" to
4977 complain. On most targets this does not actually affect the
4978 parameter passing ABI, as there is no way to pass an argument
4979 smaller than "int".
4980
4981 Also, the ABI changed the mangling of template argument packs,
4982 "const_cast", "static_cast", prefix increment/decrement, and a
4983 class scope function used as a template argument.
4984
4985 These issues were corrected in -fabi-version=6.
4986
4987 * Lambdas in default argument scope were mangled incorrectly, and
4988 the ABI changed the mangling of "nullptr_t".
4989
4990 These issues were corrected in -fabi-version=7.
4991
4992 * When mangling a function type with function-cv-qualifiers, the
4993 un-qualified function type was incorrectly treated as a
4994 substitution candidate.
4995
4996 This was fixed in -fabi-version=8, the default for GCC 5.1.
4997
4998 * decltype(nullptr) incorrectly had an alignment of 1, leading to
4999 unaligned accesses. Note that this did not affect the ABI of a
5000 function with a "nullptr_t" parameter, as parameters have a
5001 minimum alignment.
5002
5003 This was fixed in -fabi-version=9, the default for GCC 5.2.
5004
5005 * Target-specific attributes that affect the identity of a type,
5006 such as ia32 calling conventions on a function type (stdcall,
5007 regparm, etc.), did not affect the mangled name, leading to
5008 name collisions when function pointers were used as template
5009 arguments.
5010
5011 This was fixed in -fabi-version=10, the default for GCC 6.1.
5012
5013 This option also enables warnings about psABI-related changes. The
5014 known psABI changes at this point include:
5015
5016 * For SysV/x86-64, unions with "long double" members are passed
5017 in memory as specified in psABI. Prior to GCC 4.4, this was
5018 not the case. For example:
5019
5020 union U {
5021 long double ld;
5022 int i;
5023 };
5024
5025 "union U" is now always passed in memory.
5026
5027 -Wno-changes-meaning (C++ and Objective-C++ only)
5028 C++ requires that unqualified uses of a name within a class have
5029 the same meaning in the complete scope of the class, so declaring
5030 the name after using it is ill-formed:
5031
5032 struct A;
5033 struct B1 { A a; typedef A A; }; // warning, 'A' changes meaning
5034 struct B2 { A a; struct A { }; }; // error, 'A' changes meaning
5035
5036 By default, the B1 case is only a warning because the two
5037 declarations have the same type, while the B2 case is an error.
5038 Both diagnostics can be disabled with -Wno-changes-meaning.
5039 Alternately, the error case can be reduced to a warning with
5040 -Wno-error=changes-meaning or -fpermissive.
5041
5042 Both diagnostics are also suppressed by -fms-extensions.
5043
5044 -Wchar-subscripts
5045 Warn if an array subscript has type "char". This is a common cause
5046 of error, as programmers often forget that this type is signed on
5047 some machines. This warning is enabled by -Wall.
5048
5049 -Wno-coverage-mismatch
5050 Warn if feedback profiles do not match when using the -fprofile-use
5051 option. If a source file is changed between compiling with
5052 -fprofile-generate and with -fprofile-use, the files with the
5053 profile feedback can fail to match the source file and GCC cannot
5054 use the profile feedback information. By default, this warning is
5055 enabled and is treated as an error. -Wno-coverage-mismatch can be
5056 used to disable the warning or -Wno-error=coverage-mismatch can be
5057 used to disable the error. Disabling the error for this warning
5058 can result in poorly optimized code and is useful only in the case
5059 of very minor changes such as bug fixes to an existing code-base.
5060 Completely disabling the warning is not recommended.
5061
5062 -Wno-coverage-invalid-line-number
5063 Warn in case a function ends earlier than it begins due to an
5064 invalid linenum macros. The warning is emitted only with
5065 --coverage enabled.
5066
5067 By default, this warning is enabled and is treated as an error.
5068 -Wno-coverage-invalid-line-number can be used to disable the
5069 warning or -Wno-error=coverage-invalid-line-number can be used to
5070 disable the error.
5071
5072 -Wno-cpp (C, Objective-C, C++, Objective-C++ and Fortran only)
5073 Suppress warning messages emitted by "#warning" directives.
5074
5075 -Wdouble-promotion (C, C++, Objective-C and Objective-C++ only)
5076 Give a warning when a value of type "float" is implicitly promoted
5077 to "double". CPUs with a 32-bit "single-precision" floating-point
5078 unit implement "float" in hardware, but emulate "double" in
5079 software. On such a machine, doing computations using "double"
5080 values is much more expensive because of the overhead required for
5081 software emulation.
5082
5083 It is easy to accidentally do computations with "double" because
5084 floating-point literals are implicitly of type "double". For
5085 example, in:
5086
5087 float area(float radius)
5088 {
5089 return 3.14159 * radius * radius;
5090 }
5091
5092 the compiler performs the entire computation with "double" because
5093 the floating-point literal is a "double".
5094
5095 -Wduplicate-decl-specifier (C and Objective-C only)
5096 Warn if a declaration has duplicate "const", "volatile", "restrict"
5097 or "_Atomic" specifier. This warning is enabled by -Wall.
5098
5099 -Wformat
5100 -Wformat=n
5101 Check calls to "printf" and "scanf", etc., to make sure that the
5102 arguments supplied have types appropriate to the format string
5103 specified, and that the conversions specified in the format string
5104 make sense. This includes standard functions, and others specified
5105 by format attributes, in the "printf", "scanf", "strftime" and
5106 "strfmon" (an X/Open extension, not in the C standard) families (or
5107 other target-specific families). Which functions are checked
5108 without format attributes having been specified depends on the
5109 standard version selected, and such checks of functions without the
5110 attribute specified are disabled by -ffreestanding or -fno-builtin.
5111
5112 The formats are checked against the format features supported by
5113 GNU libc version 2.2. These include all ISO C90 and C99 features,
5114 as well as features from the Single Unix Specification and some BSD
5115 and GNU extensions. Other library implementations may not support
5116 all these features; GCC does not support warning about features
5117 that go beyond a particular library's limitations. However, if
5118 -Wpedantic is used with -Wformat, warnings are given about format
5119 features not in the selected standard version (but not for
5120 "strfmon" formats, since those are not in any version of the C
5121 standard).
5122
5123 -Wformat=1
5124 -Wformat
5125 Option -Wformat is equivalent to -Wformat=1, and -Wno-format is
5126 equivalent to -Wformat=0. Since -Wformat also checks for null
5127 format arguments for several functions, -Wformat also implies
5128 -Wnonnull. Some aspects of this level of format checking can
5129 be disabled by the options: -Wno-format-contains-nul,
5130 -Wno-format-extra-args, and -Wno-format-zero-length. -Wformat
5131 is enabled by -Wall.
5132
5133 -Wformat=2
5134 Enable -Wformat plus additional format checks. Currently
5135 equivalent to -Wformat -Wformat-nonliteral -Wformat-security
5136 -Wformat-y2k.
5137
5138 -Wno-format-contains-nul
5139 If -Wformat is specified, do not warn about format strings that
5140 contain NUL bytes.
5141
5142 -Wno-format-extra-args
5143 If -Wformat is specified, do not warn about excess arguments to a
5144 "printf" or "scanf" format function. The C standard specifies that
5145 such arguments are ignored.
5146
5147 Where the unused arguments lie between used arguments that are
5148 specified with $ operand number specifications, normally warnings
5149 are still given, since the implementation could not know what type
5150 to pass to "va_arg" to skip the unused arguments. However, in the
5151 case of "scanf" formats, this option suppresses the warning if the
5152 unused arguments are all pointers, since the Single Unix
5153 Specification says that such unused arguments are allowed.
5154
5155 -Wformat-overflow
5156 -Wformat-overflow=level
5157 Warn about calls to formatted input/output functions such as
5158 "sprintf" and "vsprintf" that might overflow the destination
5159 buffer. When the exact number of bytes written by a format
5160 directive cannot be determined at compile-time it is estimated
5161 based on heuristics that depend on the level argument and on
5162 optimization. While enabling optimization will in most cases
5163 improve the accuracy of the warning, it may also result in false
5164 positives.
5165
5166 -Wformat-overflow
5167 -Wformat-overflow=1
5168 Level 1 of -Wformat-overflow enabled by -Wformat employs a
5169 conservative approach that warns only about calls that most
5170 likely overflow the buffer. At this level, numeric arguments
5171 to format directives with unknown values are assumed to have
5172 the value of one, and strings of unknown length to be empty.
5173 Numeric arguments that are known to be bounded to a subrange of
5174 their type, or string arguments whose output is bounded either
5175 by their directive's precision or by a finite set of string
5176 literals, are assumed to take on the value within the range
5177 that results in the most bytes on output. For example, the
5178 call to "sprintf" below is diagnosed because even with both a
5179 and b equal to zero, the terminating NUL character ('\0')
5180 appended by the function to the destination buffer will be
5181 written past its end. Increasing the size of the buffer by a
5182 single byte is sufficient to avoid the warning, though it may
5183 not be sufficient to avoid the overflow.
5184
5185 void f (int a, int b)
5186 {
5187 char buf [13];
5188 sprintf (buf, "a = %i, b = %i\n", a, b);
5189 }
5190
5191 -Wformat-overflow=2
5192 Level 2 warns also about calls that might overflow the
5193 destination buffer given an argument of sufficient length or
5194 magnitude. At level 2, unknown numeric arguments are assumed
5195 to have the minimum representable value for signed types with a
5196 precision greater than 1, and the maximum representable value
5197 otherwise. Unknown string arguments whose length cannot be
5198 assumed to be bounded either by the directive's precision, or
5199 by a finite set of string literals they may evaluate to, or the
5200 character array they may point to, are assumed to be 1
5201 character long.
5202
5203 At level 2, the call in the example above is again diagnosed,
5204 but this time because with a equal to a 32-bit "INT_MIN" the
5205 first %i directive will write some of its digits beyond the end
5206 of the destination buffer. To make the call safe regardless of
5207 the values of the two variables, the size of the destination
5208 buffer must be increased to at least 34 bytes. GCC includes
5209 the minimum size of the buffer in an informational note
5210 following the warning.
5211
5212 An alternative to increasing the size of the destination buffer
5213 is to constrain the range of formatted values. The maximum
5214 length of string arguments can be bounded by specifying the
5215 precision in the format directive. When numeric arguments of
5216 format directives can be assumed to be bounded by less than the
5217 precision of their type, choosing an appropriate length
5218 modifier to the format specifier will reduce the required
5219 buffer size. For example, if a and b in the example above can
5220 be assumed to be within the precision of the "short int" type
5221 then using either the %hi format directive or casting the
5222 argument to "short" reduces the maximum required size of the
5223 buffer to 24 bytes.
5224
5225 void f (int a, int b)
5226 {
5227 char buf [23];
5228 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
5229 }
5230
5231 -Wno-format-zero-length
5232 If -Wformat is specified, do not warn about zero-length formats.
5233 The C standard specifies that zero-length formats are allowed.
5234
5235 -Wformat-nonliteral
5236 If -Wformat is specified, also warn if the format string is not a
5237 string literal and so cannot be checked, unless the format function
5238 takes its format arguments as a "va_list".
5239
5240 -Wformat-security
5241 If -Wformat is specified, also warn about uses of format functions
5242 that represent possible security problems. At present, this warns
5243 about calls to "printf" and "scanf" functions where the format
5244 string is not a string literal and there are no format arguments,
5245 as in "printf (foo);". This may be a security hole if the format
5246 string came from untrusted input and contains %n. (This is
5247 currently a subset of what -Wformat-nonliteral warns about, but in
5248 future warnings may be added to -Wformat-security that are not
5249 included in -Wformat-nonliteral.)
5250
5251 -Wformat-signedness
5252 If -Wformat is specified, also warn if the format string requires
5253 an unsigned argument and the argument is signed and vice versa.
5254
5255 -Wformat-truncation
5256 -Wformat-truncation=level
5257 Warn about calls to formatted input/output functions such as
5258 "snprintf" and "vsnprintf" that might result in output truncation.
5259 When the exact number of bytes written by a format directive cannot
5260 be determined at compile-time it is estimated based on heuristics
5261 that depend on the level argument and on optimization. While
5262 enabling optimization will in most cases improve the accuracy of
5263 the warning, it may also result in false positives. Except as
5264 noted otherwise, the option uses the same logic -Wformat-overflow.
5265
5266 -Wformat-truncation
5267 -Wformat-truncation=1
5268 Level 1 of -Wformat-truncation enabled by -Wformat employs a
5269 conservative approach that warns only about calls to bounded
5270 functions whose return value is unused and that will most
5271 likely result in output truncation.
5272
5273 -Wformat-truncation=2
5274 Level 2 warns also about calls to bounded functions whose
5275 return value is used and that might result in truncation given
5276 an argument of sufficient length or magnitude.
5277
5278 -Wformat-y2k
5279 If -Wformat is specified, also warn about "strftime" formats that
5280 may yield only a two-digit year.
5281
5282 -Wnonnull
5283 Warn about passing a null pointer for arguments marked as requiring
5284 a non-null value by the "nonnull" function attribute.
5285
5286 -Wnonnull is included in -Wall and -Wformat. It can be disabled
5287 with the -Wno-nonnull option.
5288
5289 -Wnonnull-compare
5290 Warn when comparing an argument marked with the "nonnull" function
5291 attribute against null inside the function.
5292
5293 -Wnonnull-compare is included in -Wall. It can be disabled with
5294 the -Wno-nonnull-compare option.
5295
5296 -Wnull-dereference
5297 Warn if the compiler detects paths that trigger erroneous or
5298 undefined behavior due to dereferencing a null pointer. This
5299 option is only active when -fdelete-null-pointer-checks is active,
5300 which is enabled by optimizations in most targets. The precision
5301 of the warnings depends on the optimization options used.
5302
5303 -Winfinite-recursion
5304 Warn about infinitely recursive calls. The warning is effective at
5305 all optimization levels but requires optimization in order to
5306 detect infinite recursion in calls between two or more functions.
5307 -Winfinite-recursion is included in -Wall.
5308
5309 Compare with -Wanalyzer-infinite-recursion which provides a similar
5310 diagnostic, but is implemented in a different way (as part of
5311 -fanalyzer).
5312
5313 -Winit-self (C, C++, Objective-C and Objective-C++ only)
5314 Warn about uninitialized variables that are initialized with
5315 themselves. Note this option can only be used with the
5316 -Wuninitialized option.
5317
5318 For example, GCC warns about "i" being uninitialized in the
5319 following snippet only when -Winit-self has been specified:
5320
5321 int f()
5322 {
5323 int i = i;
5324 return i;
5325 }
5326
5327 This warning is enabled by -Wall in C++.
5328
5329 -Wno-implicit-int (C and Objective-C only)
5330 This option controls warnings when a declaration does not specify a
5331 type. This warning is enabled by default in C99 and later dialects
5332 of C, and also by -Wall.
5333
5334 -Wno-implicit-function-declaration (C and Objective-C only)
5335 This option controls warnings when a function is used before being
5336 declared. This warning is enabled by default in C99 and later
5337 dialects of C, and also by -Wall. The warning is made into an
5338 error by -pedantic-errors.
5339
5340 -Wimplicit (C and Objective-C only)
5341 Same as -Wimplicit-int and -Wimplicit-function-declaration. This
5342 warning is enabled by -Wall.
5343
5344 -Wimplicit-fallthrough
5345 -Wimplicit-fallthrough is the same as -Wimplicit-fallthrough=3 and
5346 -Wno-implicit-fallthrough is the same as -Wimplicit-fallthrough=0.
5347
5348 -Wimplicit-fallthrough=n
5349 Warn when a switch case falls through. For example:
5350
5351 switch (cond)
5352 {
5353 case 1:
5354 a = 1;
5355 break;
5356 case 2:
5357 a = 2;
5358 case 3:
5359 a = 3;
5360 break;
5361 }
5362
5363 This warning does not warn when the last statement of a case cannot
5364 fall through, e.g. when there is a return statement or a call to
5365 function declared with the noreturn attribute.
5366 -Wimplicit-fallthrough= also takes into account control flow
5367 statements, such as ifs, and only warns when appropriate. E.g.
5368
5369 switch (cond)
5370 {
5371 case 1:
5372 if (i > 3) {
5373 bar (5);
5374 break;
5375 } else if (i < 1) {
5376 bar (0);
5377 } else
5378 return;
5379 default:
5380 ...
5381 }
5382
5383 Since there are occasions where a switch case fall through is
5384 desirable, GCC provides an attribute, "__attribute__
5385 ((fallthrough))", that is to be used along with a null statement to
5386 suppress this warning that would normally occur:
5387
5388 switch (cond)
5389 {
5390 case 1:
5391 bar (0);
5392 __attribute__ ((fallthrough));
5393 default:
5394 ...
5395 }
5396
5397 C++17 provides a standard way to suppress the
5398 -Wimplicit-fallthrough warning using "[[fallthrough]];" instead of
5399 the GNU attribute. In C++11 or C++14 users can use
5400 "[[gnu::fallthrough]];", which is a GNU extension. Instead of
5401 these attributes, it is also possible to add a fallthrough comment
5402 to silence the warning. The whole body of the C or C++ style
5403 comment should match the given regular expressions listed below.
5404 The option argument n specifies what kind of comments are accepted:
5405
5406 *<-Wimplicit-fallthrough=0 disables the warning altogether.>
5407 *<-Wimplicit-fallthrough=1 matches ".*" regular>
5408 expression, any comment is used as fallthrough comment.
5409
5410 *<-Wimplicit-fallthrough=2 case insensitively matches>
5411 ".*falls?[ \t-]*thr(ough|u).*" regular expression.
5412
5413 *<-Wimplicit-fallthrough=3 case sensitively matches one of the>
5414 following regular expressions:
5415
5416 *<"-fallthrough">
5417 *<"@fallthrough@">
5418 *<"lint -fallthrough[ \t]*">
5419 *<"[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?FALL(S |
5420 |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?">
5421 *<"[ \t.!]*(Else,? |Intentional(ly)? )?Fall((s |
5422 |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?">
5423 *<"[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?fall(s |
5424 |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?">
5425 *<-Wimplicit-fallthrough=4 case sensitively matches one of the>
5426 following regular expressions:
5427
5428 *<"-fallthrough">
5429 *<"@fallthrough@">
5430 *<"lint -fallthrough[ \t]*">
5431 *<"[ \t]*FALLTHR(OUGH|U)[ \t]*">
5432 *<-Wimplicit-fallthrough=5 doesn't recognize any comments as>
5433 fallthrough comments, only attributes disable the warning.
5434
5435 The comment needs to be followed after optional whitespace and
5436 other comments by "case" or "default" keywords or by a user label
5437 that precedes some "case" or "default" label.
5438
5439 switch (cond)
5440 {
5441 case 1:
5442 bar (0);
5443 /* FALLTHRU */
5444 default:
5445 ...
5446 }
5447
5448 The -Wimplicit-fallthrough=3 warning is enabled by -Wextra.
5449
5450 -Wno-if-not-aligned (C, C++, Objective-C and Objective-C++ only)
5451 Control if warnings triggered by the "warn_if_not_aligned"
5452 attribute should be issued. These warnings are enabled by default.
5453
5454 -Wignored-qualifiers (C and C++ only)
5455 Warn if the return type of a function has a type qualifier such as
5456 "const". For ISO C such a type qualifier has no effect, since the
5457 value returned by a function is not an lvalue. For C++, the
5458 warning is only emitted for scalar types or "void". ISO C
5459 prohibits qualified "void" return types on function definitions, so
5460 such return types always receive a warning even without this
5461 option.
5462
5463 This warning is also enabled by -Wextra.
5464
5465 -Wno-ignored-attributes (C and C++ only)
5466 This option controls warnings when an attribute is ignored. This
5467 is different from the -Wattributes option in that it warns whenever
5468 the compiler decides to drop an attribute, not that the attribute
5469 is either unknown, used in a wrong place, etc. This warning is
5470 enabled by default.
5471
5472 -Wmain
5473 Warn if the type of "main" is suspicious. "main" should be a
5474 function with external linkage, returning int, taking either zero
5475 arguments, two, or three arguments of appropriate types. This
5476 warning is enabled by default in C++ and is enabled by either -Wall
5477 or -Wpedantic.
5478
5479 -Wmisleading-indentation (C and C++ only)
5480 Warn when the indentation of the code does not reflect the block
5481 structure. Specifically, a warning is issued for "if", "else",
5482 "while", and "for" clauses with a guarded statement that does not
5483 use braces, followed by an unguarded statement with the same
5484 indentation.
5485
5486 In the following example, the call to "bar" is misleadingly
5487 indented as if it were guarded by the "if" conditional.
5488
5489 if (some_condition ())
5490 foo ();
5491 bar (); /* Gotcha: this is not guarded by the "if". */
5492
5493 In the case of mixed tabs and spaces, the warning uses the
5494 -ftabstop= option to determine if the statements line up
5495 (defaulting to 8).
5496
5497 The warning is not issued for code involving multiline preprocessor
5498 logic such as the following example.
5499
5500 if (flagA)
5501 foo (0);
5502 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5503 if (flagB)
5504 #endif
5505 foo (1);
5506
5507 The warning is not issued after a "#line" directive, since this
5508 typically indicates autogenerated code, and no assumptions can be
5509 made about the layout of the file that the directive references.
5510
5511 This warning is enabled by -Wall in C and C++.
5512
5513 -Wmissing-attributes
5514 Warn when a declaration of a function is missing one or more
5515 attributes that a related function is declared with and whose
5516 absence may adversely affect the correctness or efficiency of
5517 generated code. For example, the warning is issued for
5518 declarations of aliases that use attributes to specify less
5519 restrictive requirements than those of their targets. This
5520 typically represents a potential optimization opportunity. By
5521 contrast, the -Wattribute-alias=2 option controls warnings issued
5522 when the alias is more restrictive than the target, which could
5523 lead to incorrect code generation. Attributes considered include
5524 "alloc_align", "alloc_size", "cold", "const", "hot", "leaf",
5525 "malloc", "nonnull", "noreturn", "nothrow", "pure",
5526 "returns_nonnull", and "returns_twice".
5527
5528 In C++, the warning is issued when an explicit specialization of a
5529 primary template declared with attribute "alloc_align",
5530 "alloc_size", "assume_aligned", "format", "format_arg", "malloc",
5531 or "nonnull" is declared without it. Attributes "deprecated",
5532 "error", and "warning" suppress the warning..
5533
5534 You can use the "copy" attribute to apply the same set of
5535 attributes to a declaration as that on another declaration without
5536 explicitly enumerating the attributes. This attribute can be
5537 applied to declarations of functions, variables, or types.
5538
5539 -Wmissing-attributes is enabled by -Wall.
5540
5541 For example, since the declaration of the primary function template
5542 below makes use of both attribute "malloc" and "alloc_size" the
5543 declaration of the explicit specialization of the template is
5544 diagnosed because it is missing one of the attributes.
5545
5546 template <class T>
5547 T* __attribute__ ((malloc, alloc_size (1)))
5548 allocate (size_t);
5549
5550 template <>
5551 void* __attribute__ ((malloc)) // missing alloc_size
5552 allocate<void> (size_t);
5553
5554 -Wmissing-braces
5555 Warn if an aggregate or union initializer is not fully bracketed.
5556 In the following example, the initializer for "a" is not fully
5557 bracketed, but that for "b" is fully bracketed.
5558
5559 int a[2][2] = { 0, 1, 2, 3 };
5560 int b[2][2] = { { 0, 1 }, { 2, 3 } };
5561
5562 This warning is enabled by -Wall.
5563
5564 -Wmissing-include-dirs (C, C++, Objective-C, Objective-C++ and Fortran
5565 only)
5566 Warn if a user-supplied include directory does not exist. This
5567 option is disabled by default for C, C++, Objective-C and
5568 Objective-C++. For Fortran, it is partially enabled by default by
5569 warning for -I and -J, only.
5570
5571 -Wno-missing-profile
5572 This option controls warnings if feedback profiles are missing when
5573 using the -fprofile-use option. This option diagnoses those cases
5574 where a new function or a new file is added between compiling with
5575 -fprofile-generate and with -fprofile-use, without regenerating the
5576 profiles. In these cases, the profile feedback data files do not
5577 contain any profile feedback information for the newly added
5578 function or file respectively. Also, in the case when profile
5579 count data (.gcda) files are removed, GCC cannot use any profile
5580 feedback information. In all these cases, warnings are issued to
5581 inform you that a profile generation step is due. Ignoring the
5582 warning can result in poorly optimized code. -Wno-missing-profile
5583 can be used to disable the warning, but this is not recommended and
5584 should be done only when non-existent profile data is justified.
5585
5586 -Wmismatched-dealloc
5587 Warn for calls to deallocation functions with pointer arguments
5588 returned from from allocations functions for which the former isn't
5589 a suitable deallocator. A pair of functions can be associated as
5590 matching allocators and deallocators by use of attribute "malloc".
5591 Unless disabled by the -fno-builtin option the standard functions
5592 "calloc", "malloc", "realloc", and "free", as well as the
5593 corresponding forms of C++ "operator new" and "operator delete" are
5594 implicitly associated as matching allocators and deallocators. In
5595 the following example "mydealloc" is the deallocator for pointers
5596 returned from "myalloc".
5597
5598 void mydealloc (void*);
5599
5600 __attribute__ ((malloc (mydealloc, 1))) void*
5601 myalloc (size_t);
5602
5603 void f (void)
5604 {
5605 void *p = myalloc (32);
5606 // ...use p...
5607 free (p); // warning: not a matching deallocator for myalloc
5608 mydealloc (p); // ok
5609 }
5610
5611 In C++, the related option -Wmismatched-new-delete diagnoses
5612 mismatches involving either "operator new" or "operator delete".
5613
5614 Option -Wmismatched-dealloc is included in -Wall.
5615
5616 -Wmultistatement-macros
5617 Warn about unsafe multiple statement macros that appear to be
5618 guarded by a clause such as "if", "else", "for", "switch", or
5619 "while", in which only the first statement is actually guarded
5620 after the macro is expanded.
5621
5622 For example:
5623
5624 #define DOIT x++; y++
5625 if (c)
5626 DOIT;
5627
5628 will increment "y" unconditionally, not just when "c" holds. The
5629 can usually be fixed by wrapping the macro in a do-while loop:
5630
5631 #define DOIT do { x++; y++; } while (0)
5632 if (c)
5633 DOIT;
5634
5635 This warning is enabled by -Wall in C and C++.
5636
5637 -Wparentheses
5638 Warn if parentheses are omitted in certain contexts, such as when
5639 there is an assignment in a context where a truth value is
5640 expected, or when operators are nested whose precedence people
5641 often get confused about.
5642
5643 Also warn if a comparison like "x<=y<=z" appears; this is
5644 equivalent to "(x<=y ? 1 : 0) <= z", which is a different
5645 interpretation from that of ordinary mathematical notation.
5646
5647 Also warn for dangerous uses of the GNU extension to "?:" with
5648 omitted middle operand. When the condition in the "?": operator is
5649 a boolean expression, the omitted value is always 1. Often
5650 programmers expect it to be a value computed inside the conditional
5651 expression instead.
5652
5653 For C++ this also warns for some cases of unnecessary parentheses
5654 in declarations, which can indicate an attempt at a function call
5655 instead of a declaration:
5656
5657 {
5658 // Declares a local variable called mymutex.
5659 std::unique_lock<std::mutex> (mymutex);
5660 // User meant std::unique_lock<std::mutex> lock (mymutex);
5661 }
5662
5663 This warning is enabled by -Wall.
5664
5665 -Wno-self-move (C++ and Objective-C++ only)
5666 This warning warns when a value is moved to itself with
5667 "std::move". Such a "std::move" typically has no effect.
5668
5669 struct T {
5670 ...
5671 };
5672 void fn()
5673 {
5674 T t;
5675 ...
5676 t = std::move (t);
5677 }
5678
5679 This warning is enabled by -Wall.
5680
5681 -Wsequence-point
5682 Warn about code that may have undefined semantics because of
5683 violations of sequence point rules in the C and C++ standards.
5684
5685 The C and C++ standards define the order in which expressions in a
5686 C/C++ program are evaluated in terms of sequence points, which
5687 represent a partial ordering between the execution of parts of the
5688 program: those executed before the sequence point, and those
5689 executed after it. These occur after the evaluation of a full
5690 expression (one which is not part of a larger expression), after
5691 the evaluation of the first operand of a "&&", "||", "? :" or ","
5692 (comma) operator, before a function is called (but after the
5693 evaluation of its arguments and the expression denoting the called
5694 function), and in certain other places. Other than as expressed by
5695 the sequence point rules, the order of evaluation of subexpressions
5696 of an expression is not specified. All these rules describe only a
5697 partial order rather than a total order, since, for example, if two
5698 functions are called within one expression with no sequence point
5699 between them, the order in which the functions are called is not
5700 specified. However, the standards committee have ruled that
5701 function calls do not overlap.
5702
5703 It is not specified when between sequence points modifications to
5704 the values of objects take effect. Programs whose behavior depends
5705 on this have undefined behavior; the C and C++ standards specify
5706 that "Between the previous and next sequence point an object shall
5707 have its stored value modified at most once by the evaluation of an
5708 expression. Furthermore, the prior value shall be read only to
5709 determine the value to be stored.". If a program breaks these
5710 rules, the results on any particular implementation are entirely
5711 unpredictable.
5712
5713 Examples of code with undefined behavior are "a = a++;", "a[n] =
5714 b[n++]" and "a[i++] = i;". Some more complicated cases are not
5715 diagnosed by this option, and it may give an occasional false
5716 positive result, but in general it has been found fairly effective
5717 at detecting this sort of problem in programs.
5718
5719 The C++17 standard will define the order of evaluation of operands
5720 in more cases: in particular it requires that the right-hand side
5721 of an assignment be evaluated before the left-hand side, so the
5722 above examples are no longer undefined. But this option will still
5723 warn about them, to help people avoid writing code that is
5724 undefined in C and earlier revisions of C++.
5725
5726 The standard is worded confusingly, therefore there is some debate
5727 over the precise meaning of the sequence point rules in subtle
5728 cases. Links to discussions of the problem, including proposed
5729 formal definitions, may be found on the GCC readings page, at
5730 <https://gcc.gnu.org/readings.html>.
5731
5732 This warning is enabled by -Wall for C and C++.
5733
5734 -Wno-return-local-addr
5735 Do not warn about returning a pointer (or in C++, a reference) to a
5736 variable that goes out of scope after the function returns.
5737
5738 -Wreturn-type
5739 Warn whenever a function is defined with a return type that
5740 defaults to "int". Also warn about any "return" statement with no
5741 return value in a function whose return type is not "void" (falling
5742 off the end of the function body is considered returning without a
5743 value).
5744
5745 For C only, warn about a "return" statement with an expression in a
5746 function whose return type is "void", unless the expression type is
5747 also "void". As a GNU extension, the latter case is accepted
5748 without a warning unless -Wpedantic is used. Attempting to use the
5749 return value of a non-"void" function other than "main" that flows
5750 off the end by reaching the closing curly brace that terminates the
5751 function is undefined.
5752
5753 Unlike in C, in C++, flowing off the end of a non-"void" function
5754 other than "main" results in undefined behavior even when the value
5755 of the function is not used.
5756
5757 This warning is enabled by default in C++ and by -Wall otherwise.
5758
5759 -Wno-shift-count-negative
5760 Controls warnings if a shift count is negative. This warning is
5761 enabled by default.
5762
5763 -Wno-shift-count-overflow
5764 Controls warnings if a shift count is greater than or equal to the
5765 bit width of the type. This warning is enabled by default.
5766
5767 -Wshift-negative-value
5768 Warn if left shifting a negative value. This warning is enabled by
5769 -Wextra in C99 (and newer) and C++11 to C++17 modes.
5770
5771 -Wno-shift-overflow
5772 -Wshift-overflow=n
5773 These options control warnings about left shift overflows.
5774
5775 -Wshift-overflow=1
5776 This is the warning level of -Wshift-overflow and is enabled by
5777 default in C99 and C++11 modes (and newer). This warning level
5778 does not warn about left-shifting 1 into the sign bit.
5779 (However, in C, such an overflow is still rejected in contexts
5780 where an integer constant expression is required.) No warning
5781 is emitted in C++20 mode (and newer), as signed left shifts
5782 always wrap.
5783
5784 -Wshift-overflow=2
5785 This warning level also warns about left-shifting 1 into the
5786 sign bit, unless C++14 mode (or newer) is active.
5787
5788 -Wswitch
5789 Warn whenever a "switch" statement has an index of enumerated type
5790 and lacks a "case" for one or more of the named codes of that
5791 enumeration. (The presence of a "default" label prevents this
5792 warning.) "case" labels outside the enumeration range also provoke
5793 warnings when this option is used (even if there is a "default"
5794 label). This warning is enabled by -Wall.
5795
5796 -Wswitch-default
5797 Warn whenever a "switch" statement does not have a "default" case.
5798
5799 -Wswitch-enum
5800 Warn whenever a "switch" statement has an index of enumerated type
5801 and lacks a "case" for one or more of the named codes of that
5802 enumeration. "case" labels outside the enumeration range also
5803 provoke warnings when this option is used. The only difference
5804 between -Wswitch and this option is that this option gives a
5805 warning about an omitted enumeration code even if there is a
5806 "default" label.
5807
5808 -Wno-switch-bool
5809 Do not warn when a "switch" statement has an index of boolean type
5810 and the case values are outside the range of a boolean type. It is
5811 possible to suppress this warning by casting the controlling
5812 expression to a type other than "bool". For example:
5813
5814 switch ((int) (a == 4))
5815 {
5816 ...
5817 }
5818
5819 This warning is enabled by default for C and C++ programs.
5820
5821 -Wno-switch-outside-range
5822 This option controls warnings when a "switch" case has a value that
5823 is outside of its respective type range. This warning is enabled
5824 by default for C and C++ programs.
5825
5826 -Wno-switch-unreachable
5827 Do not warn when a "switch" statement contains statements between
5828 the controlling expression and the first case label, which will
5829 never be executed. For example:
5830
5831 switch (cond)
5832 {
5833 i = 15;
5834 ...
5835 case 5:
5836 ...
5837 }
5838
5839 -Wswitch-unreachable does not warn if the statement between the
5840 controlling expression and the first case label is just a
5841 declaration:
5842
5843 switch (cond)
5844 {
5845 int i;
5846 ...
5847 case 5:
5848 i = 5;
5849 ...
5850 }
5851
5852 This warning is enabled by default for C and C++ programs.
5853
5854 -Wsync-nand (C and C++ only)
5855 Warn when "__sync_fetch_and_nand" and "__sync_nand_and_fetch"
5856 built-in functions are used. These functions changed semantics in
5857 GCC 4.4.
5858
5859 -Wtrivial-auto-var-init
5860 Warn when "-ftrivial-auto-var-init" cannot initialize the automatic
5861 variable. A common situation is an automatic variable that is
5862 declared between the controlling expression and the first case
5863 label of a "switch" statement.
5864
5865 -Wunused-but-set-parameter
5866 Warn whenever a function parameter is assigned to, but otherwise
5867 unused (aside from its declaration).
5868
5869 To suppress this warning use the "unused" attribute.
5870
5871 This warning is also enabled by -Wunused together with -Wextra.
5872
5873 -Wunused-but-set-variable
5874 Warn whenever a local variable is assigned to, but otherwise unused
5875 (aside from its declaration). This warning is enabled by -Wall.
5876
5877 To suppress this warning use the "unused" attribute.
5878
5879 This warning is also enabled by -Wunused, which is enabled by
5880 -Wall.
5881
5882 -Wunused-function
5883 Warn whenever a static function is declared but not defined or a
5884 non-inline static function is unused. This warning is enabled by
5885 -Wall.
5886
5887 -Wunused-label
5888 Warn whenever a label is declared but not used. This warning is
5889 enabled by -Wall.
5890
5891 To suppress this warning use the "unused" attribute.
5892
5893 -Wunused-local-typedefs (C, Objective-C, C++ and Objective-C++ only)
5894 Warn when a typedef locally defined in a function is not used.
5895 This warning is enabled by -Wall.
5896
5897 -Wunused-parameter
5898 Warn whenever a function parameter is unused aside from its
5899 declaration.
5900
5901 To suppress this warning use the "unused" attribute.
5902
5903 -Wno-unused-result
5904 Do not warn if a caller of a function marked with attribute
5905 "warn_unused_result" does not use its return value. The default is
5906 -Wunused-result.
5907
5908 -Wunused-variable
5909 Warn whenever a local or static variable is unused aside from its
5910 declaration. This option implies -Wunused-const-variable=1 for C,
5911 but not for C++. This warning is enabled by -Wall.
5912
5913 To suppress this warning use the "unused" attribute.
5914
5915 -Wunused-const-variable
5916 -Wunused-const-variable=n
5917 Warn whenever a constant static variable is unused aside from its
5918 declaration. -Wunused-const-variable=1 is enabled by
5919 -Wunused-variable for C, but not for C++. In C this declares
5920 variable storage, but in C++ this is not an error since const
5921 variables take the place of "#define"s.
5922
5923 To suppress this warning use the "unused" attribute.
5924
5925 -Wunused-const-variable=1
5926 This is the warning level that is enabled by -Wunused-variable
5927 for C. It warns only about unused static const variables
5928 defined in the main compilation unit, but not about static
5929 const variables declared in any header included.
5930
5931 -Wunused-const-variable=2
5932 This warning level also warns for unused constant static
5933 variables in headers (excluding system headers). This is the
5934 warning level of -Wunused-const-variable and must be explicitly
5935 requested since in C++ this isn't an error and in C it might be
5936 harder to clean up all headers included.
5937
5938 -Wunused-value
5939 Warn whenever a statement computes a result that is explicitly not
5940 used. To suppress this warning cast the unused expression to
5941 "void". This includes an expression-statement or the left-hand side
5942 of a comma expression that contains no side effects. For example,
5943 an expression such as "x[i,j]" causes a warning, while
5944 "x[(void)i,j]" does not.
5945
5946 This warning is enabled by -Wall.
5947
5948 -Wunused
5949 All the above -Wunused options combined.
5950
5951 In order to get a warning about an unused function parameter, you
5952 must either specify -Wextra -Wunused (note that -Wall implies
5953 -Wunused), or separately specify -Wunused-parameter.
5954
5955 -Wuninitialized
5956 Warn if an object with automatic or allocated storage duration is
5957 used without having been initialized. In C++, also warn if a non-
5958 static reference or non-static "const" member appears in a class
5959 without constructors.
5960
5961 In addition, passing a pointer (or in C++, a reference) to an
5962 uninitialized object to a "const"-qualified argument of a built-in
5963 function known to read the object is also diagnosed by this
5964 warning. (-Wmaybe-uninitialized is issued for ordinary functions.)
5965
5966 If you want to warn about code that uses the uninitialized value of
5967 the variable in its own initializer, use the -Winit-self option.
5968
5969 These warnings occur for individual uninitialized elements of
5970 structure, union or array variables as well as for variables that
5971 are uninitialized as a whole. They do not occur for variables or
5972 elements declared "volatile". Because these warnings depend on
5973 optimization, the exact variables or elements for which there are
5974 warnings depend on the precise optimization options and version of
5975 GCC used.
5976
5977 Note that there may be no warning about a variable that is used
5978 only to compute a value that itself is never used, because such
5979 computations may be deleted by data flow analysis before the
5980 warnings are printed.
5981
5982 In C++, this warning also warns about using uninitialized objects
5983 in member-initializer-lists. For example, GCC warns about "b"
5984 being uninitialized in the following snippet:
5985
5986 struct A {
5987 int a;
5988 int b;
5989 A() : a(b) { }
5990 };
5991
5992 -Wno-invalid-memory-model
5993 This option controls warnings for invocations of __atomic Builtins,
5994 __sync Builtins, and the C11 atomic generic functions with a memory
5995 consistency argument that is either invalid for the operation or
5996 outside the range of values of the "memory_order" enumeration. For
5997 example, since the "__atomic_store" and "__atomic_store_n" built-
5998 ins are only defined for the relaxed, release, and sequentially
5999 consistent memory orders the following code is diagnosed:
6000
6001 void store (int *i)
6002 {
6003 __atomic_store_n (i, 0, memory_order_consume);
6004 }
6005
6006 -Winvalid-memory-model is enabled by default.
6007
6008 -Wmaybe-uninitialized
6009 For an object with automatic or allocated storage duration, if
6010 there exists a path from the function entry to a use of the object
6011 that is initialized, but there exist some other paths for which the
6012 object is not initialized, the compiler emits a warning if it
6013 cannot prove the uninitialized paths are not executed at run time.
6014
6015 In addition, passing a pointer (or in C++, a reference) to an
6016 uninitialized object to a "const"-qualified function argument is
6017 also diagnosed by this warning. (-Wuninitialized is issued for
6018 built-in functions known to read the object.) Annotating the
6019 function with attribute "access (none)" indicates that the argument
6020 isn't used to access the object and avoids the warning.
6021
6022 These warnings are only possible in optimizing compilation, because
6023 otherwise GCC does not keep track of the state of variables.
6024
6025 These warnings are made optional because GCC may not be able to
6026 determine when the code is correct in spite of appearing to have an
6027 error. Here is one example of how this can happen:
6028
6029 {
6030 int x;
6031 switch (y)
6032 {
6033 case 1: x = 1;
6034 break;
6035 case 2: x = 4;
6036 break;
6037 case 3: x = 5;
6038 }
6039 foo (x);
6040 }
6041
6042 If the value of "y" is always 1, 2 or 3, then "x" is always
6043 initialized, but GCC doesn't know this. To suppress the warning,
6044 you need to provide a default case with assert(0) or similar code.
6045
6046 This option also warns when a non-volatile automatic variable might
6047 be changed by a call to "longjmp". The compiler sees only the
6048 calls to "setjmp". It cannot know where "longjmp" will be called;
6049 in fact, a signal handler could call it at any point in the code.
6050 As a result, you may get a warning even when there is in fact no
6051 problem because "longjmp" cannot in fact be called at the place
6052 that would cause a problem.
6053
6054 Some spurious warnings can be avoided if you declare all the
6055 functions you use that never return as "noreturn".
6056
6057 This warning is enabled by -Wall or -Wextra.
6058
6059 -Wunknown-pragmas
6060 Warn when a "#pragma" directive is encountered that is not
6061 understood by GCC. If this command-line option is used, warnings
6062 are even issued for unknown pragmas in system header files. This
6063 is not the case if the warnings are only enabled by the -Wall
6064 command-line option.
6065
6066 -Wno-pragmas
6067 Do not warn about misuses of pragmas, such as incorrect parameters,
6068 invalid syntax, or conflicts between pragmas. See also
6069 -Wunknown-pragmas.
6070
6071 -Wno-prio-ctor-dtor
6072 Do not warn if a priority from 0 to 100 is used for constructor or
6073 destructor. The use of constructor and destructor attributes allow
6074 you to assign a priority to the constructor/destructor to control
6075 its order of execution before "main" is called or after it returns.
6076 The priority values must be greater than 100 as the compiler
6077 reserves priority values between 0--100 for the implementation.
6078
6079 -Wstrict-aliasing
6080 This option is only active when -fstrict-aliasing is active. It
6081 warns about code that might break the strict aliasing rules that
6082 the compiler is using for optimization. The warning does not catch
6083 all cases, but does attempt to catch the more common pitfalls. It
6084 is included in -Wall. It is equivalent to -Wstrict-aliasing=3
6085
6086 -Wstrict-aliasing=n
6087 This option is only active when -fstrict-aliasing is active. It
6088 warns about code that might break the strict aliasing rules that
6089 the compiler is using for optimization. Higher levels correspond
6090 to higher accuracy (fewer false positives). Higher levels also
6091 correspond to more effort, similar to the way -O works.
6092 -Wstrict-aliasing is equivalent to -Wstrict-aliasing=3.
6093
6094 Level 1: Most aggressive, quick, least accurate. Possibly useful
6095 when higher levels do not warn but -fstrict-aliasing still breaks
6096 the code, as it has very few false negatives. However, it has many
6097 false positives. Warns for all pointer conversions between
6098 possibly incompatible types, even if never dereferenced. Runs in
6099 the front end only.
6100
6101 Level 2: Aggressive, quick, not too precise. May still have many
6102 false positives (not as many as level 1 though), and few false
6103 negatives (but possibly more than level 1). Unlike level 1, it
6104 only warns when an address is taken. Warns about incomplete types.
6105 Runs in the front end only.
6106
6107 Level 3 (default for -Wstrict-aliasing): Should have very few false
6108 positives and few false negatives. Slightly slower than levels 1
6109 or 2 when optimization is enabled. Takes care of the common
6110 pun+dereference pattern in the front end: "*(int*)&some_float". If
6111 optimization is enabled, it also runs in the back end, where it
6112 deals with multiple statement cases using flow-sensitive points-to
6113 information. Only warns when the converted pointer is
6114 dereferenced. Does not warn about incomplete types.
6115
6116 -Wstrict-overflow
6117 -Wstrict-overflow=n
6118 This option is only active when signed overflow is undefined. It
6119 warns about cases where the compiler optimizes based on the
6120 assumption that signed overflow does not occur. Note that it does
6121 not warn about all cases where the code might overflow: it only
6122 warns about cases where the compiler implements some optimization.
6123 Thus this warning depends on the optimization level.
6124
6125 An optimization that assumes that signed overflow does not occur is
6126 perfectly safe if the values of the variables involved are such
6127 that overflow never does, in fact, occur. Therefore this warning
6128 can easily give a false positive: a warning about code that is not
6129 actually a problem. To help focus on important issues, several
6130 warning levels are defined. No warnings are issued for the use of
6131 undefined signed overflow when estimating how many iterations a
6132 loop requires, in particular when determining whether a loop will
6133 be executed at all.
6134
6135 -Wstrict-overflow=1
6136 Warn about cases that are both questionable and easy to avoid.
6137 For example the compiler simplifies "x + 1 > x" to 1. This
6138 level of -Wstrict-overflow is enabled by -Wall; higher levels
6139 are not, and must be explicitly requested.
6140
6141 -Wstrict-overflow=2
6142 Also warn about other cases where a comparison is simplified to
6143 a constant. For example: "abs (x) >= 0". This can only be
6144 simplified when signed integer overflow is undefined, because
6145 "abs (INT_MIN)" overflows to "INT_MIN", which is less than
6146 zero. -Wstrict-overflow (with no level) is the same as
6147 -Wstrict-overflow=2.
6148
6149 -Wstrict-overflow=3
6150 Also warn about other cases where a comparison is simplified.
6151 For example: "x + 1 > 1" is simplified to "x > 0".
6152
6153 -Wstrict-overflow=4
6154 Also warn about other simplifications not covered by the above
6155 cases. For example: "(x * 10) / 5" is simplified to "x * 2".
6156
6157 -Wstrict-overflow=5
6158 Also warn about cases where the compiler reduces the magnitude
6159 of a constant involved in a comparison. For example: "x + 2 >
6160 y" is simplified to "x + 1 >= y". This is reported only at the
6161 highest warning level because this simplification applies to
6162 many comparisons, so this warning level gives a very large
6163 number of false positives.
6164
6165 -Wstring-compare
6166 Warn for calls to "strcmp" and "strncmp" whose result is determined
6167 to be either zero or non-zero in tests for such equality owing to
6168 the length of one argument being greater than the size of the array
6169 the other argument is stored in (or the bound in the case of
6170 "strncmp"). Such calls could be mistakes. For example, the call
6171 to "strcmp" below is diagnosed because its result is necessarily
6172 non-zero irrespective of the contents of the array "a".
6173
6174 extern char a[4];
6175 void f (char *d)
6176 {
6177 strcpy (d, "string");
6178 ...
6179 if (0 == strcmp (a, d)) // cannot be true
6180 puts ("a and d are the same");
6181 }
6182
6183 -Wstring-compare is enabled by -Wextra.
6184
6185 -Wno-stringop-overflow
6186 -Wstringop-overflow
6187 -Wstringop-overflow=type
6188 Warn for calls to string manipulation functions such as "memcpy"
6189 and "strcpy" that are determined to overflow the destination
6190 buffer. The optional argument is one greater than the type of
6191 Object Size Checking to perform to determine the size of the
6192 destination. The argument is meaningful only for functions that
6193 operate on character arrays but not for raw memory functions like
6194 "memcpy" which always make use of Object Size type-0. The option
6195 also warns for calls that specify a size in excess of the largest
6196 possible object or at most "SIZE_MAX / 2" bytes. The option
6197 produces the best results with optimization enabled but can detect
6198 a small subset of simple buffer overflows even without optimization
6199 in calls to the GCC built-in functions like "__builtin_memcpy" that
6200 correspond to the standard functions. In any case, the option
6201 warns about just a subset of buffer overflows detected by the
6202 corresponding overflow checking built-ins. For example, the option
6203 issues a warning for the "strcpy" call below because it copies at
6204 least 5 characters (the string "blue" including the terminating
6205 NUL) into the buffer of size 4.
6206
6207 enum Color { blue, purple, yellow };
6208 const char* f (enum Color clr)
6209 {
6210 static char buf [4];
6211 const char *str;
6212 switch (clr)
6213 {
6214 case blue: str = "blue"; break;
6215 case purple: str = "purple"; break;
6216 case yellow: str = "yellow"; break;
6217 }
6218
6219 return strcpy (buf, str); // warning here
6220 }
6221
6222 Option -Wstringop-overflow=2 is enabled by default.
6223
6224 -Wstringop-overflow
6225 -Wstringop-overflow=1
6226 The -Wstringop-overflow=1 option uses type-zero Object Size
6227 Checking to determine the sizes of destination objects. At
6228 this setting the option does not warn for writes past the end
6229 of subobjects of larger objects accessed by pointers unless the
6230 size of the largest surrounding object is known. When the
6231 destination may be one of several objects it is assumed to be
6232 the largest one of them. On Linux systems, when optimization
6233 is enabled at this setting the option warns for the same code
6234 as when the "_FORTIFY_SOURCE" macro is defined to a non-zero
6235 value.
6236
6237 -Wstringop-overflow=2
6238 The -Wstringop-overflow=2 option uses type-one Object Size
6239 Checking to determine the sizes of destination objects. At
6240 this setting the option warns about overflows when writing to
6241 members of the largest complete objects whose exact size is
6242 known. However, it does not warn for excessive writes to the
6243 same members of unknown objects referenced by pointers since
6244 they may point to arrays containing unknown numbers of
6245 elements. This is the default setting of the option.
6246
6247 -Wstringop-overflow=3
6248 The -Wstringop-overflow=3 option uses type-two Object Size
6249 Checking to determine the sizes of destination objects. At
6250 this setting the option warns about overflowing the smallest
6251 object or data member. This is the most restrictive setting of
6252 the option that may result in warnings for safe code.
6253
6254 -Wstringop-overflow=4
6255 The -Wstringop-overflow=4 option uses type-three Object Size
6256 Checking to determine the sizes of destination objects. At
6257 this setting the option warns about overflowing any data
6258 members, and when the destination is one of several objects it
6259 uses the size of the largest of them to decide whether to issue
6260 a warning. Similarly to -Wstringop-overflow=3 this setting of
6261 the option may result in warnings for benign code.
6262
6263 -Wno-stringop-overread
6264 Warn for calls to string manipulation functions such as "memchr",
6265 or "strcpy" that are determined to read past the end of the source
6266 sequence.
6267
6268 Option -Wstringop-overread is enabled by default.
6269
6270 -Wno-stringop-truncation
6271 Do not warn for calls to bounded string manipulation functions such
6272 as "strncat", "strncpy", and "stpncpy" that may either truncate the
6273 copied string or leave the destination unchanged.
6274
6275 In the following example, the call to "strncat" specifies a bound
6276 that is less than the length of the source string. As a result,
6277 the copy of the source will be truncated and so the call is
6278 diagnosed. To avoid the warning use "bufsize - strlen (buf) - 1)"
6279 as the bound.
6280
6281 void append (char *buf, size_t bufsize)
6282 {
6283 strncat (buf, ".txt", 3);
6284 }
6285
6286 As another example, the following call to "strncpy" results in
6287 copying to "d" just the characters preceding the terminating NUL,
6288 without appending the NUL to the end. Assuming the result of
6289 "strncpy" is necessarily a NUL-terminated string is a common
6290 mistake, and so the call is diagnosed. To avoid the warning when
6291 the result is not expected to be NUL-terminated, call "memcpy"
6292 instead.
6293
6294 void copy (char *d, const char *s)
6295 {
6296 strncpy (d, s, strlen (s));
6297 }
6298
6299 In the following example, the call to "strncpy" specifies the size
6300 of the destination buffer as the bound. If the length of the
6301 source string is equal to or greater than this size the result of
6302 the copy will not be NUL-terminated. Therefore, the call is also
6303 diagnosed. To avoid the warning, specify "sizeof buf - 1" as the
6304 bound and set the last element of the buffer to "NUL".
6305
6306 void copy (const char *s)
6307 {
6308 char buf[80];
6309 strncpy (buf, s, sizeof buf);
6310 ...
6311 }
6312
6313 In situations where a character array is intended to store a
6314 sequence of bytes with no terminating "NUL" such an array may be
6315 annotated with attribute "nonstring" to avoid this warning. Such
6316 arrays, however, are not suitable arguments to functions that
6317 expect "NUL"-terminated strings. To help detect accidental misuses
6318 of such arrays GCC issues warnings unless it can prove that the use
6319 is safe.
6320
6321 -Wstrict-flex-arrays
6322 Warn about inproper usages of flexible array members according to
6323 the level of the "strict_flex_array (level)" attribute attached to
6324 the trailing array field of a structure if it's available,
6325 otherwise according to the level of the option
6326 -fstrict-flex-arrays=level.
6327
6328 This option is effective only when level is bigger than 0.
6329 Otherwise, it will be ignored with a warning.
6330
6331 when level=1, warnings will be issued for a trailing array
6332 reference of a structure that have 2 or more elements if the
6333 trailing array is referenced as a flexible array member.
6334
6335 when level=2, in addition to level=1, additional warnings will be
6336 issued for a trailing one-element array reference of a structure if
6337 the array is referenced as a flexible array member.
6338
6339 when level=3, in addition to level=2, additional warnings will be
6340 issued for a trailing zero-length array reference of a structure if
6341 the array is referenced as a flexible array member.
6342
6343 -Wsuggest-attribute=[pure|const|noreturn|format|cold|malloc]
6344 Warn for cases where adding an attribute may be beneficial. The
6345 attributes currently supported are listed below.
6346
6347 -Wsuggest-attribute=pure
6348 -Wsuggest-attribute=const
6349 -Wsuggest-attribute=noreturn
6350 -Wmissing-noreturn
6351 -Wsuggest-attribute=malloc
6352 Warn about functions that might be candidates for attributes
6353 "pure", "const" or "noreturn" or "malloc". The compiler only
6354 warns for functions visible in other compilation units or (in
6355 the case of "pure" and "const") if it cannot prove that the
6356 function returns normally. A function returns normally if it
6357 doesn't contain an infinite loop or return abnormally by
6358 throwing, calling "abort" or trapping. This analysis requires
6359 option -fipa-pure-const, which is enabled by default at -O and
6360 higher. Higher optimization levels improve the accuracy of the
6361 analysis.
6362
6363 -Wsuggest-attribute=format
6364 -Wmissing-format-attribute
6365 Warn about function pointers that might be candidates for
6366 "format" attributes. Note these are only possible candidates,
6367 not absolute ones. GCC guesses that function pointers with
6368 "format" attributes that are used in assignment,
6369 initialization, parameter passing or return statements should
6370 have a corresponding "format" attribute in the resulting type.
6371 I.e. the left-hand side of the assignment or initialization,
6372 the type of the parameter variable, or the return type of the
6373 containing function respectively should also have a "format"
6374 attribute to avoid the warning.
6375
6376 GCC also warns about function definitions that might be
6377 candidates for "format" attributes. Again, these are only
6378 possible candidates. GCC guesses that "format" attributes
6379 might be appropriate for any function that calls a function
6380 like "vprintf" or "vscanf", but this might not always be the
6381 case, and some functions for which "format" attributes are
6382 appropriate may not be detected.
6383
6384 -Wsuggest-attribute=cold
6385 Warn about functions that might be candidates for "cold"
6386 attribute. This is based on static detection and generally
6387 only warns about functions which always leads to a call to
6388 another "cold" function such as wrappers of C++ "throw" or
6389 fatal error reporting functions leading to "abort".
6390
6391 -Walloc-zero
6392 Warn about calls to allocation functions decorated with attribute
6393 "alloc_size" that specify zero bytes, including those to the built-
6394 in forms of the functions "aligned_alloc", "alloca", "calloc",
6395 "malloc", and "realloc". Because the behavior of these functions
6396 when called with a zero size differs among implementations (and in
6397 the case of "realloc" has been deprecated) relying on it may result
6398 in subtle portability bugs and should be avoided.
6399
6400 -Walloc-size-larger-than=byte-size
6401 Warn about calls to functions decorated with attribute "alloc_size"
6402 that attempt to allocate objects larger than the specified number
6403 of bytes, or where the result of the size computation in an integer
6404 type with infinite precision would exceed the value of PTRDIFF_MAX
6405 on the target. -Walloc-size-larger-than=PTRDIFF_MAX is enabled by
6406 default. Warnings controlled by the option can be disabled either
6407 by specifying byte-size of SIZE_MAX or more or by
6408 -Wno-alloc-size-larger-than.
6409
6410 -Wno-alloc-size-larger-than
6411 Disable -Walloc-size-larger-than= warnings. The option is
6412 equivalent to -Walloc-size-larger-than=SIZE_MAX or larger.
6413
6414 -Walloca
6415 This option warns on all uses of "alloca" in the source.
6416
6417 -Walloca-larger-than=byte-size
6418 This option warns on calls to "alloca" with an integer argument
6419 whose value is either zero, or that is not bounded by a controlling
6420 predicate that limits its value to at most byte-size. It also
6421 warns for calls to "alloca" where the bound value is unknown.
6422 Arguments of non-integer types are considered unbounded even if
6423 they appear to be constrained to the expected range.
6424
6425 For example, a bounded case of "alloca" could be:
6426
6427 void func (size_t n)
6428 {
6429 void *p;
6430 if (n <= 1000)
6431 p = alloca (n);
6432 else
6433 p = malloc (n);
6434 f (p);
6435 }
6436
6437 In the above example, passing "-Walloca-larger-than=1000" would not
6438 issue a warning because the call to "alloca" is known to be at most
6439 1000 bytes. However, if "-Walloca-larger-than=500" were passed,
6440 the compiler would emit a warning.
6441
6442 Unbounded uses, on the other hand, are uses of "alloca" with no
6443 controlling predicate constraining its integer argument. For
6444 example:
6445
6446 void func ()
6447 {
6448 void *p = alloca (n);
6449 f (p);
6450 }
6451
6452 If "-Walloca-larger-than=500" were passed, the above would trigger
6453 a warning, but this time because of the lack of bounds checking.
6454
6455 Note, that even seemingly correct code involving signed integers
6456 could cause a warning:
6457
6458 void func (signed int n)
6459 {
6460 if (n < 500)
6461 {
6462 p = alloca (n);
6463 f (p);
6464 }
6465 }
6466
6467 In the above example, n could be negative, causing a larger than
6468 expected argument to be implicitly cast into the "alloca" call.
6469
6470 This option also warns when "alloca" is used in a loop.
6471
6472 -Walloca-larger-than=PTRDIFF_MAX is enabled by default but is
6473 usually only effective when -ftree-vrp is active (default for -O2
6474 and above).
6475
6476 See also -Wvla-larger-than=byte-size.
6477
6478 -Wno-alloca-larger-than
6479 Disable -Walloca-larger-than= warnings. The option is equivalent
6480 to -Walloca-larger-than=SIZE_MAX or larger.
6481
6482 -Warith-conversion
6483 Do warn about implicit conversions from arithmetic operations even
6484 when conversion of the operands to the same type cannot change
6485 their values. This affects warnings from -Wconversion,
6486 -Wfloat-conversion, and -Wsign-conversion.
6487
6488 void f (char c, int i)
6489 {
6490 c = c + i; // warns with B<-Wconversion>
6491 c = c + 1; // only warns with B<-Warith-conversion>
6492 }
6493
6494 -Warray-bounds
6495 -Warray-bounds=n
6496 Warn about out of bounds subscripts or offsets into arrays. This
6497 warning is enabled by -Wall. It is more effective when -ftree-vrp
6498 is active (the default for -O2 and above) but a subset of instances
6499 are issued even without optimization.
6500
6501 By default, the trailing array of a structure will be treated as a
6502 flexible array member by -Warray-bounds or -Warray-bounds=n if it
6503 is declared as either a flexible array member per C99 standard
6504 onwards ([]), a GCC zero-length array extension ([0]), or an one-
6505 element array ([1]). As a result, out of bounds subscripts or
6506 offsets into zero-length arrays or one-element arrays are not
6507 warned by default.
6508
6509 You can add the option -fstrict-flex-arrays or
6510 -fstrict-flex-arrays=level to control how this option treat
6511 trailing array of a structure as a flexible array member:
6512
6513 when level<=1, no change to the default behavior.
6514
6515 when level=2, additional warnings will be issued for out of bounds
6516 subscripts or offsets into one-element arrays;
6517
6518 when level=3, in addition to level=2, additional warnings will be
6519 issued for out of bounds subscripts or offsets into zero-length
6520 arrays.
6521
6522 -Warray-bounds=1
6523 This is the default warning level of -Warray-bounds and is
6524 enabled by -Wall; higher levels are not, and must be explicitly
6525 requested.
6526
6527 -Warray-bounds=2
6528 This warning level also warns about the intermediate results of
6529 pointer arithmetic that may yield out of bounds values. This
6530 warning level may give a larger number of false positives and
6531 is deactivated by default.
6532
6533 -Warray-compare
6534 Warn about equality and relational comparisons between two operands
6535 of array type. This comparison was deprecated in C++20. For
6536 example:
6537
6538 int arr1[5];
6539 int arr2[5];
6540 bool same = arr1 == arr2;
6541
6542 -Warray-compare is enabled by -Wall.
6543
6544 -Warray-parameter
6545 -Warray-parameter=n
6546 Warn about redeclarations of functions involving arguments of array
6547 or pointer types of inconsistent kinds or forms, and enable the
6548 detection of out-of-bounds accesses to such parameters by warnings
6549 such as -Warray-bounds.
6550
6551 If the first function declaration uses the array form the bound
6552 specified in the array is assumed to be the minimum number of
6553 elements expected to be provided in calls to the function and the
6554 maximum number of elements accessed by it. Failing to provide
6555 arguments of sufficient size or accessing more than the maximum
6556 number of elements may be diagnosed by warnings such as
6557 -Warray-bounds. At level 1 the warning diagnoses inconsistencies
6558 involving array parameters declared using the "T[static N]" form.
6559
6560 For example, the warning triggers for the following redeclarations
6561 because the first one allows an array of any size to be passed to
6562 "f" while the second one with the keyword "static" specifies that
6563 the array argument must have at least four elements.
6564
6565 void f (int[static 4]);
6566 void f (int[]); // warning (inconsistent array form)
6567
6568 void g (void)
6569 {
6570 int *p = (int *)malloc (4);
6571 f (p); // warning (array too small)
6572 ...
6573 }
6574
6575 At level 2 the warning also triggers for redeclarations involving
6576 any other inconsistency in array or pointer argument forms denoting
6577 array sizes. Pointers and arrays of unspecified bound are
6578 considered equivalent and do not trigger a warning.
6579
6580 void g (int*);
6581 void g (int[]); // no warning
6582 void g (int[8]); // warning (inconsistent array bound)
6583
6584 -Warray-parameter=2 is included in -Wall. The -Wvla-parameter
6585 option triggers warnings for similar inconsistencies involving
6586 Variable Length Array arguments.
6587
6588 -Wattribute-alias=n
6589 -Wno-attribute-alias
6590 Warn about declarations using the "alias" and similar attributes
6591 whose target is incompatible with the type of the alias.
6592
6593 -Wattribute-alias=1
6594 The default warning level of the -Wattribute-alias option
6595 diagnoses incompatibilities between the type of the alias
6596 declaration and that of its target. Such incompatibilities are
6597 typically indicative of bugs.
6598
6599 -Wattribute-alias=2
6600 At this level -Wattribute-alias also diagnoses cases where the
6601 attributes of the alias declaration are more restrictive than
6602 the attributes applied to its target. These mismatches can
6603 potentially result in incorrect code generation. In other
6604 cases they may be benign and could be resolved simply by adding
6605 the missing attribute to the target. For comparison, see the
6606 -Wmissing-attributes option, which controls diagnostics when
6607 the alias declaration is less restrictive than the target,
6608 rather than more restrictive.
6609
6610 Attributes considered include "alloc_align", "alloc_size",
6611 "cold", "const", "hot", "leaf", "malloc", "nonnull",
6612 "noreturn", "nothrow", "pure", "returns_nonnull", and
6613 "returns_twice".
6614
6615 -Wattribute-alias is equivalent to -Wattribute-alias=1. This is
6616 the default. You can disable these warnings with either
6617 -Wno-attribute-alias or -Wattribute-alias=0.
6618
6619 -Wbidi-chars=[none|unpaired|any|ucn]
6620 Warn about possibly misleading UTF-8 bidirectional control
6621 characters in comments, string literals, character constants, and
6622 identifiers. Such characters can change left-to-right writing
6623 direction into right-to-left (and vice versa), which can cause
6624 confusion between the logical order and visual order. This may be
6625 dangerous; for instance, it may seem that a piece of code is not
6626 commented out, whereas it in fact is.
6627
6628 There are three levels of warning supported by GCC. The default is
6629 -Wbidi-chars=unpaired, which warns about improperly terminated bidi
6630 contexts. -Wbidi-chars=none turns the warning off.
6631 -Wbidi-chars=any warns about any use of bidirectional control
6632 characters.
6633
6634 By default, this warning does not warn about UCNs. It is, however,
6635 possible to turn on such checking by using
6636 -Wbidi-chars=unpaired,ucn or -Wbidi-chars=any,ucn. Using
6637 -Wbidi-chars=ucn is valid, and is equivalent to
6638 -Wbidi-chars=unpaired,ucn, if no previous -Wbidi-chars=any was
6639 specified.
6640
6641 -Wbool-compare
6642 Warn about boolean expression compared with an integer value
6643 different from "true"/"false". For instance, the following
6644 comparison is always false:
6645
6646 int n = 5;
6647 ...
6648 if ((n > 1) == 2) { ... }
6649
6650 This warning is enabled by -Wall.
6651
6652 -Wbool-operation
6653 Warn about suspicious operations on expressions of a boolean type.
6654 For instance, bitwise negation of a boolean is very likely a bug in
6655 the program. For C, this warning also warns about incrementing or
6656 decrementing a boolean, which rarely makes sense. (In C++,
6657 decrementing a boolean is always invalid. Incrementing a boolean
6658 is invalid in C++17, and deprecated otherwise.)
6659
6660 This warning is enabled by -Wall.
6661
6662 -Wduplicated-branches
6663 Warn when an if-else has identical branches. This warning detects
6664 cases like
6665
6666 if (p != NULL)
6667 return 0;
6668 else
6669 return 0;
6670
6671 It doesn't warn when both branches contain just a null statement.
6672 This warning also warn for conditional operators:
6673
6674 int i = x ? *p : *p;
6675
6676 -Wduplicated-cond
6677 Warn about duplicated conditions in an if-else-if chain. For
6678 instance, warn for the following code:
6679
6680 if (p->q != NULL) { ... }
6681 else if (p->q != NULL) { ... }
6682
6683 -Wframe-address
6684 Warn when the __builtin_frame_address or __builtin_return_address
6685 is called with an argument greater than 0. Such calls may return
6686 indeterminate values or crash the program. The warning is included
6687 in -Wall.
6688
6689 -Wno-discarded-qualifiers (C and Objective-C only)
6690 Do not warn if type qualifiers on pointers are being discarded.
6691 Typically, the compiler warns if a "const char *" variable is
6692 passed to a function that takes a "char *" parameter. This option
6693 can be used to suppress such a warning.
6694
6695 -Wno-discarded-array-qualifiers (C and Objective-C only)
6696 Do not warn if type qualifiers on arrays which are pointer targets
6697 are being discarded. Typically, the compiler warns if a "const int
6698 (*)[]" variable is passed to a function that takes a "int (*)[]"
6699 parameter. This option can be used to suppress such a warning.
6700
6701 -Wno-incompatible-pointer-types (C and Objective-C only)
6702 Do not warn when there is a conversion between pointers that have
6703 incompatible types. This warning is for cases not covered by
6704 -Wno-pointer-sign, which warns for pointer argument passing or
6705 assignment with different signedness.
6706
6707 -Wno-int-conversion (C and Objective-C only)
6708 Do not warn about incompatible integer to pointer and pointer to
6709 integer conversions. This warning is about implicit conversions;
6710 for explicit conversions the warnings -Wno-int-to-pointer-cast and
6711 -Wno-pointer-to-int-cast may be used.
6712
6713 -Wzero-length-bounds
6714 Warn about accesses to elements of zero-length array members that
6715 might overlap other members of the same object. Declaring interior
6716 zero-length arrays is discouraged because accesses to them are
6717 undefined.
6718
6719 For example, the first two stores in function "bad" are diagnosed
6720 because the array elements overlap the subsequent members "b" and
6721 "c". The third store is diagnosed by -Warray-bounds because it is
6722 beyond the bounds of the enclosing object.
6723
6724 struct X { int a[0]; int b, c; };
6725 struct X x;
6726
6727 void bad (void)
6728 {
6729 x.a[0] = 0; // -Wzero-length-bounds
6730 x.a[1] = 1; // -Wzero-length-bounds
6731 x.a[2] = 2; // -Warray-bounds
6732 }
6733
6734 Option -Wzero-length-bounds is enabled by -Warray-bounds.
6735
6736 -Wno-div-by-zero
6737 Do not warn about compile-time integer division by zero. Floating-
6738 point division by zero is not warned about, as it can be a
6739 legitimate way of obtaining infinities and NaNs.
6740
6741 -Wsystem-headers
6742 Print warning messages for constructs found in system header files.
6743 Warnings from system headers are normally suppressed, on the
6744 assumption that they usually do not indicate real problems and
6745 would only make the compiler output harder to read. Using this
6746 command-line option tells GCC to emit warnings from system headers
6747 as if they occurred in user code. However, note that using -Wall
6748 in conjunction with this option does not warn about unknown pragmas
6749 in system headers---for that, -Wunknown-pragmas must also be used.
6750
6751 -Wtautological-compare
6752 Warn if a self-comparison always evaluates to true or false. This
6753 warning detects various mistakes such as:
6754
6755 int i = 1;
6756 ...
6757 if (i > i) { ... }
6758
6759 This warning also warns about bitwise comparisons that always
6760 evaluate to true or false, for instance:
6761
6762 if ((a & 16) == 10) { ... }
6763
6764 will always be false.
6765
6766 This warning is enabled by -Wall.
6767
6768 -Wtrampolines
6769 Warn about trampolines generated for pointers to nested functions.
6770 A trampoline is a small piece of data or code that is created at
6771 run time on the stack when the address of a nested function is
6772 taken, and is used to call the nested function indirectly. For
6773 some targets, it is made up of data only and thus requires no
6774 special treatment. But, for most targets, it is made up of code
6775 and thus requires the stack to be made executable in order for the
6776 program to work properly.
6777
6778 -Wfloat-equal
6779 Warn if floating-point values are used in equality comparisons.
6780
6781 The idea behind this is that sometimes it is convenient (for the
6782 programmer) to consider floating-point values as approximations to
6783 infinitely precise real numbers. If you are doing this, then you
6784 need to compute (by analyzing the code, or in some other way) the
6785 maximum or likely maximum error that the computation introduces,
6786 and allow for it when performing comparisons (and when producing
6787 output, but that's a different problem). In particular, instead of
6788 testing for equality, you should check to see whether the two
6789 values have ranges that overlap; and this is done with the
6790 relational operators, so equality comparisons are probably
6791 mistaken.
6792
6793 -Wtraditional (C and Objective-C only)
6794 Warn about certain constructs that behave differently in
6795 traditional and ISO C. Also warn about ISO C constructs that have
6796 no traditional C equivalent, and/or problematic constructs that
6797 should be avoided.
6798
6799 * Macro parameters that appear within string literals in the
6800 macro body. In traditional C macro replacement takes place
6801 within string literals, but in ISO C it does not.
6802
6803 * In traditional C, some preprocessor directives did not exist.
6804 Traditional preprocessors only considered a line to be a
6805 directive if the # appeared in column 1 on the line. Therefore
6806 -Wtraditional warns about directives that traditional C
6807 understands but ignores because the # does not appear as the
6808 first character on the line. It also suggests you hide
6809 directives like "#pragma" not understood by traditional C by
6810 indenting them. Some traditional implementations do not
6811 recognize "#elif", so this option suggests avoiding it
6812 altogether.
6813
6814 * A function-like macro that appears without arguments.
6815
6816 * The unary plus operator.
6817
6818 * The U integer constant suffix, or the F or L floating-point
6819 constant suffixes. (Traditional C does support the L suffix on
6820 integer constants.) Note, these suffixes appear in macros
6821 defined in the system headers of most modern systems, e.g. the
6822 _MIN/_MAX macros in "<limits.h>". Use of these macros in user
6823 code might normally lead to spurious warnings, however GCC's
6824 integrated preprocessor has enough context to avoid warning in
6825 these cases.
6826
6827 * A function declared external in one block and then used after
6828 the end of the block.
6829
6830 * A "switch" statement has an operand of type "long".
6831
6832 * A non-"static" function declaration follows a "static" one.
6833 This construct is not accepted by some traditional C compilers.
6834
6835 * The ISO type of an integer constant has a different width or
6836 signedness from its traditional type. This warning is only
6837 issued if the base of the constant is ten. I.e. hexadecimal or
6838 octal values, which typically represent bit patterns, are not
6839 warned about.
6840
6841 * Usage of ISO string concatenation is detected.
6842
6843 * Initialization of automatic aggregates.
6844
6845 * Identifier conflicts with labels. Traditional C lacks a
6846 separate namespace for labels.
6847
6848 * Initialization of unions. If the initializer is zero, the
6849 warning is omitted. This is done under the assumption that the
6850 zero initializer in user code appears conditioned on e.g.
6851 "__STDC__" to avoid missing initializer warnings and relies on
6852 default initialization to zero in the traditional C case.
6853
6854 * Conversions by prototypes between fixed/floating-point values
6855 and vice versa. The absence of these prototypes when compiling
6856 with traditional C causes serious problems. This is a subset
6857 of the possible conversion warnings; for the full set use
6858 -Wtraditional-conversion.
6859
6860 * Use of ISO C style function definitions. This warning
6861 intentionally is not issued for prototype declarations or
6862 variadic functions because these ISO C features appear in your
6863 code when using libiberty's traditional C compatibility macros,
6864 "PARAMS" and "VPARAMS". This warning is also bypassed for
6865 nested functions because that feature is already a GCC
6866 extension and thus not relevant to traditional C compatibility.
6867
6868 -Wtraditional-conversion (C and Objective-C only)
6869 Warn if a prototype causes a type conversion that is different from
6870 what would happen to the same argument in the absence of a
6871 prototype. This includes conversions of fixed point to floating
6872 and vice versa, and conversions changing the width or signedness of
6873 a fixed-point argument except when the same as the default
6874 promotion.
6875
6876 -Wdeclaration-after-statement (C and Objective-C only)
6877 Warn when a declaration is found after a statement in a block.
6878 This construct, known from C++, was introduced with ISO C99 and is
6879 by default allowed in GCC. It is not supported by ISO C90.
6880
6881 -Wshadow
6882 Warn whenever a local variable or type declaration shadows another
6883 variable, parameter, type, class member (in C++), or instance
6884 variable (in Objective-C) or whenever a built-in function is
6885 shadowed. Note that in C++, the compiler warns if a local variable
6886 shadows an explicit typedef, but not if it shadows a
6887 struct/class/enum. If this warning is enabled, it includes also
6888 all instances of local shadowing. This means that
6889 -Wno-shadow=local and -Wno-shadow=compatible-local are ignored when
6890 -Wshadow is used. Same as -Wshadow=global.
6891
6892 -Wno-shadow-ivar (Objective-C only)
6893 Do not warn whenever a local variable shadows an instance variable
6894 in an Objective-C method.
6895
6896 -Wshadow=global
6897 Warn for any shadowing. Same as -Wshadow.
6898
6899 -Wshadow=local
6900 Warn when a local variable shadows another local variable or
6901 parameter.
6902
6903 -Wshadow=compatible-local
6904 Warn when a local variable shadows another local variable or
6905 parameter whose type is compatible with that of the shadowing
6906 variable. In C++, type compatibility here means the type of the
6907 shadowing variable can be converted to that of the shadowed
6908 variable. The creation of this flag (in addition to
6909 -Wshadow=local) is based on the idea that when a local variable
6910 shadows another one of incompatible type, it is most likely
6911 intentional, not a bug or typo, as shown in the following example:
6912
6913 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6914 {
6915 for (int i = 0; i < N; ++i)
6916 {
6917 ...
6918 }
6919 ...
6920 }
6921
6922 Since the two variable "i" in the example above have incompatible
6923 types, enabling only -Wshadow=compatible-local does not emit a
6924 warning. Because their types are incompatible, if a programmer
6925 accidentally uses one in place of the other, type checking is
6926 expected to catch that and emit an error or warning. Use of this
6927 flag instead of -Wshadow=local can possibly reduce the number of
6928 warnings triggered by intentional shadowing. Note that this also
6929 means that shadowing "const char *i" by "char *i" does not emit a
6930 warning.
6931
6932 This warning is also enabled by -Wshadow=local.
6933
6934 -Wlarger-than=byte-size
6935 Warn whenever an object is defined whose size exceeds byte-size.
6936 -Wlarger-than=PTRDIFF_MAX is enabled by default. Warnings
6937 controlled by the option can be disabled either by specifying byte-
6938 size of SIZE_MAX or more or by -Wno-larger-than.
6939
6940 Also warn for calls to bounded functions such as "memchr" or
6941 "strnlen" that specify a bound greater than the largest possible
6942 object, which is PTRDIFF_MAX bytes by default. These warnings can
6943 only be disabled by -Wno-larger-than.
6944
6945 -Wno-larger-than
6946 Disable -Wlarger-than= warnings. The option is equivalent to
6947 -Wlarger-than=SIZE_MAX or larger.
6948
6949 -Wframe-larger-than=byte-size
6950 Warn if the size of a function frame exceeds byte-size. The
6951 computation done to determine the stack frame size is approximate
6952 and not conservative. The actual requirements may be somewhat
6953 greater than byte-size even if you do not get a warning. In
6954 addition, any space allocated via "alloca", variable-length arrays,
6955 or related constructs is not included by the compiler when
6956 determining whether or not to issue a warning.
6957 -Wframe-larger-than=PTRDIFF_MAX is enabled by default. Warnings
6958 controlled by the option can be disabled either by specifying byte-
6959 size of SIZE_MAX or more or by -Wno-frame-larger-than.
6960
6961 -Wno-frame-larger-than
6962 Disable -Wframe-larger-than= warnings. The option is equivalent to
6963 -Wframe-larger-than=SIZE_MAX or larger.
6964
6965 -Wfree-nonheap-object
6966 Warn when attempting to deallocate an object that was either not
6967 allocated on the heap, or by using a pointer that was not returned
6968 from a prior call to the corresponding allocation function. For
6969 example, because the call to "stpcpy" returns a pointer to the
6970 terminating nul character and not to the beginning of the object,
6971 the call to "free" below is diagnosed.
6972
6973 void f (char *p)
6974 {
6975 p = stpcpy (p, "abc");
6976 // ...
6977 free (p); // warning
6978 }
6979
6980 -Wfree-nonheap-object is included in -Wall.
6981
6982 -Wstack-usage=byte-size
6983 Warn if the stack usage of a function might exceed byte-size. The
6984 computation done to determine the stack usage is conservative. Any
6985 space allocated via "alloca", variable-length arrays, or related
6986 constructs is included by the compiler when determining whether or
6987 not to issue a warning.
6988
6989 The message is in keeping with the output of -fstack-usage.
6990
6991 * If the stack usage is fully static but exceeds the specified
6992 amount, it's:
6993
6994 warning: stack usage is 1120 bytes
6995
6996 * If the stack usage is (partly) dynamic but bounded, it's:
6997
6998 warning: stack usage might be 1648 bytes
6999
7000 * If the stack usage is (partly) dynamic and not bounded, it's:
7001
7002 warning: stack usage might be unbounded
7003
7004 -Wstack-usage=PTRDIFF_MAX is enabled by default. Warnings
7005 controlled by the option can be disabled either by specifying byte-
7006 size of SIZE_MAX or more or by -Wno-stack-usage.
7007
7008 -Wno-stack-usage
7009 Disable -Wstack-usage= warnings. The option is equivalent to
7010 -Wstack-usage=SIZE_MAX or larger.
7011
7012 -Wunsafe-loop-optimizations
7013 Warn if the loop cannot be optimized because the compiler cannot
7014 assume anything on the bounds of the loop indices. With
7015 -funsafe-loop-optimizations warn if the compiler makes such
7016 assumptions.
7017
7018 -Wno-pedantic-ms-format (MinGW targets only)
7019 When used in combination with -Wformat and -pedantic without GNU
7020 extensions, this option disables the warnings about non-ISO
7021 "printf" / "scanf" format width specifiers "I32", "I64", and "I"
7022 used on Windows targets, which depend on the MS runtime.
7023
7024 -Wpointer-arith
7025 Warn about anything that depends on the "size of" a function type
7026 or of "void". GNU C assigns these types a size of 1, for
7027 convenience in calculations with "void *" pointers and pointers to
7028 functions. In C++, warn also when an arithmetic operation involves
7029 "NULL". This warning is also enabled by -Wpedantic.
7030
7031 -Wno-pointer-compare
7032 Do not warn if a pointer is compared with a zero character
7033 constant. This usually means that the pointer was meant to be
7034 dereferenced. For example:
7035
7036 const char *p = foo ();
7037 if (p == '\0')
7038 return 42;
7039
7040 Note that the code above is invalid in C++11.
7041
7042 This warning is enabled by default.
7043
7044 -Wtsan
7045 Warn about unsupported features in ThreadSanitizer.
7046
7047 ThreadSanitizer does not support "std::atomic_thread_fence" and can
7048 report false positives.
7049
7050 This warning is enabled by default.
7051
7052 -Wtype-limits
7053 Warn if a comparison is always true or always false due to the
7054 limited range of the data type, but do not warn for constant
7055 expressions. For example, warn if an unsigned variable is compared
7056 against zero with "<" or ">=". This warning is also enabled by
7057 -Wextra.
7058
7059 -Wabsolute-value (C and Objective-C only)
7060 Warn for calls to standard functions that compute the absolute
7061 value of an argument when a more appropriate standard function is
7062 available. For example, calling abs(3.14) triggers the warning
7063 because the appropriate function to call to compute the absolute
7064 value of a double argument is "fabs". The option also triggers
7065 warnings when the argument in a call to such a function has an
7066 unsigned type. This warning can be suppressed with an explicit
7067 type cast and it is also enabled by -Wextra.
7068
7069 -Wcomment
7070 -Wcomments
7071 Warn whenever a comment-start sequence /* appears in a /* comment,
7072 or whenever a backslash-newline appears in a // comment. This
7073 warning is enabled by -Wall.
7074
7075 -Wtrigraphs
7076 Warn if any trigraphs are encountered that might change the meaning
7077 of the program. Trigraphs within comments are not warned about,
7078 except those that would form escaped newlines.
7079
7080 This option is implied by -Wall. If -Wall is not given, this
7081 option is still enabled unless trigraphs are enabled. To get
7082 trigraph conversion without warnings, but get the other -Wall
7083 warnings, use -trigraphs -Wall -Wno-trigraphs.
7084
7085 -Wundef
7086 Warn if an undefined identifier is evaluated in an "#if" directive.
7087 Such identifiers are replaced with zero.
7088
7089 -Wexpansion-to-defined
7090 Warn whenever defined is encountered in the expansion of a macro
7091 (including the case where the macro is expanded by an #if
7092 directive). Such usage is not portable. This warning is also
7093 enabled by -Wpedantic and -Wextra.
7094
7095 -Wunused-macros
7096 Warn about macros defined in the main file that are unused. A
7097 macro is used if it is expanded or tested for existence at least
7098 once. The preprocessor also warns if the macro has not been used
7099 at the time it is redefined or undefined.
7100
7101 Built-in macros, macros defined on the command line, and macros
7102 defined in include files are not warned about.
7103
7104 Note: If a macro is actually used, but only used in skipped
7105 conditional blocks, then the preprocessor reports it as unused. To
7106 avoid the warning in such a case, you might improve the scope of
7107 the macro's definition by, for example, moving it into the first
7108 skipped block. Alternatively, you could provide a dummy use with
7109 something like:
7110
7111 #if defined the_macro_causing_the_warning
7112 #endif
7113
7114 -Wno-endif-labels
7115 Do not warn whenever an "#else" or an "#endif" are followed by
7116 text. This sometimes happens in older programs with code of the
7117 form
7118
7119 #if FOO
7120 ...
7121 #else FOO
7122 ...
7123 #endif FOO
7124
7125 The second and third "FOO" should be in comments. This warning is
7126 on by default.
7127
7128 -Wbad-function-cast (C and Objective-C only)
7129 Warn when a function call is cast to a non-matching type. For
7130 example, warn if a call to a function returning an integer type is
7131 cast to a pointer type.
7132
7133 -Wc90-c99-compat (C and Objective-C only)
7134 Warn about features not present in ISO C90, but present in ISO C99.
7135 For instance, warn about use of variable length arrays, "long long"
7136 type, "bool" type, compound literals, designated initializers, and
7137 so on. This option is independent of the standards mode. Warnings
7138 are disabled in the expression that follows "__extension__".
7139
7140 -Wc99-c11-compat (C and Objective-C only)
7141 Warn about features not present in ISO C99, but present in ISO C11.
7142 For instance, warn about use of anonymous structures and unions,
7143 "_Atomic" type qualifier, "_Thread_local" storage-class specifier,
7144 "_Alignas" specifier, "Alignof" operator, "_Generic" keyword, and
7145 so on. This option is independent of the standards mode. Warnings
7146 are disabled in the expression that follows "__extension__".
7147
7148 -Wc11-c2x-compat (C and Objective-C only)
7149 Warn about features not present in ISO C11, but present in ISO C2X.
7150 For instance, warn about omitting the string in "_Static_assert",
7151 use of [[]] syntax for attributes, use of decimal floating-point
7152 types, and so on. This option is independent of the standards
7153 mode. Warnings are disabled in the expression that follows
7154 "__extension__".
7155
7156 -Wc++-compat (C and Objective-C only)
7157 Warn about ISO C constructs that are outside of the common subset
7158 of ISO C and ISO C++, e.g. request for implicit conversion from
7159 "void *" to a pointer to non-"void" type.
7160
7161 -Wc++11-compat (C++ and Objective-C++ only)
7162 Warn about C++ constructs whose meaning differs between ISO C++
7163 1998 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are
7164 keywords in ISO C++ 2011. This warning turns on -Wnarrowing and is
7165 enabled by -Wall.
7166
7167 -Wc++14-compat (C++ and Objective-C++ only)
7168 Warn about C++ constructs whose meaning differs between ISO C++
7169 2011 and ISO C++ 2014. This warning is enabled by -Wall.
7170
7171 -Wc++17-compat (C++ and Objective-C++ only)
7172 Warn about C++ constructs whose meaning differs between ISO C++
7173 2014 and ISO C++ 2017. This warning is enabled by -Wall.
7174
7175 -Wc++20-compat (C++ and Objective-C++ only)
7176 Warn about C++ constructs whose meaning differs between ISO C++
7177 2017 and ISO C++ 2020. This warning is enabled by -Wall.
7178
7179 -Wno-c++11-extensions (C++ and Objective-C++ only)
7180 Do not warn about C++11 constructs in code being compiled using an
7181 older C++ standard. Even without this option, some C++11
7182 constructs will only be diagnosed if -Wpedantic is used.
7183
7184 -Wno-c++14-extensions (C++ and Objective-C++ only)
7185 Do not warn about C++14 constructs in code being compiled using an
7186 older C++ standard. Even without this option, some C++14
7187 constructs will only be diagnosed if -Wpedantic is used.
7188
7189 -Wno-c++17-extensions (C++ and Objective-C++ only)
7190 Do not warn about C++17 constructs in code being compiled using an
7191 older C++ standard. Even without this option, some C++17
7192 constructs will only be diagnosed if -Wpedantic is used.
7193
7194 -Wno-c++20-extensions (C++ and Objective-C++ only)
7195 Do not warn about C++20 constructs in code being compiled using an
7196 older C++ standard. Even without this option, some C++20
7197 constructs will only be diagnosed if -Wpedantic is used.
7198
7199 -Wno-c++23-extensions (C++ and Objective-C++ only)
7200 Do not warn about C++23 constructs in code being compiled using an
7201 older C++ standard. Even without this option, some C++23
7202 constructs will only be diagnosed if -Wpedantic is used.
7203
7204 -Wcast-qual
7205 Warn whenever a pointer is cast so as to remove a type qualifier
7206 from the target type. For example, warn if a "const char *" is
7207 cast to an ordinary "char *".
7208
7209 Also warn when making a cast that introduces a type qualifier in an
7210 unsafe way. For example, casting "char **" to "const char **" is
7211 unsafe, as in this example:
7212
7213 /* p is char ** value. */
7214 const char **q = (const char **) p;
7215 /* Assignment of readonly string to const char * is OK. */
7216 *q = "string";
7217 /* Now char** pointer points to read-only memory. */
7218 **p = 'b';
7219
7220 -Wcast-align
7221 Warn whenever a pointer is cast such that the required alignment of
7222 the target is increased. For example, warn if a "char *" is cast
7223 to an "int *" on machines where integers can only be accessed at
7224 two- or four-byte boundaries.
7225
7226 -Wcast-align=strict
7227 Warn whenever a pointer is cast such that the required alignment of
7228 the target is increased. For example, warn if a "char *" is cast
7229 to an "int *" regardless of the target machine.
7230
7231 -Wcast-function-type
7232 Warn when a function pointer is cast to an incompatible function
7233 pointer. In a cast involving function types with a variable
7234 argument list only the types of initial arguments that are provided
7235 are considered. Any parameter of pointer-type matches any other
7236 pointer-type. Any benign differences in integral types are
7237 ignored, like "int" vs. "long" on ILP32 targets. Likewise type
7238 qualifiers are ignored. The function type "void (*) (void)" is
7239 special and matches everything, which can be used to suppress this
7240 warning. In a cast involving pointer to member types this warning
7241 warns whenever the type cast is changing the pointer to member
7242 type. This warning is enabled by -Wextra.
7243
7244 -Wwrite-strings
7245 When compiling C, give string constants the type "const
7246 char[length]" so that copying the address of one into a non-"const"
7247 "char *" pointer produces a warning. These warnings help you find
7248 at compile time code that can try to write into a string constant,
7249 but only if you have been very careful about using "const" in
7250 declarations and prototypes. Otherwise, it is just a nuisance.
7251 This is why we did not make -Wall request these warnings.
7252
7253 When compiling C++, warn about the deprecated conversion from
7254 string literals to "char *". This warning is enabled by default
7255 for C++ programs.
7256
7257 -Wclobbered
7258 Warn for variables that might be changed by "longjmp" or "vfork".
7259 This warning is also enabled by -Wextra.
7260
7261 -Wno-complain-wrong-lang
7262 By default, language front ends complain when a command-line option
7263 is valid, but not applicable to that front end. This may be
7264 disabled with -Wno-complain-wrong-lang, which is mostly useful when
7265 invoking a single compiler driver for multiple source files written
7266 in different languages, for example:
7267
7268 $ g++ -fno-rtti a.cc b.f90
7269
7270 The driver g++ invokes the C++ front end to compile a.cc and the
7271 Fortran front end to compile b.f90. The latter front end diagnoses
7272 f951: Warning: command-line option '-fno-rtti' is valid for
7273 C++/D/ObjC++ but not for Fortran, which may be disabled with
7274 -Wno-complain-wrong-lang.
7275
7276 -Wconversion
7277 Warn for implicit conversions that may alter a value. This includes
7278 conversions between real and integer, like "abs (x)" when "x" is
7279 "double"; conversions between signed and unsigned, like "unsigned
7280 ui = -1"; and conversions to smaller types, like "sqrtf (M_PI)". Do
7281 not warn for explicit casts like "abs ((int) x)" and "ui =
7282 (unsigned) -1", or if the value is not changed by the conversion
7283 like in "abs (2.0)". Warnings about conversions between signed and
7284 unsigned integers can be disabled by using -Wno-sign-conversion.
7285
7286 For C++, also warn for confusing overload resolution for user-
7287 defined conversions; and conversions that never use a type
7288 conversion operator: conversions to "void", the same type, a base
7289 class or a reference to them. Warnings about conversions between
7290 signed and unsigned integers are disabled by default in C++ unless
7291 -Wsign-conversion is explicitly enabled.
7292
7293 Warnings about conversion from arithmetic on a small type back to
7294 that type are only given with -Warith-conversion.
7295
7296 -Wdangling-else
7297 Warn about constructions where there may be confusion to which "if"
7298 statement an "else" branch belongs. Here is an example of such a
7299 case:
7300
7301 {
7302 if (a)
7303 if (b)
7304 foo ();
7305 else
7306 bar ();
7307 }
7308
7309 In C/C++, every "else" branch belongs to the innermost possible
7310 "if" statement, which in this example is "if (b)". This is often
7311 not what the programmer expected, as illustrated in the above
7312 example by indentation the programmer chose. When there is the
7313 potential for this confusion, GCC issues a warning when this flag
7314 is specified. To eliminate the warning, add explicit braces around
7315 the innermost "if" statement so there is no way the "else" can
7316 belong to the enclosing "if". The resulting code looks like this:
7317
7318 {
7319 if (a)
7320 {
7321 if (b)
7322 foo ();
7323 else
7324 bar ();
7325 }
7326 }
7327
7328 This warning is enabled by -Wparentheses.
7329
7330 -Wdangling-pointer
7331 -Wdangling-pointer=n
7332 Warn about uses of pointers (or C++ references) to objects with
7333 automatic storage duration after their lifetime has ended. This
7334 includes local variables declared in nested blocks, compound
7335 literals and other unnamed temporary objects. In addition, warn
7336 about storing the address of such objects in escaped pointers. The
7337 warning is enabled at all optimization levels but may yield
7338 different results with optimization than without.
7339
7340 -Wdangling-pointer=1
7341 At level 1 the warning diagnoses only unconditional uses of
7342 dangling pointers. For example
7343
7344 int f (int c1, int c2, x)
7345 {
7346 char *p = strchr ((char[]){ c1, c2 }, c3);
7347 // warning: dangling pointer to a compound literal
7348 return p ? *p : 'x';
7349 }
7350
7351 In the following function the store of the address of the local
7352 variable "x" in the escaped pointer *p also triggers the
7353 warning.
7354
7355 void g (int **p)
7356 {
7357 int x = 7;
7358 // warning: storing the address of a local variable in *p
7359 *p = &x;
7360 }
7361
7362 -Wdangling-pointer=2
7363 At level 2, in addition to unconditional uses the warning also
7364 diagnoses conditional uses of dangling pointers.
7365
7366 For example, because the array a in the following function is
7367 out of scope when the pointer s that was set to point is used,
7368 the warning triggers at this level.
7369
7370 void f (char *s)
7371 {
7372 if (!s)
7373 {
7374 char a[12] = "tmpname";
7375 s = a;
7376 }
7377 // warning: dangling pointer to a may be used
7378 strcat (s, ".tmp");
7379 ...
7380 }
7381
7382 -Wdangling-pointer=2 is included in -Wall.
7383
7384 -Wdate-time
7385 Warn when macros "__TIME__", "__DATE__" or "__TIMESTAMP__" are
7386 encountered as they might prevent bit-wise-identical reproducible
7387 compilations.
7388
7389 -Wempty-body
7390 Warn if an empty body occurs in an "if", "else" or "do while"
7391 statement. This warning is also enabled by -Wextra.
7392
7393 -Wno-endif-labels
7394 Do not warn about stray tokens after "#else" and "#endif".
7395
7396 -Wenum-compare
7397 Warn about a comparison between values of different enumerated
7398 types. In C++ enumerated type mismatches in conditional
7399 expressions are also diagnosed and the warning is enabled by
7400 default. In C this warning is enabled by -Wall.
7401
7402 -Wenum-conversion
7403 Warn when a value of enumerated type is implicitly converted to a
7404 different enumerated type. This warning is enabled by -Wextra in
7405 C.
7406
7407 -Wenum-int-mismatch (C and Objective-C only)
7408 Warn about mismatches between an enumerated type and an integer
7409 type in declarations. For example:
7410
7411 enum E { l = -1, z = 0, g = 1 };
7412 int foo(void);
7413 enum E foo(void);
7414
7415 In C, an enumerated type is compatible with "char", a signed
7416 integer type, or an unsigned integer type. However, since the
7417 choice of the underlying type of an enumerated type is
7418 implementation-defined, such mismatches may cause portability
7419 issues. In C++, such mismatches are an error. In C, this warning
7420 is enabled by -Wall and -Wc++-compat.
7421
7422 -Wjump-misses-init (C, Objective-C only)
7423 Warn if a "goto" statement or a "switch" statement jumps forward
7424 across the initialization of a variable, or jumps backward to a
7425 label after the variable has been initialized. This only warns
7426 about variables that are initialized when they are declared. This
7427 warning is only supported for C and Objective-C; in C++ this sort
7428 of branch is an error in any case.
7429
7430 -Wjump-misses-init is included in -Wc++-compat. It can be disabled
7431 with the -Wno-jump-misses-init option.
7432
7433 -Wsign-compare
7434 Warn when a comparison between signed and unsigned values could
7435 produce an incorrect result when the signed value is converted to
7436 unsigned. In C++, this warning is also enabled by -Wall. In C, it
7437 is also enabled by -Wextra.
7438
7439 -Wsign-conversion
7440 Warn for implicit conversions that may change the sign of an
7441 integer value, like assigning a signed integer expression to an
7442 unsigned integer variable. An explicit cast silences the warning.
7443 In C, this option is enabled also by -Wconversion.
7444
7445 -Wfloat-conversion
7446 Warn for implicit conversions that reduce the precision of a real
7447 value. This includes conversions from real to integer, and from
7448 higher precision real to lower precision real values. This option
7449 is also enabled by -Wconversion.
7450
7451 -Wno-scalar-storage-order
7452 Do not warn on suspicious constructs involving reverse scalar
7453 storage order.
7454
7455 -Wsizeof-array-div
7456 Warn about divisions of two sizeof operators when the first one is
7457 applied to an array and the divisor does not equal the size of the
7458 array element. In such a case, the computation will not yield the
7459 number of elements in the array, which is likely what the user
7460 intended. This warning warns e.g. about
7461
7462 int fn ()
7463 {
7464 int arr[10];
7465 return sizeof (arr) / sizeof (short);
7466 }
7467
7468 This warning is enabled by -Wall.
7469
7470 -Wsizeof-pointer-div
7471 Warn for suspicious divisions of two sizeof expressions that divide
7472 the pointer size by the element size, which is the usual way to
7473 compute the array size but won't work out correctly with pointers.
7474 This warning warns e.g. about "sizeof (ptr) / sizeof (ptr[0])" if
7475 "ptr" is not an array, but a pointer. This warning is enabled by
7476 -Wall.
7477
7478 -Wsizeof-pointer-memaccess
7479 Warn for suspicious length parameters to certain string and memory
7480 built-in functions if the argument uses "sizeof". This warning
7481 triggers for example for "memset (ptr, 0, sizeof (ptr));" if "ptr"
7482 is not an array, but a pointer, and suggests a possible fix, or
7483 about "memcpy (&foo, ptr, sizeof (&foo));".
7484 -Wsizeof-pointer-memaccess also warns about calls to bounded string
7485 copy functions like "strncat" or "strncpy" that specify as the
7486 bound a "sizeof" expression of the source array. For example, in
7487 the following function the call to "strncat" specifies the size of
7488 the source string as the bound. That is almost certainly a mistake
7489 and so the call is diagnosed.
7490
7491 void make_file (const char *name)
7492 {
7493 char path[PATH_MAX];
7494 strncpy (path, name, sizeof path - 1);
7495 strncat (path, ".text", sizeof ".text");
7496 ...
7497 }
7498
7499 The -Wsizeof-pointer-memaccess option is enabled by -Wall.
7500
7501 -Wno-sizeof-array-argument
7502 Do not warn when the "sizeof" operator is applied to a parameter
7503 that is declared as an array in a function definition. This
7504 warning is enabled by default for C and C++ programs.
7505
7506 -Wmemset-elt-size
7507 Warn for suspicious calls to the "memset" built-in function, if the
7508 first argument references an array, and the third argument is a
7509 number equal to the number of elements, but not equal to the size
7510 of the array in memory. This indicates that the user has omitted a
7511 multiplication by the element size. This warning is enabled by
7512 -Wall.
7513
7514 -Wmemset-transposed-args
7515 Warn for suspicious calls to the "memset" built-in function where
7516 the second argument is not zero and the third argument is zero.
7517 For example, the call "memset (buf, sizeof buf, 0)" is diagnosed
7518 because "memset (buf, 0, sizeof buf)" was meant instead. The
7519 diagnostic is only emitted if the third argument is a literal zero.
7520 Otherwise, if it is an expression that is folded to zero, or a cast
7521 of zero to some type, it is far less likely that the arguments have
7522 been mistakenly transposed and no warning is emitted. This warning
7523 is enabled by -Wall.
7524
7525 -Waddress
7526 Warn about suspicious uses of address expressions. These include
7527 comparing the address of a function or a declared object to the
7528 null pointer constant such as in
7529
7530 void f (void);
7531 void g (void)
7532 {
7533 if (!f) // warning: expression evaluates to false
7534 abort ();
7535 }
7536
7537 comparisons of a pointer to a string literal, such as in
7538
7539 void f (const char *x)
7540 {
7541 if (x == "abc") // warning: expression evaluates to false
7542 puts ("equal");
7543 }
7544
7545 and tests of the results of pointer addition or subtraction for
7546 equality to null, such as in
7547
7548 void f (const int *p, int i)
7549 {
7550 return p + i == NULL;
7551 }
7552
7553 Such uses typically indicate a programmer error: the address of
7554 most functions and objects necessarily evaluates to true (the
7555 exception are weak symbols), so their use in a conditional might
7556 indicate missing parentheses in a function call or a missing
7557 dereference in an array expression. The subset of the warning for
7558 object pointers can be suppressed by casting the pointer operand to
7559 an integer type such as "intptr_t" or "uintptr_t". Comparisons
7560 against string literals result in unspecified behavior and are not
7561 portable, and suggest the intent was to call "strcmp". The warning
7562 is suppressed if the suspicious expression is the result of macro
7563 expansion. -Waddress warning is enabled by -Wall.
7564
7565 -Wno-address-of-packed-member
7566 Do not warn when the address of packed member of struct or union is
7567 taken, which usually results in an unaligned pointer value. This
7568 is enabled by default.
7569
7570 -Wlogical-op
7571 Warn about suspicious uses of logical operators in expressions.
7572 This includes using logical operators in contexts where a bit-wise
7573 operator is likely to be expected. Also warns when the operands of
7574 a logical operator are the same:
7575
7576 extern int a;
7577 if (a < 0 && a < 0) { ... }
7578
7579 -Wlogical-not-parentheses
7580 Warn about logical not used on the left hand side operand of a
7581 comparison. This option does not warn if the right operand is
7582 considered to be a boolean expression. Its purpose is to detect
7583 suspicious code like the following:
7584
7585 int a;
7586 ...
7587 if (!a > 1) { ... }
7588
7589 It is possible to suppress the warning by wrapping the LHS into
7590 parentheses:
7591
7592 if ((!a) > 1) { ... }
7593
7594 This warning is enabled by -Wall.
7595
7596 -Waggregate-return
7597 Warn if any functions that return structures or unions are defined
7598 or called. (In languages where you can return an array, this also
7599 elicits a warning.)
7600
7601 -Wno-aggressive-loop-optimizations
7602 Warn if in a loop with constant number of iterations the compiler
7603 detects undefined behavior in some statement during one or more of
7604 the iterations.
7605
7606 -Wno-attributes
7607 Do not warn if an unexpected "__attribute__" is used, such as
7608 unrecognized attributes, function attributes applied to variables,
7609 etc. This does not stop errors for incorrect use of supported
7610 attributes.
7611
7612 Additionally, using -Wno-attributes=, it is possible to suppress
7613 warnings about unknown scoped attributes (in C++11 and C2X). For
7614 example, -Wno-attributes=vendor::attr disables warning about the
7615 following declaration:
7616
7617 [[vendor::attr]] void f();
7618
7619 It is also possible to disable warning about all attributes in a
7620 namespace using -Wno-attributes=vendor:: which prevents warning
7621 about both of these declarations:
7622
7623 [[vendor::safe]] void f();
7624 [[vendor::unsafe]] void f2();
7625
7626 Note that -Wno-attributes= does not imply -Wno-attributes.
7627
7628 -Wno-builtin-declaration-mismatch
7629 Warn if a built-in function is declared with an incompatible
7630 signature or as a non-function, or when a built-in function
7631 declared with a type that does not include a prototype is called
7632 with arguments whose promoted types do not match those expected by
7633 the function. When -Wextra is specified, also warn when a built-in
7634 function that takes arguments is declared without a prototype. The
7635 -Wbuiltin-declaration-mismatch warning is enabled by default. To
7636 avoid the warning include the appropriate header to bring the
7637 prototypes of built-in functions into scope.
7638
7639 For example, the call to "memset" below is diagnosed by the warning
7640 because the function expects a value of type "size_t" as its
7641 argument but the type of 32 is "int". With -Wextra, the
7642 declaration of the function is diagnosed as well.
7643
7644 extern void* memset ();
7645 void f (void *d)
7646 {
7647 memset (d, '\0', 32);
7648 }
7649
7650 -Wno-builtin-macro-redefined
7651 Do not warn if certain built-in macros are redefined. This
7652 suppresses warnings for redefinition of "__TIMESTAMP__",
7653 "__TIME__", "__DATE__", "__FILE__", and "__BASE_FILE__".
7654
7655 -Wstrict-prototypes (C and Objective-C only)
7656 Warn if a function is declared or defined without specifying the
7657 argument types. (An old-style function definition is permitted
7658 without a warning if preceded by a declaration that specifies the
7659 argument types.)
7660
7661 -Wold-style-declaration (C and Objective-C only)
7662 Warn for obsolescent usages, according to the C Standard, in a
7663 declaration. For example, warn if storage-class specifiers like
7664 "static" are not the first things in a declaration. This warning
7665 is also enabled by -Wextra.
7666
7667 -Wold-style-definition (C and Objective-C only)
7668 Warn if an old-style function definition is used. A warning is
7669 given even if there is a previous prototype. A definition using ()
7670 is not considered an old-style definition in C2X mode, because it
7671 is equivalent to (void) in that case, but is considered an old-
7672 style definition for older standards.
7673
7674 -Wmissing-parameter-type (C and Objective-C only)
7675 A function parameter is declared without a type specifier in
7676 K&R-style functions:
7677
7678 void foo(bar) { }
7679
7680 This warning is also enabled by -Wextra.
7681
7682 -Wmissing-prototypes (C and Objective-C only)
7683 Warn if a global function is defined without a previous prototype
7684 declaration. This warning is issued even if the definition itself
7685 provides a prototype. Use this option to detect global functions
7686 that do not have a matching prototype declaration in a header file.
7687 This option is not valid for C++ because all function declarations
7688 provide prototypes and a non-matching declaration declares an
7689 overload rather than conflict with an earlier declaration. Use
7690 -Wmissing-declarations to detect missing declarations in C++.
7691
7692 -Wmissing-declarations
7693 Warn if a global function is defined without a previous
7694 declaration. Do so even if the definition itself provides a
7695 prototype. Use this option to detect global functions that are not
7696 declared in header files. In C, no warnings are issued for
7697 functions with previous non-prototype declarations; use
7698 -Wmissing-prototypes to detect missing prototypes. In C++, no
7699 warnings are issued for function templates, or for inline
7700 functions, or for functions in anonymous namespaces.
7701
7702 -Wmissing-field-initializers
7703 Warn if a structure's initializer has some fields missing. For
7704 example, the following code causes such a warning, because "x.h" is
7705 implicitly zero:
7706
7707 struct s { int f, g, h; };
7708 struct s x = { 3, 4 };
7709
7710 This option does not warn about designated initializers, so the
7711 following modification does not trigger a warning:
7712
7713 struct s { int f, g, h; };
7714 struct s x = { .f = 3, .g = 4 };
7715
7716 In C this option does not warn about the universal zero initializer
7717 { 0 }:
7718
7719 struct s { int f, g, h; };
7720 struct s x = { 0 };
7721
7722 Likewise, in C++ this option does not warn about the empty { }
7723 initializer, for example:
7724
7725 struct s { int f, g, h; };
7726 s x = { };
7727
7728 This warning is included in -Wextra. To get other -Wextra warnings
7729 without this one, use -Wextra -Wno-missing-field-initializers.
7730
7731 -Wno-missing-requires
7732 By default, the compiler warns about a concept-id appearing as a
7733 C++20 simple-requirement:
7734
7735 bool satisfied = requires { C<T> };
7736
7737 Here satisfied will be true if C<T> is a valid expression, which it
7738 is for all T. Presumably the user meant to write
7739
7740 bool satisfied = requires { requires C<T> };
7741
7742 so satisfied is only true if concept C is satisfied for type T.
7743
7744 This warning can be disabled with -Wno-missing-requires.
7745
7746 -Wno-missing-template-keyword
7747 The member access tokens ., -> and :: must be followed by the
7748 "template" keyword if the parent object is dependent and the member
7749 being named is a template.
7750
7751 template <class X>
7752 void DoStuff (X x)
7753 {
7754 x.template DoSomeOtherStuff<X>(); // Good.
7755 x.DoMoreStuff<X>(); // Warning, x is dependent.
7756 }
7757
7758 In rare cases it is possible to get false positives. To silence
7759 this, wrap the expression in parentheses. For example, the
7760 following is treated as a template, even where m and N are
7761 integers:
7762
7763 void NotATemplate (my_class t)
7764 {
7765 int N = 5;
7766
7767 bool test = t.m < N > (0); // Treated as a template.
7768 test = (t.m < N) > (0); // Same meaning, but not treated as a template.
7769 }
7770
7771 This warning can be disabled with -Wno-missing-template-keyword.
7772
7773 -Wno-multichar
7774 Do not warn if a multicharacter constant ('FOOF') is used. Usually
7775 they indicate a typo in the user's code, as they have
7776 implementation-defined values, and should not be used in portable
7777 code.
7778
7779 -Wnormalized=[none|id|nfc|nfkc]
7780 In ISO C and ISO C++, two identifiers are different if they are
7781 different sequences of characters. However, sometimes when
7782 characters outside the basic ASCII character set are used, you can
7783 have two different character sequences that look the same. To
7784 avoid confusion, the ISO 10646 standard sets out some normalization
7785 rules which when applied ensure that two sequences that look the
7786 same are turned into the same sequence. GCC can warn you if you
7787 are using identifiers that have not been normalized; this option
7788 controls that warning.
7789
7790 There are four levels of warning supported by GCC. The default is
7791 -Wnormalized=nfc, which warns about any identifier that is not in
7792 the ISO 10646 "C" normalized form, NFC. NFC is the recommended
7793 form for most uses. It is equivalent to -Wnormalized.
7794
7795 Unfortunately, there are some characters allowed in identifiers by
7796 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7797 identifiers. That is, there's no way to use these symbols in
7798 portable ISO C or C++ and have all your identifiers in NFC.
7799 -Wnormalized=id suppresses the warning for these characters. It is
7800 hoped that future versions of the standards involved will correct
7801 this, which is why this option is not the default.
7802
7803 You can switch the warning off for all characters by writing
7804 -Wnormalized=none or -Wno-normalized. You should only do this if
7805 you are using some other normalization scheme (like "D"), because
7806 otherwise you can easily create bugs that are literally impossible
7807 to see.
7808
7809 Some characters in ISO 10646 have distinct meanings but look
7810 identical in some fonts or display methodologies, especially once
7811 formatting has been applied. For instance "\u207F", "SUPERSCRIPT
7812 LATIN SMALL LETTER N", displays just like a regular "n" that has
7813 been placed in a superscript. ISO 10646 defines the NFKC
7814 normalization scheme to convert all these into a standard form as
7815 well, and GCC warns if your code is not in NFKC if you use
7816 -Wnormalized=nfkc. This warning is comparable to warning about
7817 every identifier that contains the letter O because it might be
7818 confused with the digit 0, and so is not the default, but may be
7819 useful as a local coding convention if the programming environment
7820 cannot be fixed to display these characters distinctly.
7821
7822 -Wno-attribute-warning
7823 Do not warn about usage of functions declared with "warning"
7824 attribute. By default, this warning is enabled.
7825 -Wno-attribute-warning can be used to disable the warning or
7826 -Wno-error=attribute-warning can be used to disable the error when
7827 compiled with -Werror flag.
7828
7829 -Wno-deprecated
7830 Do not warn about usage of deprecated features.
7831
7832 -Wno-deprecated-declarations
7833 Do not warn about uses of functions, variables, and types marked as
7834 deprecated by using the "deprecated" attribute.
7835
7836 -Wno-overflow
7837 Do not warn about compile-time overflow in constant expressions.
7838
7839 -Wno-odr
7840 Warn about One Definition Rule violations during link-time
7841 optimization. Enabled by default.
7842
7843 -Wopenacc-parallelism
7844 Warn about potentially suboptimal choices related to OpenACC
7845 parallelism.
7846
7847 -Wopenmp-simd
7848 Warn if the vectorizer cost model overrides the OpenMP simd
7849 directive set by user. The -fsimd-cost-model=unlimited option can
7850 be used to relax the cost model.
7851
7852 -Woverride-init (C and Objective-C only)
7853 Warn if an initialized field without side effects is overridden
7854 when using designated initializers.
7855
7856 This warning is included in -Wextra. To get other -Wextra warnings
7857 without this one, use -Wextra -Wno-override-init.
7858
7859 -Wno-override-init-side-effects (C and Objective-C only)
7860 Do not warn if an initialized field with side effects is overridden
7861 when using designated initializers. This warning is enabled by
7862 default.
7863
7864 -Wpacked
7865 Warn if a structure is given the packed attribute, but the packed
7866 attribute has no effect on the layout or size of the structure.
7867 Such structures may be mis-aligned for little benefit. For
7868 instance, in this code, the variable "f.x" in "struct bar" is
7869 misaligned even though "struct bar" does not itself have the packed
7870 attribute:
7871
7872 struct foo {
7873 int x;
7874 char a, b, c, d;
7875 } __attribute__((packed));
7876 struct bar {
7877 char z;
7878 struct foo f;
7879 };
7880
7881 -Wnopacked-bitfield-compat
7882 The 4.1, 4.2 and 4.3 series of GCC ignore the "packed" attribute on
7883 bit-fields of type "char". This was fixed in GCC 4.4 but the
7884 change can lead to differences in the structure layout. GCC
7885 informs you when the offset of such a field has changed in GCC 4.4.
7886 For example there is no longer a 4-bit padding between field "a"
7887 and "b" in this structure:
7888
7889 struct foo
7890 {
7891 char a:4;
7892 char b:8;
7893 } __attribute__ ((packed));
7894
7895 This warning is enabled by default. Use
7896 -Wno-packed-bitfield-compat to disable this warning.
7897
7898 -Wpacked-not-aligned (C, C++, Objective-C and Objective-C++ only)
7899 Warn if a structure field with explicitly specified alignment in a
7900 packed struct or union is misaligned. For example, a warning will
7901 be issued on "struct S", like, "warning: alignment 1 of 'struct S'
7902 is less than 8", in this code:
7903
7904 struct __attribute__ ((aligned (8))) S8 { char a[8]; };
7905 struct __attribute__ ((packed)) S {
7906 struct S8 s8;
7907 };
7908
7909 This warning is enabled by -Wall.
7910
7911 -Wpadded
7912 Warn if padding is included in a structure, either to align an
7913 element of the structure or to align the whole structure.
7914 Sometimes when this happens it is possible to rearrange the fields
7915 of the structure to reduce the padding and so make the structure
7916 smaller.
7917
7918 -Wredundant-decls
7919 Warn if anything is declared more than once in the same scope, even
7920 in cases where multiple declaration is valid and changes nothing.
7921
7922 -Wrestrict
7923 Warn when an object referenced by a "restrict"-qualified parameter
7924 (or, in C++, a "__restrict"-qualified parameter) is aliased by
7925 another argument, or when copies between such objects overlap. For
7926 example, the call to the "strcpy" function below attempts to
7927 truncate the string by replacing its initial characters with the
7928 last four. However, because the call writes the terminating NUL
7929 into "a[4]", the copies overlap and the call is diagnosed.
7930
7931 void foo (void)
7932 {
7933 char a[] = "abcd1234";
7934 strcpy (a, a + 4);
7935 ...
7936 }
7937
7938 The -Wrestrict option detects some instances of simple overlap even
7939 without optimization but works best at -O2 and above. It is
7940 included in -Wall.
7941
7942 -Wnested-externs (C and Objective-C only)
7943 Warn if an "extern" declaration is encountered within a function.
7944
7945 -Winline
7946 Warn if a function that is declared as inline cannot be inlined.
7947 Even with this option, the compiler does not warn about failures to
7948 inline functions declared in system headers.
7949
7950 The compiler uses a variety of heuristics to determine whether or
7951 not to inline a function. For example, the compiler takes into
7952 account the size of the function being inlined and the amount of
7953 inlining that has already been done in the current function.
7954 Therefore, seemingly insignificant changes in the source program
7955 can cause the warnings produced by -Winline to appear or disappear.
7956
7957 -Winterference-size
7958 Warn about use of C++17
7959 "std::hardware_destructive_interference_size" without specifying
7960 its value with --param destructive-interference-size. Also warn
7961 about questionable values for that option.
7962
7963 This variable is intended to be used for controlling class layout,
7964 to avoid false sharing in concurrent code:
7965
7966 struct independent_fields {
7967 alignas(std::hardware_destructive_interference_size)
7968 std::atomic<int> one;
7969 alignas(std::hardware_destructive_interference_size)
7970 std::atomic<int> two;
7971 };
7972
7973 Here one and two are intended to be far enough apart that stores to
7974 one won't require accesses to the other to reload the cache line.
7975
7976 By default, --param destructive-interference-size and --param
7977 constructive-interference-size are set based on the current -mtune
7978 option, typically to the L1 cache line size for the particular
7979 target CPU, sometimes to a range if tuning for a generic target.
7980 So all translation units that depend on ABI compatibility for the
7981 use of these variables must be compiled with the same -mtune (or
7982 -mcpu).
7983
7984 If ABI stability is important, such as if the use is in a header
7985 for a library, you should probably not use the hardware
7986 interference size variables at all. Alternatively, you can force a
7987 particular value with --param.
7988
7989 If you are confident that your use of the variable does not affect
7990 ABI outside a single build of your project, you can turn off the
7991 warning with -Wno-interference-size.
7992
7993 -Wint-in-bool-context
7994 Warn for suspicious use of integer values where boolean values are
7995 expected, such as conditional expressions (?:) using non-boolean
7996 integer constants in boolean context, like "if (a <= b ? 2 : 3)".
7997 Or left shifting of signed integers in boolean context, like "for
7998 (a = 0; 1 << a; a++);". Likewise for all kinds of multiplications
7999 regardless of the data type. This warning is enabled by -Wall.
8000
8001 -Wno-int-to-pointer-cast
8002 Suppress warnings from casts to pointer type of an integer of a
8003 different size. In C++, casting to a pointer type of smaller size
8004 is an error. Wint-to-pointer-cast is enabled by default.
8005
8006 -Wno-pointer-to-int-cast (C and Objective-C only)
8007 Suppress warnings from casts from a pointer to an integer type of a
8008 different size.
8009
8010 -Winvalid-pch
8011 Warn if a precompiled header is found in the search path but cannot
8012 be used.
8013
8014 -Winvalid-utf8
8015 Warn if an invalid UTF-8 character is found. This warning is on by
8016 default for C++23 if -finput-charset=UTF-8 is used and turned into
8017 error with -pedantic-errors.
8018
8019 -Wno-unicode
8020 Don't diagnose invalid forms of delimited or named escape sequences
8021 which are treated as separate tokens. Wunicode is enabled by
8022 default.
8023
8024 -Wlong-long
8025 Warn if "long long" type is used. This is enabled by either
8026 -Wpedantic or -Wtraditional in ISO C90 and C++98 modes. To inhibit
8027 the warning messages, use -Wno-long-long.
8028
8029 -Wvariadic-macros
8030 Warn if variadic macros are used in ISO C90 mode, or if the GNU
8031 alternate syntax is used in ISO C99 mode. This is enabled by
8032 either -Wpedantic or -Wtraditional. To inhibit the warning
8033 messages, use -Wno-variadic-macros.
8034
8035 -Wno-varargs
8036 Do not warn upon questionable usage of the macros used to handle
8037 variable arguments like "va_start". These warnings are enabled by
8038 default.
8039
8040 -Wvector-operation-performance
8041 Warn if vector operation is not implemented via SIMD capabilities
8042 of the architecture. Mainly useful for the performance tuning.
8043 Vector operation can be implemented "piecewise", which means that
8044 the scalar operation is performed on every vector element; "in
8045 parallel", which means that the vector operation is implemented
8046 using scalars of wider type, which normally is more performance
8047 efficient; and "as a single scalar", which means that vector fits
8048 into a scalar type.
8049
8050 -Wvla
8051 Warn if a variable-length array is used in the code. -Wno-vla
8052 prevents the -Wpedantic warning of the variable-length array.
8053
8054 -Wvla-larger-than=byte-size
8055 If this option is used, the compiler warns for declarations of
8056 variable-length arrays whose size is either unbounded, or bounded
8057 by an argument that allows the array size to exceed byte-size
8058 bytes. This is similar to how -Walloca-larger-than=byte-size
8059 works, but with variable-length arrays.
8060
8061 Note that GCC may optimize small variable-length arrays of a known
8062 value into plain arrays, so this warning may not get triggered for
8063 such arrays.
8064
8065 -Wvla-larger-than=PTRDIFF_MAX is enabled by default but is
8066 typically only effective when -ftree-vrp is active (default for -O2
8067 and above).
8068
8069 See also -Walloca-larger-than=byte-size.
8070
8071 -Wno-vla-larger-than
8072 Disable -Wvla-larger-than= warnings. The option is equivalent to
8073 -Wvla-larger-than=SIZE_MAX or larger.
8074
8075 -Wvla-parameter
8076 Warn about redeclarations of functions involving arguments of
8077 Variable Length Array types of inconsistent kinds or forms, and
8078 enable the detection of out-of-bounds accesses to such parameters
8079 by warnings such as -Warray-bounds.
8080
8081 If the first function declaration uses the VLA form the bound
8082 specified in the array is assumed to be the minimum number of
8083 elements expected to be provided in calls to the function and the
8084 maximum number of elements accessed by it. Failing to provide
8085 arguments of sufficient size or accessing more than the maximum
8086 number of elements may be diagnosed.
8087
8088 For example, the warning triggers for the following redeclarations
8089 because the first one allows an array of any size to be passed to
8090 "f" while the second one specifies that the array argument must
8091 have at least "n" elements. In addition, calling "f" with the
8092 associated VLA bound parameter in excess of the actual VLA bound
8093 triggers a warning as well.
8094
8095 void f (int n, int[n]);
8096 // warning: argument 2 previously declared as a VLA
8097 void f (int, int[]);
8098
8099 void g (int n)
8100 {
8101 if (n > 4)
8102 return;
8103 int a[n];
8104 // warning: access to a by f may be out of bounds
8105 f (sizeof a, a);
8106 ...
8107 }
8108
8109 -Wvla-parameter is included in -Wall. The -Warray-parameter option
8110 triggers warnings for similar problems involving ordinary array
8111 arguments.
8112
8113 -Wvolatile-register-var
8114 Warn if a register variable is declared volatile. The volatile
8115 modifier does not inhibit all optimizations that may eliminate
8116 reads and/or writes to register variables. This warning is enabled
8117 by -Wall.
8118
8119 -Wxor-used-as-pow (C, C++, Objective-C and Objective-C++ only)
8120 Warn about uses of "^", the exclusive or operator, where it appears
8121 the user meant exponentiation. Specifically, the warning occurs
8122 when the left-hand side is the decimal constant 2 or 10 and the
8123 right-hand side is also a decimal constant.
8124
8125 In C and C++, "^" means exclusive or, whereas in some other
8126 languages (e.g. TeX and some versions of BASIC) it means
8127 exponentiation.
8128
8129 This warning is enabled by default. It can be silenced by
8130 converting one of the operands to hexadecimal.
8131
8132 -Wdisabled-optimization
8133 Warn if a requested optimization pass is disabled. This warning
8134 does not generally indicate that there is anything wrong with your
8135 code; it merely indicates that GCC's optimizers are unable to
8136 handle the code effectively. Often, the problem is that your code
8137 is too big or too complex; GCC refuses to optimize programs when
8138 the optimization itself is likely to take inordinate amounts of
8139 time.
8140
8141 -Wpointer-sign (C and Objective-C only)
8142 Warn for pointer argument passing or assignment with different
8143 signedness. This option is only supported for C and Objective-C.
8144 It is implied by -Wall and by -Wpedantic, which can be disabled
8145 with -Wno-pointer-sign.
8146
8147 -Wstack-protector
8148 This option is only active when -fstack-protector is active. It
8149 warns about functions that are not protected against stack
8150 smashing.
8151
8152 -Woverlength-strings
8153 Warn about string constants that are longer than the "minimum
8154 maximum" length specified in the C standard. Modern compilers
8155 generally allow string constants that are much longer than the
8156 standard's minimum limit, but very portable programs should avoid
8157 using longer strings.
8158
8159 The limit applies after string constant concatenation, and does not
8160 count the trailing NUL. In C90, the limit was 509 characters; in
8161 C99, it was raised to 4095. C++98 does not specify a normative
8162 minimum maximum, so we do not diagnose overlength strings in C++.
8163
8164 This option is implied by -Wpedantic, and can be disabled with
8165 -Wno-overlength-strings.
8166
8167 -Wunsuffixed-float-constants (C and Objective-C only)
8168 Issue a warning for any floating constant that does not have a
8169 suffix. When used together with -Wsystem-headers it warns about
8170 such constants in system header files. This can be useful when
8171 preparing code to use with the "FLOAT_CONST_DECIMAL64" pragma from
8172 the decimal floating-point extension to C99.
8173
8174 -Wno-lto-type-mismatch
8175 During the link-time optimization, do not warn about type
8176 mismatches in global declarations from different compilation units.
8177 Requires -flto to be enabled. Enabled by default.
8178
8179 -Wno-designated-init (C and Objective-C only)
8180 Suppress warnings when a positional initializer is used to
8181 initialize a structure that has been marked with the
8182 "designated_init" attribute.
8183
8184 Options That Control Static Analysis
8185 -fanalyzer
8186 This option enables an static analysis of program flow which looks
8187 for "interesting" interprocedural paths through the code, and
8188 issues warnings for problems found on them.
8189
8190 This analysis is much more expensive than other GCC warnings.
8191
8192 In technical terms, it performs coverage-guided symbolic execution
8193 of the code being compiled. It is neither sound nor complete: it
8194 can have false positives and false negatives. It is a bug-finding
8195 tool, rather than a tool for proving program correctness.
8196
8197 The analyzer is only suitable for use on C code in this release.
8198
8199 Enabling this option effectively enables the following warnings:
8200
8201 -Wanalyzer-allocation-size -Wanalyzer-deref-before-check
8202 -Wanalyzer-double-fclose -Wanalyzer-double-free
8203 -Wanalyzer-exposure-through-output-file
8204 -Wanalyzer-exposure-through-uninit-copy
8205 -Wanalyzer-fd-access-mode-mismatch -Wanalyzer-fd-double-close
8206 -Wanalyzer-fd-leak -Wanalyzer-fd-phase-mismatch
8207 -Wanalyzer-fd-type-mismatch -Wanalyzer-fd-use-after-close
8208 -Wanalyzer-fd-use-without-check -Wanalyzer-file-leak
8209 -Wanalyzer-free-of-non-heap -Wanalyzer-imprecise-fp-arithmetic
8210 -Wanalyzer-infinite-recursion -Wanalyzer-jump-through-null
8211 -Wanalyzer-malloc-leak -Wanalyzer-mismatching-deallocation
8212 -Wanalyzer-null-argument -Wanalyzer-null-dereference
8213 -Wanalyzer-out-of-bounds -Wanalyzer-possible-null-argument
8214 -Wanalyzer-possible-null-dereference -Wanalyzer-putenv-of-auto-var
8215 -Wanalyzer-shift-count-negative -Wanalyzer-shift-count-overflow
8216 -Wanalyzer-stale-setjmp-buffer
8217 -Wanalyzer-unsafe-call-within-signal-handler
8218 -Wanalyzer-use-after-free
8219 -Wanalyzer-use-of-pointer-in-stale-stack-frame
8220 -Wanalyzer-use-of-uninitialized-value
8221 -Wanalyzer-va-arg-type-mismatch -Wanalyzer-va-list-exhausted
8222 -Wanalyzer-va-list-leak -Wanalyzer-va-list-use-after-va-end
8223 -Wanalyzer-write-to-const -Wanalyzer-write-to-string-literal
8224
8225 This option is only available if GCC was configured with analyzer
8226 support enabled.
8227
8228 -Wanalyzer-too-complex
8229 If -fanalyzer is enabled, the analyzer uses various heuristics to
8230 attempt to explore the control flow and data flow in the program,
8231 but these can be defeated by sufficiently complicated code.
8232
8233 By default, the analysis silently stops if the code is too
8234 complicated for the analyzer to fully explore and it reaches an
8235 internal limit. The -Wanalyzer-too-complex option warns if this
8236 occurs.
8237
8238 -Wno-analyzer-allocation-size
8239 This warning requires -fanalyzer, which enables it; to disable it,
8240 use -Wno-analyzer-allocation-size.
8241
8242 This diagnostic warns for paths through the code in which a pointer
8243 to a buffer is assigned to point at a buffer with a size that is
8244 not a multiple of "sizeof (*pointer)".
8245
8246 See CWE-131: Incorrect Calculation of Buffer Size
8247 ("https://cwe.mitre.org/data/definitions/131.html").
8248
8249 -Wno-analyzer-deref-before-check
8250 This warning requires -fanalyzer, which enables it; use
8251 -Wno-analyzer-deref-before-check to disable it.
8252
8253 This diagnostic warns for paths through the code in which a pointer
8254 is checked for "NULL" *after* it has already been dereferenced,
8255 suggesting that the pointer could have been NULL. Such cases
8256 suggest that the check for NULL is either redundant, or that it
8257 needs to be moved to before the pointer is dereferenced.
8258
8259 This diagnostic also considers values passed to a function argument
8260 marked with "__attribute__((nonnull))" as requiring a non-NULL
8261 value, and thus will complain if such values are checked for "NULL"
8262 after returning from such a function call.
8263
8264 This diagnostic is unlikely to be reported when any level of
8265 optimization is enabled, as GCC's optimization logic will typically
8266 consider such checks for NULL as being redundant, and optimize them
8267 away before the analyzer "sees" them. Hence optimization should be
8268 disabled when attempting to trigger this diagnostic.
8269
8270 -Wno-analyzer-double-fclose
8271 This warning requires -fanalyzer, which enables it; use
8272 -Wno-analyzer-double-fclose to disable it.
8273
8274 This diagnostic warns for paths through the code in which a "FILE
8275 *" can have "fclose" called on it more than once.
8276
8277 See CWE-1341: Multiple Releases of Same Resource or Handle
8278 ("https://cwe.mitre.org/data/definitions/1341.html").
8279
8280 -Wno-analyzer-double-free
8281 This warning requires -fanalyzer, which enables it; use
8282 -Wno-analyzer-double-free to disable it.
8283
8284 This diagnostic warns for paths through the code in which a pointer
8285 can have a deallocator called on it more than once, either "free",
8286 or a deallocator referenced by attribute "malloc".
8287
8288 See CWE-415: Double Free
8289 ("https://cwe.mitre.org/data/definitions/415.html").
8290
8291 -Wno-analyzer-exposure-through-output-file
8292 This warning requires -fanalyzer, which enables it; use
8293 -Wno-analyzer-exposure-through-output-file to disable it.
8294
8295 This diagnostic warns for paths through the code in which a
8296 security-sensitive value is written to an output file (such as
8297 writing a password to a log file).
8298
8299 See CWE-532: Information Exposure Through Log Files
8300 ("https://cwe.mitre.org/data/definitions/532.html").
8301
8302 -Wanalyzer-exposure-through-uninit-copy
8303 This warning requires both -fanalyzer and the use of a plugin to
8304 specify a function that copies across a "trust boundary". Use
8305 -Wno-analyzer-exposure-through-uninit-copy to disable it.
8306
8307 This diagnostic warns for "infoleaks" - paths through the code in
8308 which uninitialized values are copied across a security boundary
8309 (such as code within an OS kernel that copies a partially-
8310 initialized struct on the stack to user space).
8311
8312 See CWE-200: Exposure of Sensitive Information to an Unauthorized
8313 Actor ("https://cwe.mitre.org/data/definitions/200.html").
8314
8315 -Wno-analyzer-fd-access-mode-mismatch
8316 This warning requires -fanalyzer, which enables it; use
8317 -Wno-analyzer-fd-access-mode-mismatch to disable it.
8318
8319 This diagnostic warns for paths through code in which a "read" on a
8320 write-only file descriptor is attempted, or vice versa.
8321
8322 This diagnostic also warns for code paths in a which a function
8323 with attribute "fd_arg_read (N)" is called with a file descriptor
8324 opened with "O_WRONLY" at referenced argument "N" or a function
8325 with attribute "fd_arg_write (N)" is called with a file descriptor
8326 opened with "O_RDONLY" at referenced argument N.
8327
8328 -Wno-analyzer-fd-double-close
8329 This warning requires -fanalyzer, which enables it; use
8330 -Wno-analyzer-fd-double-close to disable it.
8331
8332 This diagnostic warns for paths through code in which a file
8333 descriptor can be closed more than once.
8334
8335 See CWE-1341: Multiple Releases of Same Resource or Handle
8336 ("https://cwe.mitre.org/data/definitions/1341.html").
8337
8338 -Wno-analyzer-fd-leak
8339 This warning requires -fanalyzer, which enables it; use
8340 -Wno-analyzer-fd-leak to disable it.
8341
8342 This diagnostic warns for paths through code in which an open file
8343 descriptor is leaked.
8344
8345 See CWE-775: Missing Release of File Descriptor or Handle after
8346 Effective Lifetime
8347 ("https://cwe.mitre.org/data/definitions/775.html").
8348
8349 -Wno-analyzer-fd-phase-mismatch
8350 This warning requires -fanalyzer, which enables it; use
8351 -Wno-analyzer-fd-phase-mismatch to disable it.
8352
8353 This diagnostic warns for paths through code in which an operation
8354 is attempted in the wrong phase of a file descriptor's lifetime.
8355 For example, it will warn on attempts to call "accept" on a stream
8356 socket that has not yet had "listen" successfully called on it.
8357
8358 See CWE-666: Operation on Resource in Wrong Phase of Lifetime
8359 ("https://cwe.mitre.org/data/definitions/666.html").
8360
8361 -Wno-analyzer-fd-type-mismatch
8362 This warning requires -fanalyzer, which enables it; use
8363 -Wno-analyzer-fd-type-mismatch to disable it.
8364
8365 This diagnostic warns for paths through code in which an operation
8366 is attempted on the wrong type of file descriptor. For example, it
8367 will warn on attempts to use socket operations on a file descriptor
8368 obtained via "open", or when attempting to use a stream socket
8369 operation on a datagram socket.
8370
8371 -Wno-analyzer-fd-use-after-close
8372 This warning requires -fanalyzer, which enables it; use
8373 -Wno-analyzer-fd-use-after-close to disable it.
8374
8375 This diagnostic warns for paths through code in which a read or
8376 write is called on a closed file descriptor.
8377
8378 This diagnostic also warns for paths through code in which a
8379 function with attribute "fd_arg (N)" or "fd_arg_read (N)" or
8380 "fd_arg_write (N)" is called with a closed file descriptor at
8381 referenced argument "N".
8382
8383 -Wno-analyzer-fd-use-without-check
8384 This warning requires -fanalyzer, which enables it; use
8385 -Wno-analyzer-fd-use-without-check to disable it.
8386
8387 This diagnostic warns for paths through code in which a file
8388 descriptor is used without being checked for validity.
8389
8390 This diagnostic also warns for paths through code in which a
8391 function with attribute "fd_arg (N)" or "fd_arg_read (N)" or
8392 "fd_arg_write (N)" is called with a file descriptor, at referenced
8393 argument "N", without being checked for validity.
8394
8395 -Wno-analyzer-file-leak
8396 This warning requires -fanalyzer, which enables it; use
8397 -Wno-analyzer-file-leak to disable it.
8398
8399 This diagnostic warns for paths through the code in which a
8400 "<stdio.h>" "FILE *" stream object is leaked.
8401
8402 See CWE-775: Missing Release of File Descriptor or Handle after
8403 Effective Lifetime
8404 ("https://cwe.mitre.org/data/definitions/775.html").
8405
8406 -Wno-analyzer-free-of-non-heap
8407 This warning requires -fanalyzer, which enables it; use
8408 -Wno-analyzer-free-of-non-heap to disable it.
8409
8410 This diagnostic warns for paths through the code in which "free" is
8411 called on a non-heap pointer (e.g. an on-stack buffer, or a
8412 global).
8413
8414 See CWE-590: Free of Memory not on the Heap
8415 ("https://cwe.mitre.org/data/definitions/590.html").
8416
8417 -Wno-analyzer-imprecise-fp-arithmetic
8418 This warning requires -fanalyzer, which enables it; use
8419 -Wno-analyzer-imprecise-fp-arithmetic to disable it.
8420
8421 This diagnostic warns for paths through the code in which floating-
8422 point arithmetic is used in locations where precise computation is
8423 needed. This diagnostic only warns on use of floating-point
8424 operands inside the calculation of an allocation size at the
8425 moment.
8426
8427 -Wno-analyzer-infinite-recursion
8428 This warning requires -fanalyzer, which enables it; use
8429 -Wno-analyzer-infinite-recursion to disable it.
8430
8431 This diagnostics warns for paths through the code which appear to
8432 lead to infinite recursion.
8433
8434 Specifically, when the analyzer "sees" a recursive call, it will
8435 compare the state of memory at the entry to the new frame with that
8436 at the entry to the previous frame of that function on the stack.
8437 The warning is issued if nothing in memory appears to be changing;
8438 any changes observed to parameters or globals are assumed to lead
8439 to termination of the recursion and thus suppress the warning.
8440
8441 This diagnostic is likely to miss cases of infinite recursion that
8442 are convered to iteration by the optimizer before the analyzer
8443 "sees" them. Hence optimization should be disabled when attempting
8444 to trigger this diagnostic.
8445
8446 Compare with -Winfinite-recursion, which provides a similar
8447 diagnostic, but is implemented in a different way.
8448
8449 -Wno-analyzer-jump-through-null
8450 This warning requires -fanalyzer, which enables it; use
8451 -Wno-analyzer-jump-through-null to disable it.
8452
8453 This diagnostic warns for paths through the code in which a "NULL"
8454 function pointer is called.
8455
8456 -Wno-analyzer-malloc-leak
8457 This warning requires -fanalyzer, which enables it; use
8458 -Wno-analyzer-malloc-leak to disable it.
8459
8460 This diagnostic warns for paths through the code in which a pointer
8461 allocated via an allocator is leaked: either "malloc", or a
8462 function marked with attribute "malloc".
8463
8464 See CWE-401: Missing Release of Memory after Effective Lifetime
8465 ("https://cwe.mitre.org/data/definitions/401.html").
8466
8467 -Wno-analyzer-mismatching-deallocation
8468 This warning requires -fanalyzer, which enables it; use
8469 -Wno-analyzer-mismatching-deallocation to disable it.
8470
8471 This diagnostic warns for paths through the code in which the wrong
8472 deallocation function is called on a pointer value, based on which
8473 function was used to allocate the pointer value. The diagnostic
8474 will warn about mismatches between "free", scalar "delete" and
8475 vector "delete[]", and those marked as allocator/deallocator pairs
8476 using attribute "malloc".
8477
8478 See CWE-762: Mismatched Memory Management Routines
8479 ("https://cwe.mitre.org/data/definitions/762.html").
8480
8481 -Wno-analyzer-out-of-bounds
8482 This warning requires -fanalyzer, which enables it; use
8483 -Wno-analyzer-out-of-bounds to disable it.
8484
8485 This diagnostic warns for paths through the code in which a buffer
8486 is definitely read or written out-of-bounds. The diagnostic
8487 applies for cases where the analyzer is able to determine a
8488 constant offset and for accesses past the end of a buffer, also a
8489 constant capacity. Further, the diagnostic does limited checking
8490 for accesses past the end when the offset as well as the capacity
8491 is symbolic.
8492
8493 See CWE-119: Improper Restriction of Operations within the Bounds
8494 of a Memory Buffer
8495 ("https://cwe.mitre.org/data/definitions/119.html").
8496
8497 -Wno-analyzer-possible-null-argument
8498 This warning requires -fanalyzer, which enables it; use
8499 -Wno-analyzer-possible-null-argument to disable it.
8500
8501 This diagnostic warns for paths through the code in which a
8502 possibly-NULL value is passed to a function argument marked with
8503 "__attribute__((nonnull))" as requiring a non-NULL value.
8504
8505 See CWE-690: Unchecked Return Value to NULL Pointer Dereference
8506 ("https://cwe.mitre.org/data/definitions/690.html").
8507
8508 -Wno-analyzer-possible-null-dereference
8509 This warning requires -fanalyzer, which enables it; use
8510 -Wno-analyzer-possible-null-dereference to disable it.
8511
8512 This diagnostic warns for paths through the code in which a
8513 possibly-NULL value is dereferenced.
8514
8515 See CWE-690: Unchecked Return Value to NULL Pointer Dereference
8516 ("https://cwe.mitre.org/data/definitions/690.html").
8517
8518 -Wno-analyzer-null-argument
8519 This warning requires -fanalyzer, which enables it; use
8520 -Wno-analyzer-null-argument to disable it.
8521
8522 This diagnostic warns for paths through the code in which a value
8523 known to be NULL is passed to a function argument marked with
8524 "__attribute__((nonnull))" as requiring a non-NULL value.
8525
8526 See CWE-476: NULL Pointer Dereference
8527 ("https://cwe.mitre.org/data/definitions/476.html").
8528
8529 -Wno-analyzer-null-dereference
8530 This warning requires -fanalyzer, which enables it; use
8531 -Wno-analyzer-null-dereference to disable it.
8532
8533 This diagnostic warns for paths through the code in which a value
8534 known to be NULL is dereferenced.
8535
8536 See CWE-476: NULL Pointer Dereference
8537 ("https://cwe.mitre.org/data/definitions/476.html").
8538
8539 -Wno-analyzer-putenv-of-auto-var
8540 This warning requires -fanalyzer, which enables it; use
8541 -Wno-analyzer-putenv-of-auto-var to disable it.
8542
8543 This diagnostic warns for paths through the code in which a call to
8544 "putenv" is passed a pointer to an automatic variable or an on-
8545 stack buffer.
8546
8547 See POS34-C. Do not call putenv() with a pointer to an automatic
8548 variable as the argument
8549 ("https://wiki.sei.cmu.edu/confluence/x/6NYxBQ").
8550
8551 -Wno-analyzer-shift-count-negative
8552 This warning requires -fanalyzer, which enables it; use
8553 -Wno-analyzer-shift-count-negative to disable it.
8554
8555 This diagnostic warns for paths through the code in which a shift
8556 is attempted with a negative count. It is analogous to the
8557 -Wshift-count-negative diagnostic implemented in the C/C++ front
8558 ends, but is implemented based on analyzing interprocedural paths,
8559 rather than merely parsing the syntax tree. However, the analyzer
8560 does not prioritize detection of such paths, so false negatives are
8561 more likely relative to other warnings.
8562
8563 -Wno-analyzer-shift-count-overflow
8564 This warning requires -fanalyzer, which enables it; use
8565 -Wno-analyzer-shift-count-overflow to disable it.
8566
8567 This diagnostic warns for paths through the code in which a shift
8568 is attempted with a count greater than or equal to the precision of
8569 the operand's type. It is analogous to the -Wshift-count-overflow
8570 diagnostic implemented in the C/C++ front ends, but is implemented
8571 based on analyzing interprocedural paths, rather than merely
8572 parsing the syntax tree. However, the analyzer does not prioritize
8573 detection of such paths, so false negatives are more likely
8574 relative to other warnings.
8575
8576 -Wno-analyzer-stale-setjmp-buffer
8577 This warning requires -fanalyzer, which enables it; use
8578 -Wno-analyzer-stale-setjmp-buffer to disable it.
8579
8580 This diagnostic warns for paths through the code in which "longjmp"
8581 is called to rewind to a "jmp_buf" relating to a "setjmp" call in a
8582 function that has returned.
8583
8584 When "setjmp" is called on a "jmp_buf" to record a rewind location,
8585 it records the stack frame. The stack frame becomes invalid when
8586 the function containing the "setjmp" call returns. Attempting to
8587 rewind to it via "longjmp" would reference a stack frame that no
8588 longer exists, and likely lead to a crash (or worse).
8589
8590 -Wno-analyzer-tainted-allocation-size
8591 This warning requires both -fanalyzer and -fanalyzer-checker=taint
8592 to enable it; use -Wno-analyzer-tainted-allocation-size to disable
8593 it.
8594
8595 This diagnostic warns for paths through the code in which a value
8596 that could be under an attacker's control is used as the size of an
8597 allocation without being sanitized, so that an attacker could
8598 inject an excessively large allocation and potentially cause a
8599 denial of service attack.
8600
8601 See CWE-789: Memory Allocation with Excessive Size Value
8602 ("https://cwe.mitre.org/data/definitions/789.html").
8603
8604 -Wno-analyzer-tainted-assertion
8605 This warning requires both -fanalyzer and -fanalyzer-checker=taint
8606 to enable it; use -Wno-analyzer-tainted-assertion to disable it.
8607
8608 This diagnostic warns for paths through the code in which a value
8609 that could be under an attacker's control is used as part of a
8610 condition without being first sanitized, and that condition guards
8611 a call to a function marked with attribute "noreturn" (such as the
8612 function "__builtin_unreachable"). Such functions typically
8613 indicate abnormal termination of the program, such as for assertion
8614 failure handlers. For example:
8615
8616 assert (some_tainted_value < SOME_LIMIT);
8617
8618 In such cases:
8619
8620 * when assertion-checking is enabled: an attacker could trigger a
8621 denial of service by injecting an assertion failure
8622
8623 * when assertion-checking is disabled, such as by defining
8624 "NDEBUG", an attacker could inject data that subverts the
8625 process, since it presumably violates a precondition that is
8626 being assumed by the code.
8627
8628 Note that when assertion-checking is disabled, the assertions are
8629 typically removed by the preprocessor before the analyzer has a
8630 chance to "see" them, so this diagnostic can only generate warnings
8631 on builds in which assertion-checking is enabled.
8632
8633 For the purpose of this warning, any function marked with attribute
8634 "noreturn" is considered as a possible assertion failure handler,
8635 including "__builtin_unreachable". Note that these functions are
8636 sometimes removed by the optimizer before the analyzer "sees" them.
8637 Hence optimization should be disabled when attempting to trigger
8638 this diagnostic.
8639
8640 See CWE-617: Reachable Assertion
8641 ("https://cwe.mitre.org/data/definitions/617.html").
8642
8643 The warning can also report problematic constructions such as
8644
8645 switch (some_tainted_value) {
8646 case 0:
8647 /* [...etc; various valid cases omitted...] */
8648 break;
8649
8650 default:
8651 __builtin_unreachable (); /* BUG: attacker can trigger this */
8652 }
8653
8654 despite the above not being an assertion failure, strictly
8655 speaking.
8656
8657 -Wno-analyzer-tainted-array-index
8658 This warning requires both -fanalyzer and -fanalyzer-checker=taint
8659 to enable it; use -Wno-analyzer-tainted-array-index to disable it.
8660
8661 This diagnostic warns for paths through the code in which a value
8662 that could be under an attacker's control is used as the index of
8663 an array access without being sanitized, so that an attacker could
8664 inject an out-of-bounds access.
8665
8666 See CWE-129: Improper Validation of Array Index
8667 ("https://cwe.mitre.org/data/definitions/129.html").
8668
8669 -Wno-analyzer-tainted-divisor
8670 This warning requires both -fanalyzer and -fanalyzer-checker=taint
8671 to enable it; use -Wno-analyzer-tainted-divisor to disable it.
8672
8673 This diagnostic warns for paths through the code in which a value
8674 that could be under an attacker's control is used as the divisor in
8675 a division or modulus operation without being sanitized, so that an
8676 attacker could inject a division-by-zero.
8677
8678 See CWE-369: Divide By Zero
8679 ("https://cwe.mitre.org/data/definitions/369.html").
8680
8681 -Wno-analyzer-tainted-offset
8682 This warning requires both -fanalyzer and -fanalyzer-checker=taint
8683 to enable it; use -Wno-analyzer-tainted-offset to disable it.
8684
8685 This diagnostic warns for paths through the code in which a value
8686 that could be under an attacker's control is used as a pointer
8687 offset without being sanitized, so that an attacker could inject an
8688 out-of-bounds access.
8689
8690 See CWE-823: Use of Out-of-range Pointer Offset
8691 ("https://cwe.mitre.org/data/definitions/823.html").
8692
8693 -Wno-analyzer-tainted-size
8694 This warning requires both -fanalyzer and -fanalyzer-checker=taint
8695 to enable it; use -Wno-analyzer-tainted-size to disable it.
8696
8697 This diagnostic warns for paths through the code in which a value
8698 that could be under an attacker's control is used as the size of an
8699 operation such as "memset" without being sanitized, so that an
8700 attacker could inject an out-of-bounds access.
8701
8702 See CWE-129: Improper Validation of Array Index
8703 ("https://cwe.mitre.org/data/definitions/129.html").
8704
8705 -Wno-analyzer-unsafe-call-within-signal-handler
8706 This warning requires -fanalyzer, which enables it; use
8707 -Wno-analyzer-unsafe-call-within-signal-handler to disable it.
8708
8709 This diagnostic warns for paths through the code in which a
8710 function known to be async-signal-unsafe (such as "fprintf") is
8711 called from a signal handler.
8712
8713 See CWE-479: Signal Handler Use of a Non-reentrant Function
8714 ("https://cwe.mitre.org/data/definitions/479.html").
8715
8716 -Wno-analyzer-use-after-free
8717 This warning requires -fanalyzer, which enables it; use
8718 -Wno-analyzer-use-after-free to disable it.
8719
8720 This diagnostic warns for paths through the code in which a pointer
8721 is used after a deallocator is called on it: either "free", or a
8722 deallocator referenced by attribute "malloc".
8723
8724 See CWE-416: Use After Free
8725 ("https://cwe.mitre.org/data/definitions/416.html").
8726
8727 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
8728 This warning requires -fanalyzer, which enables it; use
8729 -Wno-analyzer-use-of-pointer-in-stale-stack-frame to disable it.
8730
8731 This diagnostic warns for paths through the code in which a pointer
8732 is dereferenced that points to a variable in a stale stack frame.
8733
8734 -Wno-analyzer-va-arg-type-mismatch
8735 This warning requires -fanalyzer, which enables it; use
8736 -Wno-analyzer-va-arg-type-mismatch to disable it.
8737
8738 This diagnostic warns for interprocedural paths through the code
8739 for which the analyzer detects an attempt to use "va_arg" to
8740 extract a value passed to a variadic call, but uses a type that
8741 does not match that of the expression passed to the call.
8742
8743 See CWE-686: Function Call With Incorrect Argument Type
8744 ("https://cwe.mitre.org/data/definitions/686.html").
8745
8746 -Wno-analyzer-va-list-exhausted
8747 This warning requires -fanalyzer, which enables it; use
8748 -Wno-analyzer-va-list-exhausted to disable it.
8749
8750 This diagnostic warns for interprocedural paths through the code
8751 for which the analyzer detects an attempt to use "va_arg" to access
8752 the next value passed to a variadic call, but all of the values in
8753 the "va_list" have already been consumed.
8754
8755 See CWE-685: Function Call With Incorrect Number of Arguments
8756 ("https://cwe.mitre.org/data/definitions/685.html").
8757
8758 -Wno-analyzer-va-list-leak
8759 This warning requires -fanalyzer, which enables it; use
8760 -Wno-analyzer-va-list-leak to disable it.
8761
8762 This diagnostic warns for interprocedural paths through the code
8763 for which the analyzer detects that "va_start" or "va_copy" has
8764 been called on a "va_list" without a corresponding call to
8765 "va_end".
8766
8767 -Wno-analyzer-va-list-use-after-va-end
8768 This warning requires -fanalyzer, which enables it; use
8769 -Wno-analyzer-va-list-use-after-va-end to disable it.
8770
8771 This diagnostic warns for interprocedural paths through the code
8772 for which the analyzer detects an attempt to use a "va_list" after
8773 "va_end" has been called on it. "va_list".
8774
8775 -Wno-analyzer-write-to-const
8776 This warning requires -fanalyzer, which enables it; use
8777 -Wno-analyzer-write-to-const to disable it.
8778
8779 This diagnostic warns for paths through the code in which the
8780 analyzer detects an attempt to write through a pointer to a "const"
8781 object. However, the analyzer does not prioritize detection of
8782 such paths, so false negatives are more likely relative to other
8783 warnings.
8784
8785 -Wno-analyzer-write-to-string-literal
8786 This warning requires -fanalyzer, which enables it; use
8787 -Wno-analyzer-write-to-string-literal to disable it.
8788
8789 This diagnostic warns for paths through the code in which the
8790 analyzer detects an attempt to write through a pointer to a string
8791 literal. However, the analyzer does not prioritize detection of
8792 such paths, so false negatives are more likely relative to other
8793 warnings.
8794
8795 -Wno-analyzer-use-of-uninitialized-value
8796 This warning requires -fanalyzer, which enables it; use
8797 -Wno-analyzer-use-of-uninitialized-value to disable it.
8798
8799 This diagnostic warns for paths through the code in which an
8800 uninitialized value is used.
8801
8802 See CWE-457: Use of Uninitialized Variable
8803 ("https://cwe.mitre.org/data/definitions/457.html").
8804
8805 The analyzer has hardcoded knowledge about the behavior of the
8806 following memory-management functions:
8807
8808 *<"alloca">
8809 *<The built-in functions "__builtin_alloc",>
8810 "__builtin_alloc_with_align", @item "__builtin_calloc",
8811 "__builtin_free", "__builtin_malloc", "__builtin_memcpy",
8812 "__builtin_memcpy_chk", "__builtin_memset", "__builtin_memset_chk",
8813 "__builtin_realloc", "__builtin_stack_restore", and
8814 "__builtin_stack_save"
8815
8816 *<"calloc">
8817 *<"free">
8818 *<"malloc">
8819 *<"memset">
8820 *<"operator delete">
8821 *<"operator delete []">
8822 *<"operator new">
8823 *<"operator new []">
8824 *<"realloc">
8825 *<"strdup">
8826 *<"strndup">
8827
8828 of the following functions for working with file descriptors:
8829
8830 *<"open">
8831 *<"close">
8832 *<"creat">
8833 *<"dup", "dup2" and "dup3">
8834 *<"isatty">
8835 *<"pipe", and "pipe2">
8836 *<"read">
8837 *<"write">
8838 *<"socket", "bind", "listen", "accept", and "connect">
8839
8840 of the following functions for working with "<stdio.h>" streams:
8841
8842 *<The built-in functions "__builtin_fprintf",>
8843 "__builtin_fprintf_unlocked", "__builtin_fputc",
8844 "__builtin_fputc_unlocked", "__builtin_fputs",
8845 "__builtin_fputs_unlocked", "__builtin_fwrite",
8846 "__builtin_fwrite_unlocked", "__builtin_printf",
8847 "__builtin_printf_unlocked", "__builtin_putc", "__builtin_putchar",
8848 "__builtin_putchar_unlocked", "__builtin_putc_unlocked",
8849 "__builtin_puts", "__builtin_puts_unlocked", "__builtin_vfprintf",
8850 and "__builtin_vprintf"
8851
8852 *<"fopen">
8853 *<"fclose">
8854 *<"ferror">
8855 *<"fgets">
8856 *<"fgets_unlocked">
8857 *<"fileno">
8858 *<"fread">
8859 *<"getc">
8860 *<"getchar">
8861 *<"fprintf">
8862 *<"printf">
8863 *<"fwrite">
8864
8865 and of the following functions:
8866
8867 *<The built-in functions "__builtin_expect",>
8868 "__builtin_expect_with_probability", "__builtin_strchr",
8869 "__builtin_strcpy", "__builtin_strcpy_chk", "__builtin_strlen",
8870 "__builtin_va_copy", and "__builtin_va_start"
8871
8872 *<The GNU extensions "error" and "error_at_line">
8873 *<"getpass">
8874 *<"longjmp">
8875 *<"putenv">
8876 *<"setjmp">
8877 *<"siglongjmp">
8878 *<"signal">
8879 *<"sigsetjmp">
8880 *<"strchr">
8881 *<"strlen">
8882
8883 In addition, various functions with an "__analyzer_" prefix have
8884 special meaning to the analyzer, described in the GCC Internals manual.
8885
8886 Pertinent parameters for controlling the exploration are:
8887
8888 *<--param analyzer-bb-explosion-factor=value>
8889 *<--param analyzer-max-enodes-per-program-point=value>
8890 *<--param analyzer-max-recursion-depth=value>
8891 *<--param analyzer-min-snodes-for-call-summary=value>
8892
8893 The following options control the analyzer.
8894
8895 -fanalyzer-call-summaries
8896 Simplify interprocedural analysis by computing the effect of
8897 certain calls, rather than exploring all paths through the function
8898 from callsite to each possible return.
8899
8900 If enabled, call summaries are only used for functions with more
8901 than one call site, and that are sufficiently complicated (as per
8902 --param analyzer-min-snodes-for-call-summary=value).
8903
8904 -fanalyzer-checker=name
8905 Restrict the analyzer to run just the named checker, and enable it.
8906
8907 Some checkers are disabled by default (even with -fanalyzer), such
8908 as the "taint" checker that implements
8909 -Wanalyzer-tainted-array-index, and this option is required to
8910 enable them.
8911
8912 Note: currently, -fanalyzer-checker=taint disables the following
8913 warnings from -fanalyzer:
8914
8915 -Wanalyzer-deref-before-check -Wanalyzer-double-fclose
8916 -Wanalyzer-double-free -Wanalyzer-exposure-through-output-file
8917 -Wanalyzer-fd-access-mode-mismatch -Wanalyzer-fd-double-close
8918 -Wanalyzer-fd-leak -Wanalyzer-fd-use-after-close
8919 -Wanalyzer-fd-use-without-check -Wanalyzer-file-leak
8920 -Wanalyzer-free-of-non-heap -Wanalyzer-malloc-leak
8921 -Wanalyzer-mismatching-deallocation -Wanalyzer-null-argument
8922 -Wanalyzer-null-dereference -Wanalyzer-possible-null-argument
8923 -Wanalyzer-possible-null-dereference
8924 -Wanalyzer-unsafe-call-within-signal-handler
8925 -Wanalyzer-use-after-free -Wanalyzer-va-list-leak
8926 -Wanalyzer-va-list-use-after-va-end
8927
8928 -fno-analyzer-feasibility
8929 This option is intended for analyzer developers.
8930
8931 By default the analyzer verifies that there is a feasible control
8932 flow path for each diagnostic it emits: that the conditions that
8933 hold are not mutually exclusive. Diagnostics for which no feasible
8934 path can be found are rejected. This filtering can be suppressed
8935 with -fno-analyzer-feasibility, for debugging issues in this code.
8936
8937 -fanalyzer-fine-grained
8938 This option is intended for analyzer developers.
8939
8940 Internally the analyzer builds an "exploded graph" that combines
8941 control flow graphs with data flow information.
8942
8943 By default, an edge in this graph can contain the effects of a run
8944 of multiple statements within a basic block. With
8945 -fanalyzer-fine-grained, each statement gets its own edge.
8946
8947 -fanalyzer-show-duplicate-count
8948 This option is intended for analyzer developers: if multiple
8949 diagnostics have been detected as being duplicates of each other,
8950 it emits a note when reporting the best diagnostic, giving the
8951 number of additional diagnostics that were suppressed by the
8952 deduplication logic.
8953
8954 -fno-analyzer-state-merge
8955 This option is intended for analyzer developers.
8956
8957 By default the analyzer attempts to simplify analysis by merging
8958 sufficiently similar states at each program point as it builds its
8959 "exploded graph". With -fno-analyzer-state-merge this merging can
8960 be suppressed, for debugging state-handling issues.
8961
8962 -fno-analyzer-state-purge
8963 This option is intended for analyzer developers.
8964
8965 By default the analyzer attempts to simplify analysis by purging
8966 aspects of state at a program point that appear to no longer be
8967 relevant e.g. the values of locals that aren't accessed later in
8968 the function and which aren't relevant to leak analysis.
8969
8970 With -fno-analyzer-state-purge this purging of state can be
8971 suppressed, for debugging state-handling issues.
8972
8973 -fno-analyzer-suppress-followups
8974 This option is intended for analyzer developers.
8975
8976 By default the analyzer will stop exploring an execution path after
8977 encountering certain diagnostics, in order to avoid potentially
8978 issuing a cascade of follow-up diagnostics.
8979
8980 The diagnostics that terminate analysis along a path are:
8981
8982 *<-Wanalyzer-null-argument>
8983 *<-Wanalyzer-null-dereference>
8984 *<-Wanalyzer-use-after-free>
8985 *<-Wanalyzer-use-of-pointer-in-stale-stack-frame>
8986 *<-Wanalyzer-use-of-uninitialized-value>
8987
8988 With -fno-analyzer-suppress-followups the analyzer will continue to
8989 explore such paths even after such diagnostics, which may be
8990 helpful for debugging issues in the analyzer, or for
8991 microbenchmarks for detecting undefined behavior.
8992
8993 -fanalyzer-transitivity
8994 This option enables transitivity of constraints within the
8995 analyzer.
8996
8997 -fno-analyzer-undo-inlining
8998 This option is intended for analyzer developers.
8999
9000 -fanalyzer runs relatively late compared to other code analysis
9001 tools, and some optimizations have already been applied to the
9002 code. In particular function inlining may have occurred, leading
9003 to the interprocedural execution paths emitted by the analyzer
9004 containing function frames that don't correspond to those in the
9005 original source code.
9006
9007 By default the analyzer attempts to reconstruct the original
9008 function frames, and to emit events showing the inlined calls.
9009
9010 With -fno-analyzer-undo-inlining this attempt to reconstruct the
9011 original frame information can be be disabled, which may be of help
9012 when debugging issues in the analyzer.
9013
9014 -fanalyzer-verbose-edges
9015 This option is intended for analyzer developers. It enables more
9016 verbose, lower-level detail in the descriptions of control flow
9017 within diagnostic paths.
9018
9019 -fanalyzer-verbose-state-changes
9020 This option is intended for analyzer developers. It enables more
9021 verbose, lower-level detail in the descriptions of events relating
9022 to state machines within diagnostic paths.
9023
9024 -fanalyzer-verbosity=level
9025 This option controls the complexity of the control flow paths that
9026 are emitted for analyzer diagnostics.
9027
9028 The level can be one of:
9029
9030 0 At this level, interprocedural call and return events are
9031 displayed, along with the most pertinent state-change events
9032 relating to a diagnostic. For example, for a double-"free"
9033 diagnostic, both calls to "free" will be shown.
9034
9035 1 As per the previous level, but also show events for the entry
9036 to each function.
9037
9038 2 As per the previous level, but also show events relating to
9039 control flow that are significant to triggering the issue (e.g.
9040 "true path taken" at a conditional).
9041
9042 This level is the default.
9043
9044 3 As per the previous level, but show all control flow events,
9045 not just significant ones.
9046
9047 4 This level is intended for analyzer developers; it adds various
9048 other events intended for debugging the analyzer.
9049
9050 -fdump-analyzer
9051 Dump internal details about what the analyzer is doing to
9052 file.analyzer.txt. -fdump-analyzer-stderr overrides this option.
9053
9054 -fdump-analyzer-stderr
9055 Dump internal details about what the analyzer is doing to stderr.
9056 This option overrides -fdump-analyzer.
9057
9058 -fdump-analyzer-callgraph
9059 Dump a representation of the call graph suitable for viewing with
9060 GraphViz to file.callgraph.dot.
9061
9062 -fdump-analyzer-exploded-graph
9063 Dump a representation of the "exploded graph" suitable for viewing
9064 with GraphViz to file.eg.dot. Nodes are color-coded based on
9065 state-machine states to emphasize state changes.
9066
9067 -fdump-analyzer-exploded-nodes
9068 Emit diagnostics showing where nodes in the "exploded graph" are in
9069 relation to the program source.
9070
9071 -fdump-analyzer-exploded-nodes-2
9072 Dump a textual representation of the "exploded graph" to
9073 file.eg.txt.
9074
9075 -fdump-analyzer-exploded-nodes-3
9076 Dump a textual representation of the "exploded graph" to one dump
9077 file per node, to file.eg-id.txt. This is typically a large number
9078 of dump files.
9079
9080 -fdump-analyzer-exploded-paths
9081 Dump a textual representation of the "exploded path" for each
9082 diagnostic to file.idx.kind.epath.txt.
9083
9084 -fdump-analyzer-feasibility
9085 Dump internal details about the analyzer's search for feasible
9086 paths. The details are written in a form suitable for viewing with
9087 GraphViz to filenames of the form file.*.fg.dot, file.*.tg.dot, and
9088 file.*.fpath.txt.
9089
9090 -fdump-analyzer-json
9091 Dump a compressed JSON representation of analyzer internals to
9092 file.analyzer.json.gz. The precise format is subject to change.
9093
9094 -fdump-analyzer-state-purge
9095 As per -fdump-analyzer-supergraph, dump a representation of the
9096 "supergraph" suitable for viewing with GraphViz, but annotate the
9097 graph with information on what state will be purged at each node.
9098 The graph is written to file.state-purge.dot.
9099
9100 -fdump-analyzer-supergraph
9101 Dump representations of the "supergraph" suitable for viewing with
9102 GraphViz to file.supergraph.dot and to file.supergraph-eg.dot.
9103 These show all of the control flow graphs in the program, with
9104 interprocedural edges for calls and returns. The second dump
9105 contains annotations showing nodes in the "exploded graph" and
9106 diagnostics associated with them.
9107
9108 -fdump-analyzer-untracked
9109 Emit custom warnings with internal details intended for analyzer
9110 developers.
9111
9112 Options for Debugging Your Program
9113 To tell GCC to emit extra information for use by a debugger, in almost
9114 all cases you need only to add -g to your other options. Some debug
9115 formats can co-exist (like DWARF with CTF) when each of them is enabled
9116 explicitly by adding the respective command line option to your other
9117 options.
9118
9119 GCC allows you to use -g with -O. The shortcuts taken by optimized
9120 code may occasionally be surprising: some variables you declared may
9121 not exist at all; flow of control may briefly move where you did not
9122 expect it; some statements may not be executed because they compute
9123 constant results or their values are already at hand; some statements
9124 may execute in different places because they have been moved out of
9125 loops. Nevertheless it is possible to debug optimized output. This
9126 makes it reasonable to use the optimizer for programs that might have
9127 bugs.
9128
9129 If you are not using some other optimization option, consider using -Og
9130 with -g. With no -O option at all, some compiler passes that collect
9131 information useful for debugging do not run at all, so that -Og may
9132 result in a better debugging experience.
9133
9134 -g Produce debugging information in the operating system's native
9135 format (stabs, COFF, XCOFF, or DWARF). GDB can work with this
9136 debugging information.
9137
9138 On most systems that use stabs format, -g enables use of extra
9139 debugging information that only GDB can use; this extra information
9140 makes debugging work better in GDB but probably makes other
9141 debuggers crash or refuse to read the program. If you want to
9142 control for certain whether to generate the extra information, use
9143 -gvms (see below).
9144
9145 -ggdb
9146 Produce debugging information for use by GDB. This means to use
9147 the most expressive format available (DWARF, stabs, or the native
9148 format if neither of those are supported), including GDB extensions
9149 if at all possible.
9150
9151 -gdwarf
9152 -gdwarf-version
9153 Produce debugging information in DWARF format (if that is
9154 supported). The value of version may be either 2, 3, 4 or 5; the
9155 default version for most targets is 5 (with the exception of
9156 VxWorks, TPF and Darwin/Mac OS X, which default to version 2, and
9157 AIX, which defaults to version 4).
9158
9159 Note that with DWARF Version 2, some ports require and always use
9160 some non-conflicting DWARF 3 extensions in the unwind tables.
9161
9162 Version 4 may require GDB 7.0 and -fvar-tracking-assignments for
9163 maximum benefit. Version 5 requires GDB 8.0 or higher.
9164
9165 GCC no longer supports DWARF Version 1, which is substantially
9166 different than Version 2 and later. For historical reasons, some
9167 other DWARF-related options such as -fno-dwarf2-cfi-asm) retain a
9168 reference to DWARF Version 2 in their names, but apply to all
9169 currently-supported versions of DWARF.
9170
9171 -gbtf
9172 Request BTF debug information. BTF is the default debugging format
9173 for the eBPF target. On other targets, like x86, BTF debug
9174 information can be generated along with DWARF debug information
9175 when both of the debug formats are enabled explicitly via their
9176 respective command line options.
9177
9178 -gctf
9179 -gctflevel
9180 Request CTF debug information and use level to specify how much CTF
9181 debug information should be produced. If -gctf is specified
9182 without a value for level, the default level of CTF debug
9183 information is 2.
9184
9185 CTF debug information can be generated along with DWARF debug
9186 information when both of the debug formats are enabled explicitly
9187 via their respective command line options.
9188
9189 Level 0 produces no CTF debug information at all. Thus, -gctf0
9190 negates -gctf.
9191
9192 Level 1 produces CTF information for tracebacks only. This
9193 includes callsite information, but does not include type
9194 information.
9195
9196 Level 2 produces type information for entities (functions, data
9197 objects etc.) at file-scope or global-scope only.
9198
9199 -gvms
9200 Produce debugging information in Alpha/VMS debug format (if that is
9201 supported). This is the format used by DEBUG on Alpha/VMS systems.
9202
9203 -glevel
9204 -ggdblevel
9205 -gvmslevel
9206 Request debugging information and also use level to specify how
9207 much information. The default level is 2.
9208
9209 Level 0 produces no debug information at all. Thus, -g0 negates
9210 -g.
9211
9212 Level 1 produces minimal information, enough for making backtraces
9213 in parts of the program that you don't plan to debug. This
9214 includes descriptions of functions and external variables, and line
9215 number tables, but no information about local variables.
9216
9217 Level 3 includes extra information, such as all the macro
9218 definitions present in the program. Some debuggers support macro
9219 expansion when you use -g3.
9220
9221 If you use multiple -g options, with or without level numbers, the
9222 last such option is the one that is effective.
9223
9224 -gdwarf does not accept a concatenated debug level, to avoid
9225 confusion with -gdwarf-level. Instead use an additional -glevel
9226 option to change the debug level for DWARF.
9227
9228 -fno-eliminate-unused-debug-symbols
9229 By default, no debug information is produced for symbols that are
9230 not actually used. Use this option if you want debug information
9231 for all symbols.
9232
9233 -femit-class-debug-always
9234 Instead of emitting debugging information for a C++ class in only
9235 one object file, emit it in all object files using the class. This
9236 option should be used only with debuggers that are unable to handle
9237 the way GCC normally emits debugging information for classes
9238 because using this option increases the size of debugging
9239 information by as much as a factor of two.
9240
9241 -fno-merge-debug-strings
9242 Direct the linker to not merge together strings in the debugging
9243 information that are identical in different object files. Merging
9244 is not supported by all assemblers or linkers. Merging decreases
9245 the size of the debug information in the output file at the cost of
9246 increasing link processing time. Merging is enabled by default.
9247
9248 -fdebug-prefix-map=old=new
9249 When compiling files residing in directory old, record debugging
9250 information describing them as if the files resided in directory
9251 new instead. This can be used to replace a build-time path with an
9252 install-time path in the debug info. It can also be used to change
9253 an absolute path to a relative path by using . for new. This can
9254 give more reproducible builds, which are location independent, but
9255 may require an extra command to tell GDB where to find the source
9256 files. See also -ffile-prefix-map and -fcanon-prefix-map.
9257
9258 -fvar-tracking
9259 Run variable tracking pass. It computes where variables are stored
9260 at each position in code. Better debugging information is then
9261 generated (if the debugging information format supports this
9262 information).
9263
9264 It is enabled by default when compiling with optimization (-Os, -O,
9265 -O2, ...), debugging information (-g) and the debug info format
9266 supports it.
9267
9268 -fvar-tracking-assignments
9269 Annotate assignments to user variables early in the compilation and
9270 attempt to carry the annotations over throughout the compilation
9271 all the way to the end, in an attempt to improve debug information
9272 while optimizing. Use of -gdwarf-4 is recommended along with it.
9273
9274 It can be enabled even if var-tracking is disabled, in which case
9275 annotations are created and maintained, but discarded at the end.
9276 By default, this flag is enabled together with -fvar-tracking,
9277 except when selective scheduling is enabled.
9278
9279 -gsplit-dwarf
9280 If DWARF debugging information is enabled, separate as much
9281 debugging information as possible into a separate output file with
9282 the extension .dwo. This option allows the build system to avoid
9283 linking files with debug information. To be useful, this option
9284 requires a debugger capable of reading .dwo files.
9285
9286 -gdwarf32
9287 -gdwarf64
9288 If DWARF debugging information is enabled, the -gdwarf32 selects
9289 the 32-bit DWARF format and the -gdwarf64 selects the 64-bit DWARF
9290 format. The default is target specific, on most targets it is
9291 -gdwarf32 though. The 32-bit DWARF format is smaller, but can't
9292 support more than 2GiB of debug information in any of the DWARF
9293 debug information sections. The 64-bit DWARF format allows larger
9294 debug information and might not be well supported by all consumers
9295 yet.
9296
9297 -gdescribe-dies
9298 Add description attributes to some DWARF DIEs that have no name
9299 attribute, such as artificial variables, external references and
9300 call site parameter DIEs.
9301
9302 -gpubnames
9303 Generate DWARF ".debug_pubnames" and ".debug_pubtypes" sections.
9304
9305 -ggnu-pubnames
9306 Generate ".debug_pubnames" and ".debug_pubtypes" sections in a
9307 format suitable for conversion into a GDB index. This option is
9308 only useful with a linker that can produce GDB index version 7.
9309
9310 -fdebug-types-section
9311 When using DWARF Version 4 or higher, type DIEs can be put into
9312 their own ".debug_types" section instead of making them part of the
9313 ".debug_info" section. It is more efficient to put them in a
9314 separate comdat section since the linker can then remove
9315 duplicates. But not all DWARF consumers support ".debug_types"
9316 sections yet and on some objects ".debug_types" produces larger
9317 instead of smaller debugging information.
9318
9319 -grecord-gcc-switches
9320 -gno-record-gcc-switches
9321 This switch causes the command-line options used to invoke the
9322 compiler that may affect code generation to be appended to the
9323 DW_AT_producer attribute in DWARF debugging information. The
9324 options are concatenated with spaces separating them from each
9325 other and from the compiler version. It is enabled by default.
9326 See also -frecord-gcc-switches for another way of storing compiler
9327 options into the object file.
9328
9329 -gstrict-dwarf
9330 Disallow using extensions of later DWARF standard version than
9331 selected with -gdwarf-version. On most targets using non-
9332 conflicting DWARF extensions from later standard versions is
9333 allowed.
9334
9335 -gno-strict-dwarf
9336 Allow using extensions of later DWARF standard version than
9337 selected with -gdwarf-version.
9338
9339 -gas-loc-support
9340 Inform the compiler that the assembler supports ".loc" directives.
9341 It may then use them for the assembler to generate DWARF2+ line
9342 number tables.
9343
9344 This is generally desirable, because assembler-generated line-
9345 number tables are a lot more compact than those the compiler can
9346 generate itself.
9347
9348 This option will be enabled by default if, at GCC configure time,
9349 the assembler was found to support such directives.
9350
9351 -gno-as-loc-support
9352 Force GCC to generate DWARF2+ line number tables internally, if
9353 DWARF2+ line number tables are to be generated.
9354
9355 -gas-locview-support
9356 Inform the compiler that the assembler supports "view" assignment
9357 and reset assertion checking in ".loc" directives.
9358
9359 This option will be enabled by default if, at GCC configure time,
9360 the assembler was found to support them.
9361
9362 -gno-as-locview-support
9363 Force GCC to assign view numbers internally, if
9364 -gvariable-location-views are explicitly requested.
9365
9366 -gcolumn-info
9367 -gno-column-info
9368 Emit location column information into DWARF debugging information,
9369 rather than just file and line. This option is enabled by default.
9370
9371 -gstatement-frontiers
9372 -gno-statement-frontiers
9373 This option causes GCC to create markers in the internal
9374 representation at the beginning of statements, and to keep them
9375 roughly in place throughout compilation, using them to guide the
9376 output of "is_stmt" markers in the line number table. This is
9377 enabled by default when compiling with optimization (-Os, -O1, -O2,
9378 ...), and outputting DWARF 2 debug information at the normal level.
9379
9380 -gvariable-location-views
9381 -gvariable-location-views=incompat5
9382 -gno-variable-location-views
9383 Augment variable location lists with progressive view numbers
9384 implied from the line number table. This enables debug information
9385 consumers to inspect state at certain points of the program, even
9386 if no instructions associated with the corresponding source
9387 locations are present at that point. If the assembler lacks
9388 support for view numbers in line number tables, this will cause the
9389 compiler to emit the line number table, which generally makes them
9390 somewhat less compact. The augmented line number tables and
9391 location lists are fully backward-compatible, so they can be
9392 consumed by debug information consumers that are not aware of these
9393 augmentations, but they won't derive any benefit from them either.
9394
9395 This is enabled by default when outputting DWARF 2 debug
9396 information at the normal level, as long as there is assembler
9397 support, -fvar-tracking-assignments is enabled and -gstrict-dwarf
9398 is not. When assembler support is not available, this may still be
9399 enabled, but it will force GCC to output internal line number
9400 tables, and if -ginternal-reset-location-views is not enabled, that
9401 will most certainly lead to silently mismatching location views.
9402
9403 There is a proposed representation for view numbers that is not
9404 backward compatible with the location list format introduced in
9405 DWARF 5, that can be enabled with
9406 -gvariable-location-views=incompat5. This option may be removed in
9407 the future, is only provided as a reference implementation of the
9408 proposed representation. Debug information consumers are not
9409 expected to support this extended format, and they would be
9410 rendered unable to decode location lists using it.
9411
9412 -ginternal-reset-location-views
9413 -gno-internal-reset-location-views
9414 Attempt to determine location views that can be omitted from
9415 location view lists. This requires the compiler to have very
9416 accurate insn length estimates, which isn't always the case, and it
9417 may cause incorrect view lists to be generated silently when using
9418 an assembler that does not support location view lists. The GNU
9419 assembler will flag any such error as a "view number mismatch".
9420 This is only enabled on ports that define a reliable estimation
9421 function.
9422
9423 -ginline-points
9424 -gno-inline-points
9425 Generate extended debug information for inlined functions.
9426 Location view tracking markers are inserted at inlined entry
9427 points, so that address and view numbers can be computed and output
9428 in debug information. This can be enabled independently of
9429 location views, in which case the view numbers won't be output, but
9430 it can only be enabled along with statement frontiers, and it is
9431 only enabled by default if location views are enabled.
9432
9433 -gz[=type]
9434 Produce compressed debug sections in DWARF format, if that is
9435 supported. If type is not given, the default type depends on the
9436 capabilities of the assembler and linker used. type may be one of
9437 none (don't compress debug sections), or zlib (use zlib compression
9438 in ELF gABI format). If the linker doesn't support writing
9439 compressed debug sections, the option is rejected. Otherwise, if
9440 the assembler does not support them, -gz is silently ignored when
9441 producing object files.
9442
9443 -femit-struct-debug-baseonly
9444 Emit debug information for struct-like types only when the base
9445 name of the compilation source file matches the base name of file
9446 in which the struct is defined.
9447
9448 This option substantially reduces the size of debugging
9449 information, but at significant potential loss in type information
9450 to the debugger. See -femit-struct-debug-reduced for a less
9451 aggressive option. See -femit-struct-debug-detailed for more
9452 detailed control.
9453
9454 This option works only with DWARF debug output.
9455
9456 -femit-struct-debug-reduced
9457 Emit debug information for struct-like types only when the base
9458 name of the compilation source file matches the base name of file
9459 in which the type is defined, unless the struct is a template or
9460 defined in a system header.
9461
9462 This option significantly reduces the size of debugging
9463 information, with some potential loss in type information to the
9464 debugger. See -femit-struct-debug-baseonly for a more aggressive
9465 option. See -femit-struct-debug-detailed for more detailed
9466 control.
9467
9468 This option works only with DWARF debug output.
9469
9470 -femit-struct-debug-detailed[=spec-list]
9471 Specify the struct-like types for which the compiler generates
9472 debug information. The intent is to reduce duplicate struct debug
9473 information between different object files within the same program.
9474
9475 This option is a detailed version of -femit-struct-debug-reduced
9476 and -femit-struct-debug-baseonly, which serves for most needs.
9477
9478 A specification has the
9479 syntax[dir:|ind:][ord:|gen:](any|sys|base|none)
9480
9481 The optional first word limits the specification to structs that
9482 are used directly (dir:) or used indirectly (ind:). A struct type
9483 is used directly when it is the type of a variable, member.
9484 Indirect uses arise through pointers to structs. That is, when use
9485 of an incomplete struct is valid, the use is indirect. An example
9486 is struct one direct; struct two * indirect;.
9487
9488 The optional second word limits the specification to ordinary
9489 structs (ord:) or generic structs (gen:). Generic structs are a
9490 bit complicated to explain. For C++, these are non-explicit
9491 specializations of template classes, or non-template classes within
9492 the above. Other programming languages have generics, but
9493 -femit-struct-debug-detailed does not yet implement them.
9494
9495 The third word specifies the source files for those structs for
9496 which the compiler should emit debug information. The values none
9497 and any have the normal meaning. The value base means that the
9498 base of name of the file in which the type declaration appears must
9499 match the base of the name of the main compilation file. In
9500 practice, this means that when compiling foo.c, debug information
9501 is generated for types declared in that file and foo.h, but not
9502 other header files. The value sys means those types satisfying
9503 base or declared in system or compiler headers.
9504
9505 You may need to experiment to determine the best settings for your
9506 application.
9507
9508 The default is -femit-struct-debug-detailed=all.
9509
9510 This option works only with DWARF debug output.
9511
9512 -fno-dwarf2-cfi-asm
9513 Emit DWARF unwind info as compiler generated ".eh_frame" section
9514 instead of using GAS ".cfi_*" directives.
9515
9516 -fno-eliminate-unused-debug-types
9517 Normally, when producing DWARF output, GCC avoids producing debug
9518 symbol output for types that are nowhere used in the source file
9519 being compiled. Sometimes it is useful to have GCC emit debugging
9520 information for all types declared in a compilation unit,
9521 regardless of whether or not they are actually used in that
9522 compilation unit, for example if, in the debugger, you want to cast
9523 a value to a type that is not actually used in your program (but is
9524 declared). More often, however, this results in a significant
9525 amount of wasted space.
9526
9527 Options That Control Optimization
9528 These options control various sorts of optimizations.
9529
9530 Without any optimization option, the compiler's goal is to reduce the
9531 cost of compilation and to make debugging produce the expected results.
9532 Statements are independent: if you stop the program with a breakpoint
9533 between statements, you can then assign a new value to any variable or
9534 change the program counter to any other statement in the function and
9535 get exactly the results you expect from the source code.
9536
9537 Turning on optimization flags makes the compiler attempt to improve the
9538 performance and/or code size at the expense of compilation time and
9539 possibly the ability to debug the program.
9540
9541 The compiler performs optimization based on the knowledge it has of the
9542 program. Compiling multiple files at once to a single output file mode
9543 allows the compiler to use information gained from all of the files
9544 when compiling each of them.
9545
9546 Not all optimizations are controlled directly by a flag. Only
9547 optimizations that have a flag are listed in this section.
9548
9549 Most optimizations are completely disabled at -O0 or if an -O level is
9550 not set on the command line, even if individual optimization flags are
9551 specified. Similarly, -Og suppresses many optimization passes.
9552
9553 Depending on the target and how GCC was configured, a slightly
9554 different set of optimizations may be enabled at each -O level than
9555 those listed here. You can invoke GCC with -Q --help=optimizers to
9556 find out the exact set of optimizations that are enabled at each level.
9557
9558 -O
9559 -O1 Optimize. Optimizing compilation takes somewhat more time, and a
9560 lot more memory for a large function.
9561
9562 With -O, the compiler tries to reduce code size and execution time,
9563 without performing any optimizations that take a great deal of
9564 compilation time.
9565
9566 -O turns on the following optimization flags:
9567
9568 -fauto-inc-dec -fbranch-count-reg -fcombine-stack-adjustments
9569 -fcompare-elim -fcprop-registers -fdce -fdefer-pop -fdelayed-branch
9570 -fdse -fforward-propagate -fguess-branch-probability
9571 -fif-conversion -fif-conversion2 -finline-functions-called-once
9572 -fipa-modref -fipa-profile -fipa-pure-const -fipa-reference
9573 -fipa-reference-addressable -fmerge-constants
9574 -fmove-loop-invariants -fmove-loop-stores -fomit-frame-pointer
9575 -freorder-blocks -fshrink-wrap -fshrink-wrap-separate
9576 -fsplit-wide-types -fssa-backprop -fssa-phiopt -ftree-bit-ccp
9577 -ftree-ccp -ftree-ch -ftree-coalesce-vars -ftree-copy-prop
9578 -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-forwprop
9579 -ftree-fre -ftree-phiprop -ftree-pta -ftree-scev-cprop -ftree-sink
9580 -ftree-slsr -ftree-sra -ftree-ter -funit-at-a-time
9581
9582 -O2 Optimize even more. GCC performs nearly all supported
9583 optimizations that do not involve a space-speed tradeoff. As
9584 compared to -O, this option increases both compilation time and the
9585 performance of the generated code.
9586
9587 -O2 turns on all optimization flags specified by -O1. It also
9588 turns on the following optimization flags:
9589
9590 -falign-functions -falign-jumps -falign-labels -falign-loops
9591 -fcaller-saves -fcode-hoisting -fcrossjumping -fcse-follow-jumps
9592 -fcse-skip-blocks -fdelete-null-pointer-checks -fdevirtualize
9593 -fdevirtualize-speculatively -fexpensive-optimizations
9594 -ffinite-loops -fgcse -fgcse-lm -fhoist-adjacent-loads
9595 -finline-functions -finline-small-functions -findirect-inlining
9596 -fipa-bit-cp -fipa-cp -fipa-icf -fipa-ra -fipa-sra -fipa-vrp
9597 -fisolate-erroneous-paths-dereference -flra-remat
9598 -foptimize-sibling-calls -foptimize-strlen -fpartial-inlining
9599 -fpeephole2 -freorder-blocks-algorithm=stc
9600 -freorder-blocks-and-partition -freorder-functions
9601 -frerun-cse-after-loop -fschedule-insns -fschedule-insns2
9602 -fsched-interblock -fsched-spec -fstore-merging -fstrict-aliasing
9603 -fthread-jumps -ftree-builtin-call-dce -ftree-loop-vectorize
9604 -ftree-pre -ftree-slp-vectorize -ftree-switch-conversion
9605 -ftree-tail-merge -ftree-vrp -fvect-cost-model=very-cheap
9606
9607 Please note the warning under -fgcse about invoking -O2 on programs
9608 that use computed gotos.
9609
9610 -O3 Optimize yet more. -O3 turns on all optimizations specified by -O2
9611 and also turns on the following optimization flags:
9612
9613 -fgcse-after-reload -fipa-cp-clone -floop-interchange
9614 -floop-unroll-and-jam -fpeel-loops -fpredictive-commoning
9615 -fsplit-loops -fsplit-paths -ftree-loop-distribution
9616 -ftree-partial-pre -funswitch-loops -fvect-cost-model=dynamic
9617 -fversion-loops-for-strides
9618
9619 -O0 Reduce compilation time and make debugging produce the expected
9620 results. This is the default.
9621
9622 -Os Optimize for size. -Os enables all -O2 optimizations except those
9623 that often increase code size:
9624
9625 -falign-functions -falign-jumps -falign-labels -falign-loops
9626 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc
9627
9628 It also enables -finline-functions, causes the compiler to tune for
9629 code size rather than execution speed, and performs further
9630 optimizations designed to reduce code size.
9631
9632 -Ofast
9633 Disregard strict standards compliance. -Ofast enables all -O3
9634 optimizations. It also enables optimizations that are not valid
9635 for all standard-compliant programs. It turns on -ffast-math,
9636 -fallow-store-data-races and the Fortran-specific -fstack-arrays,
9637 unless -fmax-stack-var-size is specified, and -fno-protect-parens.
9638 It turns off -fsemantic-interposition.
9639
9640 -Og Optimize debugging experience. -Og should be the optimization
9641 level of choice for the standard edit-compile-debug cycle, offering
9642 a reasonable level of optimization while maintaining fast
9643 compilation and a good debugging experience. It is a better choice
9644 than -O0 for producing debuggable code because some compiler passes
9645 that collect debug information are disabled at -O0.
9646
9647 Like -O0, -Og completely disables a number of optimization passes
9648 so that individual options controlling them have no effect.
9649 Otherwise -Og enables all -O1 optimization flags except for those
9650 that may interfere with debugging:
9651
9652 -fbranch-count-reg -fdelayed-branch -fdse -fif-conversion
9653 -fif-conversion2 -finline-functions-called-once
9654 -fmove-loop-invariants -fmove-loop-stores -fssa-phiopt
9655 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra
9656
9657 -Oz Optimize aggressively for size rather than speed. This may
9658 increase the number of instructions executed if those instructions
9659 require fewer bytes to encode. -Oz behaves similarly to -Os
9660 including enabling most -O2 optimizations.
9661
9662 If you use multiple -O options, with or without level numbers, the last
9663 such option is the one that is effective.
9664
9665 Options of the form -fflag specify machine-independent flags. Most
9666 flags have both positive and negative forms; the negative form of -ffoo
9667 is -fno-foo. In the table below, only one of the forms is listed---the
9668 one you typically use. You can figure out the other form by either
9669 removing no- or adding it.
9670
9671 The following options control specific optimizations. They are either
9672 activated by -O options or are related to ones that are. You can use
9673 the following flags in the rare cases when "fine-tuning" of
9674 optimizations to be performed is desired.
9675
9676 -fno-defer-pop
9677 For machines that must pop arguments after a function call, always
9678 pop the arguments as soon as each function returns. At levels -O1
9679 and higher, -fdefer-pop is the default; this allows the compiler to
9680 let arguments accumulate on the stack for several function calls
9681 and pop them all at once.
9682
9683 -fforward-propagate
9684 Perform a forward propagation pass on RTL. The pass tries to
9685 combine two instructions and checks if the result can be
9686 simplified. If loop unrolling is active, two passes are performed
9687 and the second is scheduled after loop unrolling.
9688
9689 This option is enabled by default at optimization levels -O1, -O2,
9690 -O3, -Os.
9691
9692 -ffp-contract=style
9693 -ffp-contract=off disables floating-point expression contraction.
9694 -ffp-contract=fast enables floating-point expression contraction
9695 such as forming of fused multiply-add operations if the target has
9696 native support for them. -ffp-contract=on enables floating-point
9697 expression contraction if allowed by the language standard. This
9698 is currently not implemented and treated equal to
9699 -ffp-contract=off.
9700
9701 The default is -ffp-contract=fast.
9702
9703 -fomit-frame-pointer
9704 Omit the frame pointer in functions that don't need one. This
9705 avoids the instructions to save, set up and restore the frame
9706 pointer; on many targets it also makes an extra register available.
9707
9708 On some targets this flag has no effect because the standard
9709 calling sequence always uses a frame pointer, so it cannot be
9710 omitted.
9711
9712 Note that -fno-omit-frame-pointer doesn't guarantee the frame
9713 pointer is used in all functions. Several targets always omit the
9714 frame pointer in leaf functions.
9715
9716 Enabled by default at -O1 and higher.
9717
9718 -foptimize-sibling-calls
9719 Optimize sibling and tail recursive calls.
9720
9721 Enabled at levels -O2, -O3, -Os.
9722
9723 -foptimize-strlen
9724 Optimize various standard C string functions (e.g. "strlen",
9725 "strchr" or "strcpy") and their "_FORTIFY_SOURCE" counterparts into
9726 faster alternatives.
9727
9728 Enabled at levels -O2, -O3.
9729
9730 -fno-inline
9731 Do not expand any functions inline apart from those marked with the
9732 "always_inline" attribute. This is the default when not
9733 optimizing.
9734
9735 Single functions can be exempted from inlining by marking them with
9736 the "noinline" attribute.
9737
9738 -finline-small-functions
9739 Integrate functions into their callers when their body is smaller
9740 than expected function call code (so overall size of program gets
9741 smaller). The compiler heuristically decides which functions are
9742 simple enough to be worth integrating in this way. This inlining
9743 applies to all functions, even those not declared inline.
9744
9745 Enabled at levels -O2, -O3, -Os.
9746
9747 -findirect-inlining
9748 Inline also indirect calls that are discovered to be known at
9749 compile time thanks to previous inlining. This option has any
9750 effect only when inlining itself is turned on by the
9751 -finline-functions or -finline-small-functions options.
9752
9753 Enabled at levels -O2, -O3, -Os.
9754
9755 -finline-functions
9756 Consider all functions for inlining, even if they are not declared
9757 inline. The compiler heuristically decides which functions are
9758 worth integrating in this way.
9759
9760 If all calls to a given function are integrated, and the function
9761 is declared "static", then the function is normally not output as
9762 assembler code in its own right.
9763
9764 Enabled at levels -O2, -O3, -Os. Also enabled by -fprofile-use and
9765 -fauto-profile.
9766
9767 -finline-functions-called-once
9768 Consider all "static" functions called once for inlining into their
9769 caller even if they are not marked "inline". If a call to a given
9770 function is integrated, then the function is not output as
9771 assembler code in its own right.
9772
9773 Enabled at levels -O1, -O2, -O3 and -Os, but not -Og.
9774
9775 -fearly-inlining
9776 Inline functions marked by "always_inline" and functions whose body
9777 seems smaller than the function call overhead early before doing
9778 -fprofile-generate instrumentation and real inlining pass. Doing
9779 so makes profiling significantly cheaper and usually inlining
9780 faster on programs having large chains of nested wrapper functions.
9781
9782 Enabled by default.
9783
9784 -fipa-sra
9785 Perform interprocedural scalar replacement of aggregates, removal
9786 of unused parameters and replacement of parameters passed by
9787 reference by parameters passed by value.
9788
9789 Enabled at levels -O2, -O3 and -Os.
9790
9791 -finline-limit=n
9792 By default, GCC limits the size of functions that can be inlined.
9793 This flag allows coarse control of this limit. n is the size of
9794 functions that can be inlined in number of pseudo instructions.
9795
9796 Inlining is actually controlled by a number of parameters, which
9797 may be specified individually by using --param name=value. The
9798 -finline-limit=n option sets some of these parameters as follows:
9799
9800 max-inline-insns-single
9801 is set to n/2.
9802
9803 max-inline-insns-auto
9804 is set to n/2.
9805
9806 See below for a documentation of the individual parameters
9807 controlling inlining and for the defaults of these parameters.
9808
9809 Note: there may be no value to -finline-limit that results in
9810 default behavior.
9811
9812 Note: pseudo instruction represents, in this particular context, an
9813 abstract measurement of function's size. In no way does it
9814 represent a count of assembly instructions and as such its exact
9815 meaning might change from one release to an another.
9816
9817 -fno-keep-inline-dllexport
9818 This is a more fine-grained version of -fkeep-inline-functions,
9819 which applies only to functions that are declared using the
9820 "dllexport" attribute or declspec.
9821
9822 -fkeep-inline-functions
9823 In C, emit "static" functions that are declared "inline" into the
9824 object file, even if the function has been inlined into all of its
9825 callers. This switch does not affect functions using the "extern
9826 inline" extension in GNU C90. In C++, emit any and all inline
9827 functions into the object file.
9828
9829 -fkeep-static-functions
9830 Emit "static" functions into the object file, even if the function
9831 is never used.
9832
9833 -fkeep-static-consts
9834 Emit variables declared "static const" when optimization isn't
9835 turned on, even if the variables aren't referenced.
9836
9837 GCC enables this option by default. If you want to force the
9838 compiler to check if a variable is referenced, regardless of
9839 whether or not optimization is turned on, use the
9840 -fno-keep-static-consts option.
9841
9842 -fmerge-constants
9843 Attempt to merge identical constants (string constants and
9844 floating-point constants) across compilation units.
9845
9846 This option is the default for optimized compilation if the
9847 assembler and linker support it. Use -fno-merge-constants to
9848 inhibit this behavior.
9849
9850 Enabled at levels -O1, -O2, -O3, -Os.
9851
9852 -fmerge-all-constants
9853 Attempt to merge identical constants and identical variables.
9854
9855 This option implies -fmerge-constants. In addition to
9856 -fmerge-constants this considers e.g. even constant initialized
9857 arrays or initialized constant variables with integral or floating-
9858 point types. Languages like C or C++ require each variable,
9859 including multiple instances of the same variable in recursive
9860 calls, to have distinct locations, so using this option results in
9861 non-conforming behavior.
9862
9863 -fmodulo-sched
9864 Perform swing modulo scheduling immediately before the first
9865 scheduling pass. This pass looks at innermost loops and reorders
9866 their instructions by overlapping different iterations.
9867
9868 -fmodulo-sched-allow-regmoves
9869 Perform more aggressive SMS-based modulo scheduling with register
9870 moves allowed. By setting this flag certain anti-dependences edges
9871 are deleted, which triggers the generation of reg-moves based on
9872 the life-range analysis. This option is effective only with
9873 -fmodulo-sched enabled.
9874
9875 -fno-branch-count-reg
9876 Disable the optimization pass that scans for opportunities to use
9877 "decrement and branch" instructions on a count register instead of
9878 instruction sequences that decrement a register, compare it against
9879 zero, and then branch based upon the result. This option is only
9880 meaningful on architectures that support such instructions, which
9881 include x86, PowerPC, IA-64 and S/390. Note that the
9882 -fno-branch-count-reg option doesn't remove the decrement and
9883 branch instructions from the generated instruction stream
9884 introduced by other optimization passes.
9885
9886 The default is -fbranch-count-reg at -O1 and higher, except for
9887 -Og.
9888
9889 -fno-function-cse
9890 Do not put function addresses in registers; make each instruction
9891 that calls a constant function contain the function's address
9892 explicitly.
9893
9894 This option results in less efficient code, but some strange hacks
9895 that alter the assembler output may be confused by the
9896 optimizations performed when this option is not used.
9897
9898 The default is -ffunction-cse
9899
9900 -fno-zero-initialized-in-bss
9901 If the target supports a BSS section, GCC by default puts variables
9902 that are initialized to zero into BSS. This can save space in the
9903 resulting code.
9904
9905 This option turns off this behavior because some programs
9906 explicitly rely on variables going to the data section---e.g., so
9907 that the resulting executable can find the beginning of that
9908 section and/or make assumptions based on that.
9909
9910 The default is -fzero-initialized-in-bss.
9911
9912 -fthread-jumps
9913 Perform optimizations that check to see if a jump branches to a
9914 location where another comparison subsumed by the first is found.
9915 If so, the first branch is redirected to either the destination of
9916 the second branch or a point immediately following it, depending on
9917 whether the condition is known to be true or false.
9918
9919 Enabled at levels -O1, -O2, -O3, -Os.
9920
9921 -fsplit-wide-types
9922 When using a type that occupies multiple registers, such as "long
9923 long" on a 32-bit system, split the registers apart and allocate
9924 them independently. This normally generates better code for those
9925 types, but may make debugging more difficult.
9926
9927 Enabled at levels -O1, -O2, -O3, -Os.
9928
9929 -fsplit-wide-types-early
9930 Fully split wide types early, instead of very late. This option
9931 has no effect unless -fsplit-wide-types is turned on.
9932
9933 This is the default on some targets.
9934
9935 -fcse-follow-jumps
9936 In common subexpression elimination (CSE), scan through jump
9937 instructions when the target of the jump is not reached by any
9938 other path. For example, when CSE encounters an "if" statement
9939 with an "else" clause, CSE follows the jump when the condition
9940 tested is false.
9941
9942 Enabled at levels -O2, -O3, -Os.
9943
9944 -fcse-skip-blocks
9945 This is similar to -fcse-follow-jumps, but causes CSE to follow
9946 jumps that conditionally skip over blocks. When CSE encounters a
9947 simple "if" statement with no else clause, -fcse-skip-blocks causes
9948 CSE to follow the jump around the body of the "if".
9949
9950 Enabled at levels -O2, -O3, -Os.
9951
9952 -frerun-cse-after-loop
9953 Re-run common subexpression elimination after loop optimizations
9954 are performed.
9955
9956 Enabled at levels -O2, -O3, -Os.
9957
9958 -fgcse
9959 Perform a global common subexpression elimination pass. This pass
9960 also performs global constant and copy propagation.
9961
9962 Note: When compiling a program using computed gotos, a GCC
9963 extension, you may get better run-time performance if you disable
9964 the global common subexpression elimination pass by adding
9965 -fno-gcse to the command line.
9966
9967 Enabled at levels -O2, -O3, -Os.
9968
9969 -fgcse-lm
9970 When -fgcse-lm is enabled, global common subexpression elimination
9971 attempts to move loads that are only killed by stores into
9972 themselves. This allows a loop containing a load/store sequence to
9973 be changed to a load outside the loop, and a copy/store within the
9974 loop.
9975
9976 Enabled by default when -fgcse is enabled.
9977
9978 -fgcse-sm
9979 When -fgcse-sm is enabled, a store motion pass is run after global
9980 common subexpression elimination. This pass attempts to move
9981 stores out of loops. When used in conjunction with -fgcse-lm,
9982 loops containing a load/store sequence can be changed to a load
9983 before the loop and a store after the loop.
9984
9985 Not enabled at any optimization level.
9986
9987 -fgcse-las
9988 When -fgcse-las is enabled, the global common subexpression
9989 elimination pass eliminates redundant loads that come after stores
9990 to the same memory location (both partial and full redundancies).
9991
9992 Not enabled at any optimization level.
9993
9994 -fgcse-after-reload
9995 When -fgcse-after-reload is enabled, a redundant load elimination
9996 pass is performed after reload. The purpose of this pass is to
9997 clean up redundant spilling.
9998
9999 Enabled by -O3, -fprofile-use and -fauto-profile.
10000
10001 -faggressive-loop-optimizations
10002 This option tells the loop optimizer to use language constraints to
10003 derive bounds for the number of iterations of a loop. This assumes
10004 that loop code does not invoke undefined behavior by for example
10005 causing signed integer overflows or out-of-bound array accesses.
10006 The bounds for the number of iterations of a loop are used to guide
10007 loop unrolling and peeling and loop exit test optimizations. This
10008 option is enabled by default.
10009
10010 -funconstrained-commons
10011 This option tells the compiler that variables declared in common
10012 blocks (e.g. Fortran) may later be overridden with longer trailing
10013 arrays. This prevents certain optimizations that depend on knowing
10014 the array bounds.
10015
10016 -fcrossjumping
10017 Perform cross-jumping transformation. This transformation unifies
10018 equivalent code and saves code size. The resulting code may or may
10019 not perform better than without cross-jumping.
10020
10021 Enabled at levels -O2, -O3, -Os.
10022
10023 -fauto-inc-dec
10024 Combine increments or decrements of addresses with memory accesses.
10025 This pass is always skipped on architectures that do not have
10026 instructions to support this. Enabled by default at -O1 and higher
10027 on architectures that support this.
10028
10029 -fdce
10030 Perform dead code elimination (DCE) on RTL. Enabled by default at
10031 -O1 and higher.
10032
10033 -fdse
10034 Perform dead store elimination (DSE) on RTL. Enabled by default at
10035 -O1 and higher.
10036
10037 -fif-conversion
10038 Attempt to transform conditional jumps into branch-less
10039 equivalents. This includes use of conditional moves, min, max, set
10040 flags and abs instructions, and some tricks doable by standard
10041 arithmetics. The use of conditional execution on chips where it is
10042 available is controlled by -fif-conversion2.
10043
10044 Enabled at levels -O1, -O2, -O3, -Os, but not with -Og.
10045
10046 -fif-conversion2
10047 Use conditional execution (where available) to transform
10048 conditional jumps into branch-less equivalents.
10049
10050 Enabled at levels -O1, -O2, -O3, -Os, but not with -Og.
10051
10052 -fdeclone-ctor-dtor
10053 The C++ ABI requires multiple entry points for constructors and
10054 destructors: one for a base subobject, one for a complete object,
10055 and one for a virtual destructor that calls operator delete
10056 afterwards. For a hierarchy with virtual bases, the base and
10057 complete variants are clones, which means two copies of the
10058 function. With this option, the base and complete variants are
10059 changed to be thunks that call a common implementation.
10060
10061 Enabled by -Os.
10062
10063 -fdelete-null-pointer-checks
10064 Assume that programs cannot safely dereference null pointers, and
10065 that no code or data element resides at address zero. This option
10066 enables simple constant folding optimizations at all optimization
10067 levels. In addition, other optimization passes in GCC use this
10068 flag to control global dataflow analyses that eliminate useless
10069 checks for null pointers; these assume that a memory access to
10070 address zero always results in a trap, so that if a pointer is
10071 checked after it has already been dereferenced, it cannot be null.
10072
10073 Note however that in some environments this assumption is not true.
10074 Use -fno-delete-null-pointer-checks to disable this optimization
10075 for programs that depend on that behavior.
10076
10077 This option is enabled by default on most targets. On Nios II ELF,
10078 it defaults to off. On AVR and MSP430, this option is completely
10079 disabled.
10080
10081 Passes that use the dataflow information are enabled independently
10082 at different optimization levels.
10083
10084 -fdevirtualize
10085 Attempt to convert calls to virtual functions to direct calls.
10086 This is done both within a procedure and interprocedurally as part
10087 of indirect inlining (-findirect-inlining) and interprocedural
10088 constant propagation (-fipa-cp). Enabled at levels -O2, -O3, -Os.
10089
10090 -fdevirtualize-speculatively
10091 Attempt to convert calls to virtual functions to speculative direct
10092 calls. Based on the analysis of the type inheritance graph,
10093 determine for a given call the set of likely targets. If the set is
10094 small, preferably of size 1, change the call into a conditional
10095 deciding between direct and indirect calls. The speculative calls
10096 enable more optimizations, such as inlining. When they seem
10097 useless after further optimization, they are converted back into
10098 original form.
10099
10100 -fdevirtualize-at-ltrans
10101 Stream extra information needed for aggressive devirtualization
10102 when running the link-time optimizer in local transformation mode.
10103 This option enables more devirtualization but significantly
10104 increases the size of streamed data. For this reason it is disabled
10105 by default.
10106
10107 -fexpensive-optimizations
10108 Perform a number of minor optimizations that are relatively
10109 expensive.
10110
10111 Enabled at levels -O2, -O3, -Os.
10112
10113 -free
10114 Attempt to remove redundant extension instructions. This is
10115 especially helpful for the x86-64 architecture, which implicitly
10116 zero-extends in 64-bit registers after writing to their lower
10117 32-bit half.
10118
10119 Enabled for Alpha, AArch64 and x86 at levels -O2, -O3, -Os.
10120
10121 -fno-lifetime-dse
10122 In C++ the value of an object is only affected by changes within
10123 its lifetime: when the constructor begins, the object has an
10124 indeterminate value, and any changes during the lifetime of the
10125 object are dead when the object is destroyed. Normally dead store
10126 elimination will take advantage of this; if your code relies on the
10127 value of the object storage persisting beyond the lifetime of the
10128 object, you can use this flag to disable this optimization. To
10129 preserve stores before the constructor starts (e.g. because your
10130 operator new clears the object storage) but still treat the object
10131 as dead after the destructor, you can use -flifetime-dse=1. The
10132 default behavior can be explicitly selected with -flifetime-dse=2.
10133 -flifetime-dse=0 is equivalent to -fno-lifetime-dse.
10134
10135 -flive-range-shrinkage
10136 Attempt to decrease register pressure through register live range
10137 shrinkage. This is helpful for fast processors with small or
10138 moderate size register sets.
10139
10140 -fira-algorithm=algorithm
10141 Use the specified coloring algorithm for the integrated register
10142 allocator. The algorithm argument can be priority, which specifies
10143 Chow's priority coloring, or CB, which specifies Chaitin-Briggs
10144 coloring. Chaitin-Briggs coloring is not implemented for all
10145 architectures, but for those targets that do support it, it is the
10146 default because it generates better code.
10147
10148 -fira-region=region
10149 Use specified regions for the integrated register allocator. The
10150 region argument should be one of the following:
10151
10152 all Use all loops as register allocation regions. This can give
10153 the best results for machines with a small and/or irregular
10154 register set.
10155
10156 mixed
10157 Use all loops except for loops with small register pressure as
10158 the regions. This value usually gives the best results in most
10159 cases and for most architectures, and is enabled by default
10160 when compiling with optimization for speed (-O, -O2, ...).
10161
10162 one Use all functions as a single region. This typically results
10163 in the smallest code size, and is enabled by default for -Os or
10164 -O0.
10165
10166 -fira-hoist-pressure
10167 Use IRA to evaluate register pressure in the code hoisting pass for
10168 decisions to hoist expressions. This option usually results in
10169 smaller code, but it can slow the compiler down.
10170
10171 This option is enabled at level -Os for all targets.
10172
10173 -fira-loop-pressure
10174 Use IRA to evaluate register pressure in loops for decisions to
10175 move loop invariants. This option usually results in generation of
10176 faster and smaller code on machines with large register files (>=
10177 32 registers), but it can slow the compiler down.
10178
10179 This option is enabled at level -O3 for some targets.
10180
10181 -fno-ira-share-save-slots
10182 Disable sharing of stack slots used for saving call-used hard
10183 registers living through a call. Each hard register gets a
10184 separate stack slot, and as a result function stack frames are
10185 larger.
10186
10187 -fno-ira-share-spill-slots
10188 Disable sharing of stack slots allocated for pseudo-registers.
10189 Each pseudo-register that does not get a hard register gets a
10190 separate stack slot, and as a result function stack frames are
10191 larger.
10192
10193 -flra-remat
10194 Enable CFG-sensitive rematerialization in LRA. Instead of loading
10195 values of spilled pseudos, LRA tries to rematerialize (recalculate)
10196 values if it is profitable.
10197
10198 Enabled at levels -O2, -O3, -Os.
10199
10200 -fdelayed-branch
10201 If supported for the target machine, attempt to reorder
10202 instructions to exploit instruction slots available after delayed
10203 branch instructions.
10204
10205 Enabled at levels -O1, -O2, -O3, -Os, but not at -Og.
10206
10207 -fschedule-insns
10208 If supported for the target machine, attempt to reorder
10209 instructions to eliminate execution stalls due to required data
10210 being unavailable. This helps machines that have slow floating
10211 point or memory load instructions by allowing other instructions to
10212 be issued until the result of the load or floating-point
10213 instruction is required.
10214
10215 Enabled at levels -O2, -O3.
10216
10217 -fschedule-insns2
10218 Similar to -fschedule-insns, but requests an additional pass of
10219 instruction scheduling after register allocation has been done.
10220 This is especially useful on machines with a relatively small
10221 number of registers and where memory load instructions take more
10222 than one cycle.
10223
10224 Enabled at levels -O2, -O3, -Os.
10225
10226 -fno-sched-interblock
10227 Disable instruction scheduling across basic blocks, which is
10228 normally enabled when scheduling before register allocation, i.e.
10229 with -fschedule-insns or at -O2 or higher.
10230
10231 -fno-sched-spec
10232 Disable speculative motion of non-load instructions, which is
10233 normally enabled when scheduling before register allocation, i.e.
10234 with -fschedule-insns or at -O2 or higher.
10235
10236 -fsched-pressure
10237 Enable register pressure sensitive insn scheduling before register
10238 allocation. This only makes sense when scheduling before register
10239 allocation is enabled, i.e. with -fschedule-insns or at -O2 or
10240 higher. Usage of this option can improve the generated code and
10241 decrease its size by preventing register pressure increase above
10242 the number of available hard registers and subsequent spills in
10243 register allocation.
10244
10245 -fsched-spec-load
10246 Allow speculative motion of some load instructions. This only
10247 makes sense when scheduling before register allocation, i.e. with
10248 -fschedule-insns or at -O2 or higher.
10249
10250 -fsched-spec-load-dangerous
10251 Allow speculative motion of more load instructions. This only
10252 makes sense when scheduling before register allocation, i.e. with
10253 -fschedule-insns or at -O2 or higher.
10254
10255 -fsched-stalled-insns
10256 -fsched-stalled-insns=n
10257 Define how many insns (if any) can be moved prematurely from the
10258 queue of stalled insns into the ready list during the second
10259 scheduling pass. -fno-sched-stalled-insns means that no insns are
10260 moved prematurely, -fsched-stalled-insns=0 means there is no limit
10261 on how many queued insns can be moved prematurely.
10262 -fsched-stalled-insns without a value is equivalent to
10263 -fsched-stalled-insns=1.
10264
10265 -fsched-stalled-insns-dep
10266 -fsched-stalled-insns-dep=n
10267 Define how many insn groups (cycles) are examined for a dependency
10268 on a stalled insn that is a candidate for premature removal from
10269 the queue of stalled insns. This has an effect only during the
10270 second scheduling pass, and only if -fsched-stalled-insns is used.
10271 -fno-sched-stalled-insns-dep is equivalent to
10272 -fsched-stalled-insns-dep=0. -fsched-stalled-insns-dep without a
10273 value is equivalent to -fsched-stalled-insns-dep=1.
10274
10275 -fsched2-use-superblocks
10276 When scheduling after register allocation, use superblock
10277 scheduling. This allows motion across basic block boundaries,
10278 resulting in faster schedules. This option is experimental, as not
10279 all machine descriptions used by GCC model the CPU closely enough
10280 to avoid unreliable results from the algorithm.
10281
10282 This only makes sense when scheduling after register allocation,
10283 i.e. with -fschedule-insns2 or at -O2 or higher.
10284
10285 -fsched-group-heuristic
10286 Enable the group heuristic in the scheduler. This heuristic favors
10287 the instruction that belongs to a schedule group. This is enabled
10288 by default when scheduling is enabled, i.e. with -fschedule-insns
10289 or -fschedule-insns2 or at -O2 or higher.
10290
10291 -fsched-critical-path-heuristic
10292 Enable the critical-path heuristic in the scheduler. This
10293 heuristic favors instructions on the critical path. This is
10294 enabled by default when scheduling is enabled, i.e. with
10295 -fschedule-insns or -fschedule-insns2 or at -O2 or higher.
10296
10297 -fsched-spec-insn-heuristic
10298 Enable the speculative instruction heuristic in the scheduler.
10299 This heuristic favors speculative instructions with greater
10300 dependency weakness. This is enabled by default when scheduling is
10301 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
10302 or higher.
10303
10304 -fsched-rank-heuristic
10305 Enable the rank heuristic in the scheduler. This heuristic favors
10306 the instruction belonging to a basic block with greater size or
10307 frequency. This is enabled by default when scheduling is enabled,
10308 i.e. with -fschedule-insns or -fschedule-insns2 or at -O2 or
10309 higher.
10310
10311 -fsched-last-insn-heuristic
10312 Enable the last-instruction heuristic in the scheduler. This
10313 heuristic favors the instruction that is less dependent on the last
10314 instruction scheduled. This is enabled by default when scheduling
10315 is enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at
10316 -O2 or higher.
10317
10318 -fsched-dep-count-heuristic
10319 Enable the dependent-count heuristic in the scheduler. This
10320 heuristic favors the instruction that has more instructions
10321 depending on it. This is enabled by default when scheduling is
10322 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
10323 or higher.
10324
10325 -freschedule-modulo-scheduled-loops
10326 Modulo scheduling is performed before traditional scheduling. If a
10327 loop is modulo scheduled, later scheduling passes may change its
10328 schedule. Use this option to control that behavior.
10329
10330 -fselective-scheduling
10331 Schedule instructions using selective scheduling algorithm.
10332 Selective scheduling runs instead of the first scheduler pass.
10333
10334 -fselective-scheduling2
10335 Schedule instructions using selective scheduling algorithm.
10336 Selective scheduling runs instead of the second scheduler pass.
10337
10338 -fsel-sched-pipelining
10339 Enable software pipelining of innermost loops during selective
10340 scheduling. This option has no effect unless one of
10341 -fselective-scheduling or -fselective-scheduling2 is turned on.
10342
10343 -fsel-sched-pipelining-outer-loops
10344 When pipelining loops during selective scheduling, also pipeline
10345 outer loops. This option has no effect unless
10346 -fsel-sched-pipelining is turned on.
10347
10348 -fsemantic-interposition
10349 Some object formats, like ELF, allow interposing of symbols by the
10350 dynamic linker. This means that for symbols exported from the DSO,
10351 the compiler cannot perform interprocedural propagation, inlining
10352 and other optimizations in anticipation that the function or
10353 variable in question may change. While this feature is useful, for
10354 example, to rewrite memory allocation functions by a debugging
10355 implementation, it is expensive in the terms of code quality. With
10356 -fno-semantic-interposition the compiler assumes that if
10357 interposition happens for functions the overwriting function will
10358 have precisely the same semantics (and side effects). Similarly if
10359 interposition happens for variables, the constructor of the
10360 variable will be the same. The flag has no effect for functions
10361 explicitly declared inline (where it is never allowed for
10362 interposition to change semantics) and for symbols explicitly
10363 declared weak.
10364
10365 -fshrink-wrap
10366 Emit function prologues only before parts of the function that need
10367 it, rather than at the top of the function. This flag is enabled
10368 by default at -O and higher.
10369
10370 -fshrink-wrap-separate
10371 Shrink-wrap separate parts of the prologue and epilogue separately,
10372 so that those parts are only executed when needed. This option is
10373 on by default, but has no effect unless -fshrink-wrap is also
10374 turned on and the target supports this.
10375
10376 -fcaller-saves
10377 Enable allocation of values to registers that are clobbered by
10378 function calls, by emitting extra instructions to save and restore
10379 the registers around such calls. Such allocation is done only when
10380 it seems to result in better code.
10381
10382 This option is always enabled by default on certain machines,
10383 usually those which have no call-preserved registers to use
10384 instead.
10385
10386 Enabled at levels -O2, -O3, -Os.
10387
10388 -fcombine-stack-adjustments
10389 Tracks stack adjustments (pushes and pops) and stack memory
10390 references and then tries to find ways to combine them.
10391
10392 Enabled by default at -O1 and higher.
10393
10394 -fipa-ra
10395 Use caller save registers for allocation if those registers are not
10396 used by any called function. In that case it is not necessary to
10397 save and restore them around calls. This is only possible if
10398 called functions are part of same compilation unit as current
10399 function and they are compiled before it.
10400
10401 Enabled at levels -O2, -O3, -Os, however the option is disabled if
10402 generated code will be instrumented for profiling (-p, or -pg) or
10403 if callee's register usage cannot be known exactly (this happens on
10404 targets that do not expose prologues and epilogues in RTL).
10405
10406 -fconserve-stack
10407 Attempt to minimize stack usage. The compiler attempts to use less
10408 stack space, even if that makes the program slower. This option
10409 implies setting the large-stack-frame parameter to 100 and the
10410 large-stack-frame-growth parameter to 400.
10411
10412 -ftree-reassoc
10413 Perform reassociation on trees. This flag is enabled by default at
10414 -O1 and higher.
10415
10416 -fcode-hoisting
10417 Perform code hoisting. Code hoisting tries to move the evaluation
10418 of expressions executed on all paths to the function exit as early
10419 as possible. This is especially useful as a code size
10420 optimization, but it often helps for code speed as well. This flag
10421 is enabled by default at -O2 and higher.
10422
10423 -ftree-pre
10424 Perform partial redundancy elimination (PRE) on trees. This flag
10425 is enabled by default at -O2 and -O3.
10426
10427 -ftree-partial-pre
10428 Make partial redundancy elimination (PRE) more aggressive. This
10429 flag is enabled by default at -O3.
10430
10431 -ftree-forwprop
10432 Perform forward propagation on trees. This flag is enabled by
10433 default at -O1 and higher.
10434
10435 -ftree-fre
10436 Perform full redundancy elimination (FRE) on trees. The difference
10437 between FRE and PRE is that FRE only considers expressions that are
10438 computed on all paths leading to the redundant computation. This
10439 analysis is faster than PRE, though it exposes fewer redundancies.
10440 This flag is enabled by default at -O1 and higher.
10441
10442 -ftree-phiprop
10443 Perform hoisting of loads from conditional pointers on trees. This
10444 pass is enabled by default at -O1 and higher.
10445
10446 -fhoist-adjacent-loads
10447 Speculatively hoist loads from both branches of an if-then-else if
10448 the loads are from adjacent locations in the same structure and the
10449 target architecture has a conditional move instruction. This flag
10450 is enabled by default at -O2 and higher.
10451
10452 -ftree-copy-prop
10453 Perform copy propagation on trees. This pass eliminates
10454 unnecessary copy operations. This flag is enabled by default at
10455 -O1 and higher.
10456
10457 -fipa-pure-const
10458 Discover which functions are pure or constant. Enabled by default
10459 at -O1 and higher.
10460
10461 -fipa-reference
10462 Discover which static variables do not escape the compilation unit.
10463 Enabled by default at -O1 and higher.
10464
10465 -fipa-reference-addressable
10466 Discover read-only, write-only and non-addressable static
10467 variables. Enabled by default at -O1 and higher.
10468
10469 -fipa-stack-alignment
10470 Reduce stack alignment on call sites if possible. Enabled by
10471 default.
10472
10473 -fipa-pta
10474 Perform interprocedural pointer analysis and interprocedural
10475 modification and reference analysis. This option can cause
10476 excessive memory and compile-time usage on large compilation units.
10477 It is not enabled by default at any optimization level.
10478
10479 -fipa-profile
10480 Perform interprocedural profile propagation. The functions called
10481 only from cold functions are marked as cold. Also functions
10482 executed once (such as "cold", "noreturn", static constructors or
10483 destructors) are identified. Cold functions and loop less parts of
10484 functions executed once are then optimized for size. Enabled by
10485 default at -O1 and higher.
10486
10487 -fipa-modref
10488 Perform interprocedural mod/ref analysis. This optimization
10489 analyzes the side effects of functions (memory locations that are
10490 modified or referenced) and enables better optimization across the
10491 function call boundary. This flag is enabled by default at -O1 and
10492 higher.
10493
10494 -fipa-cp
10495 Perform interprocedural constant propagation. This optimization
10496 analyzes the program to determine when values passed to functions
10497 are constants and then optimizes accordingly. This optimization
10498 can substantially increase performance if the application has
10499 constants passed to functions. This flag is enabled by default at
10500 -O2, -Os and -O3. It is also enabled by -fprofile-use and
10501 -fauto-profile.
10502
10503 -fipa-cp-clone
10504 Perform function cloning to make interprocedural constant
10505 propagation stronger. When enabled, interprocedural constant
10506 propagation performs function cloning when externally visible
10507 function can be called with constant arguments. Because this
10508 optimization can create multiple copies of functions, it may
10509 significantly increase code size (see --param
10510 ipa-cp-unit-growth=value). This flag is enabled by default at -O3.
10511 It is also enabled by -fprofile-use and -fauto-profile.
10512
10513 -fipa-bit-cp
10514 When enabled, perform interprocedural bitwise constant propagation.
10515 This flag is enabled by default at -O2 and by -fprofile-use and
10516 -fauto-profile. It requires that -fipa-cp is enabled.
10517
10518 -fipa-vrp
10519 When enabled, perform interprocedural propagation of value ranges.
10520 This flag is enabled by default at -O2. It requires that -fipa-cp
10521 is enabled.
10522
10523 -fipa-icf
10524 Perform Identical Code Folding for functions and read-only
10525 variables. The optimization reduces code size and may disturb
10526 unwind stacks by replacing a function by equivalent one with a
10527 different name. The optimization works more effectively with link-
10528 time optimization enabled.
10529
10530 Although the behavior is similar to the Gold Linker's ICF
10531 optimization, GCC ICF works on different levels and thus the
10532 optimizations are not same - there are equivalences that are found
10533 only by GCC and equivalences found only by Gold.
10534
10535 This flag is enabled by default at -O2 and -Os.
10536
10537 -flive-patching=level
10538 Control GCC's optimizations to produce output suitable for live-
10539 patching.
10540
10541 If the compiler's optimization uses a function's body or
10542 information extracted from its body to optimize/change another
10543 function, the latter is called an impacted function of the former.
10544 If a function is patched, its impacted functions should be patched
10545 too.
10546
10547 The impacted functions are determined by the compiler's
10548 interprocedural optimizations. For example, a caller is impacted
10549 when inlining a function into its caller, cloning a function and
10550 changing its caller to call this new clone, or extracting a
10551 function's pureness/constness information to optimize its direct or
10552 indirect callers, etc.
10553
10554 Usually, the more IPA optimizations enabled, the larger the number
10555 of impacted functions for each function. In order to control the
10556 number of impacted functions and more easily compute the list of
10557 impacted function, IPA optimizations can be partially enabled at
10558 two different levels.
10559
10560 The level argument should be one of the following:
10561
10562 inline-clone
10563 Only enable inlining and cloning optimizations, which includes
10564 inlining, cloning, interprocedural scalar replacement of
10565 aggregates and partial inlining. As a result, when patching a
10566 function, all its callers and its clones' callers are impacted,
10567 therefore need to be patched as well.
10568
10569 -flive-patching=inline-clone disables the following
10570 optimization flags: -fwhole-program -fipa-pta -fipa-reference
10571 -fipa-ra -fipa-icf -fipa-icf-functions -fipa-icf-variables
10572 -fipa-bit-cp -fipa-vrp -fipa-pure-const
10573 -fipa-reference-addressable -fipa-stack-alignment -fipa-modref
10574
10575 inline-only-static
10576 Only enable inlining of static functions. As a result, when
10577 patching a static function, all its callers are impacted and so
10578 need to be patched as well.
10579
10580 In addition to all the flags that -flive-patching=inline-clone
10581 disables, -flive-patching=inline-only-static disables the
10582 following additional optimization flags: -fipa-cp-clone
10583 -fipa-sra -fpartial-inlining -fipa-cp
10584
10585 When -flive-patching is specified without any value, the default
10586 value is inline-clone.
10587
10588 This flag is disabled by default.
10589
10590 Note that -flive-patching is not supported with link-time
10591 optimization (-flto).
10592
10593 -fisolate-erroneous-paths-dereference
10594 Detect paths that trigger erroneous or undefined behavior due to
10595 dereferencing a null pointer. Isolate those paths from the main
10596 control flow and turn the statement with erroneous or undefined
10597 behavior into a trap. This flag is enabled by default at -O2 and
10598 higher and depends on -fdelete-null-pointer-checks also being
10599 enabled.
10600
10601 -fisolate-erroneous-paths-attribute
10602 Detect paths that trigger erroneous or undefined behavior due to a
10603 null value being used in a way forbidden by a "returns_nonnull" or
10604 "nonnull" attribute. Isolate those paths from the main control
10605 flow and turn the statement with erroneous or undefined behavior
10606 into a trap. This is not currently enabled, but may be enabled by
10607 -O2 in the future.
10608
10609 -ftree-sink
10610 Perform forward store motion on trees. This flag is enabled by
10611 default at -O1 and higher.
10612
10613 -ftree-bit-ccp
10614 Perform sparse conditional bit constant propagation on trees and
10615 propagate pointer alignment information. This pass only operates
10616 on local scalar variables and is enabled by default at -O1 and
10617 higher, except for -Og. It requires that -ftree-ccp is enabled.
10618
10619 -ftree-ccp
10620 Perform sparse conditional constant propagation (CCP) on trees.
10621 This pass only operates on local scalar variables and is enabled by
10622 default at -O1 and higher.
10623
10624 -fssa-backprop
10625 Propagate information about uses of a value up the definition chain
10626 in order to simplify the definitions. For example, this pass
10627 strips sign operations if the sign of a value never matters. The
10628 flag is enabled by default at -O1 and higher.
10629
10630 -fssa-phiopt
10631 Perform pattern matching on SSA PHI nodes to optimize conditional
10632 code. This pass is enabled by default at -O1 and higher, except
10633 for -Og.
10634
10635 -ftree-switch-conversion
10636 Perform conversion of simple initializations in a switch to
10637 initializations from a scalar array. This flag is enabled by
10638 default at -O2 and higher.
10639
10640 -ftree-tail-merge
10641 Look for identical code sequences. When found, replace one with a
10642 jump to the other. This optimization is known as tail merging or
10643 cross jumping. This flag is enabled by default at -O2 and higher.
10644 The compilation time in this pass can be limited using max-tail-
10645 merge-comparisons parameter and max-tail-merge-iterations
10646 parameter.
10647
10648 -ftree-dce
10649 Perform dead code elimination (DCE) on trees. This flag is enabled
10650 by default at -O1 and higher.
10651
10652 -ftree-builtin-call-dce
10653 Perform conditional dead code elimination (DCE) for calls to built-
10654 in functions that may set "errno" but are otherwise free of side
10655 effects. This flag is enabled by default at -O2 and higher if -Os
10656 is not also specified.
10657
10658 -ffinite-loops
10659 Assume that a loop with an exit will eventually take the exit and
10660 not loop indefinitely. This allows the compiler to remove loops
10661 that otherwise have no side-effects, not considering eventual
10662 endless looping as such.
10663
10664 This option is enabled by default at -O2 for C++ with -std=c++11 or
10665 higher.
10666
10667 -ftree-dominator-opts
10668 Perform a variety of simple scalar cleanups (constant/copy
10669 propagation, redundancy elimination, range propagation and
10670 expression simplification) based on a dominator tree traversal.
10671 This also performs jump threading (to reduce jumps to jumps). This
10672 flag is enabled by default at -O1 and higher.
10673
10674 -ftree-dse
10675 Perform dead store elimination (DSE) on trees. A dead store is a
10676 store into a memory location that is later overwritten by another
10677 store without any intervening loads. In this case the earlier
10678 store can be deleted. This flag is enabled by default at -O1 and
10679 higher.
10680
10681 -ftree-ch
10682 Perform loop header copying on trees. This is beneficial since it
10683 increases effectiveness of code motion optimizations. It also
10684 saves one jump. This flag is enabled by default at -O1 and higher.
10685 It is not enabled for -Os, since it usually increases code size.
10686
10687 -ftree-loop-optimize
10688 Perform loop optimizations on trees. This flag is enabled by
10689 default at -O1 and higher.
10690
10691 -ftree-loop-linear
10692 -floop-strip-mine
10693 -floop-block
10694 Perform loop nest optimizations. Same as -floop-nest-optimize. To
10695 use this code transformation, GCC has to be configured with
10696 --with-isl to enable the Graphite loop transformation
10697 infrastructure.
10698
10699 -fgraphite-identity
10700 Enable the identity transformation for graphite. For every SCoP we
10701 generate the polyhedral representation and transform it back to
10702 gimple. Using -fgraphite-identity we can check the costs or
10703 benefits of the GIMPLE -> GRAPHITE -> GIMPLE transformation. Some
10704 minimal optimizations are also performed by the code generator isl,
10705 like index splitting and dead code elimination in loops.
10706
10707 -floop-nest-optimize
10708 Enable the isl based loop nest optimizer. This is a generic loop
10709 nest optimizer based on the Pluto optimization algorithms. It
10710 calculates a loop structure optimized for data-locality and
10711 parallelism. This option is experimental.
10712
10713 -floop-parallelize-all
10714 Use the Graphite data dependence analysis to identify loops that
10715 can be parallelized. Parallelize all the loops that can be
10716 analyzed to not contain loop carried dependences without checking
10717 that it is profitable to parallelize the loops.
10718
10719 -ftree-coalesce-vars
10720 While transforming the program out of the SSA representation,
10721 attempt to reduce copying by coalescing versions of different user-
10722 defined variables, instead of just compiler temporaries. This may
10723 severely limit the ability to debug an optimized program compiled
10724 with -fno-var-tracking-assignments. In the negated form, this flag
10725 prevents SSA coalescing of user variables. This option is enabled
10726 by default if optimization is enabled, and it does very little
10727 otherwise.
10728
10729 -ftree-loop-if-convert
10730 Attempt to transform conditional jumps in the innermost loops to
10731 branch-less equivalents. The intent is to remove control-flow from
10732 the innermost loops in order to improve the ability of the
10733 vectorization pass to handle these loops. This is enabled by
10734 default if vectorization is enabled.
10735
10736 -ftree-loop-distribution
10737 Perform loop distribution. This flag can improve cache performance
10738 on big loop bodies and allow further loop optimizations, like
10739 parallelization or vectorization, to take place. For example, the
10740 loop
10741
10742 DO I = 1, N
10743 A(I) = B(I) + C
10744 D(I) = E(I) * F
10745 ENDDO
10746
10747 is transformed to
10748
10749 DO I = 1, N
10750 A(I) = B(I) + C
10751 ENDDO
10752 DO I = 1, N
10753 D(I) = E(I) * F
10754 ENDDO
10755
10756 This flag is enabled by default at -O3. It is also enabled by
10757 -fprofile-use and -fauto-profile.
10758
10759 -ftree-loop-distribute-patterns
10760 Perform loop distribution of patterns that can be code generated
10761 with calls to a library. This flag is enabled by default at -O2
10762 and higher, and by -fprofile-use and -fauto-profile.
10763
10764 This pass distributes the initialization loops and generates a call
10765 to memset zero. For example, the loop
10766
10767 DO I = 1, N
10768 A(I) = 0
10769 B(I) = A(I) + I
10770 ENDDO
10771
10772 is transformed to
10773
10774 DO I = 1, N
10775 A(I) = 0
10776 ENDDO
10777 DO I = 1, N
10778 B(I) = A(I) + I
10779 ENDDO
10780
10781 and the initialization loop is transformed into a call to memset
10782 zero. This flag is enabled by default at -O3. It is also enabled
10783 by -fprofile-use and -fauto-profile.
10784
10785 -floop-interchange
10786 Perform loop interchange outside of graphite. This flag can
10787 improve cache performance on loop nest and allow further loop
10788 optimizations, like vectorization, to take place. For example, the
10789 loop
10790
10791 for (int i = 0; i < N; i++)
10792 for (int j = 0; j < N; j++)
10793 for (int k = 0; k < N; k++)
10794 c[i][j] = c[i][j] + a[i][k]*b[k][j];
10795
10796 is transformed to
10797
10798 for (int i = 0; i < N; i++)
10799 for (int k = 0; k < N; k++)
10800 for (int j = 0; j < N; j++)
10801 c[i][j] = c[i][j] + a[i][k]*b[k][j];
10802
10803 This flag is enabled by default at -O3. It is also enabled by
10804 -fprofile-use and -fauto-profile.
10805
10806 -floop-unroll-and-jam
10807 Apply unroll and jam transformations on feasible loops. In a loop
10808 nest this unrolls the outer loop by some factor and fuses the
10809 resulting multiple inner loops. This flag is enabled by default at
10810 -O3. It is also enabled by -fprofile-use and -fauto-profile.
10811
10812 -ftree-loop-im
10813 Perform loop invariant motion on trees. This pass moves only
10814 invariants that are hard to handle at RTL level (function calls,
10815 operations that expand to nontrivial sequences of insns). With
10816 -funswitch-loops it also moves operands of conditions that are
10817 invariant out of the loop, so that we can use just trivial
10818 invariantness analysis in loop unswitching. The pass also includes
10819 store motion.
10820
10821 -ftree-loop-ivcanon
10822 Create a canonical counter for number of iterations in loops for
10823 which determining number of iterations requires complicated
10824 analysis. Later optimizations then may determine the number
10825 easily. Useful especially in connection with unrolling.
10826
10827 -ftree-scev-cprop
10828 Perform final value replacement. If a variable is modified in a
10829 loop in such a way that its value when exiting the loop can be
10830 determined using only its initial value and the number of loop
10831 iterations, replace uses of the final value by such a computation,
10832 provided it is sufficiently cheap. This reduces data dependencies
10833 and may allow further simplifications. Enabled by default at -O1
10834 and higher.
10835
10836 -fivopts
10837 Perform induction variable optimizations (strength reduction,
10838 induction variable merging and induction variable elimination) on
10839 trees.
10840
10841 -ftree-parallelize-loops=n
10842 Parallelize loops, i.e., split their iteration space to run in n
10843 threads. This is only possible for loops whose iterations are
10844 independent and can be arbitrarily reordered. The optimization is
10845 only profitable on multiprocessor machines, for loops that are CPU-
10846 intensive, rather than constrained e.g. by memory bandwidth. This
10847 option implies -pthread, and thus is only supported on targets that
10848 have support for -pthread.
10849
10850 -ftree-pta
10851 Perform function-local points-to analysis on trees. This flag is
10852 enabled by default at -O1 and higher, except for -Og.
10853
10854 -ftree-sra
10855 Perform scalar replacement of aggregates. This pass replaces
10856 structure references with scalars to prevent committing structures
10857 to memory too early. This flag is enabled by default at -O1 and
10858 higher, except for -Og.
10859
10860 -fstore-merging
10861 Perform merging of narrow stores to consecutive memory addresses.
10862 This pass merges contiguous stores of immediate values narrower
10863 than a word into fewer wider stores to reduce the number of
10864 instructions. This is enabled by default at -O2 and higher as well
10865 as -Os.
10866
10867 -ftree-ter
10868 Perform temporary expression replacement during the SSA->normal
10869 phase. Single use/single def temporaries are replaced at their use
10870 location with their defining expression. This results in non-
10871 GIMPLE code, but gives the expanders much more complex trees to
10872 work on resulting in better RTL generation. This is enabled by
10873 default at -O1 and higher.
10874
10875 -ftree-slsr
10876 Perform straight-line strength reduction on trees. This recognizes
10877 related expressions involving multiplications and replaces them by
10878 less expensive calculations when possible. This is enabled by
10879 default at -O1 and higher.
10880
10881 -ftree-vectorize
10882 Perform vectorization on trees. This flag enables
10883 -ftree-loop-vectorize and -ftree-slp-vectorize if not explicitly
10884 specified.
10885
10886 -ftree-loop-vectorize
10887 Perform loop vectorization on trees. This flag is enabled by
10888 default at -O2 and by -ftree-vectorize, -fprofile-use, and
10889 -fauto-profile.
10890
10891 -ftree-slp-vectorize
10892 Perform basic block vectorization on trees. This flag is enabled by
10893 default at -O2 and by -ftree-vectorize, -fprofile-use, and
10894 -fauto-profile.
10895
10896 -ftrivial-auto-var-init=choice
10897 Initialize automatic variables with either a pattern or with zeroes
10898 to increase the security and predictability of a program by
10899 preventing uninitialized memory disclosure and use. GCC still
10900 considers an automatic variable that doesn't have an explicit
10901 initializer as uninitialized, -Wuninitialized and
10902 -Wanalyzer-use-of-uninitialized-value will still report warning
10903 messages on such automatic variables and the compiler will perform
10904 optimization as if the variable were uninitialized. With this
10905 option, GCC will also initialize any padding of automatic variables
10906 that have structure or union types to zeroes. However, the current
10907 implementation cannot initialize automatic variables that are
10908 declared between the controlling expression and the first case of a
10909 "switch" statement. Using -Wtrivial-auto-var-init to report all
10910 such cases.
10911
10912 The three values of choice are:
10913
10914 * uninitialized doesn't initialize any automatic variables. This
10915 is C and C++'s default.
10916
10917 * pattern Initialize automatic variables with values which will
10918 likely transform logic bugs into crashes down the line, are
10919 easily recognized in a crash dump and without being values that
10920 programmers can rely on for useful program semantics. The
10921 current value is byte-repeatable pattern with byte "0xFE". The
10922 values used for pattern initialization might be changed in the
10923 future.
10924
10925 * zero Initialize automatic variables with zeroes.
10926
10927 The default is uninitialized.
10928
10929 You can control this behavior for a specific variable by using the
10930 variable attribute "uninitialized".
10931
10932 -fvect-cost-model=model
10933 Alter the cost model used for vectorization. The model argument
10934 should be one of unlimited, dynamic, cheap or very-cheap. With the
10935 unlimited model the vectorized code-path is assumed to be
10936 profitable while with the dynamic model a runtime check guards the
10937 vectorized code-path to enable it only for iteration counts that
10938 will likely execute faster than when executing the original scalar
10939 loop. The cheap model disables vectorization of loops where doing
10940 so would be cost prohibitive for example due to required runtime
10941 checks for data dependence or alignment but otherwise is equal to
10942 the dynamic model. The very-cheap model only allows vectorization
10943 if the vector code would entirely replace the scalar code that is
10944 being vectorized. For example, if each iteration of a vectorized
10945 loop would only be able to handle exactly four iterations of the
10946 scalar loop, the very-cheap model would only allow vectorization if
10947 the scalar iteration count is known to be a multiple of four.
10948
10949 The default cost model depends on other optimization flags and is
10950 either dynamic or cheap.
10951
10952 -fsimd-cost-model=model
10953 Alter the cost model used for vectorization of loops marked with
10954 the OpenMP simd directive. The model argument should be one of
10955 unlimited, dynamic, cheap. All values of model have the same
10956 meaning as described in -fvect-cost-model and by default a cost
10957 model defined with -fvect-cost-model is used.
10958
10959 -ftree-vrp
10960 Perform Value Range Propagation on trees. This is similar to the
10961 constant propagation pass, but instead of values, ranges of values
10962 are propagated. This allows the optimizers to remove unnecessary
10963 range checks like array bound checks and null pointer checks. This
10964 is enabled by default at -O2 and higher. Null pointer check
10965 elimination is only done if -fdelete-null-pointer-checks is
10966 enabled.
10967
10968 -fsplit-paths
10969 Split paths leading to loop backedges. This can improve dead code
10970 elimination and common subexpression elimination. This is enabled
10971 by default at -O3 and above.
10972
10973 -fsplit-ivs-in-unroller
10974 Enables expression of values of induction variables in later
10975 iterations of the unrolled loop using the value in the first
10976 iteration. This breaks long dependency chains, thus improving
10977 efficiency of the scheduling passes.
10978
10979 A combination of -fweb and CSE is often sufficient to obtain the
10980 same effect. However, that is not reliable in cases where the loop
10981 body is more complicated than a single basic block. It also does
10982 not work at all on some architectures due to restrictions in the
10983 CSE pass.
10984
10985 This optimization is enabled by default.
10986
10987 -fvariable-expansion-in-unroller
10988 With this option, the compiler creates multiple copies of some
10989 local variables when unrolling a loop, which can result in superior
10990 code.
10991
10992 This optimization is enabled by default for PowerPC targets, but
10993 disabled by default otherwise.
10994
10995 -fpartial-inlining
10996 Inline parts of functions. This option has any effect only when
10997 inlining itself is turned on by the -finline-functions or
10998 -finline-small-functions options.
10999
11000 Enabled at levels -O2, -O3, -Os.
11001
11002 -fpredictive-commoning
11003 Perform predictive commoning optimization, i.e., reusing
11004 computations (especially memory loads and stores) performed in
11005 previous iterations of loops.
11006
11007 This option is enabled at level -O3. It is also enabled by
11008 -fprofile-use and -fauto-profile.
11009
11010 -fprefetch-loop-arrays
11011 If supported by the target machine, generate instructions to
11012 prefetch memory to improve the performance of loops that access
11013 large arrays.
11014
11015 This option may generate better or worse code; results are highly
11016 dependent on the structure of loops within the source code.
11017
11018 Disabled at level -Os.
11019
11020 -fno-printf-return-value
11021 Do not substitute constants for known return value of formatted
11022 output functions such as "sprintf", "snprintf", "vsprintf", and
11023 "vsnprintf" (but not "printf" of "fprintf"). This transformation
11024 allows GCC to optimize or even eliminate branches based on the
11025 known return value of these functions called with arguments that
11026 are either constant, or whose values are known to be in a range
11027 that makes determining the exact return value possible. For
11028 example, when -fprintf-return-value is in effect, both the branch
11029 and the body of the "if" statement (but not the call to "snprint")
11030 can be optimized away when "i" is a 32-bit or smaller integer
11031 because the return value is guaranteed to be at most 8.
11032
11033 char buf[9];
11034 if (snprintf (buf, "%08x", i) >= sizeof buf)
11035 ...
11036
11037 The -fprintf-return-value option relies on other optimizations and
11038 yields best results with -O2 and above. It works in tandem with
11039 the -Wformat-overflow and -Wformat-truncation options. The
11040 -fprintf-return-value option is enabled by default.
11041
11042 -fno-peephole
11043 -fno-peephole2
11044 Disable any machine-specific peephole optimizations. The
11045 difference between -fno-peephole and -fno-peephole2 is in how they
11046 are implemented in the compiler; some targets use one, some use the
11047 other, a few use both.
11048
11049 -fpeephole is enabled by default. -fpeephole2 enabled at levels
11050 -O2, -O3, -Os.
11051
11052 -fno-guess-branch-probability
11053 Do not guess branch probabilities using heuristics.
11054
11055 GCC uses heuristics to guess branch probabilities if they are not
11056 provided by profiling feedback (-fprofile-arcs). These heuristics
11057 are based on the control flow graph. If some branch probabilities
11058 are specified by "__builtin_expect", then the heuristics are used
11059 to guess branch probabilities for the rest of the control flow
11060 graph, taking the "__builtin_expect" info into account. The
11061 interactions between the heuristics and "__builtin_expect" can be
11062 complex, and in some cases, it may be useful to disable the
11063 heuristics so that the effects of "__builtin_expect" are easier to
11064 understand.
11065
11066 It is also possible to specify expected probability of the
11067 expression with "__builtin_expect_with_probability" built-in
11068 function.
11069
11070 The default is -fguess-branch-probability at levels -O, -O2, -O3,
11071 -Os.
11072
11073 -freorder-blocks
11074 Reorder basic blocks in the compiled function in order to reduce
11075 number of taken branches and improve code locality.
11076
11077 Enabled at levels -O1, -O2, -O3, -Os.
11078
11079 -freorder-blocks-algorithm=algorithm
11080 Use the specified algorithm for basic block reordering. The
11081 algorithm argument can be simple, which does not increase code size
11082 (except sometimes due to secondary effects like alignment), or stc,
11083 the "software trace cache" algorithm, which tries to put all often
11084 executed code together, minimizing the number of branches executed
11085 by making extra copies of code.
11086
11087 The default is simple at levels -O1, -Os, and stc at levels -O2,
11088 -O3.
11089
11090 -freorder-blocks-and-partition
11091 In addition to reordering basic blocks in the compiled function, in
11092 order to reduce number of taken branches, partitions hot and cold
11093 basic blocks into separate sections of the assembly and .o files,
11094 to improve paging and cache locality performance.
11095
11096 This optimization is automatically turned off in the presence of
11097 exception handling or unwind tables (on targets using
11098 setjump/longjump or target specific scheme), for linkonce sections,
11099 for functions with a user-defined section attribute and on any
11100 architecture that does not support named sections. When
11101 -fsplit-stack is used this option is not enabled by default (to
11102 avoid linker errors), but may be enabled explicitly (if using a
11103 working linker).
11104
11105 Enabled for x86 at levels -O2, -O3, -Os.
11106
11107 -freorder-functions
11108 Reorder functions in the object file in order to improve code
11109 locality. This is implemented by using special subsections
11110 ".text.hot" for most frequently executed functions and
11111 ".text.unlikely" for unlikely executed functions. Reordering is
11112 done by the linker so object file format must support named
11113 sections and linker must place them in a reasonable way.
11114
11115 This option isn't effective unless you either provide profile
11116 feedback (see -fprofile-arcs for details) or manually annotate
11117 functions with "hot" or "cold" attributes.
11118
11119 Enabled at levels -O2, -O3, -Os.
11120
11121 -fstrict-aliasing
11122 Allow the compiler to assume the strictest aliasing rules
11123 applicable to the language being compiled. For C (and C++), this
11124 activates optimizations based on the type of expressions. In
11125 particular, an object of one type is assumed never to reside at the
11126 same address as an object of a different type, unless the types are
11127 almost the same. For example, an "unsigned int" can alias an
11128 "int", but not a "void*" or a "double". A character type may alias
11129 any other type.
11130
11131 Pay special attention to code like this:
11132
11133 union a_union {
11134 int i;
11135 double d;
11136 };
11137
11138 int f() {
11139 union a_union t;
11140 t.d = 3.0;
11141 return t.i;
11142 }
11143
11144 The practice of reading from a different union member than the one
11145 most recently written to (called "type-punning") is common. Even
11146 with -fstrict-aliasing, type-punning is allowed, provided the
11147 memory is accessed through the union type. So, the code above
11148 works as expected. However, this code might not:
11149
11150 int f() {
11151 union a_union t;
11152 int* ip;
11153 t.d = 3.0;
11154 ip = &t.i;
11155 return *ip;
11156 }
11157
11158 Similarly, access by taking the address, casting the resulting
11159 pointer and dereferencing the result has undefined behavior, even
11160 if the cast uses a union type, e.g.:
11161
11162 int f() {
11163 double d = 3.0;
11164 return ((union a_union *) &d)->i;
11165 }
11166
11167 The -fstrict-aliasing option is enabled at levels -O2, -O3, -Os.
11168
11169 -fipa-strict-aliasing
11170 Controls whether rules of -fstrict-aliasing are applied across
11171 function boundaries. Note that if multiple functions gets inlined
11172 into a single function the memory accesses are no longer considered
11173 to be crossing a function boundary.
11174
11175 The -fipa-strict-aliasing option is enabled by default and is
11176 effective only in combination with -fstrict-aliasing.
11177
11178 -falign-functions
11179 -falign-functions=n
11180 -falign-functions=n:m
11181 -falign-functions=n:m:n2
11182 -falign-functions=n:m:n2:m2
11183 Align the start of functions to the next power-of-two greater than
11184 or equal to n, skipping up to m-1 bytes. This ensures that at
11185 least the first m bytes of the function can be fetched by the CPU
11186 without crossing an n-byte alignment boundary.
11187
11188 If m is not specified, it defaults to n.
11189
11190 Examples: -falign-functions=32 aligns functions to the next 32-byte
11191 boundary, -falign-functions=24 aligns to the next 32-byte boundary
11192 only if this can be done by skipping 23 bytes or less,
11193 -falign-functions=32:7 aligns to the next 32-byte boundary only if
11194 this can be done by skipping 6 bytes or less.
11195
11196 The second pair of n2:m2 values allows you to specify a secondary
11197 alignment: -falign-functions=64:7:32:3 aligns to the next 64-byte
11198 boundary if this can be done by skipping 6 bytes or less, otherwise
11199 aligns to the next 32-byte boundary if this can be done by skipping
11200 2 bytes or less. If m2 is not specified, it defaults to n2.
11201
11202 Some assemblers only support this flag when n is a power of two; in
11203 that case, it is rounded up.
11204
11205 -fno-align-functions and -falign-functions=1 are equivalent and
11206 mean that functions are not aligned.
11207
11208 If n is not specified or is zero, use a machine-dependent default.
11209 The maximum allowed n option value is 65536.
11210
11211 Enabled at levels -O2, -O3.
11212
11213 -flimit-function-alignment
11214 If this option is enabled, the compiler tries to avoid
11215 unnecessarily overaligning functions. It attempts to instruct the
11216 assembler to align by the amount specified by -falign-functions,
11217 but not to skip more bytes than the size of the function.
11218
11219 -falign-labels
11220 -falign-labels=n
11221 -falign-labels=n:m
11222 -falign-labels=n:m:n2
11223 -falign-labels=n:m:n2:m2
11224 Align all branch targets to a power-of-two boundary.
11225
11226 Parameters of this option are analogous to the -falign-functions
11227 option. -fno-align-labels and -falign-labels=1 are equivalent and
11228 mean that labels are not aligned.
11229
11230 If -falign-loops or -falign-jumps are applicable and are greater
11231 than this value, then their values are used instead.
11232
11233 If n is not specified or is zero, use a machine-dependent default
11234 which is very likely to be 1, meaning no alignment. The maximum
11235 allowed n option value is 65536.
11236
11237 Enabled at levels -O2, -O3.
11238
11239 -falign-loops
11240 -falign-loops=n
11241 -falign-loops=n:m
11242 -falign-loops=n:m:n2
11243 -falign-loops=n:m:n2:m2
11244 Align loops to a power-of-two boundary. If the loops are executed
11245 many times, this makes up for any execution of the dummy padding
11246 instructions.
11247
11248 If -falign-labels is greater than this value, then its value is
11249 used instead.
11250
11251 Parameters of this option are analogous to the -falign-functions
11252 option. -fno-align-loops and -falign-loops=1 are equivalent and
11253 mean that loops are not aligned. The maximum allowed n option
11254 value is 65536.
11255
11256 If n is not specified or is zero, use a machine-dependent default.
11257
11258 Enabled at levels -O2, -O3.
11259
11260 -falign-jumps
11261 -falign-jumps=n
11262 -falign-jumps=n:m
11263 -falign-jumps=n:m:n2
11264 -falign-jumps=n:m:n2:m2
11265 Align branch targets to a power-of-two boundary, for branch targets
11266 where the targets can only be reached by jumping. In this case, no
11267 dummy operations need be executed.
11268
11269 If -falign-labels is greater than this value, then its value is
11270 used instead.
11271
11272 Parameters of this option are analogous to the -falign-functions
11273 option. -fno-align-jumps and -falign-jumps=1 are equivalent and
11274 mean that loops are not aligned.
11275
11276 If n is not specified or is zero, use a machine-dependent default.
11277 The maximum allowed n option value is 65536.
11278
11279 Enabled at levels -O2, -O3.
11280
11281 -fno-allocation-dce
11282 Do not remove unused C++ allocations in dead code elimination.
11283
11284 -fallow-store-data-races
11285 Allow the compiler to perform optimizations that may introduce new
11286 data races on stores, without proving that the variable cannot be
11287 concurrently accessed by other threads. Does not affect
11288 optimization of local data. It is safe to use this option if it is
11289 known that global data will not be accessed by multiple threads.
11290
11291 Examples of optimizations enabled by -fallow-store-data-races
11292 include hoisting or if-conversions that may cause a value that was
11293 already in memory to be re-written with that same value. Such re-
11294 writing is safe in a single threaded context but may be unsafe in a
11295 multi-threaded context. Note that on some processors, if-
11296 conversions may be required in order to enable vectorization.
11297
11298 Enabled at level -Ofast.
11299
11300 -funit-at-a-time
11301 This option is left for compatibility reasons. -funit-at-a-time has
11302 no effect, while -fno-unit-at-a-time implies -fno-toplevel-reorder
11303 and -fno-section-anchors.
11304
11305 Enabled by default.
11306
11307 -fno-toplevel-reorder
11308 Do not reorder top-level functions, variables, and "asm"
11309 statements. Output them in the same order that they appear in the
11310 input file. When this option is used, unreferenced static
11311 variables are not removed. This option is intended to support
11312 existing code that relies on a particular ordering. For new code,
11313 it is better to use attributes when possible.
11314
11315 -ftoplevel-reorder is the default at -O1 and higher, and also at
11316 -O0 if -fsection-anchors is explicitly requested. Additionally
11317 -fno-toplevel-reorder implies -fno-section-anchors.
11318
11319 -funreachable-traps
11320 With this option, the compiler turns calls to
11321 "__builtin_unreachable" into traps, instead of using them for
11322 optimization. This also affects any such calls implicitly
11323 generated by the compiler.
11324
11325 This option has the same effect as -fsanitize=unreachable
11326 -fsanitize-trap=unreachable, but does not affect the values of
11327 those options. If -fsanitize=unreachable is enabled, that option
11328 takes priority over this one.
11329
11330 This option is enabled by default at -O0 and -Og.
11331
11332 -fweb
11333 Constructs webs as commonly used for register allocation purposes
11334 and assign each web individual pseudo register. This allows the
11335 register allocation pass to operate on pseudos directly, but also
11336 strengthens several other optimization passes, such as CSE, loop
11337 optimizer and trivial dead code remover. It can, however, make
11338 debugging impossible, since variables no longer stay in a "home
11339 register".
11340
11341 Enabled by default with -funroll-loops.
11342
11343 -fwhole-program
11344 Assume that the current compilation unit represents the whole
11345 program being compiled. All public functions and variables with
11346 the exception of "main" and those merged by attribute
11347 "externally_visible" become static functions and in effect are
11348 optimized more aggressively by interprocedural optimizers.
11349
11350 With -flto this option has a limited use. In most cases the
11351 precise list of symbols used or exported from the binary is known
11352 the resolution info passed to the link-time optimizer by the linker
11353 plugin. It is still useful if no linker plugin is used or during
11354 incremental link step when final code is produced (with -flto
11355 -flinker-output=nolto-rel).
11356
11357 -flto[=n]
11358 This option runs the standard link-time optimizer. When invoked
11359 with source code, it generates GIMPLE (one of GCC's internal
11360 representations) and writes it to special ELF sections in the
11361 object file. When the object files are linked together, all the
11362 function bodies are read from these ELF sections and instantiated
11363 as if they had been part of the same translation unit.
11364
11365 To use the link-time optimizer, -flto and optimization options
11366 should be specified at compile time and during the final link. It
11367 is recommended that you compile all the files participating in the
11368 same link with the same options and also specify those options at
11369 link time. For example:
11370
11371 gcc -c -O2 -flto foo.c
11372 gcc -c -O2 -flto bar.c
11373 gcc -o myprog -flto -O2 foo.o bar.o
11374
11375 The first two invocations to GCC save a bytecode representation of
11376 GIMPLE into special ELF sections inside foo.o and bar.o. The final
11377 invocation reads the GIMPLE bytecode from foo.o and bar.o, merges
11378 the two files into a single internal image, and compiles the result
11379 as usual. Since both foo.o and bar.o are merged into a single
11380 image, this causes all the interprocedural analyses and
11381 optimizations in GCC to work across the two files as if they were a
11382 single one. This means, for example, that the inliner is able to
11383 inline functions in bar.o into functions in foo.o and vice-versa.
11384
11385 Another (simpler) way to enable link-time optimization is:
11386
11387 gcc -o myprog -flto -O2 foo.c bar.c
11388
11389 The above generates bytecode for foo.c and bar.c, merges them
11390 together into a single GIMPLE representation and optimizes them as
11391 usual to produce myprog.
11392
11393 The important thing to keep in mind is that to enable link-time
11394 optimizations you need to use the GCC driver to perform the link
11395 step. GCC automatically performs link-time optimization if any of
11396 the objects involved were compiled with the -flto command-line
11397 option. You can always override the automatic decision to do link-
11398 time optimization by passing -fno-lto to the link command.
11399
11400 To make whole program optimization effective, it is necessary to
11401 make certain whole program assumptions. The compiler needs to know
11402 what functions and variables can be accessed by libraries and
11403 runtime outside of the link-time optimized unit. When supported by
11404 the linker, the linker plugin (see -fuse-linker-plugin) passes
11405 information to the compiler about used and externally visible
11406 symbols. When the linker plugin is not available, -fwhole-program
11407 should be used to allow the compiler to make these assumptions,
11408 which leads to more aggressive optimization decisions.
11409
11410 When a file is compiled with -flto without -fuse-linker-plugin, the
11411 generated object file is larger than a regular object file because
11412 it contains GIMPLE bytecodes and the usual final code (see
11413 -ffat-lto-objects). This means that object files with LTO
11414 information can be linked as normal object files; if -fno-lto is
11415 passed to the linker, no interprocedural optimizations are applied.
11416 Note that when -fno-fat-lto-objects is enabled the compile stage is
11417 faster but you cannot perform a regular, non-LTO link on them.
11418
11419 When producing the final binary, GCC only applies link-time
11420 optimizations to those files that contain bytecode. Therefore, you
11421 can mix and match object files and libraries with GIMPLE bytecodes
11422 and final object code. GCC automatically selects which files to
11423 optimize in LTO mode and which files to link without further
11424 processing.
11425
11426 Generally, options specified at link time override those specified
11427 at compile time, although in some cases GCC attempts to infer link-
11428 time options from the settings used to compile the input files.
11429
11430 If you do not specify an optimization level option -O at link time,
11431 then GCC uses the highest optimization level used when compiling
11432 the object files. Note that it is generally ineffective to specify
11433 an optimization level option only at link time and not at compile
11434 time, for two reasons. First, compiling without optimization
11435 suppresses compiler passes that gather information needed for
11436 effective optimization at link time. Second, some early
11437 optimization passes can be performed only at compile time and not
11438 at link time.
11439
11440 There are some code generation flags preserved by GCC when
11441 generating bytecodes, as they need to be used during the final
11442 link. Currently, the following options and their settings are
11443 taken from the first object file that explicitly specifies them:
11444 -fcommon, -fexceptions, -fnon-call-exceptions, -fgnu-tm and all the
11445 -m target flags.
11446
11447 The following options -fPIC, -fpic, -fpie and -fPIE are combined
11448 based on the following scheme:
11449
11450 B<-fPIC> + B<-fpic> = B<-fpic>
11451 B<-fPIC> + B<-fno-pic> = B<-fno-pic>
11452 B<-fpic/-fPIC> + (no option) = (no option)
11453 B<-fPIC> + B<-fPIE> = B<-fPIE>
11454 B<-fpic> + B<-fPIE> = B<-fpie>
11455 B<-fPIC/-fpic> + B<-fpie> = B<-fpie>
11456
11457 Certain ABI-changing flags are required to match in all compilation
11458 units, and trying to override this at link time with a conflicting
11459 value is ignored. This includes options such as
11460 -freg-struct-return and -fpcc-struct-return.
11461
11462 Other options such as -ffp-contract, -fno-strict-overflow, -fwrapv,
11463 -fno-trapv or -fno-strict-aliasing are passed through to the link
11464 stage and merged conservatively for conflicting translation units.
11465 Specifically -fno-strict-overflow, -fwrapv and -fno-trapv take
11466 precedence; and for example -ffp-contract=off takes precedence over
11467 -ffp-contract=fast. You can override them at link time.
11468
11469 Diagnostic options such as -Wstringop-overflow are passed through
11470 to the link stage and their setting matches that of the compile-
11471 step at function granularity. Note that this matters only for
11472 diagnostics emitted during optimization. Note that code transforms
11473 such as inlining can lead to warnings being enabled or disabled for
11474 regions if code not consistent with the setting at compile time.
11475
11476 When you need to pass options to the assembler via -Wa or
11477 -Xassembler make sure to either compile such translation units with
11478 -fno-lto or consistently use the same assembler options on all
11479 translation units. You can alternatively also specify assembler
11480 options at LTO link time.
11481
11482 To enable debug info generation you need to supply -g at compile
11483 time. If any of the input files at link time were built with debug
11484 info generation enabled the link will enable debug info generation
11485 as well. Any elaborate debug info settings like the dwarf level
11486 -gdwarf-5 need to be explicitly repeated at the linker command line
11487 and mixing different settings in different translation units is
11488 discouraged.
11489
11490 If LTO encounters objects with C linkage declared with incompatible
11491 types in separate translation units to be linked together
11492 (undefined behavior according to ISO C99 6.2.7), a non-fatal
11493 diagnostic may be issued. The behavior is still undefined at run
11494 time. Similar diagnostics may be raised for other languages.
11495
11496 Another feature of LTO is that it is possible to apply
11497 interprocedural optimizations on files written in different
11498 languages:
11499
11500 gcc -c -flto foo.c
11501 g++ -c -flto bar.cc
11502 gfortran -c -flto baz.f90
11503 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
11504
11505 Notice that the final link is done with g++ to get the C++ runtime
11506 libraries and -lgfortran is added to get the Fortran runtime
11507 libraries. In general, when mixing languages in LTO mode, you
11508 should use the same link command options as when mixing languages
11509 in a regular (non-LTO) compilation.
11510
11511 If object files containing GIMPLE bytecode are stored in a library
11512 archive, say libfoo.a, it is possible to extract and use them in an
11513 LTO link if you are using a linker with plugin support. To create
11514 static libraries suitable for LTO, use gcc-ar and gcc-ranlib
11515 instead of ar and ranlib; to show the symbols of object files with
11516 GIMPLE bytecode, use gcc-nm. Those commands require that ar,
11517 ranlib and nm have been compiled with plugin support. At link
11518 time, use the flag -fuse-linker-plugin to ensure that the library
11519 participates in the LTO optimization process:
11520
11521 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
11522
11523 With the linker plugin enabled, the linker extracts the needed
11524 GIMPLE files from libfoo.a and passes them on to the running GCC to
11525 make them part of the aggregated GIMPLE image to be optimized.
11526
11527 If you are not using a linker with plugin support and/or do not
11528 enable the linker plugin, then the objects inside libfoo.a are
11529 extracted and linked as usual, but they do not participate in the
11530 LTO optimization process. In order to make a static library
11531 suitable for both LTO optimization and usual linkage, compile its
11532 object files with -flto -ffat-lto-objects.
11533
11534 Link-time optimizations do not require the presence of the whole
11535 program to operate. If the program does not require any symbols to
11536 be exported, it is possible to combine -flto and -fwhole-program to
11537 allow the interprocedural optimizers to use more aggressive
11538 assumptions which may lead to improved optimization opportunities.
11539 Use of -fwhole-program is not needed when linker plugin is active
11540 (see -fuse-linker-plugin).
11541
11542 The current implementation of LTO makes no attempt to generate
11543 bytecode that is portable between different types of hosts. The
11544 bytecode files are versioned and there is a strict version check,
11545 so bytecode files generated in one version of GCC do not work with
11546 an older or newer version of GCC.
11547
11548 Link-time optimization does not work well with generation of
11549 debugging information on systems other than those using a
11550 combination of ELF and DWARF.
11551
11552 If you specify the optional n, the optimization and code generation
11553 done at link time is executed in parallel using n parallel jobs by
11554 utilizing an installed make program. The environment variable MAKE
11555 may be used to override the program used.
11556
11557 You can also specify -flto=jobserver to use GNU make's job server
11558 mode to determine the number of parallel jobs. This is useful when
11559 the Makefile calling GCC is already executing in parallel. You
11560 must prepend a + to the command recipe in the parent Makefile for
11561 this to work. This option likely only works if MAKE is GNU make.
11562 Even without the option value, GCC tries to automatically detect a
11563 running GNU make's job server.
11564
11565 Use -flto=auto to use GNU make's job server, if available, or
11566 otherwise fall back to autodetection of the number of CPU threads
11567 present in your system.
11568
11569 -flto-partition=alg
11570 Specify the partitioning algorithm used by the link-time optimizer.
11571 The value is either 1to1 to specify a partitioning mirroring the
11572 original source files or balanced to specify partitioning into
11573 equally sized chunks (whenever possible) or max to create new
11574 partition for every symbol where possible. Specifying none as an
11575 algorithm disables partitioning and streaming completely. The
11576 default value is balanced. While 1to1 can be used as an workaround
11577 for various code ordering issues, the max partitioning is intended
11578 for internal testing only. The value one specifies that exactly
11579 one partition should be used while the value none bypasses
11580 partitioning and executes the link-time optimization step directly
11581 from the WPA phase.
11582
11583 -flto-compression-level=n
11584 This option specifies the level of compression used for
11585 intermediate language written to LTO object files, and is only
11586 meaningful in conjunction with LTO mode (-flto). GCC currently
11587 supports two LTO compression algorithms. For zstd, valid values are
11588 0 (no compression) to 19 (maximum compression), while zlib supports
11589 values from 0 to 9. Values outside this range are clamped to
11590 either minimum or maximum of the supported values. If the option
11591 is not given, a default balanced compression setting is used.
11592
11593 -fuse-linker-plugin
11594 Enables the use of a linker plugin during link-time optimization.
11595 This option relies on plugin support in the linker, which is
11596 available in gold or in GNU ld 2.21 or newer.
11597
11598 This option enables the extraction of object files with GIMPLE
11599 bytecode out of library archives. This improves the quality of
11600 optimization by exposing more code to the link-time optimizer.
11601 This information specifies what symbols can be accessed externally
11602 (by non-LTO object or during dynamic linking). Resulting code
11603 quality improvements on binaries (and shared libraries that use
11604 hidden visibility) are similar to -fwhole-program. See -flto for a
11605 description of the effect of this flag and how to use it.
11606
11607 This option is enabled by default when LTO support in GCC is
11608 enabled and GCC was configured for use with a linker supporting
11609 plugins (GNU ld 2.21 or newer or gold).
11610
11611 -ffat-lto-objects
11612 Fat LTO objects are object files that contain both the intermediate
11613 language and the object code. This makes them usable for both LTO
11614 linking and normal linking. This option is effective only when
11615 compiling with -flto and is ignored at link time.
11616
11617 -fno-fat-lto-objects improves compilation time over plain LTO, but
11618 requires the complete toolchain to be aware of LTO. It requires a
11619 linker with linker plugin support for basic functionality.
11620 Additionally, nm, ar and ranlib need to support linker plugins to
11621 allow a full-featured build environment (capable of building static
11622 libraries etc). GCC provides the gcc-ar, gcc-nm, gcc-ranlib
11623 wrappers to pass the right options to these tools. With non fat LTO
11624 makefiles need to be modified to use them.
11625
11626 Note that modern binutils provide plugin auto-load mechanism.
11627 Installing the linker plugin into $libdir/bfd-plugins has the same
11628 effect as usage of the command wrappers (gcc-ar, gcc-nm and gcc-
11629 ranlib).
11630
11631 The default is -fno-fat-lto-objects on targets with linker plugin
11632 support.
11633
11634 -fcompare-elim
11635 After register allocation and post-register allocation instruction
11636 splitting, identify arithmetic instructions that compute processor
11637 flags similar to a comparison operation based on that arithmetic.
11638 If possible, eliminate the explicit comparison operation.
11639
11640 This pass only applies to certain targets that cannot explicitly
11641 represent the comparison operation before register allocation is
11642 complete.
11643
11644 Enabled at levels -O1, -O2, -O3, -Os.
11645
11646 -fcprop-registers
11647 After register allocation and post-register allocation instruction
11648 splitting, perform a copy-propagation pass to try to reduce
11649 scheduling dependencies and occasionally eliminate the copy.
11650
11651 Enabled at levels -O1, -O2, -O3, -Os.
11652
11653 -fprofile-correction
11654 Profiles collected using an instrumented binary for multi-threaded
11655 programs may be inconsistent due to missed counter updates. When
11656 this option is specified, GCC uses heuristics to correct or smooth
11657 out such inconsistencies. By default, GCC emits an error message
11658 when an inconsistent profile is detected.
11659
11660 This option is enabled by -fauto-profile.
11661
11662 -fprofile-partial-training
11663 With "-fprofile-use" all portions of programs not executed during
11664 train run are optimized agressively for size rather than speed. In
11665 some cases it is not practical to train all possible hot paths in
11666 the program. (For example, program may contain functions specific
11667 for a given hardware and trianing may not cover all hardware
11668 configurations program is run on.) With
11669 "-fprofile-partial-training" profile feedback will be ignored for
11670 all functions not executed during the train run leading them to be
11671 optimized as if they were compiled without profile feedback. This
11672 leads to better performance when train run is not representative
11673 but also leads to significantly bigger code.
11674
11675 -fprofile-use
11676 -fprofile-use=path
11677 Enable profile feedback-directed optimizations, and the following
11678 optimizations, many of which are generally profitable only with
11679 profile feedback available:
11680
11681 -fbranch-probabilities -fprofile-values -funroll-loops
11682 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
11683 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
11684 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
11685 -ftree-slp-vectorize -fvect-cost-model=dynamic
11686 -ftree-loop-distribute-patterns -fprofile-reorder-functions
11687
11688 Before you can use this option, you must first generate profiling
11689 information.
11690
11691 By default, GCC emits an error message if the feedback profiles do
11692 not match the source code. This error can be turned into a warning
11693 by using -Wno-error=coverage-mismatch. Note this may result in
11694 poorly optimized code. Additionally, by default, GCC also emits a
11695 warning message if the feedback profiles do not exist (see
11696 -Wmissing-profile).
11697
11698 If path is specified, GCC looks at the path to find the profile
11699 feedback data files. See -fprofile-dir.
11700
11701 -fauto-profile
11702 -fauto-profile=path
11703 Enable sampling-based feedback-directed optimizations, and the
11704 following optimizations, many of which are generally profitable
11705 only with profile feedback available:
11706
11707 -fbranch-probabilities -fprofile-values -funroll-loops
11708 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
11709 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
11710 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
11711 -ftree-slp-vectorize -fvect-cost-model=dynamic
11712 -ftree-loop-distribute-patterns -fprofile-correction
11713
11714 path is the name of a file containing AutoFDO profile information.
11715 If omitted, it defaults to fbdata.afdo in the current directory.
11716
11717 Producing an AutoFDO profile data file requires running your
11718 program with the perf utility on a supported GNU/Linux target
11719 system. For more information, see <https://perf.wiki.kernel.org/>.
11720
11721 E.g.
11722
11723 perf record -e br_inst_retired:near_taken -b -o perf.data \
11724 -- your_program
11725
11726 Then use the create_gcov tool to convert the raw profile data to a
11727 format that can be used by GCC. You must also supply the
11728 unstripped binary for your program to this tool. See
11729 <https://github.com/google/autofdo>.
11730
11731 E.g.
11732
11733 create_gcov --binary=your_program.unstripped --profile=perf.data \
11734 --gcov=profile.afdo
11735
11736 The following options control compiler behavior regarding floating-
11737 point arithmetic. These options trade off between speed and
11738 correctness. All must be specifically enabled.
11739
11740 -ffloat-store
11741 Do not store floating-point variables in registers, and inhibit
11742 other options that might change whether a floating-point value is
11743 taken from a register or memory.
11744
11745 This option prevents undesirable excess precision on machines such
11746 as the 68000 where the floating registers (of the 68881) keep more
11747 precision than a "double" is supposed to have. Similarly for the
11748 x86 architecture. For most programs, the excess precision does
11749 only good, but a few programs rely on the precise definition of
11750 IEEE floating point. Use -ffloat-store for such programs, after
11751 modifying them to store all pertinent intermediate computations
11752 into variables.
11753
11754 -fexcess-precision=style
11755 This option allows further control over excess precision on
11756 machines where floating-point operations occur in a format with
11757 more precision or range than the IEEE standard and interchange
11758 floating-point types. By default, -fexcess-precision=fast is in
11759 effect; this means that operations may be carried out in a wider
11760 precision than the types specified in the source if that would
11761 result in faster code, and it is unpredictable when rounding to the
11762 types specified in the source code takes place. When compiling C
11763 or C++, if -fexcess-precision=standard is specified then excess
11764 precision follows the rules specified in ISO C99 or C++; in
11765 particular, both casts and assignments cause values to be rounded
11766 to their semantic types (whereas -ffloat-store only affects
11767 assignments). This option is enabled by default for C or C++ if a
11768 strict conformance option such as -std=c99 or -std=c++17 is used.
11769 -ffast-math enables -fexcess-precision=fast by default regardless
11770 of whether a strict conformance option is used.
11771
11772 -fexcess-precision=standard is not implemented for languages other
11773 than C or C++. On the x86, it has no effect if -mfpmath=sse or
11774 -mfpmath=sse+387 is specified; in the former case, IEEE semantics
11775 apply without excess precision, and in the latter, rounding is
11776 unpredictable.
11777
11778 -ffast-math
11779 Sets the options -fno-math-errno, -funsafe-math-optimizations,
11780 -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans,
11781 -fcx-limited-range and -fexcess-precision=fast.
11782
11783 This option causes the preprocessor macro "__FAST_MATH__" to be
11784 defined.
11785
11786 This option is not turned on by any -O option besides -Ofast since
11787 it can result in incorrect output for programs that depend on an
11788 exact implementation of IEEE or ISO rules/specifications for math
11789 functions. It may, however, yield faster code for programs that do
11790 not require the guarantees of these specifications.
11791
11792 -fno-math-errno
11793 Do not set "errno" after calling math functions that are executed
11794 with a single instruction, e.g., "sqrt". A program that relies on
11795 IEEE exceptions for math error handling may want to use this flag
11796 for speed while maintaining IEEE arithmetic compatibility.
11797
11798 This option is not turned on by any -O option since it can result
11799 in incorrect output for programs that depend on an exact
11800 implementation of IEEE or ISO rules/specifications for math
11801 functions. It may, however, yield faster code for programs that do
11802 not require the guarantees of these specifications.
11803
11804 The default is -fmath-errno.
11805
11806 On Darwin systems, the math library never sets "errno". There is
11807 therefore no reason for the compiler to consider the possibility
11808 that it might, and -fno-math-errno is the default.
11809
11810 -funsafe-math-optimizations
11811 Allow optimizations for floating-point arithmetic that (a) assume
11812 that arguments and results are valid and (b) may violate IEEE or
11813 ANSI standards. When used at link time, it may include libraries
11814 or startup files that change the default FPU control word or other
11815 similar optimizations.
11816
11817 This option is not turned on by any -O option since it can result
11818 in incorrect output for programs that depend on an exact
11819 implementation of IEEE or ISO rules/specifications for math
11820 functions. It may, however, yield faster code for programs that do
11821 not require the guarantees of these specifications. Enables
11822 -fno-signed-zeros, -fno-trapping-math, -fassociative-math and
11823 -freciprocal-math.
11824
11825 The default is -fno-unsafe-math-optimizations.
11826
11827 -fassociative-math
11828 Allow re-association of operands in series of floating-point
11829 operations. This violates the ISO C and C++ language standard by
11830 possibly changing computation result. NOTE: re-ordering may change
11831 the sign of zero as well as ignore NaNs and inhibit or create
11832 underflow or overflow (and thus cannot be used on code that relies
11833 on rounding behavior like "(x + 2**52) - 2**52". May also reorder
11834 floating-point comparisons and thus may not be used when ordered
11835 comparisons are required. This option requires that both
11836 -fno-signed-zeros and -fno-trapping-math be in effect. Moreover,
11837 it doesn't make much sense with -frounding-math. For Fortran the
11838 option is automatically enabled when both -fno-signed-zeros and
11839 -fno-trapping-math are in effect.
11840
11841 The default is -fno-associative-math.
11842
11843 -freciprocal-math
11844 Allow the reciprocal of a value to be used instead of dividing by
11845 the value if this enables optimizations. For example "x / y" can
11846 be replaced with "x * (1/y)", which is useful if "(1/y)" is subject
11847 to common subexpression elimination. Note that this loses
11848 precision and increases the number of flops operating on the value.
11849
11850 The default is -fno-reciprocal-math.
11851
11852 -ffinite-math-only
11853 Allow optimizations for floating-point arithmetic that assume that
11854 arguments and results are not NaNs or +-Infs.
11855
11856 This option is not turned on by any -O option since it can result
11857 in incorrect output for programs that depend on an exact
11858 implementation of IEEE or ISO rules/specifications for math
11859 functions. It may, however, yield faster code for programs that do
11860 not require the guarantees of these specifications.
11861
11862 The default is -fno-finite-math-only.
11863
11864 -fno-signed-zeros
11865 Allow optimizations for floating-point arithmetic that ignore the
11866 signedness of zero. IEEE arithmetic specifies the behavior of
11867 distinct +0.0 and -0.0 values, which then prohibits simplification
11868 of expressions such as x+0.0 or 0.0*x (even with
11869 -ffinite-math-only). This option implies that the sign of a zero
11870 result isn't significant.
11871
11872 The default is -fsigned-zeros.
11873
11874 -fno-trapping-math
11875 Compile code assuming that floating-point operations cannot
11876 generate user-visible traps. These traps include division by zero,
11877 overflow, underflow, inexact result and invalid operation. This
11878 option requires that -fno-signaling-nans be in effect. Setting
11879 this option may allow faster code if one relies on "non-stop" IEEE
11880 arithmetic, for example.
11881
11882 This option should never be turned on by any -O option since it can
11883 result in incorrect output for programs that depend on an exact
11884 implementation of IEEE or ISO rules/specifications for math
11885 functions.
11886
11887 The default is -ftrapping-math.
11888
11889 Future versions of GCC may provide finer control of this setting
11890 using C99's "FENV_ACCESS" pragma. This command-line option will be
11891 used along with -frounding-math to specify the default state for
11892 "FENV_ACCESS".
11893
11894 -frounding-math
11895 Disable transformations and optimizations that assume default
11896 floating-point rounding behavior. This is round-to-zero for all
11897 floating point to integer conversions, and round-to-nearest for all
11898 other arithmetic truncations. This option should be specified for
11899 programs that change the FP rounding mode dynamically, or that may
11900 be executed with a non-default rounding mode. This option disables
11901 constant folding of floating-point expressions at compile time
11902 (which may be affected by rounding mode) and arithmetic
11903 transformations that are unsafe in the presence of sign-dependent
11904 rounding modes.
11905
11906 The default is -fno-rounding-math.
11907
11908 This option is experimental and does not currently guarantee to
11909 disable all GCC optimizations that are affected by rounding mode.
11910 Future versions of GCC may provide finer control of this setting
11911 using C99's "FENV_ACCESS" pragma. This command-line option will be
11912 used along with -ftrapping-math to specify the default state for
11913 "FENV_ACCESS".
11914
11915 -fsignaling-nans
11916 Compile code assuming that IEEE signaling NaNs may generate user-
11917 visible traps during floating-point operations. Setting this
11918 option disables optimizations that may change the number of
11919 exceptions visible with signaling NaNs. This option implies
11920 -ftrapping-math.
11921
11922 This option causes the preprocessor macro "__SUPPORT_SNAN__" to be
11923 defined.
11924
11925 The default is -fno-signaling-nans.
11926
11927 This option is experimental and does not currently guarantee to
11928 disable all GCC optimizations that affect signaling NaN behavior.
11929
11930 -fno-fp-int-builtin-inexact
11931 Do not allow the built-in functions "ceil", "floor", "round" and
11932 "trunc", and their "float" and "long double" variants, to generate
11933 code that raises the "inexact" floating-point exception for
11934 noninteger arguments. ISO C99 and C11 allow these functions to
11935 raise the "inexact" exception, but ISO/IEC TS 18661-1:2014, the C
11936 bindings to IEEE 754-2008, as integrated into ISO C2X, does not
11937 allow these functions to do so.
11938
11939 The default is -ffp-int-builtin-inexact, allowing the exception to
11940 be raised, unless C2X or a later C standard is selected. This
11941 option does nothing unless -ftrapping-math is in effect.
11942
11943 Even if -fno-fp-int-builtin-inexact is used, if the functions
11944 generate a call to a library function then the "inexact" exception
11945 may be raised if the library implementation does not follow TS
11946 18661.
11947
11948 -fsingle-precision-constant
11949 Treat floating-point constants as single precision instead of
11950 implicitly converting them to double-precision constants.
11951
11952 -fcx-limited-range
11953 When enabled, this option states that a range reduction step is not
11954 needed when performing complex division. Also, there is no
11955 checking whether the result of a complex multiplication or division
11956 is "NaN + I*NaN", with an attempt to rescue the situation in that
11957 case. The default is -fno-cx-limited-range, but is enabled by
11958 -ffast-math.
11959
11960 This option controls the default setting of the ISO C99
11961 "CX_LIMITED_RANGE" pragma. Nevertheless, the option applies to all
11962 languages.
11963
11964 -fcx-fortran-rules
11965 Complex multiplication and division follow Fortran rules. Range
11966 reduction is done as part of complex division, but there is no
11967 checking whether the result of a complex multiplication or division
11968 is "NaN + I*NaN", with an attempt to rescue the situation in that
11969 case.
11970
11971 The default is -fno-cx-fortran-rules.
11972
11973 The following options control optimizations that may improve
11974 performance, but are not enabled by any -O options. This section
11975 includes experimental options that may produce broken code.
11976
11977 -fbranch-probabilities
11978 After running a program compiled with -fprofile-arcs, you can
11979 compile it a second time using -fbranch-probabilities, to improve
11980 optimizations based on the number of times each branch was taken.
11981 When a program compiled with -fprofile-arcs exits, it saves arc
11982 execution counts to a file called sourcename.gcda for each source
11983 file. The information in this data file is very dependent on the
11984 structure of the generated code, so you must use the same source
11985 code and the same optimization options for both compilations. See
11986 details about the file naming in -fprofile-arcs.
11987
11988 With -fbranch-probabilities, GCC puts a REG_BR_PROB note on each
11989 JUMP_INSN and CALL_INSN. These can be used to improve
11990 optimization. Currently, they are only used in one place: in
11991 reorg.cc, instead of guessing which path a branch is most likely to
11992 take, the REG_BR_PROB values are used to exactly determine which
11993 path is taken more often.
11994
11995 Enabled by -fprofile-use and -fauto-profile.
11996
11997 -fprofile-values
11998 If combined with -fprofile-arcs, it adds code so that some data
11999 about values of expressions in the program is gathered.
12000
12001 With -fbranch-probabilities, it reads back the data gathered from
12002 profiling values of expressions for usage in optimizations.
12003
12004 Enabled by -fprofile-generate, -fprofile-use, and -fauto-profile.
12005
12006 -fprofile-reorder-functions
12007 Function reordering based on profile instrumentation collects first
12008 time of execution of a function and orders these functions in
12009 ascending order.
12010
12011 Enabled with -fprofile-use.
12012
12013 -fvpt
12014 If combined with -fprofile-arcs, this option instructs the compiler
12015 to add code to gather information about values of expressions.
12016
12017 With -fbranch-probabilities, it reads back the data gathered and
12018 actually performs the optimizations based on them. Currently the
12019 optimizations include specialization of division operations using
12020 the knowledge about the value of the denominator.
12021
12022 Enabled with -fprofile-use and -fauto-profile.
12023
12024 -frename-registers
12025 Attempt to avoid false dependencies in scheduled code by making use
12026 of registers left over after register allocation. This
12027 optimization most benefits processors with lots of registers.
12028 Depending on the debug information format adopted by the target,
12029 however, it can make debugging impossible, since variables no
12030 longer stay in a "home register".
12031
12032 Enabled by default with -funroll-loops.
12033
12034 -fschedule-fusion
12035 Performs a target dependent pass over the instruction stream to
12036 schedule instructions of same type together because target machine
12037 can execute them more efficiently if they are adjacent to each
12038 other in the instruction flow.
12039
12040 Enabled at levels -O2, -O3, -Os.
12041
12042 -ftracer
12043 Perform tail duplication to enlarge superblock size. This
12044 transformation simplifies the control flow of the function allowing
12045 other optimizations to do a better job.
12046
12047 Enabled by -fprofile-use and -fauto-profile.
12048
12049 -funroll-loops
12050 Unroll loops whose number of iterations can be determined at
12051 compile time or upon entry to the loop. -funroll-loops implies
12052 -frerun-cse-after-loop, -fweb and -frename-registers. It also
12053 turns on complete loop peeling (i.e. complete removal of loops with
12054 a small constant number of iterations). This option makes code
12055 larger, and may or may not make it run faster.
12056
12057 Enabled by -fprofile-use and -fauto-profile.
12058
12059 -funroll-all-loops
12060 Unroll all loops, even if their number of iterations is uncertain
12061 when the loop is entered. This usually makes programs run more
12062 slowly. -funroll-all-loops implies the same options as
12063 -funroll-loops.
12064
12065 -fpeel-loops
12066 Peels loops for which there is enough information that they do not
12067 roll much (from profile feedback or static analysis). It also
12068 turns on complete loop peeling (i.e. complete removal of loops with
12069 small constant number of iterations).
12070
12071 Enabled by -O3, -fprofile-use, and -fauto-profile.
12072
12073 -fmove-loop-invariants
12074 Enables the loop invariant motion pass in the RTL loop optimizer.
12075 Enabled at level -O1 and higher, except for -Og.
12076
12077 -fmove-loop-stores
12078 Enables the loop store motion pass in the GIMPLE loop optimizer.
12079 This moves invariant stores to after the end of the loop in
12080 exchange for carrying the stored value in a register across the
12081 iteration. Note for this option to have an effect -ftree-loop-im
12082 has to be enabled as well. Enabled at level -O1 and higher, except
12083 for -Og.
12084
12085 -fsplit-loops
12086 Split a loop into two if it contains a condition that's always true
12087 for one side of the iteration space and false for the other.
12088
12089 Enabled by -fprofile-use and -fauto-profile.
12090
12091 -funswitch-loops
12092 Move branches with loop invariant conditions out of the loop, with
12093 duplicates of the loop on both branches (modified according to
12094 result of the condition).
12095
12096 Enabled by -fprofile-use and -fauto-profile.
12097
12098 -fversion-loops-for-strides
12099 If a loop iterates over an array with a variable stride, create
12100 another version of the loop that assumes the stride is always one.
12101 For example:
12102
12103 for (int i = 0; i < n; ++i)
12104 x[i * stride] = ...;
12105
12106 becomes:
12107
12108 if (stride == 1)
12109 for (int i = 0; i < n; ++i)
12110 x[i] = ...;
12111 else
12112 for (int i = 0; i < n; ++i)
12113 x[i * stride] = ...;
12114
12115 This is particularly useful for assumed-shape arrays in Fortran
12116 where (for example) it allows better vectorization assuming
12117 contiguous accesses. This flag is enabled by default at -O3. It
12118 is also enabled by -fprofile-use and -fauto-profile.
12119
12120 -ffunction-sections
12121 -fdata-sections
12122 Place each function or data item into its own section in the output
12123 file if the target supports arbitrary sections. The name of the
12124 function or the name of the data item determines the section's name
12125 in the output file.
12126
12127 Use these options on systems where the linker can perform
12128 optimizations to improve locality of reference in the instruction
12129 space. Most systems using the ELF object format have linkers with
12130 such optimizations. On AIX, the linker rearranges sections
12131 (CSECTs) based on the call graph. The performance impact varies.
12132
12133 Together with a linker garbage collection (linker --gc-sections
12134 option) these options may lead to smaller statically-linked
12135 executables (after stripping).
12136
12137 On ELF/DWARF systems these options do not degenerate the quality of
12138 the debug information. There could be issues with other object
12139 files/debug info formats.
12140
12141 Only use these options when there are significant benefits from
12142 doing so. When you specify these options, the assembler and linker
12143 create larger object and executable files and are also slower.
12144 These options affect code generation. They prevent optimizations
12145 by the compiler and assembler using relative locations inside a
12146 translation unit since the locations are unknown until link time.
12147 An example of such an optimization is relaxing calls to short call
12148 instructions.
12149
12150 -fstdarg-opt
12151 Optimize the prologue of variadic argument functions with respect
12152 to usage of those arguments.
12153
12154 -fsection-anchors
12155 Try to reduce the number of symbolic address calculations by using
12156 shared "anchor" symbols to address nearby objects. This
12157 transformation can help to reduce the number of GOT entries and GOT
12158 accesses on some targets.
12159
12160 For example, the implementation of the following function "foo":
12161
12162 static int a, b, c;
12163 int foo (void) { return a + b + c; }
12164
12165 usually calculates the addresses of all three variables, but if you
12166 compile it with -fsection-anchors, it accesses the variables from a
12167 common anchor point instead. The effect is similar to the
12168 following pseudocode (which isn't valid C):
12169
12170 int foo (void)
12171 {
12172 register int *xr = &x;
12173 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
12174 }
12175
12176 Not all targets support this option.
12177
12178 -fzero-call-used-regs=choice
12179 Zero call-used registers at function return to increase program
12180 security by either mitigating Return-Oriented Programming (ROP)
12181 attacks or preventing information leakage through registers.
12182
12183 The possible values of choice are the same as for the
12184 "zero_call_used_regs" attribute. The default is skip.
12185
12186 You can control this behavior for a specific function by using the
12187 function attribute "zero_call_used_regs".
12188
12189 --param name=value
12190 In some places, GCC uses various constants to control the amount of
12191 optimization that is done. For example, GCC does not inline
12192 functions that contain more than a certain number of instructions.
12193 You can control some of these constants on the command line using
12194 the --param option.
12195
12196 The names of specific parameters, and the meaning of the values,
12197 are tied to the internals of the compiler, and are subject to
12198 change without notice in future releases.
12199
12200 In order to get the minimal, maximal and default values of a
12201 parameter, use the --help=param -Q options.
12202
12203 In each case, the value is an integer. The following choices of
12204 name are recognized for all targets:
12205
12206 predictable-branch-outcome
12207 When branch is predicted to be taken with probability lower
12208 than this threshold (in percent), then it is considered well
12209 predictable.
12210
12211 max-rtl-if-conversion-insns
12212 RTL if-conversion tries to remove conditional branches around a
12213 block and replace them with conditionally executed
12214 instructions. This parameter gives the maximum number of
12215 instructions in a block which should be considered for if-
12216 conversion. The compiler will also use other heuristics to
12217 decide whether if-conversion is likely to be profitable.
12218
12219 max-rtl-if-conversion-predictable-cost
12220 RTL if-conversion will try to remove conditional branches
12221 around a block and replace them with conditionally executed
12222 instructions. These parameters give the maximum permissible
12223 cost for the sequence that would be generated by if-conversion
12224 depending on whether the branch is statically determined to be
12225 predictable or not. The units for this parameter are the same
12226 as those for the GCC internal seq_cost metric. The compiler
12227 will try to provide a reasonable default for this parameter
12228 using the BRANCH_COST target macro.
12229
12230 max-crossjump-edges
12231 The maximum number of incoming edges to consider for cross-
12232 jumping. The algorithm used by -fcrossjumping is O(N^2) in the
12233 number of edges incoming to each block. Increasing values mean
12234 more aggressive optimization, making the compilation time
12235 increase with probably small improvement in executable size.
12236
12237 min-crossjump-insns
12238 The minimum number of instructions that must be matched at the
12239 end of two blocks before cross-jumping is performed on them.
12240 This value is ignored in the case where all instructions in the
12241 block being cross-jumped from are matched.
12242
12243 max-grow-copy-bb-insns
12244 The maximum code size expansion factor when copying basic
12245 blocks instead of jumping. The expansion is relative to a jump
12246 instruction.
12247
12248 max-goto-duplication-insns
12249 The maximum number of instructions to duplicate to a block that
12250 jumps to a computed goto. To avoid O(N^2) behavior in a number
12251 of passes, GCC factors computed gotos early in the compilation
12252 process, and unfactors them as late as possible. Only computed
12253 jumps at the end of a basic blocks with no more than max-goto-
12254 duplication-insns are unfactored.
12255
12256 max-delay-slot-insn-search
12257 The maximum number of instructions to consider when looking for
12258 an instruction to fill a delay slot. If more than this
12259 arbitrary number of instructions are searched, the time savings
12260 from filling the delay slot are minimal, so stop searching.
12261 Increasing values mean more aggressive optimization, making the
12262 compilation time increase with probably small improvement in
12263 execution time.
12264
12265 max-delay-slot-live-search
12266 When trying to fill delay slots, the maximum number of
12267 instructions to consider when searching for a block with valid
12268 live register information. Increasing this arbitrarily chosen
12269 value means more aggressive optimization, increasing the
12270 compilation time. This parameter should be removed when the
12271 delay slot code is rewritten to maintain the control-flow
12272 graph.
12273
12274 max-gcse-memory
12275 The approximate maximum amount of memory in "kB" that can be
12276 allocated in order to perform the global common subexpression
12277 elimination optimization. If more memory than specified is
12278 required, the optimization is not done.
12279
12280 max-gcse-insertion-ratio
12281 If the ratio of expression insertions to deletions is larger
12282 than this value for any expression, then RTL PRE inserts or
12283 removes the expression and thus leaves partially redundant
12284 computations in the instruction stream.
12285
12286 max-pending-list-length
12287 The maximum number of pending dependencies scheduling allows
12288 before flushing the current state and starting over. Large
12289 functions with few branches or calls can create excessively
12290 large lists which needlessly consume memory and resources.
12291
12292 max-modulo-backtrack-attempts
12293 The maximum number of backtrack attempts the scheduler should
12294 make when modulo scheduling a loop. Larger values can
12295 exponentially increase compilation time.
12296
12297 max-inline-functions-called-once-loop-depth
12298 Maximal loop depth of a call considered by inline heuristics
12299 that tries to inline all functions called once.
12300
12301 max-inline-functions-called-once-insns
12302 Maximal estimated size of functions produced while inlining
12303 functions called once.
12304
12305 max-inline-insns-single
12306 Several parameters control the tree inliner used in GCC. This
12307 number sets the maximum number of instructions (counted in
12308 GCC's internal representation) in a single function that the
12309 tree inliner considers for inlining. This only affects
12310 functions declared inline and methods implemented in a class
12311 declaration (C++).
12312
12313 max-inline-insns-auto
12314 When you use -finline-functions (included in -O3), a lot of
12315 functions that would otherwise not be considered for inlining
12316 by the compiler are investigated. To those functions, a
12317 different (more restrictive) limit compared to functions
12318 declared inline can be applied (--param max-inline-insns-auto).
12319
12320 max-inline-insns-small
12321 This is bound applied to calls which are considered relevant
12322 with -finline-small-functions.
12323
12324 max-inline-insns-size
12325 This is bound applied to calls which are optimized for size.
12326 Small growth may be desirable to anticipate optimization
12327 oppurtunities exposed by inlining.
12328
12329 uninlined-function-insns
12330 Number of instructions accounted by inliner for function
12331 overhead such as function prologue and epilogue.
12332
12333 uninlined-function-time
12334 Extra time accounted by inliner for function overhead such as
12335 time needed to execute function prologue and epilogue.
12336
12337 inline-heuristics-hint-percent
12338 The scale (in percents) applied to inline-insns-single,
12339 inline-insns-single-O2, inline-insns-auto when inline
12340 heuristics hints that inlining is very profitable (will enable
12341 later optimizations).
12342
12343 uninlined-thunk-insns
12344 uninlined-thunk-time
12345 Same as --param uninlined-function-insns and --param uninlined-
12346 function-time but applied to function thunks.
12347
12348 inline-min-speedup
12349 When estimated performance improvement of caller + callee
12350 runtime exceeds this threshold (in percent), the function can
12351 be inlined regardless of the limit on --param max-inline-insns-
12352 single and --param max-inline-insns-auto.
12353
12354 large-function-insns
12355 The limit specifying really large functions. For functions
12356 larger than this limit after inlining, inlining is constrained
12357 by --param large-function-growth. This parameter is useful
12358 primarily to avoid extreme compilation time caused by non-
12359 linear algorithms used by the back end.
12360
12361 large-function-growth
12362 Specifies maximal growth of large function caused by inlining
12363 in percents. For example, parameter value 100 limits large
12364 function growth to 2.0 times the original size.
12365
12366 large-unit-insns
12367 The limit specifying large translation unit. Growth caused by
12368 inlining of units larger than this limit is limited by --param
12369 inline-unit-growth. For small units this might be too tight.
12370 For example, consider a unit consisting of function A that is
12371 inline and B that just calls A three times. If B is small
12372 relative to A, the growth of unit is 300\% and yet such
12373 inlining is very sane. For very large units consisting of
12374 small inlineable functions, however, the overall unit growth
12375 limit is needed to avoid exponential explosion of code size.
12376 Thus for smaller units, the size is increased to --param large-
12377 unit-insns before applying --param inline-unit-growth.
12378
12379 lazy-modules
12380 Maximum number of concurrently open C++ module files when lazy
12381 loading.
12382
12383 inline-unit-growth
12384 Specifies maximal overall growth of the compilation unit caused
12385 by inlining. For example, parameter value 20 limits unit
12386 growth to 1.2 times the original size. Cold functions (either
12387 marked cold via an attribute or by profile feedback) are not
12388 accounted into the unit size.
12389
12390 ipa-cp-unit-growth
12391 Specifies maximal overall growth of the compilation unit caused
12392 by interprocedural constant propagation. For example,
12393 parameter value 10 limits unit growth to 1.1 times the original
12394 size.
12395
12396 ipa-cp-large-unit-insns
12397 The size of translation unit that IPA-CP pass considers large.
12398
12399 large-stack-frame
12400 The limit specifying large stack frames. While inlining the
12401 algorithm is trying to not grow past this limit too much.
12402
12403 large-stack-frame-growth
12404 Specifies maximal growth of large stack frames caused by
12405 inlining in percents. For example, parameter value 1000 limits
12406 large stack frame growth to 11 times the original size.
12407
12408 max-inline-insns-recursive
12409 max-inline-insns-recursive-auto
12410 Specifies the maximum number of instructions an out-of-line
12411 copy of a self-recursive inline function can grow into by
12412 performing recursive inlining.
12413
12414 --param max-inline-insns-recursive applies to functions
12415 declared inline. For functions not declared inline, recursive
12416 inlining happens only when -finline-functions (included in -O3)
12417 is enabled; --param max-inline-insns-recursive-auto applies
12418 instead.
12419
12420 max-inline-recursive-depth
12421 max-inline-recursive-depth-auto
12422 Specifies the maximum recursion depth used for recursive
12423 inlining.
12424
12425 --param max-inline-recursive-depth applies to functions
12426 declared inline. For functions not declared inline, recursive
12427 inlining happens only when -finline-functions (included in -O3)
12428 is enabled; --param max-inline-recursive-depth-auto applies
12429 instead.
12430
12431 min-inline-recursive-probability
12432 Recursive inlining is profitable only for function having deep
12433 recursion in average and can hurt for function having little
12434 recursion depth by increasing the prologue size or complexity
12435 of function body to other optimizers.
12436
12437 When profile feedback is available (see -fprofile-generate) the
12438 actual recursion depth can be guessed from the probability that
12439 function recurses via a given call expression. This parameter
12440 limits inlining only to call expressions whose probability
12441 exceeds the given threshold (in percents).
12442
12443 early-inlining-insns
12444 Specify growth that the early inliner can make. In effect it
12445 increases the amount of inlining for code having a large
12446 abstraction penalty.
12447
12448 max-early-inliner-iterations
12449 Limit of iterations of the early inliner. This basically
12450 bounds the number of nested indirect calls the early inliner
12451 can resolve. Deeper chains are still handled by late inlining.
12452
12453 comdat-sharing-probability
12454 Probability (in percent) that C++ inline function with comdat
12455 visibility are shared across multiple compilation units.
12456
12457 modref-max-bases
12458 modref-max-refs
12459 modref-max-accesses
12460 Specifies the maximal number of base pointers, references and
12461 accesses stored for a single function by mod/ref analysis.
12462
12463 modref-max-tests
12464 Specifies the maxmal number of tests alias oracle can perform
12465 to disambiguate memory locations using the mod/ref information.
12466 This parameter ought to be bigger than --param modref-max-bases
12467 and --param modref-max-refs.
12468
12469 modref-max-depth
12470 Specifies the maximum depth of DFS walk used by modref escape
12471 analysis. Setting to 0 disables the analysis completely.
12472
12473 modref-max-escape-points
12474 Specifies the maximum number of escape points tracked by modref
12475 per SSA-name.
12476
12477 modref-max-adjustments
12478 Specifies the maximum number the access range is enlarged
12479 during modref dataflow analysis.
12480
12481 profile-func-internal-id
12482 A parameter to control whether to use function internal id in
12483 profile database lookup. If the value is 0, the compiler uses
12484 an id that is based on function assembler name and filename,
12485 which makes old profile data more tolerant to source changes
12486 such as function reordering etc.
12487
12488 min-vect-loop-bound
12489 The minimum number of iterations under which loops are not
12490 vectorized when -ftree-vectorize is used. The number of
12491 iterations after vectorization needs to be greater than the
12492 value specified by this option to allow vectorization.
12493
12494 gcse-cost-distance-ratio
12495 Scaling factor in calculation of maximum distance an expression
12496 can be moved by GCSE optimizations. This is currently
12497 supported only in the code hoisting pass. The bigger the
12498 ratio, the more aggressive code hoisting is with simple
12499 expressions, i.e., the expressions that have cost less than
12500 gcse-unrestricted-cost. Specifying 0 disables hoisting of
12501 simple expressions.
12502
12503 gcse-unrestricted-cost
12504 Cost, roughly measured as the cost of a single typical machine
12505 instruction, at which GCSE optimizations do not constrain the
12506 distance an expression can travel. This is currently supported
12507 only in the code hoisting pass. The lesser the cost, the more
12508 aggressive code hoisting is. Specifying 0 allows all
12509 expressions to travel unrestricted distances.
12510
12511 max-hoist-depth
12512 The depth of search in the dominator tree for expressions to
12513 hoist. This is used to avoid quadratic behavior in hoisting
12514 algorithm. The value of 0 does not limit on the search, but
12515 may slow down compilation of huge functions.
12516
12517 max-tail-merge-comparisons
12518 The maximum amount of similar bbs to compare a bb with. This
12519 is used to avoid quadratic behavior in tree tail merging.
12520
12521 max-tail-merge-iterations
12522 The maximum amount of iterations of the pass over the function.
12523 This is used to limit compilation time in tree tail merging.
12524
12525 store-merging-allow-unaligned
12526 Allow the store merging pass to introduce unaligned stores if
12527 it is legal to do so.
12528
12529 max-stores-to-merge
12530 The maximum number of stores to attempt to merge into wider
12531 stores in the store merging pass.
12532
12533 max-store-chains-to-track
12534 The maximum number of store chains to track at the same time in
12535 the attempt to merge them into wider stores in the store
12536 merging pass.
12537
12538 max-stores-to-track
12539 The maximum number of stores to track at the same time in the
12540 attemt to to merge them into wider stores in the store merging
12541 pass.
12542
12543 max-unrolled-insns
12544 The maximum number of instructions that a loop may have to be
12545 unrolled. If a loop is unrolled, this parameter also
12546 determines how many times the loop code is unrolled.
12547
12548 max-average-unrolled-insns
12549 The maximum number of instructions biased by probabilities of
12550 their execution that a loop may have to be unrolled. If a loop
12551 is unrolled, this parameter also determines how many times the
12552 loop code is unrolled.
12553
12554 max-unroll-times
12555 The maximum number of unrollings of a single loop.
12556
12557 max-peeled-insns
12558 The maximum number of instructions that a loop may have to be
12559 peeled. If a loop is peeled, this parameter also determines
12560 how many times the loop code is peeled.
12561
12562 max-peel-times
12563 The maximum number of peelings of a single loop.
12564
12565 max-peel-branches
12566 The maximum number of branches on the hot path through the
12567 peeled sequence.
12568
12569 max-completely-peeled-insns
12570 The maximum number of insns of a completely peeled loop.
12571
12572 max-completely-peel-times
12573 The maximum number of iterations of a loop to be suitable for
12574 complete peeling.
12575
12576 max-completely-peel-loop-nest-depth
12577 The maximum depth of a loop nest suitable for complete peeling.
12578
12579 max-unswitch-insns
12580 The maximum number of insns of an unswitched loop.
12581
12582 max-unswitch-depth
12583 The maximum depth of a loop nest to be unswitched.
12584
12585 lim-expensive
12586 The minimum cost of an expensive expression in the loop
12587 invariant motion.
12588
12589 min-loop-cond-split-prob
12590 When FDO profile information is available, min-loop-cond-split-
12591 prob specifies minimum threshold for probability of semi-
12592 invariant condition statement to trigger loop split.
12593
12594 iv-consider-all-candidates-bound
12595 Bound on number of candidates for induction variables, below
12596 which all candidates are considered for each use in induction
12597 variable optimizations. If there are more candidates than
12598 this, only the most relevant ones are considered to avoid
12599 quadratic time complexity.
12600
12601 iv-max-considered-uses
12602 The induction variable optimizations give up on loops that
12603 contain more induction variable uses.
12604
12605 iv-always-prune-cand-set-bound
12606 If the number of candidates in the set is smaller than this
12607 value, always try to remove unnecessary ivs from the set when
12608 adding a new one.
12609
12610 avg-loop-niter
12611 Average number of iterations of a loop.
12612
12613 dse-max-object-size
12614 Maximum size (in bytes) of objects tracked bytewise by dead
12615 store elimination. Larger values may result in larger
12616 compilation times.
12617
12618 dse-max-alias-queries-per-store
12619 Maximum number of queries into the alias oracle per store.
12620 Larger values result in larger compilation times and may result
12621 in more removed dead stores.
12622
12623 scev-max-expr-size
12624 Bound on size of expressions used in the scalar evolutions
12625 analyzer. Large expressions slow the analyzer.
12626
12627 scev-max-expr-complexity
12628 Bound on the complexity of the expressions in the scalar
12629 evolutions analyzer. Complex expressions slow the analyzer.
12630
12631 max-tree-if-conversion-phi-args
12632 Maximum number of arguments in a PHI supported by TREE if
12633 conversion unless the loop is marked with simd pragma.
12634
12635 vect-max-layout-candidates
12636 The maximum number of possible vector layouts (such as
12637 permutations) to consider when optimizing to-be-vectorized
12638 code.
12639
12640 vect-max-version-for-alignment-checks
12641 The maximum number of run-time checks that can be performed
12642 when doing loop versioning for alignment in the vectorizer.
12643
12644 vect-max-version-for-alias-checks
12645 The maximum number of run-time checks that can be performed
12646 when doing loop versioning for alias in the vectorizer.
12647
12648 vect-max-peeling-for-alignment
12649 The maximum number of loop peels to enhance access alignment
12650 for vectorizer. Value -1 means no limit.
12651
12652 max-iterations-to-track
12653 The maximum number of iterations of a loop the brute-force
12654 algorithm for analysis of the number of iterations of the loop
12655 tries to evaluate.
12656
12657 hot-bb-count-fraction
12658 The denominator n of fraction 1/n of the maximal execution
12659 count of a basic block in the entire program that a basic block
12660 needs to at least have in order to be considered hot. The
12661 default is 10000, which means that a basic block is considered
12662 hot if its execution count is greater than 1/10000 of the
12663 maximal execution count. 0 means that it is never considered
12664 hot. Used in non-LTO mode.
12665
12666 hot-bb-count-ws-permille
12667 The number of most executed permilles, ranging from 0 to 1000,
12668 of the profiled execution of the entire program to which the
12669 execution count of a basic block must be part of in order to be
12670 considered hot. The default is 990, which means that a basic
12671 block is considered hot if its execution count contributes to
12672 the upper 990 permilles, or 99.0%, of the profiled execution of
12673 the entire program. 0 means that it is never considered hot.
12674 Used in LTO mode.
12675
12676 hot-bb-frequency-fraction
12677 The denominator n of fraction 1/n of the execution frequency of
12678 the entry block of a function that a basic block of this
12679 function needs to at least have in order to be considered hot.
12680 The default is 1000, which means that a basic block is
12681 considered hot in a function if it is executed more frequently
12682 than 1/1000 of the frequency of the entry block of the
12683 function. 0 means that it is never considered hot.
12684
12685 unlikely-bb-count-fraction
12686 The denominator n of fraction 1/n of the number of profiled
12687 runs of the entire program below which the execution count of a
12688 basic block must be in order for the basic block to be
12689 considered unlikely executed. The default is 20, which means
12690 that a basic block is considered unlikely executed if it is
12691 executed in fewer than 1/20, or 5%, of the runs of the program.
12692 0 means that it is always considered unlikely executed.
12693
12694 max-predicted-iterations
12695 The maximum number of loop iterations we predict statically.
12696 This is useful in cases where a function contains a single loop
12697 with known bound and another loop with unknown bound. The
12698 known number of iterations is predicted correctly, while the
12699 unknown number of iterations average to roughly 10. This means
12700 that the loop without bounds appears artificially cold relative
12701 to the other one.
12702
12703 builtin-expect-probability
12704 Control the probability of the expression having the specified
12705 value. This parameter takes a percentage (i.e. 0 ... 100) as
12706 input.
12707
12708 builtin-string-cmp-inline-length
12709 The maximum length of a constant string for a builtin string
12710 cmp call eligible for inlining.
12711
12712 align-threshold
12713 Select fraction of the maximal frequency of executions of a
12714 basic block in a function to align the basic block.
12715
12716 align-loop-iterations
12717 A loop expected to iterate at least the selected number of
12718 iterations is aligned.
12719
12720 tracer-dynamic-coverage
12721 tracer-dynamic-coverage-feedback
12722 This value is used to limit superblock formation once the given
12723 percentage of executed instructions is covered. This limits
12724 unnecessary code size expansion.
12725
12726 The tracer-dynamic-coverage-feedback parameter is used only
12727 when profile feedback is available. The real profiles (as
12728 opposed to statically estimated ones) are much less balanced
12729 allowing the threshold to be larger value.
12730
12731 tracer-max-code-growth
12732 Stop tail duplication once code growth has reached given
12733 percentage. This is a rather artificial limit, as most of the
12734 duplicates are eliminated later in cross jumping, so it may be
12735 set to much higher values than is the desired code growth.
12736
12737 tracer-min-branch-ratio
12738 Stop reverse growth when the reverse probability of best edge
12739 is less than this threshold (in percent).
12740
12741 tracer-min-branch-probability
12742 tracer-min-branch-probability-feedback
12743 Stop forward growth if the best edge has probability lower than
12744 this threshold.
12745
12746 Similarly to tracer-dynamic-coverage two parameters are
12747 provided. tracer-min-branch-probability-feedback is used for
12748 compilation with profile feedback and tracer-min-branch-
12749 probability compilation without. The value for compilation
12750 with profile feedback needs to be more conservative (higher) in
12751 order to make tracer effective.
12752
12753 stack-clash-protection-guard-size
12754 Specify the size of the operating system provided stack guard
12755 as 2 raised to num bytes. Higher values may reduce the number
12756 of explicit probes, but a value larger than the operating
12757 system provided guard will leave code vulnerable to stack clash
12758 style attacks.
12759
12760 stack-clash-protection-probe-interval
12761 Stack clash protection involves probing stack space as it is
12762 allocated. This param controls the maximum distance between
12763 probes into the stack as 2 raised to num bytes. Higher values
12764 may reduce the number of explicit probes, but a value larger
12765 than the operating system provided guard will leave code
12766 vulnerable to stack clash style attacks.
12767
12768 max-cse-path-length
12769 The maximum number of basic blocks on path that CSE considers.
12770
12771 max-cse-insns
12772 The maximum number of instructions CSE processes before
12773 flushing.
12774
12775 ggc-min-expand
12776 GCC uses a garbage collector to manage its own memory
12777 allocation. This parameter specifies the minimum percentage by
12778 which the garbage collector's heap should be allowed to expand
12779 between collections. Tuning this may improve compilation
12780 speed; it has no effect on code generation.
12781
12782 The default is 30% + 70% * (RAM/1GB) with an upper bound of
12783 100% when RAM >= 1GB. If "getrlimit" is available, the notion
12784 of "RAM" is the smallest of actual RAM and "RLIMIT_DATA" or
12785 "RLIMIT_AS". If GCC is not able to calculate RAM on a
12786 particular platform, the lower bound of 30% is used. Setting
12787 this parameter and ggc-min-heapsize to zero causes a full
12788 collection to occur at every opportunity. This is extremely
12789 slow, but can be useful for debugging.
12790
12791 ggc-min-heapsize
12792 Minimum size of the garbage collector's heap before it begins
12793 bothering to collect garbage. The first collection occurs
12794 after the heap expands by ggc-min-expand% beyond ggc-min-
12795 heapsize. Again, tuning this may improve compilation speed,
12796 and has no effect on code generation.
12797
12798 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit
12799 that tries to ensure that RLIMIT_DATA or RLIMIT_AS are not
12800 exceeded, but with a lower bound of 4096 (four megabytes) and
12801 an upper bound of 131072 (128 megabytes). If GCC is not able
12802 to calculate RAM on a particular platform, the lower bound is
12803 used. Setting this parameter very large effectively disables
12804 garbage collection. Setting this parameter and ggc-min-expand
12805 to zero causes a full collection to occur at every opportunity.
12806
12807 max-reload-search-insns
12808 The maximum number of instruction reload should look backward
12809 for equivalent register. Increasing values mean more
12810 aggressive optimization, making the compilation time increase
12811 with probably slightly better performance.
12812
12813 max-cselib-memory-locations
12814 The maximum number of memory locations cselib should take into
12815 account. Increasing values mean more aggressive optimization,
12816 making the compilation time increase with probably slightly
12817 better performance.
12818
12819 max-sched-ready-insns
12820 The maximum number of instructions ready to be issued the
12821 scheduler should consider at any given time during the first
12822 scheduling pass. Increasing values mean more thorough
12823 searches, making the compilation time increase with probably
12824 little benefit.
12825
12826 max-sched-region-blocks
12827 The maximum number of blocks in a region to be considered for
12828 interblock scheduling.
12829
12830 max-pipeline-region-blocks
12831 The maximum number of blocks in a region to be considered for
12832 pipelining in the selective scheduler.
12833
12834 max-sched-region-insns
12835 The maximum number of insns in a region to be considered for
12836 interblock scheduling.
12837
12838 max-pipeline-region-insns
12839 The maximum number of insns in a region to be considered for
12840 pipelining in the selective scheduler.
12841
12842 min-spec-prob
12843 The minimum probability (in percents) of reaching a source
12844 block for interblock speculative scheduling.
12845
12846 max-sched-extend-regions-iters
12847 The maximum number of iterations through CFG to extend regions.
12848 A value of 0 disables region extensions.
12849
12850 max-sched-insn-conflict-delay
12851 The maximum conflict delay for an insn to be considered for
12852 speculative motion.
12853
12854 sched-spec-prob-cutoff
12855 The minimal probability of speculation success (in percents),
12856 so that speculative insns are scheduled.
12857
12858 sched-state-edge-prob-cutoff
12859 The minimum probability an edge must have for the scheduler to
12860 save its state across it.
12861
12862 sched-mem-true-dep-cost
12863 Minimal distance (in CPU cycles) between store and load
12864 targeting same memory locations.
12865
12866 selsched-max-lookahead
12867 The maximum size of the lookahead window of selective
12868 scheduling. It is a depth of search for available
12869 instructions.
12870
12871 selsched-max-sched-times
12872 The maximum number of times that an instruction is scheduled
12873 during selective scheduling. This is the limit on the number
12874 of iterations through which the instruction may be pipelined.
12875
12876 selsched-insns-to-rename
12877 The maximum number of best instructions in the ready list that
12878 are considered for renaming in the selective scheduler.
12879
12880 sms-min-sc
12881 The minimum value of stage count that swing modulo scheduler
12882 generates.
12883
12884 max-last-value-rtl
12885 The maximum size measured as number of RTLs that can be
12886 recorded in an expression in combiner for a pseudo register as
12887 last known value of that register.
12888
12889 max-combine-insns
12890 The maximum number of instructions the RTL combiner tries to
12891 combine.
12892
12893 integer-share-limit
12894 Small integer constants can use a shared data structure,
12895 reducing the compiler's memory usage and increasing its speed.
12896 This sets the maximum value of a shared integer constant.
12897
12898 ssp-buffer-size
12899 The minimum size of buffers (i.e. arrays) that receive stack
12900 smashing protection when -fstack-protector is used.
12901
12902 min-size-for-stack-sharing
12903 The minimum size of variables taking part in stack slot sharing
12904 when not optimizing.
12905
12906 max-jump-thread-duplication-stmts
12907 Maximum number of statements allowed in a block that needs to
12908 be duplicated when threading jumps.
12909
12910 max-jump-thread-paths
12911 The maximum number of paths to consider when searching for jump
12912 threading opportunities. When arriving at a block, incoming
12913 edges are only considered if the number of paths to be searched
12914 so far multiplied by the number of incoming edges does not
12915 exhaust the specified maximum number of paths to consider.
12916
12917 max-fields-for-field-sensitive
12918 Maximum number of fields in a structure treated in a field
12919 sensitive manner during pointer analysis.
12920
12921 prefetch-latency
12922 Estimate on average number of instructions that are executed
12923 before prefetch finishes. The distance prefetched ahead is
12924 proportional to this constant. Increasing this number may also
12925 lead to less streams being prefetched (see simultaneous-
12926 prefetches).
12927
12928 simultaneous-prefetches
12929 Maximum number of prefetches that can run at the same time.
12930
12931 l1-cache-line-size
12932 The size of cache line in L1 data cache, in bytes.
12933
12934 l1-cache-size
12935 The size of L1 data cache, in kilobytes.
12936
12937 l2-cache-size
12938 The size of L2 data cache, in kilobytes.
12939
12940 prefetch-dynamic-strides
12941 Whether the loop array prefetch pass should issue software
12942 prefetch hints for strides that are non-constant. In some
12943 cases this may be beneficial, though the fact the stride is
12944 non-constant may make it hard to predict when there is clear
12945 benefit to issuing these hints.
12946
12947 Set to 1 if the prefetch hints should be issued for non-
12948 constant strides. Set to 0 if prefetch hints should be issued
12949 only for strides that are known to be constant and below
12950 prefetch-minimum-stride.
12951
12952 prefetch-minimum-stride
12953 Minimum constant stride, in bytes, to start using prefetch
12954 hints for. If the stride is less than this threshold, prefetch
12955 hints will not be issued.
12956
12957 This setting is useful for processors that have hardware
12958 prefetchers, in which case there may be conflicts between the
12959 hardware prefetchers and the software prefetchers. If the
12960 hardware prefetchers have a maximum stride they can handle, it
12961 should be used here to improve the use of software prefetchers.
12962
12963 A value of -1 means we don't have a threshold and therefore
12964 prefetch hints can be issued for any constant stride.
12965
12966 This setting is only useful for strides that are known and
12967 constant.
12968
12969 destructive-interference-size
12970 constructive-interference-size
12971 The values for the C++17 variables
12972 "std::hardware_destructive_interference_size" and
12973 "std::hardware_constructive_interference_size". The
12974 destructive interference size is the minimum recommended offset
12975 between two independent concurrently-accessed objects; the
12976 constructive interference size is the maximum recommended size
12977 of contiguous memory accessed together. Typically both will be
12978 the size of an L1 cache line for the target, in bytes. For a
12979 generic target covering a range of L1 cache line sizes,
12980 typically the constructive interference size will be the small
12981 end of the range and the destructive size will be the large
12982 end.
12983
12984 The destructive interference size is intended to be used for
12985 layout, and thus has ABI impact. The default value is not
12986 expected to be stable, and on some targets varies with -mtune,
12987 so use of this variable in a context where ABI stability is
12988 important, such as the public interface of a library, is
12989 strongly discouraged; if it is used in that context, users can
12990 stabilize the value using this option.
12991
12992 The constructive interference size is less sensitive, as it is
12993 typically only used in a static_assert to make sure that a type
12994 fits within a cache line.
12995
12996 See also -Winterference-size.
12997
12998 loop-interchange-max-num-stmts
12999 The maximum number of stmts in a loop to be interchanged.
13000
13001 loop-interchange-stride-ratio
13002 The minimum ratio between stride of two loops for interchange
13003 to be profitable.
13004
13005 min-insn-to-prefetch-ratio
13006 The minimum ratio between the number of instructions and the
13007 number of prefetches to enable prefetching in a loop.
13008
13009 prefetch-min-insn-to-mem-ratio
13010 The minimum ratio between the number of instructions and the
13011 number of memory references to enable prefetching in a loop.
13012
13013 use-canonical-types
13014 Whether the compiler should use the "canonical" type system.
13015 Should always be 1, which uses a more efficient internal
13016 mechanism for comparing types in C++ and Objective-C++.
13017 However, if bugs in the canonical type system are causing
13018 compilation failures, set this value to 0 to disable canonical
13019 types.
13020
13021 switch-conversion-max-branch-ratio
13022 Switch initialization conversion refuses to create arrays that
13023 are bigger than switch-conversion-max-branch-ratio times the
13024 number of branches in the switch.
13025
13026 max-partial-antic-length
13027 Maximum length of the partial antic set computed during the
13028 tree partial redundancy elimination optimization (-ftree-pre)
13029 when optimizing at -O3 and above. For some sorts of source
13030 code the enhanced partial redundancy elimination optimization
13031 can run away, consuming all of the memory available on the host
13032 machine. This parameter sets a limit on the length of the sets
13033 that are computed, which prevents the runaway behavior.
13034 Setting a value of 0 for this parameter allows an unlimited set
13035 length.
13036
13037 rpo-vn-max-loop-depth
13038 Maximum loop depth that is value-numbered optimistically. When
13039 the limit hits the innermost rpo-vn-max-loop-depth loops and
13040 the outermost loop in the loop nest are value-numbered
13041 optimistically and the remaining ones not.
13042
13043 sccvn-max-alias-queries-per-access
13044 Maximum number of alias-oracle queries we perform when looking
13045 for redundancies for loads and stores. If this limit is hit
13046 the search is aborted and the load or store is not considered
13047 redundant. The number of queries is algorithmically limited to
13048 the number of stores on all paths from the load to the function
13049 entry.
13050
13051 ira-max-loops-num
13052 IRA uses regional register allocation by default. If a
13053 function contains more loops than the number given by this
13054 parameter, only at most the given number of the most
13055 frequently-executed loops form regions for regional register
13056 allocation.
13057
13058 ira-max-conflict-table-size
13059 Although IRA uses a sophisticated algorithm to compress the
13060 conflict table, the table can still require excessive amounts
13061 of memory for huge functions. If the conflict table for a
13062 function could be more than the size in MB given by this
13063 parameter, the register allocator instead uses a faster,
13064 simpler, and lower-quality algorithm that does not require
13065 building a pseudo-register conflict table.
13066
13067 ira-loop-reserved-regs
13068 IRA can be used to evaluate more accurate register pressure in
13069 loops for decisions to move loop invariants (see -O3). The
13070 number of available registers reserved for some other purposes
13071 is given by this parameter. Default of the parameter is the
13072 best found from numerous experiments.
13073
13074 ira-consider-dup-in-all-alts
13075 Make IRA to consider matching constraint (duplicated operand
13076 number) heavily in all available alternatives for preferred
13077 register class. If it is set as zero, it means IRA only
13078 respects the matching constraint when it's in the only
13079 available alternative with an appropriate register class.
13080 Otherwise, it means IRA will check all available alternatives
13081 for preferred register class even if it has found some choice
13082 with an appropriate register class and respect the found
13083 qualified matching constraint.
13084
13085 ira-simple-lra-insn-threshold
13086 Approximate function insn number in 1K units triggering simple
13087 local RA.
13088
13089 lra-inheritance-ebb-probability-cutoff
13090 LRA tries to reuse values reloaded in registers in subsequent
13091 insns. This optimization is called inheritance. EBB is used
13092 as a region to do this optimization. The parameter defines a
13093 minimal fall-through edge probability in percentage used to add
13094 BB to inheritance EBB in LRA. The default value was chosen
13095 from numerous runs of SPEC2000 on x86-64.
13096
13097 loop-invariant-max-bbs-in-loop
13098 Loop invariant motion can be very expensive, both in
13099 compilation time and in amount of needed compile-time memory,
13100 with very large loops. Loops with more basic blocks than this
13101 parameter won't have loop invariant motion optimization
13102 performed on them.
13103
13104 loop-max-datarefs-for-datadeps
13105 Building data dependencies is expensive for very large loops.
13106 This parameter limits the number of data references in loops
13107 that are considered for data dependence analysis. These large
13108 loops are no handled by the optimizations using loop data
13109 dependencies.
13110
13111 max-vartrack-size
13112 Sets a maximum number of hash table slots to use during
13113 variable tracking dataflow analysis of any function. If this
13114 limit is exceeded with variable tracking at assignments
13115 enabled, analysis for that function is retried without it,
13116 after removing all debug insns from the function. If the limit
13117 is exceeded even without debug insns, var tracking analysis is
13118 completely disabled for the function. Setting the parameter to
13119 zero makes it unlimited.
13120
13121 max-vartrack-expr-depth
13122 Sets a maximum number of recursion levels when attempting to
13123 map variable names or debug temporaries to value expressions.
13124 This trades compilation time for more complete debug
13125 information. If this is set too low, value expressions that
13126 are available and could be represented in debug information may
13127 end up not being used; setting this higher may enable the
13128 compiler to find more complex debug expressions, but compile
13129 time and memory use may grow.
13130
13131 max-debug-marker-count
13132 Sets a threshold on the number of debug markers (e.g. begin
13133 stmt markers) to avoid complexity explosion at inlining or
13134 expanding to RTL. If a function has more such gimple stmts
13135 than the set limit, such stmts will be dropped from the inlined
13136 copy of a function, and from its RTL expansion.
13137
13138 min-nondebug-insn-uid
13139 Use uids starting at this parameter for nondebug insns. The
13140 range below the parameter is reserved exclusively for debug
13141 insns created by -fvar-tracking-assignments, but debug insns
13142 may get (non-overlapping) uids above it if the reserved range
13143 is exhausted.
13144
13145 ipa-sra-deref-prob-threshold
13146 IPA-SRA replaces a pointer which is known not be NULL with one
13147 or more new parameters only when the probability (in percent,
13148 relative to function entry) of it being dereferenced is higher
13149 than this parameter.
13150
13151 ipa-sra-ptr-growth-factor
13152 IPA-SRA replaces a pointer to an aggregate with one or more new
13153 parameters only when their cumulative size is less or equal to
13154 ipa-sra-ptr-growth-factor times the size of the original
13155 pointer parameter.
13156
13157 ipa-sra-ptrwrap-growth-factor
13158 Additional maximum allowed growth of total size of new
13159 parameters that ipa-sra replaces a pointer to an aggregate
13160 with, if it points to a local variable that the caller only
13161 writes to and passes it as an argument to other functions.
13162
13163 ipa-sra-max-replacements
13164 Maximum pieces of an aggregate that IPA-SRA tracks. As a
13165 consequence, it is also the maximum number of replacements of a
13166 formal parameter.
13167
13168 sra-max-scalarization-size-Ospeed
13169 sra-max-scalarization-size-Osize
13170 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA)
13171 aim to replace scalar parts of aggregates with uses of
13172 independent scalar variables. These parameters control the
13173 maximum size, in storage units, of aggregate which is
13174 considered for replacement when compiling for speed (sra-max-
13175 scalarization-size-Ospeed) or size (sra-max-scalarization-size-
13176 Osize) respectively.
13177
13178 sra-max-propagations
13179 The maximum number of artificial accesses that Scalar
13180 Replacement of Aggregates (SRA) will track, per one local
13181 variable, in order to facilitate copy propagation.
13182
13183 tm-max-aggregate-size
13184 When making copies of thread-local variables in a transaction,
13185 this parameter specifies the size in bytes after which
13186 variables are saved with the logging functions as opposed to
13187 save/restore code sequence pairs. This option only applies
13188 when using -fgnu-tm.
13189
13190 graphite-max-nb-scop-params
13191 To avoid exponential effects in the Graphite loop transforms,
13192 the number of parameters in a Static Control Part (SCoP) is
13193 bounded. A value of zero can be used to lift the bound. A
13194 variable whose value is unknown at compilation time and defined
13195 outside a SCoP is a parameter of the SCoP.
13196
13197 loop-block-tile-size
13198 Loop blocking or strip mining transforms, enabled with
13199 -floop-block or -floop-strip-mine, strip mine each loop in the
13200 loop nest by a given number of iterations. The strip length
13201 can be changed using the loop-block-tile-size parameter.
13202
13203 ipa-jump-function-lookups
13204 Specifies number of statements visited during jump function
13205 offset discovery.
13206
13207 ipa-cp-value-list-size
13208 IPA-CP attempts to track all possible values and types passed
13209 to a function's parameter in order to propagate them and
13210 perform devirtualization. ipa-cp-value-list-size is the
13211 maximum number of values and types it stores per one formal
13212 parameter of a function.
13213
13214 ipa-cp-eval-threshold
13215 IPA-CP calculates its own score of cloning profitability
13216 heuristics and performs those cloning opportunities with scores
13217 that exceed ipa-cp-eval-threshold.
13218
13219 ipa-cp-max-recursive-depth
13220 Maximum depth of recursive cloning for self-recursive function.
13221
13222 ipa-cp-min-recursive-probability
13223 Recursive cloning only when the probability of call being
13224 executed exceeds the parameter.
13225
13226 ipa-cp-profile-count-base
13227 When using -fprofile-use option, IPA-CP will consider the
13228 measured execution count of a call graph edge at this
13229 percentage position in their histogram as the basis for its
13230 heuristics calculation.
13231
13232 ipa-cp-recursive-freq-factor
13233 The number of times interprocedural copy propagation expects
13234 recursive functions to call themselves.
13235
13236 ipa-cp-recursion-penalty
13237 Percentage penalty the recursive functions will receive when
13238 they are evaluated for cloning.
13239
13240 ipa-cp-single-call-penalty
13241 Percentage penalty functions containing a single call to
13242 another function will receive when they are evaluated for
13243 cloning.
13244
13245 ipa-max-agg-items
13246 IPA-CP is also capable to propagate a number of scalar values
13247 passed in an aggregate. ipa-max-agg-items controls the maximum
13248 number of such values per one parameter.
13249
13250 ipa-cp-loop-hint-bonus
13251 When IPA-CP determines that a cloning candidate would make the
13252 number of iterations of a loop known, it adds a bonus of ipa-
13253 cp-loop-hint-bonus to the profitability score of the candidate.
13254
13255 ipa-max-loop-predicates
13256 The maximum number of different predicates IPA will use to
13257 describe when loops in a function have known properties.
13258
13259 ipa-max-aa-steps
13260 During its analysis of function bodies, IPA-CP employs alias
13261 analysis in order to track values pointed to by function
13262 parameters. In order not spend too much time analyzing huge
13263 functions, it gives up and consider all memory clobbered after
13264 examining ipa-max-aa-steps statements modifying memory.
13265
13266 ipa-max-switch-predicate-bounds
13267 Maximal number of boundary endpoints of case ranges of switch
13268 statement. For switch exceeding this limit, IPA-CP will not
13269 construct cloning cost predicate, which is used to estimate
13270 cloning benefit, for default case of the switch statement.
13271
13272 ipa-max-param-expr-ops
13273 IPA-CP will analyze conditional statement that references some
13274 function parameter to estimate benefit for cloning upon certain
13275 constant value. But if number of operations in a parameter
13276 expression exceeds ipa-max-param-expr-ops, the expression is
13277 treated as complicated one, and is not handled by IPA analysis.
13278
13279 lto-partitions
13280 Specify desired number of partitions produced during WHOPR
13281 compilation. The number of partitions should exceed the number
13282 of CPUs used for compilation.
13283
13284 lto-min-partition
13285 Size of minimal partition for WHOPR (in estimated
13286 instructions). This prevents expenses of splitting very small
13287 programs into too many partitions.
13288
13289 lto-max-partition
13290 Size of max partition for WHOPR (in estimated instructions).
13291 to provide an upper bound for individual size of partition.
13292 Meant to be used only with balanced partitioning.
13293
13294 lto-max-streaming-parallelism
13295 Maximal number of parallel processes used for LTO streaming.
13296
13297 cxx-max-namespaces-for-diagnostic-help
13298 The maximum number of namespaces to consult for suggestions
13299 when C++ name lookup fails for an identifier.
13300
13301 sink-frequency-threshold
13302 The maximum relative execution frequency (in percents) of the
13303 target block relative to a statement's original block to allow
13304 statement sinking of a statement. Larger numbers result in
13305 more aggressive statement sinking. A small positive adjustment
13306 is applied for statements with memory operands as those are
13307 even more profitable so sink.
13308
13309 max-stores-to-sink
13310 The maximum number of conditional store pairs that can be sunk.
13311 Set to 0 if either vectorization (-ftree-vectorize) or if-
13312 conversion (-ftree-loop-if-convert) is disabled.
13313
13314 case-values-threshold
13315 The smallest number of different values for which it is best to
13316 use a jump-table instead of a tree of conditional branches. If
13317 the value is 0, use the default for the machine.
13318
13319 jump-table-max-growth-ratio-for-size
13320 The maximum code size growth ratio when expanding into a jump
13321 table (in percent). The parameter is used when optimizing for
13322 size.
13323
13324 jump-table-max-growth-ratio-for-speed
13325 The maximum code size growth ratio when expanding into a jump
13326 table (in percent). The parameter is used when optimizing for
13327 speed.
13328
13329 tree-reassoc-width
13330 Set the maximum number of instructions executed in parallel in
13331 reassociated tree. This parameter overrides target dependent
13332 heuristics used by default if has non zero value.
13333
13334 sched-pressure-algorithm
13335 Choose between the two available implementations of
13336 -fsched-pressure. Algorithm 1 is the original implementation
13337 and is the more likely to prevent instructions from being
13338 reordered. Algorithm 2 was designed to be a compromise between
13339 the relatively conservative approach taken by algorithm 1 and
13340 the rather aggressive approach taken by the default scheduler.
13341 It relies more heavily on having a regular register file and
13342 accurate register pressure classes. See haifa-sched.cc in the
13343 GCC sources for more details.
13344
13345 The default choice depends on the target.
13346
13347 max-slsr-cand-scan
13348 Set the maximum number of existing candidates that are
13349 considered when seeking a basis for a new straight-line
13350 strength reduction candidate.
13351
13352 asan-globals
13353 Enable buffer overflow detection for global objects. This kind
13354 of protection is enabled by default if you are using
13355 -fsanitize=address option. To disable global objects
13356 protection use --param asan-globals=0.
13357
13358 asan-stack
13359 Enable buffer overflow detection for stack objects. This kind
13360 of protection is enabled by default when using
13361 -fsanitize=address. To disable stack protection use --param
13362 asan-stack=0 option.
13363
13364 asan-instrument-reads
13365 Enable buffer overflow detection for memory reads. This kind
13366 of protection is enabled by default when using
13367 -fsanitize=address. To disable memory reads protection use
13368 --param asan-instrument-reads=0.
13369
13370 asan-instrument-writes
13371 Enable buffer overflow detection for memory writes. This kind
13372 of protection is enabled by default when using
13373 -fsanitize=address. To disable memory writes protection use
13374 --param asan-instrument-writes=0 option.
13375
13376 asan-memintrin
13377 Enable detection for built-in functions. This kind of
13378 protection is enabled by default when using -fsanitize=address.
13379 To disable built-in functions protection use --param
13380 asan-memintrin=0.
13381
13382 asan-use-after-return
13383 Enable detection of use-after-return. This kind of protection
13384 is enabled by default when using the -fsanitize=address option.
13385 To disable it use --param asan-use-after-return=0.
13386
13387 Note: By default the check is disabled at run time. To enable
13388 it, add "detect_stack_use_after_return=1" to the environment
13389 variable ASAN_OPTIONS.
13390
13391 asan-instrumentation-with-call-threshold
13392 If number of memory accesses in function being instrumented is
13393 greater or equal to this number, use callbacks instead of
13394 inline checks. E.g. to disable inline code use --param
13395 asan-instrumentation-with-call-threshold=0.
13396
13397 asan-kernel-mem-intrinsic-prefix
13398 If nonzero, prefix calls to "memcpy", "memset" and "memmove"
13399 with __asan_ or __hwasan_ for -fsanitize=kernel-address or
13400 -fsanitize=kernel-hwaddress, respectively.
13401
13402 hwasan-instrument-stack
13403 Enable hwasan instrumentation of statically sized stack-
13404 allocated variables. This kind of instrumentation is enabled
13405 by default when using -fsanitize=hwaddress and disabled by
13406 default when using -fsanitize=kernel-hwaddress. To disable
13407 stack instrumentation use --param hwasan-instrument-stack=0,
13408 and to enable it use --param hwasan-instrument-stack=1.
13409
13410 hwasan-random-frame-tag
13411 When using stack instrumentation, decide tags for stack
13412 variables using a deterministic sequence beginning at a random
13413 tag for each frame. With this parameter unset tags are chosen
13414 using the same sequence but beginning from 1. This is enabled
13415 by default for -fsanitize=hwaddress and unavailable for
13416 -fsanitize=kernel-hwaddress. To disable it use --param
13417 hwasan-random-frame-tag=0.
13418
13419 hwasan-instrument-allocas
13420 Enable hwasan instrumentation of dynamically sized stack-
13421 allocated variables. This kind of instrumentation is enabled
13422 by default when using -fsanitize=hwaddress and disabled by
13423 default when using -fsanitize=kernel-hwaddress. To disable
13424 instrumentation of such variables use --param
13425 hwasan-instrument-allocas=0, and to enable it use --param
13426 hwasan-instrument-allocas=1.
13427
13428 hwasan-instrument-reads
13429 Enable hwasan checks on memory reads. Instrumentation of reads
13430 is enabled by default for both -fsanitize=hwaddress and
13431 -fsanitize=kernel-hwaddress. To disable checking memory reads
13432 use --param hwasan-instrument-reads=0.
13433
13434 hwasan-instrument-writes
13435 Enable hwasan checks on memory writes. Instrumentation of
13436 writes is enabled by default for both -fsanitize=hwaddress and
13437 -fsanitize=kernel-hwaddress. To disable checking memory writes
13438 use --param hwasan-instrument-writes=0.
13439
13440 hwasan-instrument-mem-intrinsics
13441 Enable hwasan instrumentation of builtin functions.
13442 Instrumentation of these builtin functions is enabled by
13443 default for both -fsanitize=hwaddress and
13444 -fsanitize=kernel-hwaddress. To disable instrumentation of
13445 builtin functions use --param
13446 hwasan-instrument-mem-intrinsics=0.
13447
13448 use-after-scope-direct-emission-threshold
13449 If the size of a local variable in bytes is smaller or equal to
13450 this number, directly poison (or unpoison) shadow memory
13451 instead of using run-time callbacks.
13452
13453 tsan-distinguish-volatile
13454 Emit special instrumentation for accesses to volatiles.
13455
13456 tsan-instrument-func-entry-exit
13457 Emit instrumentation calls to __tsan_func_entry() and
13458 __tsan_func_exit().
13459
13460 max-fsm-thread-path-insns
13461 Maximum number of instructions to copy when duplicating blocks
13462 on a finite state automaton jump thread path.
13463
13464 threader-debug
13465 threader-debug=[none|all] Enables verbose dumping of the
13466 threader solver.
13467
13468 parloops-chunk-size
13469 Chunk size of omp schedule for loops parallelized by parloops.
13470
13471 parloops-schedule
13472 Schedule type of omp schedule for loops parallelized by
13473 parloops (static, dynamic, guided, auto, runtime).
13474
13475 parloops-min-per-thread
13476 The minimum number of iterations per thread of an innermost
13477 parallelized loop for which the parallelized variant is
13478 preferred over the single threaded one. Note that for a
13479 parallelized loop nest the minimum number of iterations of the
13480 outermost loop per thread is two.
13481
13482 max-ssa-name-query-depth
13483 Maximum depth of recursion when querying properties of SSA
13484 names in things like fold routines. One level of recursion
13485 corresponds to following a use-def chain.
13486
13487 max-speculative-devirt-maydefs
13488 The maximum number of may-defs we analyze when looking for a
13489 must-def specifying the dynamic type of an object that invokes
13490 a virtual call we may be able to devirtualize speculatively.
13491
13492 evrp-sparse-threshold
13493 Maximum number of basic blocks before EVRP uses a sparse cache.
13494
13495 ranger-debug
13496 Specifies the type of debug output to be issued for ranges.
13497
13498 evrp-switch-limit
13499 Specifies the maximum number of switch cases before EVRP
13500 ignores a switch.
13501
13502 unroll-jam-min-percent
13503 The minimum percentage of memory references that must be
13504 optimized away for the unroll-and-jam transformation to be
13505 considered profitable.
13506
13507 unroll-jam-max-unroll
13508 The maximum number of times the outer loop should be unrolled
13509 by the unroll-and-jam transformation.
13510
13511 max-rtl-if-conversion-unpredictable-cost
13512 Maximum permissible cost for the sequence that would be
13513 generated by the RTL if-conversion pass for a branch that is
13514 considered unpredictable.
13515
13516 max-variable-expansions-in-unroller
13517 If -fvariable-expansion-in-unroller is used, the maximum number
13518 of times that an individual variable will be expanded during
13519 loop unrolling.
13520
13521 partial-inlining-entry-probability
13522 Maximum probability of the entry BB of split region (in percent
13523 relative to entry BB of the function) to make partial inlining
13524 happen.
13525
13526 max-tracked-strlens
13527 Maximum number of strings for which strlen optimization pass
13528 will track string lengths.
13529
13530 gcse-after-reload-partial-fraction
13531 The threshold ratio for performing partial redundancy
13532 elimination after reload.
13533
13534 gcse-after-reload-critical-fraction
13535 The threshold ratio of critical edges execution count that
13536 permit performing redundancy elimination after reload.
13537
13538 max-loop-header-insns
13539 The maximum number of insns in loop header duplicated by the
13540 copy loop headers pass.
13541
13542 vect-epilogues-nomask
13543 Enable loop epilogue vectorization using smaller vector size.
13544
13545 vect-partial-vector-usage
13546 Controls when the loop vectorizer considers using partial
13547 vector loads and stores as an alternative to falling back to
13548 scalar code. 0 stops the vectorizer from ever using partial
13549 vector loads and stores. 1 allows partial vector loads and
13550 stores if vectorization removes the need for the code to
13551 iterate. 2 allows partial vector loads and stores in all
13552 loops. The parameter only has an effect on targets that
13553 support partial vector loads and stores.
13554
13555 vect-inner-loop-cost-factor
13556 The maximum factor which the loop vectorizer applies to the
13557 cost of statements in an inner loop relative to the loop being
13558 vectorized. The factor applied is the maximum of the estimated
13559 number of iterations of the inner loop and this parameter. The
13560 default value of this parameter is 50.
13561
13562 vect-induction-float
13563 Enable loop vectorization of floating point inductions.
13564
13565 avoid-fma-max-bits
13566 Maximum number of bits for which we avoid creating FMAs.
13567
13568 sms-loop-average-count-threshold
13569 A threshold on the average loop count considered by the swing
13570 modulo scheduler.
13571
13572 sms-dfa-history
13573 The number of cycles the swing modulo scheduler considers when
13574 checking conflicts using DFA.
13575
13576 graphite-allow-codegen-errors
13577 Whether codegen errors should be ICEs when -fchecking.
13578
13579 sms-max-ii-factor
13580 A factor for tuning the upper bound that swing modulo scheduler
13581 uses for scheduling a loop.
13582
13583 lra-max-considered-reload-pseudos
13584 The max number of reload pseudos which are considered during
13585 spilling a non-reload pseudo.
13586
13587 max-pow-sqrt-depth
13588 Maximum depth of sqrt chains to use when synthesizing
13589 exponentiation by a real constant.
13590
13591 max-dse-active-local-stores
13592 Maximum number of active local stores in RTL dead store
13593 elimination.
13594
13595 asan-instrument-allocas
13596 Enable asan allocas/VLAs protection.
13597
13598 max-iterations-computation-cost
13599 Bound on the cost of an expression to compute the number of
13600 iterations.
13601
13602 max-isl-operations
13603 Maximum number of isl operations, 0 means unlimited.
13604
13605 graphite-max-arrays-per-scop
13606 Maximum number of arrays per scop.
13607
13608 max-vartrack-reverse-op-size
13609 Max. size of loc list for which reverse ops should be added.
13610
13611 fsm-scale-path-stmts
13612 Scale factor to apply to the number of statements in a
13613 threading path crossing a loop backedge when comparing to
13614 --param=max-jump-thread-duplication-stmts.
13615
13616 uninit-control-dep-attempts
13617 Maximum number of nested calls to search for control
13618 dependencies during uninitialized variable analysis.
13619
13620 uninit-max-chain-len
13621 Maximum number of predicates anded for each predicate ored in
13622 the normalized predicate chain.
13623
13624 uninit-max-num-chains
13625 Maximum number of predicates ored in the normalized predicate
13626 chain.
13627
13628 sched-autopref-queue-depth
13629 Hardware autoprefetcher scheduler model control flag. Number
13630 of lookahead cycles the model looks into; at ' ' only enable
13631 instruction sorting heuristic.
13632
13633 loop-versioning-max-inner-insns
13634 The maximum number of instructions that an inner loop can have
13635 before the loop versioning pass considers it too big to copy.
13636
13637 loop-versioning-max-outer-insns
13638 The maximum number of instructions that an outer loop can have
13639 before the loop versioning pass considers it too big to copy,
13640 discounting any instructions in inner loops that directly
13641 benefit from versioning.
13642
13643 ssa-name-def-chain-limit
13644 The maximum number of SSA_NAME assignments to follow in
13645 determining a property of a variable such as its value. This
13646 limits the number of iterations or recursive calls GCC performs
13647 when optimizing certain statements or when determining their
13648 validity prior to issuing diagnostics.
13649
13650 store-merging-max-size
13651 Maximum size of a single store merging region in bytes.
13652
13653 hash-table-verification-limit
13654 The number of elements for which hash table verification is
13655 done for each searched element.
13656
13657 max-find-base-term-values
13658 Maximum number of VALUEs handled during a single find_base_term
13659 call.
13660
13661 analyzer-max-enodes-per-program-point
13662 The maximum number of exploded nodes per program point within
13663 the analyzer, before terminating analysis of that point.
13664
13665 analyzer-max-constraints
13666 The maximum number of constraints per state.
13667
13668 analyzer-min-snodes-for-call-summary
13669 The minimum number of supernodes within a function for the
13670 analyzer to consider summarizing its effects at call sites.
13671
13672 analyzer-max-enodes-for-full-dump
13673 The maximum depth of exploded nodes that should appear in a dot
13674 dump before switching to a less verbose format.
13675
13676 analyzer-max-recursion-depth
13677 The maximum number of times a callsite can appear in a call
13678 stack within the analyzer, before terminating analysis of a
13679 call that would recurse deeper.
13680
13681 analyzer-max-svalue-depth
13682 The maximum depth of a symbolic value, before approximating the
13683 value as unknown.
13684
13685 analyzer-max-infeasible-edges
13686 The maximum number of infeasible edges to reject before
13687 declaring a diagnostic as infeasible.
13688
13689 gimple-fe-computed-hot-bb-threshold
13690 The number of executions of a basic block which is considered
13691 hot. The parameter is used only in GIMPLE FE.
13692
13693 analyzer-bb-explosion-factor
13694 The maximum number of 'after supernode' exploded nodes within
13695 the analyzer per supernode, before terminating analysis.
13696
13697 ranger-logical-depth
13698 Maximum depth of logical expression evaluation ranger will look
13699 through when evaluating outgoing edge ranges.
13700
13701 ranger-recompute-depth
13702 Maximum depth of instruction chains to consider for
13703 recomputation in the outgoing range calculator.
13704
13705 relation-block-limit
13706 Maximum number of relations the oracle will register in a basic
13707 block.
13708
13709 min-pagesize
13710 Minimum page size for warning purposes.
13711
13712 openacc-kernels
13713 Specify mode of OpenACC `kernels' constructs handling. With
13714 --param=openacc-kernels=decompose, OpenACC `kernels' constructs
13715 are decomposed into parts, a sequence of compute constructs,
13716 each then handled individually. This is work in progress.
13717 With --param=openacc-kernels=parloops, OpenACC `kernels'
13718 constructs are handled by the parloops pass, en bloc. This is
13719 the current default.
13720
13721 openacc-privatization
13722 Control whether the -fopt-info-omp-note and applicable
13723 -fdump-tree-*-details options emit OpenACC privatization
13724 diagnostics. With --param=openacc-privatization=quiet, don't
13725 diagnose. This is the current default. With
13726 --param=openacc-privatization=noisy, do diagnose.
13727
13728 The following choices of name are available on AArch64 targets:
13729
13730 aarch64-sve-compare-costs
13731 When vectorizing for SVE, consider using "unpacked" vectors for
13732 smaller elements and use the cost model to pick the cheapest
13733 approach. Also use the cost model to choose between SVE and
13734 Advanced SIMD vectorization.
13735
13736 Using unpacked vectors includes storing smaller elements in
13737 larger containers and accessing elements with extending loads
13738 and truncating stores.
13739
13740 aarch64-float-recp-precision
13741 The number of Newton iterations for calculating the reciprocal
13742 for float type. The precision of division is proportional to
13743 this param when division approximation is enabled. The default
13744 value is 1.
13745
13746 aarch64-double-recp-precision
13747 The number of Newton iterations for calculating the reciprocal
13748 for double type. The precision of division is propotional to
13749 this param when division approximation is enabled. The default
13750 value is 2.
13751
13752 aarch64-autovec-preference
13753 Force an ISA selection strategy for auto-vectorization.
13754 Accepts values from 0 to 4, inclusive.
13755
13756 0 Use the default heuristics.
13757
13758 1 Use only Advanced SIMD for auto-vectorization.
13759
13760 2 Use only SVE for auto-vectorization.
13761
13762 3 Use both Advanced SIMD and SVE. Prefer Advanced SIMD when
13763 the costs are deemed equal.
13764
13765 4 Use both Advanced SIMD and SVE. Prefer SVE when the costs
13766 are deemed equal.
13767
13768 The default value is 0.
13769
13770 aarch64-loop-vect-issue-rate-niters
13771 The tuning for some AArch64 CPUs tries to take both latencies
13772 and issue rates into account when deciding whether a loop
13773 should be vectorized using SVE, vectorized using Advanced SIMD,
13774 or not vectorized at all. If this parameter is set to n, GCC
13775 will not use this heuristic for loops that are known to execute
13776 in fewer than n Advanced SIMD iterations.
13777
13778 aarch64-vect-unroll-limit
13779 The vectorizer will use available tuning information to
13780 determine whether it would be beneficial to unroll the main
13781 vectorized loop and by how much. This parameter set's the
13782 upper bound of how much the vectorizer will unroll the main
13783 loop. The default value is four.
13784
13785 The following choices of name are available on i386 and x86_64
13786 targets:
13787
13788 x86-stlf-window-ninsns
13789 Instructions number above which STFL stall penalty can be
13790 compensated.
13791
13792 x86-stv-max-visits
13793 The maximum number of use and def visits when discovering a STV
13794 chain before the discovery is aborted.
13795
13796 Program Instrumentation Options
13797 GCC supports a number of command-line options that control adding run-
13798 time instrumentation to the code it normally generates. For example,
13799 one purpose of instrumentation is collect profiling statistics for use
13800 in finding program hot spots, code coverage analysis, or profile-guided
13801 optimizations. Another class of program instrumentation is adding run-
13802 time checking to detect programming errors like invalid pointer
13803 dereferences or out-of-bounds array accesses, as well as deliberately
13804 hostile attacks such as stack smashing or C++ vtable hijacking. There
13805 is also a general hook which can be used to implement other forms of
13806 tracing or function-level instrumentation for debug or program analysis
13807 purposes.
13808
13809 -p
13810 -pg Generate extra code to write profile information suitable for the
13811 analysis program prof (for -p) or gprof (for -pg). You must use
13812 this option when compiling the source files you want data about,
13813 and you must also use it when linking.
13814
13815 You can use the function attribute "no_instrument_function" to
13816 suppress profiling of individual functions when compiling with
13817 these options.
13818
13819 -fprofile-arcs
13820 Add code so that program flow arcs are instrumented. During
13821 execution the program records how many times each branch and call
13822 is executed and how many times it is taken or returns. On targets
13823 that support constructors with priority support, profiling properly
13824 handles constructors, destructors and C++ constructors (and
13825 destructors) of classes which are used as a type of a global
13826 variable.
13827
13828 When the compiled program exits it saves this data to a file called
13829 auxname.gcda for each source file. The data may be used for
13830 profile-directed optimizations (-fbranch-probabilities), or for
13831 test coverage analysis (-ftest-coverage). Each object file's
13832 auxname is generated from the name of the output file, if
13833 explicitly specified and it is not the final executable, otherwise
13834 it is the basename of the source file. In both cases any suffix is
13835 removed (e.g. foo.gcda for input file dir/foo.c, or dir/foo.gcda
13836 for output file specified as -o dir/foo.o).
13837
13838 Note that if a command line directly links source files, the
13839 corresponding .gcda files will be prefixed with the unsuffixed name
13840 of the output file. E.g. "gcc a.c b.c -o binary" would generate
13841 binary-a.gcda and binary-b.gcda files.
13842
13843 --coverage
13844 This option is used to compile and link code instrumented for
13845 coverage analysis. The option is a synonym for -fprofile-arcs
13846 -ftest-coverage (when compiling) and -lgcov (when linking). See
13847 the documentation for those options for more details.
13848
13849 * Compile the source files with -fprofile-arcs plus optimization
13850 and code generation options. For test coverage analysis, use
13851 the additional -ftest-coverage option. You do not need to
13852 profile every source file in a program.
13853
13854 * Compile the source files additionally with -fprofile-abs-path
13855 to create absolute path names in the .gcno files. This allows
13856 gcov to find the correct sources in projects where compilations
13857 occur with different working directories.
13858
13859 * Link your object files with -lgcov or -fprofile-arcs (the
13860 latter implies the former).
13861
13862 * Run the program on a representative workload to generate the
13863 arc profile information. This may be repeated any number of
13864 times. You can run concurrent instances of your program, and
13865 provided that the file system supports locking, the data files
13866 will be correctly updated. Unless a strict ISO C dialect
13867 option is in effect, "fork" calls are detected and correctly
13868 handled without double counting.
13869
13870 Moreover, an object file can be recompiled multiple times and
13871 the corresponding .gcda file merges as long as the source file
13872 and the compiler options are unchanged.
13873
13874 * For profile-directed optimizations, compile the source files
13875 again with the same optimization and code generation options
13876 plus -fbranch-probabilities.
13877
13878 * For test coverage analysis, use gcov to produce human readable
13879 information from the .gcno and .gcda files. Refer to the gcov
13880 documentation for further information.
13881
13882 With -fprofile-arcs, for each function of your program GCC creates
13883 a program flow graph, then finds a spanning tree for the graph.
13884 Only arcs that are not on the spanning tree have to be
13885 instrumented: the compiler adds code to count the number of times
13886 that these arcs are executed. When an arc is the only exit or only
13887 entrance to a block, the instrumentation code can be added to the
13888 block; otherwise, a new basic block must be created to hold the
13889 instrumentation code.
13890
13891 -ftest-coverage
13892 Produce a notes file that the gcov code-coverage utility can use to
13893 show program coverage. Each source file's note file is called
13894 auxname.gcno. Refer to the -fprofile-arcs option above for a
13895 description of auxname and instructions on how to generate test
13896 coverage data. Coverage data matches the source files more closely
13897 if you do not optimize.
13898
13899 -fprofile-abs-path
13900 Automatically convert relative source file names to absolute path
13901 names in the .gcno files. This allows gcov to find the correct
13902 sources in projects where compilations occur with different working
13903 directories.
13904
13905 -fprofile-dir=path
13906 Set the directory to search for the profile data files in to path.
13907 This option affects only the profile data generated by
13908 -fprofile-generate, -ftest-coverage, -fprofile-arcs and used by
13909 -fprofile-use and -fbranch-probabilities and its related options.
13910 Both absolute and relative paths can be used. By default, GCC uses
13911 the current directory as path, thus the profile data file appears
13912 in the same directory as the object file. In order to prevent the
13913 file name clashing, if the object file name is not an absolute
13914 path, we mangle the absolute path of the sourcename.gcda file and
13915 use it as the file name of a .gcda file. See details about the
13916 file naming in -fprofile-arcs. See similar option -fprofile-note.
13917
13918 When an executable is run in a massive parallel environment, it is
13919 recommended to save profile to different folders. That can be done
13920 with variables in path that are exported during run-time:
13921
13922 %p process ID.
13923
13924 %q{VAR}
13925 value of environment variable VAR
13926
13927 -fprofile-generate
13928 -fprofile-generate=path
13929 Enable options usually used for instrumenting application to
13930 produce profile useful for later recompilation with profile
13931 feedback based optimization. You must use -fprofile-generate both
13932 when compiling and when linking your program.
13933
13934 The following options are enabled: -fprofile-arcs,
13935 -fprofile-values, -finline-functions, and -fipa-bit-cp.
13936
13937 If path is specified, GCC looks at the path to find the profile
13938 feedback data files. See -fprofile-dir.
13939
13940 To optimize the program based on the collected profile information,
13941 use -fprofile-use.
13942
13943 -fprofile-info-section
13944 -fprofile-info-section=name
13945 Register the profile information in the specified section instead
13946 of using a constructor/destructor. The section name is name if it
13947 is specified, otherwise the section name defaults to ".gcov_info".
13948 A pointer to the profile information generated by -fprofile-arcs is
13949 placed in the specified section for each translation unit. This
13950 option disables the profile information registration through a
13951 constructor and it disables the profile information processing
13952 through a destructor. This option is not intended to be used in
13953 hosted environments such as GNU/Linux. It targets freestanding
13954 environments (for example embedded systems) with limited resources
13955 which do not support constructors/destructors or the C library file
13956 I/O.
13957
13958 The linker could collect the input sections in a continuous memory
13959 block and define start and end symbols. A GNU linker script
13960 example which defines a linker output section follows:
13961
13962 .gcov_info :
13963 {
13964 PROVIDE (__gcov_info_start = .);
13965 KEEP (*(.gcov_info))
13966 PROVIDE (__gcov_info_end = .);
13967 }
13968
13969 The program could dump the profiling information registered in this
13970 linker set for example like this:
13971
13972 #include <gcov.h>
13973 #include <stdio.h>
13974 #include <stdlib.h>
13975
13976 extern const struct gcov_info *const __gcov_info_start[];
13977 extern const struct gcov_info *const __gcov_info_end[];
13978
13979 static void
13980 dump (const void *d, unsigned n, void *arg)
13981 {
13982 const unsigned char *c = d;
13983
13984 for (unsigned i = 0; i < n; ++i)
13985 printf ("%02x", c[i]);
13986 }
13987
13988 static void
13989 filename (const char *f, void *arg)
13990 {
13991 __gcov_filename_to_gcfn (f, dump, arg );
13992 }
13993
13994 static void *
13995 allocate (unsigned length, void *arg)
13996 {
13997 return malloc (length);
13998 }
13999
14000 static void
14001 dump_gcov_info (void)
14002 {
14003 const struct gcov_info *const *info = __gcov_info_start;
14004 const struct gcov_info *const *end = __gcov_info_end;
14005
14006 /* Obfuscate variable to prevent compiler optimizations. */
14007 __asm__ ("" : "+r" (info));
14008
14009 while (info != end)
14010 {
14011 void *arg = NULL;
14012 __gcov_info_to_gcda (*info, filename, dump, allocate, arg);
14013 putchar ('\n');
14014 ++info;
14015 }
14016 }
14017
14018 int
14019 main (void)
14020 {
14021 dump_gcov_info ();
14022 return 0;
14023 }
14024
14025 The merge-stream subcommand of gcov-tool may be used to deserialize
14026 the data stream generated by the "__gcov_filename_to_gcfn" and
14027 "__gcov_info_to_gcda" functions and merge the profile information
14028 into .gcda files on the host filesystem.
14029
14030 -fprofile-note=path
14031 If path is specified, GCC saves .gcno file into path location. If
14032 you combine the option with multiple source files, the .gcno file
14033 will be overwritten.
14034
14035 -fprofile-prefix-path=path
14036 This option can be used in combination with
14037 profile-generate=profile_dir and profile-use=profile_dir to inform
14038 GCC where is the base directory of built source tree. By default
14039 profile_dir will contain files with mangled absolute paths of all
14040 object files in the built project. This is not desirable when
14041 directory used to build the instrumented binary differs from the
14042 directory used to build the binary optimized with profile feedback
14043 because the profile data will not be found during the optimized
14044 build. In such setups -fprofile-prefix-path=path with path
14045 pointing to the base directory of the build can be used to strip
14046 the irrelevant part of the path and keep all file names relative to
14047 the main build directory.
14048
14049 -fprofile-prefix-map=old=new
14050 When compiling files residing in directory old, record profiling
14051 information (with --coverage) describing them as if the files
14052 resided in directory new instead. See also -ffile-prefix-map and
14053 -fcanon-prefix-map.
14054
14055 -fprofile-update=method
14056 Alter the update method for an application instrumented for profile
14057 feedback based optimization. The method argument should be one of
14058 single, atomic or prefer-atomic. The first one is useful for
14059 single-threaded applications, while the second one prevents profile
14060 corruption by emitting thread-safe code.
14061
14062 Warning: When an application does not properly join all threads (or
14063 creates an detached thread), a profile file can be still corrupted.
14064
14065 Using prefer-atomic would be transformed either to atomic, when
14066 supported by a target, or to single otherwise. The GCC driver
14067 automatically selects prefer-atomic when -pthread is present in the
14068 command line.
14069
14070 -fprofile-filter-files=regex
14071 Instrument only functions from files whose name matches any of the
14072 regular expressions (separated by semi-colons).
14073
14074 For example, -fprofile-filter-files=main\.c;module.*\.c will
14075 instrument only main.c and all C files starting with 'module'.
14076
14077 -fprofile-exclude-files=regex
14078 Instrument only functions from files whose name does not match any
14079 of the regular expressions (separated by semi-colons).
14080
14081 For example, -fprofile-exclude-files=/usr/.* will prevent
14082 instrumentation of all files that are located in the /usr/ folder.
14083
14084 -fprofile-reproducible=[multithreaded|parallel-runs|serial]
14085 Control level of reproducibility of profile gathered by
14086 "-fprofile-generate". This makes it possible to rebuild program
14087 with same outcome which is useful, for example, for distribution
14088 packages.
14089
14090 With -fprofile-reproducible=serial the profile gathered by
14091 -fprofile-generate is reproducible provided the trained program
14092 behaves the same at each invocation of the train run, it is not
14093 multi-threaded and profile data streaming is always done in the
14094 same order. Note that profile streaming happens at the end of
14095 program run but also before "fork" function is invoked.
14096
14097 Note that it is quite common that execution counts of some part of
14098 programs depends, for example, on length of temporary file names or
14099 memory space randomization (that may affect hash-table collision
14100 rate). Such non-reproducible part of programs may be annotated by
14101 "no_instrument_function" function attribute. gcov-dump with -l can
14102 be used to dump gathered data and verify that they are indeed
14103 reproducible.
14104
14105 With -fprofile-reproducible=parallel-runs collected profile stays
14106 reproducible regardless the order of streaming of the data into
14107 gcda files. This setting makes it possible to run multiple
14108 instances of instrumented program in parallel (such as with "make
14109 -j"). This reduces quality of gathered data, in particular of
14110 indirect call profiling.
14111
14112 -fsanitize=address
14113 Enable AddressSanitizer, a fast memory error detector. Memory
14114 access instructions are instrumented to detect out-of-bounds and
14115 use-after-free bugs. The option enables
14116 -fsanitize-address-use-after-scope. See
14117 <https://github.com/google/sanitizers/wiki/AddressSanitizer> for
14118 more details. The run-time behavior can be influenced using the
14119 ASAN_OPTIONS environment variable. When set to "help=1", the
14120 available options are shown at startup of the instrumented program.
14121 See
14122 <https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags>
14123 for a list of supported options. The option cannot be combined
14124 with -fsanitize=thread or -fsanitize=hwaddress. Note that the only
14125 target -fsanitize=hwaddress is currently supported on is AArch64.
14126
14127 To get more accurate stack traces, it is possible to use options
14128 such as -O0, -O1, or -Og (which, for instance, prevent most
14129 function inlining), -fno-optimize-sibling-calls (which prevents
14130 optimizing sibling and tail recursive calls; this option is
14131 implicit for -O0, -O1, or -Og), or -fno-ipa-icf (which disables
14132 Identical Code Folding for functions). Since multiple runs of the
14133 program may yield backtraces with different addresses due to ASLR
14134 (Address Space Layout Randomization), it may be desirable to turn
14135 ASLR off. On Linux, this can be achieved with setarch `uname -m`
14136 -R ./prog.
14137
14138 -fsanitize=kernel-address
14139 Enable AddressSanitizer for Linux kernel. See
14140 <https://github.com/google/kernel-sanitizers> for more details.
14141
14142 -fsanitize=hwaddress
14143 Enable Hardware-assisted AddressSanitizer, which uses a hardware
14144 ability to ignore the top byte of a pointer to allow the detection
14145 of memory errors with a low memory overhead. Memory access
14146 instructions are instrumented to detect out-of-bounds and use-
14147 after-free bugs. The option enables
14148 -fsanitize-address-use-after-scope. See
14149 <https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html>
14150 for more details. The run-time behavior can be influenced using
14151 the HWASAN_OPTIONS environment variable. When set to "help=1", the
14152 available options are shown at startup of the instrumented program.
14153 The option cannot be combined with -fsanitize=thread or
14154 -fsanitize=address, and is currently only available on AArch64.
14155
14156 -fsanitize=kernel-hwaddress
14157 Enable Hardware-assisted AddressSanitizer for compilation of the
14158 Linux kernel. Similar to -fsanitize=kernel-address but using an
14159 alternate instrumentation method, and similar to
14160 -fsanitize=hwaddress but with instrumentation differences necessary
14161 for compiling the Linux kernel. These differences are to avoid
14162 hwasan library initialization calls and to account for the stack
14163 pointer having a different value in its top byte.
14164
14165 Note: This option has different defaults to the
14166 -fsanitize=hwaddress. Instrumenting the stack and alloca calls are
14167 not on by default but are still possible by specifying the command-
14168 line options --param hwasan-instrument-stack=1 and --param
14169 hwasan-instrument-allocas=1 respectively. Using a random frame tag
14170 is not implemented for kernel instrumentation.
14171
14172 -fsanitize=pointer-compare
14173 Instrument comparison operation (<, <=, >, >=) with pointer
14174 operands. The option must be combined with either
14175 -fsanitize=kernel-address or -fsanitize=address The option cannot
14176 be combined with -fsanitize=thread. Note: By default the check is
14177 disabled at run time. To enable it, add
14178 "detect_invalid_pointer_pairs=2" to the environment variable
14179 ASAN_OPTIONS. Using "detect_invalid_pointer_pairs=1" detects
14180 invalid operation only when both pointers are non-null.
14181
14182 -fsanitize=pointer-subtract
14183 Instrument subtraction with pointer operands. The option must be
14184 combined with either -fsanitize=kernel-address or
14185 -fsanitize=address The option cannot be combined with
14186 -fsanitize=thread. Note: By default the check is disabled at run
14187 time. To enable it, add "detect_invalid_pointer_pairs=2" to the
14188 environment variable ASAN_OPTIONS. Using
14189 "detect_invalid_pointer_pairs=1" detects invalid operation only
14190 when both pointers are non-null.
14191
14192 -fsanitize=shadow-call-stack
14193 Enable ShadowCallStack, a security enhancement mechanism used to
14194 protect programs against return address overwrites (e.g. stack
14195 buffer overflows.) It works by saving a function's return address
14196 to a separately allocated shadow call stack in the function
14197 prologue and restoring the return address from the shadow call
14198 stack in the function epilogue. Instrumentation only occurs in
14199 functions that need to save the return address to the stack.
14200
14201 Currently it only supports the aarch64 platform. It is
14202 specifically designed for linux kernels that enable the
14203 CONFIG_SHADOW_CALL_STACK option. For the user space programs,
14204 runtime support is not currently provided in libc and libgcc.
14205 Users who want to use this feature in user space need to provide
14206 their own support for the runtime. It should be noted that this
14207 may cause the ABI rules to be broken.
14208
14209 On aarch64, the instrumentation makes use of the platform register
14210 "x18". This generally means that any code that may run on the same
14211 thread as code compiled with ShadowCallStack must be compiled with
14212 the flag -ffixed-x18, otherwise functions compiled without
14213 -ffixed-x18 might clobber "x18" and so corrupt the shadow stack
14214 pointer.
14215
14216 Also, because there is no userspace runtime support, code compiled
14217 with ShadowCallStack cannot use exception handling. Use
14218 -fno-exceptions to turn off exceptions.
14219
14220 See <https://clang.llvm.org/docs/ShadowCallStack.html> for more
14221 details.
14222
14223 -fsanitize=thread
14224 Enable ThreadSanitizer, a fast data race detector. Memory access
14225 instructions are instrumented to detect data race bugs. See
14226 <https://github.com/google/sanitizers/wiki#threadsanitizer> for
14227 more details. The run-time behavior can be influenced using the
14228 TSAN_OPTIONS environment variable; see
14229 <https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags>
14230 for a list of supported options. The option cannot be combined
14231 with -fsanitize=address, -fsanitize=leak.
14232
14233 Note that sanitized atomic builtins cannot throw exceptions when
14234 operating on invalid memory addresses with non-call exceptions
14235 (-fnon-call-exceptions).
14236
14237 -fsanitize=leak
14238 Enable LeakSanitizer, a memory leak detector. This option only
14239 matters for linking of executables. The executable is linked
14240 against a library that overrides "malloc" and other allocator
14241 functions. See
14242 <https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer>
14243 for more details. The run-time behavior can be influenced using
14244 the LSAN_OPTIONS environment variable. The option cannot be
14245 combined with -fsanitize=thread.
14246
14247 -fsanitize=undefined
14248 Enable UndefinedBehaviorSanitizer, a fast undefined behavior
14249 detector. Various computations are instrumented to detect
14250 undefined behavior at runtime. See
14251 <https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html> for
14252 more details. The run-time behavior can be influenced using the
14253 UBSAN_OPTIONS environment variable. Current suboptions are:
14254
14255 -fsanitize=shift
14256 This option enables checking that the result of a shift
14257 operation is not undefined. Note that what exactly is
14258 considered undefined differs slightly between C and C++, as
14259 well as between ISO C90 and C99, etc. This option has two
14260 suboptions, -fsanitize=shift-base and
14261 -fsanitize=shift-exponent.
14262
14263 -fsanitize=shift-exponent
14264 This option enables checking that the second argument of a
14265 shift operation is not negative and is smaller than the
14266 precision of the promoted first argument.
14267
14268 -fsanitize=shift-base
14269 If the second argument of a shift operation is within range,
14270 check that the result of a shift operation is not undefined.
14271 Note that what exactly is considered undefined differs slightly
14272 between C and C++, as well as between ISO C90 and C99, etc.
14273
14274 -fsanitize=integer-divide-by-zero
14275 Detect integer division by zero.
14276
14277 -fsanitize=unreachable
14278 With this option, the compiler turns the
14279 "__builtin_unreachable" call into a diagnostics message call
14280 instead. When reaching the "__builtin_unreachable" call, the
14281 behavior is undefined.
14282
14283 -fsanitize=vla-bound
14284 This option instructs the compiler to check that the size of a
14285 variable length array is positive.
14286
14287 -fsanitize=null
14288 This option enables pointer checking. Particularly, the
14289 application built with this option turned on will issue an
14290 error message when it tries to dereference a NULL pointer, or
14291 if a reference (possibly an rvalue reference) is bound to a
14292 NULL pointer, or if a method is invoked on an object pointed by
14293 a NULL pointer.
14294
14295 -fsanitize=return
14296 This option enables return statement checking. Programs built
14297 with this option turned on will issue an error message when the
14298 end of a non-void function is reached without actually
14299 returning a value. This option works in C++ only.
14300
14301 -fsanitize=signed-integer-overflow
14302 This option enables signed integer overflow checking. We check
14303 that the result of "+", "*", and both unary and binary "-" does
14304 not overflow in the signed arithmetics. This also detects
14305 "INT_MIN / -1" signed division. Note, integer promotion rules
14306 must be taken into account. That is, the following is not an
14307 overflow:
14308
14309 signed char a = SCHAR_MAX;
14310 a++;
14311
14312 -fsanitize=bounds
14313 This option enables instrumentation of array bounds. Various
14314 out of bounds accesses are detected. Flexible array members,
14315 flexible array member-like arrays, and initializers of
14316 variables with static storage are not instrumented, with the
14317 exception of flexible array member-like arrays for which
14318 "-fstrict-flex-arrays" or "-fstrict-flex-arrays=" options or
14319 "strict_flex_array" attributes say they shouldn't be treated
14320 like flexible array member-like arrays.
14321
14322 -fsanitize=bounds-strict
14323 This option enables strict instrumentation of array bounds.
14324 Most out of bounds accesses are detected, including flexible
14325 array member-like arrays. Initializers of variables with
14326 static storage are not instrumented.
14327
14328 -fsanitize=alignment
14329 This option enables checking of alignment of pointers when they
14330 are dereferenced, or when a reference is bound to
14331 insufficiently aligned target, or when a method or constructor
14332 is invoked on insufficiently aligned object.
14333
14334 -fsanitize=object-size
14335 This option enables instrumentation of memory references using
14336 the "__builtin_dynamic_object_size" function. Various out of
14337 bounds pointer accesses are detected.
14338
14339 -fsanitize=float-divide-by-zero
14340 Detect floating-point division by zero. Unlike other similar
14341 options, -fsanitize=float-divide-by-zero is not enabled by
14342 -fsanitize=undefined, since floating-point division by zero can
14343 be a legitimate way of obtaining infinities and NaNs.
14344
14345 -fsanitize=float-cast-overflow
14346 This option enables floating-point type to integer conversion
14347 checking. We check that the result of the conversion does not
14348 overflow. Unlike other similar options,
14349 -fsanitize=float-cast-overflow is not enabled by
14350 -fsanitize=undefined. This option does not work well with
14351 "FE_INVALID" exceptions enabled.
14352
14353 -fsanitize=nonnull-attribute
14354 This option enables instrumentation of calls, checking whether
14355 null values are not passed to arguments marked as requiring a
14356 non-null value by the "nonnull" function attribute.
14357
14358 -fsanitize=returns-nonnull-attribute
14359 This option enables instrumentation of return statements in
14360 functions marked with "returns_nonnull" function attribute, to
14361 detect returning of null values from such functions.
14362
14363 -fsanitize=bool
14364 This option enables instrumentation of loads from bool. If a
14365 value other than 0/1 is loaded, a run-time error is issued.
14366
14367 -fsanitize=enum
14368 This option enables instrumentation of loads from an enum type.
14369 If a value outside the range of values for the enum type is
14370 loaded, a run-time error is issued.
14371
14372 -fsanitize=vptr
14373 This option enables instrumentation of C++ member function
14374 calls, member accesses and some conversions between pointers to
14375 base and derived classes, to verify the referenced object has
14376 the correct dynamic type.
14377
14378 -fsanitize=pointer-overflow
14379 This option enables instrumentation of pointer arithmetics. If
14380 the pointer arithmetics overflows, a run-time error is issued.
14381
14382 -fsanitize=builtin
14383 This option enables instrumentation of arguments to selected
14384 builtin functions. If an invalid value is passed to such
14385 arguments, a run-time error is issued. E.g. passing 0 as the
14386 argument to "__builtin_ctz" or "__builtin_clz" invokes
14387 undefined behavior and is diagnosed by this option.
14388
14389 Note that sanitizers tend to increase the rate of false positive
14390 warnings, most notably those around -Wmaybe-uninitialized. We
14391 recommend against combining -Werror and [the use of] sanitizers.
14392
14393 While -ftrapv causes traps for signed overflows to be emitted,
14394 -fsanitize=undefined gives a diagnostic message. This currently
14395 works only for the C family of languages.
14396
14397 -fno-sanitize=all
14398 This option disables all previously enabled sanitizers.
14399 -fsanitize=all is not allowed, as some sanitizers cannot be used
14400 together.
14401
14402 -fasan-shadow-offset=number
14403 This option forces GCC to use custom shadow offset in
14404 AddressSanitizer checks. It is useful for experimenting with
14405 different shadow memory layouts in Kernel AddressSanitizer.
14406
14407 -fsanitize-sections=s1,s2,...
14408 Sanitize global variables in selected user-defined sections. si
14409 may contain wildcards.
14410
14411 -fsanitize-recover[=opts]
14412 -fsanitize-recover= controls error recovery mode for sanitizers
14413 mentioned in comma-separated list of opts. Enabling this option
14414 for a sanitizer component causes it to attempt to continue running
14415 the program as if no error happened. This means multiple runtime
14416 errors can be reported in a single program run, and the exit code
14417 of the program may indicate success even when errors have been
14418 reported. The -fno-sanitize-recover= option can be used to alter
14419 this behavior: only the first detected error is reported and
14420 program then exits with a non-zero exit code.
14421
14422 Currently this feature only works for -fsanitize=undefined (and its
14423 suboptions except for -fsanitize=unreachable and
14424 -fsanitize=return), -fsanitize=float-cast-overflow,
14425 -fsanitize=float-divide-by-zero, -fsanitize=bounds-strict,
14426 -fsanitize=kernel-address and -fsanitize=address. For these
14427 sanitizers error recovery is turned on by default, except
14428 -fsanitize=address, for which this feature is experimental.
14429 -fsanitize-recover=all and -fno-sanitize-recover=all is also
14430 accepted, the former enables recovery for all sanitizers that
14431 support it, the latter disables recovery for all sanitizers that
14432 support it.
14433
14434 Even if a recovery mode is turned on the compiler side, it needs to
14435 be also enabled on the runtime library side, otherwise the failures
14436 are still fatal. The runtime library defaults to "halt_on_error=0"
14437 for ThreadSanitizer and UndefinedBehaviorSanitizer, while default
14438 value for AddressSanitizer is "halt_on_error=1". This can be
14439 overridden through setting the "halt_on_error" flag in the
14440 corresponding environment variable.
14441
14442 Syntax without an explicit opts parameter is deprecated. It is
14443 equivalent to specifying an opts list of:
14444
14445 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
14446
14447 -fsanitize-address-use-after-scope
14448 Enable sanitization of local variables to detect use-after-scope
14449 bugs. The option sets -fstack-reuse to none.
14450
14451 -fsanitize-trap[=opts]
14452 The -fsanitize-trap= option instructs the compiler to report for
14453 sanitizers mentioned in comma-separated list of opts undefined
14454 behavior using "__builtin_trap" rather than a "libubsan" library
14455 routine. If this option is enabled for certain sanitizer, it takes
14456 precedence over the -fsanitizer-recover= for that sanitizer,
14457 "__builtin_trap" will be emitted and be fatal regardless of whether
14458 recovery is enabled or disabled using -fsanitize-recover=.
14459
14460 The advantage of this is that the "libubsan" library is not needed
14461 and is not linked in, so this is usable even in freestanding
14462 environments.
14463
14464 Currently this feature works with -fsanitize=undefined (and its
14465 suboptions except for -fsanitize=vptr),
14466 -fsanitize=float-cast-overflow, -fsanitize=float-divide-by-zero and
14467 -fsanitize=bounds-strict. "-fsanitize-trap=all" can be also
14468 specified, which enables it for "undefined" suboptions,
14469 -fsanitize=float-cast-overflow, -fsanitize=float-divide-by-zero and
14470 -fsanitize=bounds-strict. If "-fsanitize-trap=undefined" or
14471 "-fsanitize-trap=all" is used and "-fsanitize=vptr" is enabled on
14472 the command line, the instrumentation is silently ignored as the
14473 instrumentation always needs "libubsan" support,
14474 -fsanitize-trap=vptr is not allowed.
14475
14476 -fsanitize-undefined-trap-on-error
14477 The -fsanitize-undefined-trap-on-error option is deprecated
14478 equivalent of -fsanitize-trap=all.
14479
14480 -fsanitize-coverage=trace-pc
14481 Enable coverage-guided fuzzing code instrumentation. Inserts a
14482 call to "__sanitizer_cov_trace_pc" into every basic block.
14483
14484 -fsanitize-coverage=trace-cmp
14485 Enable dataflow guided fuzzing code instrumentation. Inserts a
14486 call to "__sanitizer_cov_trace_cmp1", "__sanitizer_cov_trace_cmp2",
14487 "__sanitizer_cov_trace_cmp4" or "__sanitizer_cov_trace_cmp8" for
14488 integral comparison with both operands variable or
14489 "__sanitizer_cov_trace_const_cmp1",
14490 "__sanitizer_cov_trace_const_cmp2",
14491 "__sanitizer_cov_trace_const_cmp4" or
14492 "__sanitizer_cov_trace_const_cmp8" for integral comparison with one
14493 operand constant, "__sanitizer_cov_trace_cmpf" or
14494 "__sanitizer_cov_trace_cmpd" for float or double comparisons and
14495 "__sanitizer_cov_trace_switch" for switch statements.
14496
14497 -fcf-protection=[full|branch|return|none|check]
14498 Enable code instrumentation of control-flow transfers to increase
14499 program security by checking that target addresses of control-flow
14500 transfer instructions (such as indirect function call, function
14501 return, indirect jump) are valid. This prevents diverting the flow
14502 of control to an unexpected target. This is intended to protect
14503 against such threats as Return-oriented Programming (ROP), and
14504 similarly call/jmp-oriented programming (COP/JOP).
14505
14506 The value "branch" tells the compiler to implement checking of
14507 validity of control-flow transfer at the point of indirect branch
14508 instructions, i.e. call/jmp instructions. The value "return"
14509 implements checking of validity at the point of returning from a
14510 function. The value "full" is an alias for specifying both
14511 "branch" and "return". The value "none" turns off instrumentation.
14512
14513 The value "check" is used for the final link with link-time
14514 optimization (LTO). An error is issued if LTO object files are
14515 compiled with different -fcf-protection values. The value "check"
14516 is ignored at the compile time.
14517
14518 The macro "__CET__" is defined when -fcf-protection is used. The
14519 first bit of "__CET__" is set to 1 for the value "branch" and the
14520 second bit of "__CET__" is set to 1 for the "return".
14521
14522 You can also use the "nocf_check" attribute to identify which
14523 functions and calls should be skipped from instrumentation.
14524
14525 Currently the x86 GNU/Linux target provides an implementation based
14526 on Intel Control-flow Enforcement Technology (CET) which works for
14527 i686 processor or newer.
14528
14529 -fharden-compares
14530 For every logical test that survives gimple optimizations and is
14531 not the condition in a conditional branch (for example, conditions
14532 tested for conditional moves, or to store in boolean variables),
14533 emit extra code to compute and verify the reversed condition, and
14534 to call "__builtin_trap" if the results do not match. Use with
14535 -fharden-conditional-branches to cover all conditionals.
14536
14537 -fharden-conditional-branches
14538 For every non-vectorized conditional branch that survives gimple
14539 optimizations, emit extra code to compute and verify the reversed
14540 condition, and to call "__builtin_trap" if the result is
14541 unexpected. Use with -fharden-compares to cover all conditionals.
14542
14543 -fstack-protector
14544 Emit extra code to check for buffer overflows, such as stack
14545 smashing attacks. This is done by adding a guard variable to
14546 functions with vulnerable objects. This includes functions that
14547 call "alloca", and functions with buffers larger than or equal to 8
14548 bytes. The guards are initialized when a function is entered and
14549 then checked when the function exits. If a guard check fails, an
14550 error message is printed and the program exits. Only variables
14551 that are actually allocated on the stack are considered, optimized
14552 away variables or variables allocated in registers don't count.
14553
14554 -fstack-protector-all
14555 Like -fstack-protector except that all functions are protected.
14556
14557 -fstack-protector-strong
14558 Like -fstack-protector but includes additional functions to be
14559 protected --- those that have local array definitions, or have
14560 references to local frame addresses. Only variables that are
14561 actually allocated on the stack are considered, optimized away
14562 variables or variables allocated in registers don't count.
14563
14564 -fstack-protector-explicit
14565 Like -fstack-protector but only protects those functions which have
14566 the "stack_protect" attribute.
14567
14568 -fstack-check
14569 Generate code to verify that you do not go beyond the boundary of
14570 the stack. You should specify this flag if you are running in an
14571 environment with multiple threads, but you only rarely need to
14572 specify it in a single-threaded environment since stack overflow is
14573 automatically detected on nearly all systems if there is only one
14574 stack.
14575
14576 Note that this switch does not actually cause checking to be done;
14577 the operating system or the language runtime must do that. The
14578 switch causes generation of code to ensure that they see the stack
14579 being extended.
14580
14581 You can additionally specify a string parameter: no means no
14582 checking, generic means force the use of old-style checking,
14583 specific means use the best checking method and is equivalent to
14584 bare -fstack-check.
14585
14586 Old-style checking is a generic mechanism that requires no specific
14587 target support in the compiler but comes with the following
14588 drawbacks:
14589
14590 1. Modified allocation strategy for large objects: they are always
14591 allocated dynamically if their size exceeds a fixed threshold.
14592 Note this may change the semantics of some code.
14593
14594 2. Fixed limit on the size of the static frame of functions: when
14595 it is topped by a particular function, stack checking is not
14596 reliable and a warning is issued by the compiler.
14597
14598 3. Inefficiency: because of both the modified allocation strategy
14599 and the generic implementation, code performance is hampered.
14600
14601 Note that old-style stack checking is also the fallback method for
14602 specific if no target support has been added in the compiler.
14603
14604 -fstack-check= is designed for Ada's needs to detect infinite
14605 recursion and stack overflows. specific is an excellent choice
14606 when compiling Ada code. It is not generally sufficient to protect
14607 against stack-clash attacks. To protect against those you want
14608 -fstack-clash-protection.
14609
14610 -fstack-clash-protection
14611 Generate code to prevent stack clash style attacks. When this
14612 option is enabled, the compiler will only allocate one page of
14613 stack space at a time and each page is accessed immediately after
14614 allocation. Thus, it prevents allocations from jumping over any
14615 stack guard page provided by the operating system.
14616
14617 Most targets do not fully support stack clash protection. However,
14618 on those targets -fstack-clash-protection will protect dynamic
14619 stack allocations. -fstack-clash-protection may also provide
14620 limited protection for static stack allocations if the target
14621 supports -fstack-check=specific.
14622
14623 -fstack-limit-register=reg
14624 -fstack-limit-symbol=sym
14625 -fno-stack-limit
14626 Generate code to ensure that the stack does not grow beyond a
14627 certain value, either the value of a register or the address of a
14628 symbol. If a larger stack is required, a signal is raised at run
14629 time. For most targets, the signal is raised before the stack
14630 overruns the boundary, so it is possible to catch the signal
14631 without taking special precautions.
14632
14633 For instance, if the stack starts at absolute address 0x80000000
14634 and grows downwards, you can use the flags
14635 -fstack-limit-symbol=__stack_limit and
14636 -Wl,--defsym,__stack_limit=0x7ffe0000 to enforce a stack limit of
14637 128KB. Note that this may only work with the GNU linker.
14638
14639 You can locally override stack limit checking by using the
14640 "no_stack_limit" function attribute.
14641
14642 -fsplit-stack
14643 Generate code to automatically split the stack before it overflows.
14644 The resulting program has a discontiguous stack which can only
14645 overflow if the program is unable to allocate any more memory.
14646 This is most useful when running threaded programs, as it is no
14647 longer necessary to calculate a good stack size to use for each
14648 thread. This is currently only implemented for the x86 targets
14649 running GNU/Linux.
14650
14651 When code compiled with -fsplit-stack calls code compiled without
14652 -fsplit-stack, there may not be much stack space available for the
14653 latter code to run. If compiling all code, including library code,
14654 with -fsplit-stack is not an option, then the linker can fix up
14655 these calls so that the code compiled without -fsplit-stack always
14656 has a large stack. Support for this is implemented in the gold
14657 linker in GNU binutils release 2.21 and later.
14658
14659 -fvtable-verify=[std|preinit|none]
14660 This option is only available when compiling C++ code. It turns on
14661 (or off, if using -fvtable-verify=none) the security feature that
14662 verifies at run time, for every virtual call, that the vtable
14663 pointer through which the call is made is valid for the type of the
14664 object, and has not been corrupted or overwritten. If an invalid
14665 vtable pointer is detected at run time, an error is reported and
14666 execution of the program is immediately halted.
14667
14668 This option causes run-time data structures to be built at program
14669 startup, which are used for verifying the vtable pointers. The
14670 options std and preinit control the timing of when these data
14671 structures are built. In both cases the data structures are built
14672 before execution reaches "main". Using -fvtable-verify=std causes
14673 the data structures to be built after shared libraries have been
14674 loaded and initialized. -fvtable-verify=preinit causes them to be
14675 built before shared libraries have been loaded and initialized.
14676
14677 If this option appears multiple times in the command line with
14678 different values specified, none takes highest priority over both
14679 std and preinit; preinit takes priority over std.
14680
14681 -fvtv-debug
14682 When used in conjunction with -fvtable-verify=std or
14683 -fvtable-verify=preinit, causes debug versions of the runtime
14684 functions for the vtable verification feature to be called. This
14685 flag also causes the compiler to log information about which vtable
14686 pointers it finds for each class. This information is written to a
14687 file named vtv_set_ptr_data.log in the directory named by the
14688 environment variable VTV_LOGS_DIR if that is defined or the current
14689 working directory otherwise.
14690
14691 Note: This feature appends data to the log file. If you want a
14692 fresh log file, be sure to delete any existing one.
14693
14694 -fvtv-counts
14695 This is a debugging flag. When used in conjunction with
14696 -fvtable-verify=std or -fvtable-verify=preinit, this causes the
14697 compiler to keep track of the total number of virtual calls it
14698 encounters and the number of verifications it inserts. It also
14699 counts the number of calls to certain run-time library functions
14700 that it inserts and logs this information for each compilation
14701 unit. The compiler writes this information to a file named
14702 vtv_count_data.log in the directory named by the environment
14703 variable VTV_LOGS_DIR if that is defined or the current working
14704 directory otherwise. It also counts the size of the vtable pointer
14705 sets for each class, and writes this information to
14706 vtv_class_set_sizes.log in the same directory.
14707
14708 Note: This feature appends data to the log files. To get fresh
14709 log files, be sure to delete any existing ones.
14710
14711 -finstrument-functions
14712 Generate instrumentation calls for entry and exit to functions.
14713 Just after function entry and just before function exit, the
14714 following profiling functions are called with the address of the
14715 current function and its call site. (On some platforms,
14716 "__builtin_return_address" does not work beyond the current
14717 function, so the call site information may not be available to the
14718 profiling functions otherwise.)
14719
14720 void __cyg_profile_func_enter (void *this_fn,
14721 void *call_site);
14722 void __cyg_profile_func_exit (void *this_fn,
14723 void *call_site);
14724
14725 The first argument is the address of the start of the current
14726 function, which may be looked up exactly in the symbol table.
14727
14728 This instrumentation is also done for functions expanded inline in
14729 other functions. The profiling calls indicate where, conceptually,
14730 the inline function is entered and exited. This means that
14731 addressable versions of such functions must be available. If all
14732 your uses of a function are expanded inline, this may mean an
14733 additional expansion of code size. If you use "extern inline" in
14734 your C code, an addressable version of such functions must be
14735 provided. (This is normally the case anyway, but if you get lucky
14736 and the optimizer always expands the functions inline, you might
14737 have gotten away without providing static copies.)
14738
14739 A function may be given the attribute "no_instrument_function", in
14740 which case this instrumentation is not done. This can be used, for
14741 example, for the profiling functions listed above, high-priority
14742 interrupt routines, and any functions from which the profiling
14743 functions cannot safely be called (perhaps signal handlers, if the
14744 profiling routines generate output or allocate memory).
14745
14746 -finstrument-functions-once
14747 This is similar to -finstrument-functions, but the profiling
14748 functions are called only once per instrumented function, i.e. the
14749 first profiling function is called after the first entry into the
14750 instrumented function and the second profiling function is called
14751 before the exit corresponding to this first entry.
14752
14753 The definition of "once" for the purpose of this option is a little
14754 vague because the implementation is not protected against data
14755 races. As a result, the implementation only guarantees that the
14756 profiling functions are called at least once per process and at
14757 most once per thread, but the calls are always paired, that is to
14758 say, if a thread calls the first function, then it will call the
14759 second function, unless it never reaches the exit of the
14760 instrumented function.
14761
14762 -finstrument-functions-exclude-file-list=file,file,...
14763 Set the list of functions that are excluded from instrumentation
14764 (see the description of -finstrument-functions). If the file that
14765 contains a function definition matches with one of file, then that
14766 function is not instrumented. The match is done on substrings: if
14767 the file parameter is a substring of the file name, it is
14768 considered to be a match.
14769
14770 For example:
14771
14772 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
14773
14774 excludes any inline function defined in files whose pathnames
14775 contain /bits/stl or include/sys.
14776
14777 If, for some reason, you want to include letter , in one of sym,
14778 write ,. For example,
14779 -finstrument-functions-exclude-file-list=',,tmp' (note the single
14780 quote surrounding the option).
14781
14782 -finstrument-functions-exclude-function-list=sym,sym,...
14783 This is similar to -finstrument-functions-exclude-file-list, but
14784 this option sets the list of function names to be excluded from
14785 instrumentation. The function name to be matched is its user-
14786 visible name, such as "vector<int> blah(const vector<int> &)", not
14787 the internal mangled name (e.g., "_Z4blahRSt6vectorIiSaIiEE"). The
14788 match is done on substrings: if the sym parameter is a substring of
14789 the function name, it is considered to be a match. For C99 and C++
14790 extended identifiers, the function name must be given in UTF-8, not
14791 using universal character names.
14792
14793 -fpatchable-function-entry=N[,M]
14794 Generate N NOPs right at the beginning of each function, with the
14795 function entry point before the Mth NOP. If M is omitted, it
14796 defaults to 0 so the function entry points to the address just at
14797 the first NOP. The NOP instructions reserve extra space which can
14798 be used to patch in any desired instrumentation at run time,
14799 provided that the code segment is writable. The amount of space is
14800 controllable indirectly via the number of NOPs; the NOP instruction
14801 used corresponds to the instruction emitted by the internal GCC
14802 back-end interface "gen_nop". This behavior is target-specific and
14803 may also depend on the architecture variant and/or other
14804 compilation options.
14805
14806 For run-time identification, the starting addresses of these areas,
14807 which correspond to their respective function entries minus M, are
14808 additionally collected in the "__patchable_function_entries"
14809 section of the resulting binary.
14810
14811 Note that the value of "__attribute__ ((patchable_function_entry
14812 (N,M)))" takes precedence over command-line option
14813 -fpatchable-function-entry=N,M. This can be used to increase the
14814 area size or to remove it completely on a single function. If
14815 "N=0", no pad location is recorded.
14816
14817 The NOP instructions are inserted at---and maybe before, depending
14818 on M---the function entry address, even before the prologue. On
14819 PowerPC with the ELFv2 ABI, for a function with dual entry points,
14820 the local entry point is this function entry address.
14821
14822 The maximum value of N and M is 65535. On PowerPC with the ELFv2
14823 ABI, for a function with dual entry points, the supported values
14824 for M are 0, 2, 6 and 14.
14825
14826 Options Controlling the Preprocessor
14827 These options control the C preprocessor, which is run on each C source
14828 file before actual compilation.
14829
14830 If you use the -E option, nothing is done except preprocessing. Some
14831 of these options make sense only together with -E because they cause
14832 the preprocessor output to be unsuitable for actual compilation.
14833
14834 In addition to the options listed here, there are a number of options
14835 to control search paths for include files documented in Directory
14836 Options. Options to control preprocessor diagnostics are listed in
14837 Warning Options.
14838
14839 -D name
14840 Predefine name as a macro, with definition 1.
14841
14842 -D name=definition
14843 The contents of definition are tokenized and processed as if they
14844 appeared during translation phase three in a #define directive. In
14845 particular, the definition is truncated by embedded newline
14846 characters.
14847
14848 If you are invoking the preprocessor from a shell or shell-like
14849 program you may need to use the shell's quoting syntax to protect
14850 characters such as spaces that have a meaning in the shell syntax.
14851
14852 If you wish to define a function-like macro on the command line,
14853 write its argument list with surrounding parentheses before the
14854 equals sign (if any). Parentheses are meaningful to most shells,
14855 so you should quote the option. With sh and csh,
14856 -D'name(args...)=definition' works.
14857
14858 -D and -U options are processed in the order they are given on the
14859 command line. All -imacros file and -include file options are
14860 processed after all -D and -U options.
14861
14862 -U name
14863 Cancel any previous definition of name, either built in or provided
14864 with a -D option.
14865
14866 -include file
14867 Process file as if "#include "file"" appeared as the first line of
14868 the primary source file. However, the first directory searched for
14869 file is the preprocessor's working directory instead of the
14870 directory containing the main source file. If not found there, it
14871 is searched for in the remainder of the "#include "..."" search
14872 chain as normal.
14873
14874 If multiple -include options are given, the files are included in
14875 the order they appear on the command line.
14876
14877 -imacros file
14878 Exactly like -include, except that any output produced by scanning
14879 file is thrown away. Macros it defines remain defined. This
14880 allows you to acquire all the macros from a header without also
14881 processing its declarations.
14882
14883 All files specified by -imacros are processed before all files
14884 specified by -include.
14885
14886 -undef
14887 Do not predefine any system-specific or GCC-specific macros. The
14888 standard predefined macros remain defined.
14889
14890 -pthread
14891 Define additional macros required for using the POSIX threads
14892 library. You should use this option consistently for both
14893 compilation and linking. This option is supported on GNU/Linux
14894 targets, most other Unix derivatives, and also on x86 Cygwin and
14895 MinGW targets.
14896
14897 -M Instead of outputting the result of preprocessing, output a rule
14898 suitable for make describing the dependencies of the main source
14899 file. The preprocessor outputs one make rule containing the object
14900 file name for that source file, a colon, and the names of all the
14901 included files, including those coming from -include or -imacros
14902 command-line options.
14903
14904 Unless specified explicitly (with -MT or -MQ), the object file name
14905 consists of the name of the source file with any suffix replaced
14906 with object file suffix and with any leading directory parts
14907 removed. If there are many included files then the rule is split
14908 into several lines using \-newline. The rule has no commands.
14909
14910 This option does not suppress the preprocessor's debug output, such
14911 as -dM. To avoid mixing such debug output with the dependency
14912 rules you should explicitly specify the dependency output file with
14913 -MF, or use an environment variable like DEPENDENCIES_OUTPUT.
14914 Debug output is still sent to the regular output stream as normal.
14915
14916 Passing -M to the driver implies -E, and suppresses warnings with
14917 an implicit -w.
14918
14919 -MM Like -M but do not mention header files that are found in system
14920 header directories, nor header files that are included, directly or
14921 indirectly, from such a header.
14922
14923 This implies that the choice of angle brackets or double quotes in
14924 an #include directive does not in itself determine whether that
14925 header appears in -MM dependency output.
14926
14927 -MF file
14928 When used with -M or -MM, specifies a file to write the
14929 dependencies to. If no -MF switch is given the preprocessor sends
14930 the rules to the same place it would send preprocessed output.
14931
14932 When used with the driver options -MD or -MMD, -MF overrides the
14933 default dependency output file.
14934
14935 If file is -, then the dependencies are written to stdout.
14936
14937 -MG In conjunction with an option such as -M requesting dependency
14938 generation, -MG assumes missing header files are generated files
14939 and adds them to the dependency list without raising an error. The
14940 dependency filename is taken directly from the "#include" directive
14941 without prepending any path. -MG also suppresses preprocessed
14942 output, as a missing header file renders this useless.
14943
14944 This feature is used in automatic updating of makefiles.
14945
14946 -Mno-modules
14947 Disable dependency generation for compiled module interfaces.
14948
14949 -MP This option instructs CPP to add a phony target for each dependency
14950 other than the main file, causing each to depend on nothing. These
14951 dummy rules work around errors make gives if you remove header
14952 files without updating the Makefile to match.
14953
14954 This is typical output:
14955
14956 test.o: test.c test.h
14957
14958 test.h:
14959
14960 -MT target
14961 Change the target of the rule emitted by dependency generation. By
14962 default CPP takes the name of the main input file, deletes any
14963 directory components and any file suffix such as .c, and appends
14964 the platform's usual object suffix. The result is the target.
14965
14966 An -MT option sets the target to be exactly the string you specify.
14967 If you want multiple targets, you can specify them as a single
14968 argument to -MT, or use multiple -MT options.
14969
14970 For example, -MT '$(objpfx)foo.o' might give
14971
14972 $(objpfx)foo.o: foo.c
14973
14974 -MQ target
14975 Same as -MT, but it quotes any characters which are special to
14976 Make. -MQ '$(objpfx)foo.o' gives
14977
14978 $$(objpfx)foo.o: foo.c
14979
14980 The default target is automatically quoted, as if it were given
14981 with -MQ.
14982
14983 -MD -MD is equivalent to -M -MF file, except that -E is not implied.
14984 The driver determines file based on whether an -o option is given.
14985 If it is, the driver uses its argument but with a suffix of .d,
14986 otherwise it takes the name of the input file, removes any
14987 directory components and suffix, and applies a .d suffix.
14988
14989 If -MD is used in conjunction with -E, any -o switch is understood
14990 to specify the dependency output file, but if used without -E, each
14991 -o is understood to specify a target object file.
14992
14993 Since -E is not implied, -MD can be used to generate a dependency
14994 output file as a side effect of the compilation process.
14995
14996 -MMD
14997 Like -MD except mention only user header files, not system header
14998 files.
14999
15000 -fpreprocessed
15001 Indicate to the preprocessor that the input file has already been
15002 preprocessed. This suppresses things like macro expansion,
15003 trigraph conversion, escaped newline splicing, and processing of
15004 most directives. The preprocessor still recognizes and removes
15005 comments, so that you can pass a file preprocessed with -C to the
15006 compiler without problems. In this mode the integrated
15007 preprocessor is little more than a tokenizer for the front ends.
15008
15009 -fpreprocessed is implicit if the input file has one of the
15010 extensions .i, .ii or .mi. These are the extensions that GCC uses
15011 for preprocessed files created by -save-temps.
15012
15013 -fdirectives-only
15014 When preprocessing, handle directives, but do not expand macros.
15015
15016 The option's behavior depends on the -E and -fpreprocessed options.
15017
15018 With -E, preprocessing is limited to the handling of directives
15019 such as "#define", "#ifdef", and "#error". Other preprocessor
15020 operations, such as macro expansion and trigraph conversion are not
15021 performed. In addition, the -dD option is implicitly enabled.
15022
15023 With -fpreprocessed, predefinition of command line and most builtin
15024 macros is disabled. Macros such as "__LINE__", which are
15025 contextually dependent, are handled normally. This enables
15026 compilation of files previously preprocessed with "-E
15027 -fdirectives-only".
15028
15029 With both -E and -fpreprocessed, the rules for -fpreprocessed take
15030 precedence. This enables full preprocessing of files previously
15031 preprocessed with "-E -fdirectives-only".
15032
15033 -fdollars-in-identifiers
15034 Accept $ in identifiers.
15035
15036 -fextended-identifiers
15037 Accept universal character names and extended characters in
15038 identifiers. This option is enabled by default for C99 (and later
15039 C standard versions) and C++.
15040
15041 -fno-canonical-system-headers
15042 When preprocessing, do not shorten system header paths with
15043 canonicalization.
15044
15045 -fmax-include-depth=depth
15046 Set the maximum depth of the nested #include. The default is 200.
15047
15048 -ftabstop=width
15049 Set the distance between tab stops. This helps the preprocessor
15050 report correct column numbers in warnings or errors, even if tabs
15051 appear on the line. If the value is less than 1 or greater than
15052 100, the option is ignored. The default is 8.
15053
15054 -ftrack-macro-expansion[=level]
15055 Track locations of tokens across macro expansions. This allows the
15056 compiler to emit diagnostic about the current macro expansion stack
15057 when a compilation error occurs in a macro expansion. Using this
15058 option makes the preprocessor and the compiler consume more memory.
15059 The level parameter can be used to choose the level of precision of
15060 token location tracking thus decreasing the memory consumption if
15061 necessary. Value 0 of level de-activates this option. Value 1
15062 tracks tokens locations in a degraded mode for the sake of minimal
15063 memory overhead. In this mode all tokens resulting from the
15064 expansion of an argument of a function-like macro have the same
15065 location. Value 2 tracks tokens locations completely. This value is
15066 the most memory hungry. When this option is given no argument, the
15067 default parameter value is 2.
15068
15069 Note that "-ftrack-macro-expansion=2" is activated by default.
15070
15071 -fmacro-prefix-map=old=new
15072 When preprocessing files residing in directory old, expand the
15073 "__FILE__" and "__BASE_FILE__" macros as if the files resided in
15074 directory new instead. This can be used to change an absolute path
15075 to a relative path by using . for new which can result in more
15076 reproducible builds that are location independent. This option
15077 also affects "__builtin_FILE()" during compilation. See also
15078 -ffile-prefix-map and -fcanon-prefix-map.
15079
15080 -fexec-charset=charset
15081 Set the execution character set, used for string and character
15082 constants. The default is UTF-8. charset can be any encoding
15083 supported by the system's "iconv" library routine.
15084
15085 -fwide-exec-charset=charset
15086 Set the wide execution character set, used for wide string and
15087 character constants. The default is one of UTF-32BE, UTF-32LE,
15088 UTF-16BE, or UTF-16LE, whichever corresponds to the width of
15089 "wchar_t" and the big-endian or little-endian byte order being used
15090 for code generation. As with -fexec-charset, charset can be any
15091 encoding supported by the system's "iconv" library routine;
15092 however, you will have problems with encodings that do not fit
15093 exactly in "wchar_t".
15094
15095 -finput-charset=charset
15096 Set the input character set, used for translation from the
15097 character set of the input file to the source character set used by
15098 GCC. If the locale does not specify, or GCC cannot get this
15099 information from the locale, the default is UTF-8. This can be
15100 overridden by either the locale or this command-line option.
15101 Currently the command-line option takes precedence if there's a
15102 conflict. charset can be any encoding supported by the system's
15103 "iconv" library routine.
15104
15105 -fpch-deps
15106 When using precompiled headers, this flag causes the dependency-
15107 output flags to also list the files from the precompiled header's
15108 dependencies. If not specified, only the precompiled header are
15109 listed and not the files that were used to create it, because those
15110 files are not consulted when a precompiled header is used.
15111
15112 -fpch-preprocess
15113 This option allows use of a precompiled header together with -E.
15114 It inserts a special "#pragma", "#pragma GCC pch_preprocess
15115 "filename"" in the output to mark the place where the precompiled
15116 header was found, and its filename. When -fpreprocessed is in use,
15117 GCC recognizes this "#pragma" and loads the PCH.
15118
15119 This option is off by default, because the resulting preprocessed
15120 output is only really suitable as input to GCC. It is switched on
15121 by -save-temps.
15122
15123 You should not write this "#pragma" in your own code, but it is
15124 safe to edit the filename if the PCH file is available in a
15125 different location. The filename may be absolute or it may be
15126 relative to GCC's current directory.
15127
15128 -fworking-directory
15129 Enable generation of linemarkers in the preprocessor output that
15130 let the compiler know the current working directory at the time of
15131 preprocessing. When this option is enabled, the preprocessor
15132 emits, after the initial linemarker, a second linemarker with the
15133 current working directory followed by two slashes. GCC uses this
15134 directory, when it's present in the preprocessed input, as the
15135 directory emitted as the current working directory in some
15136 debugging information formats. This option is implicitly enabled
15137 if debugging information is enabled, but this can be inhibited with
15138 the negated form -fno-working-directory. If the -P flag is present
15139 in the command line, this option has no effect, since no "#line"
15140 directives are emitted whatsoever.
15141
15142 -A predicate=answer
15143 Make an assertion with the predicate predicate and answer answer.
15144 This form is preferred to the older form -A predicate(answer),
15145 which is still supported, because it does not use shell special
15146 characters.
15147
15148 -A -predicate=answer
15149 Cancel an assertion with the predicate predicate and answer answer.
15150
15151 -C Do not discard comments. All comments are passed through to the
15152 output file, except for comments in processed directives, which are
15153 deleted along with the directive.
15154
15155 You should be prepared for side effects when using -C; it causes
15156 the preprocessor to treat comments as tokens in their own right.
15157 For example, comments appearing at the start of what would be a
15158 directive line have the effect of turning that line into an
15159 ordinary source line, since the first token on the line is no
15160 longer a #.
15161
15162 -CC Do not discard comments, including during macro expansion. This is
15163 like -C, except that comments contained within macros are also
15164 passed through to the output file where the macro is expanded.
15165
15166 In addition to the side effects of the -C option, the -CC option
15167 causes all C++-style comments inside a macro to be converted to
15168 C-style comments. This is to prevent later use of that macro from
15169 inadvertently commenting out the remainder of the source line.
15170
15171 The -CC option is generally used to support lint comments.
15172
15173 -P Inhibit generation of linemarkers in the output from the
15174 preprocessor. This might be useful when running the preprocessor
15175 on something that is not C code, and will be sent to a program
15176 which might be confused by the linemarkers.
15177
15178 -traditional
15179 -traditional-cpp
15180 Try to imitate the behavior of pre-standard C preprocessors, as
15181 opposed to ISO C preprocessors. See the GNU CPP manual for
15182 details.
15183
15184 Note that GCC does not otherwise attempt to emulate a pre-standard
15185 C compiler, and these options are only supported with the -E
15186 switch, or when invoking CPP explicitly.
15187
15188 -trigraphs
15189 Support ISO C trigraphs. These are three-character sequences, all
15190 starting with ??, that are defined by ISO C to stand for single
15191 characters. For example, ??/ stands for \, so '??/n' is a
15192 character constant for a newline.
15193
15194 The nine trigraphs and their replacements are
15195
15196 Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-
15197 Replacement: [ ] { } # \ ^ | ~
15198
15199 By default, GCC ignores trigraphs, but in standard-conforming modes
15200 it converts them. See the -std and -ansi options.
15201
15202 -remap
15203 Enable special code to work around file systems which only permit
15204 very short file names, such as MS-DOS.
15205
15206 -H Print the name of each header file used, in addition to other
15207 normal activities. Each name is indented to show how deep in the
15208 #include stack it is. Precompiled header files are also printed,
15209 even if they are found to be invalid; an invalid precompiled header
15210 file is printed with ...x and a valid one with ...! .
15211
15212 -dletters
15213 Says to make debugging dumps during compilation as specified by
15214 letters. The flags documented here are those relevant to the
15215 preprocessor. Other letters are interpreted by the compiler
15216 proper, or reserved for future versions of GCC, and so are silently
15217 ignored. If you specify letters whose behavior conflicts, the
15218 result is undefined.
15219
15220 -dM Instead of the normal output, generate a list of #define
15221 directives for all the macros defined during the execution of
15222 the preprocessor, including predefined macros. This gives you
15223 a way of finding out what is predefined in your version of the
15224 preprocessor. Assuming you have no file foo.h, the command
15225
15226 touch foo.h; cpp -dM foo.h
15227
15228 shows all the predefined macros.
15229
15230 If you use -dM without the -E option, -dM is interpreted as a
15231 synonym for -fdump-rtl-mach.
15232
15233 -dD Like -dM except in two respects: it does not include the
15234 predefined macros, and it outputs both the #define directives
15235 and the result of preprocessing. Both kinds of output go to
15236 the standard output file.
15237
15238 -dN Like -dD, but emit only the macro names, not their expansions.
15239
15240 -dI Output #include directives in addition to the result of
15241 preprocessing.
15242
15243 -dU Like -dD except that only macros that are expanded, or whose
15244 definedness is tested in preprocessor directives, are output;
15245 the output is delayed until the use or test of the macro; and
15246 #undef directives are also output for macros tested but
15247 undefined at the time.
15248
15249 -fdebug-cpp
15250 This option is only useful for debugging GCC. When used from CPP
15251 or with -E, it dumps debugging information about location maps.
15252 Every token in the output is preceded by the dump of the map its
15253 location belongs to.
15254
15255 When used from GCC without -E, this option has no effect.
15256
15257 -Wp,option
15258 You can use -Wp,option to bypass the compiler driver and pass
15259 option directly through to the preprocessor. If option contains
15260 commas, it is split into multiple options at the commas. However,
15261 many options are modified, translated or interpreted by the
15262 compiler driver before being passed to the preprocessor, and -Wp
15263 forcibly bypasses this phase. The preprocessor's direct interface
15264 is undocumented and subject to change, so whenever possible you
15265 should avoid using -Wp and let the driver handle the options
15266 instead.
15267
15268 -Xpreprocessor option
15269 Pass option as an option to the preprocessor. You can use this to
15270 supply system-specific preprocessor options that GCC does not
15271 recognize.
15272
15273 If you want to pass an option that takes an argument, you must use
15274 -Xpreprocessor twice, once for the option and once for the
15275 argument.
15276
15277 -no-integrated-cpp
15278 Perform preprocessing as a separate pass before compilation. By
15279 default, GCC performs preprocessing as an integrated part of input
15280 tokenization and parsing. If this option is provided, the
15281 appropriate language front end (cc1, cc1plus, or cc1obj for C, C++,
15282 and Objective-C, respectively) is instead invoked twice, once for
15283 preprocessing only and once for actual compilation of the
15284 preprocessed input. This option may be useful in conjunction with
15285 the -B or -wrapper options to specify an alternate preprocessor or
15286 perform additional processing of the program source between normal
15287 preprocessing and compilation.
15288
15289 -flarge-source-files
15290 Adjust GCC to expect large source files, at the expense of slower
15291 compilation and higher memory usage.
15292
15293 Specifically, GCC normally tracks both column numbers and line
15294 numbers within source files and it normally prints both of these
15295 numbers in diagnostics. However, once it has processed a certain
15296 number of source lines, it stops tracking column numbers and only
15297 tracks line numbers. This means that diagnostics for later lines
15298 do not include column numbers. It also means that options like
15299 -Wmisleading-indentation cease to work at that point, although the
15300 compiler prints a note if this happens. Passing
15301 -flarge-source-files significantly increases the number of source
15302 lines that GCC can process before it stops tracking columns.
15303
15304 Passing Options to the Assembler
15305 You can pass options to the assembler.
15306
15307 -Wa,option
15308 Pass option as an option to the assembler. If option contains
15309 commas, it is split into multiple options at the commas.
15310
15311 -Xassembler option
15312 Pass option as an option to the assembler. You can use this to
15313 supply system-specific assembler options that GCC does not
15314 recognize.
15315
15316 If you want to pass an option that takes an argument, you must use
15317 -Xassembler twice, once for the option and once for the argument.
15318
15319 Options for Linking
15320 These options come into play when the compiler links object files into
15321 an executable output file. They are meaningless if the compiler is not
15322 doing a link step.
15323
15324 object-file-name
15325 A file name that does not end in a special recognized suffix is
15326 considered to name an object file or library. (Object files are
15327 distinguished from libraries by the linker according to the file
15328 contents.) If linking is done, these object files are used as
15329 input to the linker.
15330
15331 -c
15332 -S
15333 -E If any of these options is used, then the linker is not run, and
15334 object file names should not be used as arguments.
15335
15336 -flinker-output=type
15337 This option controls code generation of the link-time optimizer.
15338 By default the linker output is automatically determined by the
15339 linker plugin. For debugging the compiler and if incremental
15340 linking with a non-LTO object file is desired, it may be useful to
15341 control the type manually.
15342
15343 If type is exec, code generation produces a static binary. In this
15344 case -fpic and -fpie are both disabled.
15345
15346 If type is dyn, code generation produces a shared library. In this
15347 case -fpic or -fPIC is preserved, but not enabled automatically.
15348 This allows to build shared libraries without position-independent
15349 code on architectures where this is possible, i.e. on x86.
15350
15351 If type is pie, code generation produces an -fpie executable. This
15352 results in similar optimizations as exec except that -fpie is not
15353 disabled if specified at compilation time.
15354
15355 If type is rel, the compiler assumes that incremental linking is
15356 done. The sections containing intermediate code for link-time
15357 optimization are merged, pre-optimized, and output to the resulting
15358 object file. In addition, if -ffat-lto-objects is specified, binary
15359 code is produced for future non-LTO linking. The object file
15360 produced by incremental linking is smaller than a static library
15361 produced from the same object files. At link time the result of
15362 incremental linking also loads faster than a static library
15363 assuming that the majority of objects in the library are used.
15364
15365 Finally nolto-rel configures the compiler for incremental linking
15366 where code generation is forced, a final binary is produced, and
15367 the intermediate code for later link-time optimization is stripped.
15368 When multiple object files are linked together the resulting code
15369 is better optimized than with link-time optimizations disabled (for
15370 example, cross-module inlining happens), but most of benefits of
15371 whole program optimizations are lost.
15372
15373 During the incremental link (by -r) the linker plugin defaults to
15374 rel. With current interfaces to GNU Binutils it is however not
15375 possible to incrementally link LTO objects and non-LTO objects into
15376 a single mixed object file. If any of object files in incremental
15377 link cannot be used for link-time optimization, the linker plugin
15378 issues a warning and uses nolto-rel. To maintain whole program
15379 optimization, it is recommended to link such objects into static
15380 library instead. Alternatively it is possible to use H.J. Lu's
15381 binutils with support for mixed objects.
15382
15383 -fuse-ld=bfd
15384 Use the bfd linker instead of the default linker.
15385
15386 -fuse-ld=gold
15387 Use the gold linker instead of the default linker.
15388
15389 -fuse-ld=lld
15390 Use the LLVM lld linker instead of the default linker.
15391
15392 -fuse-ld=mold
15393 Use the Modern Linker (mold) instead of the default linker.
15394
15395 -llibrary
15396 -l library
15397 Search the library named library when linking. (The second
15398 alternative with the library as a separate argument is only for
15399 POSIX compliance and is not recommended.)
15400
15401 The -l option is passed directly to the linker by GCC. Refer to
15402 your linker documentation for exact details. The general
15403 description below applies to the GNU linker.
15404
15405 The linker searches a standard list of directories for the library.
15406 The directories searched include several standard system
15407 directories plus any that you specify with -L.
15408
15409 Static libraries are archives of object files, and have file names
15410 like liblibrary.a. Some targets also support shared libraries,
15411 which typically have names like liblibrary.so. If both static and
15412 shared libraries are found, the linker gives preference to linking
15413 with the shared library unless the -static option is used.
15414
15415 It makes a difference where in the command you write this option;
15416 the linker searches and processes libraries and object files in the
15417 order they are specified. Thus, foo.o -lz bar.o searches library z
15418 after file foo.o but before bar.o. If bar.o refers to functions in
15419 z, those functions may not be loaded.
15420
15421 -lobjc
15422 You need this special case of the -l option in order to link an
15423 Objective-C or Objective-C++ program.
15424
15425 -nostartfiles
15426 Do not use the standard system startup files when linking. The
15427 standard system libraries are used normally, unless -nostdlib,
15428 -nolibc, or -nodefaultlibs is used.
15429
15430 -nodefaultlibs
15431 Do not use the standard system libraries when linking. Only the
15432 libraries you specify are passed to the linker, and options
15433 specifying linkage of the system libraries, such as -static-libgcc
15434 or -shared-libgcc, are ignored. The standard startup files are
15435 used normally, unless -nostartfiles is used.
15436
15437 The compiler may generate calls to "memcmp", "memset", "memcpy" and
15438 "memmove". These entries are usually resolved by entries in libc.
15439 These entry points should be supplied through some other mechanism
15440 when this option is specified.
15441
15442 -nolibc
15443 Do not use the C library or system libraries tightly coupled with
15444 it when linking. Still link with the startup files, libgcc or
15445 toolchain provided language support libraries such as libgnat,
15446 libgfortran or libstdc++ unless options preventing their inclusion
15447 are used as well. This typically removes -lc from the link command
15448 line, as well as system libraries that normally go with it and
15449 become meaningless when absence of a C library is assumed, for
15450 example -lpthread or -lm in some configurations. This is intended
15451 for bare-board targets when there is indeed no C library available.
15452
15453 -nostdlib
15454 Do not use the standard system startup files or libraries when
15455 linking. No startup files and only the libraries you specify are
15456 passed to the linker, and options specifying linkage of the system
15457 libraries, such as -static-libgcc or -shared-libgcc, are ignored.
15458
15459 The compiler may generate calls to "memcmp", "memset", "memcpy" and
15460 "memmove". These entries are usually resolved by entries in libc.
15461 These entry points should be supplied through some other mechanism
15462 when this option is specified.
15463
15464 One of the standard libraries bypassed by -nostdlib and
15465 -nodefaultlibs is libgcc.a, a library of internal subroutines which
15466 GCC uses to overcome shortcomings of particular machines, or
15467 special needs for some languages.
15468
15469 In most cases, you need libgcc.a even when you want to avoid other
15470 standard libraries. In other words, when you specify -nostdlib or
15471 -nodefaultlibs you should usually specify -lgcc as well. This
15472 ensures that you have no unresolved references to internal GCC
15473 library subroutines. (An example of such an internal subroutine is
15474 "__main", used to ensure C++ constructors are called.)
15475
15476 -nostdlib++
15477 Do not implicitly link with standard C++ libraries.
15478
15479 -e entry
15480 --entry=entry
15481 Specify that the program entry point is entry. The argument is
15482 interpreted by the linker; the GNU linker accepts either a symbol
15483 name or an address.
15484
15485 -pie
15486 Produce a dynamically linked position independent executable on
15487 targets that support it. For predictable results, you must also
15488 specify the same set of options used for compilation (-fpie, -fPIE,
15489 or model suboptions) when you specify this linker option.
15490
15491 -no-pie
15492 Don't produce a dynamically linked position independent executable.
15493
15494 -static-pie
15495 Produce a static position independent executable on targets that
15496 support it. A static position independent executable is similar to
15497 a static executable, but can be loaded at any address without a
15498 dynamic linker. For predictable results, you must also specify the
15499 same set of options used for compilation (-fpie, -fPIE, or model
15500 suboptions) when you specify this linker option.
15501
15502 -pthread
15503 Link with the POSIX threads library. This option is supported on
15504 GNU/Linux targets, most other Unix derivatives, and also on x86
15505 Cygwin and MinGW targets. On some targets this option also sets
15506 flags for the preprocessor, so it should be used consistently for
15507 both compilation and linking.
15508
15509 -r Produce a relocatable object as output. This is also known as
15510 partial linking.
15511
15512 -rdynamic
15513 Pass the flag -export-dynamic to the ELF linker, on targets that
15514 support it. This instructs the linker to add all symbols, not only
15515 used ones, to the dynamic symbol table. This option is needed for
15516 some uses of "dlopen" or to allow obtaining backtraces from within
15517 a program.
15518
15519 -s Remove all symbol table and relocation information from the
15520 executable.
15521
15522 -static
15523 On systems that support dynamic linking, this overrides -pie and
15524 prevents linking with the shared libraries. On other systems, this
15525 option has no effect.
15526
15527 -shared
15528 Produce a shared object which can then be linked with other objects
15529 to form an executable. Not all systems support this option. For
15530 predictable results, you must also specify the same set of options
15531 used for compilation (-fpic, -fPIC, or model suboptions) when you
15532 specify this linker option.[1]
15533
15534 -shared-libgcc
15535 -static-libgcc
15536 On systems that provide libgcc as a shared library, these options
15537 force the use of either the shared or static version, respectively.
15538 If no shared version of libgcc was built when the compiler was
15539 configured, these options have no effect.
15540
15541 There are several situations in which an application should use the
15542 shared libgcc instead of the static version. The most common of
15543 these is when the application wishes to throw and catch exceptions
15544 across different shared libraries. In that case, each of the
15545 libraries as well as the application itself should use the shared
15546 libgcc.
15547
15548 Therefore, the G++ driver automatically adds -shared-libgcc
15549 whenever you build a shared library or a main executable, because
15550 C++ programs typically use exceptions, so this is the right thing
15551 to do.
15552
15553 If, instead, you use the GCC driver to create shared libraries, you
15554 may find that they are not always linked with the shared libgcc.
15555 If GCC finds, at its configuration time, that you have a non-GNU
15556 linker or a GNU linker that does not support option --eh-frame-hdr,
15557 it links the shared version of libgcc into shared libraries by
15558 default. Otherwise, it takes advantage of the linker and optimizes
15559 away the linking with the shared version of libgcc, linking with
15560 the static version of libgcc by default. This allows exceptions to
15561 propagate through such shared libraries, without incurring
15562 relocation costs at library load time.
15563
15564 However, if a library or main executable is supposed to throw or
15565 catch exceptions, you must link it using the G++ driver, or using
15566 the option -shared-libgcc, such that it is linked with the shared
15567 libgcc.
15568
15569 -static-libasan
15570 When the -fsanitize=address option is used to link a program, the
15571 GCC driver automatically links against libasan. If libasan is
15572 available as a shared library, and the -static option is not used,
15573 then this links against the shared version of libasan. The
15574 -static-libasan option directs the GCC driver to link libasan
15575 statically, without necessarily linking other libraries statically.
15576
15577 -static-libtsan
15578 When the -fsanitize=thread option is used to link a program, the
15579 GCC driver automatically links against libtsan. If libtsan is
15580 available as a shared library, and the -static option is not used,
15581 then this links against the shared version of libtsan. The
15582 -static-libtsan option directs the GCC driver to link libtsan
15583 statically, without necessarily linking other libraries statically.
15584
15585 -static-liblsan
15586 When the -fsanitize=leak option is used to link a program, the GCC
15587 driver automatically links against liblsan. If liblsan is
15588 available as a shared library, and the -static option is not used,
15589 then this links against the shared version of liblsan. The
15590 -static-liblsan option directs the GCC driver to link liblsan
15591 statically, without necessarily linking other libraries statically.
15592
15593 -static-libubsan
15594 When the -fsanitize=undefined option is used to link a program, the
15595 GCC driver automatically links against libubsan. If libubsan is
15596 available as a shared library, and the -static option is not used,
15597 then this links against the shared version of libubsan. The
15598 -static-libubsan option directs the GCC driver to link libubsan
15599 statically, without necessarily linking other libraries statically.
15600
15601 -static-libstdc++
15602 When the g++ program is used to link a C++ program, it normally
15603 automatically links against libstdc++. If libstdc++ is available
15604 as a shared library, and the -static option is not used, then this
15605 links against the shared version of libstdc++. That is normally
15606 fine. However, it is sometimes useful to freeze the version of
15607 libstdc++ used by the program without going all the way to a fully
15608 static link. The -static-libstdc++ option directs the g++ driver
15609 to link libstdc++ statically, without necessarily linking other
15610 libraries statically.
15611
15612 -symbolic
15613 Bind references to global symbols when building a shared object.
15614 Warn about any unresolved references (unless overridden by the link
15615 editor option -Xlinker -z -Xlinker defs). Only a few systems
15616 support this option.
15617
15618 -T script
15619 Use script as the linker script. This option is supported by most
15620 systems using the GNU linker. On some targets, such as bare-board
15621 targets without an operating system, the -T option may be required
15622 when linking to avoid references to undefined symbols.
15623
15624 -Xlinker option
15625 Pass option as an option to the linker. You can use this to supply
15626 system-specific linker options that GCC does not recognize.
15627
15628 If you want to pass an option that takes a separate argument, you
15629 must use -Xlinker twice, once for the option and once for the
15630 argument. For example, to pass -assert definitions, you must write
15631 -Xlinker -assert -Xlinker definitions. It does not work to write
15632 -Xlinker "-assert definitions", because this passes the entire
15633 string as a single argument, which is not what the linker expects.
15634
15635 When using the GNU linker, it is usually more convenient to pass
15636 arguments to linker options using the option=value syntax than as
15637 separate arguments. For example, you can specify -Xlinker
15638 -Map=output.map rather than -Xlinker -Map -Xlinker output.map.
15639 Other linkers may not support this syntax for command-line options.
15640
15641 -Wl,option
15642 Pass option as an option to the linker. If option contains commas,
15643 it is split into multiple options at the commas. You can use this
15644 syntax to pass an argument to the option. For example,
15645 -Wl,-Map,output.map passes -Map output.map to the linker. When
15646 using the GNU linker, you can also get the same effect with
15647 -Wl,-Map=output.map.
15648
15649 -u symbol
15650 Pretend the symbol symbol is undefined, to force linking of library
15651 modules to define it. You can use -u multiple times with different
15652 symbols to force loading of additional library modules.
15653
15654 -z keyword
15655 -z is passed directly on to the linker along with the keyword
15656 keyword. See the section in the documentation of your linker for
15657 permitted values and their meanings.
15658
15659 Options for Directory Search
15660 These options specify directories to search for header files, for
15661 libraries and for parts of the compiler:
15662
15663 -I dir
15664 -iquote dir
15665 -isystem dir
15666 -idirafter dir
15667 Add the directory dir to the list of directories to be searched for
15668 header files during preprocessing. If dir begins with = or
15669 $SYSROOT, then the = or $SYSROOT is replaced by the sysroot prefix;
15670 see --sysroot and -isysroot.
15671
15672 Directories specified with -iquote apply only to the quote form of
15673 the directive, "#include "file"". Directories specified with -I,
15674 -isystem, or -idirafter apply to lookup for both the
15675 "#include "file"" and "#include <file>" directives.
15676
15677 You can specify any number or combination of these options on the
15678 command line to search for header files in several directories.
15679 The lookup order is as follows:
15680
15681 1. For the quote form of the include directive, the directory of
15682 the current file is searched first.
15683
15684 2. For the quote form of the include directive, the directories
15685 specified by -iquote options are searched in left-to-right
15686 order, as they appear on the command line.
15687
15688 3. Directories specified with -I options are scanned in left-to-
15689 right order.
15690
15691 4. Directories specified with -isystem options are scanned in
15692 left-to-right order.
15693
15694 5. Standard system directories are scanned.
15695
15696 6. Directories specified with -idirafter options are scanned in
15697 left-to-right order.
15698
15699 You can use -I to override a system header file, substituting your
15700 own version, since these directories are searched before the
15701 standard system header file directories. However, you should not
15702 use this option to add directories that contain vendor-supplied
15703 system header files; use -isystem for that.
15704
15705 The -isystem and -idirafter options also mark the directory as a
15706 system directory, so that it gets the same special treatment that
15707 is applied to the standard system directories.
15708
15709 If a standard system include directory, or a directory specified
15710 with -isystem, is also specified with -I, the -I option is ignored.
15711 The directory is still searched but as a system directory at its
15712 normal position in the system include chain. This is to ensure
15713 that GCC's procedure to fix buggy system headers and the ordering
15714 for the "#include_next" directive are not inadvertently changed.
15715 If you really need to change the search order for system
15716 directories, use the -nostdinc and/or -isystem options.
15717
15718 -I- Split the include path. This option has been deprecated. Please
15719 use -iquote instead for -I directories before the -I- and remove
15720 the -I- option.
15721
15722 Any directories specified with -I options before -I- are searched
15723 only for headers requested with "#include "file""; they are not
15724 searched for "#include <file>". If additional directories are
15725 specified with -I options after the -I-, those directories are
15726 searched for all #include directives.
15727
15728 In addition, -I- inhibits the use of the directory of the current
15729 file directory as the first search directory for "#include "file"".
15730 There is no way to override this effect of -I-.
15731
15732 -iprefix prefix
15733 Specify prefix as the prefix for subsequent -iwithprefix options.
15734 If the prefix represents a directory, you should include the final
15735 /.
15736
15737 -iwithprefix dir
15738 -iwithprefixbefore dir
15739 Append dir to the prefix specified previously with -iprefix, and
15740 add the resulting directory to the include search path.
15741 -iwithprefixbefore puts it in the same place -I would; -iwithprefix
15742 puts it where -idirafter would.
15743
15744 -isysroot dir
15745 This option is like the --sysroot option, but applies only to
15746 header files (except for Darwin targets, where it applies to both
15747 header files and libraries). See the --sysroot option for more
15748 information.
15749
15750 -imultilib dir
15751 Use dir as a subdirectory of the directory containing target-
15752 specific C++ headers.
15753
15754 -nostdinc
15755 Do not search the standard system directories for header files.
15756 Only the directories explicitly specified with -I, -iquote,
15757 -isystem, and/or -idirafter options (and the directory of the
15758 current file, if appropriate) are searched.
15759
15760 -nostdinc++
15761 Do not search for header files in the C++-specific standard
15762 directories, but do still search the other standard directories.
15763 (This option is used when building the C++ library.)
15764
15765 -iplugindir=dir
15766 Set the directory to search for plugins that are passed by
15767 -fplugin=name instead of -fplugin=path/name.so. This option is not
15768 meant to be used by the user, but only passed by the driver.
15769
15770 -Ldir
15771 Add directory dir to the list of directories to be searched for -l.
15772
15773 -Bprefix
15774 This option specifies where to find the executables, libraries,
15775 include files, and data files of the compiler itself.
15776
15777 The compiler driver program runs one or more of the subprograms
15778 cpp, cc1, as and ld. It tries prefix as a prefix for each program
15779 it tries to run, both with and without machine/version/ for the
15780 corresponding target machine and compiler version.
15781
15782 For each subprogram to be run, the compiler driver first tries the
15783 -B prefix, if any. If that name is not found, or if -B is not
15784 specified, the driver tries two standard prefixes, /usr/lib/gcc/
15785 and /usr/local/lib/gcc/. If neither of those results in a file
15786 name that is found, the unmodified program name is searched for
15787 using the directories specified in your PATH environment variable.
15788
15789 The compiler checks to see if the path provided by -B refers to a
15790 directory, and if necessary it adds a directory separator character
15791 at the end of the path.
15792
15793 -B prefixes that effectively specify directory names also apply to
15794 libraries in the linker, because the compiler translates these
15795 options into -L options for the linker. They also apply to include
15796 files in the preprocessor, because the compiler translates these
15797 options into -isystem options for the preprocessor. In this case,
15798 the compiler appends include to the prefix.
15799
15800 The runtime support file libgcc.a can also be searched for using
15801 the -B prefix, if needed. If it is not found there, the two
15802 standard prefixes above are tried, and that is all. The file is
15803 left out of the link if it is not found by those means.
15804
15805 Another way to specify a prefix much like the -B prefix is to use
15806 the environment variable GCC_EXEC_PREFIX.
15807
15808 As a special kludge, if the path provided by -B is [dir/]stageN/,
15809 where N is a number in the range 0 to 9, then it is replaced by
15810 [dir/]include. This is to help with boot-strapping the compiler.
15811
15812 -no-canonical-prefixes
15813 Do not expand any symbolic links, resolve references to /../ or
15814 /./, or make the path absolute when generating a relative prefix.
15815
15816 --sysroot=dir
15817 Use dir as the logical root directory for headers and libraries.
15818 For example, if the compiler normally searches for headers in
15819 /usr/include and libraries in /usr/lib, it instead searches
15820 dir/usr/include and dir/usr/lib.
15821
15822 If you use both this option and the -isysroot option, then the
15823 --sysroot option applies to libraries, but the -isysroot option
15824 applies to header files.
15825
15826 The GNU linker (beginning with version 2.16) has the necessary
15827 support for this option. If your linker does not support this
15828 option, the header file aspect of --sysroot still works, but the
15829 library aspect does not.
15830
15831 --no-sysroot-suffix
15832 For some targets, a suffix is added to the root directory specified
15833 with --sysroot, depending on the other options used, so that
15834 headers may for example be found in dir/suffix/usr/include instead
15835 of dir/usr/include. This option disables the addition of such a
15836 suffix.
15837
15838 Options for Code Generation Conventions
15839 These machine-independent options control the interface conventions
15840 used in code generation.
15841
15842 Most of them have both positive and negative forms; the negative form
15843 of -ffoo is -fno-foo. In the table below, only one of the forms is
15844 listed---the one that is not the default. You can figure out the other
15845 form by either removing no- or adding it.
15846
15847 -fstack-reuse=reuse-level
15848 This option controls stack space reuse for user declared local/auto
15849 variables and compiler generated temporaries. reuse_level can be
15850 all, named_vars, or none. all enables stack reuse for all local
15851 variables and temporaries, named_vars enables the reuse only for
15852 user defined local variables with names, and none disables stack
15853 reuse completely. The default value is all. The option is needed
15854 when the program extends the lifetime of a scoped local variable or
15855 a compiler generated temporary beyond the end point defined by the
15856 language. When a lifetime of a variable ends, and if the variable
15857 lives in memory, the optimizing compiler has the freedom to reuse
15858 its stack space with other temporaries or scoped local variables
15859 whose live range does not overlap with it. Legacy code extending
15860 local lifetime is likely to break with the stack reuse
15861 optimization.
15862
15863 For example,
15864
15865 int *p;
15866 {
15867 int local1;
15868
15869 p = &local1;
15870 local1 = 10;
15871 ....
15872 }
15873 {
15874 int local2;
15875 local2 = 20;
15876 ...
15877 }
15878
15879 if (*p == 10) // out of scope use of local1
15880 {
15881
15882 }
15883
15884 Another example:
15885
15886 struct A
15887 {
15888 A(int k) : i(k), j(k) { }
15889 int i;
15890 int j;
15891 };
15892
15893 A *ap;
15894
15895 void foo(const A& ar)
15896 {
15897 ap = &ar;
15898 }
15899
15900 void bar()
15901 {
15902 foo(A(10)); // temp object's lifetime ends when foo returns
15903
15904 {
15905 A a(20);
15906 ....
15907 }
15908 ap->i+= 10; // ap references out of scope temp whose space
15909 // is reused with a. What is the value of ap->i?
15910 }
15911
15912 The lifetime of a compiler generated temporary is well defined by
15913 the C++ standard. When a lifetime of a temporary ends, and if the
15914 temporary lives in memory, the optimizing compiler has the freedom
15915 to reuse its stack space with other temporaries or scoped local
15916 variables whose live range does not overlap with it. However some
15917 of the legacy code relies on the behavior of older compilers in
15918 which temporaries' stack space is not reused, the aggressive stack
15919 reuse can lead to runtime errors. This option is used to control
15920 the temporary stack reuse optimization.
15921
15922 -ftrapv
15923 This option generates traps for signed overflow on addition,
15924 subtraction, multiplication operations. The options -ftrapv and
15925 -fwrapv override each other, so using -ftrapv -fwrapv on the
15926 command-line results in -fwrapv being effective. Note that only
15927 active options override, so using -ftrapv -fwrapv -fno-wrapv on the
15928 command-line results in -ftrapv being effective.
15929
15930 -fwrapv
15931 This option instructs the compiler to assume that signed arithmetic
15932 overflow of addition, subtraction and multiplication wraps around
15933 using twos-complement representation. This flag enables some
15934 optimizations and disables others. The options -ftrapv and -fwrapv
15935 override each other, so using -ftrapv -fwrapv on the command-line
15936 results in -fwrapv being effective. Note that only active options
15937 override, so using -ftrapv -fwrapv -fno-wrapv on the command-line
15938 results in -ftrapv being effective.
15939
15940 -fwrapv-pointer
15941 This option instructs the compiler to assume that pointer
15942 arithmetic overflow on addition and subtraction wraps around using
15943 twos-complement representation. This flag disables some
15944 optimizations which assume pointer overflow is invalid.
15945
15946 -fstrict-overflow
15947 This option implies -fno-wrapv -fno-wrapv-pointer and when negated
15948 implies -fwrapv -fwrapv-pointer.
15949
15950 -fexceptions
15951 Enable exception handling. Generates extra code needed to
15952 propagate exceptions. For some targets, this implies GCC generates
15953 frame unwind information for all functions, which can produce
15954 significant data size overhead, although it does not affect
15955 execution. If you do not specify this option, GCC enables it by
15956 default for languages like C++ that normally require exception
15957 handling, and disables it for languages like C that do not normally
15958 require it. However, you may need to enable this option when
15959 compiling C code that needs to interoperate properly with exception
15960 handlers written in C++. You may also wish to disable this option
15961 if you are compiling older C++ programs that don't use exception
15962 handling.
15963
15964 -fnon-call-exceptions
15965 Generate code that allows trapping instructions to throw
15966 exceptions. Note that this requires platform-specific runtime
15967 support that does not exist everywhere. Moreover, it only allows
15968 trapping instructions to throw exceptions, i.e. memory references
15969 or floating-point instructions. It does not allow exceptions to be
15970 thrown from arbitrary signal handlers such as "SIGALRM". This
15971 enables -fexceptions.
15972
15973 -fdelete-dead-exceptions
15974 Consider that instructions that may throw exceptions but don't
15975 otherwise contribute to the execution of the program can be
15976 optimized away. This does not affect calls to functions except
15977 those with the "pure" or "const" attributes. This option is
15978 enabled by default for the Ada and C++ compilers, as permitted by
15979 the language specifications. Optimization passes that cause dead
15980 exceptions to be removed are enabled independently at different
15981 optimization levels.
15982
15983 -funwind-tables
15984 Similar to -fexceptions, except that it just generates any needed
15985 static data, but does not affect the generated code in any other
15986 way. You normally do not need to enable this option; instead, a
15987 language processor that needs this handling enables it on your
15988 behalf.
15989
15990 -fasynchronous-unwind-tables
15991 Generate unwind table in DWARF format, if supported by target
15992 machine. The table is exact at each instruction boundary, so it
15993 can be used for stack unwinding from asynchronous events (such as
15994 debugger or garbage collector).
15995
15996 -fno-gnu-unique
15997 On systems with recent GNU assembler and C library, the C++
15998 compiler uses the "STB_GNU_UNIQUE" binding to make sure that
15999 definitions of template static data members and static local
16000 variables in inline functions are unique even in the presence of
16001 "RTLD_LOCAL"; this is necessary to avoid problems with a library
16002 used by two different "RTLD_LOCAL" plugins depending on a
16003 definition in one of them and therefore disagreeing with the other
16004 one about the binding of the symbol. But this causes "dlclose" to
16005 be ignored for affected DSOs; if your program relies on
16006 reinitialization of a DSO via "dlclose" and "dlopen", you can use
16007 -fno-gnu-unique.
16008
16009 -fpcc-struct-return
16010 Return "short" "struct" and "union" values in memory like longer
16011 ones, rather than in registers. This convention is less efficient,
16012 but it has the advantage of allowing intercallability between GCC-
16013 compiled files and files compiled with other compilers,
16014 particularly the Portable C Compiler (pcc).
16015
16016 The precise convention for returning structures in memory depends
16017 on the target configuration macros.
16018
16019 Short structures and unions are those whose size and alignment
16020 match that of some integer type.
16021
16022 Warning: code compiled with the -fpcc-struct-return switch is not
16023 binary compatible with code compiled with the -freg-struct-return
16024 switch. Use it to conform to a non-default application binary
16025 interface.
16026
16027 -freg-struct-return
16028 Return "struct" and "union" values in registers when possible.
16029 This is more efficient for small structures than
16030 -fpcc-struct-return.
16031
16032 If you specify neither -fpcc-struct-return nor -freg-struct-return,
16033 GCC defaults to whichever convention is standard for the target.
16034 If there is no standard convention, GCC defaults to
16035 -fpcc-struct-return, except on targets where GCC is the principal
16036 compiler. In those cases, we can choose the standard, and we chose
16037 the more efficient register return alternative.
16038
16039 Warning: code compiled with the -freg-struct-return switch is not
16040 binary compatible with code compiled with the -fpcc-struct-return
16041 switch. Use it to conform to a non-default application binary
16042 interface.
16043
16044 -fshort-enums
16045 Allocate to an "enum" type only as many bytes as it needs for the
16046 declared range of possible values. Specifically, the "enum" type
16047 is equivalent to the smallest integer type that has enough room.
16048
16049 Warning: the -fshort-enums switch causes GCC to generate code that
16050 is not binary compatible with code generated without that switch.
16051 Use it to conform to a non-default application binary interface.
16052
16053 -fshort-wchar
16054 Override the underlying type for "wchar_t" to be "short unsigned
16055 int" instead of the default for the target. This option is useful
16056 for building programs to run under WINE.
16057
16058 Warning: the -fshort-wchar switch causes GCC to generate code that
16059 is not binary compatible with code generated without that switch.
16060 Use it to conform to a non-default application binary interface.
16061
16062 -fcommon
16063 In C code, this option controls the placement of global variables
16064 defined without an initializer, known as tentative definitions in
16065 the C standard. Tentative definitions are distinct from
16066 declarations of a variable with the "extern" keyword, which do not
16067 allocate storage.
16068
16069 The default is -fno-common, which specifies that the compiler
16070 places uninitialized global variables in the BSS section of the
16071 object file. This inhibits the merging of tentative definitions by
16072 the linker so you get a multiple-definition error if the same
16073 variable is accidentally defined in more than one compilation unit.
16074
16075 The -fcommon places uninitialized global variables in a common
16076 block. This allows the linker to resolve all tentative definitions
16077 of the same variable in different compilation units to the same
16078 object, or to a non-tentative definition. This behavior is
16079 inconsistent with C++, and on many targets implies a speed and code
16080 size penalty on global variable references. It is mainly useful to
16081 enable legacy code to link without errors.
16082
16083 -fno-ident
16084 Ignore the "#ident" directive.
16085
16086 -finhibit-size-directive
16087 Don't output a ".size" assembler directive, or anything else that
16088 would cause trouble if the function is split in the middle, and the
16089 two halves are placed at locations far apart in memory. This
16090 option is used when compiling crtstuff.c; you should not need to
16091 use it for anything else.
16092
16093 -fverbose-asm
16094 Put extra commentary information in the generated assembly code to
16095 make it more readable. This option is generally only of use to
16096 those who actually need to read the generated assembly code
16097 (perhaps while debugging the compiler itself).
16098
16099 -fno-verbose-asm, the default, causes the extra information to be
16100 omitted and is useful when comparing two assembler files.
16101
16102 The added comments include:
16103
16104 * information on the compiler version and command-line options,
16105
16106 * the source code lines associated with the assembly
16107 instructions, in the form FILENAME:LINENUMBER:CONTENT OF LINE,
16108
16109 * hints on which high-level expressions correspond to the various
16110 assembly instruction operands.
16111
16112 For example, given this C source file:
16113
16114 int test (int n)
16115 {
16116 int i;
16117 int total = 0;
16118
16119 for (i = 0; i < n; i++)
16120 total += i * i;
16121
16122 return total;
16123 }
16124
16125 compiling to (x86_64) assembly via -S and emitting the result
16126 direct to stdout via -o -
16127
16128 gcc -S test.c -fverbose-asm -Os -o -
16129
16130 gives output similar to this:
16131
16132 .file "test.c"
16133 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
16134 [...snip...]
16135 # options passed:
16136 [...snip...]
16137
16138 .text
16139 .globl test
16140 .type test, @function
16141 test:
16142 .LFB0:
16143 .cfi_startproc
16144 # test.c:4: int total = 0;
16145 xorl %eax, %eax # <retval>
16146 # test.c:6: for (i = 0; i < n; i++)
16147 xorl %edx, %edx # i
16148 .L2:
16149 # test.c:6: for (i = 0; i < n; i++)
16150 cmpl %edi, %edx # n, i
16151 jge .L5 #,
16152 # test.c:7: total += i * i;
16153 movl %edx, %ecx # i, tmp92
16154 imull %edx, %ecx # i, tmp92
16155 # test.c:6: for (i = 0; i < n; i++)
16156 incl %edx # i
16157 # test.c:7: total += i * i;
16158 addl %ecx, %eax # tmp92, <retval>
16159 jmp .L2 #
16160 .L5:
16161 # test.c:10: }
16162 ret
16163 .cfi_endproc
16164 .LFE0:
16165 .size test, .-test
16166 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
16167 .section .note.GNU-stack,"",@progbits
16168
16169 The comments are intended for humans rather than machines and hence
16170 the precise format of the comments is subject to change.
16171
16172 -frecord-gcc-switches
16173 This switch causes the command line used to invoke the compiler to
16174 be recorded into the object file that is being created. This
16175 switch is only implemented on some targets and the exact format of
16176 the recording is target and binary file format dependent, but it
16177 usually takes the form of a section containing ASCII text. This
16178 switch is related to the -fverbose-asm switch, but that switch only
16179 records information in the assembler output file as comments, so it
16180 never reaches the object file. See also -grecord-gcc-switches for
16181 another way of storing compiler options into the object file.
16182
16183 -fpic
16184 Generate position-independent code (PIC) suitable for use in a
16185 shared library, if supported for the target machine. Such code
16186 accesses all constant addresses through a global offset table
16187 (GOT). The dynamic loader resolves the GOT entries when the
16188 program starts (the dynamic loader is not part of GCC; it is part
16189 of the operating system). If the GOT size for the linked
16190 executable exceeds a machine-specific maximum size, you get an
16191 error message from the linker indicating that -fpic does not work;
16192 in that case, recompile with -fPIC instead. (These maximums are 8k
16193 on the SPARC, 28k on AArch64 and 32k on the m68k and RS/6000. The
16194 x86 has no such limit.)
16195
16196 Position-independent code requires special support, and therefore
16197 works only on certain machines. For the x86, GCC supports PIC for
16198 System V but not for the Sun 386i. Code generated for the IBM
16199 RS/6000 is always position-independent.
16200
16201 When this flag is set, the macros "__pic__" and "__PIC__" are
16202 defined to 1.
16203
16204 -fPIC
16205 If supported for the target machine, emit position-independent
16206 code, suitable for dynamic linking and avoiding any limit on the
16207 size of the global offset table. This option makes a difference on
16208 AArch64, m68k, PowerPC and SPARC.
16209
16210 Position-independent code requires special support, and therefore
16211 works only on certain machines.
16212
16213 When this flag is set, the macros "__pic__" and "__PIC__" are
16214 defined to 2.
16215
16216 -fpie
16217 -fPIE
16218 These options are similar to -fpic and -fPIC, but the generated
16219 position-independent code can be only linked into executables.
16220 Usually these options are used to compile code that will be linked
16221 using the -pie GCC option.
16222
16223 -fpie and -fPIE both define the macros "__pie__" and "__PIE__".
16224 The macros have the value 1 for -fpie and 2 for -fPIE.
16225
16226 -fno-plt
16227 Do not use the PLT for external function calls in position-
16228 independent code. Instead, load the callee address at call sites
16229 from the GOT and branch to it. This leads to more efficient code
16230 by eliminating PLT stubs and exposing GOT loads to optimizations.
16231 On architectures such as 32-bit x86 where PLT stubs expect the GOT
16232 pointer in a specific register, this gives more register allocation
16233 freedom to the compiler. Lazy binding requires use of the PLT;
16234 with -fno-plt all external symbols are resolved at load time.
16235
16236 Alternatively, the function attribute "noplt" can be used to avoid
16237 calls through the PLT for specific external functions.
16238
16239 In position-dependent code, a few targets also convert calls to
16240 functions that are marked to not use the PLT to use the GOT
16241 instead.
16242
16243 -fno-jump-tables
16244 Do not use jump tables for switch statements even where it would be
16245 more efficient than other code generation strategies. This option
16246 is of use in conjunction with -fpic or -fPIC for building code that
16247 forms part of a dynamic linker and cannot reference the address of
16248 a jump table. On some targets, jump tables do not require a GOT
16249 and this option is not needed.
16250
16251 -fno-bit-tests
16252 Do not use bit tests for switch statements even where it would be
16253 more efficient than other code generation strategies.
16254
16255 -ffixed-reg
16256 Treat the register named reg as a fixed register; generated code
16257 should never refer to it (except perhaps as a stack pointer, frame
16258 pointer or in some other fixed role).
16259
16260 reg must be the name of a register. The register names accepted
16261 are machine-specific and are defined in the "REGISTER_NAMES" macro
16262 in the machine description macro file.
16263
16264 This flag does not have a negative form, because it specifies a
16265 three-way choice.
16266
16267 -fcall-used-reg
16268 Treat the register named reg as an allocable register that is
16269 clobbered by function calls. It may be allocated for temporaries
16270 or variables that do not live across a call. Functions compiled
16271 this way do not save and restore the register reg.
16272
16273 It is an error to use this flag with the frame pointer or stack
16274 pointer. Use of this flag for other registers that have fixed
16275 pervasive roles in the machine's execution model produces
16276 disastrous results.
16277
16278 This flag does not have a negative form, because it specifies a
16279 three-way choice.
16280
16281 -fcall-saved-reg
16282 Treat the register named reg as an allocable register saved by
16283 functions. It may be allocated even for temporaries or variables
16284 that live across a call. Functions compiled this way save and
16285 restore the register reg if they use it.
16286
16287 It is an error to use this flag with the frame pointer or stack
16288 pointer. Use of this flag for other registers that have fixed
16289 pervasive roles in the machine's execution model produces
16290 disastrous results.
16291
16292 A different sort of disaster results from the use of this flag for
16293 a register in which function values may be returned.
16294
16295 This flag does not have a negative form, because it specifies a
16296 three-way choice.
16297
16298 -fpack-struct[=n]
16299 Without a value specified, pack all structure members together
16300 without holes. When a value is specified (which must be a small
16301 power of two), pack structure members according to this value,
16302 representing the maximum alignment (that is, objects with default
16303 alignment requirements larger than this are output potentially
16304 unaligned at the next fitting location.
16305
16306 Warning: the -fpack-struct switch causes GCC to generate code that
16307 is not binary compatible with code generated without that switch.
16308 Additionally, it makes the code suboptimal. Use it to conform to a
16309 non-default application binary interface.
16310
16311 -fleading-underscore
16312 This option and its counterpart, -fno-leading-underscore, forcibly
16313 change the way C symbols are represented in the object file. One
16314 use is to help link with legacy assembly code.
16315
16316 Warning: the -fleading-underscore switch causes GCC to generate
16317 code that is not binary compatible with code generated without that
16318 switch. Use it to conform to a non-default application binary
16319 interface. Not all targets provide complete support for this
16320 switch.
16321
16322 -ftls-model=model
16323 Alter the thread-local storage model to be used. The model
16324 argument should be one of global-dynamic, local-dynamic, initial-
16325 exec or local-exec. Note that the choice is subject to
16326 optimization: the compiler may use a more efficient model for
16327 symbols not visible outside of the translation unit, or if -fpic is
16328 not given on the command line.
16329
16330 The default without -fpic is initial-exec; with -fpic the default
16331 is global-dynamic.
16332
16333 -ftrampolines
16334 For targets that normally need trampolines for nested functions,
16335 always generate them instead of using descriptors. Otherwise, for
16336 targets that do not need them, like for example HP-PA or IA-64, do
16337 nothing.
16338
16339 A trampoline is a small piece of code that is created at run time
16340 on the stack when the address of a nested function is taken, and is
16341 used to call the nested function indirectly. Therefore, it
16342 requires the stack to be made executable in order for the program
16343 to work properly.
16344
16345 -fno-trampolines is enabled by default on a language by language
16346 basis to let the compiler avoid generating them, if it computes
16347 that this is safe, and replace them with descriptors. Descriptors
16348 are made up of data only, but the generated code must be prepared
16349 to deal with them. As of this writing, -fno-trampolines is enabled
16350 by default only for Ada.
16351
16352 Moreover, code compiled with -ftrampolines and code compiled with
16353 -fno-trampolines are not binary compatible if nested functions are
16354 present. This option must therefore be used on a program-wide
16355 basis and be manipulated with extreme care.
16356
16357 For languages other than Ada, the "-ftrampolines" and
16358 "-fno-trampolines" options currently have no effect, and
16359 trampolines are always generated on platforms that need them for
16360 nested functions.
16361
16362 -fvisibility=[default|internal|hidden|protected]
16363 Set the default ELF image symbol visibility to the specified
16364 option---all symbols are marked with this unless overridden within
16365 the code. Using this feature can very substantially improve
16366 linking and load times of shared object libraries, produce more
16367 optimized code, provide near-perfect API export and prevent symbol
16368 clashes. It is strongly recommended that you use this in any
16369 shared objects you distribute.
16370
16371 Despite the nomenclature, default always means public; i.e.,
16372 available to be linked against from outside the shared object.
16373 protected and internal are pretty useless in real-world usage so
16374 the only other commonly used option is hidden. The default if
16375 -fvisibility isn't specified is default, i.e., make every symbol
16376 public.
16377
16378 A good explanation of the benefits offered by ensuring ELF symbols
16379 have the correct visibility is given by "How To Write Shared
16380 Libraries" by Ulrich Drepper (which can be found at
16381 <https://www.akkadia.org/drepper/>)---however a superior solution
16382 made possible by this option to marking things hidden when the
16383 default is public is to make the default hidden and mark things
16384 public. This is the norm with DLLs on Windows and with
16385 -fvisibility=hidden and "__attribute__ ((visibility("default")))"
16386 instead of "__declspec(dllexport)" you get almost identical
16387 semantics with identical syntax. This is a great boon to those
16388 working with cross-platform projects.
16389
16390 For those adding visibility support to existing code, you may find
16391 "#pragma GCC visibility" of use. This works by you enclosing the
16392 declarations you wish to set visibility for with (for example)
16393 "#pragma GCC visibility push(hidden)" and "#pragma GCC visibility
16394 pop". Bear in mind that symbol visibility should be viewed as part
16395 of the API interface contract and thus all new code should always
16396 specify visibility when it is not the default; i.e., declarations
16397 only for use within the local DSO should always be marked
16398 explicitly as hidden as so to avoid PLT indirection
16399 overheads---making this abundantly clear also aids readability and
16400 self-documentation of the code. Note that due to ISO C++
16401 specification requirements, "operator new" and "operator delete"
16402 must always be of default visibility.
16403
16404 Be aware that headers from outside your project, in particular
16405 system headers and headers from any other library you use, may not
16406 be expecting to be compiled with visibility other than the default.
16407 You may need to explicitly say "#pragma GCC visibility
16408 push(default)" before including any such headers.
16409
16410 "extern" declarations are not affected by -fvisibility, so a lot of
16411 code can be recompiled with -fvisibility=hidden with no
16412 modifications. However, this means that calls to "extern"
16413 functions with no explicit visibility use the PLT, so it is more
16414 effective to use "__attribute ((visibility))" and/or "#pragma GCC
16415 visibility" to tell the compiler which "extern" declarations should
16416 be treated as hidden.
16417
16418 Note that -fvisibility does affect C++ vague linkage entities. This
16419 means that, for instance, an exception class that is be thrown
16420 between DSOs must be explicitly marked with default visibility so
16421 that the type_info nodes are unified between the DSOs.
16422
16423 An overview of these techniques, their benefits and how to use them
16424 is at <https://gcc.gnu.org/wiki/Visibility>.
16425
16426 -fstrict-volatile-bitfields
16427 This option should be used if accesses to volatile bit-fields (or
16428 other structure fields, although the compiler usually honors those
16429 types anyway) should use a single access of the width of the
16430 field's type, aligned to a natural alignment if possible. For
16431 example, targets with memory-mapped peripheral registers might
16432 require all such accesses to be 16 bits wide; with this flag you
16433 can declare all peripheral bit-fields as "unsigned short" (assuming
16434 short is 16 bits on these targets) to force GCC to use 16-bit
16435 accesses instead of, perhaps, a more efficient 32-bit access.
16436
16437 If this option is disabled, the compiler uses the most efficient
16438 instruction. In the previous example, that might be a 32-bit load
16439 instruction, even though that accesses bytes that do not contain
16440 any portion of the bit-field, or memory-mapped registers unrelated
16441 to the one being updated.
16442
16443 In some cases, such as when the "packed" attribute is applied to a
16444 structure field, it may not be possible to access the field with a
16445 single read or write that is correctly aligned for the target
16446 machine. In this case GCC falls back to generating multiple
16447 accesses rather than code that will fault or truncate the result at
16448 run time.
16449
16450 Note: Due to restrictions of the C/C++11 memory model, write
16451 accesses are not allowed to touch non bit-field members. It is
16452 therefore recommended to define all bits of the field's type as
16453 bit-field members.
16454
16455 The default value of this option is determined by the application
16456 binary interface for the target processor.
16457
16458 -fsync-libcalls
16459 This option controls whether any out-of-line instance of the
16460 "__sync" family of functions may be used to implement the C++11
16461 "__atomic" family of functions.
16462
16463 The default value of this option is enabled, thus the only useful
16464 form of the option is -fno-sync-libcalls. This option is used in
16465 the implementation of the libatomic runtime library.
16466
16467 GCC Developer Options
16468 This section describes command-line options that are primarily of
16469 interest to GCC developers, including options to support compiler
16470 testing and investigation of compiler bugs and compile-time performance
16471 problems. This includes options that produce debug dumps at various
16472 points in the compilation; that print statistics such as memory use and
16473 execution time; and that print information about GCC's configuration,
16474 such as where it searches for libraries. You should rarely need to use
16475 any of these options for ordinary compilation and linking tasks.
16476
16477 Many developer options that cause GCC to dump output to a file take an
16478 optional =filename suffix. You can specify stdout or - to dump to
16479 standard output, and stderr for standard error.
16480
16481 If =filename is omitted, a default dump file name is constructed by
16482 concatenating the base dump file name, a pass number, phase letter, and
16483 pass name. The base dump file name is the name of output file produced
16484 by the compiler if explicitly specified and not an executable;
16485 otherwise it is the source file name. The pass number is determined by
16486 the order passes are registered with the compiler's pass manager. This
16487 is generally the same as the order of execution, but passes registered
16488 by plugins, target-specific passes, or passes that are otherwise
16489 registered late are numbered higher than the pass named final, even if
16490 they are executed earlier. The phase letter is one of i (inter-
16491 procedural analysis), l (language-specific), r (RTL), or t (tree). The
16492 files are created in the directory of the output file.
16493
16494 -fcallgraph-info
16495 -fcallgraph-info=MARKERS
16496 Makes the compiler output callgraph information for the program, on
16497 a per-object-file basis. The information is generated in the
16498 common VCG format. It can be decorated with additional, per-node
16499 and/or per-edge information, if a list of comma-separated markers
16500 is additionally specified. When the "su" marker is specified, the
16501 callgraph is decorated with stack usage information; it is
16502 equivalent to -fstack-usage. When the "da" marker is specified,
16503 the callgraph is decorated with information about dynamically
16504 allocated objects.
16505
16506 When compiling with -flto, no callgraph information is output along
16507 with the object file. At LTO link time, -fcallgraph-info may
16508 generate multiple callgraph information files next to intermediate
16509 LTO output files.
16510
16511 -dletters
16512 -fdump-rtl-pass
16513 -fdump-rtl-pass=filename
16514 Says to make debugging dumps during compilation at times specified
16515 by letters. This is used for debugging the RTL-based passes of the
16516 compiler.
16517
16518 Some -dletters switches have different meaning when -E is used for
16519 preprocessing.
16520
16521 Debug dumps can be enabled with a -fdump-rtl switch or some -d
16522 option letters. Here are the possible letters for use in pass and
16523 letters, and their meanings:
16524
16525 -fdump-rtl-alignments
16526 Dump after branch alignments have been computed.
16527
16528 -fdump-rtl-asmcons
16529 Dump after fixing rtl statements that have unsatisfied in/out
16530 constraints.
16531
16532 -fdump-rtl-auto_inc_dec
16533 Dump after auto-inc-dec discovery. This pass is only run on
16534 architectures that have auto inc or auto dec instructions.
16535
16536 -fdump-rtl-barriers
16537 Dump after cleaning up the barrier instructions.
16538
16539 -fdump-rtl-bbpart
16540 Dump after partitioning hot and cold basic blocks.
16541
16542 -fdump-rtl-bbro
16543 Dump after block reordering.
16544
16545 -fdump-rtl-btl1
16546 -fdump-rtl-btl2
16547 -fdump-rtl-btl1 and -fdump-rtl-btl2 enable dumping after the
16548 two branch target load optimization passes.
16549
16550 -fdump-rtl-bypass
16551 Dump after jump bypassing and control flow optimizations.
16552
16553 -fdump-rtl-combine
16554 Dump after the RTL instruction combination pass.
16555
16556 -fdump-rtl-compgotos
16557 Dump after duplicating the computed gotos.
16558
16559 -fdump-rtl-ce1
16560 -fdump-rtl-ce2
16561 -fdump-rtl-ce3
16562 -fdump-rtl-ce1, -fdump-rtl-ce2, and -fdump-rtl-ce3 enable
16563 dumping after the three if conversion passes.
16564
16565 -fdump-rtl-cprop_hardreg
16566 Dump after hard register copy propagation.
16567
16568 -fdump-rtl-csa
16569 Dump after combining stack adjustments.
16570
16571 -fdump-rtl-cse1
16572 -fdump-rtl-cse2
16573 -fdump-rtl-cse1 and -fdump-rtl-cse2 enable dumping after the
16574 two common subexpression elimination passes.
16575
16576 -fdump-rtl-dce
16577 Dump after the standalone dead code elimination passes.
16578
16579 -fdump-rtl-dbr
16580 Dump after delayed branch scheduling.
16581
16582 -fdump-rtl-dce1
16583 -fdump-rtl-dce2
16584 -fdump-rtl-dce1 and -fdump-rtl-dce2 enable dumping after the
16585 two dead store elimination passes.
16586
16587 -fdump-rtl-eh
16588 Dump after finalization of EH handling code.
16589
16590 -fdump-rtl-eh_ranges
16591 Dump after conversion of EH handling range regions.
16592
16593 -fdump-rtl-expand
16594 Dump after RTL generation.
16595
16596 -fdump-rtl-fwprop1
16597 -fdump-rtl-fwprop2
16598 -fdump-rtl-fwprop1 and -fdump-rtl-fwprop2 enable dumping after
16599 the two forward propagation passes.
16600
16601 -fdump-rtl-gcse1
16602 -fdump-rtl-gcse2
16603 -fdump-rtl-gcse1 and -fdump-rtl-gcse2 enable dumping after
16604 global common subexpression elimination.
16605
16606 -fdump-rtl-init-regs
16607 Dump after the initialization of the registers.
16608
16609 -fdump-rtl-initvals
16610 Dump after the computation of the initial value sets.
16611
16612 -fdump-rtl-into_cfglayout
16613 Dump after converting to cfglayout mode.
16614
16615 -fdump-rtl-ira
16616 Dump after iterated register allocation.
16617
16618 -fdump-rtl-jump
16619 Dump after the second jump optimization.
16620
16621 -fdump-rtl-loop2
16622 -fdump-rtl-loop2 enables dumping after the rtl loop
16623 optimization passes.
16624
16625 -fdump-rtl-mach
16626 Dump after performing the machine dependent reorganization
16627 pass, if that pass exists.
16628
16629 -fdump-rtl-mode_sw
16630 Dump after removing redundant mode switches.
16631
16632 -fdump-rtl-rnreg
16633 Dump after register renumbering.
16634
16635 -fdump-rtl-outof_cfglayout
16636 Dump after converting from cfglayout mode.
16637
16638 -fdump-rtl-peephole2
16639 Dump after the peephole pass.
16640
16641 -fdump-rtl-postreload
16642 Dump after post-reload optimizations.
16643
16644 -fdump-rtl-pro_and_epilogue
16645 Dump after generating the function prologues and epilogues.
16646
16647 -fdump-rtl-sched1
16648 -fdump-rtl-sched2
16649 -fdump-rtl-sched1 and -fdump-rtl-sched2 enable dumping after
16650 the basic block scheduling passes.
16651
16652 -fdump-rtl-ree
16653 Dump after sign/zero extension elimination.
16654
16655 -fdump-rtl-seqabstr
16656 Dump after common sequence discovery.
16657
16658 -fdump-rtl-shorten
16659 Dump after shortening branches.
16660
16661 -fdump-rtl-sibling
16662 Dump after sibling call optimizations.
16663
16664 -fdump-rtl-split1
16665 -fdump-rtl-split2
16666 -fdump-rtl-split3
16667 -fdump-rtl-split4
16668 -fdump-rtl-split5
16669 These options enable dumping after five rounds of instruction
16670 splitting.
16671
16672 -fdump-rtl-sms
16673 Dump after modulo scheduling. This pass is only run on some
16674 architectures.
16675
16676 -fdump-rtl-stack
16677 Dump after conversion from GCC's "flat register file" registers
16678 to the x87's stack-like registers. This pass is only run on
16679 x86 variants.
16680
16681 -fdump-rtl-subreg1
16682 -fdump-rtl-subreg2
16683 -fdump-rtl-subreg1 and -fdump-rtl-subreg2 enable dumping after
16684 the two subreg expansion passes.
16685
16686 -fdump-rtl-unshare
16687 Dump after all rtl has been unshared.
16688
16689 -fdump-rtl-vartrack
16690 Dump after variable tracking.
16691
16692 -fdump-rtl-vregs
16693 Dump after converting virtual registers to hard registers.
16694
16695 -fdump-rtl-web
16696 Dump after live range splitting.
16697
16698 -fdump-rtl-regclass
16699 -fdump-rtl-subregs_of_mode_init
16700 -fdump-rtl-subregs_of_mode_finish
16701 -fdump-rtl-dfinit
16702 -fdump-rtl-dfinish
16703 These dumps are defined but always produce empty files.
16704
16705 -da
16706 -fdump-rtl-all
16707 Produce all the dumps listed above.
16708
16709 -dA Annotate the assembler output with miscellaneous debugging
16710 information.
16711
16712 -dD Dump all macro definitions, at the end of preprocessing, in
16713 addition to normal output.
16714
16715 -dH Produce a core dump whenever an error occurs.
16716
16717 -dp Annotate the assembler output with a comment indicating which
16718 pattern and alternative is used. The length and cost of each
16719 instruction are also printed.
16720
16721 -dP Dump the RTL in the assembler output as a comment before each
16722 instruction. Also turns on -dp annotation.
16723
16724 -dx Just generate RTL for a function instead of compiling it.
16725 Usually used with -fdump-rtl-expand.
16726
16727 -fdump-debug
16728 Dump debugging information generated during the debug generation
16729 phase.
16730
16731 -fdump-earlydebug
16732 Dump debugging information generated during the early debug
16733 generation phase.
16734
16735 -fdump-noaddr
16736 When doing debugging dumps, suppress address output. This makes it
16737 more feasible to use diff on debugging dumps for compiler
16738 invocations with different compiler binaries and/or different text
16739 / bss / data / heap / stack / dso start locations.
16740
16741 -freport-bug
16742 Collect and dump debug information into a temporary file if an
16743 internal compiler error (ICE) occurs.
16744
16745 -fdump-unnumbered
16746 When doing debugging dumps, suppress instruction numbers and
16747 address output. This makes it more feasible to use diff on
16748 debugging dumps for compiler invocations with different options, in
16749 particular with and without -g.
16750
16751 -fdump-unnumbered-links
16752 When doing debugging dumps (see -d option above), suppress
16753 instruction numbers for the links to the previous and next
16754 instructions in a sequence.
16755
16756 -fdump-ipa-switch
16757 -fdump-ipa-switch-options
16758 Control the dumping at various stages of inter-procedural analysis
16759 language tree to a file. The file name is generated by appending a
16760 switch specific suffix to the source file name, and the file is
16761 created in the same directory as the output file. The following
16762 dumps are possible:
16763
16764 all Enables all inter-procedural analysis dumps.
16765
16766 cgraph
16767 Dumps information about call-graph optimization, unused
16768 function removal, and inlining decisions.
16769
16770 inline
16771 Dump after function inlining.
16772
16773 Additionally, the options -optimized, -missed, -note, and -all can
16774 be provided, with the same meaning as for -fopt-info, defaulting to
16775 -optimized.
16776
16777 For example, -fdump-ipa-inline-optimized-missed will emit
16778 information on callsites that were inlined, along with callsites
16779 that were not inlined.
16780
16781 By default, the dump will contain messages about successful
16782 optimizations (equivalent to -optimized) together with low-level
16783 details about the analysis.
16784
16785 -fdump-lang
16786 Dump language-specific information. The file name is made by
16787 appending .lang to the source file name.
16788
16789 -fdump-lang-all
16790 -fdump-lang-switch
16791 -fdump-lang-switch-options
16792 -fdump-lang-switch-options=filename
16793 Control the dumping of language-specific information. The options
16794 and filename portions behave as described in the -fdump-tree
16795 option. The following switch values are accepted:
16796
16797 all Enable all language-specific dumps.
16798
16799 class
16800 Dump class hierarchy information. Virtual table information is
16801 emitted unless 'slim' is specified. This option is applicable
16802 to C++ only.
16803
16804 module
16805 Dump module information. Options lineno (locations), graph
16806 (reachability), blocks (clusters), uid (serialization), alias
16807 (mergeable), asmname (Elrond), eh (mapper) & vops (macros) may
16808 provide additional information. This option is applicable to
16809 C++ only.
16810
16811 raw Dump the raw internal tree data. This option is applicable to
16812 C++ only.
16813
16814 -fdump-passes
16815 Print on stderr the list of optimization passes that are turned on
16816 and off by the current command-line options.
16817
16818 -fdump-statistics-option
16819 Enable and control dumping of pass statistics in a separate file.
16820 The file name is generated by appending a suffix ending in
16821 .statistics to the source file name, and the file is created in the
16822 same directory as the output file. If the -option form is used,
16823 -stats causes counters to be summed over the whole compilation unit
16824 while -details dumps every event as the passes generate them. The
16825 default with no option is to sum counters for each function
16826 compiled.
16827
16828 -fdump-tree-all
16829 -fdump-tree-switch
16830 -fdump-tree-switch-options
16831 -fdump-tree-switch-options=filename
16832 Control the dumping at various stages of processing the
16833 intermediate language tree to a file. If the -options form is
16834 used, options is a list of - separated options which control the
16835 details of the dump. Not all options are applicable to all dumps;
16836 those that are not meaningful are ignored. The following options
16837 are available
16838
16839 address
16840 Print the address of each node. Usually this is not meaningful
16841 as it changes according to the environment and source file.
16842 Its primary use is for tying up a dump file with a debug
16843 environment.
16844
16845 asmname
16846 If "DECL_ASSEMBLER_NAME" has been set for a given decl, use
16847 that in the dump instead of "DECL_NAME". Its primary use is
16848 ease of use working backward from mangled names in the assembly
16849 file.
16850
16851 slim
16852 When dumping front-end intermediate representations, inhibit
16853 dumping of members of a scope or body of a function merely
16854 because that scope has been reached. Only dump such items when
16855 they are directly reachable by some other path.
16856
16857 When dumping pretty-printed trees, this option inhibits dumping
16858 the bodies of control structures.
16859
16860 When dumping RTL, print the RTL in slim (condensed) form
16861 instead of the default LISP-like representation.
16862
16863 raw Print a raw representation of the tree. By default, trees are
16864 pretty-printed into a C-like representation.
16865
16866 details
16867 Enable more detailed dumps (not honored by every dump option).
16868 Also include information from the optimization passes.
16869
16870 stats
16871 Enable dumping various statistics about the pass (not honored
16872 by every dump option).
16873
16874 blocks
16875 Enable showing basic block boundaries (disabled in raw dumps).
16876
16877 graph
16878 For each of the other indicated dump files (-fdump-rtl-pass),
16879 dump a representation of the control flow graph suitable for
16880 viewing with GraphViz to file.passid.pass.dot. Each function
16881 in the file is pretty-printed as a subgraph, so that GraphViz
16882 can render them all in a single plot.
16883
16884 This option currently only works for RTL dumps, and the RTL is
16885 always dumped in slim form.
16886
16887 vops
16888 Enable showing virtual operands for every statement.
16889
16890 lineno
16891 Enable showing line numbers for statements.
16892
16893 uid Enable showing the unique ID ("DECL_UID") for each variable.
16894
16895 verbose
16896 Enable showing the tree dump for each statement.
16897
16898 eh Enable showing the EH region number holding each statement.
16899
16900 scev
16901 Enable showing scalar evolution analysis details.
16902
16903 optimized
16904 Enable showing optimization information (only available in
16905 certain passes).
16906
16907 missed
16908 Enable showing missed optimization information (only available
16909 in certain passes).
16910
16911 note
16912 Enable other detailed optimization information (only available
16913 in certain passes).
16914
16915 all Turn on all options, except raw, slim, verbose and lineno.
16916
16917 optall
16918 Turn on all optimization options, i.e., optimized, missed, and
16919 note.
16920
16921 To determine what tree dumps are available or find the dump for a
16922 pass of interest follow the steps below.
16923
16924 1. Invoke GCC with -fdump-passes and in the stderr output look for
16925 a code that corresponds to the pass you are interested in. For
16926 example, the codes "tree-evrp", "tree-vrp1", and "tree-vrp2"
16927 correspond to the three Value Range Propagation passes. The
16928 number at the end distinguishes distinct invocations of the
16929 same pass.
16930
16931 2. To enable the creation of the dump file, append the pass code
16932 to the -fdump- option prefix and invoke GCC with it. For
16933 example, to enable the dump from the Early Value Range
16934 Propagation pass, invoke GCC with the -fdump-tree-evrp option.
16935 Optionally, you may specify the name of the dump file. If you
16936 don't specify one, GCC creates as described below.
16937
16938 3. Find the pass dump in a file whose name is composed of three
16939 components separated by a period: the name of the source file
16940 GCC was invoked to compile, a numeric suffix indicating the
16941 pass number followed by the letter t for tree passes (and the
16942 letter r for RTL passes), and finally the pass code. For
16943 example, the Early VRP pass dump might be in a file named
16944 myfile.c.038t.evrp in the current working directory. Note that
16945 the numeric codes are not stable and may change from one
16946 version of GCC to another.
16947
16948 -fopt-info
16949 -fopt-info-options
16950 -fopt-info-options=filename
16951 Controls optimization dumps from various optimization passes. If
16952 the -options form is used, options is a list of - separated option
16953 keywords to select the dump details and optimizations.
16954
16955 The options can be divided into three groups:
16956
16957 1. options describing what kinds of messages should be emitted,
16958
16959 2. options describing the verbosity of the dump, and
16960
16961 3. options describing which optimizations should be included.
16962
16963 The options from each group can be freely mixed as they are non-
16964 overlapping. However, in case of any conflicts, the later options
16965 override the earlier options on the command line.
16966
16967 The following options control which kinds of messages should be
16968 emitted:
16969
16970 optimized
16971 Print information when an optimization is successfully applied.
16972 It is up to a pass to decide which information is relevant. For
16973 example, the vectorizer passes print the source location of
16974 loops which are successfully vectorized.
16975
16976 missed
16977 Print information about missed optimizations. Individual passes
16978 control which information to include in the output.
16979
16980 note
16981 Print verbose information about optimizations, such as certain
16982 transformations, more detailed messages about decisions etc.
16983
16984 all Print detailed optimization information. This includes
16985 optimized, missed, and note.
16986
16987 The following option controls the dump verbosity:
16988
16989 internals
16990 By default, only "high-level" messages are emitted. This option
16991 enables additional, more detailed, messages, which are likely
16992 to only be of interest to GCC developers.
16993
16994 One or more of the following option keywords can be used to
16995 describe a group of optimizations:
16996
16997 ipa Enable dumps from all interprocedural optimizations.
16998
16999 loop
17000 Enable dumps from all loop optimizations.
17001
17002 inline
17003 Enable dumps from all inlining optimizations.
17004
17005 omp Enable dumps from all OMP (Offloading and Multi Processing)
17006 optimizations.
17007
17008 vec Enable dumps from all vectorization optimizations.
17009
17010 optall
17011 Enable dumps from all optimizations. This is a superset of the
17012 optimization groups listed above.
17013
17014 If options is omitted, it defaults to optimized-optall, which means
17015 to dump messages about successful optimizations from all the
17016 passes, omitting messages that are treated as "internals".
17017
17018 If the filename is provided, then the dumps from all the applicable
17019 optimizations are concatenated into the filename. Otherwise the
17020 dump is output onto stderr. Though multiple -fopt-info options are
17021 accepted, only one of them can include a filename. If other
17022 filenames are provided then all but the first such option are
17023 ignored.
17024
17025 Note that the output filename is overwritten in case of multiple
17026 translation units. If a combined output from multiple translation
17027 units is desired, stderr should be used instead.
17028
17029 In the following example, the optimization info is output to
17030 stderr:
17031
17032 gcc -O3 -fopt-info
17033
17034 This example:
17035
17036 gcc -O3 -fopt-info-missed=missed.all
17037
17038 outputs missed optimization report from all the passes into
17039 missed.all, and this one:
17040
17041 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
17042
17043 prints information about missed optimization opportunities from
17044 vectorization passes on stderr. Note that -fopt-info-vec-missed is
17045 equivalent to -fopt-info-missed-vec. The order of the optimization
17046 group names and message types listed after -fopt-info does not
17047 matter.
17048
17049 As another example,
17050
17051 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
17052
17053 outputs information about missed optimizations as well as optimized
17054 locations from all the inlining passes into inline.txt.
17055
17056 Finally, consider:
17057
17058 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
17059
17060 Here the two output filenames vec.miss and loop.opt are in conflict
17061 since only one output file is allowed. In this case, only the first
17062 option takes effect and the subsequent options are ignored. Thus
17063 only vec.miss is produced which contains dumps from the vectorizer
17064 about missed opportunities.
17065
17066 -fsave-optimization-record
17067 Write a SRCFILE.opt-record.json.gz file detailing what
17068 optimizations were performed, for those optimizations that support
17069 -fopt-info.
17070
17071 This option is experimental and the format of the data within the
17072 compressed JSON file is subject to change.
17073
17074 It is roughly equivalent to a machine-readable version of
17075 -fopt-info-all, as a collection of messages with source file, line
17076 number and column number, with the following additional data for
17077 each message:
17078
17079 * the execution count of the code being optimized, along with
17080 metadata about whether this was from actual profile data, or
17081 just an estimate, allowing consumers to prioritize messages by
17082 code hotness,
17083
17084 * the function name of the code being optimized, where
17085 applicable,
17086
17087 * the "inlining chain" for the code being optimized, so that when
17088 a function is inlined into several different places (which
17089 might themselves be inlined), the reader can distinguish
17090 between the copies,
17091
17092 * objects identifying those parts of the message that refer to
17093 expressions, statements or symbol-table nodes, which of these
17094 categories they are, and, when available, their source code
17095 location,
17096
17097 * the GCC pass that emitted the message, and
17098
17099 * the location in GCC's own code from which the message was
17100 emitted
17101
17102 Additionally, some messages are logically nested within other
17103 messages, reflecting implementation details of the optimization
17104 passes.
17105
17106 -fsched-verbose=n
17107 On targets that use instruction scheduling, this option controls
17108 the amount of debugging output the scheduler prints to the dump
17109 files.
17110
17111 For n greater than zero, -fsched-verbose outputs the same
17112 information as -fdump-rtl-sched1 and -fdump-rtl-sched2. For n
17113 greater than one, it also output basic block probabilities,
17114 detailed ready list information and unit/insn info. For n greater
17115 than two, it includes RTL at abort point, control-flow and regions
17116 info. And for n over four, -fsched-verbose also includes
17117 dependence info.
17118
17119 -fenable-kind-pass
17120 -fdisable-kind-pass=range-list
17121 This is a set of options that are used to explicitly disable/enable
17122 optimization passes. These options are intended for use for
17123 debugging GCC. Compiler users should use regular options for
17124 enabling/disabling passes instead.
17125
17126 -fdisable-ipa-pass
17127 Disable IPA pass pass. pass is the pass name. If the same pass
17128 is statically invoked in the compiler multiple times, the pass
17129 name should be appended with a sequential number starting from
17130 1.
17131
17132 -fdisable-rtl-pass
17133 -fdisable-rtl-pass=range-list
17134 Disable RTL pass pass. pass is the pass name. If the same
17135 pass is statically invoked in the compiler multiple times, the
17136 pass name should be appended with a sequential number starting
17137 from 1. range-list is a comma-separated list of function
17138 ranges or assembler names. Each range is a number pair
17139 separated by a colon. The range is inclusive in both ends. If
17140 the range is trivial, the number pair can be simplified as a
17141 single number. If the function's call graph node's uid falls
17142 within one of the specified ranges, the pass is disabled for
17143 that function. The uid is shown in the function header of a
17144 dump file, and the pass names can be dumped by using option
17145 -fdump-passes.
17146
17147 -fdisable-tree-pass
17148 -fdisable-tree-pass=range-list
17149 Disable tree pass pass. See -fdisable-rtl for the description
17150 of option arguments.
17151
17152 -fenable-ipa-pass
17153 Enable IPA pass pass. pass is the pass name. If the same pass
17154 is statically invoked in the compiler multiple times, the pass
17155 name should be appended with a sequential number starting from
17156 1.
17157
17158 -fenable-rtl-pass
17159 -fenable-rtl-pass=range-list
17160 Enable RTL pass pass. See -fdisable-rtl for option argument
17161 description and examples.
17162
17163 -fenable-tree-pass
17164 -fenable-tree-pass=range-list
17165 Enable tree pass pass. See -fdisable-rtl for the description
17166 of option arguments.
17167
17168 Here are some examples showing uses of these options.
17169
17170 # disable ccp1 for all functions
17171 -fdisable-tree-ccp1
17172 # disable complete unroll for function whose cgraph node uid is 1
17173 -fenable-tree-cunroll=1
17174 # disable gcse2 for functions at the following ranges [1,1],
17175 # [300,400], and [400,1000]
17176 # disable gcse2 for functions foo and foo2
17177 -fdisable-rtl-gcse2=foo,foo2
17178 # disable early inlining
17179 -fdisable-tree-einline
17180 # disable ipa inlining
17181 -fdisable-ipa-inline
17182 # enable tree full unroll
17183 -fenable-tree-unroll
17184
17185 -fchecking
17186 -fchecking=n
17187 Enable internal consistency checking. The default depends on the
17188 compiler configuration. -fchecking=2 enables further internal
17189 consistency checking that might affect code generation.
17190
17191 -frandom-seed=string
17192 This option provides a seed that GCC uses in place of random
17193 numbers in generating certain symbol names that have to be
17194 different in every compiled file. It is also used to place unique
17195 stamps in coverage data files and the object files that produce
17196 them. You can use the -frandom-seed option to produce reproducibly
17197 identical object files.
17198
17199 The string can either be a number (decimal, octal or hex) or an
17200 arbitrary string (in which case it's converted to a number by
17201 computing CRC32).
17202
17203 The string should be different for every file you compile.
17204
17205 -save-temps
17206 Store the usual "temporary" intermediate files permanently; name
17207 them as auxiliary output files, as specified described under
17208 -dumpbase and -dumpdir.
17209
17210 When used in combination with the -x command-line option,
17211 -save-temps is sensible enough to avoid overwriting an input source
17212 file with the same extension as an intermediate file. The
17213 corresponding intermediate file may be obtained by renaming the
17214 source file before using -save-temps.
17215
17216 -save-temps=cwd
17217 Equivalent to -save-temps -dumpdir ./.
17218
17219 -save-temps=obj
17220 Equivalent to -save-temps -dumpdir outdir/, where outdir/ is the
17221 directory of the output file specified after the -o option,
17222 including any directory separators. If the -o option is not used,
17223 the -save-temps=obj switch behaves like -save-temps=cwd.
17224
17225 -time[=file]
17226 Report the CPU time taken by each subprocess in the compilation
17227 sequence. For C source files, this is the compiler proper and
17228 assembler (plus the linker if linking is done).
17229
17230 Without the specification of an output file, the output looks like
17231 this:
17232
17233 # cc1 0.12 0.01
17234 # as 0.00 0.01
17235
17236 The first number on each line is the "user time", that is time
17237 spent executing the program itself. The second number is "system
17238 time", time spent executing operating system routines on behalf of
17239 the program. Both numbers are in seconds.
17240
17241 With the specification of an output file, the output is appended to
17242 the named file, and it looks like this:
17243
17244 0.12 0.01 cc1 <options>
17245 0.00 0.01 as <options>
17246
17247 The "user time" and the "system time" are moved before the program
17248 name, and the options passed to the program are displayed, so that
17249 one can later tell what file was being compiled, and with which
17250 options.
17251
17252 -fdump-final-insns[=file]
17253 Dump the final internal representation (RTL) to file. If the
17254 optional argument is omitted (or if file is "."), the name of the
17255 dump file is determined by appending ".gkd" to the dump base name,
17256 see -dumpbase.
17257
17258 -fcompare-debug[=opts]
17259 If no error occurs during compilation, run the compiler a second
17260 time, adding opts and -fcompare-debug-second to the arguments
17261 passed to the second compilation. Dump the final internal
17262 representation in both compilations, and print an error if they
17263 differ.
17264
17265 If the equal sign is omitted, the default -gtoggle is used.
17266
17267 The environment variable GCC_COMPARE_DEBUG, if defined, non-empty
17268 and nonzero, implicitly enables -fcompare-debug. If
17269 GCC_COMPARE_DEBUG is defined to a string starting with a dash, then
17270 it is used for opts, otherwise the default -gtoggle is used.
17271
17272 -fcompare-debug=, with the equal sign but without opts, is
17273 equivalent to -fno-compare-debug, which disables the dumping of the
17274 final representation and the second compilation, preventing even
17275 GCC_COMPARE_DEBUG from taking effect.
17276
17277 To verify full coverage during -fcompare-debug testing, set
17278 GCC_COMPARE_DEBUG to say -fcompare-debug-not-overridden, which GCC
17279 rejects as an invalid option in any actual compilation (rather than
17280 preprocessing, assembly or linking). To get just a warning,
17281 setting GCC_COMPARE_DEBUG to -w%n-fcompare-debug not overridden
17282 will do.
17283
17284 -fcompare-debug-second
17285 This option is implicitly passed to the compiler for the second
17286 compilation requested by -fcompare-debug, along with options to
17287 silence warnings, and omitting other options that would cause the
17288 compiler to produce output to files or to standard output as a side
17289 effect. Dump files and preserved temporary files are renamed so as
17290 to contain the ".gk" additional extension during the second
17291 compilation, to avoid overwriting those generated by the first.
17292
17293 When this option is passed to the compiler driver, it causes the
17294 first compilation to be skipped, which makes it useful for little
17295 other than debugging the compiler proper.
17296
17297 -gtoggle
17298 Turn off generation of debug info, if leaving out this option
17299 generates it, or turn it on at level 2 otherwise. The position of
17300 this argument in the command line does not matter; it takes effect
17301 after all other options are processed, and it does so only once, no
17302 matter how many times it is given. This is mainly intended to be
17303 used with -fcompare-debug.
17304
17305 -fvar-tracking-assignments-toggle
17306 Toggle -fvar-tracking-assignments, in the same way that -gtoggle
17307 toggles -g.
17308
17309 -Q Makes the compiler print out each function name as it is compiled,
17310 and print some statistics about each pass when it finishes.
17311
17312 -ftime-report
17313 Makes the compiler print some statistics about the time consumed by
17314 each pass when it finishes.
17315
17316 -ftime-report-details
17317 Record the time consumed by infrastructure parts separately for
17318 each pass.
17319
17320 -fira-verbose=n
17321 Control the verbosity of the dump file for the integrated register
17322 allocator. The default value is 5. If the value n is greater or
17323 equal to 10, the dump output is sent to stderr using the same
17324 format as n minus 10.
17325
17326 -flto-report
17327 Prints a report with internal details on the workings of the link-
17328 time optimizer. The contents of this report vary from version to
17329 version. It is meant to be useful to GCC developers when
17330 processing object files in LTO mode (via -flto).
17331
17332 Disabled by default.
17333
17334 -flto-report-wpa
17335 Like -flto-report, but only print for the WPA phase of link-time
17336 optimization.
17337
17338 -fmem-report
17339 Makes the compiler print some statistics about permanent memory
17340 allocation when it finishes.
17341
17342 -fmem-report-wpa
17343 Makes the compiler print some statistics about permanent memory
17344 allocation for the WPA phase only.
17345
17346 -fpre-ipa-mem-report
17347 -fpost-ipa-mem-report
17348 Makes the compiler print some statistics about permanent memory
17349 allocation before or after interprocedural optimization.
17350
17351 -fmultiflags
17352 This option enables multilib-aware "TFLAGS" to be used to build
17353 target libraries with options different from those the compiler is
17354 configured to use by default, through the use of specs
17355
17356 Like "TFLAGS", this allows the target libraries to be built for
17357 portable baseline environments, while the compiler defaults to more
17358 demanding ones. That's useful because users can easily override
17359 the defaults the compiler is configured to use to build their own
17360 programs, if the defaults are not ideal for their target
17361 environment, whereas rebuilding the runtime libraries is usually
17362 not as easy or desirable.
17363
17364 Unlike "TFLAGS", the use of specs enables different flags to be
17365 selected for different multilibs. The way to accomplish that is to
17366 build with make TFLAGS=-fmultiflags, after configuring
17367 --with-specs=%{fmultiflags:...}.
17368
17369 This option is discarded by the driver once it's done processing
17370 driver self spec.
17371
17372 It is also useful to check that "TFLAGS" are being used to build
17373 all target libraries, by configuring a non-bootstrap compiler
17374 --with-specs='%{!fmultiflags:%emissing TFLAGS}' and building the
17375 compiler and target libraries.
17376
17377 -fprofile-report
17378 Makes the compiler print some statistics about consistency of the
17379 (estimated) profile and effect of individual passes.
17380
17381 -fstack-usage
17382 Makes the compiler output stack usage information for the program,
17383 on a per-function basis. The filename for the dump is made by
17384 appending .su to the auxname. auxname is generated from the name
17385 of the output file, if explicitly specified and it is not an
17386 executable, otherwise it is the basename of the source file. An
17387 entry is made up of three fields:
17388
17389 * The name of the function.
17390
17391 * A number of bytes.
17392
17393 * One or more qualifiers: "static", "dynamic", "bounded".
17394
17395 The qualifier "static" means that the function manipulates the
17396 stack statically: a fixed number of bytes are allocated for the
17397 frame on function entry and released on function exit; no stack
17398 adjustments are otherwise made in the function. The second field
17399 is this fixed number of bytes.
17400
17401 The qualifier "dynamic" means that the function manipulates the
17402 stack dynamically: in addition to the static allocation described
17403 above, stack adjustments are made in the body of the function, for
17404 example to push/pop arguments around function calls. If the
17405 qualifier "bounded" is also present, the amount of these
17406 adjustments is bounded at compile time and the second field is an
17407 upper bound of the total amount of stack used by the function. If
17408 it is not present, the amount of these adjustments is not bounded
17409 at compile time and the second field only represents the bounded
17410 part.
17411
17412 -fstats
17413 Emit statistics about front-end processing at the end of the
17414 compilation. This option is supported only by the C++ front end,
17415 and the information is generally only useful to the G++ development
17416 team.
17417
17418 -fdbg-cnt-list
17419 Print the name and the counter upper bound for all debug counters.
17420
17421 -fdbg-cnt=counter-value-list
17422 Set the internal debug counter lower and upper bound. counter-
17423 value-list is a comma-separated list of
17424 name:lower_bound1-upper_bound1 [:lower_bound2-upper_bound2...]
17425 tuples which sets the name of the counter and list of closed
17426 intervals. The lower_bound is optional and is zero initialized if
17427 not set. For example, with -fdbg-cnt=dce:2-4:10-11,tail_call:10,
17428 dbg_cnt(dce) returns true only for second, third, fourth, tenth and
17429 eleventh invocation. For dbg_cnt(tail_call) true is returned for
17430 first 10 invocations.
17431
17432 -print-file-name=library
17433 Print the full absolute name of the library file library that would
17434 be used when linking---and don't do anything else. With this
17435 option, GCC does not compile or link anything; it just prints the
17436 file name.
17437
17438 -print-multi-directory
17439 Print the directory name corresponding to the multilib selected by
17440 any other switches present in the command line. This directory is
17441 supposed to exist in GCC_EXEC_PREFIX.
17442
17443 -print-multi-lib
17444 Print the mapping from multilib directory names to compiler
17445 switches that enable them. The directory name is separated from
17446 the switches by ;, and each switch starts with an @ instead of the
17447 -, without spaces between multiple switches. This is supposed to
17448 ease shell processing.
17449
17450 -print-multi-os-directory
17451 Print the path to OS libraries for the selected multilib, relative
17452 to some lib subdirectory. If OS libraries are present in the lib
17453 subdirectory and no multilibs are used, this is usually just ., if
17454 OS libraries are present in libsuffix sibling directories this
17455 prints e.g. ../lib64, ../lib or ../lib32, or if OS libraries are
17456 present in lib/subdir subdirectories it prints e.g. amd64, sparcv9
17457 or ev6.
17458
17459 -print-multiarch
17460 Print the path to OS libraries for the selected multiarch, relative
17461 to some lib subdirectory.
17462
17463 -print-prog-name=program
17464 Like -print-file-name, but searches for a program such as cpp.
17465
17466 -print-libgcc-file-name
17467 Same as -print-file-name=libgcc.a.
17468
17469 This is useful when you use -nostdlib or -nodefaultlibs but you do
17470 want to link with libgcc.a. You can do:
17471
17472 gcc -nostdlib <files>... `gcc -print-libgcc-file-name`
17473
17474 -print-search-dirs
17475 Print the name of the configured installation directory and a list
17476 of program and library directories gcc searches---and don't do
17477 anything else.
17478
17479 This is useful when gcc prints the error message installation
17480 problem, cannot exec cpp0: No such file or directory. To resolve
17481 this you either need to put cpp0 and the other compiler components
17482 where gcc expects to find them, or you can set the environment
17483 variable GCC_EXEC_PREFIX to the directory where you installed them.
17484 Don't forget the trailing /.
17485
17486 -print-sysroot
17487 Print the target sysroot directory that is used during compilation.
17488 This is the target sysroot specified either at configure time or
17489 using the --sysroot option, possibly with an extra suffix that
17490 depends on compilation options. If no target sysroot is specified,
17491 the option prints nothing.
17492
17493 -print-sysroot-headers-suffix
17494 Print the suffix added to the target sysroot when searching for
17495 headers, or give an error if the compiler is not configured with
17496 such a suffix---and don't do anything else.
17497
17498 -dumpmachine
17499 Print the compiler's target machine (for example,
17500 i686-pc-linux-gnu)---and don't do anything else.
17501
17502 -dumpversion
17503 Print the compiler version (for example, 3.0, 6.3.0 or 7)---and
17504 don't do anything else. This is the compiler version used in
17505 filesystem paths and specs. Depending on how the compiler has been
17506 configured it can be just a single number (major version), two
17507 numbers separated by a dot (major and minor version) or three
17508 numbers separated by dots (major, minor and patchlevel version).
17509
17510 -dumpfullversion
17511 Print the full compiler version---and don't do anything else. The
17512 output is always three numbers separated by dots, major, minor and
17513 patchlevel version.
17514
17515 -dumpspecs
17516 Print the compiler's built-in specs---and don't do anything else.
17517 (This is used when GCC itself is being built.)
17518
17519 Machine-Dependent Options
17520 Each target machine supported by GCC can have its own options---for
17521 example, to allow you to compile for a particular processor variant or
17522 ABI, or to control optimizations specific to that machine. By
17523 convention, the names of machine-specific options start with -m.
17524
17525 Some configurations of the compiler also support additional target-
17526 specific options, usually for compatibility with other compilers on the
17527 same platform.
17528
17529 AArch64 Options
17530 These options are defined for AArch64 implementations:
17531
17532 -mabi=name
17533 Generate code for the specified data model. Permissible values are
17534 ilp32 for SysV-like data model where int, long int and pointers are
17535 32 bits, and lp64 for SysV-like data model where int is 32 bits,
17536 but long int and pointers are 64 bits.
17537
17538 The default depends on the specific target configuration. Note
17539 that the LP64 and ILP32 ABIs are not link-compatible; you must
17540 compile your entire program with the same ABI, and link with a
17541 compatible set of libraries.
17542
17543 -mbig-endian
17544 Generate big-endian code. This is the default when GCC is
17545 configured for an aarch64_be-*-* target.
17546
17547 -mgeneral-regs-only
17548 Generate code which uses only the general-purpose registers. This
17549 will prevent the compiler from using floating-point and Advanced
17550 SIMD registers but will not impose any restrictions on the
17551 assembler.
17552
17553 -mlittle-endian
17554 Generate little-endian code. This is the default when GCC is
17555 configured for an aarch64-*-* but not an aarch64_be-*-* target.
17556
17557 -mcmodel=tiny
17558 Generate code for the tiny code model. The program and its
17559 statically defined symbols must be within 1MB of each other.
17560 Programs can be statically or dynamically linked.
17561
17562 -mcmodel=small
17563 Generate code for the small code model. The program and its
17564 statically defined symbols must be within 4GB of each other.
17565 Programs can be statically or dynamically linked. This is the
17566 default code model.
17567
17568 -mcmodel=large
17569 Generate code for the large code model. This makes no assumptions
17570 about addresses and sizes of sections. Programs can be statically
17571 linked only. The -mcmodel=large option is incompatible with
17572 -mabi=ilp32, -fpic and -fPIC.
17573
17574 -mstrict-align
17575 -mno-strict-align
17576 Avoid or allow generating memory accesses that may not be aligned
17577 on a natural object boundary as described in the architecture
17578 specification.
17579
17580 -momit-leaf-frame-pointer
17581 -mno-omit-leaf-frame-pointer
17582 Omit or keep the frame pointer in leaf functions. The former
17583 behavior is the default.
17584
17585 -mstack-protector-guard=guard
17586 -mstack-protector-guard-reg=reg
17587 -mstack-protector-guard-offset=offset
17588 Generate stack protection code using canary at guard. Supported
17589 locations are global for a global canary or sysreg for a canary in
17590 an appropriate system register.
17591
17592 With the latter choice the options -mstack-protector-guard-reg=reg
17593 and -mstack-protector-guard-offset=offset furthermore specify which
17594 system register to use as base register for reading the canary, and
17595 from what offset from that base register. There is no default
17596 register or offset as this is entirely for use within the Linux
17597 kernel.
17598
17599 -mtls-dialect=desc
17600 Use TLS descriptors as the thread-local storage mechanism for
17601 dynamic accesses of TLS variables. This is the default.
17602
17603 -mtls-dialect=traditional
17604 Use traditional TLS as the thread-local storage mechanism for
17605 dynamic accesses of TLS variables.
17606
17607 -mtls-size=size
17608 Specify bit size of immediate TLS offsets. Valid values are 12,
17609 24, 32, 48. This option requires binutils 2.26 or newer.
17610
17611 -mfix-cortex-a53-835769
17612 -mno-fix-cortex-a53-835769
17613 Enable or disable the workaround for the ARM Cortex-A53 erratum
17614 number 835769. This involves inserting a NOP instruction between
17615 memory instructions and 64-bit integer multiply-accumulate
17616 instructions.
17617
17618 -mfix-cortex-a53-843419
17619 -mno-fix-cortex-a53-843419
17620 Enable or disable the workaround for the ARM Cortex-A53 erratum
17621 number 843419. This erratum workaround is made at link time and
17622 this will only pass the corresponding flag to the linker.
17623
17624 -mlow-precision-recip-sqrt
17625 -mno-low-precision-recip-sqrt
17626 Enable or disable the reciprocal square root approximation. This
17627 option only has an effect if -ffast-math or
17628 -funsafe-math-optimizations is used as well. Enabling this reduces
17629 precision of reciprocal square root results to about 16 bits for
17630 single precision and to 32 bits for double precision.
17631
17632 -mlow-precision-sqrt
17633 -mno-low-precision-sqrt
17634 Enable or disable the square root approximation. This option only
17635 has an effect if -ffast-math or -funsafe-math-optimizations is used
17636 as well. Enabling this reduces precision of square root results to
17637 about 16 bits for single precision and to 32 bits for double
17638 precision. If enabled, it implies -mlow-precision-recip-sqrt.
17639
17640 -mlow-precision-div
17641 -mno-low-precision-div
17642 Enable or disable the division approximation. This option only has
17643 an effect if -ffast-math or -funsafe-math-optimizations is used as
17644 well. Enabling this reduces precision of division results to about
17645 16 bits for single precision and to 32 bits for double precision.
17646
17647 -mtrack-speculation
17648 -mno-track-speculation
17649 Enable or disable generation of additional code to track
17650 speculative execution through conditional branches. The tracking
17651 state can then be used by the compiler when expanding calls to
17652 "__builtin_speculation_safe_copy" to permit a more efficient code
17653 sequence to be generated.
17654
17655 -moutline-atomics
17656 -mno-outline-atomics
17657 Enable or disable calls to out-of-line helpers to implement atomic
17658 operations. These helpers will, at runtime, determine if the LSE
17659 instructions from ARMv8.1-A can be used; if not, they will use the
17660 load/store-exclusive instructions that are present in the base
17661 ARMv8.0 ISA.
17662
17663 This option is only applicable when compiling for the base ARMv8.0
17664 instruction set. If using a later revision, e.g. -march=armv8.1-a
17665 or -march=armv8-a+lse, the ARMv8.1-Atomics instructions will be
17666 used directly. The same applies when using -mcpu= when the
17667 selected cpu supports the lse feature. This option is on by
17668 default.
17669
17670 -march=name
17671 Specify the name of the target architecture and, optionally, one or
17672 more feature modifiers. This option has the form
17673 -march=arch{+[no]feature}*.
17674
17675 The table below summarizes the permissible values for arch and the
17676 features that they enable by default:
17677
17678 arch value : Architecture : Includes by default
17679 armv8-a : Armv8-A : +fp, +simd
17680 armv8.1-a : Armv8.1-A : armv8-a, +crc, +lse, +rdma
17681 armv8.2-a : Armv8.2-A : armv8.1-a
17682 armv8.3-a : Armv8.3-A : armv8.2-a, +pauth
17683 armv8.4-a : Armv8.4-A : armv8.3-a, +flagm, +fp16fml, +dotprod
17684 armv8.5-a : Armv8.5-A : armv8.4-a, +sb, +ssbs, +predres
17685 armv8.6-a : Armv8.6-A : armv8.5-a, +bf16, +i8mm
17686 armv8.7-a : Armv8.7-A : armv8.6-a, +ls64
17687 armv8.8-a : Armv8.8-a : armv8.7-a, +mops
17688 armv9-a : Armv9-A : armv8.5-a, +sve, +sve2
17689 armv9.1-a : Armv9.1-A : armv9-a, +bf16, +i8mm
17690 armv9.2-a : Armv9.2-A : armv9.1-a, +ls64
17691 armv9.3-a : Armv9.3-A : armv9.2-a, +mops
17692 armv8-r : Armv8-R : armv8-r
17693
17694 The value native is available on native AArch64 GNU/Linux and
17695 causes the compiler to pick the architecture of the host system.
17696 This option has no effect if the compiler is unable to recognize
17697 the architecture of the host system,
17698
17699 The permissible values for feature are listed in the sub-section on
17700 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
17701 Where conflicting feature modifiers are specified, the right-most
17702 feature is used.
17703
17704 GCC uses name to determine what kind of instructions it can emit
17705 when generating assembly code. If -march is specified without
17706 either of -mtune or -mcpu also being specified, the code is tuned
17707 to perform well across a range of target processors implementing
17708 the target architecture.
17709
17710 -mtune=name
17711 Specify the name of the target processor for which GCC should tune
17712 the performance of the code. Permissible values for this option
17713 are: generic, cortex-a35, cortex-a53, cortex-a55, cortex-a57,
17714 cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae,
17715 cortex-a77, cortex-a65, cortex-a65ae, cortex-a34, cortex-a78,
17716 cortex-a78ae, cortex-a78c, ares, exynos-m1, emag, falkor,
17717 neoverse-512tvb, neoverse-e1, neoverse-n1, neoverse-n2,
17718 neoverse-v1, neoverse-v2, qdf24xx, saphira, phecda, xgene1, vulcan,
17719 octeontx, octeontx81, octeontx83, octeontx2, octeontx2t98,
17720 octeontx2t96 octeontx2t93, octeontx2f95, octeontx2f95n,
17721 octeontx2f95mm, a64fx, thunderx, thunderxt88, thunderxt88p1,
17722 thunderxt81, tsv110, thunderxt83, thunderx2t99, thunderx3t110,
17723 zeus, cortex-a57.cortex-a53, cortex-a72.cortex-a53,
17724 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
17725 cortex-a75.cortex-a55, cortex-a76.cortex-a55, cortex-r82,
17726 cortex-x1, cortex-x1c, cortex-x2, cortex-x3, cortex-a510,
17727 cortex-a710, cortex-a715, ampere1, ampere1a, and native.
17728
17729 The values cortex-a57.cortex-a53, cortex-a72.cortex-a53,
17730 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
17731 cortex-a75.cortex-a55, cortex-a76.cortex-a55 specify that GCC
17732 should tune for a big.LITTLE system.
17733
17734 The value neoverse-512tvb specifies that GCC should tune for
17735 Neoverse cores that (a) implement SVE and (b) have a total vector
17736 bandwidth of 512 bits per cycle. In other words, the option tells
17737 GCC to tune for Neoverse cores that can execute 4 128-bit Advanced
17738 SIMD arithmetic instructions a cycle and that can execute an
17739 equivalent number of SVE arithmetic instructions per cycle (2 for
17740 256-bit SVE, 4 for 128-bit SVE). This is more general than tuning
17741 for a specific core like Neoverse V1 but is more specific than the
17742 default tuning described below.
17743
17744 Additionally on native AArch64 GNU/Linux systems the value native
17745 tunes performance to the host system. This option has no effect if
17746 the compiler is unable to recognize the processor of the host
17747 system.
17748
17749 Where none of -mtune=, -mcpu= or -march= are specified, the code is
17750 tuned to perform well across a range of target processors.
17751
17752 This option cannot be suffixed by feature modifiers.
17753
17754 -mcpu=name
17755 Specify the name of the target processor, optionally suffixed by
17756 one or more feature modifiers. This option has the form
17757 -mcpu=cpu{+[no]feature}*, where the permissible values for cpu are
17758 the same as those available for -mtune. The permissible values for
17759 feature are documented in the sub-section on
17760 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
17761 Where conflicting feature modifiers are specified, the right-most
17762 feature is used.
17763
17764 GCC uses name to determine what kind of instructions it can emit
17765 when generating assembly code (as if by -march) and to determine
17766 the target processor for which to tune for performance (as if by
17767 -mtune). Where this option is used in conjunction with -march or
17768 -mtune, those options take precedence over the appropriate part of
17769 this option.
17770
17771 -mcpu=neoverse-512tvb is special in that it does not refer to a
17772 specific core, but instead refers to all Neoverse cores that (a)
17773 implement SVE and (b) have a total vector bandwidth of 512 bits a
17774 cycle. Unless overridden by -march, -mcpu=neoverse-512tvb
17775 generates code that can run on a Neoverse V1 core, since Neoverse
17776 V1 is the first Neoverse core with these properties. Unless
17777 overridden by -mtune, -mcpu=neoverse-512tvb tunes code in the same
17778 way as for -mtune=neoverse-512tvb.
17779
17780 -moverride=string
17781 Override tuning decisions made by the back-end in response to a
17782 -mtune= switch. The syntax, semantics, and accepted values for
17783 string in this option are not guaranteed to be consistent across
17784 releases.
17785
17786 This option is only intended to be useful when developing GCC.
17787
17788 -mverbose-cost-dump
17789 Enable verbose cost model dumping in the debug dump files. This
17790 option is provided for use in debugging the compiler.
17791
17792 -mpc-relative-literal-loads
17793 -mno-pc-relative-literal-loads
17794 Enable or disable PC-relative literal loads. With this option
17795 literal pools are accessed using a single instruction and emitted
17796 after each function. This limits the maximum size of functions to
17797 1MB. This is enabled by default for -mcmodel=tiny.
17798
17799 -msign-return-address=scope
17800 Select the function scope on which return address signing will be
17801 applied. Permissible values are none, which disables return
17802 address signing, non-leaf, which enables pointer signing for
17803 functions which are not leaf functions, and all, which enables
17804 pointer signing for all functions. The default value is none. This
17805 option has been deprecated by -mbranch-protection.
17806
17807 -mbranch-protection=none|standard|pac-ret[+leaf+b-key]|bti
17808 Select the branch protection features to use. none is the default
17809 and turns off all types of branch protection. standard turns on
17810 all types of branch protection features. If a feature has
17811 additional tuning options, then standard sets it to its standard
17812 level. pac-ret[+leaf] turns on return address signing to its
17813 standard level: signing functions that save the return address to
17814 memory (non-leaf functions will practically always do this) using
17815 the a-key. The optional argument leaf can be used to extend the
17816 signing to include leaf functions. The optional argument b-key can
17817 be used to sign the functions with the B-key instead of the A-key.
17818 bti turns on branch target identification mechanism.
17819
17820 -mharden-sls=opts
17821 Enable compiler hardening against straight line speculation (SLS).
17822 opts is a comma-separated list of the following options:
17823
17824 retbr
17825 blr
17826
17827 In addition, -mharden-sls=all enables all SLS hardening while
17828 -mharden-sls=none disables all SLS hardening.
17829
17830 -msve-vector-bits=bits
17831 Specify the number of bits in an SVE vector register. This option
17832 only has an effect when SVE is enabled.
17833
17834 GCC supports two forms of SVE code generation: "vector-length
17835 agnostic" output that works with any size of vector register and
17836 "vector-length specific" output that allows GCC to make assumptions
17837 about the vector length when it is useful for optimization reasons.
17838 The possible values of bits are: scalable, 128, 256, 512, 1024 and
17839 2048. Specifying scalable selects vector-length agnostic output.
17840 At present -msve-vector-bits=128 also generates vector-length
17841 agnostic output for big-endian targets. All other values generate
17842 vector-length specific code. The behavior of these values may
17843 change in future releases and no value except scalable should be
17844 relied on for producing code that is portable across different
17845 hardware SVE vector lengths.
17846
17847 The default is -msve-vector-bits=scalable, which produces vector-
17848 length agnostic code.
17849
17850 -march and -mcpu Feature Modifiers
17851
17852 Feature modifiers used with -march and -mcpu can be any of the
17853 following and their inverses nofeature:
17854
17855 crc Enable CRC extension. This is on by default for -march=armv8.1-a.
17856
17857 crypto
17858 Enable Crypto extension. This also enables Advanced SIMD and
17859 floating-point instructions.
17860
17861 fp Enable floating-point instructions. This is on by default for all
17862 possible values for options -march and -mcpu.
17863
17864 simd
17865 Enable Advanced SIMD instructions. This also enables floating-
17866 point instructions. This is on by default for all possible values
17867 for options -march and -mcpu.
17868
17869 sve Enable Scalable Vector Extension instructions. This also enables
17870 Advanced SIMD and floating-point instructions.
17871
17872 lse Enable Large System Extension instructions. This is on by default
17873 for -march=armv8.1-a.
17874
17875 rdma
17876 Enable Round Double Multiply Accumulate instructions. This is on
17877 by default for -march=armv8.1-a.
17878
17879 fp16
17880 Enable FP16 extension. This also enables floating-point
17881 instructions.
17882
17883 fp16fml
17884 Enable FP16 fmla extension. This also enables FP16 extensions and
17885 floating-point instructions. This option is enabled by default for
17886 -march=armv8.4-a. Use of this option with architectures prior to
17887 Armv8.2-A is not supported.
17888
17889 rcpc
17890 Enable the RCpc extension. This enables the use of the LDAPR
17891 instructions for load-acquire atomic semantics, and passes it on to
17892 the assembler, enabling inline asm statements to use instructions
17893 from the RCpc extension.
17894
17895 dotprod
17896 Enable the Dot Product extension. This also enables Advanced SIMD
17897 instructions.
17898
17899 aes Enable the Armv8-a aes and pmull crypto extension. This also
17900 enables Advanced SIMD instructions.
17901
17902 sha2
17903 Enable the Armv8-a sha2 crypto extension. This also enables
17904 Advanced SIMD instructions.
17905
17906 sha3
17907 Enable the sha512 and sha3 crypto extension. This also enables
17908 Advanced SIMD instructions. Use of this option with architectures
17909 prior to Armv8.2-A is not supported.
17910
17911 sm4 Enable the sm3 and sm4 crypto extension. This also enables
17912 Advanced SIMD instructions. Use of this option with architectures
17913 prior to Armv8.2-A is not supported.
17914
17915 profile
17916 Enable the Statistical Profiling extension. This option is only to
17917 enable the extension at the assembler level and does not affect
17918 code generation.
17919
17920 rng Enable the Armv8.5-a Random Number instructions. This option is
17921 only to enable the extension at the assembler level and does not
17922 affect code generation.
17923
17924 memtag
17925 Enable the Armv8.5-a Memory Tagging Extensions. Use of this option
17926 with architectures prior to Armv8.5-A is not supported.
17927
17928 sb Enable the Armv8-a Speculation Barrier instruction. This option is
17929 only to enable the extension at the assembler level and does not
17930 affect code generation. This option is enabled by default for
17931 -march=armv8.5-a.
17932
17933 ssbs
17934 Enable the Armv8-a Speculative Store Bypass Safe instruction. This
17935 option is only to enable the extension at the assembler level and
17936 does not affect code generation. This option is enabled by default
17937 for -march=armv8.5-a.
17938
17939 predres
17940 Enable the Armv8-a Execution and Data Prediction Restriction
17941 instructions. This option is only to enable the extension at the
17942 assembler level and does not affect code generation. This option
17943 is enabled by default for -march=armv8.5-a.
17944
17945 sve2
17946 Enable the Armv8-a Scalable Vector Extension 2. This also enables
17947 SVE instructions.
17948
17949 sve2-bitperm
17950 Enable SVE2 bitperm instructions. This also enables SVE2
17951 instructions.
17952
17953 sve2-sm4
17954 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
17955
17956 sve2-aes
17957 Enable SVE2 aes instructions. This also enables SVE2 instructions.
17958
17959 sve2-sha3
17960 Enable SVE2 sha3 instructions. This also enables SVE2
17961 instructions.
17962
17963 tme Enable the Transactional Memory Extension.
17964
17965 i8mm
17966 Enable 8-bit Integer Matrix Multiply instructions. This also
17967 enables Advanced SIMD and floating-point instructions. This option
17968 is enabled by default for -march=armv8.6-a. Use of this option
17969 with architectures prior to Armv8.2-A is not supported.
17970
17971 f32mm
17972 Enable 32-bit Floating point Matrix Multiply instructions. This
17973 also enables SVE instructions. Use of this option with
17974 architectures prior to Armv8.2-A is not supported.
17975
17976 f64mm
17977 Enable 64-bit Floating point Matrix Multiply instructions. This
17978 also enables SVE instructions. Use of this option with
17979 architectures prior to Armv8.2-A is not supported.
17980
17981 bf16
17982 Enable brain half-precision floating-point instructions. This also
17983 enables Advanced SIMD and floating-point instructions. This option
17984 is enabled by default for -march=armv8.6-a. Use of this option
17985 with architectures prior to Armv8.2-A is not supported.
17986
17987 ls64
17988 Enable the 64-byte atomic load and store instructions for
17989 accelerators. This option is enabled by default for
17990 -march=armv8.7-a.
17991
17992 mops
17993 Enable the instructions to accelerate memory operations like
17994 "memcpy", "memmove", "memset". This option is enabled by default
17995 for -march=armv8.8-a
17996
17997 flagm
17998 Enable the Flag Manipulation instructions Extension.
17999
18000 pauth
18001 Enable the Pointer Authentication Extension.
18002
18003 cssc
18004 Enable the Common Short Sequence Compression instructions.
18005
18006 Feature crypto implies aes, sha2, and simd, which implies fp.
18007 Conversely, nofp implies nosimd, which implies nocrypto, noaes and
18008 nosha2.
18009
18010 Adapteva Epiphany Options
18011 These -m options are defined for Adapteva Epiphany:
18012
18013 -mhalf-reg-file
18014 Don't allocate any register in the range "r32"..."r63". That
18015 allows code to run on hardware variants that lack these registers.
18016
18017 -mprefer-short-insn-regs
18018 Preferentially allocate registers that allow short instruction
18019 generation. This can result in increased instruction count, so
18020 this may either reduce or increase overall code size.
18021
18022 -mbranch-cost=num
18023 Set the cost of branches to roughly num "simple" instructions.
18024 This cost is only a heuristic and is not guaranteed to produce
18025 consistent results across releases.
18026
18027 -mcmove
18028 Enable the generation of conditional moves.
18029
18030 -mnops=num
18031 Emit num NOPs before every other generated instruction.
18032
18033 -mno-soft-cmpsf
18034 For single-precision floating-point comparisons, emit an "fsub"
18035 instruction and test the flags. This is faster than a software
18036 comparison, but can get incorrect results in the presence of NaNs,
18037 or when two different small numbers are compared such that their
18038 difference is calculated as zero. The default is -msoft-cmpsf,
18039 which uses slower, but IEEE-compliant, software comparisons.
18040
18041 -mstack-offset=num
18042 Set the offset between the top of the stack and the stack pointer.
18043 E.g., a value of 8 means that the eight bytes in the range
18044 "sp+0...sp+7" can be used by leaf functions without stack
18045 allocation. Values other than 8 or 16 are untested and unlikely to
18046 work. Note also that this option changes the ABI; compiling a
18047 program with a different stack offset than the libraries have been
18048 compiled with generally does not work. This option can be useful
18049 if you want to evaluate if a different stack offset would give you
18050 better code, but to actually use a different stack offset to build
18051 working programs, it is recommended to configure the toolchain with
18052 the appropriate --with-stack-offset=num option.
18053
18054 -mno-round-nearest
18055 Make the scheduler assume that the rounding mode has been set to
18056 truncating. The default is -mround-nearest.
18057
18058 -mlong-calls
18059 If not otherwise specified by an attribute, assume all calls might
18060 be beyond the offset range of the "b" / "bl" instructions, and
18061 therefore load the function address into a register before
18062 performing a (otherwise direct) call. This is the default.
18063
18064 -mshort-calls
18065 If not otherwise specified by an attribute, assume all direct calls
18066 are in the range of the "b" / "bl" instructions, so use these
18067 instructions for direct calls. The default is -mlong-calls.
18068
18069 -msmall16
18070 Assume addresses can be loaded as 16-bit unsigned values. This
18071 does not apply to function addresses for which -mlong-calls
18072 semantics are in effect.
18073
18074 -mfp-mode=mode
18075 Set the prevailing mode of the floating-point unit. This
18076 determines the floating-point mode that is provided and expected at
18077 function call and return time. Making this mode match the mode you
18078 predominantly need at function start can make your programs smaller
18079 and faster by avoiding unnecessary mode switches.
18080
18081 mode can be set to one the following values:
18082
18083 caller
18084 Any mode at function entry is valid, and retained or restored
18085 when the function returns, and when it calls other functions.
18086 This mode is useful for compiling libraries or other
18087 compilation units you might want to incorporate into different
18088 programs with different prevailing FPU modes, and the
18089 convenience of being able to use a single object file outweighs
18090 the size and speed overhead for any extra mode switching that
18091 might be needed, compared with what would be needed with a more
18092 specific choice of prevailing FPU mode.
18093
18094 truncate
18095 This is the mode used for floating-point calculations with
18096 truncating (i.e. round towards zero) rounding mode. That
18097 includes conversion from floating point to integer.
18098
18099 round-nearest
18100 This is the mode used for floating-point calculations with
18101 round-to-nearest-or-even rounding mode.
18102
18103 int This is the mode used to perform integer calculations in the
18104 FPU, e.g. integer multiply, or integer multiply-and-
18105 accumulate.
18106
18107 The default is -mfp-mode=caller
18108
18109 -mno-split-lohi
18110 -mno-postinc
18111 -mno-postmodify
18112 Code generation tweaks that disable, respectively, splitting of
18113 32-bit loads, generation of post-increment addresses, and
18114 generation of post-modify addresses. The defaults are msplit-lohi,
18115 -mpost-inc, and -mpost-modify.
18116
18117 -mnovect-double
18118 Change the preferred SIMD mode to SImode. The default is
18119 -mvect-double, which uses DImode as preferred SIMD mode.
18120
18121 -max-vect-align=num
18122 The maximum alignment for SIMD vector mode types. num may be 4 or
18123 8. The default is 8. Note that this is an ABI change, even though
18124 many library function interfaces are unaffected if they don't use
18125 SIMD vector modes in places that affect size and/or alignment of
18126 relevant types.
18127
18128 -msplit-vecmove-early
18129 Split vector moves into single word moves before reload. In theory
18130 this can give better register allocation, but so far the reverse
18131 seems to be generally the case.
18132
18133 -m1reg-reg
18134 Specify a register to hold the constant -1, which makes loading
18135 small negative constants and certain bitmasks faster. Allowable
18136 values for reg are r43 and r63, which specify use of that register
18137 as a fixed register, and none, which means that no register is used
18138 for this purpose. The default is -m1reg-none.
18139
18140 AMD GCN Options
18141 These options are defined specifically for the AMD GCN port.
18142
18143 -march=gpu
18144 -mtune=gpu
18145 Set architecture type or tuning for gpu. Supported values for gpu
18146 are
18147
18148 fiji
18149 Compile for GCN3 Fiji devices (gfx803).
18150
18151 gfx900
18152 Compile for GCN5 Vega 10 devices (gfx900).
18153
18154 gfx906
18155 Compile for GCN5 Vega 20 devices (gfx906).
18156
18157 gfx908
18158 Compile for CDNA1 Instinct MI100 series devices (gfx908).
18159
18160 gfx90a
18161 Compile for CDNA2 Instinct MI200 series devices (gfx90a).
18162
18163 -msram-ecc=on
18164 -msram-ecc=off
18165 -msram-ecc=any
18166 Compile binaries suitable for devices with the SRAM-ECC feature
18167 enabled, disabled, or either mode. This feature can be enabled
18168 per-process on some devices. The compiled code must match the
18169 device mode. The default is any, for devices that support it.
18170
18171 -mstack-size=bytes
18172 Specify how many bytes of stack space will be requested for each
18173 GPU thread (wave-front). Beware that there may be many threads and
18174 limited memory available. The size of the stack allocation may
18175 also have an impact on run-time performance. The default is 32KB
18176 when using OpenACC or OpenMP, and 1MB otherwise.
18177
18178 -mxnack
18179 Compile binaries suitable for devices with the XNACK feature
18180 enabled. Some devices always require XNACK and some allow the user
18181 to configure XNACK. The compiled code must match the device mode.
18182 The default is -mno-xnack. At present this option is a placeholder
18183 for support that is not yet implemented.
18184
18185 ARC Options
18186 The following options control the architecture variant for which code
18187 is being compiled:
18188
18189 -mbarrel-shifter
18190 Generate instructions supported by barrel shifter. This is the
18191 default unless -mcpu=ARC601 or -mcpu=ARCEM is in effect.
18192
18193 -mjli-always
18194 Force to call a function using jli_s instruction. This option is
18195 valid only for ARCv2 architecture.
18196
18197 -mcpu=cpu
18198 Set architecture type, register usage, and instruction scheduling
18199 parameters for cpu. There are also shortcut alias options
18200 available for backward compatibility and convenience. Supported
18201 values for cpu are
18202
18203 arc600
18204 Compile for ARC600. Aliases: -mA6, -mARC600.
18205
18206 arc601
18207 Compile for ARC601. Alias: -mARC601.
18208
18209 arc700
18210 Compile for ARC700. Aliases: -mA7, -mARC700. This is the
18211 default when configured with --with-cpu=arc700.
18212
18213 arcem
18214 Compile for ARC EM.
18215
18216 archs
18217 Compile for ARC HS.
18218
18219 em Compile for ARC EM CPU with no hardware extensions.
18220
18221 em4 Compile for ARC EM4 CPU.
18222
18223 em4_dmips
18224 Compile for ARC EM4 DMIPS CPU.
18225
18226 em4_fpus
18227 Compile for ARC EM4 DMIPS CPU with the single-precision
18228 floating-point extension.
18229
18230 em4_fpuda
18231 Compile for ARC EM4 DMIPS CPU with single-precision floating-
18232 point and double assist instructions.
18233
18234 hs Compile for ARC HS CPU with no hardware extensions except the
18235 atomic instructions.
18236
18237 hs34
18238 Compile for ARC HS34 CPU.
18239
18240 hs38
18241 Compile for ARC HS38 CPU.
18242
18243 hs38_linux
18244 Compile for ARC HS38 CPU with all hardware extensions on.
18245
18246 hs4x
18247 Compile for ARC HS4x CPU.
18248
18249 hs4xd
18250 Compile for ARC HS4xD CPU.
18251
18252 hs4x_rel31
18253 Compile for ARC HS4x CPU release 3.10a.
18254
18255 arc600_norm
18256 Compile for ARC 600 CPU with "norm" instructions enabled.
18257
18258 arc600_mul32x16
18259 Compile for ARC 600 CPU with "norm" and 32x16-bit multiply
18260 instructions enabled.
18261
18262 arc600_mul64
18263 Compile for ARC 600 CPU with "norm" and "mul64"-family
18264 instructions enabled.
18265
18266 arc601_norm
18267 Compile for ARC 601 CPU with "norm" instructions enabled.
18268
18269 arc601_mul32x16
18270 Compile for ARC 601 CPU with "norm" and 32x16-bit multiply
18271 instructions enabled.
18272
18273 arc601_mul64
18274 Compile for ARC 601 CPU with "norm" and "mul64"-family
18275 instructions enabled.
18276
18277 nps400
18278 Compile for ARC 700 on NPS400 chip.
18279
18280 em_mini
18281 Compile for ARC EM minimalist configuration featuring reduced
18282 register set.
18283
18284 -mdpfp
18285 -mdpfp-compact
18286 Generate double-precision FPX instructions, tuned for the compact
18287 implementation.
18288
18289 -mdpfp-fast
18290 Generate double-precision FPX instructions, tuned for the fast
18291 implementation.
18292
18293 -mno-dpfp-lrsr
18294 Disable "lr" and "sr" instructions from using FPX extension aux
18295 registers.
18296
18297 -mea
18298 Generate extended arithmetic instructions. Currently only "divaw",
18299 "adds", "subs", and "sat16" are supported. Only valid for
18300 -mcpu=ARC700.
18301
18302 -mno-mpy
18303 Do not generate "mpy"-family instructions for ARC700. This option
18304 is deprecated.
18305
18306 -mmul32x16
18307 Generate 32x16-bit multiply and multiply-accumulate instructions.
18308
18309 -mmul64
18310 Generate "mul64" and "mulu64" instructions. Only valid for
18311 -mcpu=ARC600.
18312
18313 -mnorm
18314 Generate "norm" instructions. This is the default if -mcpu=ARC700
18315 is in effect.
18316
18317 -mspfp
18318 -mspfp-compact
18319 Generate single-precision FPX instructions, tuned for the compact
18320 implementation.
18321
18322 -mspfp-fast
18323 Generate single-precision FPX instructions, tuned for the fast
18324 implementation.
18325
18326 -msimd
18327 Enable generation of ARC SIMD instructions via target-specific
18328 builtins. Only valid for -mcpu=ARC700.
18329
18330 -msoft-float
18331 This option ignored; it is provided for compatibility purposes
18332 only. Software floating-point code is emitted by default, and this
18333 default can overridden by FPX options; -mspfp, -mspfp-compact, or
18334 -mspfp-fast for single precision, and -mdpfp, -mdpfp-compact, or
18335 -mdpfp-fast for double precision.
18336
18337 -mswap
18338 Generate "swap" instructions.
18339
18340 -matomic
18341 This enables use of the locked load/store conditional extension to
18342 implement atomic memory built-in functions. Not available for ARC
18343 6xx or ARC EM cores.
18344
18345 -mdiv-rem
18346 Enable "div" and "rem" instructions for ARCv2 cores.
18347
18348 -mcode-density
18349 Enable code density instructions for ARC EM. This option is on by
18350 default for ARC HS.
18351
18352 -mll64
18353 Enable double load/store operations for ARC HS cores.
18354
18355 -mtp-regno=regno
18356 Specify thread pointer register number.
18357
18358 -mmpy-option=multo
18359 Compile ARCv2 code with a multiplier design option. You can
18360 specify the option using either a string or numeric value for
18361 multo. wlh1 is the default value. The recognized values are:
18362
18363 0
18364 none
18365 No multiplier available.
18366
18367 1
18368 w 16x16 multiplier, fully pipelined. The following instructions
18369 are enabled: "mpyw" and "mpyuw".
18370
18371 2
18372 wlh1
18373 32x32 multiplier, fully pipelined (1 stage). The following
18374 instructions are additionally enabled: "mpy", "mpyu", "mpym",
18375 "mpymu", and "mpy_s".
18376
18377 3
18378 wlh2
18379 32x32 multiplier, fully pipelined (2 stages). The following
18380 instructions are additionally enabled: "mpy", "mpyu", "mpym",
18381 "mpymu", and "mpy_s".
18382
18383 4
18384 wlh3
18385 Two 16x16 multipliers, blocking, sequential. The following
18386 instructions are additionally enabled: "mpy", "mpyu", "mpym",
18387 "mpymu", and "mpy_s".
18388
18389 5
18390 wlh4
18391 One 16x16 multiplier, blocking, sequential. The following
18392 instructions are additionally enabled: "mpy", "mpyu", "mpym",
18393 "mpymu", and "mpy_s".
18394
18395 6
18396 wlh5
18397 One 32x4 multiplier, blocking, sequential. The following
18398 instructions are additionally enabled: "mpy", "mpyu", "mpym",
18399 "mpymu", and "mpy_s".
18400
18401 7
18402 plus_dmpy
18403 ARC HS SIMD support.
18404
18405 8
18406 plus_macd
18407 ARC HS SIMD support.
18408
18409 9
18410 plus_qmacw
18411 ARC HS SIMD support.
18412
18413 This option is only available for ARCv2 cores.
18414
18415 -mfpu=fpu
18416 Enables support for specific floating-point hardware extensions for
18417 ARCv2 cores. Supported values for fpu are:
18418
18419 fpus
18420 Enables support for single-precision floating-point hardware
18421 extensions.
18422
18423 fpud
18424 Enables support for double-precision floating-point hardware
18425 extensions. The single-precision floating-point extension is
18426 also enabled. Not available for ARC EM.
18427
18428 fpuda
18429 Enables support for double-precision floating-point hardware
18430 extensions using double-precision assist instructions. The
18431 single-precision floating-point extension is also enabled.
18432 This option is only available for ARC EM.
18433
18434 fpuda_div
18435 Enables support for double-precision floating-point hardware
18436 extensions using double-precision assist instructions. The
18437 single-precision floating-point, square-root, and divide
18438 extensions are also enabled. This option is only available for
18439 ARC EM.
18440
18441 fpuda_fma
18442 Enables support for double-precision floating-point hardware
18443 extensions using double-precision assist instructions. The
18444 single-precision floating-point and fused multiply and add
18445 hardware extensions are also enabled. This option is only
18446 available for ARC EM.
18447
18448 fpuda_all
18449 Enables support for double-precision floating-point hardware
18450 extensions using double-precision assist instructions. All
18451 single-precision floating-point hardware extensions are also
18452 enabled. This option is only available for ARC EM.
18453
18454 fpus_div
18455 Enables support for single-precision floating-point, square-
18456 root and divide hardware extensions.
18457
18458 fpud_div
18459 Enables support for double-precision floating-point, square-
18460 root and divide hardware extensions. This option includes
18461 option fpus_div. Not available for ARC EM.
18462
18463 fpus_fma
18464 Enables support for single-precision floating-point and fused
18465 multiply and add hardware extensions.
18466
18467 fpud_fma
18468 Enables support for double-precision floating-point and fused
18469 multiply and add hardware extensions. This option includes
18470 option fpus_fma. Not available for ARC EM.
18471
18472 fpus_all
18473 Enables support for all single-precision floating-point
18474 hardware extensions.
18475
18476 fpud_all
18477 Enables support for all single- and double-precision floating-
18478 point hardware extensions. Not available for ARC EM.
18479
18480 -mirq-ctrl-saved=register-range, blink, lp_count
18481 Specifies general-purposes registers that the processor
18482 automatically saves/restores on interrupt entry and exit.
18483 register-range is specified as two registers separated by a dash.
18484 The register range always starts with "r0", the upper limit is "fp"
18485 register. blink and lp_count are optional. This option is only
18486 valid for ARC EM and ARC HS cores.
18487
18488 -mrgf-banked-regs=number
18489 Specifies the number of registers replicated in second register
18490 bank on entry to fast interrupt. Fast interrupts are interrupts
18491 with the highest priority level P0. These interrupts save only PC
18492 and STATUS32 registers to avoid memory transactions during
18493 interrupt entry and exit sequences. Use this option when you are
18494 using fast interrupts in an ARC V2 family processor. Permitted
18495 values are 4, 8, 16, and 32.
18496
18497 -mlpc-width=width
18498 Specify the width of the "lp_count" register. Valid values for
18499 width are 8, 16, 20, 24, 28 and 32 bits. The default width is
18500 fixed to 32 bits. If the width is less than 32, the compiler does
18501 not attempt to transform loops in your program to use the zero-
18502 delay loop mechanism unless it is known that the "lp_count"
18503 register can hold the required loop-counter value. Depending on
18504 the width specified, the compiler and run-time library might
18505 continue to use the loop mechanism for various needs. This option
18506 defines macro "__ARC_LPC_WIDTH__" with the value of width.
18507
18508 -mrf16
18509 This option instructs the compiler to generate code for a 16-entry
18510 register file. This option defines the "__ARC_RF16__" preprocessor
18511 macro.
18512
18513 -mbranch-index
18514 Enable use of "bi" or "bih" instructions to implement jump tables.
18515
18516 The following options are passed through to the assembler, and also
18517 define preprocessor macro symbols.
18518
18519 -mdsp-packa
18520 Passed down to the assembler to enable the DSP Pack A extensions.
18521 Also sets the preprocessor symbol "__Xdsp_packa". This option is
18522 deprecated.
18523
18524 -mdvbf
18525 Passed down to the assembler to enable the dual Viterbi butterfly
18526 extension. Also sets the preprocessor symbol "__Xdvbf". This
18527 option is deprecated.
18528
18529 -mlock
18530 Passed down to the assembler to enable the locked load/store
18531 conditional extension. Also sets the preprocessor symbol
18532 "__Xlock".
18533
18534 -mmac-d16
18535 Passed down to the assembler. Also sets the preprocessor symbol
18536 "__Xxmac_d16". This option is deprecated.
18537
18538 -mmac-24
18539 Passed down to the assembler. Also sets the preprocessor symbol
18540 "__Xxmac_24". This option is deprecated.
18541
18542 -mrtsc
18543 Passed down to the assembler to enable the 64-bit time-stamp
18544 counter extension instruction. Also sets the preprocessor symbol
18545 "__Xrtsc". This option is deprecated.
18546
18547 -mswape
18548 Passed down to the assembler to enable the swap byte ordering
18549 extension instruction. Also sets the preprocessor symbol
18550 "__Xswape".
18551
18552 -mtelephony
18553 Passed down to the assembler to enable dual- and single-operand
18554 instructions for telephony. Also sets the preprocessor symbol
18555 "__Xtelephony". This option is deprecated.
18556
18557 -mxy
18558 Passed down to the assembler to enable the XY memory extension.
18559 Also sets the preprocessor symbol "__Xxy".
18560
18561 The following options control how the assembly code is annotated:
18562
18563 -misize
18564 Annotate assembler instructions with estimated addresses.
18565
18566 -mannotate-align
18567 Explain what alignment considerations lead to the decision to make
18568 an instruction short or long.
18569
18570 The following options are passed through to the linker:
18571
18572 -marclinux
18573 Passed through to the linker, to specify use of the "arclinux"
18574 emulation. This option is enabled by default in tool chains built
18575 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
18576 profiling is not requested.
18577
18578 -marclinux_prof
18579 Passed through to the linker, to specify use of the "arclinux_prof"
18580 emulation. This option is enabled by default in tool chains built
18581 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
18582 profiling is requested.
18583
18584 The following options control the semantics of generated code:
18585
18586 -mlong-calls
18587 Generate calls as register indirect calls, thus providing access to
18588 the full 32-bit address range.
18589
18590 -mmedium-calls
18591 Don't use less than 25-bit addressing range for calls, which is the
18592 offset available for an unconditional branch-and-link instruction.
18593 Conditional execution of function calls is suppressed, to allow use
18594 of the 25-bit range, rather than the 21-bit range with conditional
18595 branch-and-link. This is the default for tool chains built for
18596 "arc-linux-uclibc" and "arceb-linux-uclibc" targets.
18597
18598 -G num
18599 Put definitions of externally-visible data in a small data section
18600 if that data is no bigger than num bytes. The default value of num
18601 is 4 for any ARC configuration, or 8 when we have double load/store
18602 operations.
18603
18604 -mno-sdata
18605 Do not generate sdata references. This is the default for tool
18606 chains built for "arc-linux-uclibc" and "arceb-linux-uclibc"
18607 targets.
18608
18609 -mvolatile-cache
18610 Use ordinarily cached memory accesses for volatile references.
18611 This is the default.
18612
18613 -mno-volatile-cache
18614 Enable cache bypass for volatile references.
18615
18616 The following options fine tune code generation:
18617
18618 -malign-call
18619 Does nothing. Preserved for backward compatibility.
18620
18621 -mauto-modify-reg
18622 Enable the use of pre/post modify with register displacement.
18623
18624 -mbbit-peephole
18625 Enable bbit peephole2.
18626
18627 -mno-brcc
18628 This option disables a target-specific pass in arc_reorg to
18629 generate compare-and-branch ("brcc") instructions. It has no
18630 effect on generation of these instructions driven by the combiner
18631 pass.
18632
18633 -mcase-vector-pcrel
18634 Use PC-relative switch case tables to enable case table shortening.
18635 This is the default for -Os.
18636
18637 -mcompact-casesi
18638 Enable compact "casesi" pattern. This is the default for -Os, and
18639 only available for ARCv1 cores. This option is deprecated.
18640
18641 -mno-cond-exec
18642 Disable the ARCompact-specific pass to generate conditional
18643 execution instructions.
18644
18645 Due to delay slot scheduling and interactions between operand
18646 numbers, literal sizes, instruction lengths, and the support for
18647 conditional execution, the target-independent pass to generate
18648 conditional execution is often lacking, so the ARC port has kept a
18649 special pass around that tries to find more conditional execution
18650 generation opportunities after register allocation, branch
18651 shortening, and delay slot scheduling have been done. This pass
18652 generally, but not always, improves performance and code size, at
18653 the cost of extra compilation time, which is why there is an option
18654 to switch it off. If you have a problem with call instructions
18655 exceeding their allowable offset range because they are
18656 conditionalized, you should consider using -mmedium-calls instead.
18657
18658 -mearly-cbranchsi
18659 Enable pre-reload use of the "cbranchsi" pattern.
18660
18661 -mexpand-adddi
18662 Expand "adddi3" and "subdi3" at RTL generation time into "add.f",
18663 "adc" etc. This option is deprecated.
18664
18665 -mindexed-loads
18666 Enable the use of indexed loads. This can be problematic because
18667 some optimizers then assume that indexed stores exist, which is not
18668 the case.
18669
18670 -mlra
18671 Enable Local Register Allocation. This is still experimental for
18672 ARC, so by default the compiler uses standard reload (i.e.
18673 -mno-lra).
18674
18675 -mlra-priority-none
18676 Don't indicate any priority for target registers.
18677
18678 -mlra-priority-compact
18679 Indicate target register priority for r0..r3 / r12..r15.
18680
18681 -mlra-priority-noncompact
18682 Reduce target register priority for r0..r3 / r12..r15.
18683
18684 -mmillicode
18685 When optimizing for size (using -Os), prologues and epilogues that
18686 have to save or restore a large number of registers are often
18687 shortened by using call to a special function in libgcc; this is
18688 referred to as a millicode call. As these calls can pose
18689 performance issues, and/or cause linking issues when linking in a
18690 nonstandard way, this option is provided to turn on or off
18691 millicode call generation.
18692
18693 -mcode-density-frame
18694 This option enable the compiler to emit "enter" and "leave"
18695 instructions. These instructions are only valid for CPUs with
18696 code-density feature.
18697
18698 -mmixed-code
18699 Does nothing. Preserved for backward compatibility.
18700
18701 -mq-class
18702 Ths option is deprecated. Enable q instruction alternatives. This
18703 is the default for -Os.
18704
18705 -mRcq
18706 Does nothing. Preserved for backward compatibility.
18707
18708 -mRcw
18709 Does nothing. Preserved for backward compatibility.
18710
18711 -msize-level=level
18712 Fine-tune size optimization with regards to instruction lengths and
18713 alignment. The recognized values for level are:
18714
18715 0 No size optimization. This level is deprecated and treated
18716 like 1.
18717
18718 1 Short instructions are used opportunistically.
18719
18720 2 In addition, alignment of loops and of code after barriers are
18721 dropped.
18722
18723 3 In addition, optional data alignment is dropped, and the option
18724 Os is enabled.
18725
18726 This defaults to 3 when -Os is in effect. Otherwise, the behavior
18727 when this is not set is equivalent to level 1.
18728
18729 -mtune=cpu
18730 Set instruction scheduling parameters for cpu, overriding any
18731 implied by -mcpu=.
18732
18733 Supported values for cpu are
18734
18735 ARC600
18736 Tune for ARC600 CPU.
18737
18738 ARC601
18739 Tune for ARC601 CPU.
18740
18741 ARC700
18742 Tune for ARC700 CPU with standard multiplier block.
18743
18744 ARC700-xmac
18745 Tune for ARC700 CPU with XMAC block.
18746
18747 ARC725D
18748 Tune for ARC725D CPU.
18749
18750 ARC750D
18751 Tune for ARC750D CPU.
18752
18753 core3
18754 Tune for ARCv2 core3 type CPU. This option enable usage of
18755 "dbnz" instruction.
18756
18757 release31a
18758 Tune for ARC4x release 3.10a.
18759
18760 -mmultcost=num
18761 Cost to assume for a multiply instruction, with 4 being equal to a
18762 normal instruction.
18763
18764 -munalign-prob-threshold=probability
18765 Does nothing. Preserved for backward compatibility.
18766
18767 The following options are maintained for backward compatibility, but
18768 are now deprecated and will be removed in a future release:
18769
18770 -margonaut
18771 Obsolete FPX.
18772
18773 -mbig-endian
18774 -EB Compile code for big-endian targets. Use of these options is now
18775 deprecated. Big-endian code is supported by configuring GCC to
18776 build "arceb-elf32" and "arceb-linux-uclibc" targets, for which big
18777 endian is the default.
18778
18779 -mlittle-endian
18780 -EL Compile code for little-endian targets. Use of these options is
18781 now deprecated. Little-endian code is supported by configuring GCC
18782 to build "arc-elf32" and "arc-linux-uclibc" targets, for which
18783 little endian is the default.
18784
18785 -mbarrel_shifter
18786 Replaced by -mbarrel-shifter.
18787
18788 -mdpfp_compact
18789 Replaced by -mdpfp-compact.
18790
18791 -mdpfp_fast
18792 Replaced by -mdpfp-fast.
18793
18794 -mdsp_packa
18795 Replaced by -mdsp-packa.
18796
18797 -mEA
18798 Replaced by -mea.
18799
18800 -mmac_24
18801 Replaced by -mmac-24.
18802
18803 -mmac_d16
18804 Replaced by -mmac-d16.
18805
18806 -mspfp_compact
18807 Replaced by -mspfp-compact.
18808
18809 -mspfp_fast
18810 Replaced by -mspfp-fast.
18811
18812 -mtune=cpu
18813 Values arc600, arc601, arc700 and arc700-xmac for cpu are replaced
18814 by ARC600, ARC601, ARC700 and ARC700-xmac respectively.
18815
18816 -multcost=num
18817 Replaced by -mmultcost.
18818
18819 ARM Options
18820 These -m options are defined for the ARM port:
18821
18822 -mabi=name
18823 Generate code for the specified ABI. Permissible values are: apcs-
18824 gnu, atpcs, aapcs, aapcs-linux and iwmmxt.
18825
18826 -mapcs-frame
18827 Generate a stack frame that is compliant with the ARM Procedure
18828 Call Standard for all functions, even if this is not strictly
18829 necessary for correct execution of the code. Specifying
18830 -fomit-frame-pointer with this option causes the stack frames not
18831 to be generated for leaf functions. The default is
18832 -mno-apcs-frame. This option is deprecated.
18833
18834 -mapcs
18835 This is a synonym for -mapcs-frame and is deprecated.
18836
18837 -mthumb-interwork
18838 Generate code that supports calling between the ARM and Thumb
18839 instruction sets. Without this option, on pre-v5 architectures,
18840 the two instruction sets cannot be reliably used inside one
18841 program. The default is -mno-thumb-interwork, since slightly
18842 larger code is generated when -mthumb-interwork is specified. In
18843 AAPCS configurations this option is meaningless.
18844
18845 -mno-sched-prolog
18846 Prevent the reordering of instructions in the function prologue, or
18847 the merging of those instruction with the instructions in the
18848 function's body. This means that all functions start with a
18849 recognizable set of instructions (or in fact one of a choice from a
18850 small set of different function prologues), and this information
18851 can be used to locate the start of functions inside an executable
18852 piece of code. The default is -msched-prolog.
18853
18854 -mfloat-abi=name
18855 Specifies which floating-point ABI to use. Permissible values are:
18856 soft, softfp and hard.
18857
18858 Specifying soft causes GCC to generate output containing library
18859 calls for floating-point operations. softfp allows the generation
18860 of code using hardware floating-point instructions, but still uses
18861 the soft-float calling conventions. hard allows generation of
18862 floating-point instructions and uses FPU-specific calling
18863 conventions.
18864
18865 The default depends on the specific target configuration. Note
18866 that the hard-float and soft-float ABIs are not link-compatible;
18867 you must compile your entire program with the same ABI, and link
18868 with a compatible set of libraries.
18869
18870 -mgeneral-regs-only
18871 Generate code which uses only the general-purpose registers. This
18872 will prevent the compiler from using floating-point and Advanced
18873 SIMD registers but will not impose any restrictions on the
18874 assembler.
18875
18876 -mlittle-endian
18877 Generate code for a processor running in little-endian mode. This
18878 is the default for all standard configurations.
18879
18880 -mbig-endian
18881 Generate code for a processor running in big-endian mode; the
18882 default is to compile code for a little-endian processor.
18883
18884 -mbe8
18885 -mbe32
18886 When linking a big-endian image select between BE8 and BE32
18887 formats. The option has no effect for little-endian images and is
18888 ignored. The default is dependent on the selected target
18889 architecture. For ARMv6 and later architectures the default is
18890 BE8, for older architectures the default is BE32. BE32 format has
18891 been deprecated by ARM.
18892
18893 -march=name[+extension...]
18894 This specifies the name of the target ARM architecture. GCC uses
18895 this name to determine what kind of instructions it can emit when
18896 generating assembly code. This option can be used in conjunction
18897 with or instead of the -mcpu= option.
18898
18899 Permissible names are: armv4t, armv5t, armv5te, armv6, armv6j,
18900 armv6k, armv6kz, armv6t2, armv6z, armv6zk, armv7, armv7-a, armv7ve,
18901 armv8-a, armv8.1-a, armv8.2-a, armv8.3-a, armv8.4-a, armv8.5-a,
18902 armv8.6-a, armv9-a, armv7-r, armv8-r, armv6-m, armv6s-m, armv7-m,
18903 armv7e-m, armv8-m.base, armv8-m.main, armv8.1-m.main, armv9-a,
18904 iwmmxt and iwmmxt2.
18905
18906 Additionally, the following architectures, which lack support for
18907 the Thumb execution state, are recognized but support is
18908 deprecated: armv4.
18909
18910 Many of the architectures support extensions. These can be added
18911 by appending +extension to the architecture name. Extension
18912 options are processed in order and capabilities accumulate. An
18913 extension will also enable any necessary base extensions upon which
18914 it depends. For example, the +crypto extension will always enable
18915 the +simd extension. The exception to the additive construction is
18916 for extensions that are prefixed with +no...: these extensions
18917 disable the specified option and any other extensions that may
18918 depend on the presence of that extension.
18919
18920 For example, -march=armv7-a+simd+nofp+vfpv4 is equivalent to
18921 writing -march=armv7-a+vfpv4 since the +simd option is entirely
18922 disabled by the +nofp option that follows it.
18923
18924 Most extension names are generically named, but have an effect that
18925 is dependent upon the architecture to which it is applied. For
18926 example, the +simd option can be applied to both armv7-a and
18927 armv8-a architectures, but will enable the original ARMv7-A
18928 Advanced SIMD (Neon) extensions for armv7-a and the ARMv8-A variant
18929 for armv8-a.
18930
18931 The table below lists the supported extensions for each
18932 architecture. Architectures not mentioned do not support any
18933 extensions.
18934
18935 armv5te
18936 armv6
18937 armv6j
18938 armv6k
18939 armv6kz
18940 armv6t2
18941 armv6z
18942 armv6zk
18943 +fp The VFPv2 floating-point instructions. The extension
18944 +vfpv2 can be used as an alias for this extension.
18945
18946 +nofp
18947 Disable the floating-point instructions.
18948
18949 armv7
18950 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M
18951 architectures.
18952
18953 +fp The VFPv3 floating-point instructions, with 16 double-
18954 precision registers. The extension +vfpv3-d16 can be used
18955 as an alias for this extension. Note that floating-point
18956 is not supported by the base ARMv7-M architecture, but is
18957 compatible with both the ARMv7-A and ARMv7-R architectures.
18958
18959 +nofp
18960 Disable the floating-point instructions.
18961
18962 armv7-a
18963 +mp The multiprocessing extension.
18964
18965 +sec
18966 The security extension.
18967
18968 +fp The VFPv3 floating-point instructions, with 16 double-
18969 precision registers. The extension +vfpv3-d16 can be used
18970 as an alias for this extension.
18971
18972 +simd
18973 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
18974 instructions. The extensions +neon and +neon-vfpv3 can be
18975 used as aliases for this extension.
18976
18977 +vfpv3
18978 The VFPv3 floating-point instructions, with 32 double-
18979 precision registers.
18980
18981 +vfpv3-d16-fp16
18982 The VFPv3 floating-point instructions, with 16 double-
18983 precision registers and the half-precision floating-point
18984 conversion operations.
18985
18986 +vfpv3-fp16
18987 The VFPv3 floating-point instructions, with 32 double-
18988 precision registers and the half-precision floating-point
18989 conversion operations.
18990
18991 +vfpv4-d16
18992 The VFPv4 floating-point instructions, with 16 double-
18993 precision registers.
18994
18995 +vfpv4
18996 The VFPv4 floating-point instructions, with 32 double-
18997 precision registers.
18998
18999 +neon-fp16
19000 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
19001 instructions, with the half-precision floating-point
19002 conversion operations.
19003
19004 +neon-vfpv4
19005 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
19006 instructions.
19007
19008 +nosimd
19009 Disable the Advanced SIMD instructions (does not disable
19010 floating point).
19011
19012 +nofp
19013 Disable the floating-point and Advanced SIMD instructions.
19014
19015 armv7ve
19016 The extended version of the ARMv7-A architecture with support
19017 for virtualization.
19018
19019 +fp The VFPv4 floating-point instructions, with 16 double-
19020 precision registers. The extension +vfpv4-d16 can be used
19021 as an alias for this extension.
19022
19023 +simd
19024 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
19025 instructions. The extension +neon-vfpv4 can be used as an
19026 alias for this extension.
19027
19028 +vfpv3-d16
19029 The VFPv3 floating-point instructions, with 16 double-
19030 precision registers.
19031
19032 +vfpv3
19033 The VFPv3 floating-point instructions, with 32 double-
19034 precision registers.
19035
19036 +vfpv3-d16-fp16
19037 The VFPv3 floating-point instructions, with 16 double-
19038 precision registers and the half-precision floating-point
19039 conversion operations.
19040
19041 +vfpv3-fp16
19042 The VFPv3 floating-point instructions, with 32 double-
19043 precision registers and the half-precision floating-point
19044 conversion operations.
19045
19046 +vfpv4-d16
19047 The VFPv4 floating-point instructions, with 16 double-
19048 precision registers.
19049
19050 +vfpv4
19051 The VFPv4 floating-point instructions, with 32 double-
19052 precision registers.
19053
19054 +neon
19055 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
19056 instructions. The extension +neon-vfpv3 can be used as an
19057 alias for this extension.
19058
19059 +neon-fp16
19060 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
19061 instructions, with the half-precision floating-point
19062 conversion operations.
19063
19064 +nosimd
19065 Disable the Advanced SIMD instructions (does not disable
19066 floating point).
19067
19068 +nofp
19069 Disable the floating-point and Advanced SIMD instructions.
19070
19071 armv8-a
19072 +crc
19073 The Cyclic Redundancy Check (CRC) instructions.
19074
19075 +simd
19076 The ARMv8-A Advanced SIMD and floating-point instructions.
19077
19078 +crypto
19079 The cryptographic instructions.
19080
19081 +nocrypto
19082 Disable the cryptographic instructions.
19083
19084 +nofp
19085 Disable the floating-point, Advanced SIMD and cryptographic
19086 instructions.
19087
19088 +sb Speculation Barrier Instruction.
19089
19090 +predres
19091 Execution and Data Prediction Restriction Instructions.
19092
19093 armv8.1-a
19094 +simd
19095 The ARMv8.1-A Advanced SIMD and floating-point
19096 instructions.
19097
19098 +crypto
19099 The cryptographic instructions. This also enables the
19100 Advanced SIMD and floating-point instructions.
19101
19102 +nocrypto
19103 Disable the cryptographic instructions.
19104
19105 +nofp
19106 Disable the floating-point, Advanced SIMD and cryptographic
19107 instructions.
19108
19109 +sb Speculation Barrier Instruction.
19110
19111 +predres
19112 Execution and Data Prediction Restriction Instructions.
19113
19114 armv8.2-a
19115 armv8.3-a
19116 +fp16
19117 The half-precision floating-point data processing
19118 instructions. This also enables the Advanced SIMD and
19119 floating-point instructions.
19120
19121 +fp16fml
19122 The half-precision floating-point fmla extension. This
19123 also enables the half-precision floating-point extension
19124 and Advanced SIMD and floating-point instructions.
19125
19126 +simd
19127 The ARMv8.1-A Advanced SIMD and floating-point
19128 instructions.
19129
19130 +crypto
19131 The cryptographic instructions. This also enables the
19132 Advanced SIMD and floating-point instructions.
19133
19134 +dotprod
19135 Enable the Dot Product extension. This also enables
19136 Advanced SIMD instructions.
19137
19138 +nocrypto
19139 Disable the cryptographic extension.
19140
19141 +nofp
19142 Disable the floating-point, Advanced SIMD and cryptographic
19143 instructions.
19144
19145 +sb Speculation Barrier Instruction.
19146
19147 +predres
19148 Execution and Data Prediction Restriction Instructions.
19149
19150 +i8mm
19151 8-bit Integer Matrix Multiply instructions. This also
19152 enables Advanced SIMD and floating-point instructions.
19153
19154 +bf16
19155 Brain half-precision floating-point instructions. This
19156 also enables Advanced SIMD and floating-point instructions.
19157
19158 armv8.4-a
19159 +fp16
19160 The half-precision floating-point data processing
19161 instructions. This also enables the Advanced SIMD and
19162 floating-point instructions as well as the Dot Product
19163 extension and the half-precision floating-point fmla
19164 extension.
19165
19166 +simd
19167 The ARMv8.3-A Advanced SIMD and floating-point instructions
19168 as well as the Dot Product extension.
19169
19170 +crypto
19171 The cryptographic instructions. This also enables the
19172 Advanced SIMD and floating-point instructions as well as
19173 the Dot Product extension.
19174
19175 +nocrypto
19176 Disable the cryptographic extension.
19177
19178 +nofp
19179 Disable the floating-point, Advanced SIMD and cryptographic
19180 instructions.
19181
19182 +sb Speculation Barrier Instruction.
19183
19184 +predres
19185 Execution and Data Prediction Restriction Instructions.
19186
19187 +i8mm
19188 8-bit Integer Matrix Multiply instructions. This also
19189 enables Advanced SIMD and floating-point instructions.
19190
19191 +bf16
19192 Brain half-precision floating-point instructions. This
19193 also enables Advanced SIMD and floating-point instructions.
19194
19195 armv8.5-a
19196 +fp16
19197 The half-precision floating-point data processing
19198 instructions. This also enables the Advanced SIMD and
19199 floating-point instructions as well as the Dot Product
19200 extension and the half-precision floating-point fmla
19201 extension.
19202
19203 +simd
19204 The ARMv8.3-A Advanced SIMD and floating-point instructions
19205 as well as the Dot Product extension.
19206
19207 +crypto
19208 The cryptographic instructions. This also enables the
19209 Advanced SIMD and floating-point instructions as well as
19210 the Dot Product extension.
19211
19212 +nocrypto
19213 Disable the cryptographic extension.
19214
19215 +nofp
19216 Disable the floating-point, Advanced SIMD and cryptographic
19217 instructions.
19218
19219 +i8mm
19220 8-bit Integer Matrix Multiply instructions. This also
19221 enables Advanced SIMD and floating-point instructions.
19222
19223 +bf16
19224 Brain half-precision floating-point instructions. This
19225 also enables Advanced SIMD and floating-point instructions.
19226
19227 armv8.6-a
19228 +fp16
19229 The half-precision floating-point data processing
19230 instructions. This also enables the Advanced SIMD and
19231 floating-point instructions as well as the Dot Product
19232 extension and the half-precision floating-point fmla
19233 extension.
19234
19235 +simd
19236 The ARMv8.3-A Advanced SIMD and floating-point instructions
19237 as well as the Dot Product extension.
19238
19239 +crypto
19240 The cryptographic instructions. This also enables the
19241 Advanced SIMD and floating-point instructions as well as
19242 the Dot Product extension.
19243
19244 +nocrypto
19245 Disable the cryptographic extension.
19246
19247 +nofp
19248 Disable the floating-point, Advanced SIMD and cryptographic
19249 instructions.
19250
19251 +i8mm
19252 8-bit Integer Matrix Multiply instructions. This also
19253 enables Advanced SIMD and floating-point instructions.
19254
19255 +bf16
19256 Brain half-precision floating-point instructions. This
19257 also enables Advanced SIMD and floating-point instructions.
19258
19259 armv7-r
19260 +fp.sp
19261 The single-precision VFPv3 floating-point instructions.
19262 The extension +vfpv3xd can be used as an alias for this
19263 extension.
19264
19265 +fp The VFPv3 floating-point instructions with 16 double-
19266 precision registers. The extension +vfpv3-d16 can be used
19267 as an alias for this extension.
19268
19269 +vfpv3xd-d16-fp16
19270 The single-precision VFPv3 floating-point instructions with
19271 16 double-precision registers and the half-precision
19272 floating-point conversion operations.
19273
19274 +vfpv3-d16-fp16
19275 The VFPv3 floating-point instructions with 16 double-
19276 precision registers and the half-precision floating-point
19277 conversion operations.
19278
19279 +nofp
19280 Disable the floating-point extension.
19281
19282 +idiv
19283 The ARM-state integer division instructions.
19284
19285 +noidiv
19286 Disable the ARM-state integer division extension.
19287
19288 armv7e-m
19289 +fp The single-precision VFPv4 floating-point instructions.
19290
19291 +fpv5
19292 The single-precision FPv5 floating-point instructions.
19293
19294 +fp.dp
19295 The single- and double-precision FPv5 floating-point
19296 instructions.
19297
19298 +nofp
19299 Disable the floating-point extensions.
19300
19301 armv8.1-m.main
19302 +dsp
19303 The DSP instructions.
19304
19305 +mve
19306 The M-Profile Vector Extension (MVE) integer instructions.
19307
19308 +mve.fp
19309 The M-Profile Vector Extension (MVE) integer and single
19310 precision floating-point instructions.
19311
19312 +fp The single-precision floating-point instructions.
19313
19314 +fp.dp
19315 The single- and double-precision floating-point
19316 instructions.
19317
19318 +nofp
19319 Disable the floating-point extension.
19320
19321 +cdecp0, +cdecp1, ... , +cdecp7
19322 Enable the Custom Datapath Extension (CDE) on selected
19323 coprocessors according to the numbers given in the options
19324 in the range 0 to 7.
19325
19326 +pacbti
19327 Enable the Pointer Authentication and Branch Target
19328 Identification Extension.
19329
19330 armv8-m.main
19331 +dsp
19332 The DSP instructions.
19333
19334 +nodsp
19335 Disable the DSP extension.
19336
19337 +fp The single-precision floating-point instructions.
19338
19339 +fp.dp
19340 The single- and double-precision floating-point
19341 instructions.
19342
19343 +nofp
19344 Disable the floating-point extension.
19345
19346 +cdecp0, +cdecp1, ... , +cdecp7
19347 Enable the Custom Datapath Extension (CDE) on selected
19348 coprocessors according to the numbers given in the options
19349 in the range 0 to 7.
19350
19351 armv8-r
19352 +crc
19353 The Cyclic Redundancy Check (CRC) instructions.
19354
19355 +fp.sp
19356 The single-precision FPv5 floating-point instructions.
19357
19358 +simd
19359 The ARMv8-A Advanced SIMD and floating-point instructions.
19360
19361 +crypto
19362 The cryptographic instructions.
19363
19364 +nocrypto
19365 Disable the cryptographic instructions.
19366
19367 +nofp
19368 Disable the floating-point, Advanced SIMD and cryptographic
19369 instructions.
19370
19371 -march=native causes the compiler to auto-detect the architecture
19372 of the build computer. At present, this feature is only supported
19373 on GNU/Linux, and not all architectures are recognized. If the
19374 auto-detect is unsuccessful the option has no effect.
19375
19376 -mtune=name
19377 This option specifies the name of the target ARM processor for
19378 which GCC should tune the performance of the code. For some ARM
19379 implementations better performance can be obtained by using this
19380 option. Permissible names are: arm7tdmi, arm7tdmi-s, arm710t,
19381 arm720t, arm740t, strongarm, strongarm110, strongarm1100,
19382 strongarm1110, arm8, arm810, arm9, arm9e, arm920, arm920t, arm922t,
19383 arm946e-s, arm966e-s, arm968e-s, arm926ej-s, arm940t, arm9tdmi,
19384 arm10tdmi, arm1020t, arm1026ej-s, arm10e, arm1020e, arm1022e,
19385 arm1136j-s, arm1136jf-s, mpcore, mpcorenovfp, arm1156t2-s,
19386 arm1156t2f-s, arm1176jz-s, arm1176jzf-s, generic-armv7-a,
19387 cortex-a5, cortex-a7, cortex-a8, cortex-a9, cortex-a12, cortex-a15,
19388 cortex-a17, cortex-a32, cortex-a35, cortex-a53, cortex-a55,
19389 cortex-a57, cortex-a72, cortex-a73, cortex-a75, cortex-a76,
19390 cortex-a76ae, cortex-a77, cortex-a78, cortex-a78ae, cortex-a78c,
19391 cortex-a710, ares, cortex-r4, cortex-r4f, cortex-r5, cortex-r7,
19392 cortex-r8, cortex-r52, cortex-r52plus, cortex-m0, cortex-m0plus,
19393 cortex-m1, cortex-m3, cortex-m4, cortex-m7, cortex-m23, cortex-m33,
19394 cortex-m35p, cortex-m55, cortex-m85, cortex-x1, cortex-x1c,
19395 cortex-m1.small-multiply, cortex-m0.small-multiply,
19396 cortex-m0plus.small-multiply, exynos-m1, marvell-pj4, neoverse-n1,
19397 neoverse-n2, neoverse-v1, xscale, iwmmxt, iwmmxt2, ep9312, fa526,
19398 fa626, fa606te, fa626te, fmp626, fa726te, star-mc1, xgene1.
19399
19400 Additionally, this option can specify that GCC should tune the
19401 performance of the code for a big.LITTLE system. Permissible names
19402 are: cortex-a15.cortex-a7, cortex-a17.cortex-a7,
19403 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
19404 cortex-a72.cortex-a35, cortex-a73.cortex-a53,
19405 cortex-a75.cortex-a55, cortex-a76.cortex-a55.
19406
19407 -mtune=generic-arch specifies that GCC should tune the performance
19408 for a blend of processors within architecture arch. The aim is to
19409 generate code that run well on the current most popular processors,
19410 balancing between optimizations that benefit some CPUs in the
19411 range, and avoiding performance pitfalls of other CPUs. The
19412 effects of this option may change in future GCC versions as CPU
19413 models come and go.
19414
19415 -mtune permits the same extension options as -mcpu, but the
19416 extension options do not affect the tuning of the generated code.
19417
19418 -mtune=native causes the compiler to auto-detect the CPU of the
19419 build computer. At present, this feature is only supported on
19420 GNU/Linux, and not all architectures are recognized. If the auto-
19421 detect is unsuccessful the option has no effect.
19422
19423 -mcpu=name[+extension...]
19424 This specifies the name of the target ARM processor. GCC uses this
19425 name to derive the name of the target ARM architecture (as if
19426 specified by -march) and the ARM processor type for which to tune
19427 for performance (as if specified by -mtune). Where this option is
19428 used in conjunction with -march or -mtune, those options take
19429 precedence over the appropriate part of this option.
19430
19431 Many of the supported CPUs implement optional architectural
19432 extensions. Where this is so the architectural extensions are
19433 normally enabled by default. If implementations that lack the
19434 extension exist, then the extension syntax can be used to disable
19435 those extensions that have been omitted. For floating-point and
19436 Advanced SIMD (Neon) instructions, the settings of the options
19437 -mfloat-abi and -mfpu must also be considered: floating-point and
19438 Advanced SIMD instructions will only be used if -mfloat-abi is not
19439 set to soft; and any setting of -mfpu other than auto will override
19440 the available floating-point and SIMD extension instructions.
19441
19442 For example, cortex-a9 can be found in three major configurations:
19443 integer only, with just a floating-point unit or with floating-
19444 point and Advanced SIMD. The default is to enable all the
19445 instructions, but the extensions +nosimd and +nofp can be used to
19446 disable just the SIMD or both the SIMD and floating-point
19447 instructions respectively.
19448
19449 Permissible names for this option are the same as those for -mtune.
19450
19451 The following extension options are common to the listed CPUs:
19452
19453 +nodsp
19454 Disable the DSP instructions on cortex-m33, cortex-m35p,
19455 cortex-m55 and cortex-m85. Also disable the M-Profile Vector
19456 Extension (MVE) integer and single precision floating-point
19457 instructions on cortex-m55 and cortex-m85.
19458
19459 +nopacbti
19460 Disable the Pointer Authentication and Branch Target
19461 Identification Extension on cortex-m85.
19462
19463 +nomve
19464 Disable the M-Profile Vector Extension (MVE) integer and single
19465 precision floating-point instructions on cortex-m55 and
19466 cortex-m85.
19467
19468 +nomve.fp
19469 Disable the M-Profile Vector Extension (MVE) single precision
19470 floating-point instructions on cortex-m55 and cortex-m85.
19471
19472 +cdecp0, +cdecp1, ... , +cdecp7
19473 Enable the Custom Datapath Extension (CDE) on selected
19474 coprocessors according to the numbers given in the options in
19475 the range 0 to 7 on cortex-m55.
19476
19477 +nofp
19478 Disables the floating-point instructions on arm9e, arm946e-s,
19479 arm966e-s, arm968e-s, arm10e, arm1020e, arm1022e, arm926ej-s,
19480 arm1026ej-s, cortex-r5, cortex-r7, cortex-r8, cortex-m4,
19481 cortex-m7, cortex-m33, cortex-m35p cortex-m4, cortex-m7,
19482 cortex-m33, cortex-m35p, cortex-m55 and cortex-m85. Disables
19483 the floating-point and SIMD instructions on generic-armv7-a,
19484 cortex-a5, cortex-a7, cortex-a8, cortex-a9, cortex-a12,
19485 cortex-a15, cortex-a17, cortex-a15.cortex-a7,
19486 cortex-a17.cortex-a7, cortex-a32, cortex-a35, cortex-a53 and
19487 cortex-a55.
19488
19489 +nofp.dp
19490 Disables the double-precision component of the floating-point
19491 instructions on cortex-r5, cortex-r7, cortex-r8, cortex-r52,
19492 cortex-r52plus and cortex-m7.
19493
19494 +nosimd
19495 Disables the SIMD (but not floating-point) instructions on
19496 generic-armv7-a, cortex-a5, cortex-a7 and cortex-a9.
19497
19498 +crypto
19499 Enables the cryptographic instructions on cortex-a32,
19500 cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a72,
19501 cortex-a73, cortex-a75, exynos-m1, xgene1,
19502 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
19503 cortex-a73.cortex-a35, cortex-a73.cortex-a53 and
19504 cortex-a75.cortex-a55.
19505
19506 Additionally the generic-armv7-a pseudo target defaults to VFPv3
19507 with 16 double-precision registers. It supports the following
19508 extension options: mp, sec, vfpv3-d16, vfpv3, vfpv3-d16-fp16,
19509 vfpv3-fp16, vfpv4-d16, vfpv4, neon, neon-vfpv3, neon-fp16,
19510 neon-vfpv4. The meanings are the same as for the extensions to
19511 -march=armv7-a.
19512
19513 -mcpu=generic-arch is also permissible, and is equivalent to
19514 -march=arch -mtune=generic-arch. See -mtune for more information.
19515
19516 -mcpu=native causes the compiler to auto-detect the CPU of the
19517 build computer. At present, this feature is only supported on
19518 GNU/Linux, and not all architectures are recognized. If the auto-
19519 detect is unsuccessful the option has no effect.
19520
19521 -mfpu=name
19522 This specifies what floating-point hardware (or hardware emulation)
19523 is available on the target. Permissible names are: auto, vfpv2,
19524 vfpv3, vfpv3-fp16, vfpv3-d16, vfpv3-d16-fp16, vfpv3xd,
19525 vfpv3xd-fp16, neon-vfpv3, neon-fp16, vfpv4, vfpv4-d16, fpv4-sp-d16,
19526 neon-vfpv4, fpv5-d16, fpv5-sp-d16, fp-armv8, neon-fp-armv8 and
19527 crypto-neon-fp-armv8. Note that neon is an alias for neon-vfpv3
19528 and vfp is an alias for vfpv2.
19529
19530 The setting auto is the default and is special. It causes the
19531 compiler to select the floating-point and Advanced SIMD
19532 instructions based on the settings of -mcpu and -march.
19533
19534 If the selected floating-point hardware includes the NEON extension
19535 (e.g. -mfpu=neon), note that floating-point operations are not
19536 generated by GCC's auto-vectorization pass unless
19537 -funsafe-math-optimizations is also specified. This is because
19538 NEON hardware does not fully implement the IEEE 754 standard for
19539 floating-point arithmetic (in particular denormal values are
19540 treated as zero), so the use of NEON instructions may lead to a
19541 loss of precision.
19542
19543 You can also set the fpu name at function level by using the
19544 target("fpu=") function attributes or pragmas.
19545
19546 -mfp16-format=name
19547 Specify the format of the "__fp16" half-precision floating-point
19548 type. Permissible names are none, ieee, and alternative; the
19549 default is none, in which case the "__fp16" type is not defined.
19550
19551 -mstructure-size-boundary=n
19552 The sizes of all structures and unions are rounded up to a multiple
19553 of the number of bits set by this option. Permissible values are
19554 8, 32 and 64. The default value varies for different toolchains.
19555 For the COFF targeted toolchain the default value is 8. A value of
19556 64 is only allowed if the underlying ABI supports it.
19557
19558 Specifying a larger number can produce faster, more efficient code,
19559 but can also increase the size of the program. Different values
19560 are potentially incompatible. Code compiled with one value cannot
19561 necessarily expect to work with code or libraries compiled with
19562 another value, if they exchange information using structures or
19563 unions.
19564
19565 This option is deprecated.
19566
19567 -mabort-on-noreturn
19568 Generate a call to the function "abort" at the end of a "noreturn"
19569 function. It is executed if the function tries to return.
19570
19571 -mlong-calls
19572 -mno-long-calls
19573 Tells the compiler to perform function calls by first loading the
19574 address of the function into a register and then performing a
19575 subroutine call on this register. This switch is needed if the
19576 target function lies outside of the 64-megabyte addressing range of
19577 the offset-based version of subroutine call instruction.
19578
19579 Even if this switch is enabled, not all function calls are turned
19580 into long calls. The heuristic is that static functions, functions
19581 that have the "short_call" attribute, functions that are inside the
19582 scope of a "#pragma no_long_calls" directive, and functions whose
19583 definitions have already been compiled within the current
19584 compilation unit are not turned into long calls. The exceptions to
19585 this rule are that weak function definitions, functions with the
19586 "long_call" attribute or the "section" attribute, and functions
19587 that are within the scope of a "#pragma long_calls" directive are
19588 always turned into long calls.
19589
19590 This feature is not enabled by default. Specifying -mno-long-calls
19591 restores the default behavior, as does placing the function calls
19592 within the scope of a "#pragma long_calls_off" directive. Note
19593 these switches have no effect on how the compiler generates code to
19594 handle function calls via function pointers.
19595
19596 -msingle-pic-base
19597 Treat the register used for PIC addressing as read-only, rather
19598 than loading it in the prologue for each function. The runtime
19599 system is responsible for initializing this register with an
19600 appropriate value before execution begins.
19601
19602 -mpic-register=reg
19603 Specify the register to be used for PIC addressing. For standard
19604 PIC base case, the default is any suitable register determined by
19605 compiler. For single PIC base case, the default is R9 if target is
19606 EABI based or stack-checking is enabled, otherwise the default is
19607 R10.
19608
19609 -mpic-data-is-text-relative
19610 Assume that the displacement between the text and data segments is
19611 fixed at static link time. This permits using PC-relative
19612 addressing operations to access data known to be in the data
19613 segment. For non-VxWorks RTP targets, this option is enabled by
19614 default. When disabled on such targets, it will enable
19615 -msingle-pic-base by default.
19616
19617 -mpoke-function-name
19618 Write the name of each function into the text section, directly
19619 preceding the function prologue. The generated code is similar to
19620 this:
19621
19622 t0
19623 .ascii "arm_poke_function_name", 0
19624 .align
19625 t1
19626 .word 0xff000000 + (t1 - t0)
19627 arm_poke_function_name
19628 mov ip, sp
19629 stmfd sp!, {fp, ip, lr, pc}
19630 sub fp, ip, #4
19631
19632 When performing a stack backtrace, code can inspect the value of
19633 "pc" stored at "fp + 0". If the trace function then looks at
19634 location "pc - 12" and the top 8 bits are set, then we know that
19635 there is a function name embedded immediately preceding this
19636 location and has length "((pc[-3]) & 0xff000000)".
19637
19638 -mthumb
19639 -marm
19640 Select between generating code that executes in ARM and Thumb
19641 states. The default for most configurations is to generate code
19642 that executes in ARM state, but the default can be changed by
19643 configuring GCC with the --with-mode=state configure option.
19644
19645 You can also override the ARM and Thumb mode for each function by
19646 using the target("thumb") and target("arm") function attributes or
19647 pragmas.
19648
19649 -mflip-thumb
19650 Switch ARM/Thumb modes on alternating functions. This option is
19651 provided for regression testing of mixed Thumb/ARM code generation,
19652 and is not intended for ordinary use in compiling code.
19653
19654 -mtpcs-frame
19655 Generate a stack frame that is compliant with the Thumb Procedure
19656 Call Standard for all non-leaf functions. (A leaf function is one
19657 that does not call any other functions.) The default is
19658 -mno-tpcs-frame.
19659
19660 -mtpcs-leaf-frame
19661 Generate a stack frame that is compliant with the Thumb Procedure
19662 Call Standard for all leaf functions. (A leaf function is one that
19663 does not call any other functions.) The default is
19664 -mno-apcs-leaf-frame.
19665
19666 -mcallee-super-interworking
19667 Gives all externally visible functions in the file being compiled
19668 an ARM instruction set header which switches to Thumb mode before
19669 executing the rest of the function. This allows these functions to
19670 be called from non-interworking code. This option is not valid in
19671 AAPCS configurations because interworking is enabled by default.
19672
19673 -mcaller-super-interworking
19674 Allows calls via function pointers (including virtual functions) to
19675 execute correctly regardless of whether the target code has been
19676 compiled for interworking or not. There is a small overhead in the
19677 cost of executing a function pointer if this option is enabled.
19678 This option is not valid in AAPCS configurations because
19679 interworking is enabled by default.
19680
19681 -mtp=name
19682 Specify the access model for the thread local storage pointer. The
19683 valid models are soft, which generates calls to "__aeabi_read_tp",
19684 cp15, which fetches the thread pointer from "cp15" directly
19685 (supported in the arm6k architecture), and auto, which uses the
19686 best available method for the selected processor. The default
19687 setting is auto.
19688
19689 -mtls-dialect=dialect
19690 Specify the dialect to use for accessing thread local storage. Two
19691 dialects are supported---gnu and gnu2. The gnu dialect selects the
19692 original GNU scheme for supporting local and global dynamic TLS
19693 models. The gnu2 dialect selects the GNU descriptor scheme, which
19694 provides better performance for shared libraries. The GNU
19695 descriptor scheme is compatible with the original scheme, but does
19696 require new assembler, linker and library support. Initial and
19697 local exec TLS models are unaffected by this option and always use
19698 the original scheme.
19699
19700 -mword-relocations
19701 Only generate absolute relocations on word-sized values (i.e.
19702 R_ARM_ABS32). This is enabled by default on targets (uClinux,
19703 SymbianOS) where the runtime loader imposes this restriction, and
19704 when -fpic or -fPIC is specified. This option conflicts with
19705 -mslow-flash-data.
19706
19707 -mfix-cortex-m3-ldrd
19708 Some Cortex-M3 cores can cause data corruption when "ldrd"
19709 instructions with overlapping destination and base registers are
19710 used. This option avoids generating these instructions. This
19711 option is enabled by default when -mcpu=cortex-m3 is specified.
19712
19713 -mfix-cortex-a57-aes-1742098
19714 -mno-fix-cortex-a57-aes-1742098
19715 -mfix-cortex-a72-aes-1655431
19716 -mno-fix-cortex-a72-aes-1655431
19717 Enable (disable) mitigation for an erratum on Cortex-A57 and
19718 Cortex-A72 that affects the AES cryptographic instructions. This
19719 option is enabled by default when either -mcpu=cortex-a57 or
19720 -mcpu=cortex-a72 is specified.
19721
19722 -munaligned-access
19723 -mno-unaligned-access
19724 Enables (or disables) reading and writing of 16- and 32- bit values
19725 from addresses that are not 16- or 32- bit aligned. By default
19726 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
19727 ARMv8-M Baseline architectures, and enabled for all other
19728 architectures. If unaligned access is not enabled then words in
19729 packed data structures are accessed a byte at a time.
19730
19731 The ARM attribute "Tag_CPU_unaligned_access" is set in the
19732 generated object file to either true or false, depending upon the
19733 setting of this option. If unaligned access is enabled then the
19734 preprocessor symbol "__ARM_FEATURE_UNALIGNED" is also defined.
19735
19736 -mneon-for-64bits
19737 This option is deprecated and has no effect.
19738
19739 -mslow-flash-data
19740 Assume loading data from flash is slower than fetching instruction.
19741 Therefore literal load is minimized for better performance. This
19742 option is only supported when compiling for ARMv7 M-profile and off
19743 by default. It conflicts with -mword-relocations.
19744
19745 -masm-syntax-unified
19746 Assume inline assembler is using unified asm syntax. The default
19747 is currently off which implies divided syntax. This option has no
19748 impact on Thumb2. However, this may change in future releases of
19749 GCC. Divided syntax should be considered deprecated.
19750
19751 -mrestrict-it
19752 Restricts generation of IT blocks to conform to the rules of
19753 ARMv8-A. IT blocks can only contain a single 16-bit instruction
19754 from a select set of instructions. This option is on by default for
19755 ARMv8-A Thumb mode.
19756
19757 -mprint-tune-info
19758 Print CPU tuning information as comment in assembler file. This is
19759 an option used only for regression testing of the compiler and not
19760 intended for ordinary use in compiling code. This option is
19761 disabled by default.
19762
19763 -mverbose-cost-dump
19764 Enable verbose cost model dumping in the debug dump files. This
19765 option is provided for use in debugging the compiler.
19766
19767 -mpure-code
19768 Do not allow constant data to be placed in code sections.
19769 Additionally, when compiling for ELF object format give all text
19770 sections the ELF processor-specific section attribute
19771 "SHF_ARM_PURECODE". This option is only available when generating
19772 non-pic code for M-profile targets.
19773
19774 -mcmse
19775 Generate secure code as per the "ARMv8-M Security Extensions:
19776 Requirements on Development Tools Engineering Specification", which
19777 can be found on
19778 <https://developer.arm.com/documentation/ecm0359818/latest/>.
19779
19780 -mfix-cmse-cve-2021-35465
19781 Mitigate against a potential security issue with the "VLLDM"
19782 instruction in some M-profile devices when using CMSE
19783 (CVE-2021-365465). This option is enabled by default when the
19784 option -mcpu= is used with "cortex-m33", "cortex-m35p",
19785 "cortex-m55", "cortex-m85" or "star-mc1". The option
19786 -mno-fix-cmse-cve-2021-35465 can be used to disable the mitigation.
19787
19788 -mstack-protector-guard=guard
19789 -mstack-protector-guard-offset=offset
19790 Generate stack protection code using canary at guard. Supported
19791 locations are global for a global canary or tls for a canary
19792 accessible via the TLS register. The option
19793 -mstack-protector-guard-offset= is for use with
19794 -fstack-protector-guard=tls and not for use in user-land code.
19795
19796 -mfdpic
19797 -mno-fdpic
19798 Select the FDPIC ABI, which uses 64-bit function descriptors to
19799 represent pointers to functions. When the compiler is configured
19800 for "arm-*-uclinuxfdpiceabi" targets, this option is on by default
19801 and implies -fPIE if none of the PIC/PIE-related options is
19802 provided. On other targets, it only enables the FDPIC-specific
19803 code generation features, and the user should explicitly provide
19804 the PIC/PIE-related options as needed.
19805
19806 Note that static linking is not supported because it would still
19807 involve the dynamic linker when the program self-relocates. If
19808 such behavior is acceptable, use -static and -Wl,-dynamic-linker
19809 options.
19810
19811 The opposite -mno-fdpic option is useful (and required) to build
19812 the Linux kernel using the same ("arm-*-uclinuxfdpiceabi")
19813 toolchain as the one used to build the userland programs.
19814
19815 -mbranch-protection=none|standard|pac-ret[+leaf][+bti]|bti[+pac-
19816 ret[+leaf]]
19817 Enable branch protection features (armv8.1-m.main only). none
19818 generate code without branch protection or return address signing.
19819 standard[+leaf] generate code with all branch protection features
19820 enabled at their standard level. pac-ret[+leaf] generate code with
19821 return address signing set to its standard level, which is to sign
19822 all functions that save the return address to memory. leaf When
19823 return address signing is enabled, also sign leaf functions even if
19824 they do not write the return address to memory. +bti Add landing-
19825 pad instructions at the permitted targets of indirect branch
19826 instructions.
19827
19828 If the +pacbti architecture extension is not enabled, then all
19829 branch protection and return address signing operations are
19830 constrained to use only the instructions defined in the
19831 architectural-NOP space. The generated code will remain backwards-
19832 compatible with earlier versions of the architecture, but the
19833 additional security can be enabled at run time on processors that
19834 support the PACBTI extension.
19835
19836 Branch target enforcement using BTI can only be enabled at runtime
19837 if all code in the application has been compiled with at least
19838 -mbranch-protection=bti.
19839
19840 Any setting other than none is supported only on armv8-m.main or
19841 later.
19842
19843 The default is to generate code without branch protection or return
19844 address signing.
19845
19846 AVR Options
19847 These options are defined for AVR implementations:
19848
19849 -mmcu=mcu
19850 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
19851
19852 The default for this option is avr2.
19853
19854 GCC supports the following AVR devices and ISAs:
19855
19856 "avr2"
19857 "Classic" devices with up to 8 KiB of program memory. mcu =
19858 "attiny22", "attiny26", "at90s2313", "at90s2323", "at90s2333",
19859 "at90s2343", "at90s4414", "at90s4433", "at90s4434",
19860 "at90c8534", "at90s8515", "at90s8535".
19861
19862 "avr25"
19863 "Classic" devices with up to 8 KiB of program memory and with
19864 the "MOVW" instruction. mcu = "attiny13", "attiny13a",
19865 "attiny24", "attiny24a", "attiny25", "attiny261", "attiny261a",
19866 "attiny2313", "attiny2313a", "attiny43u", "attiny44",
19867 "attiny44a", "attiny45", "attiny48", "attiny441", "attiny461",
19868 "attiny461a", "attiny4313", "attiny84", "attiny84a",
19869 "attiny85", "attiny87", "attiny88", "attiny828", "attiny841",
19870 "attiny861", "attiny861a", "ata5272", "ata6616c", "at86rf401".
19871
19872 "avr3"
19873 "Classic" devices with 16 KiB up to 64 KiB of program memory.
19874 mcu = "at76c711", "at43usb355".
19875
19876 "avr31"
19877 "Classic" devices with 128 KiB of program memory. mcu =
19878 "atmega103", "at43usb320".
19879
19880 "avr35"
19881 "Classic" devices with 16 KiB up to 64 KiB of program memory
19882 and with the "MOVW" instruction. mcu = "attiny167",
19883 "attiny1634", "atmega8u2", "atmega16u2", "atmega32u2",
19884 "ata5505", "ata6617c", "ata664251", "at90usb82", "at90usb162".
19885
19886 "avr4"
19887 "Enhanced" devices with up to 8 KiB of program memory. mcu =
19888 "atmega48", "atmega48a", "atmega48p", "atmega48pa",
19889 "atmega48pb", "atmega8", "atmega8a", "atmega8hva", "atmega88",
19890 "atmega88a", "atmega88p", "atmega88pa", "atmega88pb",
19891 "atmega8515", "atmega8535", "ata6285", "ata6286", "ata6289",
19892 "ata6612c", "at90pwm1", "at90pwm2", "at90pwm2b", "at90pwm3",
19893 "at90pwm3b", "at90pwm81".
19894
19895 "avr5"
19896 "Enhanced" devices with 16 KiB up to 64 KiB of program memory.
19897 mcu = "atmega16", "atmega16a", "atmega16hva", "atmega16hva2",
19898 "atmega16hvb", "atmega16hvbrevb", "atmega16m1", "atmega16u4",
19899 "atmega161", "atmega162", "atmega163", "atmega164a",
19900 "atmega164p", "atmega164pa", "atmega165", "atmega165a",
19901 "atmega165p", "atmega165pa", "atmega168", "atmega168a",
19902 "atmega168p", "atmega168pa", "atmega168pb", "atmega169",
19903 "atmega169a", "atmega169p", "atmega169pa", "atmega32",
19904 "atmega32a", "atmega32c1", "atmega32hvb", "atmega32hvbrevb",
19905 "atmega32m1", "atmega32u4", "atmega32u6", "atmega323",
19906 "atmega324a", "atmega324p", "atmega324pa", "atmega324pb",
19907 "atmega325", "atmega325a", "atmega325p", "atmega325pa",
19908 "atmega328", "atmega328p", "atmega328pb", "atmega329",
19909 "atmega329a", "atmega329p", "atmega329pa", "atmega3250",
19910 "atmega3250a", "atmega3250p", "atmega3250pa", "atmega3290",
19911 "atmega3290a", "atmega3290p", "atmega3290pa", "atmega406",
19912 "atmega64", "atmega64a", "atmega64c1", "atmega64hve",
19913 "atmega64hve2", "atmega64m1", "atmega64rfr2", "atmega640",
19914 "atmega644", "atmega644a", "atmega644p", "atmega644pa",
19915 "atmega644rfr2", "atmega645", "atmega645a", "atmega645p",
19916 "atmega649", "atmega649a", "atmega649p", "atmega6450",
19917 "atmega6450a", "atmega6450p", "atmega6490", "atmega6490a",
19918 "atmega6490p", "ata5795", "ata5790", "ata5790n", "ata5791",
19919 "ata6613c", "ata6614q", "ata5782", "ata5831", "ata8210",
19920 "ata8510", "ata5702m322", "at90pwm161", "at90pwm216",
19921 "at90pwm316", "at90can32", "at90can64", "at90scr100",
19922 "at90usb646", "at90usb647", "at94k", "m3000".
19923
19924 "avr51"
19925 "Enhanced" devices with 128 KiB of program memory. mcu =
19926 "atmega128", "atmega128a", "atmega128rfa1", "atmega128rfr2",
19927 "atmega1280", "atmega1281", "atmega1284", "atmega1284p",
19928 "atmega1284rfr2", "at90can128", "at90usb1286", "at90usb1287".
19929
19930 "avr6"
19931 "Enhanced" devices with 3-byte PC, i.e. with more than 128 KiB
19932 of program memory. mcu = "atmega256rfr2", "atmega2560",
19933 "atmega2561", "atmega2564rfr2".
19934
19935 "avrxmega2"
19936 "XMEGA" devices with more than 8 KiB and up to 64 KiB of
19937 program memory. mcu = "atxmega8e5", "atxmega16a4",
19938 "atxmega16a4u", "atxmega16c4", "atxmega16d4", "atxmega16e5",
19939 "atxmega32a4", "atxmega32a4u", "atxmega32c3", "atxmega32c4",
19940 "atxmega32d3", "atxmega32d4", "atxmega32e5", "avr64da28",
19941 "avr64da32", "avr64da48", "avr64da64", "avr64db28",
19942 "avr64db32", "avr64db48", "avr64db64", "avr64dd14",
19943 "avr64dd20", "avr64dd28", "avr64dd32", "avr64ea28",
19944 "avr64ea32", "avr64ea48".
19945
19946 "avrxmega3"
19947 "XMEGA" devices with up to 64 KiB of combined program memory
19948 and RAM, and with program memory visible in the RAM address
19949 space. mcu = "attiny202", "attiny204", "attiny212",
19950 "attiny214", "attiny402", "attiny404", "attiny406",
19951 "attiny412", "attiny414", "attiny416", "attiny417",
19952 "attiny424", "attiny426", "attiny427", "attiny804",
19953 "attiny806", "attiny807", "attiny814", "attiny816",
19954 "attiny817", "attiny824", "attiny826", "attiny827",
19955 "attiny1604", "attiny1606", "attiny1607", "attiny1614",
19956 "attiny1616", "attiny1617", "attiny1624", "attiny1626",
19957 "attiny1627", "attiny3214", "attiny3216", "attiny3217",
19958 "attiny3224", "attiny3226", "attiny3227", "atmega808",
19959 "atmega809", "atmega1608", "atmega1609", "atmega3208",
19960 "atmega3209", "atmega4808", "atmega4809", "avr16dd14",
19961 "avr16dd20", "avr16dd28", "avr16dd32", "avr32da28",
19962 "avr32da32", "avr32da48", "avr32db28", "avr32db32",
19963 "avr32db48", "avr32dd14", "avr32dd20", "avr32dd28",
19964 "avr32dd32".
19965
19966 "avrxmega4"
19967 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
19968 program memory. mcu = "atxmega64a3", "atxmega64a3u",
19969 "atxmega64a4u", "atxmega64b1", "atxmega64b3", "atxmega64c3",
19970 "atxmega64d3", "atxmega64d4", "avr128da28", "avr128da32",
19971 "avr128da48", "avr128da64", "avr128db28", "avr128db32",
19972 "avr128db48", "avr128db64".
19973
19974 "avrxmega5"
19975 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
19976 program memory and more than 64 KiB of RAM. mcu =
19977 "atxmega64a1", "atxmega64a1u".
19978
19979 "avrxmega6"
19980 "XMEGA" devices with more than 128 KiB of program memory. mcu
19981 = "atxmega128a3", "atxmega128a3u", "atxmega128b1",
19982 "atxmega128b3", "atxmega128c3", "atxmega128d3", "atxmega128d4",
19983 "atxmega192a3", "atxmega192a3u", "atxmega192c3",
19984 "atxmega192d3", "atxmega256a3", "atxmega256a3b",
19985 "atxmega256a3bu", "atxmega256a3u", "atxmega256c3",
19986 "atxmega256d3", "atxmega384c3", "atxmega384d3".
19987
19988 "avrxmega7"
19989 "XMEGA" devices with more than 128 KiB of program memory and
19990 more than 64 KiB of RAM. mcu = "atxmega128a1",
19991 "atxmega128a1u", "atxmega128a4u".
19992
19993 "avrtiny"
19994 "TINY" Tiny core devices with 512 B up to 4 KiB of program
19995 memory. mcu = "attiny4", "attiny5", "attiny9", "attiny10",
19996 "attiny102", "attiny104", "attiny20", "attiny40".
19997
19998 "avr1"
19999 This ISA is implemented by the minimal AVR core and supported
20000 for assembler only. mcu = "attiny11", "attiny12", "attiny15",
20001 "attiny28", "at90s1200".
20002
20003 -mabsdata
20004 Assume that all data in static storage can be accessed by LDS / STS
20005 instructions. This option has only an effect on reduced Tiny
20006 devices like ATtiny40. See also the "absdata" AVR Variable
20007 Attributes,variable attribute.
20008
20009 -maccumulate-args
20010 Accumulate outgoing function arguments and acquire/release the
20011 needed stack space for outgoing function arguments once in function
20012 prologue/epilogue. Without this option, outgoing arguments are
20013 pushed before calling a function and popped afterwards.
20014
20015 Popping the arguments after the function call can be expensive on
20016 AVR so that accumulating the stack space might lead to smaller
20017 executables because arguments need not be removed from the stack
20018 after such a function call.
20019
20020 This option can lead to reduced code size for functions that
20021 perform several calls to functions that get their arguments on the
20022 stack like calls to printf-like functions.
20023
20024 -mbranch-cost=cost
20025 Set the branch costs for conditional branch instructions to cost.
20026 Reasonable values for cost are small, non-negative integers. The
20027 default branch cost is 0.
20028
20029 -mcall-prologues
20030 Functions prologues/epilogues are expanded as calls to appropriate
20031 subroutines. Code size is smaller.
20032
20033 -mdouble=bits
20034 -mlong-double=bits
20035 Set the size (in bits) of the "double" or "long double" type,
20036 respectively. Possible values for bits are 32 and 64. Whether or
20037 not a specific value for bits is allowed depends on the
20038 "--with-double=" and "--with-long-double=" configure options
20039 ("https://gcc.gnu.org/install/configure.html#avr"), and the same
20040 applies for the default values of the options.
20041
20042 -mgas-isr-prologues
20043 Interrupt service routines (ISRs) may use the "__gcc_isr" pseudo
20044 instruction supported by GNU Binutils. If this option is on, the
20045 feature can still be disabled for individual ISRs by means of the
20046 AVR Function Attributes,,"no_gccisr" function attribute. This
20047 feature is activated per default if optimization is on (but not
20048 with -Og, @pxref{Optimize Options}), and if GNU Binutils support
20049 PR21683 ("https://sourceware.org/PR21683").
20050
20051 -mint8
20052 Assume "int" to be 8-bit integer. This affects the sizes of all
20053 types: a "char" is 1 byte, an "int" is 1 byte, a "long" is 2 bytes,
20054 and "long long" is 4 bytes. Please note that this option does not
20055 conform to the C standards, but it results in smaller code size.
20056
20057 -mmain-is-OS_task
20058 Do not save registers in "main". The effect is the same like
20059 attaching attribute AVR Function Attributes,,"OS_task" to "main".
20060 It is activated per default if optimization is on.
20061
20062 -mn-flash=num
20063 Assume that the flash memory has a size of num times 64 KiB.
20064
20065 -mno-interrupts
20066 Generated code is not compatible with hardware interrupts. Code
20067 size is smaller.
20068
20069 -mrelax
20070 Try to replace "CALL" resp. "JMP" instruction by the shorter
20071 "RCALL" resp. "RJMP" instruction if applicable. Setting -mrelax
20072 just adds the --mlink-relax option to the assembler's command line
20073 and the --relax option to the linker's command line.
20074
20075 Jump relaxing is performed by the linker because jump offsets are
20076 not known before code is located. Therefore, the assembler code
20077 generated by the compiler is the same, but the instructions in the
20078 executable may differ from instructions in the assembler code.
20079
20080 Relaxing must be turned on if linker stubs are needed, see the
20081 section on "EIND" and linker stubs below.
20082
20083 -mrmw
20084 Assume that the device supports the Read-Modify-Write instructions
20085 "XCH", "LAC", "LAS" and "LAT".
20086
20087 -mshort-calls
20088 Assume that "RJMP" and "RCALL" can target the whole program memory.
20089
20090 This option is used internally for multilib selection. It is not
20091 an optimization option, and you don't need to set it by hand.
20092
20093 -msp8
20094 Treat the stack pointer register as an 8-bit register, i.e. assume
20095 the high byte of the stack pointer is zero. In general, you don't
20096 need to set this option by hand.
20097
20098 This option is used internally by the compiler to select and build
20099 multilibs for architectures "avr2" and "avr25". These
20100 architectures mix devices with and without "SPH". For any setting
20101 other than -mmcu=avr2 or -mmcu=avr25 the compiler driver adds or
20102 removes this option from the compiler proper's command line,
20103 because the compiler then knows if the device or architecture has
20104 an 8-bit stack pointer and thus no "SPH" register or not.
20105
20106 -mstrict-X
20107 Use address register "X" in a way proposed by the hardware. This
20108 means that "X" is only used in indirect, post-increment or pre-
20109 decrement addressing.
20110
20111 Without this option, the "X" register may be used in the same way
20112 as "Y" or "Z" which then is emulated by additional instructions.
20113 For example, loading a value with "X+const" addressing with a small
20114 non-negative "const < 64" to a register Rn is performed as
20115
20116 adiw r26, const ; X += const
20117 ld <Rn>, X ; <Rn> = *X
20118 sbiw r26, const ; X -= const
20119
20120 -mtiny-stack
20121 Only change the lower 8 bits of the stack pointer.
20122
20123 -mfract-convert-truncate
20124 Allow to use truncation instead of rounding towards zero for
20125 fractional fixed-point types.
20126
20127 -nodevicelib
20128 Don't link against AVR-LibC's device specific library "lib<mcu>.a".
20129
20130 -nodevicespecs
20131 Don't add -specs=device-specs/specs-mcu to the compiler driver's
20132 command line. The user takes responsibility for supplying the sub-
20133 processes like compiler proper, assembler and linker with
20134 appropriate command line options. This means that the user has to
20135 supply her private device specs file by means of -specs=path-to-
20136 specs-file. There is no more need for option -mmcu=mcu.
20137
20138 This option can also serve as a replacement for the older way of
20139 specifying custom device-specs files that needed -B some-path to
20140 point to a directory which contains a folder named "device-specs"
20141 which contains a specs file named "specs-mcu", where mcu was
20142 specified by -mmcu=mcu.
20143
20144 -Waddr-space-convert
20145 Warn about conversions between address spaces in the case where the
20146 resulting address space is not contained in the incoming address
20147 space.
20148
20149 -Wmisspelled-isr
20150 Warn if the ISR is misspelled, i.e. without __vector prefix.
20151 Enabled by default.
20152
20153 "EIND" and Devices with More Than 128 Ki Bytes of Flash
20154
20155 Pointers in the implementation are 16 bits wide. The address of a
20156 function or label is represented as word address so that indirect jumps
20157 and calls can target any code address in the range of 64 Ki words.
20158
20159 In order to facilitate indirect jump on devices with more than 128 Ki
20160 bytes of program memory space, there is a special function register
20161 called "EIND" that serves as most significant part of the target
20162 address when "EICALL" or "EIJMP" instructions are used.
20163
20164 Indirect jumps and calls on these devices are handled as follows by the
20165 compiler and are subject to some limitations:
20166
20167 * The compiler never sets "EIND".
20168
20169 * The compiler uses "EIND" implicitly in "EICALL"/"EIJMP"
20170 instructions or might read "EIND" directly in order to emulate an
20171 indirect call/jump by means of a "RET" instruction.
20172
20173 * The compiler assumes that "EIND" never changes during the startup
20174 code or during the application. In particular, "EIND" is not
20175 saved/restored in function or interrupt service routine
20176 prologue/epilogue.
20177
20178 * For indirect calls to functions and computed goto, the linker
20179 generates stubs. Stubs are jump pads sometimes also called
20180 trampolines. Thus, the indirect call/jump jumps to such a stub.
20181 The stub contains a direct jump to the desired address.
20182
20183 * Linker relaxation must be turned on so that the linker generates
20184 the stubs correctly in all situations. See the compiler option
20185 -mrelax and the linker option --relax. There are corner cases
20186 where the linker is supposed to generate stubs but aborts without
20187 relaxation and without a helpful error message.
20188
20189 * The default linker script is arranged for code with "EIND = 0". If
20190 code is supposed to work for a setup with "EIND != 0", a custom
20191 linker script has to be used in order to place the sections whose
20192 name start with ".trampolines" into the segment where "EIND" points
20193 to.
20194
20195 * The startup code from libgcc never sets "EIND". Notice that
20196 startup code is a blend of code from libgcc and AVR-LibC. For the
20197 impact of AVR-LibC on "EIND", see the AVR-LibC user manual
20198 ("https://www.nongnu.org/avr-libc/user-manual/").
20199
20200 * It is legitimate for user-specific startup code to set up "EIND"
20201 early, for example by means of initialization code located in
20202 section ".init3". Such code runs prior to general startup code that
20203 initializes RAM and calls constructors, but after the bit of
20204 startup code from AVR-LibC that sets "EIND" to the segment where
20205 the vector table is located.
20206
20207 #include <avr/io.h>
20208
20209 static void
20210 __attribute__((section(".init3"),naked,used,no_instrument_function))
20211 init3_set_eind (void)
20212 {
20213 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
20214 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
20215 }
20216
20217 The "__trampolines_start" symbol is defined in the linker script.
20218
20219 * Stubs are generated automatically by the linker if the following
20220 two conditions are met:
20221
20222 -<The address of a label is taken by means of the "gs" modifier>
20223 (short for generate stubs) like so:
20224
20225 LDI r24, lo8(gs(<func>))
20226 LDI r25, hi8(gs(<func>))
20227
20228 -<The final location of that label is in a code segment>
20229 outside the segment where the stubs are located.
20230
20231 * The compiler emits such "gs" modifiers for code labels in the
20232 following situations:
20233
20234 -<Taking address of a function or code label.>
20235 -<Computed goto.>
20236 -<If prologue-save function is used, see -mcall-prologues>
20237 command-line option.
20238
20239 -<Switch/case dispatch tables. If you do not want such dispatch>
20240 tables you can specify the -fno-jump-tables command-line
20241 option.
20242
20243 -<C and C++ constructors/destructors called during
20244 startup/shutdown.>
20245 -<If the tools hit a gs() modifier explained above.>
20246 * Jumping to non-symbolic addresses like so is not supported:
20247
20248 int main (void)
20249 {
20250 /* Call function at word address 0x2 */
20251 return ((int(*)(void)) 0x2)();
20252 }
20253
20254 Instead, a stub has to be set up, i.e. the function has to be
20255 called through a symbol ("func_4" in the example):
20256
20257 int main (void)
20258 {
20259 extern int func_4 (void);
20260
20261 /* Call function at byte address 0x4 */
20262 return func_4();
20263 }
20264
20265 and the application be linked with -Wl,--defsym,func_4=0x4.
20266 Alternatively, "func_4" can be defined in the linker script.
20267
20268 Handling of the "RAMPD", "RAMPX", "RAMPY" and "RAMPZ" Special Function
20269 Registers
20270
20271 Some AVR devices support memories larger than the 64 KiB range that can
20272 be accessed with 16-bit pointers. To access memory locations outside
20273 this 64 KiB range, the content of a "RAMP" register is used as high
20274 part of the address: The "X", "Y", "Z" address register is concatenated
20275 with the "RAMPX", "RAMPY", "RAMPZ" special function register,
20276 respectively, to get a wide address. Similarly, "RAMPD" is used
20277 together with direct addressing.
20278
20279 * The startup code initializes the "RAMP" special function registers
20280 with zero.
20281
20282 * If a AVR Named Address Spaces,named address space other than
20283 generic or "__flash" is used, then "RAMPZ" is set as needed before
20284 the operation.
20285
20286 * If the device supports RAM larger than 64 KiB and the compiler
20287 needs to change "RAMPZ" to accomplish an operation, "RAMPZ" is
20288 reset to zero after the operation.
20289
20290 * If the device comes with a specific "RAMP" register, the ISR
20291 prologue/epilogue saves/restores that SFR and initializes it with
20292 zero in case the ISR code might (implicitly) use it.
20293
20294 * RAM larger than 64 KiB is not supported by GCC for AVR targets. If
20295 you use inline assembler to read from locations outside the 16-bit
20296 address range and change one of the "RAMP" registers, you must
20297 reset it to zero after the access.
20298
20299 AVR Built-in Macros
20300
20301 GCC defines several built-in macros so that the user code can test for
20302 the presence or absence of features. Almost any of the following
20303 built-in macros are deduced from device capabilities and thus triggered
20304 by the -mmcu= command-line option.
20305
20306 For even more AVR-specific built-in macros see AVR Named Address Spaces
20307 and AVR Built-in Functions.
20308
20309 "__AVR_ARCH__"
20310 Build-in macro that resolves to a decimal number that identifies
20311 the architecture and depends on the -mmcu=mcu option. Possible
20312 values are:
20313
20314 2, 25, 3, 31, 35, 4, 5, 51, 6
20315
20316 for mcu="avr2", "avr25", "avr3", "avr31", "avr35", "avr4", "avr5",
20317 "avr51", "avr6",
20318
20319 respectively and
20320
20321 100, 102, 103, 104, 105, 106, 107
20322
20323 for mcu="avrtiny", "avrxmega2", "avrxmega3", "avrxmega4",
20324 "avrxmega5", "avrxmega6", "avrxmega7", respectively. If mcu
20325 specifies a device, this built-in macro is set accordingly. For
20326 example, with -mmcu=atmega8 the macro is defined to 4.
20327
20328 "__AVR_Device__"
20329 Setting -mmcu=device defines this built-in macro which reflects the
20330 device's name. For example, -mmcu=atmega8 defines the built-in
20331 macro "__AVR_ATmega8__", -mmcu=attiny261a defines
20332 "__AVR_ATtiny261A__", etc.
20333
20334 The built-in macros' names follow the scheme "__AVR_Device__" where
20335 Device is the device name as from the AVR user manual. The
20336 difference between Device in the built-in macro and device in
20337 -mmcu=device is that the latter is always lowercase.
20338
20339 If device is not a device but only a core architecture like avr51,
20340 this macro is not defined.
20341
20342 "__AVR_DEVICE_NAME__"
20343 Setting -mmcu=device defines this built-in macro to the device's
20344 name. For example, with -mmcu=atmega8 the macro is defined to
20345 "atmega8".
20346
20347 If device is not a device but only a core architecture like avr51,
20348 this macro is not defined.
20349
20350 "__AVR_XMEGA__"
20351 The device / architecture belongs to the XMEGA family of devices.
20352
20353 "__AVR_HAVE_ELPM__"
20354 The device has the "ELPM" instruction.
20355
20356 "__AVR_HAVE_ELPMX__"
20357 The device has the "ELPM Rn,Z" and "ELPM Rn,Z+" instructions.
20358
20359 "__AVR_HAVE_MOVW__"
20360 The device has the "MOVW" instruction to perform 16-bit register-
20361 register moves.
20362
20363 "__AVR_HAVE_LPMX__"
20364 The device has the "LPM Rn,Z" and "LPM Rn,Z+" instructions.
20365
20366 "__AVR_HAVE_MUL__"
20367 The device has a hardware multiplier.
20368
20369 "__AVR_HAVE_JMP_CALL__"
20370 The device has the "JMP" and "CALL" instructions. This is the case
20371 for devices with more than 8 KiB of program memory.
20372
20373 "__AVR_HAVE_EIJMP_EICALL__"
20374 "__AVR_3_BYTE_PC__"
20375 The device has the "EIJMP" and "EICALL" instructions. This is the
20376 case for devices with more than 128 KiB of program memory. This
20377 also means that the program counter (PC) is 3 bytes wide.
20378
20379 "__AVR_2_BYTE_PC__"
20380 The program counter (PC) is 2 bytes wide. This is the case for
20381 devices with up to 128 KiB of program memory.
20382
20383 "__AVR_HAVE_8BIT_SP__"
20384 "__AVR_HAVE_16BIT_SP__"
20385 The stack pointer (SP) register is treated as 8-bit respectively
20386 16-bit register by the compiler. The definition of these macros is
20387 affected by -mtiny-stack.
20388
20389 "__AVR_HAVE_SPH__"
20390 "__AVR_SP8__"
20391 The device has the SPH (high part of stack pointer) special
20392 function register or has an 8-bit stack pointer, respectively. The
20393 definition of these macros is affected by -mmcu= and in the cases
20394 of -mmcu=avr2 and -mmcu=avr25 also by -msp8.
20395
20396 "__AVR_HAVE_RAMPD__"
20397 "__AVR_HAVE_RAMPX__"
20398 "__AVR_HAVE_RAMPY__"
20399 "__AVR_HAVE_RAMPZ__"
20400 The device has the "RAMPD", "RAMPX", "RAMPY", "RAMPZ" special
20401 function register, respectively.
20402
20403 "__NO_INTERRUPTS__"
20404 This macro reflects the -mno-interrupts command-line option.
20405
20406 "__AVR_ERRATA_SKIP__"
20407 "__AVR_ERRATA_SKIP_JMP_CALL__"
20408 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
20409 instructions because of a hardware erratum. Skip instructions are
20410 "SBRS", "SBRC", "SBIS", "SBIC" and "CPSE". The second macro is
20411 only defined if "__AVR_HAVE_JMP_CALL__" is also set.
20412
20413 "__AVR_ISA_RMW__"
20414 The device has Read-Modify-Write instructions (XCH, LAC, LAS and
20415 LAT).
20416
20417 "__AVR_SFR_OFFSET__=offset"
20418 Instructions that can address I/O special function registers
20419 directly like "IN", "OUT", "SBI", etc. may use a different address
20420 as if addressed by an instruction to access RAM like "LD" or "STS".
20421 This offset depends on the device architecture and has to be
20422 subtracted from the RAM address in order to get the respective I/O
20423 address.
20424
20425 "__AVR_SHORT_CALLS__"
20426 The -mshort-calls command line option is set.
20427
20428 "__AVR_PM_BASE_ADDRESS__=addr"
20429 Some devices support reading from flash memory by means of "LD*"
20430 instructions. The flash memory is seen in the data address space
20431 at an offset of "__AVR_PM_BASE_ADDRESS__". If this macro is not
20432 defined, this feature is not available. If defined, the address
20433 space is linear and there is no need to put ".rodata" into RAM.
20434 This is handled by the default linker description file, and is
20435 currently available for "avrtiny" and "avrxmega3". Even more
20436 convenient, there is no need to use address spaces like "__flash"
20437 or features like attribute "progmem" and "pgm_read_*".
20438
20439 "__WITH_AVRLIBC__"
20440 The compiler is configured to be used together with AVR-Libc. See
20441 the --with-avrlibc configure option.
20442
20443 "__HAVE_DOUBLE_MULTILIB__"
20444 Defined if -mdouble= acts as a multilib option.
20445
20446 "__HAVE_DOUBLE32__"
20447 "__HAVE_DOUBLE64__"
20448 Defined if the compiler supports 32-bit double resp. 64-bit double.
20449 The actual layout is specified by option -mdouble=.
20450
20451 "__DEFAULT_DOUBLE__"
20452 The size in bits of "double" if -mdouble= is not set. To test the
20453 layout of "double" in a program, use the built-in macro
20454 "__SIZEOF_DOUBLE__".
20455
20456 "__HAVE_LONG_DOUBLE32__"
20457 "__HAVE_LONG_DOUBLE64__"
20458 "__HAVE_LONG_DOUBLE_MULTILIB__"
20459 "__DEFAULT_LONG_DOUBLE__"
20460 Same as above, but for "long double" instead of "double".
20461
20462 "__WITH_DOUBLE_COMPARISON__"
20463 Reflects the "--with-double-comparison={tristate|bool|libf7}"
20464 configure option ("https://gcc.gnu.org/install/configure.html#avr")
20465 and is defined to 2 or 3.
20466
20467 "__WITH_LIBF7_LIBGCC__"
20468 "__WITH_LIBF7_MATH__"
20469 "__WITH_LIBF7_MATH_SYMBOLS__"
20470 Reflects the "--with-libf7={libgcc|math|math-symbols}"
20471 configure option
20472 ("https://gcc.gnu.org/install/configure.html#avr").
20473
20474 Blackfin Options
20475 -mcpu=cpu[-sirevision]
20476 Specifies the name of the target Blackfin processor. Currently,
20477 cpu can be one of bf512, bf514, bf516, bf518, bf522, bf523, bf524,
20478 bf525, bf526, bf527, bf531, bf532, bf533, bf534, bf536, bf537,
20479 bf538, bf539, bf542, bf544, bf547, bf548, bf549, bf542m, bf544m,
20480 bf547m, bf548m, bf549m, bf561, bf592.
20481
20482 The optional sirevision specifies the silicon revision of the
20483 target Blackfin processor. Any workarounds available for the
20484 targeted silicon revision are enabled. If sirevision is none, no
20485 workarounds are enabled. If sirevision is any, all workarounds for
20486 the targeted processor are enabled. The "__SILICON_REVISION__"
20487 macro is defined to two hexadecimal digits representing the major
20488 and minor numbers in the silicon revision. If sirevision is none,
20489 the "__SILICON_REVISION__" is not defined. If sirevision is any,
20490 the "__SILICON_REVISION__" is defined to be 0xffff. If this
20491 optional sirevision is not used, GCC assumes the latest known
20492 silicon revision of the targeted Blackfin processor.
20493
20494 GCC defines a preprocessor macro for the specified cpu. For the
20495 bfin-elf toolchain, this option causes the hardware BSP provided by
20496 libgloss to be linked in if -msim is not given.
20497
20498 Without this option, bf532 is used as the processor by default.
20499
20500 Note that support for bf561 is incomplete. For bf561, only the
20501 preprocessor macro is defined.
20502
20503 -msim
20504 Specifies that the program will be run on the simulator. This
20505 causes the simulator BSP provided by libgloss to be linked in.
20506 This option has effect only for bfin-elf toolchain. Certain other
20507 options, such as -mid-shared-library and -mfdpic, imply -msim.
20508
20509 -momit-leaf-frame-pointer
20510 Don't keep the frame pointer in a register for leaf functions.
20511 This avoids the instructions to save, set up and restore frame
20512 pointers and makes an extra register available in leaf functions.
20513
20514 -mspecld-anomaly
20515 When enabled, the compiler ensures that the generated code does not
20516 contain speculative loads after jump instructions. If this option
20517 is used, "__WORKAROUND_SPECULATIVE_LOADS" is defined.
20518
20519 -mno-specld-anomaly
20520 Don't generate extra code to prevent speculative loads from
20521 occurring.
20522
20523 -mcsync-anomaly
20524 When enabled, the compiler ensures that the generated code does not
20525 contain CSYNC or SSYNC instructions too soon after conditional
20526 branches. If this option is used, "__WORKAROUND_SPECULATIVE_SYNCS"
20527 is defined.
20528
20529 -mno-csync-anomaly
20530 Don't generate extra code to prevent CSYNC or SSYNC instructions
20531 from occurring too soon after a conditional branch.
20532
20533 -mlow64k
20534 When enabled, the compiler is free to take advantage of the
20535 knowledge that the entire program fits into the low 64k of memory.
20536
20537 -mno-low64k
20538 Assume that the program is arbitrarily large. This is the default.
20539
20540 -mstack-check-l1
20541 Do stack checking using information placed into L1 scratchpad
20542 memory by the uClinux kernel.
20543
20544 -mid-shared-library
20545 Generate code that supports shared libraries via the library ID
20546 method. This allows for execute in place and shared libraries in
20547 an environment without virtual memory management. This option
20548 implies -fPIC. With a bfin-elf target, this option implies -msim.
20549
20550 -mno-id-shared-library
20551 Generate code that doesn't assume ID-based shared libraries are
20552 being used. This is the default.
20553
20554 -mleaf-id-shared-library
20555 Generate code that supports shared libraries via the library ID
20556 method, but assumes that this library or executable won't link
20557 against any other ID shared libraries. That allows the compiler to
20558 use faster code for jumps and calls.
20559
20560 -mno-leaf-id-shared-library
20561 Do not assume that the code being compiled won't link against any
20562 ID shared libraries. Slower code is generated for jump and call
20563 insns.
20564
20565 -mshared-library-id=n
20566 Specifies the identification number of the ID-based shared library
20567 being compiled. Specifying a value of 0 generates more compact
20568 code; specifying other values forces the allocation of that number
20569 to the current library but is no more space- or time-efficient than
20570 omitting this option.
20571
20572 -msep-data
20573 Generate code that allows the data segment to be located in a
20574 different area of memory from the text segment. This allows for
20575 execute in place in an environment without virtual memory
20576 management by eliminating relocations against the text section.
20577
20578 -mno-sep-data
20579 Generate code that assumes that the data segment follows the text
20580 segment. This is the default.
20581
20582 -mlong-calls
20583 -mno-long-calls
20584 Tells the compiler to perform function calls by first loading the
20585 address of the function into a register and then performing a
20586 subroutine call on this register. This switch is needed if the
20587 target function lies outside of the 24-bit addressing range of the
20588 offset-based version of subroutine call instruction.
20589
20590 This feature is not enabled by default. Specifying -mno-long-calls
20591 restores the default behavior. Note these switches have no effect
20592 on how the compiler generates code to handle function calls via
20593 function pointers.
20594
20595 -mfast-fp
20596 Link with the fast floating-point library. This library relaxes
20597 some of the IEEE floating-point standard's rules for checking
20598 inputs against Not-a-Number (NAN), in the interest of performance.
20599
20600 -minline-plt
20601 Enable inlining of PLT entries in function calls to functions that
20602 are not known to bind locally. It has no effect without -mfdpic.
20603
20604 -mmulticore
20605 Build a standalone application for multicore Blackfin processors.
20606 This option causes proper start files and link scripts supporting
20607 multicore to be used, and defines the macro "__BFIN_MULTICORE". It
20608 can only be used with -mcpu=bf561[-sirevision].
20609
20610 This option can be used with -mcorea or -mcoreb, which selects the
20611 one-application-per-core programming model. Without -mcorea or
20612 -mcoreb, the single-application/dual-core programming model is
20613 used. In this model, the main function of Core B should be named as
20614 "coreb_main".
20615
20616 If this option is not used, the single-core application programming
20617 model is used.
20618
20619 -mcorea
20620 Build a standalone application for Core A of BF561 when using the
20621 one-application-per-core programming model. Proper start files and
20622 link scripts are used to support Core A, and the macro
20623 "__BFIN_COREA" is defined. This option can only be used in
20624 conjunction with -mmulticore.
20625
20626 -mcoreb
20627 Build a standalone application for Core B of BF561 when using the
20628 one-application-per-core programming model. Proper start files and
20629 link scripts are used to support Core B, and the macro
20630 "__BFIN_COREB" is defined. When this option is used, "coreb_main"
20631 should be used instead of "main". This option can only be used in
20632 conjunction with -mmulticore.
20633
20634 -msdram
20635 Build a standalone application for SDRAM. Proper start files and
20636 link scripts are used to put the application into SDRAM, and the
20637 macro "__BFIN_SDRAM" is defined. The loader should initialize
20638 SDRAM before loading the application.
20639
20640 -micplb
20641 Assume that ICPLBs are enabled at run time. This has an effect on
20642 certain anomaly workarounds. For Linux targets, the default is to
20643 assume ICPLBs are enabled; for standalone applications the default
20644 is off.
20645
20646 C6X Options
20647 -march=name
20648 This specifies the name of the target architecture. GCC uses this
20649 name to determine what kind of instructions it can emit when
20650 generating assembly code. Permissible names are: c62x, c64x,
20651 c64x+, c67x, c67x+, c674x.
20652
20653 -mbig-endian
20654 Generate code for a big-endian target.
20655
20656 -mlittle-endian
20657 Generate code for a little-endian target. This is the default.
20658
20659 -msim
20660 Choose startup files and linker script suitable for the simulator.
20661
20662 -msdata=default
20663 Put small global and static data in the ".neardata" section, which
20664 is pointed to by register "B14". Put small uninitialized global
20665 and static data in the ".bss" section, which is adjacent to the
20666 ".neardata" section. Put small read-only data into the ".rodata"
20667 section. The corresponding sections used for large pieces of data
20668 are ".fardata", ".far" and ".const".
20669
20670 -msdata=all
20671 Put all data, not just small objects, into the sections reserved
20672 for small data, and use addressing relative to the "B14" register
20673 to access them.
20674
20675 -msdata=none
20676 Make no use of the sections reserved for small data, and use
20677 absolute addresses to access all data. Put all initialized global
20678 and static data in the ".fardata" section, and all uninitialized
20679 data in the ".far" section. Put all constant data into the
20680 ".const" section.
20681
20682 CRIS Options
20683 These options are defined specifically for the CRIS ports.
20684
20685 -march=architecture-type
20686 -mcpu=architecture-type
20687 Generate code for the specified architecture. The choices for
20688 architecture-type are v3, v8 and v10 for respectively ETRAX 4,
20689 ETRAX 100, and ETRAX 100 LX. Default is v0.
20690
20691 -mtune=architecture-type
20692 Tune to architecture-type everything applicable about the generated
20693 code, except for the ABI and the set of available instructions.
20694 The choices for architecture-type are the same as for
20695 -march=architecture-type.
20696
20697 -mmax-stack-frame=n
20698 Warn when the stack frame of a function exceeds n bytes.
20699
20700 -metrax4
20701 -metrax100
20702 The options -metrax4 and -metrax100 are synonyms for -march=v3 and
20703 -march=v8 respectively.
20704
20705 -mmul-bug-workaround
20706 -mno-mul-bug-workaround
20707 Work around a bug in the "muls" and "mulu" instructions for CPU
20708 models where it applies. This option is disabled by default.
20709
20710 -mpdebug
20711 Enable CRIS-specific verbose debug-related information in the
20712 assembly code. This option also has the effect of turning off the
20713 #NO_APP formatted-code indicator to the assembler at the beginning
20714 of the assembly file.
20715
20716 -mcc-init
20717 Do not use condition-code results from previous instruction; always
20718 emit compare and test instructions before use of condition codes.
20719
20720 -mno-side-effects
20721 Do not emit instructions with side effects in addressing modes
20722 other than post-increment.
20723
20724 -mstack-align
20725 -mno-stack-align
20726 -mdata-align
20727 -mno-data-align
20728 -mconst-align
20729 -mno-const-align
20730 These options (no- options) arrange (eliminate arrangements) for
20731 the stack frame, individual data and constants to be aligned for
20732 the maximum single data access size for the chosen CPU model. The
20733 default is to arrange for 32-bit alignment. ABI details such as
20734 structure layout are not affected by these options.
20735
20736 -m32-bit
20737 -m16-bit
20738 -m8-bit
20739 Similar to the stack- data- and const-align options above, these
20740 options arrange for stack frame, writable data and constants to all
20741 be 32-bit, 16-bit or 8-bit aligned. The default is 32-bit
20742 alignment.
20743
20744 -mno-prologue-epilogue
20745 -mprologue-epilogue
20746 With -mno-prologue-epilogue, the normal function prologue and
20747 epilogue which set up the stack frame are omitted and no return
20748 instructions or return sequences are generated in the code. Use
20749 this option only together with visual inspection of the compiled
20750 code: no warnings or errors are generated when call-saved registers
20751 must be saved, or storage for local variables needs to be
20752 allocated.
20753
20754 -melf
20755 Legacy no-op option.
20756
20757 -sim
20758 This option arranges to link with input-output functions from a
20759 simulator library. Code, initialized data and zero-initialized
20760 data are allocated consecutively.
20761
20762 -sim2
20763 Like -sim, but pass linker options to locate initialized data at
20764 0x40000000 and zero-initialized data at 0x80000000.
20765
20766 C-SKY Options
20767 GCC supports these options when compiling for C-SKY V2 processors.
20768
20769 -march=arch
20770 Specify the C-SKY target architecture. Valid values for arch are:
20771 ck801, ck802, ck803, ck807, and ck810. The default is ck810.
20772
20773 -mcpu=cpu
20774 Specify the C-SKY target processor. Valid values for cpu are:
20775 ck801, ck801t, ck802, ck802t, ck802j, ck803, ck803h, ck803t,
20776 ck803ht, ck803f, ck803fh, ck803e, ck803eh, ck803et, ck803eht,
20777 ck803ef, ck803efh, ck803ft, ck803eft, ck803efht, ck803r1, ck803hr1,
20778 ck803tr1, ck803htr1, ck803fr1, ck803fhr1, ck803er1, ck803ehr1,
20779 ck803etr1, ck803ehtr1, ck803efr1, ck803efhr1, ck803ftr1,
20780 ck803eftr1, ck803efhtr1, ck803s, ck803st, ck803se, ck803sf,
20781 ck803sef, ck803seft, ck807e, ck807ef, ck807, ck807f, ck810e,
20782 ck810et, ck810ef, ck810eft, ck810, ck810v, ck810f, ck810t, ck810fv,
20783 ck810tv, ck810ft, and ck810ftv.
20784
20785 -mbig-endian
20786 -EB
20787 -mlittle-endian
20788 -EL Select big- or little-endian code. The default is little-endian.
20789
20790 -mfloat-abi=name
20791 Specifies which floating-point ABI to use. Permissible values are:
20792 soft, softfp and hard.
20793
20794 Specifying soft causes GCC to generate output containing library
20795 calls for floating-point operations. softfp allows the generation
20796 of code using hardware floating-point instructions, but still uses
20797 the soft-float calling conventions. hard allows generation of
20798 floating-point instructions and uses FPU-specific calling
20799 conventions.
20800
20801 The default depends on the specific target configuration. Note
20802 that the hard-float and soft-float ABIs are not link-compatible;
20803 you must compile your entire program with the same ABI, and link
20804 with a compatible set of libraries.
20805
20806 -mhard-float
20807 -msoft-float
20808 Select hardware or software floating-point implementations. The
20809 default is soft float.
20810
20811 -mdouble-float
20812 -mno-double-float
20813 When -mhard-float is in effect, enable generation of double-
20814 precision float instructions. This is the default except when
20815 compiling for CK803.
20816
20817 -mfdivdu
20818 -mno-fdivdu
20819 When -mhard-float is in effect, enable generation of "frecipd",
20820 "fsqrtd", and "fdivd" instructions. This is the default except
20821 when compiling for CK803.
20822
20823 -mfpu=fpu
20824 Select the floating-point processor. This option can only be used
20825 with -mhard-float. Values for fpu are fpv2_sf (equivalent to
20826 -mno-double-float -mno-fdivdu), fpv2 (-mdouble-float -mno-divdu),
20827 and fpv2_divd (-mdouble-float -mdivdu).
20828
20829 -melrw
20830 -mno-elrw
20831 Enable the extended "lrw" instruction. This option defaults to on
20832 for CK801 and off otherwise.
20833
20834 -mistack
20835 -mno-istack
20836 Enable interrupt stack instructions; the default is off.
20837
20838 The -mistack option is required to handle the "interrupt" and "isr"
20839 function attributes.
20840
20841 -mmp
20842 Enable multiprocessor instructions; the default is off.
20843
20844 -mcp
20845 Enable coprocessor instructions; the default is off.
20846
20847 -mcache
20848 Enable coprocessor instructions; the default is off.
20849
20850 -msecurity
20851 Enable C-SKY security instructions; the default is off.
20852
20853 -mtrust
20854 Enable C-SKY trust instructions; the default is off.
20855
20856 -mdsp
20857 -medsp
20858 -mvdsp
20859 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions,
20860 respectively. All of these options default to off.
20861
20862 -mdiv
20863 -mno-div
20864 Generate divide instructions. Default is off.
20865
20866 -msmart
20867 -mno-smart
20868 Generate code for Smart Mode, using only registers numbered 0-7 to
20869 allow use of 16-bit instructions. This option is ignored for CK801
20870 where this is the required behavior, and it defaults to on for
20871 CK802. For other targets, the default is off.
20872
20873 -mhigh-registers
20874 -mno-high-registers
20875 Generate code using the high registers numbered 16-31. This option
20876 is not supported on CK801, CK802, or CK803, and is enabled by
20877 default for other processors.
20878
20879 -manchor
20880 -mno-anchor
20881 Generate code using global anchor symbol addresses.
20882
20883 -mpushpop
20884 -mno-pushpop
20885 Generate code using "push" and "pop" instructions. This option
20886 defaults to on.
20887
20888 -mmultiple-stld
20889 -mstm
20890 -mno-multiple-stld
20891 -mno-stm
20892 Generate code using "stm" and "ldm" instructions. This option
20893 isn't supported on CK801 but is enabled by default on other
20894 processors.
20895
20896 -mconstpool
20897 -mno-constpool
20898 Create constant pools in the compiler instead of deferring it to
20899 the assembler. This option is the default and required for correct
20900 code generation on CK801 and CK802, and is optional on other
20901 processors.
20902
20903 -mstack-size
20904 -mno-stack-size
20905 Emit ".stack_size" directives for each function in the assembly
20906 output. This option defaults to off.
20907
20908 -mccrt
20909 -mno-ccrt
20910 Generate code for the C-SKY compiler runtime instead of libgcc.
20911 This option defaults to off.
20912
20913 -mbranch-cost=n
20914 Set the branch costs to roughly "n" instructions. The default is
20915 1.
20916
20917 -msched-prolog
20918 -mno-sched-prolog
20919 Permit scheduling of function prologue and epilogue sequences.
20920 Using this option can result in code that is not compliant with the
20921 C-SKY V2 ABI prologue requirements and that cannot be debugged or
20922 backtraced. It is disabled by default.
20923
20924 -msim
20925 Links the library libsemi.a which is in compatible with simulator.
20926 Applicable to ELF compiler only.
20927
20928 Darwin Options
20929 These options are defined for all architectures running the Darwin
20930 operating system.
20931
20932 FSF GCC on Darwin does not create "fat" object files; it creates an
20933 object file for the single architecture that GCC was built to target.
20934 Apple's GCC on Darwin does create "fat" files if multiple -arch options
20935 are used; it does so by running the compiler or linker multiple times
20936 and joining the results together with lipo.
20937
20938 The subtype of the file created (like ppc7400 or ppc970 or i686) is
20939 determined by the flags that specify the ISA that GCC is targeting,
20940 like -mcpu or -march. The -force_cpusubtype_ALL option can be used to
20941 override this.
20942
20943 The Darwin tools vary in their behavior when presented with an ISA
20944 mismatch. The assembler, as, only permits instructions to be used that
20945 are valid for the subtype of the file it is generating, so you cannot
20946 put 64-bit instructions in a ppc750 object file. The linker for shared
20947 libraries, /usr/bin/libtool, fails and prints an error if asked to
20948 create a shared library with a less restrictive subtype than its input
20949 files (for instance, trying to put a ppc970 object file in a ppc7400
20950 library). The linker for executables, ld, quietly gives the executable
20951 the most restrictive subtype of any of its input files.
20952
20953 -Fdir
20954 Add the framework directory dir to the head of the list of
20955 directories to be searched for header files. These directories are
20956 interleaved with those specified by -I options and are scanned in a
20957 left-to-right order.
20958
20959 A framework directory is a directory with frameworks in it. A
20960 framework is a directory with a Headers and/or PrivateHeaders
20961 directory contained directly in it that ends in .framework. The
20962 name of a framework is the name of this directory excluding the
20963 .framework. Headers associated with the framework are found in one
20964 of those two directories, with Headers being searched first. A
20965 subframework is a framework directory that is in a framework's
20966 Frameworks directory. Includes of subframework headers can only
20967 appear in a header of a framework that contains the subframework,
20968 or in a sibling subframework header. Two subframeworks are
20969 siblings if they occur in the same framework. A subframework
20970 should not have the same name as a framework; a warning is issued
20971 if this is violated. Currently a subframework cannot have
20972 subframeworks; in the future, the mechanism may be extended to
20973 support this. The standard frameworks can be found in
20974 /System/Library/Frameworks and /Library/Frameworks. An example
20975 include looks like "#include <Framework/header.h>", where Framework
20976 denotes the name of the framework and header.h is found in the
20977 PrivateHeaders or Headers directory.
20978
20979 -iframeworkdir
20980 Like -F except the directory is a treated as a system directory.
20981 The main difference between this -iframework and -F is that with
20982 -iframework the compiler does not warn about constructs contained
20983 within header files found via dir. This option is valid only for
20984 the C family of languages.
20985
20986 -gused
20987 Emit debugging information for symbols that are used. For stabs
20988 debugging format, this enables -feliminate-unused-debug-symbols.
20989 This is by default ON.
20990
20991 -gfull
20992 Emit debugging information for all symbols and types.
20993
20994 -fconstant-cfstrings
20995 The -fconstant-cfstrings is an alias for -mconstant-cfstrings.
20996
20997 -mconstant-cfstrings
20998 When the NeXT runtime is being used (the default on these systems),
20999 override any -fconstant-string-class setting and cause "@"...""
21000 literals to be laid out as constant CoreFoundation strings.
21001
21002 -mmacosx-version-min=version
21003 The earliest version of MacOS X that this executable will run on is
21004 version. Typical values supported for version include 12, 10.12,
21005 and 10.5.8.
21006
21007 If the compiler was built to use the system's headers by default,
21008 then the default for this option is the system version on which the
21009 compiler is running, otherwise the default is to make choices that
21010 are compatible with as many systems and code bases as possible.
21011
21012 -mkernel
21013 Enable kernel development mode. The -mkernel option sets -static,
21014 -fno-common, -fno-use-cxa-atexit, -fno-exceptions,
21015 -fno-non-call-exceptions, -fapple-kext, -fno-weak and -fno-rtti
21016 where applicable. This mode also sets -mno-altivec, -msoft-float,
21017 -fno-builtin and -mlong-branch for PowerPC targets.
21018
21019 -mone-byte-bool
21020 Override the defaults for "bool" so that "sizeof(bool)==1". By
21021 default sizeof(bool) is 4 when compiling for Darwin/PowerPC and 1
21022 when compiling for Darwin/x86, so this option has no effect on x86.
21023
21024 Warning: The -mone-byte-bool switch causes GCC to generate code
21025 that is not binary compatible with code generated without that
21026 switch. Using this switch may require recompiling all other
21027 modules in a program, including system libraries. Use this switch
21028 to conform to a non-default data model.
21029
21030 -mfix-and-continue
21031 -ffix-and-continue
21032 -findirect-data
21033 Generate code suitable for fast turnaround development, such as to
21034 allow GDB to dynamically load .o files into already-running
21035 programs. -findirect-data and -ffix-and-continue are provided for
21036 backwards compatibility.
21037
21038 -all_load
21039 Loads all members of static archive libraries. See man ld(1) for
21040 more information.
21041
21042 -arch_errors_fatal
21043 Cause the errors having to do with files that have the wrong
21044 architecture to be fatal.
21045
21046 -bind_at_load
21047 Causes the output file to be marked such that the dynamic linker
21048 will bind all undefined references when the file is loaded or
21049 launched.
21050
21051 -bundle
21052 Produce a Mach-o bundle format file. See man ld(1) for more
21053 information.
21054
21055 -bundle_loader executable
21056 This option specifies the executable that will load the build
21057 output file being linked. See man ld(1) for more information.
21058
21059 -dynamiclib
21060 When passed this option, GCC produces a dynamic library instead of
21061 an executable when linking, using the Darwin libtool command.
21062
21063 -force_cpusubtype_ALL
21064 This causes GCC's output file to have the ALL subtype, instead of
21065 one controlled by the -mcpu or -march option.
21066
21067 -allowable_client client_name
21068 -client_name
21069 -compatibility_version
21070 -current_version
21071 -dead_strip
21072 -dependency-file
21073 -dylib_file
21074 -dylinker_install_name
21075 -dynamic
21076 -exported_symbols_list
21077 -filelist
21078 -flat_namespace
21079 -force_flat_namespace
21080 -headerpad_max_install_names
21081 -image_base
21082 -init
21083 -install_name
21084 -keep_private_externs
21085 -multi_module
21086 -multiply_defined
21087 -multiply_defined_unused
21088 -noall_load
21089 -no_dead_strip_inits_and_terms
21090 -nofixprebinding
21091 -nomultidefs
21092 -noprebind
21093 -noseglinkedit
21094 -pagezero_size
21095 -prebind
21096 -prebind_all_twolevel_modules
21097 -private_bundle
21098 -read_only_relocs
21099 -sectalign
21100 -sectobjectsymbols
21101 -whyload
21102 -seg1addr
21103 -sectcreate
21104 -sectobjectsymbols
21105 -sectorder
21106 -segaddr
21107 -segs_read_only_addr
21108 -segs_read_write_addr
21109 -seg_addr_table
21110 -seg_addr_table_filename
21111 -seglinkedit
21112 -segprot
21113 -segs_read_only_addr
21114 -segs_read_write_addr
21115 -single_module
21116 -static
21117 -sub_library
21118 -sub_umbrella
21119 -twolevel_namespace
21120 -umbrella
21121 -undefined
21122 -unexported_symbols_list
21123 -weak_reference_mismatches
21124 -whatsloaded
21125 These options are passed to the Darwin linker. The Darwin linker
21126 man page describes them in detail.
21127
21128 DEC Alpha Options
21129 These -m options are defined for the DEC Alpha implementations:
21130
21131 -mno-soft-float
21132 -msoft-float
21133 Use (do not use) the hardware floating-point instructions for
21134 floating-point operations. When -msoft-float is specified,
21135 functions in libgcc.a are used to perform floating-point
21136 operations. Unless they are replaced by routines that emulate the
21137 floating-point operations, or compiled in such a way as to call
21138 such emulations routines, these routines issue floating-point
21139 operations. If you are compiling for an Alpha without floating-
21140 point operations, you must ensure that the library is built so as
21141 not to call them.
21142
21143 Note that Alpha implementations without floating-point operations
21144 are required to have floating-point registers.
21145
21146 -mfp-reg
21147 -mno-fp-regs
21148 Generate code that uses (does not use) the floating-point register
21149 set. -mno-fp-regs implies -msoft-float. If the floating-point
21150 register set is not used, floating-point operands are passed in
21151 integer registers as if they were integers and floating-point
21152 results are passed in $0 instead of $f0. This is a non-standard
21153 calling sequence, so any function with a floating-point argument or
21154 return value called by code compiled with -mno-fp-regs must also be
21155 compiled with that option.
21156
21157 A typical use of this option is building a kernel that does not
21158 use, and hence need not save and restore, any floating-point
21159 registers.
21160
21161 -mieee
21162 The Alpha architecture implements floating-point hardware optimized
21163 for maximum performance. It is mostly compliant with the IEEE
21164 floating-point standard. However, for full compliance, software
21165 assistance is required. This option generates code fully IEEE-
21166 compliant code except that the inexact-flag is not maintained (see
21167 below). If this option is turned on, the preprocessor macro
21168 "_IEEE_FP" is defined during compilation. The resulting code is
21169 less efficient but is able to correctly support denormalized
21170 numbers and exceptional IEEE values such as not-a-number and
21171 plus/minus infinity. Other Alpha compilers call this option
21172 -ieee_with_no_inexact.
21173
21174 -mieee-with-inexact
21175 This is like -mieee except the generated code also maintains the
21176 IEEE inexact-flag. Turning on this option causes the generated
21177 code to implement fully-compliant IEEE math. In addition to
21178 "_IEEE_FP", "_IEEE_FP_EXACT" is defined as a preprocessor macro.
21179 On some Alpha implementations the resulting code may execute
21180 significantly slower than the code generated by default. Since
21181 there is very little code that depends on the inexact-flag, you
21182 should normally not specify this option. Other Alpha compilers
21183 call this option -ieee_with_inexact.
21184
21185 -mfp-trap-mode=trap-mode
21186 This option controls what floating-point related traps are enabled.
21187 Other Alpha compilers call this option -fptm trap-mode. The trap
21188 mode can be set to one of four values:
21189
21190 n This is the default (normal) setting. The only traps that are
21191 enabled are the ones that cannot be disabled in software (e.g.,
21192 division by zero trap).
21193
21194 u In addition to the traps enabled by n, underflow traps are
21195 enabled as well.
21196
21197 su Like u, but the instructions are marked to be safe for software
21198 completion (see Alpha architecture manual for details).
21199
21200 sui Like su, but inexact traps are enabled as well.
21201
21202 -mfp-rounding-mode=rounding-mode
21203 Selects the IEEE rounding mode. Other Alpha compilers call this
21204 option -fprm rounding-mode. The rounding-mode can be one of:
21205
21206 n Normal IEEE rounding mode. Floating-point numbers are rounded
21207 towards the nearest machine number or towards the even machine
21208 number in case of a tie.
21209
21210 m Round towards minus infinity.
21211
21212 c Chopped rounding mode. Floating-point numbers are rounded
21213 towards zero.
21214
21215 d Dynamic rounding mode. A field in the floating-point control
21216 register (fpcr, see Alpha architecture reference manual)
21217 controls the rounding mode in effect. The C library
21218 initializes this register for rounding towards plus infinity.
21219 Thus, unless your program modifies the fpcr, d corresponds to
21220 round towards plus infinity.
21221
21222 -mtrap-precision=trap-precision
21223 In the Alpha architecture, floating-point traps are imprecise.
21224 This means without software assistance it is impossible to recover
21225 from a floating trap and program execution normally needs to be
21226 terminated. GCC can generate code that can assist operating system
21227 trap handlers in determining the exact location that caused a
21228 floating-point trap. Depending on the requirements of an
21229 application, different levels of precisions can be selected:
21230
21231 p Program precision. This option is the default and means a trap
21232 handler can only identify which program caused a floating-point
21233 exception.
21234
21235 f Function precision. The trap handler can determine the
21236 function that caused a floating-point exception.
21237
21238 i Instruction precision. The trap handler can determine the
21239 exact instruction that caused a floating-point exception.
21240
21241 Other Alpha compilers provide the equivalent options called
21242 -scope_safe and -resumption_safe.
21243
21244 -mieee-conformant
21245 This option marks the generated code as IEEE conformant. You must
21246 not use this option unless you also specify -mtrap-precision=i and
21247 either -mfp-trap-mode=su or -mfp-trap-mode=sui. Its only effect is
21248 to emit the line .eflag 48 in the function prologue of the
21249 generated assembly file.
21250
21251 -mbuild-constants
21252 Normally GCC examines a 32- or 64-bit integer constant to see if it
21253 can construct it from smaller constants in two or three
21254 instructions. If it cannot, it outputs the constant as a literal
21255 and generates code to load it from the data segment at run time.
21256
21257 Use this option to require GCC to construct all integer constants
21258 using code, even if it takes more instructions (the maximum is
21259 six).
21260
21261 You typically use this option to build a shared library dynamic
21262 loader. Itself a shared library, it must relocate itself in memory
21263 before it can find the variables and constants in its own data
21264 segment.
21265
21266 -mbwx
21267 -mno-bwx
21268 -mcix
21269 -mno-cix
21270 -mfix
21271 -mno-fix
21272 -mmax
21273 -mno-max
21274 Indicate whether GCC should generate code to use the optional BWX,
21275 CIX, FIX and MAX instruction sets. The default is to use the
21276 instruction sets supported by the CPU type specified via -mcpu=
21277 option or that of the CPU on which GCC was built if none is
21278 specified.
21279
21280 -mfloat-vax
21281 -mfloat-ieee
21282 Generate code that uses (does not use) VAX F and G floating-point
21283 arithmetic instead of IEEE single and double precision.
21284
21285 -mexplicit-relocs
21286 -mno-explicit-relocs
21287 Older Alpha assemblers provided no way to generate symbol
21288 relocations except via assembler macros. Use of these macros does
21289 not allow optimal instruction scheduling. GNU binutils as of
21290 version 2.12 supports a new syntax that allows the compiler to
21291 explicitly mark which relocations should apply to which
21292 instructions. This option is mostly useful for debugging, as GCC
21293 detects the capabilities of the assembler when it is built and sets
21294 the default accordingly.
21295
21296 -msmall-data
21297 -mlarge-data
21298 When -mexplicit-relocs is in effect, static data is accessed via
21299 gp-relative relocations. When -msmall-data is used, objects 8
21300 bytes long or smaller are placed in a small data area (the ".sdata"
21301 and ".sbss" sections) and are accessed via 16-bit relocations off
21302 of the $gp register. This limits the size of the small data area
21303 to 64KB, but allows the variables to be directly accessed via a
21304 single instruction.
21305
21306 The default is -mlarge-data. With this option the data area is
21307 limited to just below 2GB. Programs that require more than 2GB of
21308 data must use "malloc" or "mmap" to allocate the data in the heap
21309 instead of in the program's data segment.
21310
21311 When generating code for shared libraries, -fpic implies
21312 -msmall-data and -fPIC implies -mlarge-data.
21313
21314 -msmall-text
21315 -mlarge-text
21316 When -msmall-text is used, the compiler assumes that the code of
21317 the entire program (or shared library) fits in 4MB, and is thus
21318 reachable with a branch instruction. When -msmall-data is used,
21319 the compiler can assume that all local symbols share the same $gp
21320 value, and thus reduce the number of instructions required for a
21321 function call from 4 to 1.
21322
21323 The default is -mlarge-text.
21324
21325 -mcpu=cpu_type
21326 Set the instruction set and instruction scheduling parameters for
21327 machine type cpu_type. You can specify either the EV style name or
21328 the corresponding chip number. GCC supports scheduling parameters
21329 for the EV4, EV5 and EV6 family of processors and chooses the
21330 default values for the instruction set from the processor you
21331 specify. If you do not specify a processor type, GCC defaults to
21332 the processor on which the compiler was built.
21333
21334 Supported values for cpu_type are
21335
21336 ev4
21337 ev45
21338 21064
21339 Schedules as an EV4 and has no instruction set extensions.
21340
21341 ev5
21342 21164
21343 Schedules as an EV5 and has no instruction set extensions.
21344
21345 ev56
21346 21164a
21347 Schedules as an EV5 and supports the BWX extension.
21348
21349 pca56
21350 21164pc
21351 21164PC
21352 Schedules as an EV5 and supports the BWX and MAX extensions.
21353
21354 ev6
21355 21264
21356 Schedules as an EV6 and supports the BWX, FIX, and MAX
21357 extensions.
21358
21359 ev67
21360 21264a
21361 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX
21362 extensions.
21363
21364 Native toolchains also support the value native, which selects the
21365 best architecture option for the host processor. -mcpu=native has
21366 no effect if GCC does not recognize the processor.
21367
21368 -mtune=cpu_type
21369 Set only the instruction scheduling parameters for machine type
21370 cpu_type. The instruction set is not changed.
21371
21372 Native toolchains also support the value native, which selects the
21373 best architecture option for the host processor. -mtune=native has
21374 no effect if GCC does not recognize the processor.
21375
21376 -mmemory-latency=time
21377 Sets the latency the scheduler should assume for typical memory
21378 references as seen by the application. This number is highly
21379 dependent on the memory access patterns used by the application and
21380 the size of the external cache on the machine.
21381
21382 Valid options for time are
21383
21384 number
21385 A decimal number representing clock cycles.
21386
21387 L1
21388 L2
21389 L3
21390 main
21391 The compiler contains estimates of the number of clock cycles
21392 for "typical" EV4 & EV5 hardware for the Level 1, 2 & 3 caches
21393 (also called Dcache, Scache, and Bcache), as well as to main
21394 memory. Note that L3 is only valid for EV5.
21395
21396 eBPF Options
21397 -mframe-limit=bytes
21398 This specifies the hard limit for frame sizes, in bytes.
21399 Currently, the value that can be specified should be less than or
21400 equal to 32767. Defaults to whatever limit is imposed by the
21401 version of the Linux kernel targeted.
21402
21403 -mkernel=version
21404 This specifies the minimum version of the kernel that will run the
21405 compiled program. GCC uses this version to determine which
21406 instructions to use, what kernel helpers to allow, etc. Currently,
21407 version can be one of 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8,
21408 4.9, 4.10, 4.11, 4.12, 4.13, 4.14, 4.15, 4.16, 4.17, 4.18, 4.19,
21409 4.20, 5.0, 5.1, 5.2, latest and native.
21410
21411 -mbig-endian
21412 Generate code for a big-endian target.
21413
21414 -mlittle-endian
21415 Generate code for a little-endian target. This is the default.
21416
21417 -mjmpext
21418 Enable generation of extra conditional-branch instructions.
21419 Enabled for CPU v2 and above.
21420
21421 -mjmp32
21422 Enable 32-bit jump instructions. Enabled for CPU v3 and above.
21423
21424 -malu32
21425 Enable 32-bit ALU instructions. Enabled for CPU v3 and above.
21426
21427 -mcpu=version
21428 This specifies which version of the eBPF ISA to target. Newer
21429 versions may not be supported by all kernels. The default is v3.
21430
21431 Supported values for version are:
21432
21433 v1 The first stable eBPF ISA with no special features or
21434 extensions.
21435
21436 v2 Supports the jump extensions, as in -mjmpext.
21437
21438 v3 All features of v2, plus:
21439
21440 -<32-bit jump operations, as in -mjmp32>
21441 -<32-bit ALU operations, as in -malu32>
21442 -mco-re
21443 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires
21444 and is implied by -gbtf.
21445
21446 -mno-co-re
21447 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-
21448 RE support is enabled by default when generating BTF debug
21449 information for the BPF target.
21450
21451 -mxbpf
21452 Generate code for an expanded version of BPF, which relaxes some of
21453 the restrictions imposed by the BPF architecture:
21454
21455 -<Save and restore callee-saved registers at function entry and>
21456 exit, respectively.
21457
21458 FR30 Options
21459 These options are defined specifically for the FR30 port.
21460
21461 -msmall-model
21462 Use the small address space model. This can produce smaller code,
21463 but it does assume that all symbolic values and addresses fit into
21464 a 20-bit range.
21465
21466 -mno-lsim
21467 Assume that runtime support has been provided and so there is no
21468 need to include the simulator library (libsim.a) on the linker
21469 command line.
21470
21471 FT32 Options
21472 These options are defined specifically for the FT32 port.
21473
21474 -msim
21475 Specifies that the program will be run on the simulator. This
21476 causes an alternate runtime startup and library to be linked. You
21477 must not use this option when generating programs that will run on
21478 real hardware; you must provide your own runtime library for
21479 whatever I/O functions are needed.
21480
21481 -mlra
21482 Enable Local Register Allocation. This is still experimental for
21483 FT32, so by default the compiler uses standard reload.
21484
21485 -mnodiv
21486 Do not use div and mod instructions.
21487
21488 -mft32b
21489 Enable use of the extended instructions of the FT32B processor.
21490
21491 -mcompress
21492 Compress all code using the Ft32B code compression scheme.
21493
21494 -mnopm
21495 Do not generate code that reads program memory.
21496
21497 FRV Options
21498 -mgpr-32
21499 Only use the first 32 general-purpose registers.
21500
21501 -mgpr-64
21502 Use all 64 general-purpose registers.
21503
21504 -mfpr-32
21505 Use only the first 32 floating-point registers.
21506
21507 -mfpr-64
21508 Use all 64 floating-point registers.
21509
21510 -mhard-float
21511 Use hardware instructions for floating-point operations.
21512
21513 -msoft-float
21514 Use library routines for floating-point operations.
21515
21516 -malloc-cc
21517 Dynamically allocate condition code registers.
21518
21519 -mfixed-cc
21520 Do not try to dynamically allocate condition code registers, only
21521 use "icc0" and "fcc0".
21522
21523 -mdword
21524 Change ABI to use double word insns.
21525
21526 -mno-dword
21527 Do not use double word instructions.
21528
21529 -mdouble
21530 Use floating-point double instructions.
21531
21532 -mno-double
21533 Do not use floating-point double instructions.
21534
21535 -mmedia
21536 Use media instructions.
21537
21538 -mno-media
21539 Do not use media instructions.
21540
21541 -mmuladd
21542 Use multiply and add/subtract instructions.
21543
21544 -mno-muladd
21545 Do not use multiply and add/subtract instructions.
21546
21547 -mfdpic
21548 Select the FDPIC ABI, which uses function descriptors to represent
21549 pointers to functions. Without any PIC/PIE-related options, it
21550 implies -fPIE. With -fpic or -fpie, it assumes GOT entries and
21551 small data are within a 12-bit range from the GOT base address;
21552 with -fPIC or -fPIE, GOT offsets are computed with 32 bits. With a
21553 bfin-elf target, this option implies -msim.
21554
21555 -minline-plt
21556 Enable inlining of PLT entries in function calls to functions that
21557 are not known to bind locally. It has no effect without -mfdpic.
21558 It's enabled by default if optimizing for speed and compiling for
21559 shared libraries (i.e., -fPIC or -fpic), or when an optimization
21560 option such as -O3 or above is present in the command line.
21561
21562 -mTLS
21563 Assume a large TLS segment when generating thread-local code.
21564
21565 -mtls
21566 Do not assume a large TLS segment when generating thread-local
21567 code.
21568
21569 -mgprel-ro
21570 Enable the use of "GPREL" relocations in the FDPIC ABI for data
21571 that is known to be in read-only sections. It's enabled by
21572 default, except for -fpic or -fpie: even though it may help make
21573 the global offset table smaller, it trades 1 instruction for 4.
21574 With -fPIC or -fPIE, it trades 3 instructions for 4, one of which
21575 may be shared by multiple symbols, and it avoids the need for a GOT
21576 entry for the referenced symbol, so it's more likely to be a win.
21577 If it is not, -mno-gprel-ro can be used to disable it.
21578
21579 -multilib-library-pic
21580 Link with the (library, not FD) pic libraries. It's implied by
21581 -mlibrary-pic, as well as by -fPIC and -fpic without -mfdpic. You
21582 should never have to use it explicitly.
21583
21584 -mlinked-fp
21585 Follow the EABI requirement of always creating a frame pointer
21586 whenever a stack frame is allocated. This option is enabled by
21587 default and can be disabled with -mno-linked-fp.
21588
21589 -mlong-calls
21590 Use indirect addressing to call functions outside the current
21591 compilation unit. This allows the functions to be placed anywhere
21592 within the 32-bit address space.
21593
21594 -malign-labels
21595 Try to align labels to an 8-byte boundary by inserting NOPs into
21596 the previous packet. This option only has an effect when VLIW
21597 packing is enabled. It doesn't create new packets; it merely adds
21598 NOPs to existing ones.
21599
21600 -mlibrary-pic
21601 Generate position-independent EABI code.
21602
21603 -macc-4
21604 Use only the first four media accumulator registers.
21605
21606 -macc-8
21607 Use all eight media accumulator registers.
21608
21609 -mpack
21610 Pack VLIW instructions.
21611
21612 -mno-pack
21613 Do not pack VLIW instructions.
21614
21615 -mno-eflags
21616 Do not mark ABI switches in e_flags.
21617
21618 -mcond-move
21619 Enable the use of conditional-move instructions (default).
21620
21621 This switch is mainly for debugging the compiler and will likely be
21622 removed in a future version.
21623
21624 -mno-cond-move
21625 Disable the use of conditional-move instructions.
21626
21627 This switch is mainly for debugging the compiler and will likely be
21628 removed in a future version.
21629
21630 -mscc
21631 Enable the use of conditional set instructions (default).
21632
21633 This switch is mainly for debugging the compiler and will likely be
21634 removed in a future version.
21635
21636 -mno-scc
21637 Disable the use of conditional set instructions.
21638
21639 This switch is mainly for debugging the compiler and will likely be
21640 removed in a future version.
21641
21642 -mcond-exec
21643 Enable the use of conditional execution (default).
21644
21645 This switch is mainly for debugging the compiler and will likely be
21646 removed in a future version.
21647
21648 -mno-cond-exec
21649 Disable the use of conditional execution.
21650
21651 This switch is mainly for debugging the compiler and will likely be
21652 removed in a future version.
21653
21654 -mvliw-branch
21655 Run a pass to pack branches into VLIW instructions (default).
21656
21657 This switch is mainly for debugging the compiler and will likely be
21658 removed in a future version.
21659
21660 -mno-vliw-branch
21661 Do not run a pass to pack branches into VLIW instructions.
21662
21663 This switch is mainly for debugging the compiler and will likely be
21664 removed in a future version.
21665
21666 -mmulti-cond-exec
21667 Enable optimization of "&&" and "||" in conditional execution
21668 (default).
21669
21670 This switch is mainly for debugging the compiler and will likely be
21671 removed in a future version.
21672
21673 -mno-multi-cond-exec
21674 Disable optimization of "&&" and "||" in conditional execution.
21675
21676 This switch is mainly for debugging the compiler and will likely be
21677 removed in a future version.
21678
21679 -mnested-cond-exec
21680 Enable nested conditional execution optimizations (default).
21681
21682 This switch is mainly for debugging the compiler and will likely be
21683 removed in a future version.
21684
21685 -mno-nested-cond-exec
21686 Disable nested conditional execution optimizations.
21687
21688 This switch is mainly for debugging the compiler and will likely be
21689 removed in a future version.
21690
21691 -moptimize-membar
21692 This switch removes redundant "membar" instructions from the
21693 compiler-generated code. It is enabled by default.
21694
21695 -mno-optimize-membar
21696 This switch disables the automatic removal of redundant "membar"
21697 instructions from the generated code.
21698
21699 -mtomcat-stats
21700 Cause gas to print out tomcat statistics.
21701
21702 -mcpu=cpu
21703 Select the processor type for which to generate code. Possible
21704 values are frv, fr550, tomcat, fr500, fr450, fr405, fr400, fr300
21705 and simple.
21706
21707 GNU/Linux Options
21708 These -m options are defined for GNU/Linux targets:
21709
21710 -mglibc
21711 Use the GNU C library. This is the default except on
21712 *-*-linux-*uclibc*, *-*-linux-*musl* and *-*-linux-*android*
21713 targets.
21714
21715 -muclibc
21716 Use uClibc C library. This is the default on *-*-linux-*uclibc*
21717 targets.
21718
21719 -mmusl
21720 Use the musl C library. This is the default on *-*-linux-*musl*
21721 targets.
21722
21723 -mbionic
21724 Use Bionic C library. This is the default on *-*-linux-*android*
21725 targets.
21726
21727 -mandroid
21728 Compile code compatible with Android platform. This is the default
21729 on *-*-linux-*android* targets.
21730
21731 When compiling, this option enables -mbionic, -fPIC,
21732 -fno-exceptions and -fno-rtti by default. When linking, this
21733 option makes the GCC driver pass Android-specific options to the
21734 linker. Finally, this option causes the preprocessor macro
21735 "__ANDROID__" to be defined.
21736
21737 -tno-android-cc
21738 Disable compilation effects of -mandroid, i.e., do not enable
21739 -mbionic, -fPIC, -fno-exceptions and -fno-rtti by default.
21740
21741 -tno-android-ld
21742 Disable linking effects of -mandroid, i.e., pass standard Linux
21743 linking options to the linker.
21744
21745 H8/300 Options
21746 These -m options are defined for the H8/300 implementations:
21747
21748 -mrelax
21749 Shorten some address references at link time, when possible; uses
21750 the linker option -relax.
21751
21752 -mh Generate code for the H8/300H.
21753
21754 -ms Generate code for the H8S.
21755
21756 -mn Generate code for the H8S and H8/300H in the normal mode. This
21757 switch must be used either with -mh or -ms.
21758
21759 -ms2600
21760 Generate code for the H8S/2600. This switch must be used with -ms.
21761
21762 -mexr
21763 Extended registers are stored on stack before execution of function
21764 with monitor attribute. Default option is -mexr. This option is
21765 valid only for H8S targets.
21766
21767 -mno-exr
21768 Extended registers are not stored on stack before execution of
21769 function with monitor attribute. Default option is -mno-exr. This
21770 option is valid only for H8S targets.
21771
21772 -mint32
21773 Make "int" data 32 bits by default.
21774
21775 -malign-300
21776 On the H8/300H and H8S, use the same alignment rules as for the
21777 H8/300. The default for the H8/300H and H8S is to align longs and
21778 floats on 4-byte boundaries. -malign-300 causes them to be aligned
21779 on 2-byte boundaries. This option has no effect on the H8/300.
21780
21781 HPPA Options
21782 These -m options are defined for the HPPA family of computers:
21783
21784 -march=architecture-type
21785 Generate code for the specified architecture. The choices for
21786 architecture-type are 1.0 for PA 1.0, 1.1 for PA 1.1, and 2.0 for
21787 PA 2.0 processors. Refer to /usr/lib/sched.models on an HP-UX
21788 system to determine the proper architecture option for your
21789 machine. Code compiled for lower numbered architectures runs on
21790 higher numbered architectures, but not the other way around.
21791
21792 -mpa-risc-1-0
21793 -mpa-risc-1-1
21794 -mpa-risc-2-0
21795 Synonyms for -march=1.0, -march=1.1, and -march=2.0 respectively.
21796
21797 -matomic-libcalls
21798 Generate libcalls for atomic loads and stores when sync libcalls
21799 are disabled. This option is enabled by default. It only affects
21800 the generation of atomic libcalls by the HPPA backend.
21801
21802 Both the sync and libatomic libcall implementations use locking.
21803 As a result, processor stores are not atomic with respect to other
21804 atomic operations. Processor loads up to DImode are atomic with
21805 respect to other atomic operations provided they are implemented as
21806 a single access.
21807
21808 The PA-RISC architecture does not support any atomic operations in
21809 hardware except for the "ldcw" instruction. Thus, all atomic
21810 support is implemented using sync and atomic libcalls. Sync
21811 libcall support is in libgcc.a. Atomic libcall support is in
21812 libatomic.
21813
21814 This option generates "__atomic_exchange" calls for atomic stores.
21815 It also provides special handling for atomic DImode accesses on
21816 32-bit targets.
21817
21818 -mbig-switch
21819 Does nothing. Preserved for backward compatibility.
21820
21821 -mcaller-copies
21822 The caller copies function arguments passed by hidden reference.
21823 This option should be used with care as it is not compatible with
21824 the default 32-bit runtime. However, only aggregates larger than
21825 eight bytes are passed by hidden reference and the option provides
21826 better compatibility with OpenMP.
21827
21828 -mcoherent-ldcw
21829 Use ldcw/ldcd coherent cache-control hint.
21830
21831 -mdisable-fpregs
21832 Disable floating-point registers. Equivalent to "-msoft-float".
21833
21834 -mdisable-indexing
21835 Prevent the compiler from using indexing address modes. This
21836 avoids some rather obscure problems when compiling MIG generated
21837 code under MACH.
21838
21839 -mfast-indirect-calls
21840 Generate code that assumes calls never cross space boundaries.
21841 This allows GCC to emit code that performs faster indirect calls.
21842
21843 This option does not work in the presence of shared libraries or
21844 nested functions.
21845
21846 -mfixed-range=register-range
21847 Generate code treating the given register range as fixed registers.
21848 A fixed register is one that the register allocator cannot use.
21849 This is useful when compiling kernel code. A register range is
21850 specified as two registers separated by a dash. Multiple register
21851 ranges can be specified separated by a comma.
21852
21853 -mgas
21854 Enable the use of assembler directives only GAS understands.
21855
21856 -mgnu-ld
21857 Use options specific to GNU ld. This passes -shared to ld when
21858 building a shared library. It is the default when GCC is
21859 configured, explicitly or implicitly, with the GNU linker. This
21860 option does not affect which ld is called; it only changes what
21861 parameters are passed to that ld. The ld that is called is
21862 determined by the --with-ld configure option, GCC's program search
21863 path, and finally by the user's PATH. The linker used by GCC can
21864 be printed using which `gcc -print-prog-name=ld`. This option is
21865 only available on the 64-bit HP-UX GCC, i.e. configured with
21866 hppa*64*-*-hpux*.
21867
21868 -mhp-ld
21869 Use options specific to HP ld. This passes -b to ld when building
21870 a shared library and passes +Accept TypeMismatch to ld on all
21871 links. It is the default when GCC is configured, explicitly or
21872 implicitly, with the HP linker. This option does not affect which
21873 ld is called; it only changes what parameters are passed to that
21874 ld. The ld that is called is determined by the --with-ld configure
21875 option, GCC's program search path, and finally by the user's PATH.
21876 The linker used by GCC can be printed using which `gcc
21877 -print-prog-name=ld`. This option is only available on the 64-bit
21878 HP-UX GCC, i.e. configured with hppa*64*-*-hpux*.
21879
21880 -mlinker-opt
21881 Enable the optimization pass in the HP-UX linker. Note this makes
21882 symbolic debugging impossible. It also triggers a bug in the HP-UX
21883 8 and HP-UX 9 linkers in which they give bogus error messages when
21884 linking some programs.
21885
21886 -mlong-calls
21887 Generate code that uses long call sequences. This ensures that a
21888 call is always able to reach linker generated stubs. The default
21889 is to generate long calls only when the distance from the call site
21890 to the beginning of the function or translation unit, as the case
21891 may be, exceeds a predefined limit set by the branch type being
21892 used. The limits for normal calls are 7,600,000 and 240,000 bytes,
21893 respectively for the PA 2.0 and PA 1.X architectures. Sibcalls are
21894 always limited at 240,000 bytes.
21895
21896 Distances are measured from the beginning of functions when using
21897 the -ffunction-sections option, or when using the -mgas and
21898 -mno-portable-runtime options together under HP-UX with the SOM
21899 linker.
21900
21901 It is normally not desirable to use this option as it degrades
21902 performance. However, it may be useful in large applications,
21903 particularly when partial linking is used to build the application.
21904
21905 The types of long calls used depends on the capabilities of the
21906 assembler and linker, and the type of code being generated. The
21907 impact on systems that support long absolute calls, and long pic
21908 symbol-difference or pc-relative calls should be relatively small.
21909 However, an indirect call is used on 32-bit ELF systems in pic code
21910 and it is quite long.
21911
21912 -mlong-load-store
21913 Generate 3-instruction load and store sequences as sometimes
21914 required by the HP-UX 10 linker. This is equivalent to the +k
21915 option to the HP compilers.
21916
21917 -mjump-in-delay
21918 This option is ignored and provided for compatibility purposes
21919 only.
21920
21921 -mno-space-regs
21922 Generate code that assumes the target has no space registers. This
21923 allows GCC to generate faster indirect calls and use unscaled index
21924 address modes.
21925
21926 Such code is suitable for level 0 PA systems and kernels.
21927
21928 -mordered
21929 Assume memory references are ordered and barriers are not needed.
21930
21931 -mportable-runtime
21932 Use the portable calling conventions proposed by HP for ELF
21933 systems.
21934
21935 -mschedule=cpu-type
21936 Schedule code according to the constraints for the machine type
21937 cpu-type. The choices for cpu-type are 700 7100, 7100LC, 7200,
21938 7300 and 8000. Refer to /usr/lib/sched.models on an HP-UX system
21939 to determine the proper scheduling option for your machine. The
21940 default scheduling is 8000.
21941
21942 -msio
21943 Generate the predefine, "_SIO", for server IO. The default is
21944 -mwsio. This generates the predefines, "__hp9000s700",
21945 "__hp9000s700__" and "_WSIO", for workstation IO. These options
21946 are available under HP-UX and HI-UX.
21947
21948 -msoft-float
21949 Generate output containing library calls for floating point.
21950 Warning: the requisite libraries are not available for all HPPA
21951 targets. Normally the facilities of the machine's usual C compiler
21952 are used, but this cannot be done directly in cross-compilation.
21953 You must make your own arrangements to provide suitable library
21954 functions for cross-compilation.
21955
21956 -msoft-float changes the calling convention in the output file;
21957 therefore, it is only useful if you compile all of a program with
21958 this option. In particular, you need to compile libgcc.a, the
21959 library that comes with GCC, with -msoft-float in order for this to
21960 work.
21961
21962 -msoft-mult
21963 Use software integer multiplication.
21964
21965 This disables the use of the "xmpyu" instruction.
21966
21967 -munix=unix-std
21968 Generate compiler predefines and select a startfile for the
21969 specified UNIX standard. The choices for unix-std are 93, 95 and
21970 98. 93 is supported on all HP-UX versions. 95 is available on HP-
21971 UX 10.10 and later. 98 is available on HP-UX 11.11 and later. The
21972 default values are 93 for HP-UX 10.00, 95 for HP-UX 10.10 though to
21973 11.00, and 98 for HP-UX 11.11 and later.
21974
21975 -munix=93 provides the same predefines as GCC 3.3 and 3.4.
21976 -munix=95 provides additional predefines for "XOPEN_UNIX" and
21977 "_XOPEN_SOURCE_EXTENDED", and the startfile unix95.o. -munix=98
21978 provides additional predefines for "_XOPEN_UNIX",
21979 "_XOPEN_SOURCE_EXTENDED", "_INCLUDE__STDC_A1_SOURCE" and
21980 "_INCLUDE_XOPEN_SOURCE_500", and the startfile unix98.o.
21981
21982 It is important to note that this option changes the interfaces for
21983 various library routines. It also affects the operational behavior
21984 of the C library. Thus, extreme care is needed in using this
21985 option.
21986
21987 Library code that is intended to operate with more than one UNIX
21988 standard must test, set and restore the variable
21989 "__xpg4_extended_mask" as appropriate. Most GNU software doesn't
21990 provide this capability.
21991
21992 -nolibdld
21993 Suppress the generation of link options to search libdld.sl when
21994 the -static option is specified on HP-UX 10 and later.
21995
21996 -static
21997 The HP-UX implementation of setlocale in libc has a dependency on
21998 libdld.sl. There isn't an archive version of libdld.sl. Thus,
21999 when the -static option is specified, special link options are
22000 needed to resolve this dependency.
22001
22002 On HP-UX 10 and later, the GCC driver adds the necessary options to
22003 link with libdld.sl when the -static option is specified. This
22004 causes the resulting binary to be dynamic. On the 64-bit port, the
22005 linkers generate dynamic binaries by default in any case. The
22006 -nolibdld option can be used to prevent the GCC driver from adding
22007 these link options.
22008
22009 -threads
22010 Add support for multithreading with the dce thread library under
22011 HP-UX. This option sets flags for both the preprocessor and
22012 linker.
22013
22014 IA-64 Options
22015 These are the -m options defined for the Intel IA-64 architecture.
22016
22017 -mbig-endian
22018 Generate code for a big-endian target. This is the default for HP-
22019 UX.
22020
22021 -mlittle-endian
22022 Generate code for a little-endian target. This is the default for
22023 AIX5 and GNU/Linux.
22024
22025 -mgnu-as
22026 -mno-gnu-as
22027 Generate (or don't) code for the GNU assembler. This is the
22028 default.
22029
22030 -mgnu-ld
22031 -mno-gnu-ld
22032 Generate (or don't) code for the GNU linker. This is the default.
22033
22034 -mno-pic
22035 Generate code that does not use a global pointer register. The
22036 result is not position independent code, and violates the IA-64
22037 ABI.
22038
22039 -mvolatile-asm-stop
22040 -mno-volatile-asm-stop
22041 Generate (or don't) a stop bit immediately before and after
22042 volatile asm statements.
22043
22044 -mregister-names
22045 -mno-register-names
22046 Generate (or don't) in, loc, and out register names for the stacked
22047 registers. This may make assembler output more readable.
22048
22049 -mno-sdata
22050 -msdata
22051 Disable (or enable) optimizations that use the small data section.
22052 This may be useful for working around optimizer bugs.
22053
22054 -mconstant-gp
22055 Generate code that uses a single constant global pointer value.
22056 This is useful when compiling kernel code.
22057
22058 -mauto-pic
22059 Generate code that is self-relocatable. This implies
22060 -mconstant-gp. This is useful when compiling firmware code.
22061
22062 -minline-float-divide-min-latency
22063 Generate code for inline divides of floating-point values using the
22064 minimum latency algorithm.
22065
22066 -minline-float-divide-max-throughput
22067 Generate code for inline divides of floating-point values using the
22068 maximum throughput algorithm.
22069
22070 -mno-inline-float-divide
22071 Do not generate inline code for divides of floating-point values.
22072
22073 -minline-int-divide-min-latency
22074 Generate code for inline divides of integer values using the
22075 minimum latency algorithm.
22076
22077 -minline-int-divide-max-throughput
22078 Generate code for inline divides of integer values using the
22079 maximum throughput algorithm.
22080
22081 -mno-inline-int-divide
22082 Do not generate inline code for divides of integer values.
22083
22084 -minline-sqrt-min-latency
22085 Generate code for inline square roots using the minimum latency
22086 algorithm.
22087
22088 -minline-sqrt-max-throughput
22089 Generate code for inline square roots using the maximum throughput
22090 algorithm.
22091
22092 -mno-inline-sqrt
22093 Do not generate inline code for "sqrt".
22094
22095 -mfused-madd
22096 -mno-fused-madd
22097 Do (don't) generate code that uses the fused multiply/add or
22098 multiply/subtract instructions. The default is to use these
22099 instructions.
22100
22101 -mno-dwarf2-asm
22102 -mdwarf2-asm
22103 Don't (or do) generate assembler code for the DWARF line number
22104 debugging info. This may be useful when not using the GNU
22105 assembler.
22106
22107 -mearly-stop-bits
22108 -mno-early-stop-bits
22109 Allow stop bits to be placed earlier than immediately preceding the
22110 instruction that triggered the stop bit. This can improve
22111 instruction scheduling, but does not always do so.
22112
22113 -mfixed-range=register-range
22114 Generate code treating the given register range as fixed registers.
22115 A fixed register is one that the register allocator cannot use.
22116 This is useful when compiling kernel code. A register range is
22117 specified as two registers separated by a dash. Multiple register
22118 ranges can be specified separated by a comma.
22119
22120 -mtls-size=tls-size
22121 Specify bit size of immediate TLS offsets. Valid values are 14,
22122 22, and 64.
22123
22124 -mtune=cpu-type
22125 Tune the instruction scheduling for a particular CPU, Valid values
22126 are itanium, itanium1, merced, itanium2, and mckinley.
22127
22128 -milp32
22129 -mlp64
22130 Generate code for a 32-bit or 64-bit environment. The 32-bit
22131 environment sets int, long and pointer to 32 bits. The 64-bit
22132 environment sets int to 32 bits and long and pointer to 64 bits.
22133 These are HP-UX specific flags.
22134
22135 -mno-sched-br-data-spec
22136 -msched-br-data-spec
22137 (Dis/En)able data speculative scheduling before reload. This
22138 results in generation of "ld.a" instructions and the corresponding
22139 check instructions ("ld.c" / "chk.a"). The default setting is
22140 disabled.
22141
22142 -msched-ar-data-spec
22143 -mno-sched-ar-data-spec
22144 (En/Dis)able data speculative scheduling after reload. This
22145 results in generation of "ld.a" instructions and the corresponding
22146 check instructions ("ld.c" / "chk.a"). The default setting is
22147 enabled.
22148
22149 -mno-sched-control-spec
22150 -msched-control-spec
22151 (Dis/En)able control speculative scheduling. This feature is
22152 available only during region scheduling (i.e. before reload). This
22153 results in generation of the "ld.s" instructions and the
22154 corresponding check instructions "chk.s". The default setting is
22155 disabled.
22156
22157 -msched-br-in-data-spec
22158 -mno-sched-br-in-data-spec
22159 (En/Dis)able speculative scheduling of the instructions that are
22160 dependent on the data speculative loads before reload. This is
22161 effective only with -msched-br-data-spec enabled. The default
22162 setting is enabled.
22163
22164 -msched-ar-in-data-spec
22165 -mno-sched-ar-in-data-spec
22166 (En/Dis)able speculative scheduling of the instructions that are
22167 dependent on the data speculative loads after reload. This is
22168 effective only with -msched-ar-data-spec enabled. The default
22169 setting is enabled.
22170
22171 -msched-in-control-spec
22172 -mno-sched-in-control-spec
22173 (En/Dis)able speculative scheduling of the instructions that are
22174 dependent on the control speculative loads. This is effective only
22175 with -msched-control-spec enabled. The default setting is enabled.
22176
22177 -mno-sched-prefer-non-data-spec-insns
22178 -msched-prefer-non-data-spec-insns
22179 If enabled, data-speculative instructions are chosen for schedule
22180 only if there are no other choices at the moment. This makes the
22181 use of the data speculation much more conservative. The default
22182 setting is disabled.
22183
22184 -mno-sched-prefer-non-control-spec-insns
22185 -msched-prefer-non-control-spec-insns
22186 If enabled, control-speculative instructions are chosen for
22187 schedule only if there are no other choices at the moment. This
22188 makes the use of the control speculation much more conservative.
22189 The default setting is disabled.
22190
22191 -mno-sched-count-spec-in-critical-path
22192 -msched-count-spec-in-critical-path
22193 If enabled, speculative dependencies are considered during
22194 computation of the instructions priorities. This makes the use of
22195 the speculation a bit more conservative. The default setting is
22196 disabled.
22197
22198 -msched-spec-ldc
22199 Use a simple data speculation check. This option is on by default.
22200
22201 -msched-control-spec-ldc
22202 Use a simple check for control speculation. This option is on by
22203 default.
22204
22205 -msched-stop-bits-after-every-cycle
22206 Place a stop bit after every cycle when scheduling. This option is
22207 on by default.
22208
22209 -msched-fp-mem-deps-zero-cost
22210 Assume that floating-point stores and loads are not likely to cause
22211 a conflict when placed into the same instruction group. This
22212 option is disabled by default.
22213
22214 -msel-sched-dont-check-control-spec
22215 Generate checks for control speculation in selective scheduling.
22216 This flag is disabled by default.
22217
22218 -msched-max-memory-insns=max-insns
22219 Limit on the number of memory insns per instruction group, giving
22220 lower priority to subsequent memory insns attempting to schedule in
22221 the same instruction group. Frequently useful to prevent cache bank
22222 conflicts. The default value is 1.
22223
22224 -msched-max-memory-insns-hard-limit
22225 Makes the limit specified by msched-max-memory-insns a hard limit,
22226 disallowing more than that number in an instruction group.
22227 Otherwise, the limit is "soft", meaning that non-memory operations
22228 are preferred when the limit is reached, but memory operations may
22229 still be scheduled.
22230
22231 LM32 Options
22232 These -m options are defined for the LatticeMico32 architecture:
22233
22234 -mbarrel-shift-enabled
22235 Enable barrel-shift instructions.
22236
22237 -mdivide-enabled
22238 Enable divide and modulus instructions.
22239
22240 -mmultiply-enabled
22241 Enable multiply instructions.
22242
22243 -msign-extend-enabled
22244 Enable sign extend instructions.
22245
22246 -muser-enabled
22247 Enable user-defined instructions.
22248
22249 LoongArch Options
22250 These command-line options are defined for LoongArch targets:
22251
22252 -march=cpu-type
22253 Generate instructions for the machine type cpu-type. In contrast
22254 to -mtune=cpu-type, which merely tunes the generated code for the
22255 specified cpu-type, -march=cpu-type allows GCC to generate code
22256 that may not run at all on processors other than the one indicated.
22257 Specifying -march=cpu-type implies -mtune=cpu-type, except where
22258 noted otherwise.
22259
22260 The choices for cpu-type are:
22261
22262 native
22263 This selects the CPU to generate code for at compilation time
22264 by determining the processor type of the compiling machine.
22265 Using -march=native enables all instruction subsets supported
22266 by the local machine (hence the result might not run on
22267 different machines). Using -mtune=native produces code
22268 optimized for the local machine under the constraints of the
22269 selected instruction set.
22270
22271 loongarch64
22272 A generic CPU with 64-bit extensions.
22273
22274 la464
22275 LoongArch LA464 CPU with LBT, LSX, LASX, LVZ.
22276
22277 -mtune=cpu-type
22278 Optimize the output for the given processor, specified by
22279 microarchitecture name.
22280
22281 -mabi=base-abi-type
22282 Generate code for the specified calling convention. base-abi-type
22283 can be one of:
22284
22285 lp64d
22286 Uses 64-bit general purpose registers and 32/64-bit floating-
22287 point registers for parameter passing. Data model is LP64,
22288 where int is 32 bits, while long int and pointers are 64 bits.
22289
22290 lp64f
22291 Uses 64-bit general purpose registers and 32-bit floating-point
22292 registers for parameter passing. Data model is LP64, where int
22293 is 32 bits, while long int and pointers are 64 bits.
22294
22295 lp64s
22296 Uses 64-bit general purpose registers and no floating-point
22297 registers for parameter passing. Data model is LP64, where int
22298 is 32 bits, while long int and pointers are 64 bits.
22299
22300 -mfpu=fpu-type
22301 Generate code for the specified FPU type, which can be one of:
22302
22303 64 Allow the use of hardware floating-point instructions for
22304 32-bit and 64-bit operations.
22305
22306 32 Allow the use of hardware floating-point instructions for
22307 32-bit operations.
22308
22309 none
22310 0 Prevent the use of hardware floating-point instructions.
22311
22312 -msoft-float
22313 Force -mfpu=none and prevents the use of floating-point registers
22314 for parameter passing. This option may change the target ABI.
22315
22316 -msingle-float
22317 Force -mfpu=32 and allow the use of 32-bit floating-point registers
22318 for parameter passing. This option may change the target ABI.
22319
22320 -mdouble-float
22321 Force -mfpu=64 and allow the use of 32/64-bit floating-point
22322 registers for parameter passing. This option may change the target
22323 ABI.
22324
22325 -mbranch-cost=n
22326 Set the cost of branches to roughly n instructions.
22327
22328 -mcheck-zero-division
22329 -mno-check-zero-divison
22330 Trap (do not trap) on integer division by zero. The default is
22331 -mcheck-zero-division for -O0 or -Og, and -mno-check-zero-division
22332 for other optimization levels.
22333
22334 -mcond-move-int
22335 -mno-cond-move-int
22336 Conditional moves for integral data in general-purpose registers
22337 are enabled (disabled). The default is -mcond-move-int.
22338
22339 -mcond-move-float
22340 -mno-cond-move-float
22341 Conditional moves for floating-point registers are enabled
22342 (disabled). The default is -mcond-move-float.
22343
22344 -mmemcpy
22345 -mno-memcpy
22346 Force (do not force) the use of "memcpy" for non-trivial block
22347 moves. The default is -mno-memcpy, which allows GCC to inline most
22348 constant-sized copies. Setting optimization level to -Os also
22349 forces the use of "memcpy", but -mno-memcpy may override this
22350 behavior if explicitly specified, regardless of the order these
22351 options on the command line.
22352
22353 -mstrict-align
22354 -mno-strict-align
22355 Avoid or allow generating memory accesses that may not be aligned
22356 on a natural object boundary as described in the architecture
22357 specification. The default is -mno-strict-align.
22358
22359 -msmall-data-limit=number
22360 Put global and static data smaller than number bytes into a special
22361 section (on some targets). The default value is 0.
22362
22363 -mmax-inline-memcpy-size=n
22364 Inline all block moves (such as calls to "memcpy" or structure
22365 copies) less than or equal to n bytes. The default value of n is
22366 1024.
22367
22368 -mcmodel=code-model
22369 Set the code model to one of:
22370
22371 tiny-static (Not implemented yet)
22372 tiny (Not implemented yet)
22373 normal
22374 The text segment must be within 128MB addressing space. The
22375 data segment must be within 2GB addressing space.
22376
22377 medium
22378 The text segment and data segment must be within 2GB addressing
22379 space.
22380
22381 large (Not implemented yet)
22382 extreme
22383 This mode does not limit the size of the code segment and data
22384 segment. The -mcmodel=extreme option is incompatible with
22385 -fplt and -mno-explicit-relocs.
22386
22387 The default code model is "normal".
22388
22389 -mexplicit-relocs
22390 -mno-explicit-relocs
22391 Use or do not use assembler relocation operators when dealing with
22392 symbolic addresses. The alternative is to use assembler macros
22393 instead, which may limit optimization. The default value for the
22394 option is determined during GCC build-time by detecting
22395 corresponding assembler support: "-mexplicit-relocs" if said
22396 support is present, "-mno-explicit-relocs" otherwise. This option
22397 is mostly useful for debugging, or interoperation with assemblers
22398 different from the build-time one.
22399
22400 -mdirect-extern-access
22401 -mno-direct-extern-access
22402 Do not use or use GOT to access external symbols. The default is
22403 -mno-direct-extern-access: GOT is used for external symbols with
22404 default visibility, but not used for other external symbols.
22405
22406 With -mdirect-extern-access, GOT is not used and all external
22407 symbols are PC-relatively addressed. It is only suitable for
22408 environments where no dynamic link is performed, like firmwares, OS
22409 kernels, executables linked with -static or -static-pie.
22410 -mdirect-extern-access is not compatible with -fPIC or -fpic.
22411
22412 M32C Options
22413 -mcpu=name
22414 Select the CPU for which code is generated. name may be one of r8c
22415 for the R8C/Tiny series, m16c for the M16C (up to /60) series,
22416 m32cm for the M16C/80 series, or m32c for the M32C/80 series.
22417
22418 -msim
22419 Specifies that the program will be run on the simulator. This
22420 causes an alternate runtime library to be linked in which supports,
22421 for example, file I/O. You must not use this option when
22422 generating programs that will run on real hardware; you must
22423 provide your own runtime library for whatever I/O functions are
22424 needed.
22425
22426 -memregs=number
22427 Specifies the number of memory-based pseudo-registers GCC uses
22428 during code generation. These pseudo-registers are used like real
22429 registers, so there is a tradeoff between GCC's ability to fit the
22430 code into available registers, and the performance penalty of using
22431 memory instead of registers. Note that all modules in a program
22432 must be compiled with the same value for this option. Because of
22433 that, you must not use this option with GCC's default runtime
22434 libraries.
22435
22436 M32R/D Options
22437 These -m options are defined for Renesas M32R/D architectures:
22438
22439 -m32r2
22440 Generate code for the M32R/2.
22441
22442 -m32rx
22443 Generate code for the M32R/X.
22444
22445 -m32r
22446 Generate code for the M32R. This is the default.
22447
22448 -mmodel=small
22449 Assume all objects live in the lower 16MB of memory (so that their
22450 addresses can be loaded with the "ld24" instruction), and assume
22451 all subroutines are reachable with the "bl" instruction. This is
22452 the default.
22453
22454 The addressability of a particular object can be set with the
22455 "model" attribute.
22456
22457 -mmodel=medium
22458 Assume objects may be anywhere in the 32-bit address space (the
22459 compiler generates "seth/add3" instructions to load their
22460 addresses), and assume all subroutines are reachable with the "bl"
22461 instruction.
22462
22463 -mmodel=large
22464 Assume objects may be anywhere in the 32-bit address space (the
22465 compiler generates "seth/add3" instructions to load their
22466 addresses), and assume subroutines may not be reachable with the
22467 "bl" instruction (the compiler generates the much slower
22468 "seth/add3/jl" instruction sequence).
22469
22470 -msdata=none
22471 Disable use of the small data area. Variables are put into one of
22472 ".data", ".bss", or ".rodata" (unless the "section" attribute has
22473 been specified). This is the default.
22474
22475 The small data area consists of sections ".sdata" and ".sbss".
22476 Objects may be explicitly put in the small data area with the
22477 "section" attribute using one of these sections.
22478
22479 -msdata=sdata
22480 Put small global and static data in the small data area, but do not
22481 generate special code to reference them.
22482
22483 -msdata=use
22484 Put small global and static data in the small data area, and
22485 generate special instructions to reference them.
22486
22487 -G num
22488 Put global and static objects less than or equal to num bytes into
22489 the small data or BSS sections instead of the normal data or BSS
22490 sections. The default value of num is 8. The -msdata option must
22491 be set to one of sdata or use for this option to have any effect.
22492
22493 All modules should be compiled with the same -G num value.
22494 Compiling with different values of num may or may not work; if it
22495 doesn't the linker gives an error message---incorrect code is not
22496 generated.
22497
22498 -mdebug
22499 Makes the M32R-specific code in the compiler display some
22500 statistics that might help in debugging programs.
22501
22502 -malign-loops
22503 Align all loops to a 32-byte boundary.
22504
22505 -mno-align-loops
22506 Do not enforce a 32-byte alignment for loops. This is the default.
22507
22508 -missue-rate=number
22509 Issue number instructions per cycle. number can only be 1 or 2.
22510
22511 -mbranch-cost=number
22512 number can only be 1 or 2. If it is 1 then branches are preferred
22513 over conditional code, if it is 2, then the opposite applies.
22514
22515 -mflush-trap=number
22516 Specifies the trap number to use to flush the cache. The default
22517 is 12. Valid numbers are between 0 and 15 inclusive.
22518
22519 -mno-flush-trap
22520 Specifies that the cache cannot be flushed by using a trap.
22521
22522 -mflush-func=name
22523 Specifies the name of the operating system function to call to
22524 flush the cache. The default is _flush_cache, but a function call
22525 is only used if a trap is not available.
22526
22527 -mno-flush-func
22528 Indicates that there is no OS function for flushing the cache.
22529
22530 M680x0 Options
22531 These are the -m options defined for M680x0 and ColdFire processors.
22532 The default settings depend on which architecture was selected when the
22533 compiler was configured; the defaults for the most common choices are
22534 given below.
22535
22536 -march=arch
22537 Generate code for a specific M680x0 or ColdFire instruction set
22538 architecture. Permissible values of arch for M680x0 architectures
22539 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. ColdFire
22540 architectures are selected according to Freescale's ISA
22541 classification and the permissible values are: isaa, isaaplus, isab
22542 and isac.
22543
22544 GCC defines a macro "__mcfarch__" whenever it is generating code
22545 for a ColdFire target. The arch in this macro is one of the -march
22546 arguments given above.
22547
22548 When used together, -march and -mtune select code that runs on a
22549 family of similar processors but that is optimized for a particular
22550 microarchitecture.
22551
22552 -mcpu=cpu
22553 Generate code for a specific M680x0 or ColdFire processor. The
22554 M680x0 cpus are: 68000, 68010, 68020, 68030, 68040, 68060, 68302,
22555 68332 and cpu32. The ColdFire cpus are given by the table below,
22556 which also classifies the CPUs into families:
22557
22558 Family : -mcpu arguments
22559 51 : 51 51ac 51ag 51cn 51em 51je 51jf 51jg 51jm 51mm 51qe 51qm
22560 5206 : 5202 5204 5206
22561 5206e : 5206e
22562 5208 : 5207 5208
22563 5211a : 5210a 5211a
22564 5213 : 5211 5212 5213
22565 5216 : 5214 5216
22566 52235 : 52230 52231 52232 52233 52234 52235
22567 5225 : 5224 5225
22568 52259 : 52252 52254 52255 52256 52258 52259
22569 5235 : 5232 5233 5234 5235 523x
22570 5249 : 5249
22571 5250 : 5250
22572 5271 : 5270 5271
22573 5272 : 5272
22574 5275 : 5274 5275
22575 5282 : 5280 5281 5282 528x
22576 53017 : 53011 53012 53013 53014 53015 53016 53017
22577 5307 : 5307
22578 5329 : 5327 5328 5329 532x
22579 5373 : 5372 5373 537x
22580 5407 : 5407
22581 5475 : 5470 5471 5472 5473 5474 5475 547x 5480 5481 5482 5483 5484
22582 5485
22583
22584 -mcpu=cpu overrides -march=arch if arch is compatible with cpu.
22585 Other combinations of -mcpu and -march are rejected.
22586
22587 GCC defines the macro "__mcf_cpu_cpu" when ColdFire target cpu is
22588 selected. It also defines "__mcf_family_family", where the value
22589 of family is given by the table above.
22590
22591 -mtune=tune
22592 Tune the code for a particular microarchitecture within the
22593 constraints set by -march and -mcpu. The M680x0 microarchitectures
22594 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. The
22595 ColdFire microarchitectures are: cfv1, cfv2, cfv3, cfv4 and cfv4e.
22596
22597 You can also use -mtune=68020-40 for code that needs to run
22598 relatively well on 68020, 68030 and 68040 targets. -mtune=68020-60
22599 is similar but includes 68060 targets as well. These two options
22600 select the same tuning decisions as -m68020-40 and -m68020-60
22601 respectively.
22602
22603 GCC defines the macros "__mcarch" and "__mcarch__" when tuning for
22604 680x0 architecture arch. It also defines "mcarch" unless either
22605 -ansi or a non-GNU -std option is used. If GCC is tuning for a
22606 range of architectures, as selected by -mtune=68020-40 or
22607 -mtune=68020-60, it defines the macros for every architecture in
22608 the range.
22609
22610 GCC also defines the macro "__muarch__" when tuning for ColdFire
22611 microarchitecture uarch, where uarch is one of the arguments given
22612 above.
22613
22614 -m68000
22615 -mc68000
22616 Generate output for a 68000. This is the default when the compiler
22617 is configured for 68000-based systems. It is equivalent to
22618 -march=68000.
22619
22620 Use this option for microcontrollers with a 68000 or EC000 core,
22621 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
22622
22623 -m68010
22624 Generate output for a 68010. This is the default when the compiler
22625 is configured for 68010-based systems. It is equivalent to
22626 -march=68010.
22627
22628 -m68020
22629 -mc68020
22630 Generate output for a 68020. This is the default when the compiler
22631 is configured for 68020-based systems. It is equivalent to
22632 -march=68020.
22633
22634 -m68030
22635 Generate output for a 68030. This is the default when the compiler
22636 is configured for 68030-based systems. It is equivalent to
22637 -march=68030.
22638
22639 -m68040
22640 Generate output for a 68040. This is the default when the compiler
22641 is configured for 68040-based systems. It is equivalent to
22642 -march=68040.
22643
22644 This option inhibits the use of 68881/68882 instructions that have
22645 to be emulated by software on the 68040. Use this option if your
22646 68040 does not have code to emulate those instructions.
22647
22648 -m68060
22649 Generate output for a 68060. This is the default when the compiler
22650 is configured for 68060-based systems. It is equivalent to
22651 -march=68060.
22652
22653 This option inhibits the use of 68020 and 68881/68882 instructions
22654 that have to be emulated by software on the 68060. Use this option
22655 if your 68060 does not have code to emulate those instructions.
22656
22657 -mcpu32
22658 Generate output for a CPU32. This is the default when the compiler
22659 is configured for CPU32-based systems. It is equivalent to
22660 -march=cpu32.
22661
22662 Use this option for microcontrollers with a CPU32 or CPU32+ core,
22663 including the 68330, 68331, 68332, 68333, 68334, 68336, 68340,
22664 68341, 68349 and 68360.
22665
22666 -m5200
22667 Generate output for a 520X ColdFire CPU. This is the default when
22668 the compiler is configured for 520X-based systems. It is
22669 equivalent to -mcpu=5206, and is now deprecated in favor of that
22670 option.
22671
22672 Use this option for microcontroller with a 5200 core, including the
22673 MCF5202, MCF5203, MCF5204 and MCF5206.
22674
22675 -m5206e
22676 Generate output for a 5206e ColdFire CPU. The option is now
22677 deprecated in favor of the equivalent -mcpu=5206e.
22678
22679 -m528x
22680 Generate output for a member of the ColdFire 528X family. The
22681 option is now deprecated in favor of the equivalent -mcpu=528x.
22682
22683 -m5307
22684 Generate output for a ColdFire 5307 CPU. The option is now
22685 deprecated in favor of the equivalent -mcpu=5307.
22686
22687 -m5407
22688 Generate output for a ColdFire 5407 CPU. The option is now
22689 deprecated in favor of the equivalent -mcpu=5407.
22690
22691 -mcfv4e
22692 Generate output for a ColdFire V4e family CPU (e.g. 547x/548x).
22693 This includes use of hardware floating-point instructions. The
22694 option is equivalent to -mcpu=547x, and is now deprecated in favor
22695 of that option.
22696
22697 -m68020-40
22698 Generate output for a 68040, without using any of the new
22699 instructions. This results in code that can run relatively
22700 efficiently on either a 68020/68881 or a 68030 or a 68040. The
22701 generated code does use the 68881 instructions that are emulated on
22702 the 68040.
22703
22704 The option is equivalent to -march=68020 -mtune=68020-40.
22705
22706 -m68020-60
22707 Generate output for a 68060, without using any of the new
22708 instructions. This results in code that can run relatively
22709 efficiently on either a 68020/68881 or a 68030 or a 68040. The
22710 generated code does use the 68881 instructions that are emulated on
22711 the 68060.
22712
22713 The option is equivalent to -march=68020 -mtune=68020-60.
22714
22715 -mhard-float
22716 -m68881
22717 Generate floating-point instructions. This is the default for
22718 68020 and above, and for ColdFire devices that have an FPU. It
22719 defines the macro "__HAVE_68881__" on M680x0 targets and
22720 "__mcffpu__" on ColdFire targets.
22721
22722 -msoft-float
22723 Do not generate floating-point instructions; use library calls
22724 instead. This is the default for 68000, 68010, and 68832 targets.
22725 It is also the default for ColdFire devices that have no FPU.
22726
22727 -mdiv
22728 -mno-div
22729 Generate (do not generate) ColdFire hardware divide and remainder
22730 instructions. If -march is used without -mcpu, the default is "on"
22731 for ColdFire architectures and "off" for M680x0 architectures.
22732 Otherwise, the default is taken from the target CPU (either the
22733 default CPU, or the one specified by -mcpu). For example, the
22734 default is "off" for -mcpu=5206 and "on" for -mcpu=5206e.
22735
22736 GCC defines the macro "__mcfhwdiv__" when this option is enabled.
22737
22738 -mshort
22739 Consider type "int" to be 16 bits wide, like "short int".
22740 Additionally, parameters passed on the stack are also aligned to a
22741 16-bit boundary even on targets whose API mandates promotion to
22742 32-bit.
22743
22744 -mno-short
22745 Do not consider type "int" to be 16 bits wide. This is the
22746 default.
22747
22748 -mnobitfield
22749 -mno-bitfield
22750 Do not use the bit-field instructions. The -m68000, -mcpu32 and
22751 -m5200 options imply -mnobitfield.
22752
22753 -mbitfield
22754 Do use the bit-field instructions. The -m68020 option implies
22755 -mbitfield. This is the default if you use a configuration
22756 designed for a 68020.
22757
22758 -mrtd
22759 Use a different function-calling convention, in which functions
22760 that take a fixed number of arguments return with the "rtd"
22761 instruction, which pops their arguments while returning. This
22762 saves one instruction in the caller since there is no need to pop
22763 the arguments there.
22764
22765 This calling convention is incompatible with the one normally used
22766 on Unix, so you cannot use it if you need to call libraries
22767 compiled with the Unix compiler.
22768
22769 Also, you must provide function prototypes for all functions that
22770 take variable numbers of arguments (including "printf"); otherwise
22771 incorrect code is generated for calls to those functions.
22772
22773 In addition, seriously incorrect code results if you call a
22774 function with too many arguments. (Normally, extra arguments are
22775 harmlessly ignored.)
22776
22777 The "rtd" instruction is supported by the 68010, 68020, 68030,
22778 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
22779
22780 The default is -mno-rtd.
22781
22782 -malign-int
22783 -mno-align-int
22784 Control whether GCC aligns "int", "long", "long long", "float",
22785 "double", and "long double" variables on a 32-bit boundary
22786 (-malign-int) or a 16-bit boundary (-mno-align-int). Aligning
22787 variables on 32-bit boundaries produces code that runs somewhat
22788 faster on processors with 32-bit busses at the expense of more
22789 memory.
22790
22791 Warning: if you use the -malign-int switch, GCC aligns structures
22792 containing the above types differently than most published
22793 application binary interface specifications for the m68k.
22794
22795 Use the pc-relative addressing mode of the 68000 directly, instead
22796 of using a global offset table. At present, this option implies
22797 -fpic, allowing at most a 16-bit offset for pc-relative addressing.
22798 -fPIC is not presently supported with -mpcrel, though this could be
22799 supported for 68020 and higher processors.
22800
22801 -mno-strict-align
22802 -mstrict-align
22803 Do not (do) assume that unaligned memory references are handled by
22804 the system.
22805
22806 -msep-data
22807 Generate code that allows the data segment to be located in a
22808 different area of memory from the text segment. This allows for
22809 execute-in-place in an environment without virtual memory
22810 management. This option implies -fPIC.
22811
22812 -mno-sep-data
22813 Generate code that assumes that the data segment follows the text
22814 segment. This is the default.
22815
22816 -mid-shared-library
22817 Generate code that supports shared libraries via the library ID
22818 method. This allows for execute-in-place and shared libraries in
22819 an environment without virtual memory management. This option
22820 implies -fPIC.
22821
22822 -mno-id-shared-library
22823 Generate code that doesn't assume ID-based shared libraries are
22824 being used. This is the default.
22825
22826 -mshared-library-id=n
22827 Specifies the identification number of the ID-based shared library
22828 being compiled. Specifying a value of 0 generates more compact
22829 code; specifying other values forces the allocation of that number
22830 to the current library, but is no more space- or time-efficient
22831 than omitting this option.
22832
22833 -mxgot
22834 -mno-xgot
22835 When generating position-independent code for ColdFire, generate
22836 code that works if the GOT has more than 8192 entries. This code
22837 is larger and slower than code generated without this option. On
22838 M680x0 processors, this option is not needed; -fPIC suffices.
22839
22840 GCC normally uses a single instruction to load values from the GOT.
22841 While this is relatively efficient, it only works if the GOT is
22842 smaller than about 64k. Anything larger causes the linker to
22843 report an error such as:
22844
22845 relocation truncated to fit: R_68K_GOT16O foobar
22846
22847 If this happens, you should recompile your code with -mxgot. It
22848 should then work with very large GOTs. However, code generated
22849 with -mxgot is less efficient, since it takes 4 instructions to
22850 fetch the value of a global symbol.
22851
22852 Note that some linkers, including newer versions of the GNU linker,
22853 can create multiple GOTs and sort GOT entries. If you have such a
22854 linker, you should only need to use -mxgot when compiling a single
22855 object file that accesses more than 8192 GOT entries. Very few do.
22856
22857 These options have no effect unless GCC is generating position-
22858 independent code.
22859
22860 -mlong-jump-table-offsets
22861 Use 32-bit offsets in "switch" tables. The default is to use
22862 16-bit offsets.
22863
22864 MCore Options
22865 These are the -m options defined for the Motorola M*Core processors.
22866
22867 -mhardlit
22868 -mno-hardlit
22869 Inline constants into the code stream if it can be done in two
22870 instructions or less.
22871
22872 -mdiv
22873 -mno-div
22874 Use the divide instruction. (Enabled by default).
22875
22876 -mrelax-immediate
22877 -mno-relax-immediate
22878 Allow arbitrary-sized immediates in bit operations.
22879
22880 -mwide-bitfields
22881 -mno-wide-bitfields
22882 Always treat bit-fields as "int"-sized.
22883
22884 -m4byte-functions
22885 -mno-4byte-functions
22886 Force all functions to be aligned to a 4-byte boundary.
22887
22888 -mcallgraph-data
22889 -mno-callgraph-data
22890 Emit callgraph information.
22891
22892 -mslow-bytes
22893 -mno-slow-bytes
22894 Prefer word access when reading byte quantities.
22895
22896 -mlittle-endian
22897 -mbig-endian
22898 Generate code for a little-endian target.
22899
22900 -m210
22901 -m340
22902 Generate code for the 210 processor.
22903
22904 -mno-lsim
22905 Assume that runtime support has been provided and so omit the
22906 simulator library (libsim.a) from the linker command line.
22907
22908 -mstack-increment=size
22909 Set the maximum amount for a single stack increment operation.
22910 Large values can increase the speed of programs that contain
22911 functions that need a large amount of stack space, but they can
22912 also trigger a segmentation fault if the stack is extended too
22913 much. The default value is 0x1000.
22914
22915 MicroBlaze Options
22916 -msoft-float
22917 Use software emulation for floating point (default).
22918
22919 -mhard-float
22920 Use hardware floating-point instructions.
22921
22922 -mmemcpy
22923 Do not optimize block moves, use "memcpy".
22924
22925 -mno-clearbss
22926 This option is deprecated. Use -fno-zero-initialized-in-bss
22927 instead.
22928
22929 -mcpu=cpu-type
22930 Use features of, and schedule code for, the given CPU. Supported
22931 values are in the format vX.YY.Z, where X is a major version, YY is
22932 the minor version, and Z is compatibility code. Example values are
22933 v3.00.a, v4.00.b, v5.00.a, v5.00.b, v6.00.a.
22934
22935 -mxl-soft-mul
22936 Use software multiply emulation (default).
22937
22938 -mxl-soft-div
22939 Use software emulation for divides (default).
22940
22941 -mxl-barrel-shift
22942 Use the hardware barrel shifter.
22943
22944 -mxl-pattern-compare
22945 Use pattern compare instructions.
22946
22947 -msmall-divides
22948 Use table lookup optimization for small signed integer divisions.
22949
22950 -mxl-stack-check
22951 This option is deprecated. Use -fstack-check instead.
22952
22953 -mxl-gp-opt
22954 Use GP-relative ".sdata"/".sbss" sections.
22955
22956 -mxl-multiply-high
22957 Use multiply high instructions for high part of 32x32 multiply.
22958
22959 -mxl-float-convert
22960 Use hardware floating-point conversion instructions.
22961
22962 -mxl-float-sqrt
22963 Use hardware floating-point square root instruction.
22964
22965 -mbig-endian
22966 Generate code for a big-endian target.
22967
22968 -mlittle-endian
22969 Generate code for a little-endian target.
22970
22971 -mxl-reorder
22972 Use reorder instructions (swap and byte reversed load/store).
22973
22974 -mxl-mode-app-model
22975 Select application model app-model. Valid models are
22976
22977 executable
22978 normal executable (default), uses startup code crt0.o.
22979
22980 xmdstub
22981 for use with Xilinx Microprocessor Debugger (XMD) based
22982 software intrusive debug agent called xmdstub. This uses
22983 startup file crt1.o and sets the start address of the program
22984 to 0x800.
22985
22986 bootstrap
22987 for applications that are loaded using a bootloader. This
22988 model uses startup file crt2.o which does not contain a
22989 processor reset vector handler. This is suitable for
22990 transferring control on a processor reset to the bootloader
22991 rather than the application.
22992
22993 novectors
22994 for applications that do not require any of the MicroBlaze
22995 vectors. This option may be useful for applications running
22996 within a monitoring application. This model uses crt3.o as a
22997 startup file.
22998
22999 Option -xl-mode-app-model is a deprecated alias for -mxl-mode-app-
23000 model.
23001
23002 -mpic-data-is-text-relative
23003 Assume that the displacement between the text and data segments is
23004 fixed at static link time. This allows data to be referenced by
23005 offset from start of text address instead of GOT since PC-relative
23006 addressing is not supported.
23007
23008 MIPS Options
23009 -EB Generate big-endian code.
23010
23011 -EL Generate little-endian code. This is the default for mips*el-*-*
23012 configurations.
23013
23014 -march=arch
23015 Generate code that runs on arch, which can be the name of a generic
23016 MIPS ISA, or the name of a particular processor. The ISA names
23017 are: mips1, mips2, mips3, mips4, mips32, mips32r2, mips32r3,
23018 mips32r5, mips32r6, mips64, mips64r2, mips64r3, mips64r5 and
23019 mips64r6. The processor names are: 4kc, 4km, 4kp, 4ksc, 4kec,
23020 4kem, 4kep, 4ksd, 5kc, 5kf, 20kc, 24kc, 24kf2_1, 24kf1_1, 24kec,
23021 24kef2_1, 24kef1_1, 34kc, 34kf2_1, 34kf1_1, 34kn, 74kc, 74kf2_1,
23022 74kf1_1, 74kf3_2, 1004kc, 1004kf2_1, 1004kf1_1, i6400, i6500,
23023 interaptiv, loongson2e, loongson2f, loongson3a, gs464, gs464e,
23024 gs264e, m4k, m14k, m14kc, m14ke, m14kec, m5100, m5101, octeon,
23025 octeon+, octeon2, octeon3, orion, p5600, p6600, r2000, r3000,
23026 r3900, r4000, r4400, r4600, r4650, r4700, r5900, r6000, r8000,
23027 rm7000, rm9000, r10000, r12000, r14000, r16000, sb1, sr71000,
23028 vr4100, vr4111, vr4120, vr4130, vr4300, vr5000, vr5400, vr5500, xlr
23029 and xlp. The special value from-abi selects the most compatible
23030 architecture for the selected ABI (that is, mips1 for 32-bit ABIs
23031 and mips3 for 64-bit ABIs).
23032
23033 The native Linux/GNU toolchain also supports the value native,
23034 which selects the best architecture option for the host processor.
23035 -march=native has no effect if GCC does not recognize the
23036 processor.
23037
23038 In processor names, a final 000 can be abbreviated as k (for
23039 example, -march=r2k). Prefixes are optional, and vr may be written
23040 r.
23041
23042 Names of the form nf2_1 refer to processors with FPUs clocked at
23043 half the rate of the core, names of the form nf1_1 refer to
23044 processors with FPUs clocked at the same rate as the core, and
23045 names of the form nf3_2 refer to processors with FPUs clocked a
23046 ratio of 3:2 with respect to the core. For compatibility reasons,
23047 nf is accepted as a synonym for nf2_1 while nx and bfx are accepted
23048 as synonyms for nf1_1.
23049
23050 GCC defines two macros based on the value of this option. The
23051 first is "_MIPS_ARCH", which gives the name of target architecture,
23052 as a string. The second has the form "_MIPS_ARCH_foo", where foo
23053 is the capitalized value of "_MIPS_ARCH". For example,
23054 -march=r2000 sets "_MIPS_ARCH" to "r2000" and defines the macro
23055 "_MIPS_ARCH_R2000".
23056
23057 Note that the "_MIPS_ARCH" macro uses the processor names given
23058 above. In other words, it has the full prefix and does not
23059 abbreviate 000 as k. In the case of from-abi, the macro names the
23060 resolved architecture (either "mips1" or "mips3"). It names the
23061 default architecture when no -march option is given.
23062
23063 -mtune=arch
23064 Optimize for arch. Among other things, this option controls the
23065 way instructions are scheduled, and the perceived cost of
23066 arithmetic operations. The list of arch values is the same as for
23067 -march.
23068
23069 When this option is not used, GCC optimizes for the processor
23070 specified by -march. By using -march and -mtune together, it is
23071 possible to generate code that runs on a family of processors, but
23072 optimize the code for one particular member of that family.
23073
23074 -mtune defines the macros "_MIPS_TUNE" and "_MIPS_TUNE_foo", which
23075 work in the same way as the -march ones described above.
23076
23077 -mips1
23078 Equivalent to -march=mips1.
23079
23080 -mips2
23081 Equivalent to -march=mips2.
23082
23083 -mips3
23084 Equivalent to -march=mips3.
23085
23086 -mips4
23087 Equivalent to -march=mips4.
23088
23089 -mips32
23090 Equivalent to -march=mips32.
23091
23092 -mips32r3
23093 Equivalent to -march=mips32r3.
23094
23095 -mips32r5
23096 Equivalent to -march=mips32r5.
23097
23098 -mips32r6
23099 Equivalent to -march=mips32r6.
23100
23101 -mips64
23102 Equivalent to -march=mips64.
23103
23104 -mips64r2
23105 Equivalent to -march=mips64r2.
23106
23107 -mips64r3
23108 Equivalent to -march=mips64r3.
23109
23110 -mips64r5
23111 Equivalent to -march=mips64r5.
23112
23113 -mips64r6
23114 Equivalent to -march=mips64r6.
23115
23116 -mips16
23117 -mno-mips16
23118 Generate (do not generate) MIPS16 code. If GCC is targeting a
23119 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE.
23120
23121 MIPS16 code generation can also be controlled on a per-function
23122 basis by means of "mips16" and "nomips16" attributes.
23123
23124 -mflip-mips16
23125 Generate MIPS16 code on alternating functions. This option is
23126 provided for regression testing of mixed MIPS16/non-MIPS16 code
23127 generation, and is not intended for ordinary use in compiling user
23128 code.
23129
23130 -minterlink-compressed
23131 -mno-interlink-compressed
23132 Require (do not require) that code using the standard
23133 (uncompressed) MIPS ISA be link-compatible with MIPS16 and
23134 microMIPS code, and vice versa.
23135
23136 For example, code using the standard ISA encoding cannot jump
23137 directly to MIPS16 or microMIPS code; it must either use a call or
23138 an indirect jump. -minterlink-compressed therefore disables direct
23139 jumps unless GCC knows that the target of the jump is not
23140 compressed.
23141
23142 -minterlink-mips16
23143 -mno-interlink-mips16
23144 Aliases of -minterlink-compressed and -mno-interlink-compressed.
23145 These options predate the microMIPS ASE and are retained for
23146 backwards compatibility.
23147
23148 -mabi=32
23149 -mabi=o64
23150 -mabi=n32
23151 -mabi=64
23152 -mabi=eabi
23153 Generate code for the given ABI.
23154
23155 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
23156 generates 64-bit code when you select a 64-bit architecture, but
23157 you can use -mgp32 to get 32-bit code instead.
23158
23159 For information about the O64 ABI, see
23160 <https://gcc.gnu.org/projects/mipso64-abi.html>.
23161
23162 GCC supports a variant of the o32 ABI in which floating-point
23163 registers are 64 rather than 32 bits wide. You can select this
23164 combination with -mabi=32 -mfp64. This ABI relies on the "mthc1"
23165 and "mfhc1" instructions and is therefore only supported for
23166 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
23167
23168 The register assignments for arguments and return values remain the
23169 same, but each scalar value is passed in a single 64-bit register
23170 rather than a pair of 32-bit registers. For example, scalar
23171 floating-point values are returned in $f0 only, not a $f0/$f1 pair.
23172 The set of call-saved registers also remains the same in that the
23173 even-numbered double-precision registers are saved.
23174
23175 Two additional variants of the o32 ABI are supported to enable a
23176 transition from 32-bit to 64-bit registers. These are FPXX
23177 (-mfpxx) and FP64A (-mfp64 -mno-odd-spreg). The FPXX extension
23178 mandates that all code must execute correctly when run using 32-bit
23179 or 64-bit registers. The code can be interlinked with either FP32
23180 or FP64, but not both. The FP64A extension is similar to the FP64
23181 extension but forbids the use of odd-numbered single-precision
23182 registers. This can be used in conjunction with the "FRE" mode of
23183 FPUs in MIPS32R5 processors and allows both FP32 and FP64A code to
23184 interlink and run in the same process without changing FPU modes.
23185
23186 -mabicalls
23187 -mno-abicalls
23188 Generate (do not generate) code that is suitable for SVR4-style
23189 dynamic objects. -mabicalls is the default for SVR4-based systems.
23190
23191 -mshared
23192 -mno-shared
23193 Generate (do not generate) code that is fully position-independent,
23194 and that can therefore be linked into shared libraries. This
23195 option only affects -mabicalls.
23196
23197 All -mabicalls code has traditionally been position-independent,
23198 regardless of options like -fPIC and -fpic. However, as an
23199 extension, the GNU toolchain allows executables to use absolute
23200 accesses for locally-binding symbols. It can also use shorter GP
23201 initialization sequences and generate direct calls to locally-
23202 defined functions. This mode is selected by -mno-shared.
23203
23204 -mno-shared depends on binutils 2.16 or higher and generates
23205 objects that can only be linked by the GNU linker. However, the
23206 option does not affect the ABI of the final executable; it only
23207 affects the ABI of relocatable objects. Using -mno-shared
23208 generally makes executables both smaller and quicker.
23209
23210 -mshared is the default.
23211
23212 -mplt
23213 -mno-plt
23214 Assume (do not assume) that the static and dynamic linkers support
23215 PLTs and copy relocations. This option only affects -mno-shared
23216 -mabicalls. For the n64 ABI, this option has no effect without
23217 -msym32.
23218
23219 You can make -mplt the default by configuring GCC with
23220 --with-mips-plt. The default is -mno-plt otherwise.
23221
23222 -mxgot
23223 -mno-xgot
23224 Lift (do not lift) the usual restrictions on the size of the global
23225 offset table.
23226
23227 GCC normally uses a single instruction to load values from the GOT.
23228 While this is relatively efficient, it only works if the GOT is
23229 smaller than about 64k. Anything larger causes the linker to
23230 report an error such as:
23231
23232 relocation truncated to fit: R_MIPS_GOT16 foobar
23233
23234 If this happens, you should recompile your code with -mxgot. This
23235 works with very large GOTs, although the code is also less
23236 efficient, since it takes three instructions to fetch the value of
23237 a global symbol.
23238
23239 Note that some linkers can create multiple GOTs. If you have such
23240 a linker, you should only need to use -mxgot when a single object
23241 file accesses more than 64k's worth of GOT entries. Very few do.
23242
23243 These options have no effect unless GCC is generating position
23244 independent code.
23245
23246 -mgp32
23247 Assume that general-purpose registers are 32 bits wide.
23248
23249 -mgp64
23250 Assume that general-purpose registers are 64 bits wide.
23251
23252 -mfp32
23253 Assume that floating-point registers are 32 bits wide.
23254
23255 -mfp64
23256 Assume that floating-point registers are 64 bits wide.
23257
23258 -mfpxx
23259 Do not assume the width of floating-point registers.
23260
23261 -mhard-float
23262 Use floating-point coprocessor instructions.
23263
23264 -msoft-float
23265 Do not use floating-point coprocessor instructions. Implement
23266 floating-point calculations using library calls instead.
23267
23268 -mno-float
23269 Equivalent to -msoft-float, but additionally asserts that the
23270 program being compiled does not perform any floating-point
23271 operations. This option is presently supported only by some bare-
23272 metal MIPS configurations, where it may select a special set of
23273 libraries that lack all floating-point support (including, for
23274 example, the floating-point "printf" formats). If code compiled
23275 with -mno-float accidentally contains floating-point operations, it
23276 is likely to suffer a link-time or run-time failure.
23277
23278 -msingle-float
23279 Assume that the floating-point coprocessor only supports single-
23280 precision operations.
23281
23282 -mdouble-float
23283 Assume that the floating-point coprocessor supports double-
23284 precision operations. This is the default.
23285
23286 -modd-spreg
23287 -mno-odd-spreg
23288 Enable the use of odd-numbered single-precision floating-point
23289 registers for the o32 ABI. This is the default for processors that
23290 are known to support these registers. When using the o32 FPXX ABI,
23291 -mno-odd-spreg is set by default.
23292
23293 -mabs=2008
23294 -mabs=legacy
23295 These options control the treatment of the special not-a-number
23296 (NaN) IEEE 754 floating-point data with the "abs.fmt" and "neg.fmt"
23297 machine instructions.
23298
23299 By default or when -mabs=legacy is used the legacy treatment is
23300 selected. In this case these instructions are considered
23301 arithmetic and avoided where correct operation is required and the
23302 input operand might be a NaN. A longer sequence of instructions
23303 that manipulate the sign bit of floating-point datum manually is
23304 used instead unless the -ffinite-math-only option has also been
23305 specified.
23306
23307 The -mabs=2008 option selects the IEEE 754-2008 treatment. In this
23308 case these instructions are considered non-arithmetic and therefore
23309 operating correctly in all cases, including in particular where the
23310 input operand is a NaN. These instructions are therefore always
23311 used for the respective operations.
23312
23313 -mnan=2008
23314 -mnan=legacy
23315 These options control the encoding of the special not-a-number
23316 (NaN) IEEE 754 floating-point data.
23317
23318 The -mnan=legacy option selects the legacy encoding. In this case
23319 quiet NaNs (qNaNs) are denoted by the first bit of their trailing
23320 significand field being 0, whereas signaling NaNs (sNaNs) are
23321 denoted by the first bit of their trailing significand field being
23322 1.
23323
23324 The -mnan=2008 option selects the IEEE 754-2008 encoding. In this
23325 case qNaNs are denoted by the first bit of their trailing
23326 significand field being 1, whereas sNaNs are denoted by the first
23327 bit of their trailing significand field being 0.
23328
23329 The default is -mnan=legacy unless GCC has been configured with
23330 --with-nan=2008.
23331
23332 -mllsc
23333 -mno-llsc
23334 Use (do not use) ll, sc, and sync instructions to implement atomic
23335 memory built-in functions. When neither option is specified, GCC
23336 uses the instructions if the target architecture supports them.
23337
23338 -mllsc is useful if the runtime environment can emulate the
23339 instructions and -mno-llsc can be useful when compiling for
23340 nonstandard ISAs. You can make either option the default by
23341 configuring GCC with --with-llsc and --without-llsc respectively.
23342 --with-llsc is the default for some configurations; see the
23343 installation documentation for details.
23344
23345 -mdsp
23346 -mno-dsp
23347 Use (do not use) revision 1 of the MIPS DSP ASE.
23348 This option defines the preprocessor macro "__mips_dsp". It also
23349 defines "__mips_dsp_rev" to 1.
23350
23351 -mdspr2
23352 -mno-dspr2
23353 Use (do not use) revision 2 of the MIPS DSP ASE.
23354 This option defines the preprocessor macros "__mips_dsp" and
23355 "__mips_dspr2". It also defines "__mips_dsp_rev" to 2.
23356
23357 -msmartmips
23358 -mno-smartmips
23359 Use (do not use) the MIPS SmartMIPS ASE.
23360
23361 -mpaired-single
23362 -mno-paired-single
23363 Use (do not use) paired-single floating-point instructions.
23364 This option requires hardware floating-point support to be
23365 enabled.
23366
23367 -mdmx
23368 -mno-mdmx
23369 Use (do not use) MIPS Digital Media Extension instructions. This
23370 option can only be used when generating 64-bit code and requires
23371 hardware floating-point support to be enabled.
23372
23373 -mips3d
23374 -mno-mips3d
23375 Use (do not use) the MIPS-3D ASE. The option -mips3d implies
23376 -mpaired-single.
23377
23378 -mmicromips
23379 -mno-micromips
23380 Generate (do not generate) microMIPS code.
23381
23382 MicroMIPS code generation can also be controlled on a per-function
23383 basis by means of "micromips" and "nomicromips" attributes.
23384
23385 -mmt
23386 -mno-mt
23387 Use (do not use) MT Multithreading instructions.
23388
23389 -mmcu
23390 -mno-mcu
23391 Use (do not use) the MIPS MCU ASE instructions.
23392
23393 -meva
23394 -mno-eva
23395 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
23396
23397 -mvirt
23398 -mno-virt
23399 Use (do not use) the MIPS Virtualization (VZ) instructions.
23400
23401 -mxpa
23402 -mno-xpa
23403 Use (do not use) the MIPS eXtended Physical Address (XPA)
23404 instructions.
23405
23406 -mcrc
23407 -mno-crc
23408 Use (do not use) the MIPS Cyclic Redundancy Check (CRC)
23409 instructions.
23410
23411 -mginv
23412 -mno-ginv
23413 Use (do not use) the MIPS Global INValidate (GINV) instructions.
23414
23415 -mloongson-mmi
23416 -mno-loongson-mmi
23417 Use (do not use) the MIPS Loongson MultiMedia extensions
23418 Instructions (MMI).
23419
23420 -mloongson-ext
23421 -mno-loongson-ext
23422 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
23423
23424 -mloongson-ext2
23425 -mno-loongson-ext2
23426 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2)
23427 instructions.
23428
23429 -mlong64
23430 Force "long" types to be 64 bits wide. See -mlong32 for an
23431 explanation of the default and the way that the pointer size is
23432 determined.
23433
23434 -mlong32
23435 Force "long", "int", and pointer types to be 32 bits wide.
23436
23437 The default size of "int"s, "long"s and pointers depends on the
23438 ABI. All the supported ABIs use 32-bit "int"s. The n64 ABI uses
23439 64-bit "long"s, as does the 64-bit EABI; the others use 32-bit
23440 "long"s. Pointers are the same size as "long"s, or the same size
23441 as integer registers, whichever is smaller.
23442
23443 -msym32
23444 -mno-sym32
23445 Assume (do not assume) that all symbols have 32-bit values,
23446 regardless of the selected ABI. This option is useful in
23447 combination with -mabi=64 and -mno-abicalls because it allows GCC
23448 to generate shorter and faster references to symbolic addresses.
23449
23450 -G num
23451 Put definitions of externally-visible data in a small data section
23452 if that data is no bigger than num bytes. GCC can then generate
23453 more efficient accesses to the data; see -mgpopt for details.
23454
23455 The default -G option depends on the configuration.
23456
23457 -mlocal-sdata
23458 -mno-local-sdata
23459 Extend (do not extend) the -G behavior to local data too, such as
23460 to static variables in C. -mlocal-sdata is the default for all
23461 configurations.
23462
23463 If the linker complains that an application is using too much small
23464 data, you might want to try rebuilding the less performance-
23465 critical parts with -mno-local-sdata. You might also want to build
23466 large libraries with -mno-local-sdata, so that the libraries leave
23467 more room for the main program.
23468
23469 -mextern-sdata
23470 -mno-extern-sdata
23471 Assume (do not assume) that externally-defined data is in a small
23472 data section if the size of that data is within the -G limit.
23473 -mextern-sdata is the default for all configurations.
23474
23475 If you compile a module Mod with -mextern-sdata -G num -mgpopt, and
23476 Mod references a variable Var that is no bigger than num bytes, you
23477 must make sure that Var is placed in a small data section. If Var
23478 is defined by another module, you must either compile that module
23479 with a high-enough -G setting or attach a "section" attribute to
23480 Var's definition. If Var is common, you must link the application
23481 with a high-enough -G setting.
23482
23483 The easiest way of satisfying these restrictions is to compile and
23484 link every module with the same -G option. However, you may wish
23485 to build a library that supports several different small data
23486 limits. You can do this by compiling the library with the highest
23487 supported -G setting and additionally using -mno-extern-sdata to
23488 stop the library from making assumptions about externally-defined
23489 data.
23490
23491 -mgpopt
23492 -mno-gpopt
23493 Use (do not use) GP-relative accesses for symbols that are known to
23494 be in a small data section; see -G, -mlocal-sdata and
23495 -mextern-sdata. -mgpopt is the default for all configurations.
23496
23497 -mno-gpopt is useful for cases where the $gp register might not
23498 hold the value of "_gp". For example, if the code is part of a
23499 library that might be used in a boot monitor, programs that call
23500 boot monitor routines pass an unknown value in $gp. (In such
23501 situations, the boot monitor itself is usually compiled with -G0.)
23502
23503 -mno-gpopt implies -mno-local-sdata and -mno-extern-sdata.
23504
23505 -membedded-data
23506 -mno-embedded-data
23507 Allocate variables to the read-only data section first if possible,
23508 then next in the small data section if possible, otherwise in data.
23509 This gives slightly slower code than the default, but reduces the
23510 amount of RAM required when executing, and thus may be preferred
23511 for some embedded systems.
23512
23513 -muninit-const-in-rodata
23514 -mno-uninit-const-in-rodata
23515 Put uninitialized "const" variables in the read-only data section.
23516 This option is only meaningful in conjunction with -membedded-data.
23517
23518 -mcode-readable=setting
23519 Specify whether GCC may generate code that reads from executable
23520 sections. There are three possible settings:
23521
23522 -mcode-readable=yes
23523 Instructions may freely access executable sections. This is
23524 the default setting.
23525
23526 -mcode-readable=pcrel
23527 MIPS16 PC-relative load instructions can access executable
23528 sections, but other instructions must not do so. This option
23529 is useful on 4KSc and 4KSd processors when the code TLBs have
23530 the Read Inhibit bit set. It is also useful on processors that
23531 can be configured to have a dual instruction/data SRAM
23532 interface and that, like the M4K, automatically redirect PC-
23533 relative loads to the instruction RAM.
23534
23535 -mcode-readable=no
23536 Instructions must not access executable sections. This option
23537 can be useful on targets that are configured to have a dual
23538 instruction/data SRAM interface but that (unlike the M4K) do
23539 not automatically redirect PC-relative loads to the instruction
23540 RAM.
23541
23542 -msplit-addresses
23543 -mno-split-addresses
23544 Enable (disable) use of the %hi() and %lo() assembler relocation
23545 operators. This option has been superseded by -mexplicit-relocs
23546 but is retained for backwards compatibility.
23547
23548 -mexplicit-relocs
23549 -mno-explicit-relocs
23550 Use (do not use) assembler relocation operators when dealing with
23551 symbolic addresses. The alternative, selected by
23552 -mno-explicit-relocs, is to use assembler macros instead.
23553
23554 -mexplicit-relocs is the default if GCC was configured to use an
23555 assembler that supports relocation operators.
23556
23557 -mcheck-zero-division
23558 -mno-check-zero-division
23559 Trap (do not trap) on integer division by zero.
23560
23561 The default is -mcheck-zero-division.
23562
23563 -mdivide-traps
23564 -mdivide-breaks
23565 MIPS systems check for division by zero by generating either a
23566 conditional trap or a break instruction. Using traps results in
23567 smaller code, but is only supported on MIPS II and later. Also,
23568 some versions of the Linux kernel have a bug that prevents trap
23569 from generating the proper signal ("SIGFPE"). Use -mdivide-traps
23570 to allow conditional traps on architectures that support them and
23571 -mdivide-breaks to force the use of breaks.
23572
23573 The default is usually -mdivide-traps, but this can be overridden
23574 at configure time using --with-divide=breaks. Divide-by-zero
23575 checks can be completely disabled using -mno-check-zero-division.
23576
23577 -mload-store-pairs
23578 -mno-load-store-pairs
23579 Enable (disable) an optimization that pairs consecutive load or
23580 store instructions to enable load/store bonding. This option is
23581 enabled by default but only takes effect when the selected
23582 architecture is known to support bonding.
23583
23584 -munaligned-access
23585 -mno-unaligned-access
23586 Enable (disable) direct unaligned access for MIPS Release 6.
23587 MIPSr6 requires load/store unaligned-access support, by hardware or
23588 trap&emulate. So -mno-unaligned-access may be needed by kernel.
23589
23590 -mmemcpy
23591 -mno-memcpy
23592 Force (do not force) the use of "memcpy" for non-trivial block
23593 moves. The default is -mno-memcpy, which allows GCC to inline most
23594 constant-sized copies.
23595
23596 -mlong-calls
23597 -mno-long-calls
23598 Disable (do not disable) use of the "jal" instruction. Calling
23599 functions using "jal" is more efficient but requires the caller and
23600 callee to be in the same 256 megabyte segment.
23601
23602 This option has no effect on abicalls code. The default is
23603 -mno-long-calls.
23604
23605 -mmad
23606 -mno-mad
23607 Enable (disable) use of the "mad", "madu" and "mul" instructions,
23608 as provided by the R4650 ISA.
23609
23610 -mimadd
23611 -mno-imadd
23612 Enable (disable) use of the "madd" and "msub" integer instructions.
23613 The default is -mimadd on architectures that support "madd" and
23614 "msub" except for the 74k architecture where it was found to
23615 generate slower code.
23616
23617 -mfused-madd
23618 -mno-fused-madd
23619 Enable (disable) use of the floating-point multiply-accumulate
23620 instructions, when they are available. The default is
23621 -mfused-madd.
23622
23623 On the R8000 CPU when multiply-accumulate instructions are used,
23624 the intermediate product is calculated to infinite precision and is
23625 not subject to the FCSR Flush to Zero bit. This may be undesirable
23626 in some circumstances. On other processors the result is
23627 numerically identical to the equivalent computation using separate
23628 multiply, add, subtract and negate instructions.
23629
23630 -nocpp
23631 Tell the MIPS assembler to not run its preprocessor over user
23632 assembler files (with a .s suffix) when assembling them.
23633
23634 -mfix-24k
23635 -mno-fix-24k
23636 Work around the 24K E48 (lost data on stores during refill) errata.
23637 The workarounds are implemented by the assembler rather than by
23638 GCC.
23639
23640 -mfix-r4000
23641 -mno-fix-r4000
23642 Work around certain R4000 CPU errata:
23643
23644 - A double-word or a variable shift may give an incorrect result
23645 if executed immediately after starting an integer division.
23646
23647 - A double-word or a variable shift may give an incorrect result
23648 if executed while an integer multiplication is in progress.
23649
23650 - An integer division may give an incorrect result if started in
23651 a delay slot of a taken branch or a jump.
23652
23653 -mfix-r4400
23654 -mno-fix-r4400
23655 Work around certain R4400 CPU errata:
23656
23657 - A double-word or a variable shift may give an incorrect result
23658 if executed immediately after starting an integer division.
23659
23660 -mfix-r10000
23661 -mno-fix-r10000
23662 Work around certain R10000 errata:
23663
23664 - "ll"/"sc" sequences may not behave atomically on revisions
23665 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
23666
23667 This option can only be used if the target architecture supports
23668 branch-likely instructions. -mfix-r10000 is the default when
23669 -march=r10000 is used; -mno-fix-r10000 is the default otherwise.
23670
23671 -mfix-r5900
23672 -mno-fix-r5900
23673 Do not attempt to schedule the preceding instruction into the delay
23674 slot of a branch instruction placed at the end of a short loop of
23675 six instructions or fewer and always schedule a "nop" instruction
23676 there instead. The short loop bug under certain conditions causes
23677 loops to execute only once or twice, due to a hardware bug in the
23678 R5900 chip. The workaround is implemented by the assembler rather
23679 than by GCC.
23680
23681 -mfix-rm7000
23682 -mno-fix-rm7000
23683 Work around the RM7000 "dmult"/"dmultu" errata. The workarounds
23684 are implemented by the assembler rather than by GCC.
23685
23686 -mfix-vr4120
23687 -mno-fix-vr4120
23688 Work around certain VR4120 errata:
23689
23690 - "dmultu" does not always produce the correct result.
23691
23692 - "div" and "ddiv" do not always produce the correct result if
23693 one of the operands is negative.
23694
23695 The workarounds for the division errata rely on special functions
23696 in libgcc.a. At present, these functions are only provided by the
23697 "mips64vr*-elf" configurations.
23698
23699 Other VR4120 errata require a NOP to be inserted between certain
23700 pairs of instructions. These errata are handled by the assembler,
23701 not by GCC itself.
23702
23703 -mfix-vr4130
23704 Work around the VR4130 "mflo"/"mfhi" errata. The workarounds are
23705 implemented by the assembler rather than by GCC, although GCC
23706 avoids using "mflo" and "mfhi" if the VR4130 "macc", "macchi",
23707 "dmacc" and "dmacchi" instructions are available instead.
23708
23709 -mfix-sb1
23710 -mno-fix-sb1
23711 Work around certain SB-1 CPU core errata. (This flag currently
23712 works around the SB-1 revision 2 "F1" and "F2" floating-point
23713 errata.)
23714
23715 -mr10k-cache-barrier=setting
23716 Specify whether GCC should insert cache barriers to avoid the side
23717 effects of speculation on R10K processors.
23718
23719 In common with many processors, the R10K tries to predict the
23720 outcome of a conditional branch and speculatively executes
23721 instructions from the "taken" branch. It later aborts these
23722 instructions if the predicted outcome is wrong. However, on the
23723 R10K, even aborted instructions can have side effects.
23724
23725 This problem only affects kernel stores and, depending on the
23726 system, kernel loads. As an example, a speculatively-executed
23727 store may load the target memory into cache and mark the cache line
23728 as dirty, even if the store itself is later aborted. If a DMA
23729 operation writes to the same area of memory before the "dirty" line
23730 is flushed, the cached data overwrites the DMA-ed data. See the
23731 R10K processor manual for a full description, including other
23732 potential problems.
23733
23734 One workaround is to insert cache barrier instructions before every
23735 memory access that might be speculatively executed and that might
23736 have side effects even if aborted. -mr10k-cache-barrier=setting
23737 controls GCC's implementation of this workaround. It assumes that
23738 aborted accesses to any byte in the following regions does not have
23739 side effects:
23740
23741 1. the memory occupied by the current function's stack frame;
23742
23743 2. the memory occupied by an incoming stack argument;
23744
23745 3. the memory occupied by an object with a link-time-constant
23746 address.
23747
23748 It is the kernel's responsibility to ensure that speculative
23749 accesses to these regions are indeed safe.
23750
23751 If the input program contains a function declaration such as:
23752
23753 void foo (void);
23754
23755 then the implementation of "foo" must allow "j foo" and "jal foo"
23756 to be executed speculatively. GCC honors this restriction for
23757 functions it compiles itself. It expects non-GCC functions (such
23758 as hand-written assembly code) to do the same.
23759
23760 The option has three forms:
23761
23762 -mr10k-cache-barrier=load-store
23763 Insert a cache barrier before a load or store that might be
23764 speculatively executed and that might have side effects even if
23765 aborted.
23766
23767 -mr10k-cache-barrier=store
23768 Insert a cache barrier before a store that might be
23769 speculatively executed and that might have side effects even if
23770 aborted.
23771
23772 -mr10k-cache-barrier=none
23773 Disable the insertion of cache barriers. This is the default
23774 setting.
23775
23776 -mflush-func=func
23777 -mno-flush-func
23778 Specifies the function to call to flush the I and D caches, or to
23779 not call any such function. If called, the function must take the
23780 same arguments as the common "_flush_func", that is, the address of
23781 the memory range for which the cache is being flushed, the size of
23782 the memory range, and the number 3 (to flush both caches). The
23783 default depends on the target GCC was configured for, but commonly
23784 is either "_flush_func" or "__cpu_flush".
23785
23786 mbranch-cost=num
23787 Set the cost of branches to roughly num "simple" instructions.
23788 This cost is only a heuristic and is not guaranteed to produce
23789 consistent results across releases. A zero cost redundantly
23790 selects the default, which is based on the -mtune setting.
23791
23792 -mbranch-likely
23793 -mno-branch-likely
23794 Enable or disable use of Branch Likely instructions, regardless of
23795 the default for the selected architecture. By default, Branch
23796 Likely instructions may be generated if they are supported by the
23797 selected architecture. An exception is for the MIPS32 and MIPS64
23798 architectures and processors that implement those architectures;
23799 for those, Branch Likely instructions are not be generated by
23800 default because the MIPS32 and MIPS64 architectures specifically
23801 deprecate their use.
23802
23803 -mcompact-branches=never
23804 -mcompact-branches=optimal
23805 -mcompact-branches=always
23806 These options control which form of branches will be generated.
23807 The default is -mcompact-branches=optimal.
23808
23809 The -mcompact-branches=never option ensures that compact branch
23810 instructions will never be generated.
23811
23812 The -mcompact-branches=always option ensures that a compact branch
23813 instruction will be generated if available for MIPS Release 6
23814 onwards. If a compact branch instruction is not available (or
23815 pre-R6), a delay slot form of the branch will be used instead.
23816
23817 If it is used for MIPS16/microMIPS targets, it will be just ignored
23818 now. The behaviour for MIPS16/microMIPS may change in future,
23819 since they do have some compact branch instructions.
23820
23821 The -mcompact-branches=optimal option will cause a delay slot
23822 branch to be used if one is available in the current ISA and the
23823 delay slot is successfully filled. If the delay slot is not
23824 filled, a compact branch will be chosen if one is available.
23825
23826 -mfp-exceptions
23827 -mno-fp-exceptions
23828 Specifies whether FP exceptions are enabled. This affects how FP
23829 instructions are scheduled for some processors. The default is
23830 that FP exceptions are enabled.
23831
23832 For instance, on the SB-1, if FP exceptions are disabled, and we
23833 are emitting 64-bit code, then we can use both FP pipes.
23834 Otherwise, we can only use one FP pipe.
23835
23836 -mvr4130-align
23837 -mno-vr4130-align
23838 The VR4130 pipeline is two-way superscalar, but can only issue two
23839 instructions together if the first one is 8-byte aligned. When
23840 this option is enabled, GCC aligns pairs of instructions that it
23841 thinks should execute in parallel.
23842
23843 This option only has an effect when optimizing for the VR4130. It
23844 normally makes code faster, but at the expense of making it bigger.
23845 It is enabled by default at optimization level -O3.
23846
23847 -msynci
23848 -mno-synci
23849 Enable (disable) generation of "synci" instructions on
23850 architectures that support it. The "synci" instructions (if
23851 enabled) are generated when "__builtin___clear_cache" is compiled.
23852
23853 This option defaults to -mno-synci, but the default can be
23854 overridden by configuring GCC with --with-synci.
23855
23856 When compiling code for single processor systems, it is generally
23857 safe to use "synci". However, on many multi-core (SMP) systems, it
23858 does not invalidate the instruction caches on all cores and may
23859 lead to undefined behavior.
23860
23861 -mrelax-pic-calls
23862 -mno-relax-pic-calls
23863 Try to turn PIC calls that are normally dispatched via register $25
23864 into direct calls. This is only possible if the linker can resolve
23865 the destination at link time and if the destination is within range
23866 for a direct call.
23867
23868 -mrelax-pic-calls is the default if GCC was configured to use an
23869 assembler and a linker that support the ".reloc" assembly directive
23870 and -mexplicit-relocs is in effect. With -mno-explicit-relocs,
23871 this optimization can be performed by the assembler and the linker
23872 alone without help from the compiler.
23873
23874 -mmcount-ra-address
23875 -mno-mcount-ra-address
23876 Emit (do not emit) code that allows "_mcount" to modify the calling
23877 function's return address. When enabled, this option extends the
23878 usual "_mcount" interface with a new ra-address parameter, which
23879 has type "intptr_t *" and is passed in register $12. "_mcount" can
23880 then modify the return address by doing both of the following:
23881
23882 * Returning the new address in register $31.
23883
23884 * Storing the new address in "*ra-address", if ra-address is
23885 nonnull.
23886
23887 The default is -mno-mcount-ra-address.
23888
23889 -mframe-header-opt
23890 -mno-frame-header-opt
23891 Enable (disable) frame header optimization in the o32 ABI. When
23892 using the o32 ABI, calling functions will allocate 16 bytes on the
23893 stack for the called function to write out register arguments.
23894 When enabled, this optimization will suppress the allocation of the
23895 frame header if it can be determined that it is unused.
23896
23897 This optimization is off by default at all optimization levels.
23898
23899 -mlxc1-sxc1
23900 -mno-lxc1-sxc1
23901 When applicable, enable (disable) the generation of "lwxc1",
23902 "swxc1", "ldxc1", "sdxc1" instructions. Enabled by default.
23903
23904 -mmadd4
23905 -mno-madd4
23906 When applicable, enable (disable) the generation of 4-operand
23907 "madd.s", "madd.d" and related instructions. Enabled by default.
23908
23909 MMIX Options
23910 These options are defined for the MMIX:
23911
23912 -mlibfuncs
23913 -mno-libfuncs
23914 Specify that intrinsic library functions are being compiled,
23915 passing all values in registers, no matter the size.
23916
23917 -mepsilon
23918 -mno-epsilon
23919 Generate floating-point comparison instructions that compare with
23920 respect to the "rE" epsilon register.
23921
23922 -mabi=mmixware
23923 -mabi=gnu
23924 Generate code that passes function parameters and return values
23925 that (in the called function) are seen as registers $0 and up, as
23926 opposed to the GNU ABI which uses global registers $231 and up.
23927
23928 -mzero-extend
23929 -mno-zero-extend
23930 When reading data from memory in sizes shorter than 64 bits, use
23931 (do not use) zero-extending load instructions by default, rather
23932 than sign-extending ones.
23933
23934 -mknuthdiv
23935 -mno-knuthdiv
23936 Make the result of a division yielding a remainder have the same
23937 sign as the divisor. With the default, -mno-knuthdiv, the sign of
23938 the remainder follows the sign of the dividend. Both methods are
23939 arithmetically valid, the latter being almost exclusively used.
23940
23941 -mtoplevel-symbols
23942 -mno-toplevel-symbols
23943 Prepend (do not prepend) a : to all global symbols, so the assembly
23944 code can be used with the "PREFIX" assembly directive.
23945
23946 -melf
23947 Generate an executable in the ELF format, rather than the default
23948 mmo format used by the mmix simulator.
23949
23950 -mbranch-predict
23951 -mno-branch-predict
23952 Use (do not use) the probable-branch instructions, when static
23953 branch prediction indicates a probable branch.
23954
23955 -mbase-addresses
23956 -mno-base-addresses
23957 Generate (do not generate) code that uses base addresses. Using a
23958 base address automatically generates a request (handled by the
23959 assembler and the linker) for a constant to be set up in a global
23960 register. The register is used for one or more base address
23961 requests within the range 0 to 255 from the value held in the
23962 register. The generally leads to short and fast code, but the
23963 number of different data items that can be addressed is limited.
23964 This means that a program that uses lots of static data may require
23965 -mno-base-addresses.
23966
23967 -msingle-exit
23968 -mno-single-exit
23969 Force (do not force) generated code to have a single exit point in
23970 each function.
23971
23972 MN10300 Options
23973 These -m options are defined for Matsushita MN10300 architectures:
23974
23975 -mmult-bug
23976 Generate code to avoid bugs in the multiply instructions for the
23977 MN10300 processors. This is the default.
23978
23979 -mno-mult-bug
23980 Do not generate code to avoid bugs in the multiply instructions for
23981 the MN10300 processors.
23982
23983 -mam33
23984 Generate code using features specific to the AM33 processor.
23985
23986 -mno-am33
23987 Do not generate code using features specific to the AM33 processor.
23988 This is the default.
23989
23990 -mam33-2
23991 Generate code using features specific to the AM33/2.0 processor.
23992
23993 -mam34
23994 Generate code using features specific to the AM34 processor.
23995
23996 -mtune=cpu-type
23997 Use the timing characteristics of the indicated CPU type when
23998 scheduling instructions. This does not change the targeted
23999 processor type. The CPU type must be one of mn10300, am33, am33-2
24000 or am34.
24001
24002 -mreturn-pointer-on-d0
24003 When generating a function that returns a pointer, return the
24004 pointer in both "a0" and "d0". Otherwise, the pointer is returned
24005 only in "a0", and attempts to call such functions without a
24006 prototype result in errors. Note that this option is on by
24007 default; use -mno-return-pointer-on-d0 to disable it.
24008
24009 -mno-crt0
24010 Do not link in the C run-time initialization object file.
24011
24012 -mrelax
24013 Indicate to the linker that it should perform a relaxation
24014 optimization pass to shorten branches, calls and absolute memory
24015 addresses. This option only has an effect when used on the command
24016 line for the final link step.
24017
24018 This option makes symbolic debugging impossible.
24019
24020 -mliw
24021 Allow the compiler to generate Long Instruction Word instructions
24022 if the target is the AM33 or later. This is the default. This
24023 option defines the preprocessor macro "__LIW__".
24024
24025 -mno-liw
24026 Do not allow the compiler to generate Long Instruction Word
24027 instructions. This option defines the preprocessor macro
24028 "__NO_LIW__".
24029
24030 -msetlb
24031 Allow the compiler to generate the SETLB and Lcc instructions if
24032 the target is the AM33 or later. This is the default. This option
24033 defines the preprocessor macro "__SETLB__".
24034
24035 -mno-setlb
24036 Do not allow the compiler to generate SETLB or Lcc instructions.
24037 This option defines the preprocessor macro "__NO_SETLB__".
24038
24039 Moxie Options
24040 -meb
24041 Generate big-endian code. This is the default for moxie-*-*
24042 configurations.
24043
24044 -mel
24045 Generate little-endian code.
24046
24047 -mmul.x
24048 Generate mul.x and umul.x instructions. This is the default for
24049 moxiebox-*-* configurations.
24050
24051 -mno-crt0
24052 Do not link in the C run-time initialization object file.
24053
24054 MSP430 Options
24055 These options are defined for the MSP430:
24056
24057 -masm-hex
24058 Force assembly output to always use hex constants. Normally such
24059 constants are signed decimals, but this option is available for
24060 testsuite and/or aesthetic purposes.
24061
24062 -mmcu=
24063 Select the MCU to target. This is used to create a C preprocessor
24064 symbol based upon the MCU name, converted to upper case and pre-
24065 and post-fixed with __. This in turn is used by the msp430.h
24066 header file to select an MCU-specific supplementary header file.
24067
24068 The option also sets the ISA to use. If the MCU name is one that
24069 is known to only support the 430 ISA then that is selected,
24070 otherwise the 430X ISA is selected. A generic MCU name of msp430
24071 can also be used to select the 430 ISA. Similarly the generic
24072 msp430x MCU name selects the 430X ISA.
24073
24074 In addition an MCU-specific linker script is added to the linker
24075 command line. The script's name is the name of the MCU with .ld
24076 appended. Thus specifying -mmcu=xxx on the gcc command line
24077 defines the C preprocessor symbol "__XXX__" and cause the linker to
24078 search for a script called xxx.ld.
24079
24080 The ISA and hardware multiply supported for the different MCUs is
24081 hard-coded into GCC. However, an external devices.csv file can be
24082 used to extend device support beyond those that have been hard-
24083 coded.
24084
24085 GCC searches for the devices.csv file using the following methods
24086 in the given precedence order, where the first method takes
24087 precendence over the second which takes precedence over the third.
24088
24089 Include path specified with "-I" and "-L"
24090 devices.csv will be searched for in each of the directories
24091 specified by include paths and linker library search paths.
24092
24093 Path specified by the environment variable MSP430_GCC_INCLUDE_DIR
24094 Define the value of the global environment variable
24095 MSP430_GCC_INCLUDE_DIR to the full path to the directory
24096 containing devices.csv, and GCC will search this directory for
24097 devices.csv. If devices.csv is found, this directory will also
24098 be registered as an include path, and linker library path.
24099 Header files and linker scripts in this directory can therefore
24100 be used without manually specifying "-I" and "-L" on the
24101 command line.
24102
24103 The msp430-elf{,bare}/include/devices directory
24104 Finally, GCC will examine msp430-elf{,bare}/include/devices
24105 from the toolchain root directory. This directory does not
24106 exist in a default installation, but if the user has created it
24107 and copied devices.csv there, then the MCU data will be read.
24108 As above, this directory will also be registered as an include
24109 path, and linker library path.
24110
24111 If none of the above search methods find devices.csv, then the
24112 hard-coded MCU data is used.
24113
24114 -mwarn-mcu
24115 -mno-warn-mcu
24116 This option enables or disables warnings about conflicts between
24117 the MCU name specified by the -mmcu option and the ISA set by the
24118 -mcpu option and/or the hardware multiply support set by the
24119 -mhwmult option. It also toggles warnings about unrecognized MCU
24120 names. This option is on by default.
24121
24122 -mcpu=
24123 Specifies the ISA to use. Accepted values are msp430, msp430x and
24124 msp430xv2. This option is deprecated. The -mmcu= option should be
24125 used to select the ISA.
24126
24127 -msim
24128 Link to the simulator runtime libraries and linker script.
24129 Overrides any scripts that would be selected by the -mmcu= option.
24130
24131 -mlarge
24132 Use large-model addressing (20-bit pointers, 20-bit "size_t").
24133
24134 -msmall
24135 Use small-model addressing (16-bit pointers, 16-bit "size_t").
24136
24137 -mrelax
24138 This option is passed to the assembler and linker, and allows the
24139 linker to perform certain optimizations that cannot be done until
24140 the final link.
24141
24142 mhwmult=
24143 Describes the type of hardware multiply supported by the target.
24144 Accepted values are none for no hardware multiply, 16bit for the
24145 original 16-bit-only multiply supported by early MCUs. 32bit for
24146 the 16/32-bit multiply supported by later MCUs and f5series for the
24147 16/32-bit multiply supported by F5-series MCUs. A value of auto
24148 can also be given. This tells GCC to deduce the hardware multiply
24149 support based upon the MCU name provided by the -mmcu option. If
24150 no -mmcu option is specified or if the MCU name is not recognized
24151 then no hardware multiply support is assumed. "auto" is the
24152 default setting.
24153
24154 Hardware multiplies are normally performed by calling a library
24155 routine. This saves space in the generated code. When compiling
24156 at -O3 or higher however the hardware multiplier is invoked inline.
24157 This makes for bigger, but faster code.
24158
24159 The hardware multiply routines disable interrupts whilst running
24160 and restore the previous interrupt state when they finish. This
24161 makes them safe to use inside interrupt handlers as well as in
24162 normal code.
24163
24164 -minrt
24165 Enable the use of a minimum runtime environment - no static
24166 initializers or constructors. This is intended for memory-
24167 constrained devices. The compiler includes special symbols in some
24168 objects that tell the linker and runtime which code fragments are
24169 required.
24170
24171 -mtiny-printf
24172 Enable reduced code size "printf" and "puts" library functions.
24173 The tiny implementations of these functions are not reentrant, so
24174 must be used with caution in multi-threaded applications.
24175
24176 Support for streams has been removed and the string to be printed
24177 will always be sent to stdout via the "write" syscall. The string
24178 is not buffered before it is sent to write.
24179
24180 This option requires Newlib Nano IO, so GCC must be configured with
24181 --enable-newlib-nano-formatted-io.
24182
24183 -mmax-inline-shift=
24184 This option takes an integer between 0 and 64 inclusive, and sets
24185 the maximum number of inline shift instructions which should be
24186 emitted to perform a shift operation by a constant amount. When
24187 this value needs to be exceeded, an mspabi helper function is used
24188 instead. The default value is 4.
24189
24190 This only affects cases where a shift by multiple positions cannot
24191 be completed with a single instruction (e.g. all shifts >1 on the
24192 430 ISA).
24193
24194 Shifts of a 32-bit value are at least twice as costly, so the value
24195 passed for this option is divided by 2 and the resulting value used
24196 instead.
24197
24198 -mcode-region=
24199 -mdata-region=
24200 These options tell the compiler where to place functions and data
24201 that do not have one of the "lower", "upper", "either" or "section"
24202 attributes. Possible values are "lower", "upper", "either" or
24203 "any". The first three behave like the corresponding attribute.
24204 The fourth possible value - "any" - is the default. It leaves
24205 placement entirely up to the linker script and how it assigns the
24206 standard sections (".text", ".data", etc) to the memory regions.
24207
24208 -msilicon-errata=
24209 This option passes on a request to assembler to enable the fixes
24210 for the named silicon errata.
24211
24212 -msilicon-errata-warn=
24213 This option passes on a request to the assembler to enable warning
24214 messages when a silicon errata might need to be applied.
24215
24216 -mwarn-devices-csv
24217 -mno-warn-devices-csv
24218 Warn if devices.csv is not found or there are problem parsing it
24219 (default: on).
24220
24221 NDS32 Options
24222 These options are defined for NDS32 implementations:
24223
24224 -mbig-endian
24225 Generate code in big-endian mode.
24226
24227 -mlittle-endian
24228 Generate code in little-endian mode.
24229
24230 -mreduced-regs
24231 Use reduced-set registers for register allocation.
24232
24233 -mfull-regs
24234 Use full-set registers for register allocation.
24235
24236 -mcmov
24237 Generate conditional move instructions.
24238
24239 -mno-cmov
24240 Do not generate conditional move instructions.
24241
24242 -mext-perf
24243 Generate performance extension instructions.
24244
24245 -mno-ext-perf
24246 Do not generate performance extension instructions.
24247
24248 -mext-perf2
24249 Generate performance extension 2 instructions.
24250
24251 -mno-ext-perf2
24252 Do not generate performance extension 2 instructions.
24253
24254 -mext-string
24255 Generate string extension instructions.
24256
24257 -mno-ext-string
24258 Do not generate string extension instructions.
24259
24260 -mv3push
24261 Generate v3 push25/pop25 instructions.
24262
24263 -mno-v3push
24264 Do not generate v3 push25/pop25 instructions.
24265
24266 -m16-bit
24267 Generate 16-bit instructions.
24268
24269 -mno-16-bit
24270 Do not generate 16-bit instructions.
24271
24272 -misr-vector-size=num
24273 Specify the size of each interrupt vector, which must be 4 or 16.
24274
24275 -mcache-block-size=num
24276 Specify the size of each cache block, which must be a power of 2
24277 between 4 and 512.
24278
24279 -march=arch
24280 Specify the name of the target architecture.
24281
24282 -mcmodel=code-model
24283 Set the code model to one of
24284
24285 small
24286 All the data and read-only data segments must be within 512KB
24287 addressing space. The text segment must be within 16MB
24288 addressing space.
24289
24290 medium
24291 The data segment must be within 512KB while the read-only data
24292 segment can be within 4GB addressing space. The text segment
24293 should be still within 16MB addressing space.
24294
24295 large
24296 All the text and data segments can be within 4GB addressing
24297 space.
24298
24299 -mctor-dtor
24300 Enable constructor/destructor feature.
24301
24302 -mrelax
24303 Guide linker to relax instructions.
24304
24305 Nios II Options
24306 These are the options defined for the Altera Nios II processor.
24307
24308 -G num
24309 Put global and static objects less than or equal to num bytes into
24310 the small data or BSS sections instead of the normal data or BSS
24311 sections. The default value of num is 8.
24312
24313 -mgpopt=option
24314 -mgpopt
24315 -mno-gpopt
24316 Generate (do not generate) GP-relative accesses. The following
24317 option names are recognized:
24318
24319 none
24320 Do not generate GP-relative accesses.
24321
24322 local
24323 Generate GP-relative accesses for small data objects that are
24324 not external, weak, or uninitialized common symbols. Also use
24325 GP-relative addressing for objects that have been explicitly
24326 placed in a small data section via a "section" attribute.
24327
24328 global
24329 As for local, but also generate GP-relative accesses for small
24330 data objects that are external, weak, or common. If you use
24331 this option, you must ensure that all parts of your program
24332 (including libraries) are compiled with the same -G setting.
24333
24334 data
24335 Generate GP-relative accesses for all data objects in the
24336 program. If you use this option, the entire data and BSS
24337 segments of your program must fit in 64K of memory and you must
24338 use an appropriate linker script to allocate them within the
24339 addressable range of the global pointer.
24340
24341 all Generate GP-relative addresses for function pointers as well as
24342 data pointers. If you use this option, the entire text, data,
24343 and BSS segments of your program must fit in 64K of memory and
24344 you must use an appropriate linker script to allocate them
24345 within the addressable range of the global pointer.
24346
24347 -mgpopt is equivalent to -mgpopt=local, and -mno-gpopt is
24348 equivalent to -mgpopt=none.
24349
24350 The default is -mgpopt except when -fpic or -fPIC is specified to
24351 generate position-independent code. Note that the Nios II ABI does
24352 not permit GP-relative accesses from shared libraries.
24353
24354 You may need to specify -mno-gpopt explicitly when building
24355 programs that include large amounts of small data, including large
24356 GOT data sections. In this case, the 16-bit offset for GP-relative
24357 addressing may not be large enough to allow access to the entire
24358 small data section.
24359
24360 -mgprel-sec=regexp
24361 This option specifies additional section names that can be accessed
24362 via GP-relative addressing. It is most useful in conjunction with
24363 "section" attributes on variable declarations and a custom linker
24364 script. The regexp is a POSIX Extended Regular Expression.
24365
24366 This option does not affect the behavior of the -G option, and the
24367 specified sections are in addition to the standard ".sdata" and
24368 ".sbss" small-data sections that are recognized by -mgpopt.
24369
24370 -mr0rel-sec=regexp
24371 This option specifies names of sections that can be accessed via a
24372 16-bit offset from "r0"; that is, in the low 32K or high 32K of the
24373 32-bit address space. It is most useful in conjunction with
24374 "section" attributes on variable declarations and a custom linker
24375 script. The regexp is a POSIX Extended Regular Expression.
24376
24377 In contrast to the use of GP-relative addressing for small data,
24378 zero-based addressing is never generated by default and there are
24379 no conventional section names used in standard linker scripts for
24380 sections in the low or high areas of memory.
24381
24382 -mel
24383 -meb
24384 Generate little-endian (default) or big-endian (experimental) code,
24385 respectively.
24386
24387 -march=arch
24388 This specifies the name of the target Nios II architecture. GCC
24389 uses this name to determine what kind of instructions it can emit
24390 when generating assembly code. Permissible names are: r1, r2.
24391
24392 The preprocessor macro "__nios2_arch__" is available to programs,
24393 with value 1 or 2, indicating the targeted ISA level.
24394
24395 -mbypass-cache
24396 -mno-bypass-cache
24397 Force all load and store instructions to always bypass cache by
24398 using I/O variants of the instructions. The default is not to
24399 bypass the cache.
24400
24401 -mno-cache-volatile
24402 -mcache-volatile
24403 Volatile memory access bypass the cache using the I/O variants of
24404 the load and store instructions. The default is not to bypass the
24405 cache.
24406
24407 -mno-fast-sw-div
24408 -mfast-sw-div
24409 Do not use table-based fast divide for small numbers. The default
24410 is to use the fast divide at -O3 and above.
24411
24412 -mno-hw-mul
24413 -mhw-mul
24414 -mno-hw-mulx
24415 -mhw-mulx
24416 -mno-hw-div
24417 -mhw-div
24418 Enable or disable emitting "mul", "mulx" and "div" family of
24419 instructions by the compiler. The default is to emit "mul" and not
24420 emit "div" and "mulx".
24421
24422 -mbmx
24423 -mno-bmx
24424 -mcdx
24425 -mno-cdx
24426 Enable or disable generation of Nios II R2 BMX (bit manipulation)
24427 and CDX (code density) instructions. Enabling these instructions
24428 also requires -march=r2. Since these instructions are optional
24429 extensions to the R2 architecture, the default is not to emit them.
24430
24431 -mcustom-insn=N
24432 -mno-custom-insn
24433 Each -mcustom-insn=N option enables use of a custom instruction
24434 with encoding N when generating code that uses insn. For example,
24435 -mcustom-fadds=253 generates custom instruction 253 for single-
24436 precision floating-point add operations instead of the default
24437 behavior of using a library call.
24438
24439 The following values of insn are supported. Except as otherwise
24440 noted, floating-point operations are expected to be implemented
24441 with normal IEEE 754 semantics and correspond directly to the C
24442 operators or the equivalent GCC built-in functions.
24443
24444 Single-precision floating point:
24445
24446 fadds, fsubs, fdivs, fmuls
24447 Binary arithmetic operations.
24448
24449 fnegs
24450 Unary negation.
24451
24452 fabss
24453 Unary absolute value.
24454
24455 fcmpeqs, fcmpges, fcmpgts, fcmples, fcmplts, fcmpnes
24456 Comparison operations.
24457
24458 fmins, fmaxs
24459 Floating-point minimum and maximum. These instructions are
24460 only generated if -ffinite-math-only is specified.
24461
24462 fsqrts
24463 Unary square root operation.
24464
24465 fcoss, fsins, ftans, fatans, fexps, flogs
24466 Floating-point trigonometric and exponential functions. These
24467 instructions are only generated if -funsafe-math-optimizations
24468 is also specified.
24469
24470 Double-precision floating point:
24471
24472 faddd, fsubd, fdivd, fmuld
24473 Binary arithmetic operations.
24474
24475 fnegd
24476 Unary negation.
24477
24478 fabsd
24479 Unary absolute value.
24480
24481 fcmpeqd, fcmpged, fcmpgtd, fcmpled, fcmpltd, fcmpned
24482 Comparison operations.
24483
24484 fmind, fmaxd
24485 Double-precision minimum and maximum. These instructions are
24486 only generated if -ffinite-math-only is specified.
24487
24488 fsqrtd
24489 Unary square root operation.
24490
24491 fcosd, fsind, ftand, fatand, fexpd, flogd
24492 Double-precision trigonometric and exponential functions.
24493 These instructions are only generated if
24494 -funsafe-math-optimizations is also specified.
24495
24496 Conversions:
24497
24498 fextsd
24499 Conversion from single precision to double precision.
24500
24501 ftruncds
24502 Conversion from double precision to single precision.
24503
24504 fixsi, fixsu, fixdi, fixdu
24505 Conversion from floating point to signed or unsigned integer
24506 types, with truncation towards zero.
24507
24508 round
24509 Conversion from single-precision floating point to signed
24510 integer, rounding to the nearest integer and ties away from
24511 zero. This corresponds to the "__builtin_lroundf" function
24512 when -fno-math-errno is used.
24513
24514 floatis, floatus, floatid, floatud
24515 Conversion from signed or unsigned integer types to floating-
24516 point types.
24517
24518 In addition, all of the following transfer instructions for
24519 internal registers X and Y must be provided to use any of the
24520 double-precision floating-point instructions. Custom instructions
24521 taking two double-precision source operands expect the first
24522 operand in the 64-bit register X. The other operand (or only
24523 operand of a unary operation) is given to the custom arithmetic
24524 instruction with the least significant half in source register src1
24525 and the most significant half in src2. A custom instruction that
24526 returns a double-precision result returns the most significant 32
24527 bits in the destination register and the other half in 32-bit
24528 register Y. GCC automatically generates the necessary code
24529 sequences to write register X and/or read register Y when double-
24530 precision floating-point instructions are used.
24531
24532 fwrx
24533 Write src1 into the least significant half of X and src2 into
24534 the most significant half of X.
24535
24536 fwry
24537 Write src1 into Y.
24538
24539 frdxhi, frdxlo
24540 Read the most or least (respectively) significant half of X and
24541 store it in dest.
24542
24543 frdy
24544 Read the value of Y and store it into dest.
24545
24546 Note that you can gain more local control over generation of Nios
24547 II custom instructions by using the target("custom-insn=N") and
24548 target("no-custom-insn") function attributes or pragmas.
24549
24550 -mcustom-fpu-cfg=name
24551 This option enables a predefined, named set of custom instruction
24552 encodings (see -mcustom-insn above). Currently, the following sets
24553 are defined:
24554
24555 -mcustom-fpu-cfg=60-1 is equivalent to: -mcustom-fmuls=252
24556 -mcustom-fadds=253 -mcustom-fsubs=254 -fsingle-precision-constant
24557
24558 -mcustom-fpu-cfg=60-2 is equivalent to: -mcustom-fmuls=252
24559 -mcustom-fadds=253 -mcustom-fsubs=254 -mcustom-fdivs=255
24560 -fsingle-precision-constant
24561
24562 -mcustom-fpu-cfg=72-3 is equivalent to: -mcustom-floatus=243
24563 -mcustom-fixsi=244 -mcustom-floatis=245 -mcustom-fcmpgts=246
24564 -mcustom-fcmples=249 -mcustom-fcmpeqs=250 -mcustom-fcmpnes=251
24565 -mcustom-fmuls=252 -mcustom-fadds=253 -mcustom-fsubs=254
24566 -mcustom-fdivs=255 -fsingle-precision-constant
24567
24568 -mcustom-fpu-cfg=fph2 is equivalent to: -mcustom-fabss=224
24569 -mcustom-fnegs=225 -mcustom-fcmpnes=226 -mcustom-fcmpeqs=227
24570 -mcustom-fcmpges=228 -mcustom-fcmpgts=229 -mcustom-fcmples=230
24571 -mcustom-fcmplts=231 -mcustom-fmaxs=232 -mcustom-fmins=233
24572 -mcustom-round=248 -mcustom-fixsi=249 -mcustom-floatis=250
24573 -mcustom-fsqrts=251 -mcustom-fmuls=252 -mcustom-fadds=253
24574 -mcustom-fsubs=254 -mcustom-fdivs=255
24575
24576 Custom instruction assignments given by individual -mcustom-insn=
24577 options override those given by -mcustom-fpu-cfg=, regardless of
24578 the order of the options on the command line.
24579
24580 Note that you can gain more local control over selection of a FPU
24581 configuration by using the target("custom-fpu-cfg=name") function
24582 attribute or pragma.
24583
24584 The name fph2 is an abbreviation for Nios II Floating Point
24585 Hardware 2 Component. Please note that the custom instructions
24586 enabled by -mcustom-fmins=233 and -mcustom-fmaxs=234 are only
24587 generated if -ffinite-math-only is specified. The custom
24588 instruction enabled by -mcustom-round=248 is only generated if
24589 -fno-math-errno is specified. In contrast to the other
24590 configurations, -fsingle-precision-constant is not set.
24591
24592 These additional -m options are available for the Altera Nios II ELF
24593 (bare-metal) target:
24594
24595 -mhal
24596 Link with HAL BSP. This suppresses linking with the GCC-provided C
24597 runtime startup and termination code, and is typically used in
24598 conjunction with -msys-crt0= to specify the location of the
24599 alternate startup code provided by the HAL BSP.
24600
24601 -msmallc
24602 Link with a limited version of the C library, -lsmallc, rather than
24603 Newlib.
24604
24605 -msys-crt0=startfile
24606 startfile is the file name of the startfile (crt0) to use when
24607 linking. This option is only useful in conjunction with -mhal.
24608
24609 -msys-lib=systemlib
24610 systemlib is the library name of the library that provides low-
24611 level system calls required by the C library, e.g. "read" and
24612 "write". This option is typically used to link with a library
24613 provided by a HAL BSP.
24614
24615 Nvidia PTX Options
24616 These options are defined for Nvidia PTX:
24617
24618 -m64
24619 Ignored, but preserved for backward compatibility. Only 64-bit ABI
24620 is supported.
24621
24622 -march=architecture-string
24623 Generate code for the specified PTX ISA target architecture (e.g.
24624 sm_35). Valid architecture strings are sm_30, sm_35, sm_53, sm_70,
24625 sm_75 and sm_80. The default depends on how the compiler has been
24626 configured, see --with-arch.
24627
24628 This option sets the value of the preprocessor macro "__PTX_SM__";
24629 for instance, for sm_35, it has the value 350.
24630
24631 -misa=architecture-string
24632 Alias of -march=.
24633
24634 -march-map=architecture-string
24635 Select the closest available -march= value that is not more
24636 capable. For instance, for -march-map=sm_50 select -march=sm_35,
24637 and for -march-map=sm_53 select -march=sm_53.
24638
24639 -mptx=version-string
24640 Generate code for the specified PTX ISA version (e.g. 7.0). Valid
24641 version strings include 3.1, 6.0, 6.3, and 7.0. The default PTX
24642 ISA version is 6.0, unless a higher version is required for
24643 specified PTX ISA target architecture via option -march=.
24644
24645 This option sets the values of the preprocessor macros
24646 "__PTX_ISA_VERSION_MAJOR__" and "__PTX_ISA_VERSION_MINOR__"; for
24647 instance, for 3.1 the macros have the values 3 and 1, respectively.
24648
24649 -mmainkernel
24650 Link in code for a __main kernel. This is for stand-alone instead
24651 of offloading execution.
24652
24653 -moptimize
24654 Apply partitioned execution optimizations. This is the default
24655 when any level of optimization is selected.
24656
24657 -msoft-stack
24658 Generate code that does not use ".local" memory directly for stack
24659 storage. Instead, a per-warp stack pointer is maintained
24660 explicitly. This enables variable-length stack allocation (with
24661 variable-length arrays or "alloca"), and when global memory is used
24662 for underlying storage, makes it possible to access automatic
24663 variables from other threads, or with atomic instructions. This
24664 code generation variant is used for OpenMP offloading, but the
24665 option is exposed on its own for the purpose of testing the
24666 compiler; to generate code suitable for linking into programs using
24667 OpenMP offloading, use option -mgomp.
24668
24669 -muniform-simt
24670 Switch to code generation variant that allows to execute all
24671 threads in each warp, while maintaining memory state and side
24672 effects as if only one thread in each warp was active outside of
24673 OpenMP SIMD regions. All atomic operations and calls to runtime
24674 (malloc, free, vprintf) are conditionally executed (iff current
24675 lane index equals the master lane index), and the register being
24676 assigned is copied via a shuffle instruction from the master lane.
24677 Outside of SIMD regions lane 0 is the master; inside, each thread
24678 sees itself as the master. Shared memory array "int __nvptx_uni[]"
24679 stores all-zeros or all-ones bitmasks for each warp, indicating
24680 current mode (0 outside of SIMD regions). Each thread can bitwise-
24681 and the bitmask at position "tid.y" with current lane index to
24682 compute the master lane index.
24683
24684 -mgomp
24685 Generate code for use in OpenMP offloading: enables -msoft-stack
24686 and -muniform-simt options, and selects corresponding multilib
24687 variant.
24688
24689 OpenRISC Options
24690 These options are defined for OpenRISC:
24691
24692 -mboard=name
24693 Configure a board specific runtime. This will be passed to the
24694 linker for newlib board library linking. The default is "or1ksim".
24695
24696 -mnewlib
24697 This option is ignored; it is for compatibility purposes only.
24698 This used to select linker and preprocessor options for use with
24699 newlib.
24700
24701 -msoft-div
24702 -mhard-div
24703 Select software or hardware divide ("l.div", "l.divu")
24704 instructions. This default is hardware divide.
24705
24706 -msoft-mul
24707 -mhard-mul
24708 Select software or hardware multiply ("l.mul", "l.muli")
24709 instructions. This default is hardware multiply.
24710
24711 -msoft-float
24712 -mhard-float
24713 Select software or hardware for floating point operations. The
24714 default is software.
24715
24716 -mdouble-float
24717 When -mhard-float is selected, enables generation of double-
24718 precision floating point instructions. By default functions from
24719 libgcc are used to perform double-precision floating point
24720 operations.
24721
24722 -munordered-float
24723 When -mhard-float is selected, enables generation of unordered
24724 floating point compare and set flag ("lf.sfun*") instructions. By
24725 default functions from libgcc are used to perform unordered
24726 floating point compare and set flag operations.
24727
24728 -mcmov
24729 Enable generation of conditional move ("l.cmov") instructions. By
24730 default the equivalent will be generated using set and branch.
24731
24732 -mror
24733 Enable generation of rotate right ("l.ror") instructions. By
24734 default functions from libgcc are used to perform rotate right
24735 operations.
24736
24737 -mrori
24738 Enable generation of rotate right with immediate ("l.rori")
24739 instructions. By default functions from libgcc are used to perform
24740 rotate right with immediate operations.
24741
24742 -msext
24743 Enable generation of sign extension ("l.ext*") instructions. By
24744 default memory loads are used to perform sign extension.
24745
24746 -msfimm
24747 Enable generation of compare and set flag with immediate ("l.sf*i")
24748 instructions. By default extra instructions will be generated to
24749 store the immediate to a register first.
24750
24751 -mshftimm
24752 Enable generation of shift with immediate ("l.srai", "l.srli",
24753 "l.slli") instructions. By default extra instructions will be
24754 generated to store the immediate to a register first.
24755
24756 -mcmodel=small
24757 Generate OpenRISC code for the small model: The GOT is limited to
24758 64k. This is the default model.
24759
24760 -mcmodel=large
24761 Generate OpenRISC code for the large model: The GOT may grow up to
24762 4G in size.
24763
24764 PDP-11 Options
24765 These options are defined for the PDP-11:
24766
24767 -mfpu
24768 Use hardware FPP floating point. This is the default. (FIS
24769 floating point on the PDP-11/40 is not supported.) Implies -m45.
24770
24771 -msoft-float
24772 Do not use hardware floating point.
24773
24774 -mac0
24775 Return floating-point results in ac0 (fr0 in Unix assembler
24776 syntax).
24777
24778 -mno-ac0
24779 Return floating-point results in memory. This is the default.
24780
24781 -m40
24782 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
24783
24784 -m45
24785 Generate code for a PDP-11/45. This is the default.
24786
24787 -m10
24788 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
24789
24790 -mint16
24791 -mno-int32
24792 Use 16-bit "int". This is the default.
24793
24794 -mint32
24795 -mno-int16
24796 Use 32-bit "int".
24797
24798 -msplit
24799 Target has split instruction and data space. Implies -m45.
24800
24801 -munix-asm
24802 Use Unix assembler syntax.
24803
24804 -mdec-asm
24805 Use DEC assembler syntax.
24806
24807 -mgnu-asm
24808 Use GNU assembler syntax. This is the default.
24809
24810 -mlra
24811 Use the new LRA register allocator. By default, the old "reload"
24812 allocator is used.
24813
24814 PowerPC Options
24815 These are listed under
24816
24817 PRU Options
24818 These command-line options are defined for PRU target:
24819
24820 -minrt
24821 Link with a minimum runtime environment, with no support for static
24822 initializers and constructors. Using this option can significantly
24823 reduce the size of the final ELF binary. Beware that the compiler
24824 could still generate code with static initializers and
24825 constructors. It is up to the programmer to ensure that the source
24826 program will not use those features.
24827
24828 -mmcu=mcu
24829 Specify the PRU MCU variant to use. Check Newlib for the exact
24830 list of supported MCUs.
24831
24832 -mno-relax
24833 Make GCC pass the --no-relax command-line option to the linker
24834 instead of the --relax option.
24835
24836 -mloop
24837 Allow (or do not allow) GCC to use the LOOP instruction.
24838
24839 -mabi=variant
24840 Specify the ABI variant to output code for. -mabi=ti selects the
24841 unmodified TI ABI while -mabi=gnu selects a GNU variant that copes
24842 more naturally with certain GCC assumptions. These are the
24843 differences:
24844
24845 Function Pointer Size
24846 TI ABI specifies that function (code) pointers are 16-bit,
24847 whereas GNU supports only 32-bit data and code pointers.
24848
24849 Optional Return Value Pointer
24850 Function return values larger than 64 bits are passed by using
24851 a hidden pointer as the first argument of the function. TI
24852 ABI, though, mandates that the pointer can be NULL in case the
24853 caller is not using the returned value. GNU always passes and
24854 expects a valid return value pointer.
24855
24856 The current -mabi=ti implementation simply raises a compile error
24857 when any of the above code constructs is detected. As a
24858 consequence the standard C library cannot be built and it is
24859 omitted when linking with -mabi=ti.
24860
24861 Relaxation is a GNU feature and for safety reasons is disabled when
24862 using -mabi=ti. The TI toolchain does not emit relocations for
24863 QBBx instructions, so the GNU linker cannot adjust them when
24864 shortening adjacent LDI32 pseudo instructions.
24865
24866 RISC-V Options
24867 These command-line options are defined for RISC-V targets:
24868
24869 -mbranch-cost=n
24870 Set the cost of branches to roughly n instructions.
24871
24872 -mplt
24873 -mno-plt
24874 When generating PIC code, do or don't allow the use of PLTs.
24875 Ignored for non-PIC. The default is -mplt.
24876
24877 -mabi=ABI-string
24878 Specify integer and floating-point calling convention. ABI-string
24879 contains two parts: the size of integer types and the registers
24880 used for floating-point types. For example -march=rv64ifd
24881 -mabi=lp64d means that long and pointers are 64-bit (implicitly
24882 defining int to be 32-bit), and that floating-point values up to 64
24883 bits wide are passed in F registers. Contrast this with
24884 -march=rv64ifd -mabi=lp64f, which still allows the compiler to
24885 generate code that uses the F and D extensions but only allows
24886 floating-point values up to 32 bits long to be passed in registers;
24887 or -march=rv64ifd -mabi=lp64, in which no floating-point arguments
24888 will be passed in registers.
24889
24890 The default for this argument is system dependent, users who want a
24891 specific calling convention should specify one explicitly. The
24892 valid calling conventions are: ilp32, ilp32f, ilp32d, lp64, lp64f,
24893 and lp64d. Some calling conventions are impossible to implement on
24894 some ISAs: for example, -march=rv32if -mabi=ilp32d is invalid
24895 because the ABI requires 64-bit values be passed in F registers,
24896 but F registers are only 32 bits wide. There is also the ilp32e
24897 ABI that can only be used with the rv32e architecture. This ABI is
24898 not well specified at present, and is subject to change.
24899
24900 -mfdiv
24901 -mno-fdiv
24902 Do or don't use hardware floating-point divide and square root
24903 instructions. This requires the F or D extensions for floating-
24904 point registers. The default is to use them if the specified
24905 architecture has these instructions.
24906
24907 -mdiv
24908 -mno-div
24909 Do or don't use hardware instructions for integer division. This
24910 requires the M extension. The default is to use them if the
24911 specified architecture has these instructions.
24912
24913 -misa-spec=ISA-spec-string
24914 Specify the version of the RISC-V Unprivileged (formerly User-
24915 Level) ISA specification to produce code conforming to. The
24916 possibilities for ISA-spec-string are:
24917
24918 2.2 Produce code conforming to version 2.2.
24919
24920 20190608
24921 Produce code conforming to version 20190608.
24922
24923 20191213
24924 Produce code conforming to version 20191213.
24925
24926 The default is -misa-spec=20191213 unless GCC has been configured
24927 with --with-isa-spec= specifying a different default version.
24928
24929 -march=ISA-string
24930 Generate code for given RISC-V ISA (e.g. rv64im). ISA strings must
24931 be lower-case. Examples include rv64i, rv32g, rv32e, and rv32imaf.
24932
24933 When -march= is not specified, use the setting from -mcpu.
24934
24935 If both -march and -mcpu= are not specified, the default for this
24936 argument is system dependent, users who want a specific
24937 architecture extensions should specify one explicitly.
24938
24939 -mcpu=processor-string
24940 Use architecture of and optimize the output for the given
24941 processor, specified by particular CPU name. Permissible values
24942 for this option are: sifive-e20, sifive-e21, sifive-e24,
24943 sifive-e31, sifive-e34, sifive-e76, sifive-s21, sifive-s51,
24944 sifive-s54, sifive-s76, sifive-u54, and sifive-u74.
24945
24946 -mtune=processor-string
24947 Optimize the output for the given processor, specified by
24948 microarchitecture or particular CPU name. Permissible values for
24949 this option are: rocket, sifive-3-series, sifive-5-series,
24950 sifive-7-series, thead-c906, size, and all valid options for
24951 -mcpu=.
24952
24953 When -mtune= is not specified, use the setting from -mcpu, the
24954 default is rocket if both are not specified.
24955
24956 The size choice is not intended for use by end-users. This is used
24957 when -Os is specified. It overrides the instruction cost info
24958 provided by -mtune=, but does not override the pipeline info. This
24959 helps reduce code size while still giving good performance.
24960
24961 -mpreferred-stack-boundary=num
24962 Attempt to keep the stack boundary aligned to a 2 raised to num
24963 byte boundary. If -mpreferred-stack-boundary is not specified, the
24964 default is 4 (16 bytes or 128-bits).
24965
24966 Warning: If you use this switch, then you must build all modules
24967 with the same value, including any libraries. This includes the
24968 system libraries and startup modules.
24969
24970 -msmall-data-limit=n
24971 Put global and static data smaller than n bytes into a special
24972 section (on some targets).
24973
24974 -msave-restore
24975 -mno-save-restore
24976 Do or don't use smaller but slower prologue and epilogue code that
24977 uses library function calls. The default is to use fast inline
24978 prologues and epilogues.
24979
24980 -minline-atomics
24981 -mno-inline-atomics
24982 Do or don't use smaller but slower subword atomic emulation code
24983 that uses libatomic function calls. The default is to use fast
24984 inline subword atomics that do not require libatomic.
24985
24986 -mshorten-memrefs
24987 -mno-shorten-memrefs
24988 Do or do not attempt to make more use of compressed load/store
24989 instructions by replacing a load/store of 'base register + large
24990 offset' with a new load/store of 'new base + small offset'. If the
24991 new base gets stored in a compressed register, then the new
24992 load/store can be compressed. Currently targets 32-bit integer
24993 load/stores only.
24994
24995 -mstrict-align
24996 -mno-strict-align
24997 Do not or do generate unaligned memory accesses. The default is
24998 set depending on whether the processor we are optimizing for
24999 supports fast unaligned access or not.
25000
25001 -mcmodel=medlow
25002 Generate code for the medium-low code model. The program and its
25003 statically defined symbols must lie within a single 2 GiB address
25004 range and must lie between absolute addresses -2 GiB and +2 GiB.
25005 Programs can be statically or dynamically linked. This is the
25006 default code model.
25007
25008 -mcmodel=medany
25009 Generate code for the medium-any code model. The program and its
25010 statically defined symbols must be within any single 2 GiB address
25011 range. Programs can be statically or dynamically linked.
25012
25013 The code generated by the medium-any code model is position-
25014 independent, but is not guaranteed to function correctly when
25015 linked into position-independent executables or libraries.
25016
25017 -mexplicit-relocs
25018 -mno-exlicit-relocs
25019 Use or do not use assembler relocation operators when dealing with
25020 symbolic addresses. The alternative is to use assembler macros
25021 instead, which may limit optimization.
25022
25023 -mrelax
25024 -mno-relax
25025 Take advantage of linker relaxations to reduce the number of
25026 instructions required to materialize symbol addresses. The default
25027 is to take advantage of linker relaxations.
25028
25029 -mriscv-attribute
25030 -mno-riscv-attribute
25031 Emit (do not emit) RISC-V attribute to record extra information
25032 into ELF objects. This feature requires at least binutils 2.32.
25033
25034 -mcsr-check
25035 -mno-csr-check
25036 Enables or disables the CSR checking.
25037
25038 -malign-data=type
25039 Control how GCC aligns variables and constants of array, structure,
25040 or union types. Supported values for type are xlen which uses x
25041 register width as the alignment value, and natural which uses
25042 natural alignment. xlen is the default.
25043
25044 -mbig-endian
25045 Generate big-endian code. This is the default when GCC is
25046 configured for a riscv64be-*-* or riscv32be-*-* target.
25047
25048 -mlittle-endian
25049 Generate little-endian code. This is the default when GCC is
25050 configured for a riscv64-*-* or riscv32-*-* but not a riscv64be-*-*
25051 or riscv32be-*-* target.
25052
25053 -mstack-protector-guard=guard
25054 -mstack-protector-guard-reg=reg
25055 -mstack-protector-guard-offset=offset
25056 Generate stack protection code using canary at guard. Supported
25057 locations are global for a global canary or tls for per-thread
25058 canary in the TLS block.
25059
25060 With the latter choice the options -mstack-protector-guard-reg=reg
25061 and -mstack-protector-guard-offset=offset furthermore specify which
25062 register to use as base register for reading the canary, and from
25063 what offset from that base register. There is no default register
25064 or offset as this is entirely for use within the Linux kernel.
25065
25066 RL78 Options
25067 -msim
25068 Links in additional target libraries to support operation within a
25069 simulator.
25070
25071 -mmul=none
25072 -mmul=g10
25073 -mmul=g13
25074 -mmul=g14
25075 -mmul=rl78
25076 Specifies the type of hardware multiplication and division support
25077 to be used. The simplest is "none", which uses software for both
25078 multiplication and division. This is the default. The "g13" value
25079 is for the hardware multiply/divide peripheral found on the
25080 RL78/G13 (S2 core) targets. The "g14" value selects the use of the
25081 multiplication and division instructions supported by the RL78/G14
25082 (S3 core) parts. The value "rl78" is an alias for "g14" and the
25083 value "mg10" is an alias for "none".
25084
25085 In addition a C preprocessor macro is defined, based upon the
25086 setting of this option. Possible values are: "__RL78_MUL_NONE__",
25087 "__RL78_MUL_G13__" or "__RL78_MUL_G14__".
25088
25089 -mcpu=g10
25090 -mcpu=g13
25091 -mcpu=g14
25092 -mcpu=rl78
25093 Specifies the RL78 core to target. The default is the G14 core,
25094 also known as an S3 core or just RL78. The G13 or S2 core does not
25095 have multiply or divide instructions, instead it uses a hardware
25096 peripheral for these operations. The G10 or S1 core does not have
25097 register banks, so it uses a different calling convention.
25098
25099 If this option is set it also selects the type of hardware multiply
25100 support to use, unless this is overridden by an explicit -mmul=none
25101 option on the command line. Thus specifying -mcpu=g13 enables the
25102 use of the G13 hardware multiply peripheral and specifying
25103 -mcpu=g10 disables the use of hardware multiplications altogether.
25104
25105 Note, although the RL78/G14 core is the default target, specifying
25106 -mcpu=g14 or -mcpu=rl78 on the command line does change the
25107 behavior of the toolchain since it also enables G14 hardware
25108 multiply support. If these options are not specified on the
25109 command line then software multiplication routines will be used
25110 even though the code targets the RL78 core. This is for backwards
25111 compatibility with older toolchains which did not have hardware
25112 multiply and divide support.
25113
25114 In addition a C preprocessor macro is defined, based upon the
25115 setting of this option. Possible values are: "__RL78_G10__",
25116 "__RL78_G13__" or "__RL78_G14__".
25117
25118 -mg10
25119 -mg13
25120 -mg14
25121 -mrl78
25122 These are aliases for the corresponding -mcpu= option. They are
25123 provided for backwards compatibility.
25124
25125 -mallregs
25126 Allow the compiler to use all of the available registers. By
25127 default registers "r24..r31" are reserved for use in interrupt
25128 handlers. With this option enabled these registers can be used in
25129 ordinary functions as well.
25130
25131 -m64bit-doubles
25132 -m32bit-doubles
25133 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
25134 (-m32bit-doubles) in size. The default is -m32bit-doubles.
25135
25136 -msave-mduc-in-interrupts
25137 -mno-save-mduc-in-interrupts
25138 Specifies that interrupt handler functions should preserve the MDUC
25139 registers. This is only necessary if normal code might use the
25140 MDUC registers, for example because it performs multiplication and
25141 division operations. The default is to ignore the MDUC registers
25142 as this makes the interrupt handlers faster. The target option
25143 -mg13 needs to be passed for this to work as this feature is only
25144 available on the G13 target (S2 core). The MDUC registers will
25145 only be saved if the interrupt handler performs a multiplication or
25146 division operation or it calls another function.
25147
25148 IBM RS/6000 and PowerPC Options
25149 These -m options are defined for the IBM RS/6000 and PowerPC:
25150
25151 -mpowerpc-gpopt
25152 -mno-powerpc-gpopt
25153 -mpowerpc-gfxopt
25154 -mno-powerpc-gfxopt
25155 -mpowerpc64
25156 -mno-powerpc64
25157 -mmfcrf
25158 -mno-mfcrf
25159 -mpopcntb
25160 -mno-popcntb
25161 -mpopcntd
25162 -mno-popcntd
25163 -mfprnd
25164 -mno-fprnd
25165 -mcmpb
25166 -mno-cmpb
25167 -mhard-dfp
25168 -mno-hard-dfp
25169 You use these options to specify which instructions are available
25170 on the processor you are using. The default value of these options
25171 is determined when configuring GCC. Specifying the -mcpu=cpu_type
25172 overrides the specification of these options. We recommend you use
25173 the -mcpu=cpu_type option rather than the options listed above.
25174
25175 Specifying -mpowerpc-gpopt allows GCC to use the optional PowerPC
25176 architecture instructions in the General Purpose group, including
25177 floating-point square root. Specifying -mpowerpc-gfxopt allows GCC
25178 to use the optional PowerPC architecture instructions in the
25179 Graphics group, including floating-point select.
25180
25181 The -mmfcrf option allows GCC to generate the move from condition
25182 register field instruction implemented on the POWER4 processor and
25183 other processors that support the PowerPC V2.01 architecture. The
25184 -mpopcntb option allows GCC to generate the popcount and double-
25185 precision FP reciprocal estimate instruction implemented on the
25186 POWER5 processor and other processors that support the PowerPC
25187 V2.02 architecture. The -mpopcntd option allows GCC to generate
25188 the popcount instruction implemented on the POWER7 processor and
25189 other processors that support the PowerPC V2.06 architecture. The
25190 -mfprnd option allows GCC to generate the FP round to integer
25191 instructions implemented on the POWER5+ processor and other
25192 processors that support the PowerPC V2.03 architecture. The -mcmpb
25193 option allows GCC to generate the compare bytes instruction
25194 implemented on the POWER6 processor and other processors that
25195 support the PowerPC V2.05 architecture. The -mhard-dfp option
25196 allows GCC to generate the decimal floating-point instructions
25197 implemented on some POWER processors.
25198
25199 The -mpowerpc64 option allows GCC to generate the additional 64-bit
25200 instructions that are found in the full PowerPC64 architecture and
25201 to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
25202 -mno-powerpc64.
25203
25204 -mcpu=cpu_type
25205 Set architecture type, register usage, and instruction scheduling
25206 parameters for machine type cpu_type. Supported values for
25207 cpu_type are 401, 403, 405, 405fp, 440, 440fp, 464, 464fp, 476,
25208 476fp, 505, 601, 602, 603, 603e, 604, 604e, 620, 630, 740, 7400,
25209 7450, 750, 801, 821, 823, 860, 970, 8540, a2, e300c2, e300c3,
25210 e500mc, e500mc64, e5500, e6500, ec603e, G3, G4, G5, titan, power3,
25211 power4, power5, power5+, power6, power6x, power7, power8, power9,
25212 power10, powerpc, powerpc64, powerpc64le, rs64, and native.
25213
25214 -mcpu=powerpc, -mcpu=powerpc64, and -mcpu=powerpc64le specify pure
25215 32-bit PowerPC (either endian), 64-bit big endian PowerPC and
25216 64-bit little endian PowerPC architecture machine types, with an
25217 appropriate, generic processor model assumed for scheduling
25218 purposes.
25219
25220 Specifying native as cpu type detects and selects the architecture
25221 option that corresponds to the host processor of the system
25222 performing the compilation. -mcpu=native has no effect if GCC does
25223 not recognize the processor.
25224
25225 The other options specify a specific processor. Code generated
25226 under those options runs best on that processor, and may not run at
25227 all on others.
25228
25229 The -mcpu options automatically enable or disable the following
25230 options:
25231
25232 -maltivec -mfprnd -mhard-float -mmfcrf -mmultiple -mpopcntb
25233 -mpopcntd -mpowerpc64 -mpowerpc-gpopt -mpowerpc-gfxopt -mmulhw
25234 -mdlmzb -mmfpgpr -mvsx -mcrypto -mhtm -mpower8-fusion
25235 -mpower8-vector -mquad-memory -mquad-memory-atomic -mfloat128
25236 -mfloat128-hardware -mprefixed -mpcrel -mmma -mrop-protect
25237
25238 The particular options set for any particular CPU varies between
25239 compiler versions, depending on what setting seems to produce
25240 optimal code for that CPU; it doesn't necessarily reflect the
25241 actual hardware's capabilities. If you wish to set an individual
25242 option to a particular value, you may specify it after the -mcpu
25243 option, like -mcpu=970 -mno-altivec.
25244
25245 On AIX, the -maltivec and -mpowerpc64 options are not enabled or
25246 disabled by the -mcpu option at present because AIX does not have
25247 full support for these options. You may still enable or disable
25248 them individually if you're sure it'll work in your environment.
25249
25250 -mtune=cpu_type
25251 Set the instruction scheduling parameters for machine type
25252 cpu_type, but do not set the architecture type or register usage,
25253 as -mcpu=cpu_type does. The same values for cpu_type are used for
25254 -mtune as for -mcpu. If both are specified, the code generated
25255 uses the architecture and registers set by -mcpu, but the
25256 scheduling parameters set by -mtune.
25257
25258 -mcmodel=small
25259 Generate PowerPC64 code for the small model: The TOC is limited to
25260 64k.
25261
25262 -mcmodel=medium
25263 Generate PowerPC64 code for the medium model: The TOC and other
25264 static data may be up to a total of 4G in size. This is the
25265 default for 64-bit Linux.
25266
25267 -mcmodel=large
25268 Generate PowerPC64 code for the large model: The TOC may be up to
25269 4G in size. Other data and code is only limited by the 64-bit
25270 address space.
25271
25272 -maltivec
25273 -mno-altivec
25274 Generate code that uses (does not use) AltiVec instructions, and
25275 also enable the use of built-in functions that allow more direct
25276 access to the AltiVec instruction set. You may also need to set
25277 -mabi=altivec to adjust the current ABI with AltiVec ABI
25278 enhancements.
25279
25280 When -maltivec is used, the element order for AltiVec intrinsics
25281 such as "vec_splat", "vec_extract", and "vec_insert" match array
25282 element order corresponding to the endianness of the target. That
25283 is, element zero identifies the leftmost element in a vector
25284 register when targeting a big-endian platform, and identifies the
25285 rightmost element in a vector register when targeting a little-
25286 endian platform.
25287
25288 -mvrsave
25289 -mno-vrsave
25290 Generate VRSAVE instructions when generating AltiVec code.
25291
25292 -msecure-plt
25293 Generate code that allows ld and ld.so to build executables and
25294 shared libraries with non-executable ".plt" and ".got" sections.
25295 This is a PowerPC 32-bit SYSV ABI option.
25296
25297 -mbss-plt
25298 Generate code that uses a BSS ".plt" section that ld.so fills in,
25299 and requires ".plt" and ".got" sections that are both writable and
25300 executable. This is a PowerPC 32-bit SYSV ABI option.
25301
25302 -misel
25303 -mno-isel
25304 This switch enables or disables the generation of ISEL
25305 instructions.
25306
25307 -mvsx
25308 -mno-vsx
25309 Generate code that uses (does not use) vector/scalar (VSX)
25310 instructions, and also enable the use of built-in functions that
25311 allow more direct access to the VSX instruction set.
25312
25313 -mcrypto
25314 -mno-crypto
25315 Enable the use (disable) of the built-in functions that allow
25316 direct access to the cryptographic instructions that were added in
25317 version 2.07 of the PowerPC ISA.
25318
25319 -mhtm
25320 -mno-htm
25321 Enable (disable) the use of the built-in functions that allow
25322 direct access to the Hardware Transactional Memory (HTM)
25323 instructions that were added in version 2.07 of the PowerPC ISA.
25324
25325 -mpower8-fusion
25326 -mno-power8-fusion
25327 Generate code that keeps (does not keeps) some integer operations
25328 adjacent so that the instructions can be fused together on power8
25329 and later processors.
25330
25331 -mpower8-vector
25332 -mno-power8-vector
25333 Generate code that uses (does not use) the vector and scalar
25334 instructions that were added in version 2.07 of the PowerPC ISA.
25335 Also enable the use of built-in functions that allow more direct
25336 access to the vector instructions.
25337
25338 -mquad-memory
25339 -mno-quad-memory
25340 Generate code that uses (does not use) the non-atomic quad word
25341 memory instructions. The -mquad-memory option requires use of
25342 64-bit mode.
25343
25344 -mquad-memory-atomic
25345 -mno-quad-memory-atomic
25346 Generate code that uses (does not use) the atomic quad word memory
25347 instructions. The -mquad-memory-atomic option requires use of
25348 64-bit mode.
25349
25350 -mfloat128
25351 -mno-float128
25352 Enable/disable the __float128 keyword for IEEE 128-bit floating
25353 point and use either software emulation for IEEE 128-bit floating
25354 point or hardware instructions.
25355
25356 The VSX instruction set (-mvsx) must be enabled to use the IEEE
25357 128-bit floating point support. The IEEE 128-bit floating point is
25358 only supported on Linux.
25359
25360 The default for -mfloat128 is enabled on PowerPC Linux systems
25361 using the VSX instruction set, and disabled on other systems.
25362
25363 If you use the ISA 3.0 instruction set (-mpower9-vector or
25364 -mcpu=power9) on a 64-bit system, the IEEE 128-bit floating point
25365 support will also enable the generation of ISA 3.0 IEEE 128-bit
25366 floating point instructions. Otherwise, if you do not specify to
25367 generate ISA 3.0 instructions or you are targeting a 32-bit big
25368 endian system, IEEE 128-bit floating point will be done with
25369 software emulation.
25370
25371 -mfloat128-hardware
25372 -mno-float128-hardware
25373 Enable/disable using ISA 3.0 hardware instructions to support the
25374 __float128 data type.
25375
25376 The default for -mfloat128-hardware is enabled on PowerPC Linux
25377 systems using the ISA 3.0 instruction set, and disabled on other
25378 systems.
25379
25380 -m32
25381 -m64
25382 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
25383 targets (including GNU/Linux). The 32-bit environment sets int,
25384 long and pointer to 32 bits and generates code that runs on any
25385 PowerPC variant. The 64-bit environment sets int to 32 bits and
25386 long and pointer to 64 bits, and generates code for PowerPC64, as
25387 for -mpowerpc64.
25388
25389 -mfull-toc
25390 -mno-fp-in-toc
25391 -mno-sum-in-toc
25392 -mminimal-toc
25393 Modify generation of the TOC (Table Of Contents), which is created
25394 for every executable file. The -mfull-toc option is selected by
25395 default. In that case, GCC allocates at least one TOC entry for
25396 each unique non-automatic variable reference in your program. GCC
25397 also places floating-point constants in the TOC. However, only
25398 16,384 entries are available in the TOC.
25399
25400 If you receive a linker error message that saying you have
25401 overflowed the available TOC space, you can reduce the amount of
25402 TOC space used with the -mno-fp-in-toc and -mno-sum-in-toc options.
25403 -mno-fp-in-toc prevents GCC from putting floating-point constants
25404 in the TOC and -mno-sum-in-toc forces GCC to generate code to
25405 calculate the sum of an address and a constant at run time instead
25406 of putting that sum into the TOC. You may specify one or both of
25407 these options. Each causes GCC to produce very slightly slower and
25408 larger code at the expense of conserving TOC space.
25409
25410 If you still run out of space in the TOC even when you specify both
25411 of these options, specify -mminimal-toc instead. This option
25412 causes GCC to make only one TOC entry for every file. When you
25413 specify this option, GCC produces code that is slower and larger
25414 but which uses extremely little TOC space. You may wish to use
25415 this option only on files that contain less frequently-executed
25416 code.
25417
25418 -maix64
25419 -maix32
25420 Enable 64-bit AIX ABI and calling convention: 64-bit pointers,
25421 64-bit "long" type, and the infrastructure needed to support them.
25422 Specifying -maix64 implies -mpowerpc64, while -maix32 disables the
25423 64-bit ABI and implies -mno-powerpc64. GCC defaults to -maix32.
25424
25425 -mxl-compat
25426 -mno-xl-compat
25427 Produce code that conforms more closely to IBM XL compiler
25428 semantics when using AIX-compatible ABI. Pass floating-point
25429 arguments to prototyped functions beyond the register save area
25430 (RSA) on the stack in addition to argument FPRs. Do not assume
25431 that most significant double in 128-bit long double value is
25432 properly rounded when comparing values and converting to double.
25433 Use XL symbol names for long double support routines.
25434
25435 The AIX calling convention was extended but not initially
25436 documented to handle an obscure K&R C case of calling a function
25437 that takes the address of its arguments with fewer arguments than
25438 declared. IBM XL compilers access floating-point arguments that do
25439 not fit in the RSA from the stack when a subroutine is compiled
25440 without optimization. Because always storing floating-point
25441 arguments on the stack is inefficient and rarely needed, this
25442 option is not enabled by default and only is necessary when calling
25443 subroutines compiled by IBM XL compilers without optimization.
25444
25445 -mpe
25446 Support IBM RS/6000 SP Parallel Environment (PE). Link an
25447 application written to use message passing with special startup
25448 code to enable the application to run. The system must have PE
25449 installed in the standard location (/usr/lpp/ppe.poe/), or the
25450 specs file must be overridden with the -specs= option to specify
25451 the appropriate directory location. The Parallel Environment does
25452 not support threads, so the -mpe option and the -pthread option are
25453 incompatible.
25454
25455 -malign-natural
25456 -malign-power
25457 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
25458 -malign-natural overrides the ABI-defined alignment of larger
25459 types, such as floating-point doubles, on their natural size-based
25460 boundary. The option -malign-power instructs GCC to follow the
25461 ABI-specified alignment rules. GCC defaults to the standard
25462 alignment defined in the ABI.
25463
25464 On 64-bit Darwin, natural alignment is the default, and
25465 -malign-power is not supported.
25466
25467 -msoft-float
25468 -mhard-float
25469 Generate code that does not use (uses) the floating-point register
25470 set. Software floating-point emulation is provided if you use the
25471 -msoft-float option, and pass the option to GCC when linking.
25472
25473 -mmultiple
25474 -mno-multiple
25475 Generate code that uses (does not use) the load multiple word
25476 instructions and the store multiple word instructions. These
25477 instructions are generated by default on POWER systems, and not
25478 generated on PowerPC systems. Do not use -mmultiple on little-
25479 endian PowerPC systems, since those instructions do not work when
25480 the processor is in little-endian mode. The exceptions are PPC740
25481 and PPC750 which permit these instructions in little-endian mode.
25482
25483 -mupdate
25484 -mno-update
25485 Generate code that uses (does not use) the load or store
25486 instructions that update the base register to the address of the
25487 calculated memory location. These instructions are generated by
25488 default. If you use -mno-update, there is a small window between
25489 the time that the stack pointer is updated and the address of the
25490 previous frame is stored, which means code that walks the stack
25491 frame across interrupts or signals may get corrupted data.
25492
25493 -mavoid-indexed-addresses
25494 -mno-avoid-indexed-addresses
25495 Generate code that tries to avoid (not avoid) the use of indexed
25496 load or store instructions. These instructions can incur a
25497 performance penalty on Power6 processors in certain situations,
25498 such as when stepping through large arrays that cross a 16M
25499 boundary. This option is enabled by default when targeting Power6
25500 and disabled otherwise.
25501
25502 -mfused-madd
25503 -mno-fused-madd
25504 Generate code that uses (does not use) the floating-point multiply
25505 and accumulate instructions. These instructions are generated by
25506 default if hardware floating point is used. The machine-dependent
25507 -mfused-madd option is now mapped to the machine-independent
25508 -ffp-contract=fast option, and -mno-fused-madd is mapped to
25509 -ffp-contract=off.
25510
25511 -mmulhw
25512 -mno-mulhw
25513 Generate code that uses (does not use) the half-word multiply and
25514 multiply-accumulate instructions on the IBM 405, 440, 464 and 476
25515 processors. These instructions are generated by default when
25516 targeting those processors.
25517
25518 -mdlmzb
25519 -mno-dlmzb
25520 Generate code that uses (does not use) the string-search dlmzb
25521 instruction on the IBM 405, 440, 464 and 476 processors. This
25522 instruction is generated by default when targeting those
25523 processors.
25524
25525 -mno-bit-align
25526 -mbit-align
25527 On System V.4 and embedded PowerPC systems do not (do) force
25528 structures and unions that contain bit-fields to be aligned to the
25529 base type of the bit-field.
25530
25531 For example, by default a structure containing nothing but 8
25532 "unsigned" bit-fields of length 1 is aligned to a 4-byte boundary
25533 and has a size of 4 bytes. By using -mno-bit-align, the structure
25534 is aligned to a 1-byte boundary and is 1 byte in size.
25535
25536 -mno-strict-align
25537 -mstrict-align
25538 On System V.4 and embedded PowerPC systems do not (do) assume that
25539 unaligned memory references are handled by the system.
25540
25541 -mrelocatable
25542 -mno-relocatable
25543 Generate code that allows (does not allow) a static executable to
25544 be relocated to a different address at run time. A simple embedded
25545 PowerPC system loader should relocate the entire contents of
25546 ".got2" and 4-byte locations listed in the ".fixup" section, a
25547 table of 32-bit addresses generated by this option. For this to
25548 work, all objects linked together must be compiled with
25549 -mrelocatable or -mrelocatable-lib. -mrelocatable code aligns the
25550 stack to an 8-byte boundary.
25551
25552 -mrelocatable-lib
25553 -mno-relocatable-lib
25554 Like -mrelocatable, -mrelocatable-lib generates a ".fixup" section
25555 to allow static executables to be relocated at run time, but
25556 -mrelocatable-lib does not use the smaller stack alignment of
25557 -mrelocatable. Objects compiled with -mrelocatable-lib may be
25558 linked with objects compiled with any combination of the
25559 -mrelocatable options.
25560
25561 -mno-toc
25562 -mtoc
25563 On System V.4 and embedded PowerPC systems do not (do) assume that
25564 register 2 contains a pointer to a global area pointing to the
25565 addresses used in the program.
25566
25567 -mlittle
25568 -mlittle-endian
25569 On System V.4 and embedded PowerPC systems compile code for the
25570 processor in little-endian mode. The -mlittle-endian option is the
25571 same as -mlittle.
25572
25573 -mbig
25574 -mbig-endian
25575 On System V.4 and embedded PowerPC systems compile code for the
25576 processor in big-endian mode. The -mbig-endian option is the same
25577 as -mbig.
25578
25579 -mdynamic-no-pic
25580 On Darwin and Mac OS X systems, compile code so that it is not
25581 relocatable, but that its external references are relocatable. The
25582 resulting code is suitable for applications, but not shared
25583 libraries.
25584
25585 -msingle-pic-base
25586 Treat the register used for PIC addressing as read-only, rather
25587 than loading it in the prologue for each function. The runtime
25588 system is responsible for initializing this register with an
25589 appropriate value before execution begins.
25590
25591 -mprioritize-restricted-insns=priority
25592 This option controls the priority that is assigned to dispatch-slot
25593 restricted instructions during the second scheduling pass. The
25594 argument priority takes the value 0, 1, or 2 to assign no, highest,
25595 or second-highest (respectively) priority to dispatch-slot
25596 restricted instructions.
25597
25598 -msched-costly-dep=dependence_type
25599 This option controls which dependences are considered costly by the
25600 target during instruction scheduling. The argument dependence_type
25601 takes one of the following values:
25602
25603 no No dependence is costly.
25604
25605 all All dependences are costly.
25606
25607 true_store_to_load
25608 A true dependence from store to load is costly.
25609
25610 store_to_load
25611 Any dependence from store to load is costly.
25612
25613 number
25614 Any dependence for which the latency is greater than or equal
25615 to number is costly.
25616
25617 -minsert-sched-nops=scheme
25618 This option controls which NOP insertion scheme is used during the
25619 second scheduling pass. The argument scheme takes one of the
25620 following values:
25621
25622 no Don't insert NOPs.
25623
25624 pad Pad with NOPs any dispatch group that has vacant issue slots,
25625 according to the scheduler's grouping.
25626
25627 regroup_exact
25628 Insert NOPs to force costly dependent insns into separate
25629 groups. Insert exactly as many NOPs as needed to force an insn
25630 to a new group, according to the estimated processor grouping.
25631
25632 number
25633 Insert NOPs to force costly dependent insns into separate
25634 groups. Insert number NOPs to force an insn to a new group.
25635
25636 -mcall-sysv
25637 On System V.4 and embedded PowerPC systems compile code using
25638 calling conventions that adhere to the March 1995 draft of the
25639 System V Application Binary Interface, PowerPC processor
25640 supplement. This is the default unless you configured GCC using
25641 powerpc-*-eabiaix.
25642
25643 -mcall-sysv-eabi
25644 -mcall-eabi
25645 Specify both -mcall-sysv and -meabi options.
25646
25647 -mcall-sysv-noeabi
25648 Specify both -mcall-sysv and -mno-eabi options.
25649
25650 -mcall-aixdesc
25651 On System V.4 and embedded PowerPC systems compile code for the AIX
25652 operating system.
25653
25654 -mcall-linux
25655 On System V.4 and embedded PowerPC systems compile code for the
25656 Linux-based GNU system.
25657
25658 -mcall-freebsd
25659 On System V.4 and embedded PowerPC systems compile code for the
25660 FreeBSD operating system.
25661
25662 -mcall-netbsd
25663 On System V.4 and embedded PowerPC systems compile code for the
25664 NetBSD operating system.
25665
25666 -mcall-openbsd
25667 On System V.4 and embedded PowerPC systems compile code for the
25668 OpenBSD operating system.
25669
25670 -mtraceback=traceback_type
25671 Select the type of traceback table. Valid values for traceback_type
25672 are full, part, and no.
25673
25674 -maix-struct-return
25675 Return all structures in memory (as specified by the AIX ABI).
25676
25677 -msvr4-struct-return
25678 Return structures smaller than 8 bytes in registers (as specified
25679 by the SVR4 ABI).
25680
25681 -mabi=abi-type
25682 Extend the current ABI with a particular extension, or remove such
25683 extension. Valid values are: altivec, no-altivec, ibmlongdouble,
25684 ieeelongdouble, elfv1, elfv2, and for AIX: vec-extabi, vec-default.
25685
25686 -mabi=ibmlongdouble
25687 Change the current ABI to use IBM extended-precision long double.
25688 This is not likely to work if your system defaults to using IEEE
25689 extended-precision long double. If you change the long double type
25690 from IEEE extended-precision, the compiler will issue a warning
25691 unless you use the -Wno-psabi option. Requires -mlong-double-128
25692 to be enabled.
25693
25694 -mabi=ieeelongdouble
25695 Change the current ABI to use IEEE extended-precision long double.
25696 This is not likely to work if your system defaults to using IBM
25697 extended-precision long double. If you change the long double type
25698 from IBM extended-precision, the compiler will issue a warning
25699 unless you use the -Wno-psabi option. Requires -mlong-double-128
25700 to be enabled.
25701
25702 -mabi=elfv1
25703 Change the current ABI to use the ELFv1 ABI. This is the default
25704 ABI for big-endian PowerPC 64-bit Linux. Overriding the default
25705 ABI requires special system support and is likely to fail in
25706 spectacular ways.
25707
25708 -mabi=elfv2
25709 Change the current ABI to use the ELFv2 ABI. This is the default
25710 ABI for little-endian PowerPC 64-bit Linux. Overriding the default
25711 ABI requires special system support and is likely to fail in
25712 spectacular ways.
25713
25714 -mgnu-attribute
25715 -mno-gnu-attribute
25716 Emit .gnu_attribute assembly directives to set tag/value pairs in a
25717 .gnu.attributes section that specify ABI variations in function
25718 parameters or return values.
25719
25720 -mprototype
25721 -mno-prototype
25722 On System V.4 and embedded PowerPC systems assume that all calls to
25723 variable argument functions are properly prototyped. Otherwise,
25724 the compiler must insert an instruction before every non-prototyped
25725 call to set or clear bit 6 of the condition code register ("CR") to
25726 indicate whether floating-point values are passed in the floating-
25727 point registers in case the function takes variable arguments.
25728 With -mprototype, only calls to prototyped variable argument
25729 functions set or clear the bit.
25730
25731 -msim
25732 On embedded PowerPC systems, assume that the startup module is
25733 called sim-crt0.o and that the standard C libraries are libsim.a
25734 and libc.a. This is the default for powerpc-*-eabisim
25735 configurations.
25736
25737 -mmvme
25738 On embedded PowerPC systems, assume that the startup module is
25739 called crt0.o and the standard C libraries are libmvme.a and
25740 libc.a.
25741
25742 -mads
25743 On embedded PowerPC systems, assume that the startup module is
25744 called crt0.o and the standard C libraries are libads.a and libc.a.
25745
25746 -myellowknife
25747 On embedded PowerPC systems, assume that the startup module is
25748 called crt0.o and the standard C libraries are libyk.a and libc.a.
25749
25750 -mvxworks
25751 On System V.4 and embedded PowerPC systems, specify that you are
25752 compiling for a VxWorks system.
25753
25754 -memb
25755 On embedded PowerPC systems, set the "PPC_EMB" bit in the ELF flags
25756 header to indicate that eabi extended relocations are used.
25757
25758 -meabi
25759 -mno-eabi
25760 On System V.4 and embedded PowerPC systems do (do not) adhere to
25761 the Embedded Applications Binary Interface (EABI), which is a set
25762 of modifications to the System V.4 specifications. Selecting
25763 -meabi means that the stack is aligned to an 8-byte boundary, a
25764 function "__eabi" is called from "main" to set up the EABI
25765 environment, and the -msdata option can use both "r2" and "r13" to
25766 point to two separate small data areas. Selecting -mno-eabi means
25767 that the stack is aligned to a 16-byte boundary, no EABI
25768 initialization function is called from "main", and the -msdata
25769 option only uses "r13" to point to a single small data area. The
25770 -meabi option is on by default if you configured GCC using one of
25771 the powerpc*-*-eabi* options.
25772
25773 -msdata=eabi
25774 On System V.4 and embedded PowerPC systems, put small initialized
25775 "const" global and static data in the ".sdata2" section, which is
25776 pointed to by register "r2". Put small initialized non-"const"
25777 global and static data in the ".sdata" section, which is pointed to
25778 by register "r13". Put small uninitialized global and static data
25779 in the ".sbss" section, which is adjacent to the ".sdata" section.
25780 The -msdata=eabi option is incompatible with the -mrelocatable
25781 option. The -msdata=eabi option also sets the -memb option.
25782
25783 -msdata=sysv
25784 On System V.4 and embedded PowerPC systems, put small global and
25785 static data in the ".sdata" section, which is pointed to by
25786 register "r13". Put small uninitialized global and static data in
25787 the ".sbss" section, which is adjacent to the ".sdata" section.
25788 The -msdata=sysv option is incompatible with the -mrelocatable
25789 option.
25790
25791 -msdata=default
25792 -msdata
25793 On System V.4 and embedded PowerPC systems, if -meabi is used,
25794 compile code the same as -msdata=eabi, otherwise compile code the
25795 same as -msdata=sysv.
25796
25797 -msdata=data
25798 On System V.4 and embedded PowerPC systems, put small global data
25799 in the ".sdata" section. Put small uninitialized global data in
25800 the ".sbss" section. Do not use register "r13" to address small
25801 data however. This is the default behavior unless other -msdata
25802 options are used.
25803
25804 -msdata=none
25805 -mno-sdata
25806 On embedded PowerPC systems, put all initialized global and static
25807 data in the ".data" section, and all uninitialized data in the
25808 ".bss" section.
25809
25810 -mreadonly-in-sdata
25811 Put read-only objects in the ".sdata" section as well. This is the
25812 default.
25813
25814 -mblock-move-inline-limit=num
25815 Inline all block moves (such as calls to "memcpy" or structure
25816 copies) less than or equal to num bytes. The minimum value for num
25817 is 32 bytes on 32-bit targets and 64 bytes on 64-bit targets. The
25818 default value is target-specific.
25819
25820 -mblock-compare-inline-limit=num
25821 Generate non-looping inline code for all block compares (such as
25822 calls to "memcmp" or structure compares) less than or equal to num
25823 bytes. If num is 0, all inline expansion (non-loop and loop) of
25824 block compare is disabled. The default value is target-specific.
25825
25826 -mblock-compare-inline-loop-limit=num
25827 Generate an inline expansion using loop code for all block compares
25828 that are less than or equal to num bytes, but greater than the
25829 limit for non-loop inline block compare expansion. If the block
25830 length is not constant, at most num bytes will be compared before
25831 "memcmp" is called to compare the remainder of the block. The
25832 default value is target-specific.
25833
25834 -mstring-compare-inline-limit=num
25835 Compare at most num string bytes with inline code. If the
25836 difference or end of string is not found at the end of the inline
25837 compare a call to "strcmp" or "strncmp" will take care of the rest
25838 of the comparison. The default is 64 bytes.
25839
25840 -G num
25841 On embedded PowerPC systems, put global and static items less than
25842 or equal to num bytes into the small data or BSS sections instead
25843 of the normal data or BSS section. By default, num is 8. The -G
25844 num switch is also passed to the linker. All modules should be
25845 compiled with the same -G num value.
25846
25847 -mregnames
25848 -mno-regnames
25849 On System V.4 and embedded PowerPC systems do (do not) emit
25850 register names in the assembly language output using symbolic
25851 forms.
25852
25853 -mlongcall
25854 -mno-longcall
25855 By default assume that all calls are far away so that a longer and
25856 more expensive calling sequence is required. This is required for
25857 calls farther than 32 megabytes (33,554,432 bytes) from the current
25858 location. A short call is generated if the compiler knows the call
25859 cannot be that far away. This setting can be overridden by the
25860 "shortcall" function attribute, or by #pragma longcall(0).
25861
25862 Some linkers are capable of detecting out-of-range calls and
25863 generating glue code on the fly. On these systems, long calls are
25864 unnecessary and generate slower code. As of this writing, the AIX
25865 linker can do this, as can the GNU linker for PowerPC/64. It is
25866 planned to add this feature to the GNU linker for 32-bit PowerPC
25867 systems as well.
25868
25869 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
25870 linkers, GCC can generate long calls using an inline PLT call
25871 sequence (see -mpltseq). PowerPC with -mbss-plt and PowerPC64
25872 ELFv1 (big-endian) do not support inline PLT calls.
25873
25874 On Darwin/PPC systems, "#pragma longcall" generates "jbsr callee,
25875 L42", plus a branch island (glue code). The two target addresses
25876 represent the callee and the branch island. The Darwin/PPC linker
25877 prefers the first address and generates a "bl callee" if the PPC
25878 "bl" instruction reaches the callee directly; otherwise, the linker
25879 generates "bl L42" to call the branch island. The branch island is
25880 appended to the body of the calling function; it computes the full
25881 32-bit address of the callee and jumps to it.
25882
25883 On Mach-O (Darwin) systems, this option directs the compiler emit
25884 to the glue for every direct call, and the Darwin linker decides
25885 whether to use or discard it.
25886
25887 In the future, GCC may ignore all longcall specifications when the
25888 linker is known to generate glue.
25889
25890 -mpltseq
25891 -mno-pltseq
25892 Implement (do not implement) -fno-plt and long calls using an
25893 inline PLT call sequence that supports lazy linking and long calls
25894 to functions in dlopen'd shared libraries. Inline PLT calls are
25895 only supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with
25896 newer GNU linkers, and are enabled by default if the support is
25897 detected when configuring GCC, and, in the case of 32-bit PowerPC,
25898 if GCC is configured with --enable-secureplt. -mpltseq code and
25899 -mbss-plt 32-bit PowerPC relocatable objects may not be linked
25900 together.
25901
25902 -mtls-markers
25903 -mno-tls-markers
25904 Mark (do not mark) calls to "__tls_get_addr" with a relocation
25905 specifying the function argument. The relocation allows the linker
25906 to reliably associate function call with argument setup
25907 instructions for TLS optimization, which in turn allows GCC to
25908 better schedule the sequence.
25909
25910 -mrecip
25911 -mno-recip
25912 This option enables use of the reciprocal estimate and reciprocal
25913 square root estimate instructions with additional Newton-Raphson
25914 steps to increase precision instead of doing a divide or square
25915 root and divide for floating-point arguments. You should use the
25916 -ffast-math option when using -mrecip (or at least
25917 -funsafe-math-optimizations, -ffinite-math-only, -freciprocal-math
25918 and -fno-trapping-math). Note that while the throughput of the
25919 sequence is generally higher than the throughput of the non-
25920 reciprocal instruction, the precision of the sequence can be
25921 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
25922 0.99999994) for reciprocal square roots.
25923
25924 -mrecip=opt
25925 This option controls which reciprocal estimate instructions may be
25926 used. opt is a comma-separated list of options, which may be
25927 preceded by a "!" to invert the option:
25928
25929 all Enable all estimate instructions.
25930
25931 default
25932 Enable the default instructions, equivalent to -mrecip.
25933
25934 none
25935 Disable all estimate instructions, equivalent to -mno-recip.
25936
25937 div Enable the reciprocal approximation instructions for both
25938 single and double precision.
25939
25940 divf
25941 Enable the single-precision reciprocal approximation
25942 instructions.
25943
25944 divd
25945 Enable the double-precision reciprocal approximation
25946 instructions.
25947
25948 rsqrt
25949 Enable the reciprocal square root approximation instructions
25950 for both single and double precision.
25951
25952 rsqrtf
25953 Enable the single-precision reciprocal square root
25954 approximation instructions.
25955
25956 rsqrtd
25957 Enable the double-precision reciprocal square root
25958 approximation instructions.
25959
25960 So, for example, -mrecip=all,!rsqrtd enables all of the reciprocal
25961 estimate instructions, except for the "FRSQRTE", "XSRSQRTEDP", and
25962 "XVRSQRTEDP" instructions which handle the double-precision
25963 reciprocal square root calculations.
25964
25965 -mrecip-precision
25966 -mno-recip-precision
25967 Assume (do not assume) that the reciprocal estimate instructions
25968 provide higher-precision estimates than is mandated by the PowerPC
25969 ABI. Selecting -mcpu=power6, -mcpu=power7 or -mcpu=power8
25970 automatically selects -mrecip-precision. The double-precision
25971 square root estimate instructions are not generated by default on
25972 low-precision machines, since they do not provide an estimate that
25973 converges after three steps.
25974
25975 -mveclibabi=type
25976 Specifies the ABI type to use for vectorizing intrinsics using an
25977 external library. The only type supported at present is mass,
25978 which specifies to use IBM's Mathematical Acceleration Subsystem
25979 (MASS) libraries for vectorizing intrinsics using external
25980 libraries. GCC currently emits calls to "acosd2", "acosf4",
25981 "acoshd2", "acoshf4", "asind2", "asinf4", "asinhd2", "asinhf4",
25982 "atan2d2", "atan2f4", "atand2", "atanf4", "atanhd2", "atanhf4",
25983 "cbrtd2", "cbrtf4", "cosd2", "cosf4", "coshd2", "coshf4", "erfcd2",
25984 "erfcf4", "erfd2", "erff4", "exp2d2", "exp2f4", "expd2", "expf4",
25985 "expm1d2", "expm1f4", "hypotd2", "hypotf4", "lgammad2", "lgammaf4",
25986 "log10d2", "log10f4", "log1pd2", "log1pf4", "log2d2", "log2f4",
25987 "logd2", "logf4", "powd2", "powf4", "sind2", "sinf4", "sinhd2",
25988 "sinhf4", "sqrtd2", "sqrtf4", "tand2", "tanf4", "tanhd2", and
25989 "tanhf4" when generating code for power7. Both -ftree-vectorize
25990 and -funsafe-math-optimizations must also be enabled. The MASS
25991 libraries must be specified at link time.
25992
25993 -mfriz
25994 -mno-friz
25995 Generate (do not generate) the "friz" instruction when the
25996 -funsafe-math-optimizations option is used to optimize rounding of
25997 floating-point values to 64-bit integer and back to floating point.
25998 The "friz" instruction does not return the same value if the
25999 floating-point number is too large to fit in an integer.
26000
26001 -mpointers-to-nested-functions
26002 -mno-pointers-to-nested-functions
26003 Generate (do not generate) code to load up the static chain
26004 register ("r11") when calling through a pointer on AIX and 64-bit
26005 Linux systems where a function pointer points to a 3-word
26006 descriptor giving the function address, TOC value to be loaded in
26007 register "r2", and static chain value to be loaded in register
26008 "r11". The -mpointers-to-nested-functions is on by default. You
26009 cannot call through pointers to nested functions or pointers to
26010 functions compiled in other languages that use the static chain if
26011 you use -mno-pointers-to-nested-functions.
26012
26013 -msave-toc-indirect
26014 -mno-save-toc-indirect
26015 Generate (do not generate) code to save the TOC value in the
26016 reserved stack location in the function prologue if the function
26017 calls through a pointer on AIX and 64-bit Linux systems. If the
26018 TOC value is not saved in the prologue, it is saved just before the
26019 call through the pointer. The -mno-save-toc-indirect option is the
26020 default.
26021
26022 -mcompat-align-parm
26023 -mno-compat-align-parm
26024 Generate (do not generate) code to pass structure parameters with a
26025 maximum alignment of 64 bits, for compatibility with older versions
26026 of GCC.
26027
26028 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
26029 structure parameter on a 128-bit boundary when that structure
26030 contained a member requiring 128-bit alignment. This is corrected
26031 in more recent versions of GCC. This option may be used to
26032 generate code that is compatible with functions compiled with older
26033 versions of GCC.
26034
26035 The -mno-compat-align-parm option is the default.
26036
26037 -mstack-protector-guard=guard
26038 -mstack-protector-guard-reg=reg
26039 -mstack-protector-guard-offset=offset
26040 -mstack-protector-guard-symbol=symbol
26041 Generate stack protection code using canary at guard. Supported
26042 locations are global for global canary or tls for per-thread canary
26043 in the TLS block (the default with GNU libc version 2.4 or later).
26044
26045 With the latter choice the options -mstack-protector-guard-reg=reg
26046 and -mstack-protector-guard-offset=offset furthermore specify which
26047 register to use as base register for reading the canary, and from
26048 what offset from that base register. The default for those is as
26049 specified in the relevant ABI.
26050 -mstack-protector-guard-symbol=symbol overrides the offset with a
26051 symbol reference to a canary in the TLS block.
26052
26053 -mpcrel
26054 -mno-pcrel
26055 Generate (do not generate) pc-relative addressing. The -mpcrel
26056 option requires that the medium code model (-mcmodel=medium) and
26057 prefixed addressing (-mprefixed) options are enabled.
26058
26059 -mprefixed
26060 -mno-prefixed
26061 Generate (do not generate) addressing modes using prefixed load and
26062 store instructions. The -mprefixed option requires that the option
26063 -mcpu=power10 (or later) is enabled.
26064
26065 -mmma
26066 -mno-mma
26067 Generate (do not generate) the MMA instructions. The -mma option
26068 requires that the option -mcpu=power10 (or later) is enabled.
26069
26070 -mrop-protect
26071 -mno-rop-protect
26072 Generate (do not generate) ROP protection instructions when the
26073 target processor supports them. Currently this option disables the
26074 shrink-wrap optimization (-fshrink-wrap).
26075
26076 -mprivileged
26077 -mno-privileged
26078 Generate (do not generate) code that will run in privileged state.
26079
26080 -mblock-ops-unaligned-vsx
26081 -mno-block-ops-unaligned-vsx
26082 Generate (do not generate) unaligned vsx loads and stores for
26083 inline expansion of "memcpy" and "memmove".
26084
26085 --param rs6000-vect-unroll-limit=
26086 The vectorizer will check with target information to determine
26087 whether it would be beneficial to unroll the main vectorized loop
26088 and by how much. This parameter sets the upper bound of how much
26089 the vectorizer will unroll the main loop. The default value is
26090 four.
26091
26092 RX Options
26093 These command-line options are defined for RX targets:
26094
26095 -m64bit-doubles
26096 -m32bit-doubles
26097 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
26098 (-m32bit-doubles) in size. The default is -m32bit-doubles. Note
26099 RX floating-point hardware only works on 32-bit values, which is
26100 why the default is -m32bit-doubles.
26101
26102 -fpu
26103 -nofpu
26104 Enables (-fpu) or disables (-nofpu) the use of RX floating-point
26105 hardware. The default is enabled for the RX600 series and disabled
26106 for the RX200 series.
26107
26108 Floating-point instructions are only generated for 32-bit floating-
26109 point values, however, so the FPU hardware is not used for doubles
26110 if the -m64bit-doubles option is used.
26111
26112 Note If the -fpu option is enabled then -funsafe-math-optimizations
26113 is also enabled automatically. This is because the RX FPU
26114 instructions are themselves unsafe.
26115
26116 -mcpu=name
26117 Selects the type of RX CPU to be targeted. Currently three types
26118 are supported, the generic RX600 and RX200 series hardware and the
26119 specific RX610 CPU. The default is RX600.
26120
26121 The only difference between RX600 and RX610 is that the RX610 does
26122 not support the "MVTIPL" instruction.
26123
26124 The RX200 series does not have a hardware floating-point unit and
26125 so -nofpu is enabled by default when this type is selected.
26126
26127 -mbig-endian-data
26128 -mlittle-endian-data
26129 Store data (but not code) in the big-endian format. The default is
26130 -mlittle-endian-data, i.e. to store data in the little-endian
26131 format.
26132
26133 -msmall-data-limit=N
26134 Specifies the maximum size in bytes of global and static variables
26135 which can be placed into the small data area. Using the small data
26136 area can lead to smaller and faster code, but the size of area is
26137 limited and it is up to the programmer to ensure that the area does
26138 not overflow. Also when the small data area is used one of the
26139 RX's registers (usually "r13") is reserved for use pointing to this
26140 area, so it is no longer available for use by the compiler. This
26141 could result in slower and/or larger code if variables are pushed
26142 onto the stack instead of being held in this register.
26143
26144 Note, common variables (variables that have not been initialized)
26145 and constants are not placed into the small data area as they are
26146 assigned to other sections in the output executable.
26147
26148 The default value is zero, which disables this feature. Note, this
26149 feature is not enabled by default with higher optimization levels
26150 (-O2 etc) because of the potentially detrimental effects of
26151 reserving a register. It is up to the programmer to experiment and
26152 discover whether this feature is of benefit to their program. See
26153 the description of the -mpid option for a description of how the
26154 actual register to hold the small data area pointer is chosen.
26155
26156 -msim
26157 -mno-sim
26158 Use the simulator runtime. The default is to use the libgloss
26159 board-specific runtime.
26160
26161 -mas100-syntax
26162 -mno-as100-syntax
26163 When generating assembler output use a syntax that is compatible
26164 with Renesas's AS100 assembler. This syntax can also be handled by
26165 the GAS assembler, but it has some restrictions so it is not
26166 generated by default.
26167
26168 -mmax-constant-size=N
26169 Specifies the maximum size, in bytes, of a constant that can be
26170 used as an operand in a RX instruction. Although the RX
26171 instruction set does allow constants of up to 4 bytes in length to
26172 be used in instructions, a longer value equates to a longer
26173 instruction. Thus in some circumstances it can be beneficial to
26174 restrict the size of constants that are used in instructions.
26175 Constants that are too big are instead placed into a constant pool
26176 and referenced via register indirection.
26177
26178 The value N can be between 0 and 4. A value of 0 (the default) or
26179 4 means that constants of any size are allowed.
26180
26181 -mrelax
26182 Enable linker relaxation. Linker relaxation is a process whereby
26183 the linker attempts to reduce the size of a program by finding
26184 shorter versions of various instructions. Disabled by default.
26185
26186 -mint-register=N
26187 Specify the number of registers to reserve for fast interrupt
26188 handler functions. The value N can be between 0 and 4. A value of
26189 1 means that register "r13" is reserved for the exclusive use of
26190 fast interrupt handlers. A value of 2 reserves "r13" and "r12". A
26191 value of 3 reserves "r13", "r12" and "r11", and a value of 4
26192 reserves "r13" through "r10". A value of 0, the default, does not
26193 reserve any registers.
26194
26195 -msave-acc-in-interrupts
26196 Specifies that interrupt handler functions should preserve the
26197 accumulator register. This is only necessary if normal code might
26198 use the accumulator register, for example because it performs
26199 64-bit multiplications. The default is to ignore the accumulator
26200 as this makes the interrupt handlers faster.
26201
26202 -mpid
26203 -mno-pid
26204 Enables the generation of position independent data. When enabled
26205 any access to constant data is done via an offset from a base
26206 address held in a register. This allows the location of constant
26207 data to be determined at run time without requiring the executable
26208 to be relocated, which is a benefit to embedded applications with
26209 tight memory constraints. Data that can be modified is not
26210 affected by this option.
26211
26212 Note, using this feature reserves a register, usually "r13", for
26213 the constant data base address. This can result in slower and/or
26214 larger code, especially in complicated functions.
26215
26216 The actual register chosen to hold the constant data base address
26217 depends upon whether the -msmall-data-limit and/or the
26218 -mint-register command-line options are enabled. Starting with
26219 register "r13" and proceeding downwards, registers are allocated
26220 first to satisfy the requirements of -mint-register, then -mpid and
26221 finally -msmall-data-limit. Thus it is possible for the small data
26222 area register to be "r8" if both -mint-register=4 and -mpid are
26223 specified on the command line.
26224
26225 By default this feature is not enabled. The default can be
26226 restored via the -mno-pid command-line option.
26227
26228 -mno-warn-multiple-fast-interrupts
26229 -mwarn-multiple-fast-interrupts
26230 Prevents GCC from issuing a warning message if it finds more than
26231 one fast interrupt handler when it is compiling a file. The
26232 default is to issue a warning for each extra fast interrupt handler
26233 found, as the RX only supports one such interrupt.
26234
26235 -mallow-string-insns
26236 -mno-allow-string-insns
26237 Enables or disables the use of the string manipulation instructions
26238 "SMOVF", "SCMPU", "SMOVB", "SMOVU", "SUNTIL" "SWHILE" and also the
26239 "RMPA" instruction. These instructions may prefetch data, which is
26240 not safe to do if accessing an I/O register. (See section 12.2.7
26241 of the RX62N Group User's Manual for more information).
26242
26243 The default is to allow these instructions, but it is not possible
26244 for GCC to reliably detect all circumstances where a string
26245 instruction might be used to access an I/O register, so their use
26246 cannot be disabled automatically. Instead it is reliant upon the
26247 programmer to use the -mno-allow-string-insns option if their
26248 program accesses I/O space.
26249
26250 When the instructions are enabled GCC defines the C preprocessor
26251 symbol "__RX_ALLOW_STRING_INSNS__", otherwise it defines the symbol
26252 "__RX_DISALLOW_STRING_INSNS__".
26253
26254 -mjsr
26255 -mno-jsr
26256 Use only (or not only) "JSR" instructions to access functions.
26257 This option can be used when code size exceeds the range of "BSR"
26258 instructions. Note that -mno-jsr does not mean to not use "JSR"
26259 but instead means that any type of branch may be used.
26260
26261 Note: The generic GCC command-line option -ffixed-reg has special
26262 significance to the RX port when used with the "interrupt" function
26263 attribute. This attribute indicates a function intended to process
26264 fast interrupts. GCC ensures that it only uses the registers "r10",
26265 "r11", "r12" and/or "r13" and only provided that the normal use of the
26266 corresponding registers have been restricted via the -ffixed-reg or
26267 -mint-register command-line options.
26268
26269 S/390 and zSeries Options
26270 These are the -m options defined for the S/390 and zSeries
26271 architecture.
26272
26273 -mhard-float
26274 -msoft-float
26275 Use (do not use) the hardware floating-point instructions and
26276 registers for floating-point operations. When -msoft-float is
26277 specified, functions in libgcc.a are used to perform floating-point
26278 operations. When -mhard-float is specified, the compiler generates
26279 IEEE floating-point instructions. This is the default.
26280
26281 -mhard-dfp
26282 -mno-hard-dfp
26283 Use (do not use) the hardware decimal-floating-point instructions
26284 for decimal-floating-point operations. When -mno-hard-dfp is
26285 specified, functions in libgcc.a are used to perform decimal-
26286 floating-point operations. When -mhard-dfp is specified, the
26287 compiler generates decimal-floating-point hardware instructions.
26288 This is the default for -march=z9-ec or higher.
26289
26290 -mlong-double-64
26291 -mlong-double-128
26292 These switches control the size of "long double" type. A size of 64
26293 bits makes the "long double" type equivalent to the "double" type.
26294 This is the default.
26295
26296 -mbackchain
26297 -mno-backchain
26298 Store (do not store) the address of the caller's frame as backchain
26299 pointer into the callee's stack frame. A backchain may be needed
26300 to allow debugging using tools that do not understand DWARF call
26301 frame information. When -mno-packed-stack is in effect, the
26302 backchain pointer is stored at the bottom of the stack frame; when
26303 -mpacked-stack is in effect, the backchain is placed into the
26304 topmost word of the 96/160 byte register save area.
26305
26306 In general, code compiled with -mbackchain is call-compatible with
26307 code compiled with -mno-backchain; however, use of the backchain
26308 for debugging purposes usually requires that the whole binary is
26309 built with -mbackchain. Note that the combination of -mbackchain,
26310 -mpacked-stack and -mhard-float is not supported. In order to
26311 build a linux kernel use -msoft-float.
26312
26313 The default is to not maintain the backchain.
26314
26315 -mpacked-stack
26316 -mno-packed-stack
26317 Use (do not use) the packed stack layout. When -mno-packed-stack
26318 is specified, the compiler uses the all fields of the 96/160 byte
26319 register save area only for their default purpose; unused fields
26320 still take up stack space. When -mpacked-stack is specified,
26321 register save slots are densely packed at the top of the register
26322 save area; unused space is reused for other purposes, allowing for
26323 more efficient use of the available stack space. However, when
26324 -mbackchain is also in effect, the topmost word of the save area is
26325 always used to store the backchain, and the return address register
26326 is always saved two words below the backchain.
26327
26328 As long as the stack frame backchain is not used, code generated
26329 with -mpacked-stack is call-compatible with code generated with
26330 -mno-packed-stack. Note that some non-FSF releases of GCC 2.95 for
26331 S/390 or zSeries generated code that uses the stack frame backchain
26332 at run time, not just for debugging purposes. Such code is not
26333 call-compatible with code compiled with -mpacked-stack. Also, note
26334 that the combination of -mbackchain, -mpacked-stack and
26335 -mhard-float is not supported. In order to build a linux kernel
26336 use -msoft-float.
26337
26338 The default is to not use the packed stack layout.
26339
26340 -msmall-exec
26341 -mno-small-exec
26342 Generate (or do not generate) code using the "bras" instruction to
26343 do subroutine calls. This only works reliably if the total
26344 executable size does not exceed 64k. The default is to use the
26345 "basr" instruction instead, which does not have this limitation.
26346
26347 -m64
26348 -m31
26349 When -m31 is specified, generate code compliant to the GNU/Linux
26350 for S/390 ABI. When -m64 is specified, generate code compliant to
26351 the GNU/Linux for zSeries ABI. This allows GCC in particular to
26352 generate 64-bit instructions. For the s390 targets, the default is
26353 -m31, while the s390x targets default to -m64.
26354
26355 -mzarch
26356 -mesa
26357 When -mzarch is specified, generate code using the instructions
26358 available on z/Architecture. When -mesa is specified, generate
26359 code using the instructions available on ESA/390. Note that -mesa
26360 is not possible with -m64. When generating code compliant to the
26361 GNU/Linux for S/390 ABI, the default is -mesa. When generating
26362 code compliant to the GNU/Linux for zSeries ABI, the default is
26363 -mzarch.
26364
26365 -mhtm
26366 -mno-htm
26367 The -mhtm option enables a set of builtins making use of
26368 instructions available with the transactional execution facility
26369 introduced with the IBM zEnterprise EC12 machine generation S/390
26370 System z Built-in Functions. -mhtm is enabled by default when
26371 using -march=zEC12.
26372
26373 -mvx
26374 -mno-vx
26375 When -mvx is specified, generate code using the instructions
26376 available with the vector extension facility introduced with the
26377 IBM z13 machine generation. This option changes the ABI for some
26378 vector type values with regard to alignment and calling
26379 conventions. In case vector type values are being used in an ABI-
26380 relevant context a GAS .gnu_attribute command will be added to mark
26381 the resulting binary with the ABI used. -mvx is enabled by default
26382 when using -march=z13.
26383
26384 -mzvector
26385 -mno-zvector
26386 The -mzvector option enables vector language extensions and
26387 builtins using instructions available with the vector extension
26388 facility introduced with the IBM z13 machine generation. This
26389 option adds support for vector to be used as a keyword to define
26390 vector type variables and arguments. vector is only available when
26391 GNU extensions are enabled. It will not be expanded when
26392 requesting strict standard compliance e.g. with -std=c99. In
26393 addition to the GCC low-level builtins -mzvector enables a set of
26394 builtins added for compatibility with AltiVec-style implementations
26395 like Power and Cell. In order to make use of these builtins the
26396 header file vecintrin.h needs to be included. -mzvector is
26397 disabled by default.
26398
26399 -mmvcle
26400 -mno-mvcle
26401 Generate (or do not generate) code using the "mvcle" instruction to
26402 perform block moves. When -mno-mvcle is specified, use a "mvc"
26403 loop instead. This is the default unless optimizing for size.
26404
26405 -mdebug
26406 -mno-debug
26407 Print (or do not print) additional debug information when
26408 compiling. The default is to not print debug information.
26409
26410 -march=cpu-type
26411 Generate code that runs on cpu-type, which is the name of a system
26412 representing a certain processor type. Possible values for cpu-
26413 type are z900/arch5, z990/arch6, z9-109, z9-ec/arch7, z10/arch8,
26414 z196/arch9, zEC12, z13/arch11, z14/arch12, z15/arch13, z16/arch14,
26415 and native.
26416
26417 The default is -march=z900.
26418
26419 Specifying native as cpu type can be used to select the best
26420 architecture option for the host processor. -march=native has no
26421 effect if GCC does not recognize the processor.
26422
26423 -mtune=cpu-type
26424 Tune to cpu-type everything applicable about the generated code,
26425 except for the ABI and the set of available instructions. The list
26426 of cpu-type values is the same as for -march. The default is the
26427 value used for -march.
26428
26429 -mtpf-trace
26430 -mno-tpf-trace
26431 Generate code that adds (does not add) in TPF OS specific branches
26432 to trace routines in the operating system. This option is off by
26433 default, even when compiling for the TPF OS.
26434
26435 -mtpf-trace-skip
26436 -mno-tpf-trace-skip
26437 Generate code that changes (does not change) the default branch
26438 targets enabled by -mtpf-trace to point to specialized trace
26439 routines providing the ability of selectively skipping function
26440 trace entries for the TPF OS. This option is off by default, even
26441 when compiling for the TPF OS and specifying -mtpf-trace.
26442
26443 -mfused-madd
26444 -mno-fused-madd
26445 Generate code that uses (does not use) the floating-point multiply
26446 and accumulate instructions. These instructions are generated by
26447 default if hardware floating point is used.
26448
26449 -mwarn-framesize=framesize
26450 Emit a warning if the current function exceeds the given frame
26451 size. Because this is a compile-time check it doesn't need to be a
26452 real problem when the program runs. It is intended to identify
26453 functions that most probably cause a stack overflow. It is useful
26454 to be used in an environment with limited stack size e.g. the linux
26455 kernel.
26456
26457 -mwarn-dynamicstack
26458 Emit a warning if the function calls "alloca" or uses dynamically-
26459 sized arrays. This is generally a bad idea with a limited stack
26460 size.
26461
26462 -mstack-guard=stack-guard
26463 -mstack-size=stack-size
26464 If these options are provided the S/390 back end emits additional
26465 instructions in the function prologue that trigger a trap if the
26466 stack size is stack-guard bytes above the stack-size (remember that
26467 the stack on S/390 grows downward). If the stack-guard option is
26468 omitted the smallest power of 2 larger than the frame size of the
26469 compiled function is chosen. These options are intended to be used
26470 to help debugging stack overflow problems. The additionally
26471 emitted code causes only little overhead and hence can also be used
26472 in production-like systems without greater performance degradation.
26473 The given values have to be exact powers of 2 and stack-size has to
26474 be greater than stack-guard without exceeding 64k. In order to be
26475 efficient the extra code makes the assumption that the stack starts
26476 at an address aligned to the value given by stack-size. The stack-
26477 guard option can only be used in conjunction with stack-size.
26478
26479 -mhotpatch=pre-halfwords,post-halfwords
26480 If the hotpatch option is enabled, a "hot-patching" function
26481 prologue is generated for all functions in the compilation unit.
26482 The funtion label is prepended with the given number of two-byte
26483 NOP instructions (pre-halfwords, maximum 1000000). After the
26484 label, 2 * post-halfwords bytes are appended, using the largest NOP
26485 like instructions the architecture allows (maximum 1000000).
26486
26487 If both arguments are zero, hotpatching is disabled.
26488
26489 This option can be overridden for individual functions with the
26490 "hotpatch" attribute.
26491
26492 SH Options
26493 These -m options are defined for the SH implementations:
26494
26495 -m1 Generate code for the SH1.
26496
26497 -m2 Generate code for the SH2.
26498
26499 -m2e
26500 Generate code for the SH2e.
26501
26502 -m2a-nofpu
26503 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a
26504 way that the floating-point unit is not used.
26505
26506 -m2a-single-only
26507 Generate code for the SH2a-FPU, in such a way that no double-
26508 precision floating-point operations are used.
26509
26510 -m2a-single
26511 Generate code for the SH2a-FPU assuming the floating-point unit is
26512 in single-precision mode by default.
26513
26514 -m2a
26515 Generate code for the SH2a-FPU assuming the floating-point unit is
26516 in double-precision mode by default.
26517
26518 -m3 Generate code for the SH3.
26519
26520 -m3e
26521 Generate code for the SH3e.
26522
26523 -m4-nofpu
26524 Generate code for the SH4 without a floating-point unit.
26525
26526 -m4-single-only
26527 Generate code for the SH4 with a floating-point unit that only
26528 supports single-precision arithmetic.
26529
26530 -m4-single
26531 Generate code for the SH4 assuming the floating-point unit is in
26532 single-precision mode by default.
26533
26534 -m4 Generate code for the SH4.
26535
26536 -m4-100
26537 Generate code for SH4-100.
26538
26539 -m4-100-nofpu
26540 Generate code for SH4-100 in such a way that the floating-point
26541 unit is not used.
26542
26543 -m4-100-single
26544 Generate code for SH4-100 assuming the floating-point unit is in
26545 single-precision mode by default.
26546
26547 -m4-100-single-only
26548 Generate code for SH4-100 in such a way that no double-precision
26549 floating-point operations are used.
26550
26551 -m4-200
26552 Generate code for SH4-200.
26553
26554 -m4-200-nofpu
26555 Generate code for SH4-200 without in such a way that the floating-
26556 point unit is not used.
26557
26558 -m4-200-single
26559 Generate code for SH4-200 assuming the floating-point unit is in
26560 single-precision mode by default.
26561
26562 -m4-200-single-only
26563 Generate code for SH4-200 in such a way that no double-precision
26564 floating-point operations are used.
26565
26566 -m4-300
26567 Generate code for SH4-300.
26568
26569 -m4-300-nofpu
26570 Generate code for SH4-300 without in such a way that the floating-
26571 point unit is not used.
26572
26573 -m4-300-single
26574 Generate code for SH4-300 in such a way that no double-precision
26575 floating-point operations are used.
26576
26577 -m4-300-single-only
26578 Generate code for SH4-300 in such a way that no double-precision
26579 floating-point operations are used.
26580
26581 -m4-340
26582 Generate code for SH4-340 (no MMU, no FPU).
26583
26584 -m4-500
26585 Generate code for SH4-500 (no FPU). Passes -isa=sh4-nofpu to the
26586 assembler.
26587
26588 -m4a-nofpu
26589 Generate code for the SH4al-dsp, or for a SH4a in such a way that
26590 the floating-point unit is not used.
26591
26592 -m4a-single-only
26593 Generate code for the SH4a, in such a way that no double-precision
26594 floating-point operations are used.
26595
26596 -m4a-single
26597 Generate code for the SH4a assuming the floating-point unit is in
26598 single-precision mode by default.
26599
26600 -m4a
26601 Generate code for the SH4a.
26602
26603 -m4al
26604 Same as -m4a-nofpu, except that it implicitly passes -dsp to the
26605 assembler. GCC doesn't generate any DSP instructions at the
26606 moment.
26607
26608 -mb Compile code for the processor in big-endian mode.
26609
26610 -ml Compile code for the processor in little-endian mode.
26611
26612 -mdalign
26613 Align doubles at 64-bit boundaries. Note that this changes the
26614 calling conventions, and thus some functions from the standard C
26615 library do not work unless you recompile it first with -mdalign.
26616
26617 -mrelax
26618 Shorten some address references at link time, when possible; uses
26619 the linker option -relax.
26620
26621 -mbigtable
26622 Use 32-bit offsets in "switch" tables. The default is to use
26623 16-bit offsets.
26624
26625 -mbitops
26626 Enable the use of bit manipulation instructions on SH2A.
26627
26628 -mfmovd
26629 Enable the use of the instruction "fmovd". Check -mdalign for
26630 alignment constraints.
26631
26632 -mrenesas
26633 Comply with the calling conventions defined by Renesas.
26634
26635 -mno-renesas
26636 Comply with the calling conventions defined for GCC before the
26637 Renesas conventions were available. This option is the default for
26638 all targets of the SH toolchain.
26639
26640 -mnomacsave
26641 Mark the "MAC" register as call-clobbered, even if -mrenesas is
26642 given.
26643
26644 -mieee
26645 -mno-ieee
26646 Control the IEEE compliance of floating-point comparisons, which
26647 affects the handling of cases where the result of a comparison is
26648 unordered. By default -mieee is implicitly enabled. If
26649 -ffinite-math-only is enabled -mno-ieee is implicitly set, which
26650 results in faster floating-point greater-equal and less-equal
26651 comparisons. The implicit settings can be overridden by specifying
26652 either -mieee or -mno-ieee.
26653
26654 -minline-ic_invalidate
26655 Inline code to invalidate instruction cache entries after setting
26656 up nested function trampolines. This option has no effect if
26657 -musermode is in effect and the selected code generation option
26658 (e.g. -m4) does not allow the use of the "icbi" instruction. If
26659 the selected code generation option does not allow the use of the
26660 "icbi" instruction, and -musermode is not in effect, the inlined
26661 code manipulates the instruction cache address array directly with
26662 an associative write. This not only requires privileged mode at
26663 run time, but it also fails if the cache line had been mapped via
26664 the TLB and has become unmapped.
26665
26666 -misize
26667 Dump instruction size and location in the assembly code.
26668
26669 -mpadstruct
26670 This option is deprecated. It pads structures to multiple of 4
26671 bytes, which is incompatible with the SH ABI.
26672
26673 -matomic-model=model
26674 Sets the model of atomic operations and additional parameters as a
26675 comma separated list. For details on the atomic built-in functions
26676 see __atomic Builtins. The following models and parameters are
26677 supported:
26678
26679 none
26680 Disable compiler generated atomic sequences and emit library
26681 calls for atomic operations. This is the default if the target
26682 is not "sh*-*-linux*".
26683
26684 soft-gusa
26685 Generate GNU/Linux compatible gUSA software atomic sequences
26686 for the atomic built-in functions. The generated atomic
26687 sequences require additional support from the
26688 interrupt/exception handling code of the system and are only
26689 suitable for SH3* and SH4* single-core systems. This option is
26690 enabled by default when the target is "sh*-*-linux*" and SH3*
26691 or SH4*. When the target is SH4A, this option also partially
26692 utilizes the hardware atomic instructions "movli.l" and
26693 "movco.l" to create more efficient code, unless strict is
26694 specified.
26695
26696 soft-tcb
26697 Generate software atomic sequences that use a variable in the
26698 thread control block. This is a variation of the gUSA
26699 sequences which can also be used on SH1* and SH2* targets. The
26700 generated atomic sequences require additional support from the
26701 interrupt/exception handling code of the system and are only
26702 suitable for single-core systems. When using this model, the
26703 gbr-offset= parameter has to be specified as well.
26704
26705 soft-imask
26706 Generate software atomic sequences that temporarily disable
26707 interrupts by setting "SR.IMASK = 1111". This model works only
26708 when the program runs in privileged mode and is only suitable
26709 for single-core systems. Additional support from the
26710 interrupt/exception handling code of the system is not
26711 required. This model is enabled by default when the target is
26712 "sh*-*-linux*" and SH1* or SH2*.
26713
26714 hard-llcs
26715 Generate hardware atomic sequences using the "movli.l" and
26716 "movco.l" instructions only. This is only available on SH4A
26717 and is suitable for multi-core systems. Since the hardware
26718 instructions support only 32 bit atomic variables access to 8
26719 or 16 bit variables is emulated with 32 bit accesses. Code
26720 compiled with this option is also compatible with other
26721 software atomic model interrupt/exception handling systems if
26722 executed on an SH4A system. Additional support from the
26723 interrupt/exception handling code of the system is not required
26724 for this model.
26725
26726 gbr-offset=
26727 This parameter specifies the offset in bytes of the variable in
26728 the thread control block structure that should be used by the
26729 generated atomic sequences when the soft-tcb model has been
26730 selected. For other models this parameter is ignored. The
26731 specified value must be an integer multiple of four and in the
26732 range 0-1020.
26733
26734 strict
26735 This parameter prevents mixed usage of multiple atomic models,
26736 even if they are compatible, and makes the compiler generate
26737 atomic sequences of the specified model only.
26738
26739 -mtas
26740 Generate the "tas.b" opcode for "__atomic_test_and_set". Notice
26741 that depending on the particular hardware and software
26742 configuration this can degrade overall performance due to the
26743 operand cache line flushes that are implied by the "tas.b"
26744 instruction. On multi-core SH4A processors the "tas.b" instruction
26745 must be used with caution since it can result in data corruption
26746 for certain cache configurations.
26747
26748 -mprefergot
26749 When generating position-independent code, emit function calls
26750 using the Global Offset Table instead of the Procedure Linkage
26751 Table.
26752
26753 -musermode
26754 -mno-usermode
26755 Don't allow (allow) the compiler generating privileged mode code.
26756 Specifying -musermode also implies -mno-inline-ic_invalidate if the
26757 inlined code would not work in user mode. -musermode is the
26758 default when the target is "sh*-*-linux*". If the target is SH1*
26759 or SH2* -musermode has no effect, since there is no user mode.
26760
26761 -multcost=number
26762 Set the cost to assume for a multiply insn.
26763
26764 -mdiv=strategy
26765 Set the division strategy to be used for integer division
26766 operations. strategy can be one of:
26767
26768 call-div1
26769 Calls a library function that uses the single-step division
26770 instruction "div1" to perform the operation. Division by zero
26771 calculates an unspecified result and does not trap. This is
26772 the default except for SH4, SH2A and SHcompact.
26773
26774 call-fp
26775 Calls a library function that performs the operation in double
26776 precision floating point. Division by zero causes a floating-
26777 point exception. This is the default for SHcompact with FPU.
26778 Specifying this for targets that do not have a double precision
26779 FPU defaults to "call-div1".
26780
26781 call-table
26782 Calls a library function that uses a lookup table for small
26783 divisors and the "div1" instruction with case distinction for
26784 larger divisors. Division by zero calculates an unspecified
26785 result and does not trap. This is the default for SH4.
26786 Specifying this for targets that do not have dynamic shift
26787 instructions defaults to "call-div1".
26788
26789 When a division strategy has not been specified the default
26790 strategy is selected based on the current target. For SH2A the
26791 default strategy is to use the "divs" and "divu" instructions
26792 instead of library function calls.
26793
26794 -maccumulate-outgoing-args
26795 Reserve space once for outgoing arguments in the function prologue
26796 rather than around each call. Generally beneficial for performance
26797 and size. Also needed for unwinding to avoid changing the stack
26798 frame around conditional code.
26799
26800 -mdivsi3_libfunc=name
26801 Set the name of the library function used for 32-bit signed
26802 division to name. This only affects the name used in the call
26803 division strategies, and the compiler still expects the same sets
26804 of input/output/clobbered registers as if this option were not
26805 present.
26806
26807 -mfixed-range=register-range
26808 Generate code treating the given register range as fixed registers.
26809 A fixed register is one that the register allocator cannot use.
26810 This is useful when compiling kernel code. A register range is
26811 specified as two registers separated by a dash. Multiple register
26812 ranges can be specified separated by a comma.
26813
26814 -mbranch-cost=num
26815 Assume num to be the cost for a branch instruction. Higher numbers
26816 make the compiler try to generate more branch-free code if
26817 possible. If not specified the value is selected depending on the
26818 processor type that is being compiled for.
26819
26820 -mzdcbranch
26821 -mno-zdcbranch
26822 Assume (do not assume) that zero displacement conditional branch
26823 instructions "bt" and "bf" are fast. If -mzdcbranch is specified,
26824 the compiler prefers zero displacement branch code sequences. This
26825 is enabled by default when generating code for SH4 and SH4A. It
26826 can be explicitly disabled by specifying -mno-zdcbranch.
26827
26828 -mcbranch-force-delay-slot
26829 Force the usage of delay slots for conditional branches, which
26830 stuffs the delay slot with a "nop" if a suitable instruction cannot
26831 be found. By default this option is disabled. It can be enabled
26832 to work around hardware bugs as found in the original SH7055.
26833
26834 -mfused-madd
26835 -mno-fused-madd
26836 Generate code that uses (does not use) the floating-point multiply
26837 and accumulate instructions. These instructions are generated by
26838 default if hardware floating point is used. The machine-dependent
26839 -mfused-madd option is now mapped to the machine-independent
26840 -ffp-contract=fast option, and -mno-fused-madd is mapped to
26841 -ffp-contract=off.
26842
26843 -mfsca
26844 -mno-fsca
26845 Allow or disallow the compiler to emit the "fsca" instruction for
26846 sine and cosine approximations. The option -mfsca must be used in
26847 combination with -funsafe-math-optimizations. It is enabled by
26848 default when generating code for SH4A. Using -mno-fsca disables
26849 sine and cosine approximations even if -funsafe-math-optimizations
26850 is in effect.
26851
26852 -mfsrra
26853 -mno-fsrra
26854 Allow or disallow the compiler to emit the "fsrra" instruction for
26855 reciprocal square root approximations. The option -mfsrra must be
26856 used in combination with -funsafe-math-optimizations and
26857 -ffinite-math-only. It is enabled by default when generating code
26858 for SH4A. Using -mno-fsrra disables reciprocal square root
26859 approximations even if -funsafe-math-optimizations and
26860 -ffinite-math-only are in effect.
26861
26862 -mpretend-cmove
26863 Prefer zero-displacement conditional branches for conditional move
26864 instruction patterns. This can result in faster code on the SH4
26865 processor.
26866
26867 -mfdpic
26868 Generate code using the FDPIC ABI.
26869
26870 Solaris 2 Options
26871 These -m options are supported on Solaris 2:
26872
26873 -mclear-hwcap
26874 -mclear-hwcap tells the compiler to remove the hardware
26875 capabilities generated by the Solaris assembler. This is only
26876 necessary when object files use ISA extensions not supported by the
26877 current machine, but check at runtime whether or not to use them.
26878
26879 -mimpure-text
26880 -mimpure-text, used in addition to -shared, tells the compiler to
26881 not pass -z text to the linker when linking a shared object. Using
26882 this option, you can link position-dependent code into a shared
26883 object.
26884
26885 -mimpure-text suppresses the "relocations remain against
26886 allocatable but non-writable sections" linker error message.
26887 However, the necessary relocations trigger copy-on-write, and the
26888 shared object is not actually shared across processes. Instead of
26889 using -mimpure-text, you should compile all source code with -fpic
26890 or -fPIC.
26891
26892 These switches are supported in addition to the above on Solaris 2:
26893
26894 -pthreads
26895 This is a synonym for -pthread.
26896
26897 SPARC Options
26898 These -m options are supported on the SPARC:
26899
26900 -mno-app-regs
26901 -mapp-regs
26902 Specify -mapp-regs to generate output using the global registers 2
26903 through 4, which the SPARC SVR4 ABI reserves for applications.
26904 Like the global register 1, each global register 2 through 4 is
26905 then treated as an allocable register that is clobbered by function
26906 calls. This is the default.
26907
26908 To be fully SVR4 ABI-compliant at the cost of some performance
26909 loss, specify -mno-app-regs. You should compile libraries and
26910 system software with this option.
26911
26912 -mflat
26913 -mno-flat
26914 With -mflat, the compiler does not generate save/restore
26915 instructions and uses a "flat" or single register window model.
26916 This model is compatible with the regular register window model.
26917 The local registers and the input registers (0--5) are still
26918 treated as "call-saved" registers and are saved on the stack as
26919 needed.
26920
26921 With -mno-flat (the default), the compiler generates save/restore
26922 instructions (except for leaf functions). This is the normal
26923 operating mode.
26924
26925 -mfpu
26926 -mhard-float
26927 Generate output containing floating-point instructions. This is
26928 the default.
26929
26930 -mno-fpu
26931 -msoft-float
26932 Generate output containing library calls for floating point.
26933 Warning: the requisite libraries are not available for all SPARC
26934 targets. Normally the facilities of the machine's usual C compiler
26935 are used, but this cannot be done directly in cross-compilation.
26936 You must make your own arrangements to provide suitable library
26937 functions for cross-compilation. The embedded targets sparc-*-aout
26938 and sparclite-*-* do provide software floating-point support.
26939
26940 -msoft-float changes the calling convention in the output file;
26941 therefore, it is only useful if you compile all of a program with
26942 this option. In particular, you need to compile libgcc.a, the
26943 library that comes with GCC, with -msoft-float in order for this to
26944 work.
26945
26946 -mhard-quad-float
26947 Generate output containing quad-word (long double) floating-point
26948 instructions.
26949
26950 -msoft-quad-float
26951 Generate output containing library calls for quad-word (long
26952 double) floating-point instructions. The functions called are
26953 those specified in the SPARC ABI. This is the default.
26954
26955 As of this writing, there are no SPARC implementations that have
26956 hardware support for the quad-word floating-point instructions.
26957 They all invoke a trap handler for one of these instructions, and
26958 then the trap handler emulates the effect of the instruction.
26959 Because of the trap handler overhead, this is much slower than
26960 calling the ABI library routines. Thus the -msoft-quad-float
26961 option is the default.
26962
26963 -mno-unaligned-doubles
26964 -munaligned-doubles
26965 Assume that doubles have 8-byte alignment. This is the default.
26966
26967 With -munaligned-doubles, GCC assumes that doubles have 8-byte
26968 alignment only if they are contained in another type, or if they
26969 have an absolute address. Otherwise, it assumes they have 4-byte
26970 alignment. Specifying this option avoids some rare compatibility
26971 problems with code generated by other compilers. It is not the
26972 default because it results in a performance loss, especially for
26973 floating-point code.
26974
26975 -muser-mode
26976 -mno-user-mode
26977 Do not generate code that can only run in supervisor mode. This is
26978 relevant only for the "casa" instruction emitted for the LEON3
26979 processor. This is the default.
26980
26981 -mfaster-structs
26982 -mno-faster-structs
26983 With -mfaster-structs, the compiler assumes that structures should
26984 have 8-byte alignment. This enables the use of pairs of "ldd" and
26985 "std" instructions for copies in structure assignment, in place of
26986 twice as many "ld" and "st" pairs. However, the use of this
26987 changed alignment directly violates the SPARC ABI. Thus, it's
26988 intended only for use on targets where the developer acknowledges
26989 that their resulting code is not directly in line with the rules of
26990 the ABI.
26991
26992 -mstd-struct-return
26993 -mno-std-struct-return
26994 With -mstd-struct-return, the compiler generates checking code in
26995 functions returning structures or unions to detect size mismatches
26996 between the two sides of function calls, as per the 32-bit ABI.
26997
26998 The default is -mno-std-struct-return. This option has no effect
26999 in 64-bit mode.
27000
27001 -mlra
27002 -mno-lra
27003 Enable Local Register Allocation. This is the default for SPARC
27004 since GCC 7 so -mno-lra needs to be passed to get old Reload.
27005
27006 -mcpu=cpu_type
27007 Set the instruction set, register set, and instruction scheduling
27008 parameters for machine type cpu_type. Supported values for
27009 cpu_type are v7, cypress, v8, supersparc, hypersparc, leon, leon3,
27010 leon3v7, leon5, sparclite, f930, f934, sparclite86x, sparclet,
27011 tsc701, v9, ultrasparc, ultrasparc3, niagara, niagara2, niagara3,
27012 niagara4, niagara7 and m8.
27013
27014 Native Solaris and GNU/Linux toolchains also support the value
27015 native, which selects the best architecture option for the host
27016 processor. -mcpu=native has no effect if GCC does not recognize
27017 the processor.
27018
27019 Default instruction scheduling parameters are used for values that
27020 select an architecture and not an implementation. These are v7,
27021 v8, sparclite, sparclet, v9.
27022
27023 Here is a list of each supported architecture and their supported
27024 implementations.
27025
27026 v7 cypress, leon3v7
27027
27028 v8 supersparc, hypersparc, leon, leon3, leon5
27029
27030 sparclite
27031 f930, f934, sparclite86x
27032
27033 sparclet
27034 tsc701
27035
27036 v9 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
27037 niagara7, m8
27038
27039 By default (unless configured otherwise), GCC generates code for
27040 the V7 variant of the SPARC architecture. With -mcpu=cypress, the
27041 compiler additionally optimizes it for the Cypress CY7C602 chip, as
27042 used in the SPARCStation/SPARCServer 3xx series. This is also
27043 appropriate for the older SPARCStation 1, 2, IPX etc.
27044
27045 With -mcpu=v8, GCC generates code for the V8 variant of the SPARC
27046 architecture. The only difference from V7 code is that the
27047 compiler emits the integer multiply and integer divide instructions
27048 which exist in SPARC-V8 but not in SPARC-V7. With
27049 -mcpu=supersparc, the compiler additionally optimizes it for the
27050 SuperSPARC chip, as used in the SPARCStation 10, 1000 and 2000
27051 series.
27052
27053 With -mcpu=sparclite, GCC generates code for the SPARClite variant
27054 of the SPARC architecture. This adds the integer multiply, integer
27055 divide step and scan ("ffs") instructions which exist in SPARClite
27056 but not in SPARC-V7. With -mcpu=f930, the compiler additionally
27057 optimizes it for the Fujitsu MB86930 chip, which is the original
27058 SPARClite, with no FPU. With -mcpu=f934, the compiler additionally
27059 optimizes it for the Fujitsu MB86934 chip, which is the more recent
27060 SPARClite with FPU.
27061
27062 With -mcpu=sparclet, GCC generates code for the SPARClet variant of
27063 the SPARC architecture. This adds the integer multiply,
27064 multiply/accumulate, integer divide step and scan ("ffs")
27065 instructions which exist in SPARClet but not in SPARC-V7. With
27066 -mcpu=tsc701, the compiler additionally optimizes it for the TEMIC
27067 SPARClet chip.
27068
27069 With -mcpu=v9, GCC generates code for the V9 variant of the SPARC
27070 architecture. This adds 64-bit integer and floating-point move
27071 instructions, 3 additional floating-point condition code registers
27072 and conditional move instructions. With -mcpu=ultrasparc, the
27073 compiler additionally optimizes it for the Sun UltraSPARC I/II/IIi
27074 chips. With -mcpu=ultrasparc3, the compiler additionally optimizes
27075 it for the Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
27076 -mcpu=niagara, the compiler additionally optimizes it for Sun
27077 UltraSPARC T1 chips. With -mcpu=niagara2, the compiler
27078 additionally optimizes it for Sun UltraSPARC T2 chips. With
27079 -mcpu=niagara3, the compiler additionally optimizes it for Sun
27080 UltraSPARC T3 chips. With -mcpu=niagara4, the compiler
27081 additionally optimizes it for Sun UltraSPARC T4 chips. With
27082 -mcpu=niagara7, the compiler additionally optimizes it for Oracle
27083 SPARC M7 chips. With -mcpu=m8, the compiler additionally optimizes
27084 it for Oracle M8 chips.
27085
27086 -mtune=cpu_type
27087 Set the instruction scheduling parameters for machine type
27088 cpu_type, but do not set the instruction set or register set that
27089 the option -mcpu=cpu_type does.
27090
27091 The same values for -mcpu=cpu_type can be used for -mtune=cpu_type,
27092 but the only useful values are those that select a particular CPU
27093 implementation. Those are cypress, supersparc, hypersparc, leon,
27094 leon3, leon3v7, leon5, f930, f934, sparclite86x, tsc701,
27095 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
27096 niagara7 and m8. With native Solaris and GNU/Linux toolchains,
27097 native can also be used.
27098
27099 -mv8plus
27100 -mno-v8plus
27101 With -mv8plus, GCC generates code for the SPARC-V8+ ABI. The
27102 difference from the V8 ABI is that the global and out registers are
27103 considered 64 bits wide. This is enabled by default on Solaris in
27104 32-bit mode for all SPARC-V9 processors.
27105
27106 -mvis
27107 -mno-vis
27108 With -mvis, GCC generates code that takes advantage of the
27109 UltraSPARC Visual Instruction Set extensions. The default is
27110 -mno-vis.
27111
27112 -mvis2
27113 -mno-vis2
27114 With -mvis2, GCC generates code that takes advantage of version 2.0
27115 of the UltraSPARC Visual Instruction Set extensions. The default
27116 is -mvis2 when targeting a cpu that supports such instructions,
27117 such as UltraSPARC-III and later. Setting -mvis2 also sets -mvis.
27118
27119 -mvis3
27120 -mno-vis3
27121 With -mvis3, GCC generates code that takes advantage of version 3.0
27122 of the UltraSPARC Visual Instruction Set extensions. The default
27123 is -mvis3 when targeting a cpu that supports such instructions,
27124 such as niagara-3 and later. Setting -mvis3 also sets -mvis2 and
27125 -mvis.
27126
27127 -mvis4
27128 -mno-vis4
27129 With -mvis4, GCC generates code that takes advantage of version 4.0
27130 of the UltraSPARC Visual Instruction Set extensions. The default
27131 is -mvis4 when targeting a cpu that supports such instructions,
27132 such as niagara-7 and later. Setting -mvis4 also sets -mvis3,
27133 -mvis2 and -mvis.
27134
27135 -mvis4b
27136 -mno-vis4b
27137 With -mvis4b, GCC generates code that takes advantage of version
27138 4.0 of the UltraSPARC Visual Instruction Set extensions, plus the
27139 additional VIS instructions introduced in the Oracle SPARC
27140 Architecture 2017. The default is -mvis4b when targeting a cpu
27141 that supports such instructions, such as m8 and later. Setting
27142 -mvis4b also sets -mvis4, -mvis3, -mvis2 and -mvis.
27143
27144 -mcbcond
27145 -mno-cbcond
27146 With -mcbcond, GCC generates code that takes advantage of the
27147 UltraSPARC Compare-and-Branch-on-Condition instructions. The
27148 default is -mcbcond when targeting a CPU that supports such
27149 instructions, such as Niagara-4 and later.
27150
27151 -mfmaf
27152 -mno-fmaf
27153 With -mfmaf, GCC generates code that takes advantage of the
27154 UltraSPARC Fused Multiply-Add Floating-point instructions. The
27155 default is -mfmaf when targeting a CPU that supports such
27156 instructions, such as Niagara-3 and later.
27157
27158 -mfsmuld
27159 -mno-fsmuld
27160 With -mfsmuld, GCC generates code that takes advantage of the
27161 Floating-point Multiply Single to Double (FsMULd) instruction. The
27162 default is -mfsmuld when targeting a CPU supporting the
27163 architecture versions V8 or V9 with FPU except -mcpu=leon.
27164
27165 -mpopc
27166 -mno-popc
27167 With -mpopc, GCC generates code that takes advantage of the
27168 UltraSPARC Population Count instruction. The default is -mpopc
27169 when targeting a CPU that supports such an instruction, such as
27170 Niagara-2 and later.
27171
27172 -msubxc
27173 -mno-subxc
27174 With -msubxc, GCC generates code that takes advantage of the
27175 UltraSPARC Subtract-Extended-with-Carry instruction. The default
27176 is -msubxc when targeting a CPU that supports such an instruction,
27177 such as Niagara-7 and later.
27178
27179 -mfix-at697f
27180 Enable the documented workaround for the single erratum of the
27181 Atmel AT697F processor (which corresponds to erratum #13 of the
27182 AT697E processor).
27183
27184 -mfix-ut699
27185 Enable the documented workarounds for the floating-point errata and
27186 the data cache nullify errata of the UT699 processor.
27187
27188 -mfix-ut700
27189 Enable the documented workaround for the back-to-back store errata
27190 of the UT699E/UT700 processor.
27191
27192 -mfix-gr712rc
27193 Enable the documented workaround for the back-to-back store errata
27194 of the GR712RC processor.
27195
27196 These -m options are supported in addition to the above on SPARC-V9
27197 processors in 64-bit environments:
27198
27199 -m32
27200 -m64
27201 Generate code for a 32-bit or 64-bit environment. The 32-bit
27202 environment sets int, long and pointer to 32 bits. The 64-bit
27203 environment sets int to 32 bits and long and pointer to 64 bits.
27204
27205 -mcmodel=which
27206 Set the code model to one of
27207
27208 medlow
27209 The Medium/Low code model: 64-bit addresses, programs must be
27210 linked in the low 32 bits of memory. Programs can be
27211 statically or dynamically linked.
27212
27213 medmid
27214 The Medium/Middle code model: 64-bit addresses, programs must
27215 be linked in the low 44 bits of memory, the text and data
27216 segments must be less than 2GB in size and the data segment
27217 must be located within 2GB of the text segment.
27218
27219 medany
27220 The Medium/Anywhere code model: 64-bit addresses, programs may
27221 be linked anywhere in memory, the text and data segments must
27222 be less than 2GB in size and the data segment must be located
27223 within 2GB of the text segment.
27224
27225 embmedany
27226 The Medium/Anywhere code model for embedded systems: 64-bit
27227 addresses, the text and data segments must be less than 2GB in
27228 size, both starting anywhere in memory (determined at link
27229 time). The global register %g4 points to the base of the data
27230 segment. Programs are statically linked and PIC is not
27231 supported.
27232
27233 -mmemory-model=mem-model
27234 Set the memory model in force on the processor to one of
27235
27236 default
27237 The default memory model for the processor and operating
27238 system.
27239
27240 rmo Relaxed Memory Order
27241
27242 pso Partial Store Order
27243
27244 tso Total Store Order
27245
27246 sc Sequential Consistency
27247
27248 These memory models are formally defined in Appendix D of the
27249 SPARC-V9 architecture manual, as set in the processor's "PSTATE.MM"
27250 field.
27251
27252 -mstack-bias
27253 -mno-stack-bias
27254 With -mstack-bias, GCC assumes that the stack pointer, and frame
27255 pointer if present, are offset by -2047 which must be added back
27256 when making stack frame references. This is the default in 64-bit
27257 mode. Otherwise, assume no such offset is present.
27258
27259 Options for System V
27260 These additional options are available on System V Release 4 for
27261 compatibility with other compilers on those systems:
27262
27263 -G Create a shared object. It is recommended that -symbolic or
27264 -shared be used instead.
27265
27266 -Qy Identify the versions of each tool used by the compiler, in a
27267 ".ident" assembler directive in the output.
27268
27269 -Qn Refrain from adding ".ident" directives to the output file (this is
27270 the default).
27271
27272 -YP,dirs
27273 Search the directories dirs, and no others, for libraries specified
27274 with -l.
27275
27276 -Ym,dir
27277 Look in the directory dir to find the M4 preprocessor. The
27278 assembler uses this option.
27279
27280 V850 Options
27281 These -m options are defined for V850 implementations:
27282
27283 -mlong-calls
27284 -mno-long-calls
27285 Treat all calls as being far away (near). If calls are assumed to
27286 be far away, the compiler always loads the function's address into
27287 a register, and calls indirect through the pointer.
27288
27289 -mno-ep
27290 -mep
27291 Do not optimize (do optimize) basic blocks that use the same index
27292 pointer 4 or more times to copy pointer into the "ep" register, and
27293 use the shorter "sld" and "sst" instructions. The -mep option is
27294 on by default if you optimize.
27295
27296 -mno-prolog-function
27297 -mprolog-function
27298 Do not use (do use) external functions to save and restore
27299 registers at the prologue and epilogue of a function. The external
27300 functions are slower, but use less code space if more than one
27301 function saves the same number of registers. The -mprolog-function
27302 option is on by default if you optimize.
27303
27304 -mspace
27305 Try to make the code as small as possible. At present, this just
27306 turns on the -mep and -mprolog-function options.
27307
27308 -mtda=n
27309 Put static or global variables whose size is n bytes or less into
27310 the tiny data area that register "ep" points to. The tiny data
27311 area can hold up to 256 bytes in total (128 bytes for byte
27312 references).
27313
27314 -msda=n
27315 Put static or global variables whose size is n bytes or less into
27316 the small data area that register "gp" points to. The small data
27317 area can hold up to 64 kilobytes.
27318
27319 -mzda=n
27320 Put static or global variables whose size is n bytes or less into
27321 the first 32 kilobytes of memory.
27322
27323 -mv850
27324 Specify that the target processor is the V850.
27325
27326 -mv850e3v5
27327 Specify that the target processor is the V850E3V5. The
27328 preprocessor constant "__v850e3v5__" is defined if this option is
27329 used.
27330
27331 -mv850e2v4
27332 Specify that the target processor is the V850E3V5. This is an
27333 alias for the -mv850e3v5 option.
27334
27335 -mv850e2v3
27336 Specify that the target processor is the V850E2V3. The
27337 preprocessor constant "__v850e2v3__" is defined if this option is
27338 used.
27339
27340 -mv850e2
27341 Specify that the target processor is the V850E2. The preprocessor
27342 constant "__v850e2__" is defined if this option is used.
27343
27344 -mv850e1
27345 Specify that the target processor is the V850E1. The preprocessor
27346 constants "__v850e1__" and "__v850e__" are defined if this option
27347 is used.
27348
27349 -mv850es
27350 Specify that the target processor is the V850ES. This is an alias
27351 for the -mv850e1 option.
27352
27353 -mv850e
27354 Specify that the target processor is the V850E. The preprocessor
27355 constant "__v850e__" is defined if this option is used.
27356
27357 If neither -mv850 nor -mv850e nor -mv850e1 nor -mv850e2 nor
27358 -mv850e2v3 nor -mv850e3v5 are defined then a default target
27359 processor is chosen and the relevant __v850*__ preprocessor
27360 constant is defined.
27361
27362 The preprocessor constants "__v850" and "__v851__" are always
27363 defined, regardless of which processor variant is the target.
27364
27365 -mdisable-callt
27366 -mno-disable-callt
27367 This option suppresses generation of the "CALLT" instruction for
27368 the v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the
27369 v850 architecture.
27370
27371 This option is enabled by default when the RH850 ABI is in use (see
27372 -mrh850-abi), and disabled by default when the GCC ABI is in use.
27373 If "CALLT" instructions are being generated then the C preprocessor
27374 symbol "__V850_CALLT__" is defined.
27375
27376 -mrelax
27377 -mno-relax
27378 Pass on (or do not pass on) the -mrelax command-line option to the
27379 assembler.
27380
27381 -mlong-jumps
27382 -mno-long-jumps
27383 Disable (or re-enable) the generation of PC-relative jump
27384 instructions.
27385
27386 -msoft-float
27387 -mhard-float
27388 Disable (or re-enable) the generation of hardware floating point
27389 instructions. This option is only significant when the target
27390 architecture is V850E2V3 or higher. If hardware floating point
27391 instructions are being generated then the C preprocessor symbol
27392 "__FPU_OK__" is defined, otherwise the symbol "__NO_FPU__" is
27393 defined.
27394
27395 -mloop
27396 Enables the use of the e3v5 LOOP instruction. The use of this
27397 instruction is not enabled by default when the e3v5 architecture is
27398 selected because its use is still experimental.
27399
27400 -mrh850-abi
27401 -mghs
27402 Enables support for the RH850 version of the V850 ABI. This is the
27403 default. With this version of the ABI the following rules apply:
27404
27405 * Integer sized structures and unions are returned via a memory
27406 pointer rather than a register.
27407
27408 * Large structures and unions (more than 8 bytes in size) are
27409 passed by value.
27410
27411 * Functions are aligned to 16-bit boundaries.
27412
27413 * The -m8byte-align command-line option is supported.
27414
27415 * The -mdisable-callt command-line option is enabled by default.
27416 The -mno-disable-callt command-line option is not supported.
27417
27418 When this version of the ABI is enabled the C preprocessor symbol
27419 "__V850_RH850_ABI__" is defined.
27420
27421 -mgcc-abi
27422 Enables support for the old GCC version of the V850 ABI. With this
27423 version of the ABI the following rules apply:
27424
27425 * Integer sized structures and unions are returned in register
27426 "r10".
27427
27428 * Large structures and unions (more than 8 bytes in size) are
27429 passed by reference.
27430
27431 * Functions are aligned to 32-bit boundaries, unless optimizing
27432 for size.
27433
27434 * The -m8byte-align command-line option is not supported.
27435
27436 * The -mdisable-callt command-line option is supported but not
27437 enabled by default.
27438
27439 When this version of the ABI is enabled the C preprocessor symbol
27440 "__V850_GCC_ABI__" is defined.
27441
27442 -m8byte-align
27443 -mno-8byte-align
27444 Enables support for "double" and "long long" types to be aligned on
27445 8-byte boundaries. The default is to restrict the alignment of all
27446 objects to at most 4-bytes. When -m8byte-align is in effect the C
27447 preprocessor symbol "__V850_8BYTE_ALIGN__" is defined.
27448
27449 -mbig-switch
27450 Generate code suitable for big switch tables. Use this option only
27451 if the assembler/linker complain about out of range branches within
27452 a switch table.
27453
27454 -mapp-regs
27455 This option causes r2 and r5 to be used in the code generated by
27456 the compiler. This setting is the default.
27457
27458 -mno-app-regs
27459 This option causes r2 and r5 to be treated as fixed registers.
27460
27461 VAX Options
27462 These -m options are defined for the VAX:
27463
27464 -munix
27465 Do not output certain jump instructions ("aobleq" and so on) that
27466 the Unix assembler for the VAX cannot handle across long ranges.
27467
27468 -mgnu
27469 Do output those jump instructions, on the assumption that the GNU
27470 assembler is being used.
27471
27472 -mg Output code for G-format floating-point numbers instead of
27473 D-format.
27474
27475 -mlra
27476 -mno-lra
27477 Enable Local Register Allocation. This is still experimental for
27478 the VAX, so by default the compiler uses standard reload.
27479
27480 Visium Options
27481 -mdebug
27482 A program which performs file I/O and is destined to run on an MCM
27483 target should be linked with this option. It causes the libraries
27484 libc.a and libdebug.a to be linked. The program should be run on
27485 the target under the control of the GDB remote debugging stub.
27486
27487 -msim
27488 A program which performs file I/O and is destined to run on the
27489 simulator should be linked with option. This causes libraries
27490 libc.a and libsim.a to be linked.
27491
27492 -mfpu
27493 -mhard-float
27494 Generate code containing floating-point instructions. This is the
27495 default.
27496
27497 -mno-fpu
27498 -msoft-float
27499 Generate code containing library calls for floating-point.
27500
27501 -msoft-float changes the calling convention in the output file;
27502 therefore, it is only useful if you compile all of a program with
27503 this option. In particular, you need to compile libgcc.a, the
27504 library that comes with GCC, with -msoft-float in order for this to
27505 work.
27506
27507 -mcpu=cpu_type
27508 Set the instruction set, register set, and instruction scheduling
27509 parameters for machine type cpu_type. Supported values for
27510 cpu_type are mcm, gr5 and gr6.
27511
27512 mcm is a synonym of gr5 present for backward compatibility.
27513
27514 By default (unless configured otherwise), GCC generates code for
27515 the GR5 variant of the Visium architecture.
27516
27517 With -mcpu=gr6, GCC generates code for the GR6 variant of the
27518 Visium architecture. The only difference from GR5 code is that the
27519 compiler will generate block move instructions.
27520
27521 -mtune=cpu_type
27522 Set the instruction scheduling parameters for machine type
27523 cpu_type, but do not set the instruction set or register set that
27524 the option -mcpu=cpu_type would.
27525
27526 -msv-mode
27527 Generate code for the supervisor mode, where there are no
27528 restrictions on the access to general registers. This is the
27529 default.
27530
27531 -muser-mode
27532 Generate code for the user mode, where the access to some general
27533 registers is forbidden: on the GR5, registers r24 to r31 cannot be
27534 accessed in this mode; on the GR6, only registers r29 to r31 are
27535 affected.
27536
27537 VMS Options
27538 These -m options are defined for the VMS implementations:
27539
27540 -mvms-return-codes
27541 Return VMS condition codes from "main". The default is to return
27542 POSIX-style condition (e.g. error) codes.
27543
27544 -mdebug-main=prefix
27545 Flag the first routine whose name starts with prefix as the main
27546 routine for the debugger.
27547
27548 -mmalloc64
27549 Default to 64-bit memory allocation routines.
27550
27551 -mpointer-size=size
27552 Set the default size of pointers. Possible options for size are 32
27553 or short for 32 bit pointers, 64 or long for 64 bit pointers, and
27554 no for supporting only 32 bit pointers. The later option disables
27555 "pragma pointer_size".
27556
27557 VxWorks Options
27558 The options in this section are defined for all VxWorks targets.
27559 Options specific to the target hardware are listed with the other
27560 options for that target.
27561
27562 -mrtp
27563 GCC can generate code for both VxWorks kernels and real time
27564 processes (RTPs). This option switches from the former to the
27565 latter. It also defines the preprocessor macro "__RTP__".
27566
27567 -non-static
27568 Link an RTP executable against shared libraries rather than static
27569 libraries. The options -static and -shared can also be used for
27570 RTPs; -static is the default.
27571
27572 -Bstatic
27573 -Bdynamic
27574 These options are passed down to the linker. They are defined for
27575 compatibility with Diab.
27576
27577 -Xbind-lazy
27578 Enable lazy binding of function calls. This option is equivalent
27579 to -Wl,-z,now and is defined for compatibility with Diab.
27580
27581 -Xbind-now
27582 Disable lazy binding of function calls. This option is the default
27583 and is defined for compatibility with Diab.
27584
27585 x86 Options
27586 These -m options are defined for the x86 family of computers.
27587
27588 -march=cpu-type
27589 Generate instructions for the machine type cpu-type. In contrast
27590 to -mtune=cpu-type, which merely tunes the generated code for the
27591 specified cpu-type, -march=cpu-type allows GCC to generate code
27592 that may not run at all on processors other than the one indicated.
27593 Specifying -march=cpu-type implies -mtune=cpu-type, except where
27594 noted otherwise.
27595
27596 The choices for cpu-type are:
27597
27598 native
27599 This selects the CPU to generate code for at compilation time
27600 by determining the processor type of the compiling machine.
27601 Using -march=native enables all instruction subsets supported
27602 by the local machine (hence the result might not run on
27603 different machines). Using -mtune=native produces code
27604 optimized for the local machine under the constraints of the
27605 selected instruction set.
27606
27607 x86-64
27608 A generic CPU with 64-bit extensions.
27609
27610 x86-64-v2
27611 x86-64-v3
27612 x86-64-v4
27613 These choices for cpu-type select the corresponding micro-
27614 architecture level from the x86-64 psABI. On ABIs other than
27615 the x86-64 psABI they select the same CPU features as the
27616 x86-64 psABI documents for the particular micro-architecture
27617 level.
27618
27619 Since these cpu-type values do not have a corresponding -mtune
27620 setting, using -march with these values enables generic tuning.
27621 Specific tuning can be enabled using the -mtune=other-cpu-type
27622 option with an appropriate other-cpu-type value.
27623
27624 i386
27625 Original Intel i386 CPU.
27626
27627 i486
27628 Intel i486 CPU. (No scheduling is implemented for this chip.)
27629
27630 i586
27631 pentium
27632 Intel Pentium CPU with no MMX support.
27633
27634 lakemont
27635 Intel Lakemont MCU, based on Intel Pentium CPU.
27636
27637 pentium-mmx
27638 Intel Pentium MMX CPU, based on Pentium core with MMX
27639 instruction set support.
27640
27641 pentiumpro
27642 Intel Pentium Pro CPU.
27643
27644 i686
27645 When used with -march, the Pentium Pro instruction set is used,
27646 so the code runs on all i686 family chips. When used with
27647 -mtune, it has the same meaning as generic.
27648
27649 pentium2
27650 Intel Pentium II CPU, based on Pentium Pro core with MMX and
27651 FXSR instruction set support.
27652
27653 pentium3
27654 pentium3m
27655 Intel Pentium III CPU, based on Pentium Pro core with MMX, FXSR
27656 and SSE instruction set support.
27657
27658 pentium-m
27659 Intel Pentium M; low-power version of Intel Pentium III CPU
27660 with MMX, SSE, SSE2 and FXSR instruction set support. Used by
27661 Centrino notebooks.
27662
27663 pentium4
27664 pentium4m
27665 Intel Pentium 4 CPU with MMX, SSE, SSE2 and FXSR instruction
27666 set support.
27667
27668 prescott
27669 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2,
27670 SSE3 and FXSR instruction set support.
27671
27672 nocona
27673 Improved version of Intel Pentium 4 CPU with 64-bit extensions,
27674 MMX, SSE, SSE2, SSE3 and FXSR instruction set support.
27675
27676 core2
27677 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
27678 SSSE3, CX16, SAHF and FXSR instruction set support.
27679
27680 nehalem
27681 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
27682 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF and FXSR instruction
27683 set support.
27684
27685 westmere
27686 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2,
27687 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR and
27688 PCLMUL instruction set support.
27689
27690 sandybridge
27691 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
27692 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX,
27693 XSAVE and PCLMUL instruction set support.
27694
27695 ivybridge
27696 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
27697 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX,
27698 XSAVE, PCLMUL, FSGSBASE, RDRND and F16C instruction set
27699 support.
27700
27701 haswell
27702 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE,
27703 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27704 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27705 LZCNT, FMA, MOVBE and HLE instruction set support.
27706
27707 broadwell
27708 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE,
27709 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27710 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27711 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX and PREFETCHW instruction
27712 set support.
27713
27714 skylake
27715 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27716 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27717 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27718 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27719 CLFLUSHOPT, XSAVEC, XSAVES and SGX instruction set support.
27720
27721 bonnell
27722 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE,
27723 SSE2, SSE3 and SSSE3 instruction set support.
27724
27725 silvermont
27726 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE,
27727 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27728 PCLMUL, PREFETCHW and RDRND instruction set support.
27729
27730 goldmont
27731 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE,
27732 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27733 PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE, XSAVEC,
27734 XSAVES, XSAVEOPT, CLFLUSHOPT and FSGSBASE instruction set
27735 support.
27736
27737 goldmont-plus
27738 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX,
27739 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27740 FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE,
27741 XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID
27742 and SGX instruction set support.
27743
27744 tremont
27745 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE,
27746 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27747 PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE, XSAVEC,
27748 XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID, SGX,
27749 CLWB, GFNI-SSE, MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG
27750 instruction set support.
27751
27752 sierraforest
27753 Intel Sierra Forest CPU with 64-bit extensions, MOVBE, MMX,
27754 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
27755 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
27756 PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
27757 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
27758 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL,
27759 WIDEKL, AVX-VNNI, AVXIFMA, AVXVNNIINT8, AVXNECONVERT,
27760 CMPCCXADD, ENQCMD and UINTR instruction set support.
27761
27762 grandridge
27763 Intel Grand Ridge CPU with 64-bit extensions, MOVBE, MMX, SSE,
27764 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
27765 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
27766 PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
27767 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
27768 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL,
27769 WIDEKL, AVX-VNNI, AVXIFMA, AVXVNNIINT8, AVXNECONVERT,
27770 CMPCCXADD, ENQCMD, UINTR and RAOINT instruction set support.
27771
27772 knl Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX,
27773 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27774 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27775 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
27776 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1
27777 instruction set support.
27778
27779 knm Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE,
27780 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27781 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27782 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AVX512PF,
27783 AVX512ER, AVX512F, AVX512CD and PREFETCHWT1, AVX5124VNNIW,
27784 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27785
27786 skylake-avx512
27787 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX,
27788 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27789 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27790 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27791 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
27792 AVX512BW, AVX512DQ and AVX512CD instruction set support.
27793
27794 cannonlake
27795 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX,
27796 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27797 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27798 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27799 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
27800 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA and SHA
27801 instruction set support.
27802
27803 icelake-client
27804 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX,
27805 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27806 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27807 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27808 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
27809 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
27810 AVX512VNNI, GFNI, VAES, AVX512VBMI2 , VPCLMULQDQ, AVX512BITALG,
27811 RDPID and AVX512VPOPCNTDQ instruction set support.
27812
27813 icelake-server
27814 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX,
27815 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27816 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27817 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27818 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
27819 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
27820 AVX512VNNI, GFNI, VAES, AVX512VBMI2 , VPCLMULQDQ, AVX512BITALG,
27821 RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD and CLWB instruction
27822 set support.
27823
27824 cascadelake
27825 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27826 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27827 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27828 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27829 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
27830 AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set
27831 support.
27832
27833 cooperlake
27834 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27835 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27836 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27837 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27838 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
27839 AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16
27840 instruction set support.
27841
27842 tigerlake
27843 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27844 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27845 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27846 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27847 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
27848 AVX512DQ, AVX512CD PKU, AVX512VBMI, AVX512IFMA, SHA,
27849 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
27850 RDPID, AVX512VPOPCNTDQ, MOVDIRI, MOVDIR64B, CLWB,
27851 AVX512VP2INTERSECT and KEYLOCKER instruction set support.
27852
27853 sapphirerapids
27854 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX,
27855 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27856 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27857 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27858 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
27859 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
27860 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
27861 RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB, MOVDIRI,
27862 MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE,
27863 TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI,
27864 AVX512-FP16 and AVX512BF16 instruction set support.
27865
27866 alderlake
27867 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27868 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
27869 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
27870 PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
27871 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
27872 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL,
27873 WIDEKL and AVX-VNNI instruction set support.
27874
27875 rocketlake
27876 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27877 SSE2, SSE3, SSSE3 , SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27878 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27879 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27880 CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL, AVX512BW,
27881 AVX512DQ, AVX512CD PKU, AVX512VBMI, AVX512IFMA, SHA,
27882 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
27883 RDPID and AVX512VPOPCNTDQ instruction set support.
27884
27885 graniterapids
27886 Intel graniterapids CPU with 64-bit extensions, MOVBE, MMX,
27887 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27888 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27889 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27890 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
27891 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
27892 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
27893 RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB, MOVDIRI,
27894 MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE,
27895 TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI,
27896 AVX512-FP16, AVX512BF16, AMX-FP16 and PREFETCHI instruction set
27897 support.
27898
27899 graniterapids-d
27900 Intel graniterapids D CPU with 64-bit extensions, MOVBE, MMX,
27901 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27902 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27903 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27904 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
27905 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
27906 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
27907 RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB, MOVDIRI,
27908 MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE,
27909 TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI,
27910 AVX512FP16, AVX512BF16, AMX-FP16, PREFETCHI and AMX-COMPLEX
27911 instruction set support.
27912
27913 k6 AMD K6 CPU with MMX instruction set support.
27914
27915 k6-2
27916 k6-3
27917 Improved versions of AMD K6 CPU with MMX and 3DNow! instruction
27918 set support.
27919
27920 athlon
27921 athlon-tbird
27922 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow! and SSE
27923 prefetch instructions support.
27924
27925 athlon-4
27926 athlon-xp
27927 athlon-mp
27928 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow! and
27929 full SSE instruction set support.
27930
27931 k8
27932 opteron
27933 athlon64
27934 athlon-fx
27935 Processors based on the AMD K8 core with x86-64 instruction set
27936 support, including the AMD Opteron, Athlon 64, and Athlon 64 FX
27937 processors. (This supersets MMX, SSE, SSE2, 3DNow!, enhanced
27938 3DNow! and 64-bit instruction set extensions.)
27939
27940 k8-sse3
27941 opteron-sse3
27942 athlon64-sse3
27943 Improved versions of AMD K8 cores with SSE3 instruction set
27944 support.
27945
27946 amdfam10
27947 barcelona
27948 CPUs based on AMD Family 10h cores with x86-64 instruction set
27949 support. (This supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!,
27950 enhanced 3DNow!, ABM and 64-bit instruction set extensions.)
27951
27952 bdver1
27953 CPUs based on AMD Family 15h cores with x86-64 instruction set
27954 support. (This supersets FMA4, AVX, XOP, LWP, AES, PCLMUL,
27955 CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM
27956 and 64-bit instruction set extensions.)
27957
27958 bdver2
27959 AMD Family 15h core based CPUs with x86-64 instruction set
27960 support. (This supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP,
27961 LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27962 SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27963
27964 bdver3
27965 AMD Family 15h core based CPUs with x86-64 instruction set
27966 support. (This supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE,
27967 AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27968 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27969 extensions.)
27970
27971 bdver4
27972 AMD Family 15h core based CPUs with x86-64 instruction set
27973 support. (This supersets BMI, BMI2, TBM, F16C, FMA, FMA4,
27974 FSGSBASE, AVX, AVX2, XOP, LWP, AES, PCLMUL, CX16, MOVBE, MMX,
27975 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit
27976 instruction set extensions.)
27977
27978 znver1
27979 AMD Family 17h core based CPUs with x86-64 instruction set
27980 support. (This supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX,
27981 AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL, CX16,
27982 MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM,
27983 XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit instruction set
27984 extensions.)
27985
27986 znver2
27987 AMD Family 17h core based CPUs with x86-64 instruction set
27988 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
27989 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
27990 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27991 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
27992 WBNOINVD, and 64-bit instruction set extensions.)
27993
27994 znver3
27995 AMD Family 19h core based CPUs with x86-64 instruction set
27996 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
27997 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
27998 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27999 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
28000 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set
28001 extensions.)
28002
28003 znver4
28004 AMD Family 19h core based CPUs with x86-64 instruction set
28005 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
28006 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
28007 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
28008 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
28009 WBNOINVD, PKU, VPCLMULQDQ, VAES, AVX512F, AVX512DQ, AVX512IFMA,
28010 AVX512CD, AVX512BW, AVX512VL, AVX512BF16, AVX512VBMI,
28011 AVX512VBMI2, AVX512VNNI, AVX512BITALG, AVX512VPOPCNTDQ, GFNI
28012 and 64-bit instruction set extensions.)
28013
28014 btver1
28015 CPUs based on AMD Family 14h cores with x86-64 instruction set
28016 support. (This supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A,
28017 CX16, ABM and 64-bit instruction set extensions.)
28018
28019 btver2
28020 CPUs based on AMD Family 16h cores with x86-64 instruction set
28021 support. This includes MOVBE, F16C, BMI, AVX, PCLMUL, AES,
28022 SSE4.2, SSE4.1, CX16, ABM, SSE4A, SSSE3, SSE3, SSE2, SSE, MMX
28023 and 64-bit instruction set extensions.
28024
28025 winchip-c6
28026 IDT WinChip C6 CPU, dealt in same way as i486 with additional
28027 MMX instruction set support.
28028
28029 winchip2
28030 IDT WinChip 2 CPU, dealt in same way as i486 with additional
28031 MMX and 3DNow! instruction set support.
28032
28033 c3 VIA C3 CPU with MMX and 3DNow! instruction set support. (No
28034 scheduling is implemented for this chip.)
28035
28036 c3-2
28037 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set
28038 support. (No scheduling is implemented for this chip.)
28039
28040 c7 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction
28041 set support. (No scheduling is implemented for this chip.)
28042
28043 samuel-2
28044 VIA Eden Samuel 2 CPU with MMX and 3DNow! instruction set
28045 support. (No scheduling is implemented for this chip.)
28046
28047 nehemiah
28048 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
28049 (No scheduling is implemented for this chip.)
28050
28051 esther
28052 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction
28053 set support. (No scheduling is implemented for this chip.)
28054
28055 eden-x2
28056 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3
28057 instruction set support. (No scheduling is implemented for
28058 this chip.)
28059
28060 eden-x4
28061 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3,
28062 SSE4.1, SSE4.2, AVX and AVX2 instruction set support. (No
28063 scheduling is implemented for this chip.)
28064
28065 nano
28066 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and
28067 SSSE3 instruction set support. (No scheduling is implemented
28068 for this chip.)
28069
28070 nano-1000
28071 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
28072 instruction set support. (No scheduling is implemented for
28073 this chip.)
28074
28075 nano-2000
28076 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
28077 instruction set support. (No scheduling is implemented for
28078 this chip.)
28079
28080 nano-3000
28081 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and
28082 SSE4.1 instruction set support. (No scheduling is implemented
28083 for this chip.)
28084
28085 nano-x2
28086 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
28087 and SSE4.1 instruction set support. (No scheduling is
28088 implemented for this chip.)
28089
28090 nano-x4
28091 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
28092 and SSE4.1 instruction set support. (No scheduling is
28093 implemented for this chip.)
28094
28095 lujiazui
28096 ZHAOXIN lujiazui CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3,
28097 SSSE3, SSE4.1, SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE,
28098 XSAVEOPT, FSGSBASE, CX16, ABM, BMI, BMI2, F16C, FXSR, RDSEED
28099 instruction set support.
28100
28101 geode
28102 AMD Geode embedded processor with MMX and 3DNow! instruction
28103 set support.
28104
28105 -mtune=cpu-type
28106 Tune to cpu-type everything applicable about the generated code,
28107 except for the ABI and the set of available instructions. While
28108 picking a specific cpu-type schedules things appropriately for that
28109 particular chip, the compiler does not generate any code that
28110 cannot run on the default machine type unless you use a -march=cpu-
28111 type option. For example, if GCC is configured for
28112 i686-pc-linux-gnu then -mtune=pentium4 generates code that is tuned
28113 for Pentium 4 but still runs on i686 machines.
28114
28115 The choices for cpu-type are the same as for -march. In addition,
28116 -mtune supports 2 extra choices for cpu-type:
28117
28118 generic
28119 Produce code optimized for the most common IA32/AMD64/EM64T
28120 processors. If you know the CPU on which your code will run,
28121 then you should use the corresponding -mtune or -march option
28122 instead of -mtune=generic. But, if you do not know exactly
28123 what CPU users of your application will have, then you should
28124 use this option.
28125
28126 As new processors are deployed in the marketplace, the behavior
28127 of this option will change. Therefore, if you upgrade to a
28128 newer version of GCC, code generation controlled by this option
28129 will change to reflect the processors that are most common at
28130 the time that version of GCC is released.
28131
28132 There is no -march=generic option because -march indicates the
28133 instruction set the compiler can use, and there is no generic
28134 instruction set applicable to all processors. In contrast,
28135 -mtune indicates the processor (or, in this case, collection of
28136 processors) for which the code is optimized.
28137
28138 intel
28139 Produce code optimized for the most current Intel processors,
28140 which are Haswell and Silvermont for this version of GCC. If
28141 you know the CPU on which your code will run, then you should
28142 use the corresponding -mtune or -march option instead of
28143 -mtune=intel. But, if you want your application performs
28144 better on both Haswell and Silvermont, then you should use this
28145 option.
28146
28147 As new Intel processors are deployed in the marketplace, the
28148 behavior of this option will change. Therefore, if you upgrade
28149 to a newer version of GCC, code generation controlled by this
28150 option will change to reflect the most current Intel processors
28151 at the time that version of GCC is released.
28152
28153 There is no -march=intel option because -march indicates the
28154 instruction set the compiler can use, and there is no common
28155 instruction set applicable to all processors. In contrast,
28156 -mtune indicates the processor (or, in this case, collection of
28157 processors) for which the code is optimized.
28158
28159 -mcpu=cpu-type
28160 A deprecated synonym for -mtune.
28161
28162 -mfpmath=unit
28163 Generate floating-point arithmetic for selected unit unit. The
28164 choices for unit are:
28165
28166 387 Use the standard 387 floating-point coprocessor present on the
28167 majority of chips and emulated otherwise. Code compiled with
28168 this option runs almost everywhere. The temporary results are
28169 computed in 80-bit precision instead of the precision specified
28170 by the type, resulting in slightly different results compared
28171 to most of other chips. See -ffloat-store for more detailed
28172 description.
28173
28174 This is the default choice for non-Darwin x86-32 targets.
28175
28176 sse Use scalar floating-point instructions present in the SSE
28177 instruction set. This instruction set is supported by Pentium
28178 III and newer chips, and in the AMD line by Athlon-4, Athlon XP
28179 and Athlon MP chips. The earlier version of the SSE
28180 instruction set supports only single-precision arithmetic, thus
28181 the double and extended-precision arithmetic are still done
28182 using 387. A later version, present only in Pentium 4 and AMD
28183 x86-64 chips, supports double-precision arithmetic too.
28184
28185 For the x86-32 compiler, you must use -march=cpu-type, -msse or
28186 -msse2 switches to enable SSE extensions and make this option
28187 effective. For the x86-64 compiler, these extensions are
28188 enabled by default.
28189
28190 The resulting code should be considerably faster in the
28191 majority of cases and avoid the numerical instability problems
28192 of 387 code, but may break some existing code that expects
28193 temporaries to be 80 bits.
28194
28195 This is the default choice for the x86-64 compiler, Darwin
28196 x86-32 targets, and the default choice for x86-32 targets with
28197 the SSE2 instruction set when -ffast-math is enabled.
28198
28199 sse,387
28200 sse+387
28201 both
28202 Attempt to utilize both instruction sets at once. This
28203 effectively doubles the amount of available registers, and on
28204 chips with separate execution units for 387 and SSE the
28205 execution resources too. Use this option with care, as it is
28206 still experimental, because the GCC register allocator does not
28207 model separate functional units well, resulting in unstable
28208 performance.
28209
28210 -masm=dialect
28211 Output assembly instructions using selected dialect. Also affects
28212 which dialect is used for basic "asm" and extended "asm". Supported
28213 choices (in dialect order) are att or intel. The default is att.
28214 Darwin does not support intel.
28215
28216 -mieee-fp
28217 -mno-ieee-fp
28218 Control whether or not the compiler uses IEEE floating-point
28219 comparisons. These correctly handle the case where the result of a
28220 comparison is unordered.
28221
28222 -m80387
28223 -mhard-float
28224 Generate output containing 80387 instructions for floating point.
28225
28226 -mno-80387
28227 -msoft-float
28228 Generate output containing library calls for floating point.
28229
28230 Warning: the requisite libraries are not part of GCC. Normally the
28231 facilities of the machine's usual C compiler are used, but this
28232 cannot be done directly in cross-compilation. You must make your
28233 own arrangements to provide suitable library functions for cross-
28234 compilation.
28235
28236 On machines where a function returns floating-point results in the
28237 80387 register stack, some floating-point opcodes may be emitted
28238 even if -msoft-float is used.
28239
28240 -mno-fp-ret-in-387
28241 Do not use the FPU registers for return values of functions.
28242
28243 The usual calling convention has functions return values of types
28244 "float" and "double" in an FPU register, even if there is no FPU.
28245 The idea is that the operating system should emulate an FPU.
28246
28247 The option -mno-fp-ret-in-387 causes such values to be returned in
28248 ordinary CPU registers instead.
28249
28250 -mno-fancy-math-387
28251 Some 387 emulators do not support the "sin", "cos" and "sqrt"
28252 instructions for the 387. Specify this option to avoid generating
28253 those instructions. This option is overridden when -march
28254 indicates that the target CPU always has an FPU and so the
28255 instruction does not need emulation. These instructions are not
28256 generated unless you also use the -funsafe-math-optimizations
28257 switch.
28258
28259 -malign-double
28260 -mno-align-double
28261 Control whether GCC aligns "double", "long double", and "long long"
28262 variables on a two-word boundary or a one-word boundary. Aligning
28263 "double" variables on a two-word boundary produces code that runs
28264 somewhat faster on a Pentium at the expense of more memory.
28265
28266 On x86-64, -malign-double is enabled by default.
28267
28268 Warning: if you use the -malign-double switch, structures
28269 containing the above types are aligned differently than the
28270 published application binary interface specifications for the
28271 x86-32 and are not binary compatible with structures in code
28272 compiled without that switch.
28273
28274 -m96bit-long-double
28275 -m128bit-long-double
28276 These switches control the size of "long double" type. The x86-32
28277 application binary interface specifies the size to be 96 bits, so
28278 -m96bit-long-double is the default in 32-bit mode.
28279
28280 Modern architectures (Pentium and newer) prefer "long double" to be
28281 aligned to an 8- or 16-byte boundary. In arrays or structures
28282 conforming to the ABI, this is not possible. So specifying
28283 -m128bit-long-double aligns "long double" to a 16-byte boundary by
28284 padding the "long double" with an additional 32-bit zero.
28285
28286 In the x86-64 compiler, -m128bit-long-double is the default choice
28287 as its ABI specifies that "long double" is aligned on 16-byte
28288 boundary.
28289
28290 Notice that neither of these options enable any extra precision
28291 over the x87 standard of 80 bits for a "long double".
28292
28293 Warning: if you override the default value for your target ABI,
28294 this changes the size of structures and arrays containing "long
28295 double" variables, as well as modifying the function calling
28296 convention for functions taking "long double". Hence they are not
28297 binary-compatible with code compiled without that switch.
28298
28299 -mlong-double-64
28300 -mlong-double-80
28301 -mlong-double-128
28302 These switches control the size of "long double" type. A size of 64
28303 bits makes the "long double" type equivalent to the "double" type.
28304 This is the default for 32-bit Bionic C library. A size of 128
28305 bits makes the "long double" type equivalent to the "__float128"
28306 type. This is the default for 64-bit Bionic C library.
28307
28308 Warning: if you override the default value for your target ABI,
28309 this changes the size of structures and arrays containing "long
28310 double" variables, as well as modifying the function calling
28311 convention for functions taking "long double". Hence they are not
28312 binary-compatible with code compiled without that switch.
28313
28314 -malign-data=type
28315 Control how GCC aligns variables. Supported values for type are
28316 compat uses increased alignment value compatible uses GCC 4.8 and
28317 earlier, abi uses alignment value as specified by the psABI, and
28318 cacheline uses increased alignment value to match the cache line
28319 size. compat is the default.
28320
28321 -mlarge-data-threshold=threshold
28322 When -mcmodel=medium is specified, data objects larger than
28323 threshold are placed in the large data section. This value must be
28324 the same across all objects linked into the binary, and defaults to
28325 65535.
28326
28327 -mrtd
28328 Use a different function-calling convention, in which functions
28329 that take a fixed number of arguments return with the "ret num"
28330 instruction, which pops their arguments while returning. This
28331 saves one instruction in the caller since there is no need to pop
28332 the arguments there.
28333
28334 You can specify that an individual function is called with this
28335 calling sequence with the function attribute "stdcall". You can
28336 also override the -mrtd option by using the function attribute
28337 "cdecl".
28338
28339 Warning: this calling convention is incompatible with the one
28340 normally used on Unix, so you cannot use it if you need to call
28341 libraries compiled with the Unix compiler.
28342
28343 Also, you must provide function prototypes for all functions that
28344 take variable numbers of arguments (including "printf"); otherwise
28345 incorrect code is generated for calls to those functions.
28346
28347 In addition, seriously incorrect code results if you call a
28348 function with too many arguments. (Normally, extra arguments are
28349 harmlessly ignored.)
28350
28351 -mregparm=num
28352 Control how many registers are used to pass integer arguments. By
28353 default, no registers are used to pass arguments, and at most 3
28354 registers can be used. You can control this behavior for a
28355 specific function by using the function attribute "regparm".
28356
28357 Warning: if you use this switch, and num is nonzero, then you must
28358 build all modules with the same value, including any libraries.
28359 This includes the system libraries and startup modules.
28360
28361 -msseregparm
28362 Use SSE register passing conventions for float and double arguments
28363 and return values. You can control this behavior for a specific
28364 function by using the function attribute "sseregparm".
28365
28366 Warning: if you use this switch then you must build all modules
28367 with the same value, including any libraries. This includes the
28368 system libraries and startup modules.
28369
28370 -mvect8-ret-in-mem
28371 Return 8-byte vectors in memory instead of MMX registers. This is
28372 the default on VxWorks to match the ABI of the Sun Studio compilers
28373 until version 12. Only use this option if you need to remain
28374 compatible with existing code produced by those previous compiler
28375 versions or older versions of GCC.
28376
28377 -mpc32
28378 -mpc64
28379 -mpc80
28380 Set 80387 floating-point precision to 32, 64 or 80 bits. When
28381 -mpc32 is specified, the significands of results of floating-point
28382 operations are rounded to 24 bits (single precision); -mpc64 rounds
28383 the significands of results of floating-point operations to 53 bits
28384 (double precision) and -mpc80 rounds the significands of results of
28385 floating-point operations to 64 bits (extended double precision),
28386 which is the default. When this option is used, floating-point
28387 operations in higher precisions are not available to the programmer
28388 without setting the FPU control word explicitly.
28389
28390 Setting the rounding of floating-point operations to less than the
28391 default 80 bits can speed some programs by 2% or more. Note that
28392 some mathematical libraries assume that extended-precision (80-bit)
28393 floating-point operations are enabled by default; routines in such
28394 libraries could suffer significant loss of accuracy, typically
28395 through so-called "catastrophic cancellation", when this option is
28396 used to set the precision to less than extended precision.
28397
28398 -mdaz-ftz
28399 The flush-to-zero (FTZ) and denormals-are-zero (DAZ) flags in the
28400 MXCSR register are used to control floating-point calculations.SSE
28401 and AVX instructions including scalar and vector instructions could
28402 benefit from enabling the FTZ and DAZ flags when -mdaz-ftz is
28403 specified. Don't set FTZ/DAZ flags when -mno-daz-ftz or -shared is
28404 specified, -mdaz-ftz will set FTZ/DAZ flags even with -shared.
28405
28406 -mstackrealign
28407 Realign the stack at entry. On the x86, the -mstackrealign option
28408 generates an alternate prologue and epilogue that realigns the run-
28409 time stack if necessary. This supports mixing legacy codes that
28410 keep 4-byte stack alignment with modern codes that keep 16-byte
28411 stack alignment for SSE compatibility. See also the attribute
28412 "force_align_arg_pointer", applicable to individual functions.
28413
28414 -mpreferred-stack-boundary=num
28415 Attempt to keep the stack boundary aligned to a 2 raised to num
28416 byte boundary. If -mpreferred-stack-boundary is not specified, the
28417 default is 4 (16 bytes or 128 bits).
28418
28419 Warning: When generating code for the x86-64 architecture with SSE
28420 extensions disabled, -mpreferred-stack-boundary=3 can be used to
28421 keep the stack boundary aligned to 8 byte boundary. Since x86-64
28422 ABI require 16 byte stack alignment, this is ABI incompatible and
28423 intended to be used in controlled environment where stack space is
28424 important limitation. This option leads to wrong code when
28425 functions compiled with 16 byte stack alignment (such as functions
28426 from a standard library) are called with misaligned stack. In this
28427 case, SSE instructions may lead to misaligned memory access traps.
28428 In addition, variable arguments are handled incorrectly for 16 byte
28429 aligned objects (including x87 long double and __int128), leading
28430 to wrong results. You must build all modules with
28431 -mpreferred-stack-boundary=3, including any libraries. This
28432 includes the system libraries and startup modules.
28433
28434 -mincoming-stack-boundary=num
28435 Assume the incoming stack is aligned to a 2 raised to num byte
28436 boundary. If -mincoming-stack-boundary is not specified, the one
28437 specified by -mpreferred-stack-boundary is used.
28438
28439 On Pentium and Pentium Pro, "double" and "long double" values
28440 should be aligned to an 8-byte boundary (see -malign-double) or
28441 suffer significant run time performance penalties. On Pentium III,
28442 the Streaming SIMD Extension (SSE) data type "__m128" may not work
28443 properly if it is not 16-byte aligned.
28444
28445 To ensure proper alignment of this values on the stack, the stack
28446 boundary must be as aligned as that required by any value stored on
28447 the stack. Further, every function must be generated such that it
28448 keeps the stack aligned. Thus calling a function compiled with a
28449 higher preferred stack boundary from a function compiled with a
28450 lower preferred stack boundary most likely misaligns the stack. It
28451 is recommended that libraries that use callbacks always use the
28452 default setting.
28453
28454 This extra alignment does consume extra stack space, and generally
28455 increases code size. Code that is sensitive to stack space usage,
28456 such as embedded systems and operating system kernels, may want to
28457 reduce the preferred alignment to -mpreferred-stack-boundary=2.
28458
28459 -mmmx
28460 -msse
28461 -msse2
28462 -msse3
28463 -mssse3
28464 -msse4
28465 -msse4a
28466 -msse4.1
28467 -msse4.2
28468 -mavx
28469 -mavx2
28470 -mavx512f
28471 -mavx512pf
28472 -mavx512er
28473 -mavx512cd
28474 -mavx512vl
28475 -mavx512bw
28476 -mavx512dq
28477 -mavx512ifma
28478 -mavx512vbmi
28479 -msha
28480 -maes
28481 -mpclmul
28482 -mclflushopt
28483 -mclwb
28484 -mfsgsbase
28485 -mptwrite
28486 -mrdrnd
28487 -mf16c
28488 -mfma
28489 -mpconfig
28490 -mwbnoinvd
28491 -mfma4
28492 -mprfchw
28493 -mrdpid
28494 -mprefetchwt1
28495 -mrdseed
28496 -msgx
28497 -mxop
28498 -mlwp
28499 -m3dnow
28500 -m3dnowa
28501 -mpopcnt
28502 -mabm
28503 -madx
28504 -mbmi
28505 -mbmi2
28506 -mlzcnt
28507 -mfxsr
28508 -mxsave
28509 -mxsaveopt
28510 -mxsavec
28511 -mxsaves
28512 -mrtm
28513 -mhle
28514 -mtbm
28515 -mmwaitx
28516 -mclzero
28517 -mpku
28518 -mavx512vbmi2
28519 -mavx512bf16
28520 -mavx512fp16
28521 -mgfni
28522 -mvaes
28523 -mwaitpkg
28524 -mvpclmulqdq
28525 -mavx512bitalg
28526 -mmovdiri
28527 -mmovdir64b
28528 -menqcmd
28529 -muintr
28530 -mtsxldtrk
28531 -mavx512vpopcntdq
28532 -mavx512vp2intersect
28533 -mavx5124fmaps
28534 -mavx512vnni
28535 -mavxvnni
28536 -mavx5124vnniw
28537 -mcldemote
28538 -mserialize
28539 -mamx-tile
28540 -mamx-int8
28541 -mamx-bf16
28542 -mhreset
28543 -mkl
28544 -mwidekl
28545 -mavxifma
28546 -mavxvnniint8
28547 -mavxneconvert
28548 -mcmpccxadd
28549 -mamx-fp16
28550 -mprefetchi
28551 -mraoint
28552 -mamx-complex
28553 These switches enable the use of instructions in the MMX, SSE,
28554 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F,
28555 AVX512PF, AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ,
28556 AVX512IFMA, AVX512VBMI, SHA, AES, PCLMUL, CLFLUSHOPT, CLWB,
28557 FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG, WBNOINVD, FMA4,
28558 PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP, 3DNow!,
28559 enhanced 3DNow!, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
28560 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU,
28561 AVX512VBMI2, GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG,
28562 MOVDIRI, MOVDIR64B, AVX512BF16, ENQCMD, AVX512VPOPCNTDQ,
28563 AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE, UINTR, HRESET,
28564 AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512-FP16,
28565 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AMX-FP16, PREFETCHI,
28566 RAOINT, AMX-COMPLEX or CLDEMOTE extended instruction sets. Each has
28567 a corresponding -mno- option to disable use of these instructions.
28568
28569 These extensions are also available as built-in functions: see x86
28570 Built-in Functions, for details of the functions enabled and
28571 disabled by these switches.
28572
28573 To generate SSE/SSE2 instructions automatically from floating-point
28574 code (as opposed to 387 instructions), see -mfpmath=sse.
28575
28576 GCC depresses SSEx instructions when -mavx is used. Instead, it
28577 generates new AVX instructions or AVX equivalence for all SSEx
28578 instructions when needed.
28579
28580 These options enable GCC to use these extended instructions in
28581 generated code, even without -mfpmath=sse. Applications that
28582 perform run-time CPU detection must compile separate files for each
28583 supported architecture, using the appropriate flags. In
28584 particular, the file containing the CPU detection code should be
28585 compiled without these options.
28586
28587 -mdump-tune-features
28588 This option instructs GCC to dump the names of the x86 performance
28589 tuning features and default settings. The names can be used in
28590 -mtune-ctrl=feature-list.
28591
28592 -mtune-ctrl=feature-list
28593 This option is used to do fine grain control of x86 code generation
28594 features. feature-list is a comma separated list of feature names.
28595 See also -mdump-tune-features. When specified, the feature is
28596 turned on if it is not preceded with ^, otherwise, it is turned
28597 off. -mtune-ctrl=feature-list is intended to be used by GCC
28598 developers. Using it may lead to code paths not covered by testing
28599 and can potentially result in compiler ICEs or runtime errors.
28600
28601 -mno-default
28602 This option instructs GCC to turn off all tunable features. See
28603 also -mtune-ctrl=feature-list and -mdump-tune-features.
28604
28605 -mcld
28606 This option instructs GCC to emit a "cld" instruction in the
28607 prologue of functions that use string instructions. String
28608 instructions depend on the DF flag to select between autoincrement
28609 or autodecrement mode. While the ABI specifies the DF flag to be
28610 cleared on function entry, some operating systems violate this
28611 specification by not clearing the DF flag in their exception
28612 dispatchers. The exception handler can be invoked with the DF flag
28613 set, which leads to wrong direction mode when string instructions
28614 are used. This option can be enabled by default on 32-bit x86
28615 targets by configuring GCC with the --enable-cld configure option.
28616 Generation of "cld" instructions can be suppressed with the
28617 -mno-cld compiler option in this case.
28618
28619 -mvzeroupper
28620 This option instructs GCC to emit a "vzeroupper" instruction before
28621 a transfer of control flow out of the function to minimize the AVX
28622 to SSE transition penalty as well as remove unnecessary "zeroupper"
28623 intrinsics.
28624
28625 -mprefer-avx128
28626 This option instructs GCC to use 128-bit AVX instructions instead
28627 of 256-bit AVX instructions in the auto-vectorizer.
28628
28629 -mprefer-vector-width=opt
28630 This option instructs GCC to use opt-bit vector width in
28631 instructions instead of default on the selected platform.
28632
28633 -mmove-max=bits
28634 This option instructs GCC to set the maximum number of bits can be
28635 moved from memory to memory efficiently to bits. The valid bits
28636 are 128, 256 and 512.
28637
28638 -mstore-max=bits
28639 This option instructs GCC to set the maximum number of bits can be
28640 stored to memory efficiently to bits. The valid bits are 128, 256
28641 and 512.
28642
28643 none
28644 No extra limitations applied to GCC other than defined by the
28645 selected platform.
28646
28647 128 Prefer 128-bit vector width for instructions.
28648
28649 256 Prefer 256-bit vector width for instructions.
28650
28651 512 Prefer 512-bit vector width for instructions.
28652
28653 -mcx16
28654 This option enables GCC to generate "CMPXCHG16B" instructions in
28655 64-bit code to implement compare-and-exchange operations on 16-byte
28656 aligned 128-bit objects. This is useful for atomic updates of data
28657 structures exceeding one machine word in size. The compiler uses
28658 this instruction to implement __sync Builtins. However, for
28659 __atomic Builtins operating on 128-bit integers, a library call is
28660 always used.
28661
28662 -msahf
28663 This option enables generation of "SAHF" instructions in 64-bit
28664 code. Early Intel Pentium 4 CPUs with Intel 64 support, prior to
28665 the introduction of Pentium 4 G1 step in December 2005, lacked the
28666 "LAHF" and "SAHF" instructions which are supported by AMD64. These
28667 are load and store instructions, respectively, for certain status
28668 flags. In 64-bit mode, the "SAHF" instruction is used to optimize
28669 "fmod", "drem", and "remainder" built-in functions; see Other
28670 Builtins for details.
28671
28672 -mmovbe
28673 This option enables use of the "movbe" instruction to implement
28674 "__builtin_bswap32" and "__builtin_bswap64".
28675
28676 -mshstk
28677 The -mshstk option enables shadow stack built-in functions from x86
28678 Control-flow Enforcement Technology (CET).
28679
28680 -mcrc32
28681 This option enables built-in functions "__builtin_ia32_crc32qi",
28682 "__builtin_ia32_crc32hi", "__builtin_ia32_crc32si" and
28683 "__builtin_ia32_crc32di" to generate the "crc32" machine
28684 instruction.
28685
28686 -mmwait
28687 This option enables built-in functions "__builtin_ia32_monitor",
28688 and "__builtin_ia32_mwait" to generate the "monitor" and "mwait"
28689 machine instructions.
28690
28691 -mrecip
28692 This option enables use of "RCPSS" and "RSQRTSS" instructions (and
28693 their vectorized variants "RCPPS" and "RSQRTPS") with an additional
28694 Newton-Raphson step to increase precision instead of "DIVSS" and
28695 "SQRTSS" (and their vectorized variants) for single-precision
28696 floating-point arguments. These instructions are generated only
28697 when -funsafe-math-optimizations is enabled together with
28698 -ffinite-math-only and -fno-trapping-math. Note that while the
28699 throughput of the sequence is higher than the throughput of the
28700 non-reciprocal instruction, the precision of the sequence can be
28701 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
28702 0.99999994).
28703
28704 Note that GCC implements "1.0f/sqrtf(x)" in terms of "RSQRTSS" (or
28705 "RSQRTPS") already with -ffast-math (or the above option
28706 combination), and doesn't need -mrecip.
28707
28708 Also note that GCC emits the above sequence with additional Newton-
28709 Raphson step for vectorized single-float division and vectorized
28710 sqrtf(x) already with -ffast-math (or the above option
28711 combination), and doesn't need -mrecip.
28712
28713 -mrecip=opt
28714 This option controls which reciprocal estimate instructions may be
28715 used. opt is a comma-separated list of options, which may be
28716 preceded by a ! to invert the option:
28717
28718 all Enable all estimate instructions.
28719
28720 default
28721 Enable the default instructions, equivalent to -mrecip.
28722
28723 none
28724 Disable all estimate instructions, equivalent to -mno-recip.
28725
28726 div Enable the approximation for scalar division.
28727
28728 vec-div
28729 Enable the approximation for vectorized division.
28730
28731 sqrt
28732 Enable the approximation for scalar square root.
28733
28734 vec-sqrt
28735 Enable the approximation for vectorized square root.
28736
28737 So, for example, -mrecip=all,!sqrt enables all of the reciprocal
28738 approximations, except for square root.
28739
28740 -mveclibabi=type
28741 Specifies the ABI type to use for vectorizing intrinsics using an
28742 external library. Supported values for type are svml for the Intel
28743 short vector math library and acml for the AMD math core library.
28744 To use this option, both -ftree-vectorize and
28745 -funsafe-math-optimizations have to be enabled, and an SVML or ACML
28746 ABI-compatible library must be specified at link time.
28747
28748 GCC currently emits calls to "vmldExp2", "vmldLn2", "vmldLog102",
28749 "vmldPow2", "vmldTanh2", "vmldTan2", "vmldAtan2", "vmldAtanh2",
28750 "vmldCbrt2", "vmldSinh2", "vmldSin2", "vmldAsinh2", "vmldAsin2",
28751 "vmldCosh2", "vmldCos2", "vmldAcosh2", "vmldAcos2", "vmlsExp4",
28752 "vmlsLn4", "vmlsLog104", "vmlsPow4", "vmlsTanh4", "vmlsTan4",
28753 "vmlsAtan4", "vmlsAtanh4", "vmlsCbrt4", "vmlsSinh4", "vmlsSin4",
28754 "vmlsAsinh4", "vmlsAsin4", "vmlsCosh4", "vmlsCos4", "vmlsAcosh4"
28755 and "vmlsAcos4" for corresponding function type when
28756 -mveclibabi=svml is used, and "__vrd2_sin", "__vrd2_cos",
28757 "__vrd2_exp", "__vrd2_log", "__vrd2_log2", "__vrd2_log10",
28758 "__vrs4_sinf", "__vrs4_cosf", "__vrs4_expf", "__vrs4_logf",
28759 "__vrs4_log2f", "__vrs4_log10f" and "__vrs4_powf" for the
28760 corresponding function type when -mveclibabi=acml is used.
28761
28762 -mabi=name
28763 Generate code for the specified calling convention. Permissible
28764 values are sysv for the ABI used on GNU/Linux and other systems,
28765 and ms for the Microsoft ABI. The default is to use the Microsoft
28766 ABI when targeting Microsoft Windows and the SysV ABI on all other
28767 systems. You can control this behavior for specific functions by
28768 using the function attributes "ms_abi" and "sysv_abi".
28769
28770 -mforce-indirect-call
28771 Force all calls to functions to be indirect. This is useful when
28772 using Intel Processor Trace where it generates more precise timing
28773 information for function calls.
28774
28775 -mmanual-endbr
28776 Insert ENDBR instruction at function entry only via the "cf_check"
28777 function attribute. This is useful when used with the option
28778 -fcf-protection=branch to control ENDBR insertion at the function
28779 entry.
28780
28781 -mcet-switch
28782 By default, CET instrumentation is turned off on switch statements
28783 that use a jump table and indirect branch track is disabled. Since
28784 jump tables are stored in read-only memory, this does not result in
28785 a direct loss of hardening. But if the jump table index is
28786 attacker-controlled, the indirect jump may not be constrained by
28787 CET. This option turns on CET instrumentation to enable indirect
28788 branch track for switch statements with jump tables which leads to
28789 the jump targets reachable via any indirect jumps.
28790
28791 -mcall-ms2sysv-xlogues
28792 Due to differences in 64-bit ABIs, any Microsoft ABI function that
28793 calls a System V ABI function must consider RSI, RDI and XMM6-15 as
28794 clobbered. By default, the code for saving and restoring these
28795 registers is emitted inline, resulting in fairly lengthy prologues
28796 and epilogues. Using -mcall-ms2sysv-xlogues emits prologues and
28797 epilogues that use stubs in the static portion of libgcc to perform
28798 these saves and restores, thus reducing function size at the cost
28799 of a few extra instructions.
28800
28801 -mtls-dialect=type
28802 Generate code to access thread-local storage using the gnu or gnu2
28803 conventions. gnu is the conservative default; gnu2 is more
28804 efficient, but it may add compile- and run-time requirements that
28805 cannot be satisfied on all systems.
28806
28807 -mpush-args
28808 -mno-push-args
28809 Use PUSH operations to store outgoing parameters. This method is
28810 shorter and usually equally fast as method using SUB/MOV operations
28811 and is enabled by default. In some cases disabling it may improve
28812 performance because of improved scheduling and reduced
28813 dependencies.
28814
28815 -maccumulate-outgoing-args
28816 If enabled, the maximum amount of space required for outgoing
28817 arguments is computed in the function prologue. This is faster on
28818 most modern CPUs because of reduced dependencies, improved
28819 scheduling and reduced stack usage when the preferred stack
28820 boundary is not equal to 2. The drawback is a notable increase in
28821 code size. This switch implies -mno-push-args.
28822
28823 -mthreads
28824 Support thread-safe exception handling on MinGW. Programs that
28825 rely on thread-safe exception handling must compile and link all
28826 code with the -mthreads option. When compiling, -mthreads defines
28827 -D_MT; when linking, it links in a special thread helper library
28828 -lmingwthrd which cleans up per-thread exception-handling data.
28829
28830 -mms-bitfields
28831 -mno-ms-bitfields
28832 Enable/disable bit-field layout compatible with the native
28833 Microsoft Windows compiler.
28834
28835 If "packed" is used on a structure, or if bit-fields are used, it
28836 may be that the Microsoft ABI lays out the structure differently
28837 than the way GCC normally does. Particularly when moving packed
28838 data between functions compiled with GCC and the native Microsoft
28839 compiler (either via function call or as data in a file), it may be
28840 necessary to access either format.
28841
28842 This option is enabled by default for Microsoft Windows targets.
28843 This behavior can also be controlled locally by use of variable or
28844 type attributes. For more information, see x86 Variable Attributes
28845 and x86 Type Attributes.
28846
28847 The Microsoft structure layout algorithm is fairly simple with the
28848 exception of the bit-field packing. The padding and alignment of
28849 members of structures and whether a bit-field can straddle a
28850 storage-unit boundary are determine by these rules:
28851
28852 1. Structure members are stored sequentially in the order in which
28853 they are
28854 declared: the first member has the lowest memory address and
28855 the last member the highest.
28856
28857 2. Every data object has an alignment requirement. The alignment
28858 requirement
28859 for all data except structures, unions, and arrays is either
28860 the size of the object or the current packing size (specified
28861 with either the "aligned" attribute or the "pack" pragma),
28862 whichever is less. For structures, unions, and arrays, the
28863 alignment requirement is the largest alignment requirement of
28864 its members. Every object is allocated an offset so that:
28865
28866 offset % alignment_requirement == 0
28867
28868 3. Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte
28869 allocation
28870 unit if the integral types are the same size and if the next
28871 bit-field fits into the current allocation unit without
28872 crossing the boundary imposed by the common alignment
28873 requirements of the bit-fields.
28874
28875 MSVC interprets zero-length bit-fields in the following ways:
28876
28877 1. If a zero-length bit-field is inserted between two bit-fields
28878 that
28879 are normally coalesced, the bit-fields are not coalesced.
28880
28881 For example:
28882
28883 struct
28884 {
28885 unsigned long bf_1 : 12;
28886 unsigned long : 0;
28887 unsigned long bf_2 : 12;
28888 } t1;
28889
28890 The size of "t1" is 8 bytes with the zero-length bit-field. If
28891 the zero-length bit-field were removed, "t1"'s size would be 4
28892 bytes.
28893
28894 2. If a zero-length bit-field is inserted after a bit-field, "foo",
28895 and the
28896 alignment of the zero-length bit-field is greater than the
28897 member that follows it, "bar", "bar" is aligned as the type of
28898 the zero-length bit-field.
28899
28900 For example:
28901
28902 struct
28903 {
28904 char foo : 4;
28905 short : 0;
28906 char bar;
28907 } t2;
28908
28909 struct
28910 {
28911 char foo : 4;
28912 short : 0;
28913 double bar;
28914 } t3;
28915
28916 For "t2", "bar" is placed at offset 2, rather than offset 1.
28917 Accordingly, the size of "t2" is 4. For "t3", the zero-length
28918 bit-field does not affect the alignment of "bar" or, as a
28919 result, the size of the structure.
28920
28921 Taking this into account, it is important to note the
28922 following:
28923
28924 1. If a zero-length bit-field follows a normal bit-field, the
28925 type of the
28926 zero-length bit-field may affect the alignment of the
28927 structure as whole. For example, "t2" has a size of 4
28928 bytes, since the zero-length bit-field follows a normal
28929 bit-field, and is of type short.
28930
28931 2. Even if a zero-length bit-field is not followed by a normal
28932 bit-field, it may
28933 still affect the alignment of the structure:
28934
28935 struct
28936 {
28937 char foo : 6;
28938 long : 0;
28939 } t4;
28940
28941 Here, "t4" takes up 4 bytes.
28942
28943 3. Zero-length bit-fields following non-bit-field members are
28944 ignored:
28945 struct
28946 {
28947 char foo;
28948 long : 0;
28949 char bar;
28950 } t5;
28951
28952 Here, "t5" takes up 2 bytes.
28953
28954 -mno-align-stringops
28955 Do not align the destination of inlined string operations. This
28956 switch reduces code size and improves performance in case the
28957 destination is already aligned, but GCC doesn't know about it.
28958
28959 -minline-all-stringops
28960 By default GCC inlines string operations only when the destination
28961 is known to be aligned to least a 4-byte boundary. This enables
28962 more inlining and increases code size, but may improve performance
28963 of code that depends on fast "memcpy" and "memset" for short
28964 lengths. The option enables inline expansion of "strlen" for all
28965 pointer alignments.
28966
28967 -minline-stringops-dynamically
28968 For string operations of unknown size, use run-time checks with
28969 inline code for small blocks and a library call for large blocks.
28970
28971 -mstringop-strategy=alg
28972 Override the internal decision heuristic for the particular
28973 algorithm to use for inlining string operations. The allowed
28974 values for alg are:
28975
28976 rep_byte
28977 rep_4byte
28978 rep_8byte
28979 Expand using i386 "rep" prefix of the specified size.
28980
28981 byte_loop
28982 loop
28983 unrolled_loop
28984 Expand into an inline loop.
28985
28986 libcall
28987 Always use a library call.
28988
28989 -mmemcpy-strategy=strategy
28990 Override the internal decision heuristic to decide if
28991 "__builtin_memcpy" should be inlined and what inline algorithm to
28992 use when the expected size of the copy operation is known. strategy
28993 is a comma-separated list of alg:max_size:dest_align triplets. alg
28994 is specified in -mstringop-strategy, max_size specifies the max
28995 byte size with which inline algorithm alg is allowed. For the last
28996 triplet, the max_size must be -1. The max_size of the triplets in
28997 the list must be specified in increasing order. The minimal byte
28998 size for alg is 0 for the first triplet and "max_size + 1" of the
28999 preceding range.
29000
29001 -mmemset-strategy=strategy
29002 The option is similar to -mmemcpy-strategy= except that it is to
29003 control "__builtin_memset" expansion.
29004
29005 -momit-leaf-frame-pointer
29006 Don't keep the frame pointer in a register for leaf functions.
29007 This avoids the instructions to save, set up, and restore frame
29008 pointers and makes an extra register available in leaf functions.
29009 The option -fomit-leaf-frame-pointer removes the frame pointer for
29010 leaf functions, which might make debugging harder.
29011
29012 -mtls-direct-seg-refs
29013 -mno-tls-direct-seg-refs
29014 Controls whether TLS variables may be accessed with offsets from
29015 the TLS segment register (%gs for 32-bit, %fs for 64-bit), or
29016 whether the thread base pointer must be added. Whether or not this
29017 is valid depends on the operating system, and whether it maps the
29018 segment to cover the entire TLS area.
29019
29020 For systems that use the GNU C Library, the default is on.
29021
29022 -msse2avx
29023 -mno-sse2avx
29024 Specify that the assembler should encode SSE instructions with VEX
29025 prefix. The option -mavx turns this on by default.
29026
29027 -mfentry
29028 -mno-fentry
29029 If profiling is active (-pg), put the profiling counter call before
29030 the prologue. Note: On x86 architectures the attribute
29031 "ms_hook_prologue" isn't possible at the moment for -mfentry and
29032 -pg.
29033
29034 -mrecord-mcount
29035 -mno-record-mcount
29036 If profiling is active (-pg), generate a __mcount_loc section that
29037 contains pointers to each profiling call. This is useful for
29038 automatically patching and out calls.
29039
29040 -mnop-mcount
29041 -mno-nop-mcount
29042 If profiling is active (-pg), generate the calls to the profiling
29043 functions as NOPs. This is useful when they should be patched in
29044 later dynamically. This is likely only useful together with
29045 -mrecord-mcount.
29046
29047 -minstrument-return=type
29048 Instrument function exit in -pg -mfentry instrumented functions
29049 with call to specified function. This only instruments true returns
29050 ending with ret, but not sibling calls ending with jump. Valid
29051 types are none to not instrument, call to generate a call to
29052 __return__, or nop5 to generate a 5 byte nop.
29053
29054 -mrecord-return
29055 -mno-record-return
29056 Generate a __return_loc section pointing to all return
29057 instrumentation code.
29058
29059 -mfentry-name=name
29060 Set name of __fentry__ symbol called at function entry for -pg
29061 -mfentry functions.
29062
29063 -mfentry-section=name
29064 Set name of section to record -mrecord-mcount calls (default
29065 __mcount_loc).
29066
29067 -mskip-rax-setup
29068 -mno-skip-rax-setup
29069 When generating code for the x86-64 architecture with SSE
29070 extensions disabled, -mskip-rax-setup can be used to skip setting
29071 up RAX register when there are no variable arguments passed in
29072 vector registers.
29073
29074 Warning: Since RAX register is used to avoid unnecessarily saving
29075 vector registers on stack when passing variable arguments, the
29076 impacts of this option are callees may waste some stack space,
29077 misbehave or jump to a random location. GCC 4.4 or newer don't
29078 have those issues, regardless the RAX register value.
29079
29080 -m8bit-idiv
29081 -mno-8bit-idiv
29082 On some processors, like Intel Atom, 8-bit unsigned integer divide
29083 is much faster than 32-bit/64-bit integer divide. This option
29084 generates a run-time check. If both dividend and divisor are
29085 within range of 0 to 255, 8-bit unsigned integer divide is used
29086 instead of 32-bit/64-bit integer divide.
29087
29088 -mavx256-split-unaligned-load
29089 -mavx256-split-unaligned-store
29090 Split 32-byte AVX unaligned load and store.
29091
29092 -mstack-protector-guard=guard
29093 -mstack-protector-guard-reg=reg
29094 -mstack-protector-guard-offset=offset
29095 Generate stack protection code using canary at guard. Supported
29096 locations are global for global canary or tls for per-thread canary
29097 in the TLS block (the default). This option has effect only when
29098 -fstack-protector or -fstack-protector-all is specified.
29099
29100 With the latter choice the options -mstack-protector-guard-reg=reg
29101 and -mstack-protector-guard-offset=offset furthermore specify which
29102 segment register (%fs or %gs) to use as base register for reading
29103 the canary, and from what offset from that base register. The
29104 default for those is as specified in the relevant ABI.
29105
29106 -mgeneral-regs-only
29107 Generate code that uses only the general-purpose registers. This
29108 prevents the compiler from using floating-point, vector, mask and
29109 bound registers.
29110
29111 -mrelax-cmpxchg-loop
29112 When emitting a compare-and-swap loop for __sync Builtins and
29113 __atomic Builtins lacking a native instruction, optimize for the
29114 highly contended case by issuing an atomic load before the
29115 "CMPXCHG" instruction, and using the "PAUSE" instruction to save
29116 CPU power when restarting the loop.
29117
29118 -mindirect-branch=choice
29119 Convert indirect call and jump with choice. The default is keep,
29120 which keeps indirect call and jump unmodified. thunk converts
29121 indirect call and jump to call and return thunk. thunk-inline
29122 converts indirect call and jump to inlined call and return thunk.
29123 thunk-extern converts indirect call and jump to external call and
29124 return thunk provided in a separate object file. You can control
29125 this behavior for a specific function by using the function
29126 attribute "indirect_branch".
29127
29128 Note that -mcmodel=large is incompatible with
29129 -mindirect-branch=thunk and -mindirect-branch=thunk-extern since
29130 the thunk function may not be reachable in the large code model.
29131
29132 Note that -mindirect-branch=thunk-extern is compatible with
29133 -fcf-protection=branch since the external thunk can be made to
29134 enable control-flow check.
29135
29136 -mfunction-return=choice
29137 Convert function return with choice. The default is keep, which
29138 keeps function return unmodified. thunk converts function return
29139 to call and return thunk. thunk-inline converts function return to
29140 inlined call and return thunk. thunk-extern converts function
29141 return to external call and return thunk provided in a separate
29142 object file. You can control this behavior for a specific function
29143 by using the function attribute "function_return".
29144
29145 Note that -mindirect-return=thunk-extern is compatible with
29146 -fcf-protection=branch since the external thunk can be made to
29147 enable control-flow check.
29148
29149 Note that -mcmodel=large is incompatible with
29150 -mfunction-return=thunk and -mfunction-return=thunk-extern since
29151 the thunk function may not be reachable in the large code model.
29152
29153 -mindirect-branch-register
29154 Force indirect call and jump via register.
29155
29156 -mharden-sls=choice
29157 Generate code to mitigate against straight line speculation (SLS)
29158 with choice. The default is none which disables all SLS hardening.
29159 return enables SLS hardening for function returns. indirect-jmp
29160 enables SLS hardening for indirect jumps. all enables all SLS
29161 hardening.
29162
29163 -mindirect-branch-cs-prefix
29164 Add CS prefix to call and jmp to indirect thunk with branch target
29165 in r8-r15 registers so that the call and jmp instruction length is
29166 6 bytes to allow them to be replaced with lfence; call *%r8-r15 or
29167 lfence; jmp *%r8-r15 at run-time.
29168
29169 These -m switches are supported in addition to the above on x86-64
29170 processors in 64-bit environments.
29171
29172 -m32
29173 -m64
29174 -mx32
29175 -m16
29176 -miamcu
29177 Generate code for a 16-bit, 32-bit or 64-bit environment. The -m32
29178 option sets "int", "long", and pointer types to 32 bits, and
29179 generates code that runs in 32-bit mode.
29180
29181 The -m64 option sets "int" to 32 bits and "long" and pointer types
29182 to 64 bits, and generates code for the x86-64 architecture. For
29183 Darwin only the -m64 option also turns off the -fno-pic and
29184 -mdynamic-no-pic options.
29185
29186 The -mx32 option sets "int", "long", and pointer types to 32 bits,
29187 and generates code for the x86-64 architecture.
29188
29189 The -m16 option is the same as -m32, except for that it outputs the
29190 ".code16gcc" assembly directive at the beginning of the assembly
29191 output so that the binary can run in 16-bit mode.
29192
29193 The -miamcu option generates code which conforms to Intel MCU
29194 psABI. It requires the -m32 option to be turned on.
29195
29196 -mno-red-zone
29197 Do not use a so-called "red zone" for x86-64 code. The red zone is
29198 mandated by the x86-64 ABI; it is a 128-byte area beyond the
29199 location of the stack pointer that is not modified by signal or
29200 interrupt handlers and therefore can be used for temporary data
29201 without adjusting the stack pointer. The flag -mno-red-zone
29202 disables this red zone.
29203
29204 -mcmodel=small
29205 Generate code for the small code model: the program and its symbols
29206 must be linked in the lower 2 GB of the address space. Pointers
29207 are 64 bits. Programs can be statically or dynamically linked.
29208 This is the default code model.
29209
29210 -mcmodel=kernel
29211 Generate code for the kernel code model. The kernel runs in the
29212 negative 2 GB of the address space. This model has to be used for
29213 Linux kernel code.
29214
29215 -mcmodel=medium
29216 Generate code for the medium model: the program is linked in the
29217 lower 2 GB of the address space. Small symbols are also placed
29218 there. Symbols with sizes larger than -mlarge-data-threshold are
29219 put into large data or BSS sections and can be located above 2GB.
29220 Programs can be statically or dynamically linked.
29221
29222 -mcmodel=large
29223 Generate code for the large model. This model makes no assumptions
29224 about addresses and sizes of sections.
29225
29226 -maddress-mode=long
29227 Generate code for long address mode. This is only supported for
29228 64-bit and x32 environments. It is the default address mode for
29229 64-bit environments.
29230
29231 -maddress-mode=short
29232 Generate code for short address mode. This is only supported for
29233 32-bit and x32 environments. It is the default address mode for
29234 32-bit and x32 environments.
29235
29236 -mneeded
29237 -mno-needed
29238 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
29239 indicate the micro-architecture ISA level required to execute the
29240 binary.
29241
29242 -mno-direct-extern-access
29243 Without -fpic nor -fPIC, always use the GOT pointer to access
29244 external symbols. With -fpic or -fPIC, treat access to protected
29245 symbols as local symbols. The default is -mdirect-extern-access.
29246
29247 Warning: shared libraries compiled with -mno-direct-extern-access
29248 and executable compiled with -mdirect-extern-access may not be
29249 binary compatible if protected symbols are used in shared libraries
29250 and executable.
29251
29252 -munroll-only-small-loops
29253 Controls conservative small loop unrolling. It is default enabled
29254 by O2, and unrolls loop with less than 4 insns by 1 time. Explicit
29255 -f[no-]unroll-[all-]loops would disable this flag to avoid any
29256 unintended unrolling behavior that user does not want.
29257
29258 -mlam=choice
29259 LAM(linear-address masking) allows special bits in the pointer to
29260 be used for metadata. The default is none. With u48, pointer bits
29261 in positions 62:48 can be used for metadata; With u57, pointer bits
29262 in positions 62:57 can be used for metadata.
29263
29264 x86 Windows Options
29265 These additional options are available for Microsoft Windows targets:
29266
29267 -mconsole
29268 This option specifies that a console application is to be
29269 generated, by instructing the linker to set the PE header subsystem
29270 type required for console applications. This option is available
29271 for Cygwin and MinGW targets and is enabled by default on those
29272 targets.
29273
29274 -mdll
29275 This option is available for Cygwin and MinGW targets. It
29276 specifies that a DLL---a dynamic link library---is to be generated,
29277 enabling the selection of the required runtime startup object and
29278 entry point.
29279
29280 -mnop-fun-dllimport
29281 This option is available for Cygwin and MinGW targets. It
29282 specifies that the "dllimport" attribute should be ignored.
29283
29284 -mthreads
29285 This option is available for MinGW targets. It specifies that
29286 MinGW-specific thread support is to be used.
29287
29288 -municode
29289 This option is available for MinGW-w64 targets. It causes the
29290 "UNICODE" preprocessor macro to be predefined, and chooses Unicode-
29291 capable runtime startup code.
29292
29293 -mwin32
29294 This option is available for Cygwin and MinGW targets. It
29295 specifies that the typical Microsoft Windows predefined macros are
29296 to be set in the pre-processor, but does not influence the choice
29297 of runtime library/startup code.
29298
29299 -mwindows
29300 This option is available for Cygwin and MinGW targets. It
29301 specifies that a GUI application is to be generated by instructing
29302 the linker to set the PE header subsystem type appropriately.
29303
29304 -fno-set-stack-executable
29305 This option is available for MinGW targets. It specifies that the
29306 executable flag for the stack used by nested functions isn't set.
29307 This is necessary for binaries running in kernel mode of Microsoft
29308 Windows, as there the User32 API, which is used to set executable
29309 privileges, isn't available.
29310
29311 -fwritable-relocated-rdata
29312 This option is available for MinGW and Cygwin targets. It
29313 specifies that relocated-data in read-only section is put into the
29314 ".data" section. This is a necessary for older runtimes not
29315 supporting modification of ".rdata" sections for pseudo-relocation.
29316
29317 -mpe-aligned-commons
29318 This option is available for Cygwin and MinGW targets. It
29319 specifies that the GNU extension to the PE file format that permits
29320 the correct alignment of COMMON variables should be used when
29321 generating code. It is enabled by default if GCC detects that the
29322 target assembler found during configuration supports the feature.
29323
29324 See also under x86 Options for standard options.
29325
29326 Xstormy16 Options
29327 These options are defined for Xstormy16:
29328
29329 -msim
29330 Choose startup files and linker script suitable for the simulator.
29331
29332 Xtensa Options
29333 These options are supported for Xtensa targets:
29334
29335 -mconst16
29336 -mno-const16
29337 Enable or disable use of "CONST16" instructions for loading
29338 constant values. The "CONST16" instruction is currently not a
29339 standard option from Tensilica. When enabled, "CONST16"
29340 instructions are always used in place of the standard "L32R"
29341 instructions. The use of "CONST16" is enabled by default only if
29342 the "L32R" instruction is not available.
29343
29344 -mfused-madd
29345 -mno-fused-madd
29346 Enable or disable use of fused multiply/add and multiply/subtract
29347 instructions in the floating-point option. This has no effect if
29348 the floating-point option is not also enabled. Disabling fused
29349 multiply/add and multiply/subtract instructions forces the compiler
29350 to use separate instructions for the multiply and add/subtract
29351 operations. This may be desirable in some cases where strict IEEE
29352 754-compliant results are required: the fused multiply add/subtract
29353 instructions do not round the intermediate result, thereby
29354 producing results with more bits of precision than specified by the
29355 IEEE standard. Disabling fused multiply add/subtract instructions
29356 also ensures that the program output is not sensitive to the
29357 compiler's ability to combine multiply and add/subtract operations.
29358
29359 -mserialize-volatile
29360 -mno-serialize-volatile
29361 When this option is enabled, GCC inserts "MEMW" instructions before
29362 "volatile" memory references to guarantee sequential consistency.
29363 The default is -mserialize-volatile. Use -mno-serialize-volatile
29364 to omit the "MEMW" instructions.
29365
29366 -mforce-no-pic
29367 For targets, like GNU/Linux, where all user-mode Xtensa code must
29368 be position-independent code (PIC), this option disables PIC for
29369 compiling kernel code.
29370
29371 -mtext-section-literals
29372 -mno-text-section-literals
29373 These options control the treatment of literal pools. The default
29374 is -mno-text-section-literals, which places literals in a separate
29375 section in the output file. This allows the literal pool to be
29376 placed in a data RAM/ROM, and it also allows the linker to combine
29377 literal pools from separate object files to remove redundant
29378 literals and improve code size. With -mtext-section-literals, the
29379 literals are interspersed in the text section in order to keep them
29380 as close as possible to their references. This may be necessary
29381 for large assembly files. Literals for each function are placed
29382 right before that function.
29383
29384 -mauto-litpools
29385 -mno-auto-litpools
29386 These options control the treatment of literal pools. The default
29387 is -mno-auto-litpools, which places literals in a separate section
29388 in the output file unless -mtext-section-literals is used. With
29389 -mauto-litpools the literals are interspersed in the text section
29390 by the assembler. Compiler does not produce explicit ".literal"
29391 directives and loads literals into registers with "MOVI"
29392 instructions instead of "L32R" to let the assembler do relaxation
29393 and place literals as necessary. This option allows assembler to
29394 create several literal pools per function and assemble very big
29395 functions, which may not be possible with -mtext-section-literals.
29396
29397 -mtarget-align
29398 -mno-target-align
29399 When this option is enabled, GCC instructs the assembler to
29400 automatically align instructions to reduce branch penalties at the
29401 expense of some code density. The assembler attempts to widen
29402 density instructions to align branch targets and the instructions
29403 following call instructions. If there are not enough preceding
29404 safe density instructions to align a target, no widening is
29405 performed. The default is -mtarget-align. These options do not
29406 affect the treatment of auto-aligned instructions like "LOOP",
29407 which the assembler always aligns, either by widening density
29408 instructions or by inserting NOP instructions.
29409
29410 -mlongcalls
29411 -mno-longcalls
29412 When this option is enabled, GCC instructs the assembler to
29413 translate direct calls to indirect calls unless it can determine
29414 that the target of a direct call is in the range allowed by the
29415 call instruction. This translation typically occurs for calls to
29416 functions in other source files. Specifically, the assembler
29417 translates a direct "CALL" instruction into an "L32R" followed by a
29418 "CALLX" instruction. The default is -mno-longcalls. This option
29419 should be used in programs where the call target can potentially be
29420 out of range. This option is implemented in the assembler, not the
29421 compiler, so the assembly code generated by GCC still shows direct
29422 call instructions---look at the disassembled object code to see the
29423 actual instructions. Note that the assembler uses an indirect call
29424 for every cross-file call, not just those that really are out of
29425 range.
29426
29427 -mabi=name
29428 Generate code for the specified ABI. Permissible values are:
29429 call0, windowed. Default ABI is chosen by the Xtensa core
29430 configuration.
29431
29432 -mabi=call0
29433 When this option is enabled function parameters are passed in
29434 registers "a2" through "a7", registers "a12" through "a15" are
29435 caller-saved, and register "a15" may be used as a frame pointer.
29436 When this version of the ABI is enabled the C preprocessor symbol
29437 "__XTENSA_CALL0_ABI__" is defined.
29438
29439 -mabi=windowed
29440 When this option is enabled function parameters are passed in
29441 registers "a10" through "a15", and called function rotates register
29442 window by 8 registers on entry so that its arguments are found in
29443 registers "a2" through "a7". Register "a7" may be used as a frame
29444 pointer. Register window is rotated 8 registers back upon return.
29445 When this version of the ABI is enabled the C preprocessor symbol
29446 "__XTENSA_WINDOWED_ABI__" is defined.
29447
29448 -mextra-l32r-costs=n
29449 Specify an extra cost of instruction RAM/ROM access for "L32R"
29450 instructions, in clock cycles. This affects, when optimizing for
29451 speed, whether loading a constant from literal pool using "L32R" or
29452 synthesizing the constant from a small one with a couple of
29453 arithmetic instructions. The default value is 0.
29454
29455 zSeries Options
29456 These are listed under
29457
29459 This section describes several environment variables that affect how
29460 GCC operates. Some of them work by specifying directories or prefixes
29461 to use when searching for various kinds of files. Some are used to
29462 specify other aspects of the compilation environment.
29463
29464 Note that you can also specify places to search using options such as
29465 -B, -I and -L. These take precedence over places specified using
29466 environment variables, which in turn take precedence over those
29467 specified by the configuration of GCC.
29468
29469 LANG
29470 LC_CTYPE
29471 LC_MESSAGES
29472 LC_ALL
29473 These environment variables control the way that GCC uses
29474 localization information which allows GCC to work with different
29475 national conventions. GCC inspects the locale categories LC_CTYPE
29476 and LC_MESSAGES if it has been configured to do so. These locale
29477 categories can be set to any value supported by your installation.
29478 A typical value is en_GB.UTF-8 for English in the United Kingdom
29479 encoded in UTF-8.
29480
29481 The LC_CTYPE environment variable specifies character
29482 classification. GCC uses it to determine the character boundaries
29483 in a string; this is needed for some multibyte encodings that
29484 contain quote and escape characters that are otherwise interpreted
29485 as a string end or escape.
29486
29487 The LC_MESSAGES environment variable specifies the language to use
29488 in diagnostic messages.
29489
29490 If the LC_ALL environment variable is set, it overrides the value
29491 of LC_CTYPE and LC_MESSAGES; otherwise, LC_CTYPE and LC_MESSAGES
29492 default to the value of the LANG environment variable. If none of
29493 these variables are set, GCC defaults to traditional C English
29494 behavior.
29495
29496 TMPDIR
29497 If TMPDIR is set, it specifies the directory to use for temporary
29498 files. GCC uses temporary files to hold the output of one stage of
29499 compilation which is to be used as input to the next stage: for
29500 example, the output of the preprocessor, which is the input to the
29501 compiler proper.
29502
29503 GCC_COMPARE_DEBUG
29504 Setting GCC_COMPARE_DEBUG is nearly equivalent to passing
29505 -fcompare-debug to the compiler driver. See the documentation of
29506 this option for more details.
29507
29508 GCC_EXEC_PREFIX
29509 If GCC_EXEC_PREFIX is set, it specifies a prefix to use in the
29510 names of the subprograms executed by the compiler. No slash is
29511 added when this prefix is combined with the name of a subprogram,
29512 but you can specify a prefix that ends with a slash if you wish.
29513
29514 If GCC_EXEC_PREFIX is not set, GCC attempts to figure out an
29515 appropriate prefix to use based on the pathname it is invoked with.
29516
29517 If GCC cannot find the subprogram using the specified prefix, it
29518 tries looking in the usual places for the subprogram.
29519
29520 The default value of GCC_EXEC_PREFIX is prefix/lib/gcc/ where
29521 prefix is the prefix to the installed compiler. In many cases
29522 prefix is the value of "prefix" when you ran the configure script.
29523
29524 Other prefixes specified with -B take precedence over this prefix.
29525
29526 This prefix is also used for finding files such as crt0.o that are
29527 used for linking.
29528
29529 In addition, the prefix is used in an unusual way in finding the
29530 directories to search for header files. For each of the standard
29531 directories whose name normally begins with /usr/local/lib/gcc
29532 (more precisely, with the value of GCC_INCLUDE_DIR), GCC tries
29533 replacing that beginning with the specified prefix to produce an
29534 alternate directory name. Thus, with -Bfoo/, GCC searches foo/bar
29535 just before it searches the standard directory /usr/local/lib/bar.
29536 If a standard directory begins with the configured prefix then the
29537 value of prefix is replaced by GCC_EXEC_PREFIX when looking for
29538 header files.
29539
29540 COMPILER_PATH
29541 The value of COMPILER_PATH is a colon-separated list of
29542 directories, much like PATH. GCC tries the directories thus
29543 specified when searching for subprograms, if it cannot find the
29544 subprograms using GCC_EXEC_PREFIX.
29545
29546 LIBRARY_PATH
29547 The value of LIBRARY_PATH is a colon-separated list of directories,
29548 much like PATH. When configured as a native compiler, GCC tries
29549 the directories thus specified when searching for special linker
29550 files, if it cannot find them using GCC_EXEC_PREFIX. Linking using
29551 GCC also uses these directories when searching for ordinary
29552 libraries for the -l option (but directories specified with -L come
29553 first).
29554
29555 LANG
29556 This variable is used to pass locale information to the compiler.
29557 One way in which this information is used is to determine the
29558 character set to be used when character literals, string literals
29559 and comments are parsed in C and C++. When the compiler is
29560 configured to allow multibyte characters, the following values for
29561 LANG are recognized:
29562
29563 C-JIS
29564 Recognize JIS characters.
29565
29566 C-SJIS
29567 Recognize SJIS characters.
29568
29569 C-EUCJP
29570 Recognize EUCJP characters.
29571
29572 If LANG is not defined, or if it has some other value, then the
29573 compiler uses "mblen" and "mbtowc" as defined by the default locale
29574 to recognize and translate multibyte characters.
29575
29576 GCC_EXTRA_DIAGNOSTIC_OUTPUT
29577 If GCC_EXTRA_DIAGNOSTIC_OUTPUT is set to one of the following
29578 values, then additional text will be emitted to stderr when fix-it
29579 hints are emitted. -fdiagnostics-parseable-fixits and
29580 -fno-diagnostics-parseable-fixits take precedence over this
29581 environment variable.
29582
29583 fixits-v1
29584 Emit parseable fix-it hints, equivalent to
29585 -fdiagnostics-parseable-fixits. In particular, columns are
29586 expressed as a count of bytes, starting at byte 1 for the
29587 initial column.
29588
29589 fixits-v2
29590 As "fixits-v1", but columns are expressed as display columns,
29591 as per -fdiagnostics-column-unit=display.
29592
29593 Some additional environment variables affect the behavior of the
29594 preprocessor.
29595
29596 CPATH
29597 C_INCLUDE_PATH
29598 CPLUS_INCLUDE_PATH
29599 OBJC_INCLUDE_PATH
29600 Each variable's value is a list of directories separated by a
29601 special character, much like PATH, in which to look for header
29602 files. The special character, "PATH_SEPARATOR", is target-
29603 dependent and determined at GCC build time. For Microsoft Windows-
29604 based targets it is a semicolon, and for almost all other targets
29605 it is a colon.
29606
29607 CPATH specifies a list of directories to be searched as if
29608 specified with -I, but after any paths given with -I options on the
29609 command line. This environment variable is used regardless of
29610 which language is being preprocessed.
29611
29612 The remaining environment variables apply only when preprocessing
29613 the particular language indicated. Each specifies a list of
29614 directories to be searched as if specified with -isystem, but after
29615 any paths given with -isystem options on the command line.
29616
29617 In all these variables, an empty element instructs the compiler to
29618 search its current working directory. Empty elements can appear at
29619 the beginning or end of a path. For instance, if the value of
29620 CPATH is ":/special/include", that has the same effect as
29621 -I. -I/special/include.
29622
29623 DEPENDENCIES_OUTPUT
29624 If this variable is set, its value specifies how to output
29625 dependencies for Make based on the non-system header files
29626 processed by the compiler. System header files are ignored in the
29627 dependency output.
29628
29629 The value of DEPENDENCIES_OUTPUT can be just a file name, in which
29630 case the Make rules are written to that file, guessing the target
29631 name from the source file name. Or the value can have the form
29632 file target, in which case the rules are written to file file using
29633 target as the target name.
29634
29635 In other words, this environment variable is equivalent to
29636 combining the options -MM and -MF, with an optional -MT switch too.
29637
29638 SUNPRO_DEPENDENCIES
29639 This variable is the same as DEPENDENCIES_OUTPUT (see above),
29640 except that system header files are not ignored, so it implies -M
29641 rather than -MM. However, the dependence on the main input file is
29642 omitted.
29643
29644 SOURCE_DATE_EPOCH
29645 If this variable is set, its value specifies a UNIX timestamp to be
29646 used in replacement of the current date and time in the "__DATE__"
29647 and "__TIME__" macros, so that the embedded timestamps become
29648 reproducible.
29649
29650 The value of SOURCE_DATE_EPOCH must be a UNIX timestamp, defined as
29651 the number of seconds (excluding leap seconds) since 01 Jan 1970
29652 00:00:00 represented in ASCII; identical to the output of "date
29653 +%s" on GNU/Linux and other systems that support the %s extension
29654 in the "date" command.
29655
29656 The value should be a known timestamp such as the last modification
29657 time of the source or package and it should be set by the build
29658 process.
29659
29661 For instructions on reporting bugs, see
29662 <http://bugzilla.redhat.com/bugzilla>.
29663
29665 1. On some systems, gcc -shared needs to build supplementary stub code
29666 for constructors to work. On multi-libbed systems, gcc -shared
29667 must select the correct support libraries to link against. Failing
29668 to supply the correct flags may lead to subtle defects. Supplying
29669 them in cases where they are not necessary is innocuous. -shared
29670 suppresses the addition of startup code to alter the floating-point
29671 environment as done with -ffast-math, -Ofast or
29672 -funsafe-math-optimizations on some targets.
29673
29675 gpl(7), gfdl(7), fsf-funding(7), cpp(1), gcov(1), as(1), ld(1), gdb(1)
29676 and the Info entries for gcc, cpp, as, ld, binutils and gdb.
29677
29679 See the Info entry for gcc, or
29680 <https://gcc.gnu.org/onlinedocs/gcc/Contributors.html>, for
29681 contributors to GCC.
29682
29684 Copyright (c) 1988-2023 Free Software Foundation, Inc.
29685
29686 Permission is granted to copy, distribute and/or modify this document
29687 under the terms of the GNU Free Documentation License, Version 1.3 or
29688 any later version published by the Free Software Foundation; with the
29689 Invariant Sections being "GNU General Public License" and "Funding Free
29690 Software", the Front-Cover texts being (a) (see below), and with the
29691 Back-Cover Texts being (b) (see below). A copy of the license is
29692 included in the gfdl(7) man page.
29693
29694 (a) The FSF's Front-Cover Text is:
29695
29696 A GNU Manual
29697
29698 (b) The FSF's Back-Cover Text is:
29699
29700 You have freedom to copy and modify this GNU Manual, like GNU
29701 software. Copies published by the Free Software Foundation raise
29702 funds for GNU development.
29703
29704
29705
29706gcc-13 2023-12-05 GCC(1)