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 sched-autopref-queue-depth
13621 Hardware autoprefetcher scheduler model control flag. Number
13622 of lookahead cycles the model looks into; at ' ' only enable
13623 instruction sorting heuristic.
13624
13625 loop-versioning-max-inner-insns
13626 The maximum number of instructions that an inner loop can have
13627 before the loop versioning pass considers it too big to copy.
13628
13629 loop-versioning-max-outer-insns
13630 The maximum number of instructions that an outer loop can have
13631 before the loop versioning pass considers it too big to copy,
13632 discounting any instructions in inner loops that directly
13633 benefit from versioning.
13634
13635 ssa-name-def-chain-limit
13636 The maximum number of SSA_NAME assignments to follow in
13637 determining a property of a variable such as its value. This
13638 limits the number of iterations or recursive calls GCC performs
13639 when optimizing certain statements or when determining their
13640 validity prior to issuing diagnostics.
13641
13642 store-merging-max-size
13643 Maximum size of a single store merging region in bytes.
13644
13645 hash-table-verification-limit
13646 The number of elements for which hash table verification is
13647 done for each searched element.
13648
13649 max-find-base-term-values
13650 Maximum number of VALUEs handled during a single find_base_term
13651 call.
13652
13653 analyzer-max-enodes-per-program-point
13654 The maximum number of exploded nodes per program point within
13655 the analyzer, before terminating analysis of that point.
13656
13657 analyzer-max-constraints
13658 The maximum number of constraints per state.
13659
13660 analyzer-min-snodes-for-call-summary
13661 The minimum number of supernodes within a function for the
13662 analyzer to consider summarizing its effects at call sites.
13663
13664 analyzer-max-enodes-for-full-dump
13665 The maximum depth of exploded nodes that should appear in a dot
13666 dump before switching to a less verbose format.
13667
13668 analyzer-max-recursion-depth
13669 The maximum number of times a callsite can appear in a call
13670 stack within the analyzer, before terminating analysis of a
13671 call that would recurse deeper.
13672
13673 analyzer-max-svalue-depth
13674 The maximum depth of a symbolic value, before approximating the
13675 value as unknown.
13676
13677 analyzer-max-infeasible-edges
13678 The maximum number of infeasible edges to reject before
13679 declaring a diagnostic as infeasible.
13680
13681 gimple-fe-computed-hot-bb-threshold
13682 The number of executions of a basic block which is considered
13683 hot. The parameter is used only in GIMPLE FE.
13684
13685 analyzer-bb-explosion-factor
13686 The maximum number of 'after supernode' exploded nodes within
13687 the analyzer per supernode, before terminating analysis.
13688
13689 ranger-logical-depth
13690 Maximum depth of logical expression evaluation ranger will look
13691 through when evaluating outgoing edge ranges.
13692
13693 ranger-recompute-depth
13694 Maximum depth of instruction chains to consider for
13695 recomputation in the outgoing range calculator.
13696
13697 relation-block-limit
13698 Maximum number of relations the oracle will register in a basic
13699 block.
13700
13701 min-pagesize
13702 Minimum page size for warning purposes.
13703
13704 openacc-kernels
13705 Specify mode of OpenACC `kernels' constructs handling. With
13706 --param=openacc-kernels=decompose, OpenACC `kernels' constructs
13707 are decomposed into parts, a sequence of compute constructs,
13708 each then handled individually. This is work in progress.
13709 With --param=openacc-kernels=parloops, OpenACC `kernels'
13710 constructs are handled by the parloops pass, en bloc. This is
13711 the current default.
13712
13713 openacc-privatization
13714 Control whether the -fopt-info-omp-note and applicable
13715 -fdump-tree-*-details options emit OpenACC privatization
13716 diagnostics. With --param=openacc-privatization=quiet, don't
13717 diagnose. This is the current default. With
13718 --param=openacc-privatization=noisy, do diagnose.
13719
13720 The following choices of name are available on AArch64 targets:
13721
13722 aarch64-sve-compare-costs
13723 When vectorizing for SVE, consider using "unpacked" vectors for
13724 smaller elements and use the cost model to pick the cheapest
13725 approach. Also use the cost model to choose between SVE and
13726 Advanced SIMD vectorization.
13727
13728 Using unpacked vectors includes storing smaller elements in
13729 larger containers and accessing elements with extending loads
13730 and truncating stores.
13731
13732 aarch64-float-recp-precision
13733 The number of Newton iterations for calculating the reciprocal
13734 for float type. The precision of division is proportional to
13735 this param when division approximation is enabled. The default
13736 value is 1.
13737
13738 aarch64-double-recp-precision
13739 The number of Newton iterations for calculating the reciprocal
13740 for double type. The precision of division is propotional to
13741 this param when division approximation is enabled. The default
13742 value is 2.
13743
13744 aarch64-autovec-preference
13745 Force an ISA selection strategy for auto-vectorization.
13746 Accepts values from 0 to 4, inclusive.
13747
13748 0 Use the default heuristics.
13749
13750 1 Use only Advanced SIMD for auto-vectorization.
13751
13752 2 Use only SVE for auto-vectorization.
13753
13754 3 Use both Advanced SIMD and SVE. Prefer Advanced SIMD when
13755 the costs are deemed equal.
13756
13757 4 Use both Advanced SIMD and SVE. Prefer SVE when the costs
13758 are deemed equal.
13759
13760 The default value is 0.
13761
13762 aarch64-loop-vect-issue-rate-niters
13763 The tuning for some AArch64 CPUs tries to take both latencies
13764 and issue rates into account when deciding whether a loop
13765 should be vectorized using SVE, vectorized using Advanced SIMD,
13766 or not vectorized at all. If this parameter is set to n, GCC
13767 will not use this heuristic for loops that are known to execute
13768 in fewer than n Advanced SIMD iterations.
13769
13770 aarch64-vect-unroll-limit
13771 The vectorizer will use available tuning information to
13772 determine whether it would be beneficial to unroll the main
13773 vectorized loop and by how much. This parameter set's the
13774 upper bound of how much the vectorizer will unroll the main
13775 loop. The default value is four.
13776
13777 The following choices of name are available on i386 and x86_64
13778 targets:
13779
13780 x86-stlf-window-ninsns
13781 Instructions number above which STFL stall penalty can be
13782 compensated.
13783
13784 x86-stv-max-visits
13785 The maximum number of use and def visits when discovering a STV
13786 chain before the discovery is aborted.
13787
13788 Program Instrumentation Options
13789 GCC supports a number of command-line options that control adding run-
13790 time instrumentation to the code it normally generates. For example,
13791 one purpose of instrumentation is collect profiling statistics for use
13792 in finding program hot spots, code coverage analysis, or profile-guided
13793 optimizations. Another class of program instrumentation is adding run-
13794 time checking to detect programming errors like invalid pointer
13795 dereferences or out-of-bounds array accesses, as well as deliberately
13796 hostile attacks such as stack smashing or C++ vtable hijacking. There
13797 is also a general hook which can be used to implement other forms of
13798 tracing or function-level instrumentation for debug or program analysis
13799 purposes.
13800
13801 -p
13802 -pg Generate extra code to write profile information suitable for the
13803 analysis program prof (for -p) or gprof (for -pg). You must use
13804 this option when compiling the source files you want data about,
13805 and you must also use it when linking.
13806
13807 You can use the function attribute "no_instrument_function" to
13808 suppress profiling of individual functions when compiling with
13809 these options.
13810
13811 -fprofile-arcs
13812 Add code so that program flow arcs are instrumented. During
13813 execution the program records how many times each branch and call
13814 is executed and how many times it is taken or returns. On targets
13815 that support constructors with priority support, profiling properly
13816 handles constructors, destructors and C++ constructors (and
13817 destructors) of classes which are used as a type of a global
13818 variable.
13819
13820 When the compiled program exits it saves this data to a file called
13821 auxname.gcda for each source file. The data may be used for
13822 profile-directed optimizations (-fbranch-probabilities), or for
13823 test coverage analysis (-ftest-coverage). Each object file's
13824 auxname is generated from the name of the output file, if
13825 explicitly specified and it is not the final executable, otherwise
13826 it is the basename of the source file. In both cases any suffix is
13827 removed (e.g. foo.gcda for input file dir/foo.c, or dir/foo.gcda
13828 for output file specified as -o dir/foo.o).
13829
13830 Note that if a command line directly links source files, the
13831 corresponding .gcda files will be prefixed with the unsuffixed name
13832 of the output file. E.g. "gcc a.c b.c -o binary" would generate
13833 binary-a.gcda and binary-b.gcda files.
13834
13835 --coverage
13836 This option is used to compile and link code instrumented for
13837 coverage analysis. The option is a synonym for -fprofile-arcs
13838 -ftest-coverage (when compiling) and -lgcov (when linking). See
13839 the documentation for those options for more details.
13840
13841 * Compile the source files with -fprofile-arcs plus optimization
13842 and code generation options. For test coverage analysis, use
13843 the additional -ftest-coverage option. You do not need to
13844 profile every source file in a program.
13845
13846 * Compile the source files additionally with -fprofile-abs-path
13847 to create absolute path names in the .gcno files. This allows
13848 gcov to find the correct sources in projects where compilations
13849 occur with different working directories.
13850
13851 * Link your object files with -lgcov or -fprofile-arcs (the
13852 latter implies the former).
13853
13854 * Run the program on a representative workload to generate the
13855 arc profile information. This may be repeated any number of
13856 times. You can run concurrent instances of your program, and
13857 provided that the file system supports locking, the data files
13858 will be correctly updated. Unless a strict ISO C dialect
13859 option is in effect, "fork" calls are detected and correctly
13860 handled without double counting.
13861
13862 Moreover, an object file can be recompiled multiple times and
13863 the corresponding .gcda file merges as long as the source file
13864 and the compiler options are unchanged.
13865
13866 * For profile-directed optimizations, compile the source files
13867 again with the same optimization and code generation options
13868 plus -fbranch-probabilities.
13869
13870 * For test coverage analysis, use gcov to produce human readable
13871 information from the .gcno and .gcda files. Refer to the gcov
13872 documentation for further information.
13873
13874 With -fprofile-arcs, for each function of your program GCC creates
13875 a program flow graph, then finds a spanning tree for the graph.
13876 Only arcs that are not on the spanning tree have to be
13877 instrumented: the compiler adds code to count the number of times
13878 that these arcs are executed. When an arc is the only exit or only
13879 entrance to a block, the instrumentation code can be added to the
13880 block; otherwise, a new basic block must be created to hold the
13881 instrumentation code.
13882
13883 -ftest-coverage
13884 Produce a notes file that the gcov code-coverage utility can use to
13885 show program coverage. Each source file's note file is called
13886 auxname.gcno. Refer to the -fprofile-arcs option above for a
13887 description of auxname and instructions on how to generate test
13888 coverage data. Coverage data matches the source files more closely
13889 if you do not optimize.
13890
13891 -fprofile-abs-path
13892 Automatically convert relative source file names to absolute path
13893 names in the .gcno files. This allows gcov to find the correct
13894 sources in projects where compilations occur with different working
13895 directories.
13896
13897 -fprofile-dir=path
13898 Set the directory to search for the profile data files in to path.
13899 This option affects only the profile data generated by
13900 -fprofile-generate, -ftest-coverage, -fprofile-arcs and used by
13901 -fprofile-use and -fbranch-probabilities and its related options.
13902 Both absolute and relative paths can be used. By default, GCC uses
13903 the current directory as path, thus the profile data file appears
13904 in the same directory as the object file. In order to prevent the
13905 file name clashing, if the object file name is not an absolute
13906 path, we mangle the absolute path of the sourcename.gcda file and
13907 use it as the file name of a .gcda file. See details about the
13908 file naming in -fprofile-arcs. See similar option -fprofile-note.
13909
13910 When an executable is run in a massive parallel environment, it is
13911 recommended to save profile to different folders. That can be done
13912 with variables in path that are exported during run-time:
13913
13914 %p process ID.
13915
13916 %q{VAR}
13917 value of environment variable VAR
13918
13919 -fprofile-generate
13920 -fprofile-generate=path
13921 Enable options usually used for instrumenting application to
13922 produce profile useful for later recompilation with profile
13923 feedback based optimization. You must use -fprofile-generate both
13924 when compiling and when linking your program.
13925
13926 The following options are enabled: -fprofile-arcs,
13927 -fprofile-values, -finline-functions, and -fipa-bit-cp.
13928
13929 If path is specified, GCC looks at the path to find the profile
13930 feedback data files. See -fprofile-dir.
13931
13932 To optimize the program based on the collected profile information,
13933 use -fprofile-use.
13934
13935 -fprofile-info-section
13936 -fprofile-info-section=name
13937 Register the profile information in the specified section instead
13938 of using a constructor/destructor. The section name is name if it
13939 is specified, otherwise the section name defaults to ".gcov_info".
13940 A pointer to the profile information generated by -fprofile-arcs is
13941 placed in the specified section for each translation unit. This
13942 option disables the profile information registration through a
13943 constructor and it disables the profile information processing
13944 through a destructor. This option is not intended to be used in
13945 hosted environments such as GNU/Linux. It targets freestanding
13946 environments (for example embedded systems) with limited resources
13947 which do not support constructors/destructors or the C library file
13948 I/O.
13949
13950 The linker could collect the input sections in a continuous memory
13951 block and define start and end symbols. A GNU linker script
13952 example which defines a linker output section follows:
13953
13954 .gcov_info :
13955 {
13956 PROVIDE (__gcov_info_start = .);
13957 KEEP (*(.gcov_info))
13958 PROVIDE (__gcov_info_end = .);
13959 }
13960
13961 The program could dump the profiling information registered in this
13962 linker set for example like this:
13963
13964 #include <gcov.h>
13965 #include <stdio.h>
13966 #include <stdlib.h>
13967
13968 extern const struct gcov_info *const __gcov_info_start[];
13969 extern const struct gcov_info *const __gcov_info_end[];
13970
13971 static void
13972 dump (const void *d, unsigned n, void *arg)
13973 {
13974 const unsigned char *c = d;
13975
13976 for (unsigned i = 0; i < n; ++i)
13977 printf ("%02x", c[i]);
13978 }
13979
13980 static void
13981 filename (const char *f, void *arg)
13982 {
13983 __gcov_filename_to_gcfn (f, dump, arg );
13984 }
13985
13986 static void *
13987 allocate (unsigned length, void *arg)
13988 {
13989 return malloc (length);
13990 }
13991
13992 static void
13993 dump_gcov_info (void)
13994 {
13995 const struct gcov_info *const *info = __gcov_info_start;
13996 const struct gcov_info *const *end = __gcov_info_end;
13997
13998 /* Obfuscate variable to prevent compiler optimizations. */
13999 __asm__ ("" : "+r" (info));
14000
14001 while (info != end)
14002 {
14003 void *arg = NULL;
14004 __gcov_info_to_gcda (*info, filename, dump, allocate, arg);
14005 putchar ('\n');
14006 ++info;
14007 }
14008 }
14009
14010 int
14011 main (void)
14012 {
14013 dump_gcov_info ();
14014 return 0;
14015 }
14016
14017 The merge-stream subcommand of gcov-tool may be used to deserialize
14018 the data stream generated by the "__gcov_filename_to_gcfn" and
14019 "__gcov_info_to_gcda" functions and merge the profile information
14020 into .gcda files on the host filesystem.
14021
14022 -fprofile-note=path
14023 If path is specified, GCC saves .gcno file into path location. If
14024 you combine the option with multiple source files, the .gcno file
14025 will be overwritten.
14026
14027 -fprofile-prefix-path=path
14028 This option can be used in combination with
14029 profile-generate=profile_dir and profile-use=profile_dir to inform
14030 GCC where is the base directory of built source tree. By default
14031 profile_dir will contain files with mangled absolute paths of all
14032 object files in the built project. This is not desirable when
14033 directory used to build the instrumented binary differs from the
14034 directory used to build the binary optimized with profile feedback
14035 because the profile data will not be found during the optimized
14036 build. In such setups -fprofile-prefix-path=path with path
14037 pointing to the base directory of the build can be used to strip
14038 the irrelevant part of the path and keep all file names relative to
14039 the main build directory.
14040
14041 -fprofile-prefix-map=old=new
14042 When compiling files residing in directory old, record profiling
14043 information (with --coverage) describing them as if the files
14044 resided in directory new instead. See also -ffile-prefix-map and
14045 -fcanon-prefix-map.
14046
14047 -fprofile-update=method
14048 Alter the update method for an application instrumented for profile
14049 feedback based optimization. The method argument should be one of
14050 single, atomic or prefer-atomic. The first one is useful for
14051 single-threaded applications, while the second one prevents profile
14052 corruption by emitting thread-safe code.
14053
14054 Warning: When an application does not properly join all threads (or
14055 creates an detached thread), a profile file can be still corrupted.
14056
14057 Using prefer-atomic would be transformed either to atomic, when
14058 supported by a target, or to single otherwise. The GCC driver
14059 automatically selects prefer-atomic when -pthread is present in the
14060 command line.
14061
14062 -fprofile-filter-files=regex
14063 Instrument only functions from files whose name matches any of the
14064 regular expressions (separated by semi-colons).
14065
14066 For example, -fprofile-filter-files=main\.c;module.*\.c will
14067 instrument only main.c and all C files starting with 'module'.
14068
14069 -fprofile-exclude-files=regex
14070 Instrument only functions from files whose name does not match any
14071 of the regular expressions (separated by semi-colons).
14072
14073 For example, -fprofile-exclude-files=/usr/.* will prevent
14074 instrumentation of all files that are located in the /usr/ folder.
14075
14076 -fprofile-reproducible=[multithreaded|parallel-runs|serial]
14077 Control level of reproducibility of profile gathered by
14078 "-fprofile-generate". This makes it possible to rebuild program
14079 with same outcome which is useful, for example, for distribution
14080 packages.
14081
14082 With -fprofile-reproducible=serial the profile gathered by
14083 -fprofile-generate is reproducible provided the trained program
14084 behaves the same at each invocation of the train run, it is not
14085 multi-threaded and profile data streaming is always done in the
14086 same order. Note that profile streaming happens at the end of
14087 program run but also before "fork" function is invoked.
14088
14089 Note that it is quite common that execution counts of some part of
14090 programs depends, for example, on length of temporary file names or
14091 memory space randomization (that may affect hash-table collision
14092 rate). Such non-reproducible part of programs may be annotated by
14093 "no_instrument_function" function attribute. gcov-dump with -l can
14094 be used to dump gathered data and verify that they are indeed
14095 reproducible.
14096
14097 With -fprofile-reproducible=parallel-runs collected profile stays
14098 reproducible regardless the order of streaming of the data into
14099 gcda files. This setting makes it possible to run multiple
14100 instances of instrumented program in parallel (such as with "make
14101 -j"). This reduces quality of gathered data, in particular of
14102 indirect call profiling.
14103
14104 -fsanitize=address
14105 Enable AddressSanitizer, a fast memory error detector. Memory
14106 access instructions are instrumented to detect out-of-bounds and
14107 use-after-free bugs. The option enables
14108 -fsanitize-address-use-after-scope. See
14109 <https://github.com/google/sanitizers/wiki/AddressSanitizer> for
14110 more details. The run-time behavior can be influenced using the
14111 ASAN_OPTIONS environment variable. When set to "help=1", the
14112 available options are shown at startup of the instrumented program.
14113 See
14114 <https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags>
14115 for a list of supported options. The option cannot be combined
14116 with -fsanitize=thread or -fsanitize=hwaddress. Note that the only
14117 target -fsanitize=hwaddress is currently supported on is AArch64.
14118
14119 To get more accurate stack traces, it is possible to use options
14120 such as -O0, -O1, or -Og (which, for instance, prevent most
14121 function inlining), -fno-optimize-sibling-calls (which prevents
14122 optimizing sibling and tail recursive calls; this option is
14123 implicit for -O0, -O1, or -Og), or -fno-ipa-icf (which disables
14124 Identical Code Folding for functions). Since multiple runs of the
14125 program may yield backtraces with different addresses due to ASLR
14126 (Address Space Layout Randomization), it may be desirable to turn
14127 ASLR off. On Linux, this can be achieved with setarch `uname -m`
14128 -R ./prog.
14129
14130 -fsanitize=kernel-address
14131 Enable AddressSanitizer for Linux kernel. See
14132 <https://github.com/google/kernel-sanitizers> for more details.
14133
14134 -fsanitize=hwaddress
14135 Enable Hardware-assisted AddressSanitizer, which uses a hardware
14136 ability to ignore the top byte of a pointer to allow the detection
14137 of memory errors with a low memory overhead. Memory access
14138 instructions are instrumented to detect out-of-bounds and use-
14139 after-free bugs. The option enables
14140 -fsanitize-address-use-after-scope. See
14141 <https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html>
14142 for more details. The run-time behavior can be influenced using
14143 the HWASAN_OPTIONS environment variable. When set to "help=1", the
14144 available options are shown at startup of the instrumented program.
14145 The option cannot be combined with -fsanitize=thread or
14146 -fsanitize=address, and is currently only available on AArch64.
14147
14148 -fsanitize=kernel-hwaddress
14149 Enable Hardware-assisted AddressSanitizer for compilation of the
14150 Linux kernel. Similar to -fsanitize=kernel-address but using an
14151 alternate instrumentation method, and similar to
14152 -fsanitize=hwaddress but with instrumentation differences necessary
14153 for compiling the Linux kernel. These differences are to avoid
14154 hwasan library initialization calls and to account for the stack
14155 pointer having a different value in its top byte.
14156
14157 Note: This option has different defaults to the
14158 -fsanitize=hwaddress. Instrumenting the stack and alloca calls are
14159 not on by default but are still possible by specifying the command-
14160 line options --param hwasan-instrument-stack=1 and --param
14161 hwasan-instrument-allocas=1 respectively. Using a random frame tag
14162 is not implemented for kernel instrumentation.
14163
14164 -fsanitize=pointer-compare
14165 Instrument comparison operation (<, <=, >, >=) with pointer
14166 operands. The option must be combined with either
14167 -fsanitize=kernel-address or -fsanitize=address The option cannot
14168 be combined with -fsanitize=thread. Note: By default the check is
14169 disabled at run time. To enable it, add
14170 "detect_invalid_pointer_pairs=2" to the environment variable
14171 ASAN_OPTIONS. Using "detect_invalid_pointer_pairs=1" detects
14172 invalid operation only when both pointers are non-null.
14173
14174 -fsanitize=pointer-subtract
14175 Instrument subtraction with pointer operands. The option must be
14176 combined with either -fsanitize=kernel-address or
14177 -fsanitize=address The option cannot be combined with
14178 -fsanitize=thread. Note: By default the check is disabled at run
14179 time. To enable it, add "detect_invalid_pointer_pairs=2" to the
14180 environment variable ASAN_OPTIONS. Using
14181 "detect_invalid_pointer_pairs=1" detects invalid operation only
14182 when both pointers are non-null.
14183
14184 -fsanitize=shadow-call-stack
14185 Enable ShadowCallStack, a security enhancement mechanism used to
14186 protect programs against return address overwrites (e.g. stack
14187 buffer overflows.) It works by saving a function's return address
14188 to a separately allocated shadow call stack in the function
14189 prologue and restoring the return address from the shadow call
14190 stack in the function epilogue. Instrumentation only occurs in
14191 functions that need to save the return address to the stack.
14192
14193 Currently it only supports the aarch64 platform. It is
14194 specifically designed for linux kernels that enable the
14195 CONFIG_SHADOW_CALL_STACK option. For the user space programs,
14196 runtime support is not currently provided in libc and libgcc.
14197 Users who want to use this feature in user space need to provide
14198 their own support for the runtime. It should be noted that this
14199 may cause the ABI rules to be broken.
14200
14201 On aarch64, the instrumentation makes use of the platform register
14202 "x18". This generally means that any code that may run on the same
14203 thread as code compiled with ShadowCallStack must be compiled with
14204 the flag -ffixed-x18, otherwise functions compiled without
14205 -ffixed-x18 might clobber "x18" and so corrupt the shadow stack
14206 pointer.
14207
14208 Also, because there is no userspace runtime support, code compiled
14209 with ShadowCallStack cannot use exception handling. Use
14210 -fno-exceptions to turn off exceptions.
14211
14212 See <https://clang.llvm.org/docs/ShadowCallStack.html> for more
14213 details.
14214
14215 -fsanitize=thread
14216 Enable ThreadSanitizer, a fast data race detector. Memory access
14217 instructions are instrumented to detect data race bugs. See
14218 <https://github.com/google/sanitizers/wiki#threadsanitizer> for
14219 more details. The run-time behavior can be influenced using the
14220 TSAN_OPTIONS environment variable; see
14221 <https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags>
14222 for a list of supported options. The option cannot be combined
14223 with -fsanitize=address, -fsanitize=leak.
14224
14225 Note that sanitized atomic builtins cannot throw exceptions when
14226 operating on invalid memory addresses with non-call exceptions
14227 (-fnon-call-exceptions).
14228
14229 -fsanitize=leak
14230 Enable LeakSanitizer, a memory leak detector. This option only
14231 matters for linking of executables. The executable is linked
14232 against a library that overrides "malloc" and other allocator
14233 functions. See
14234 <https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer>
14235 for more details. The run-time behavior can be influenced using
14236 the LSAN_OPTIONS environment variable. The option cannot be
14237 combined with -fsanitize=thread.
14238
14239 -fsanitize=undefined
14240 Enable UndefinedBehaviorSanitizer, a fast undefined behavior
14241 detector. Various computations are instrumented to detect
14242 undefined behavior at runtime. See
14243 <https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html> for
14244 more details. The run-time behavior can be influenced using the
14245 UBSAN_OPTIONS environment variable. Current suboptions are:
14246
14247 -fsanitize=shift
14248 This option enables checking that the result of a shift
14249 operation is not undefined. Note that what exactly is
14250 considered undefined differs slightly between C and C++, as
14251 well as between ISO C90 and C99, etc. This option has two
14252 suboptions, -fsanitize=shift-base and
14253 -fsanitize=shift-exponent.
14254
14255 -fsanitize=shift-exponent
14256 This option enables checking that the second argument of a
14257 shift operation is not negative and is smaller than the
14258 precision of the promoted first argument.
14259
14260 -fsanitize=shift-base
14261 If the second argument of a shift operation is within range,
14262 check that the result of a shift operation is not undefined.
14263 Note that what exactly is considered undefined differs slightly
14264 between C and C++, as well as between ISO C90 and C99, etc.
14265
14266 -fsanitize=integer-divide-by-zero
14267 Detect integer division by zero.
14268
14269 -fsanitize=unreachable
14270 With this option, the compiler turns the
14271 "__builtin_unreachable" call into a diagnostics message call
14272 instead. When reaching the "__builtin_unreachable" call, the
14273 behavior is undefined.
14274
14275 -fsanitize=vla-bound
14276 This option instructs the compiler to check that the size of a
14277 variable length array is positive.
14278
14279 -fsanitize=null
14280 This option enables pointer checking. Particularly, the
14281 application built with this option turned on will issue an
14282 error message when it tries to dereference a NULL pointer, or
14283 if a reference (possibly an rvalue reference) is bound to a
14284 NULL pointer, or if a method is invoked on an object pointed by
14285 a NULL pointer.
14286
14287 -fsanitize=return
14288 This option enables return statement checking. Programs built
14289 with this option turned on will issue an error message when the
14290 end of a non-void function is reached without actually
14291 returning a value. This option works in C++ only.
14292
14293 -fsanitize=signed-integer-overflow
14294 This option enables signed integer overflow checking. We check
14295 that the result of "+", "*", and both unary and binary "-" does
14296 not overflow in the signed arithmetics. This also detects
14297 "INT_MIN / -1" signed division. Note, integer promotion rules
14298 must be taken into account. That is, the following is not an
14299 overflow:
14300
14301 signed char a = SCHAR_MAX;
14302 a++;
14303
14304 -fsanitize=bounds
14305 This option enables instrumentation of array bounds. Various
14306 out of bounds accesses are detected. Flexible array members,
14307 flexible array member-like arrays, and initializers of
14308 variables with static storage are not instrumented, with the
14309 exception of flexible array member-like arrays for which
14310 "-fstrict-flex-arrays" or "-fstrict-flex-arrays=" options or
14311 "strict_flex_array" attributes say they shouldn't be treated
14312 like flexible array member-like arrays.
14313
14314 -fsanitize=bounds-strict
14315 This option enables strict instrumentation of array bounds.
14316 Most out of bounds accesses are detected, including flexible
14317 array member-like arrays. Initializers of variables with
14318 static storage are not instrumented.
14319
14320 -fsanitize=alignment
14321 This option enables checking of alignment of pointers when they
14322 are dereferenced, or when a reference is bound to
14323 insufficiently aligned target, or when a method or constructor
14324 is invoked on insufficiently aligned object.
14325
14326 -fsanitize=object-size
14327 This option enables instrumentation of memory references using
14328 the "__builtin_dynamic_object_size" function. Various out of
14329 bounds pointer accesses are detected.
14330
14331 -fsanitize=float-divide-by-zero
14332 Detect floating-point division by zero. Unlike other similar
14333 options, -fsanitize=float-divide-by-zero is not enabled by
14334 -fsanitize=undefined, since floating-point division by zero can
14335 be a legitimate way of obtaining infinities and NaNs.
14336
14337 -fsanitize=float-cast-overflow
14338 This option enables floating-point type to integer conversion
14339 checking. We check that the result of the conversion does not
14340 overflow. Unlike other similar options,
14341 -fsanitize=float-cast-overflow is not enabled by
14342 -fsanitize=undefined. This option does not work well with
14343 "FE_INVALID" exceptions enabled.
14344
14345 -fsanitize=nonnull-attribute
14346 This option enables instrumentation of calls, checking whether
14347 null values are not passed to arguments marked as requiring a
14348 non-null value by the "nonnull" function attribute.
14349
14350 -fsanitize=returns-nonnull-attribute
14351 This option enables instrumentation of return statements in
14352 functions marked with "returns_nonnull" function attribute, to
14353 detect returning of null values from such functions.
14354
14355 -fsanitize=bool
14356 This option enables instrumentation of loads from bool. If a
14357 value other than 0/1 is loaded, a run-time error is issued.
14358
14359 -fsanitize=enum
14360 This option enables instrumentation of loads from an enum type.
14361 If a value outside the range of values for the enum type is
14362 loaded, a run-time error is issued.
14363
14364 -fsanitize=vptr
14365 This option enables instrumentation of C++ member function
14366 calls, member accesses and some conversions between pointers to
14367 base and derived classes, to verify the referenced object has
14368 the correct dynamic type.
14369
14370 -fsanitize=pointer-overflow
14371 This option enables instrumentation of pointer arithmetics. If
14372 the pointer arithmetics overflows, a run-time error is issued.
14373
14374 -fsanitize=builtin
14375 This option enables instrumentation of arguments to selected
14376 builtin functions. If an invalid value is passed to such
14377 arguments, a run-time error is issued. E.g. passing 0 as the
14378 argument to "__builtin_ctz" or "__builtin_clz" invokes
14379 undefined behavior and is diagnosed by this option.
14380
14381 Note that sanitizers tend to increase the rate of false positive
14382 warnings, most notably those around -Wmaybe-uninitialized. We
14383 recommend against combining -Werror and [the use of] sanitizers.
14384
14385 While -ftrapv causes traps for signed overflows to be emitted,
14386 -fsanitize=undefined gives a diagnostic message. This currently
14387 works only for the C family of languages.
14388
14389 -fno-sanitize=all
14390 This option disables all previously enabled sanitizers.
14391 -fsanitize=all is not allowed, as some sanitizers cannot be used
14392 together.
14393
14394 -fasan-shadow-offset=number
14395 This option forces GCC to use custom shadow offset in
14396 AddressSanitizer checks. It is useful for experimenting with
14397 different shadow memory layouts in Kernel AddressSanitizer.
14398
14399 -fsanitize-sections=s1,s2,...
14400 Sanitize global variables in selected user-defined sections. si
14401 may contain wildcards.
14402
14403 -fsanitize-recover[=opts]
14404 -fsanitize-recover= controls error recovery mode for sanitizers
14405 mentioned in comma-separated list of opts. Enabling this option
14406 for a sanitizer component causes it to attempt to continue running
14407 the program as if no error happened. This means multiple runtime
14408 errors can be reported in a single program run, and the exit code
14409 of the program may indicate success even when errors have been
14410 reported. The -fno-sanitize-recover= option can be used to alter
14411 this behavior: only the first detected error is reported and
14412 program then exits with a non-zero exit code.
14413
14414 Currently this feature only works for -fsanitize=undefined (and its
14415 suboptions except for -fsanitize=unreachable and
14416 -fsanitize=return), -fsanitize=float-cast-overflow,
14417 -fsanitize=float-divide-by-zero, -fsanitize=bounds-strict,
14418 -fsanitize=kernel-address and -fsanitize=address. For these
14419 sanitizers error recovery is turned on by default, except
14420 -fsanitize=address, for which this feature is experimental.
14421 -fsanitize-recover=all and -fno-sanitize-recover=all is also
14422 accepted, the former enables recovery for all sanitizers that
14423 support it, the latter disables recovery for all sanitizers that
14424 support it.
14425
14426 Even if a recovery mode is turned on the compiler side, it needs to
14427 be also enabled on the runtime library side, otherwise the failures
14428 are still fatal. The runtime library defaults to "halt_on_error=0"
14429 for ThreadSanitizer and UndefinedBehaviorSanitizer, while default
14430 value for AddressSanitizer is "halt_on_error=1". This can be
14431 overridden through setting the "halt_on_error" flag in the
14432 corresponding environment variable.
14433
14434 Syntax without an explicit opts parameter is deprecated. It is
14435 equivalent to specifying an opts list of:
14436
14437 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
14438
14439 -fsanitize-address-use-after-scope
14440 Enable sanitization of local variables to detect use-after-scope
14441 bugs. The option sets -fstack-reuse to none.
14442
14443 -fsanitize-trap[=opts]
14444 The -fsanitize-trap= option instructs the compiler to report for
14445 sanitizers mentioned in comma-separated list of opts undefined
14446 behavior using "__builtin_trap" rather than a "libubsan" library
14447 routine. If this option is enabled for certain sanitizer, it takes
14448 precedence over the -fsanitizer-recover= for that sanitizer,
14449 "__builtin_trap" will be emitted and be fatal regardless of whether
14450 recovery is enabled or disabled using -fsanitize-recover=.
14451
14452 The advantage of this is that the "libubsan" library is not needed
14453 and is not linked in, so this is usable even in freestanding
14454 environments.
14455
14456 Currently this feature works with -fsanitize=undefined (and its
14457 suboptions except for -fsanitize=vptr),
14458 -fsanitize=float-cast-overflow, -fsanitize=float-divide-by-zero and
14459 -fsanitize=bounds-strict. "-fsanitize-trap=all" can be also
14460 specified, which enables it for "undefined" suboptions,
14461 -fsanitize=float-cast-overflow, -fsanitize=float-divide-by-zero and
14462 -fsanitize=bounds-strict. If "-fsanitize-trap=undefined" or
14463 "-fsanitize-trap=all" is used and "-fsanitize=vptr" is enabled on
14464 the command line, the instrumentation is silently ignored as the
14465 instrumentation always needs "libubsan" support,
14466 -fsanitize-trap=vptr is not allowed.
14467
14468 -fsanitize-undefined-trap-on-error
14469 The -fsanitize-undefined-trap-on-error option is deprecated
14470 equivalent of -fsanitize-trap=all.
14471
14472 -fsanitize-coverage=trace-pc
14473 Enable coverage-guided fuzzing code instrumentation. Inserts a
14474 call to "__sanitizer_cov_trace_pc" into every basic block.
14475
14476 -fsanitize-coverage=trace-cmp
14477 Enable dataflow guided fuzzing code instrumentation. Inserts a
14478 call to "__sanitizer_cov_trace_cmp1", "__sanitizer_cov_trace_cmp2",
14479 "__sanitizer_cov_trace_cmp4" or "__sanitizer_cov_trace_cmp8" for
14480 integral comparison with both operands variable or
14481 "__sanitizer_cov_trace_const_cmp1",
14482 "__sanitizer_cov_trace_const_cmp2",
14483 "__sanitizer_cov_trace_const_cmp4" or
14484 "__sanitizer_cov_trace_const_cmp8" for integral comparison with one
14485 operand constant, "__sanitizer_cov_trace_cmpf" or
14486 "__sanitizer_cov_trace_cmpd" for float or double comparisons and
14487 "__sanitizer_cov_trace_switch" for switch statements.
14488
14489 -fcf-protection=[full|branch|return|none|check]
14490 Enable code instrumentation of control-flow transfers to increase
14491 program security by checking that target addresses of control-flow
14492 transfer instructions (such as indirect function call, function
14493 return, indirect jump) are valid. This prevents diverting the flow
14494 of control to an unexpected target. This is intended to protect
14495 against such threats as Return-oriented Programming (ROP), and
14496 similarly call/jmp-oriented programming (COP/JOP).
14497
14498 The value "branch" tells the compiler to implement checking of
14499 validity of control-flow transfer at the point of indirect branch
14500 instructions, i.e. call/jmp instructions. The value "return"
14501 implements checking of validity at the point of returning from a
14502 function. The value "full" is an alias for specifying both
14503 "branch" and "return". The value "none" turns off instrumentation.
14504
14505 The value "check" is used for the final link with link-time
14506 optimization (LTO). An error is issued if LTO object files are
14507 compiled with different -fcf-protection values. The value "check"
14508 is ignored at the compile time.
14509
14510 The macro "__CET__" is defined when -fcf-protection is used. The
14511 first bit of "__CET__" is set to 1 for the value "branch" and the
14512 second bit of "__CET__" is set to 1 for the "return".
14513
14514 You can also use the "nocf_check" attribute to identify which
14515 functions and calls should be skipped from instrumentation.
14516
14517 Currently the x86 GNU/Linux target provides an implementation based
14518 on Intel Control-flow Enforcement Technology (CET) which works for
14519 i686 processor or newer.
14520
14521 -fharden-compares
14522 For every logical test that survives gimple optimizations and is
14523 not the condition in a conditional branch (for example, conditions
14524 tested for conditional moves, or to store in boolean variables),
14525 emit extra code to compute and verify the reversed condition, and
14526 to call "__builtin_trap" if the results do not match. Use with
14527 -fharden-conditional-branches to cover all conditionals.
14528
14529 -fharden-conditional-branches
14530 For every non-vectorized conditional branch that survives gimple
14531 optimizations, emit extra code to compute and verify the reversed
14532 condition, and to call "__builtin_trap" if the result is
14533 unexpected. Use with -fharden-compares to cover all conditionals.
14534
14535 -fstack-protector
14536 Emit extra code to check for buffer overflows, such as stack
14537 smashing attacks. This is done by adding a guard variable to
14538 functions with vulnerable objects. This includes functions that
14539 call "alloca", and functions with buffers larger than or equal to 8
14540 bytes. The guards are initialized when a function is entered and
14541 then checked when the function exits. If a guard check fails, an
14542 error message is printed and the program exits. Only variables
14543 that are actually allocated on the stack are considered, optimized
14544 away variables or variables allocated in registers don't count.
14545
14546 -fstack-protector-all
14547 Like -fstack-protector except that all functions are protected.
14548
14549 -fstack-protector-strong
14550 Like -fstack-protector but includes additional functions to be
14551 protected --- those that have local array definitions, or have
14552 references to local frame addresses. Only variables that are
14553 actually allocated on the stack are considered, optimized away
14554 variables or variables allocated in registers don't count.
14555
14556 -fstack-protector-explicit
14557 Like -fstack-protector but only protects those functions which have
14558 the "stack_protect" attribute.
14559
14560 -fstack-check
14561 Generate code to verify that you do not go beyond the boundary of
14562 the stack. You should specify this flag if you are running in an
14563 environment with multiple threads, but you only rarely need to
14564 specify it in a single-threaded environment since stack overflow is
14565 automatically detected on nearly all systems if there is only one
14566 stack.
14567
14568 Note that this switch does not actually cause checking to be done;
14569 the operating system or the language runtime must do that. The
14570 switch causes generation of code to ensure that they see the stack
14571 being extended.
14572
14573 You can additionally specify a string parameter: no means no
14574 checking, generic means force the use of old-style checking,
14575 specific means use the best checking method and is equivalent to
14576 bare -fstack-check.
14577
14578 Old-style checking is a generic mechanism that requires no specific
14579 target support in the compiler but comes with the following
14580 drawbacks:
14581
14582 1. Modified allocation strategy for large objects: they are always
14583 allocated dynamically if their size exceeds a fixed threshold.
14584 Note this may change the semantics of some code.
14585
14586 2. Fixed limit on the size of the static frame of functions: when
14587 it is topped by a particular function, stack checking is not
14588 reliable and a warning is issued by the compiler.
14589
14590 3. Inefficiency: because of both the modified allocation strategy
14591 and the generic implementation, code performance is hampered.
14592
14593 Note that old-style stack checking is also the fallback method for
14594 specific if no target support has been added in the compiler.
14595
14596 -fstack-check= is designed for Ada's needs to detect infinite
14597 recursion and stack overflows. specific is an excellent choice
14598 when compiling Ada code. It is not generally sufficient to protect
14599 against stack-clash attacks. To protect against those you want
14600 -fstack-clash-protection.
14601
14602 -fstack-clash-protection
14603 Generate code to prevent stack clash style attacks. When this
14604 option is enabled, the compiler will only allocate one page of
14605 stack space at a time and each page is accessed immediately after
14606 allocation. Thus, it prevents allocations from jumping over any
14607 stack guard page provided by the operating system.
14608
14609 Most targets do not fully support stack clash protection. However,
14610 on those targets -fstack-clash-protection will protect dynamic
14611 stack allocations. -fstack-clash-protection may also provide
14612 limited protection for static stack allocations if the target
14613 supports -fstack-check=specific.
14614
14615 -fstack-limit-register=reg
14616 -fstack-limit-symbol=sym
14617 -fno-stack-limit
14618 Generate code to ensure that the stack does not grow beyond a
14619 certain value, either the value of a register or the address of a
14620 symbol. If a larger stack is required, a signal is raised at run
14621 time. For most targets, the signal is raised before the stack
14622 overruns the boundary, so it is possible to catch the signal
14623 without taking special precautions.
14624
14625 For instance, if the stack starts at absolute address 0x80000000
14626 and grows downwards, you can use the flags
14627 -fstack-limit-symbol=__stack_limit and
14628 -Wl,--defsym,__stack_limit=0x7ffe0000 to enforce a stack limit of
14629 128KB. Note that this may only work with the GNU linker.
14630
14631 You can locally override stack limit checking by using the
14632 "no_stack_limit" function attribute.
14633
14634 -fsplit-stack
14635 Generate code to automatically split the stack before it overflows.
14636 The resulting program has a discontiguous stack which can only
14637 overflow if the program is unable to allocate any more memory.
14638 This is most useful when running threaded programs, as it is no
14639 longer necessary to calculate a good stack size to use for each
14640 thread. This is currently only implemented for the x86 targets
14641 running GNU/Linux.
14642
14643 When code compiled with -fsplit-stack calls code compiled without
14644 -fsplit-stack, there may not be much stack space available for the
14645 latter code to run. If compiling all code, including library code,
14646 with -fsplit-stack is not an option, then the linker can fix up
14647 these calls so that the code compiled without -fsplit-stack always
14648 has a large stack. Support for this is implemented in the gold
14649 linker in GNU binutils release 2.21 and later.
14650
14651 -fvtable-verify=[std|preinit|none]
14652 This option is only available when compiling C++ code. It turns on
14653 (or off, if using -fvtable-verify=none) the security feature that
14654 verifies at run time, for every virtual call, that the vtable
14655 pointer through which the call is made is valid for the type of the
14656 object, and has not been corrupted or overwritten. If an invalid
14657 vtable pointer is detected at run time, an error is reported and
14658 execution of the program is immediately halted.
14659
14660 This option causes run-time data structures to be built at program
14661 startup, which are used for verifying the vtable pointers. The
14662 options std and preinit control the timing of when these data
14663 structures are built. In both cases the data structures are built
14664 before execution reaches "main". Using -fvtable-verify=std causes
14665 the data structures to be built after shared libraries have been
14666 loaded and initialized. -fvtable-verify=preinit causes them to be
14667 built before shared libraries have been loaded and initialized.
14668
14669 If this option appears multiple times in the command line with
14670 different values specified, none takes highest priority over both
14671 std and preinit; preinit takes priority over std.
14672
14673 -fvtv-debug
14674 When used in conjunction with -fvtable-verify=std or
14675 -fvtable-verify=preinit, causes debug versions of the runtime
14676 functions for the vtable verification feature to be called. This
14677 flag also causes the compiler to log information about which vtable
14678 pointers it finds for each class. This information is written to a
14679 file named vtv_set_ptr_data.log in the directory named by the
14680 environment variable VTV_LOGS_DIR if that is defined or the current
14681 working directory otherwise.
14682
14683 Note: This feature appends data to the log file. If you want a
14684 fresh log file, be sure to delete any existing one.
14685
14686 -fvtv-counts
14687 This is a debugging flag. When used in conjunction with
14688 -fvtable-verify=std or -fvtable-verify=preinit, this causes the
14689 compiler to keep track of the total number of virtual calls it
14690 encounters and the number of verifications it inserts. It also
14691 counts the number of calls to certain run-time library functions
14692 that it inserts and logs this information for each compilation
14693 unit. The compiler writes this information to a file named
14694 vtv_count_data.log in the directory named by the environment
14695 variable VTV_LOGS_DIR if that is defined or the current working
14696 directory otherwise. It also counts the size of the vtable pointer
14697 sets for each class, and writes this information to
14698 vtv_class_set_sizes.log in the same directory.
14699
14700 Note: This feature appends data to the log files. To get fresh
14701 log files, be sure to delete any existing ones.
14702
14703 -finstrument-functions
14704 Generate instrumentation calls for entry and exit to functions.
14705 Just after function entry and just before function exit, the
14706 following profiling functions are called with the address of the
14707 current function and its call site. (On some platforms,
14708 "__builtin_return_address" does not work beyond the current
14709 function, so the call site information may not be available to the
14710 profiling functions otherwise.)
14711
14712 void __cyg_profile_func_enter (void *this_fn,
14713 void *call_site);
14714 void __cyg_profile_func_exit (void *this_fn,
14715 void *call_site);
14716
14717 The first argument is the address of the start of the current
14718 function, which may be looked up exactly in the symbol table.
14719
14720 This instrumentation is also done for functions expanded inline in
14721 other functions. The profiling calls indicate where, conceptually,
14722 the inline function is entered and exited. This means that
14723 addressable versions of such functions must be available. If all
14724 your uses of a function are expanded inline, this may mean an
14725 additional expansion of code size. If you use "extern inline" in
14726 your C code, an addressable version of such functions must be
14727 provided. (This is normally the case anyway, but if you get lucky
14728 and the optimizer always expands the functions inline, you might
14729 have gotten away without providing static copies.)
14730
14731 A function may be given the attribute "no_instrument_function", in
14732 which case this instrumentation is not done. This can be used, for
14733 example, for the profiling functions listed above, high-priority
14734 interrupt routines, and any functions from which the profiling
14735 functions cannot safely be called (perhaps signal handlers, if the
14736 profiling routines generate output or allocate memory).
14737
14738 -finstrument-functions-once
14739 This is similar to -finstrument-functions, but the profiling
14740 functions are called only once per instrumented function, i.e. the
14741 first profiling function is called after the first entry into the
14742 instrumented function and the second profiling function is called
14743 before the exit corresponding to this first entry.
14744
14745 The definition of "once" for the purpose of this option is a little
14746 vague because the implementation is not protected against data
14747 races. As a result, the implementation only guarantees that the
14748 profiling functions are called at least once per process and at
14749 most once per thread, but the calls are always paired, that is to
14750 say, if a thread calls the first function, then it will call the
14751 second function, unless it never reaches the exit of the
14752 instrumented function.
14753
14754 -finstrument-functions-exclude-file-list=file,file,...
14755 Set the list of functions that are excluded from instrumentation
14756 (see the description of -finstrument-functions). If the file that
14757 contains a function definition matches with one of file, then that
14758 function is not instrumented. The match is done on substrings: if
14759 the file parameter is a substring of the file name, it is
14760 considered to be a match.
14761
14762 For example:
14763
14764 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
14765
14766 excludes any inline function defined in files whose pathnames
14767 contain /bits/stl or include/sys.
14768
14769 If, for some reason, you want to include letter , in one of sym,
14770 write ,. For example,
14771 -finstrument-functions-exclude-file-list=',,tmp' (note the single
14772 quote surrounding the option).
14773
14774 -finstrument-functions-exclude-function-list=sym,sym,...
14775 This is similar to -finstrument-functions-exclude-file-list, but
14776 this option sets the list of function names to be excluded from
14777 instrumentation. The function name to be matched is its user-
14778 visible name, such as "vector<int> blah(const vector<int> &)", not
14779 the internal mangled name (e.g., "_Z4blahRSt6vectorIiSaIiEE"). The
14780 match is done on substrings: if the sym parameter is a substring of
14781 the function name, it is considered to be a match. For C99 and C++
14782 extended identifiers, the function name must be given in UTF-8, not
14783 using universal character names.
14784
14785 -fpatchable-function-entry=N[,M]
14786 Generate N NOPs right at the beginning of each function, with the
14787 function entry point before the Mth NOP. If M is omitted, it
14788 defaults to 0 so the function entry points to the address just at
14789 the first NOP. The NOP instructions reserve extra space which can
14790 be used to patch in any desired instrumentation at run time,
14791 provided that the code segment is writable. The amount of space is
14792 controllable indirectly via the number of NOPs; the NOP instruction
14793 used corresponds to the instruction emitted by the internal GCC
14794 back-end interface "gen_nop". This behavior is target-specific and
14795 may also depend on the architecture variant and/or other
14796 compilation options.
14797
14798 For run-time identification, the starting addresses of these areas,
14799 which correspond to their respective function entries minus M, are
14800 additionally collected in the "__patchable_function_entries"
14801 section of the resulting binary.
14802
14803 Note that the value of "__attribute__ ((patchable_function_entry
14804 (N,M)))" takes precedence over command-line option
14805 -fpatchable-function-entry=N,M. This can be used to increase the
14806 area size or to remove it completely on a single function. If
14807 "N=0", no pad location is recorded.
14808
14809 The NOP instructions are inserted at---and maybe before, depending
14810 on M---the function entry address, even before the prologue. On
14811 PowerPC with the ELFv2 ABI, for a function with dual entry points,
14812 the local entry point is this function entry address.
14813
14814 The maximum value of N and M is 65535. On PowerPC with the ELFv2
14815 ABI, for a function with dual entry points, the supported values
14816 for M are 0, 2, 6 and 14.
14817
14818 Options Controlling the Preprocessor
14819 These options control the C preprocessor, which is run on each C source
14820 file before actual compilation.
14821
14822 If you use the -E option, nothing is done except preprocessing. Some
14823 of these options make sense only together with -E because they cause
14824 the preprocessor output to be unsuitable for actual compilation.
14825
14826 In addition to the options listed here, there are a number of options
14827 to control search paths for include files documented in Directory
14828 Options. Options to control preprocessor diagnostics are listed in
14829 Warning Options.
14830
14831 -D name
14832 Predefine name as a macro, with definition 1.
14833
14834 -D name=definition
14835 The contents of definition are tokenized and processed as if they
14836 appeared during translation phase three in a #define directive. In
14837 particular, the definition is truncated by embedded newline
14838 characters.
14839
14840 If you are invoking the preprocessor from a shell or shell-like
14841 program you may need to use the shell's quoting syntax to protect
14842 characters such as spaces that have a meaning in the shell syntax.
14843
14844 If you wish to define a function-like macro on the command line,
14845 write its argument list with surrounding parentheses before the
14846 equals sign (if any). Parentheses are meaningful to most shells,
14847 so you should quote the option. With sh and csh,
14848 -D'name(args...)=definition' works.
14849
14850 -D and -U options are processed in the order they are given on the
14851 command line. All -imacros file and -include file options are
14852 processed after all -D and -U options.
14853
14854 -U name
14855 Cancel any previous definition of name, either built in or provided
14856 with a -D option.
14857
14858 -include file
14859 Process file as if "#include "file"" appeared as the first line of
14860 the primary source file. However, the first directory searched for
14861 file is the preprocessor's working directory instead of the
14862 directory containing the main source file. If not found there, it
14863 is searched for in the remainder of the "#include "..."" search
14864 chain as normal.
14865
14866 If multiple -include options are given, the files are included in
14867 the order they appear on the command line.
14868
14869 -imacros file
14870 Exactly like -include, except that any output produced by scanning
14871 file is thrown away. Macros it defines remain defined. This
14872 allows you to acquire all the macros from a header without also
14873 processing its declarations.
14874
14875 All files specified by -imacros are processed before all files
14876 specified by -include.
14877
14878 -undef
14879 Do not predefine any system-specific or GCC-specific macros. The
14880 standard predefined macros remain defined.
14881
14882 -pthread
14883 Define additional macros required for using the POSIX threads
14884 library. You should use this option consistently for both
14885 compilation and linking. This option is supported on GNU/Linux
14886 targets, most other Unix derivatives, and also on x86 Cygwin and
14887 MinGW targets.
14888
14889 -M Instead of outputting the result of preprocessing, output a rule
14890 suitable for make describing the dependencies of the main source
14891 file. The preprocessor outputs one make rule containing the object
14892 file name for that source file, a colon, and the names of all the
14893 included files, including those coming from -include or -imacros
14894 command-line options.
14895
14896 Unless specified explicitly (with -MT or -MQ), the object file name
14897 consists of the name of the source file with any suffix replaced
14898 with object file suffix and with any leading directory parts
14899 removed. If there are many included files then the rule is split
14900 into several lines using \-newline. The rule has no commands.
14901
14902 This option does not suppress the preprocessor's debug output, such
14903 as -dM. To avoid mixing such debug output with the dependency
14904 rules you should explicitly specify the dependency output file with
14905 -MF, or use an environment variable like DEPENDENCIES_OUTPUT.
14906 Debug output is still sent to the regular output stream as normal.
14907
14908 Passing -M to the driver implies -E, and suppresses warnings with
14909 an implicit -w.
14910
14911 -MM Like -M but do not mention header files that are found in system
14912 header directories, nor header files that are included, directly or
14913 indirectly, from such a header.
14914
14915 This implies that the choice of angle brackets or double quotes in
14916 an #include directive does not in itself determine whether that
14917 header appears in -MM dependency output.
14918
14919 -MF file
14920 When used with -M or -MM, specifies a file to write the
14921 dependencies to. If no -MF switch is given the preprocessor sends
14922 the rules to the same place it would send preprocessed output.
14923
14924 When used with the driver options -MD or -MMD, -MF overrides the
14925 default dependency output file.
14926
14927 If file is -, then the dependencies are written to stdout.
14928
14929 -MG In conjunction with an option such as -M requesting dependency
14930 generation, -MG assumes missing header files are generated files
14931 and adds them to the dependency list without raising an error. The
14932 dependency filename is taken directly from the "#include" directive
14933 without prepending any path. -MG also suppresses preprocessed
14934 output, as a missing header file renders this useless.
14935
14936 This feature is used in automatic updating of makefiles.
14937
14938 -Mno-modules
14939 Disable dependency generation for compiled module interfaces.
14940
14941 -MP This option instructs CPP to add a phony target for each dependency
14942 other than the main file, causing each to depend on nothing. These
14943 dummy rules work around errors make gives if you remove header
14944 files without updating the Makefile to match.
14945
14946 This is typical output:
14947
14948 test.o: test.c test.h
14949
14950 test.h:
14951
14952 -MT target
14953 Change the target of the rule emitted by dependency generation. By
14954 default CPP takes the name of the main input file, deletes any
14955 directory components and any file suffix such as .c, and appends
14956 the platform's usual object suffix. The result is the target.
14957
14958 An -MT option sets the target to be exactly the string you specify.
14959 If you want multiple targets, you can specify them as a single
14960 argument to -MT, or use multiple -MT options.
14961
14962 For example, -MT '$(objpfx)foo.o' might give
14963
14964 $(objpfx)foo.o: foo.c
14965
14966 -MQ target
14967 Same as -MT, but it quotes any characters which are special to
14968 Make. -MQ '$(objpfx)foo.o' gives
14969
14970 $$(objpfx)foo.o: foo.c
14971
14972 The default target is automatically quoted, as if it were given
14973 with -MQ.
14974
14975 -MD -MD is equivalent to -M -MF file, except that -E is not implied.
14976 The driver determines file based on whether an -o option is given.
14977 If it is, the driver uses its argument but with a suffix of .d,
14978 otherwise it takes the name of the input file, removes any
14979 directory components and suffix, and applies a .d suffix.
14980
14981 If -MD is used in conjunction with -E, any -o switch is understood
14982 to specify the dependency output file, but if used without -E, each
14983 -o is understood to specify a target object file.
14984
14985 Since -E is not implied, -MD can be used to generate a dependency
14986 output file as a side effect of the compilation process.
14987
14988 -MMD
14989 Like -MD except mention only user header files, not system header
14990 files.
14991
14992 -fpreprocessed
14993 Indicate to the preprocessor that the input file has already been
14994 preprocessed. This suppresses things like macro expansion,
14995 trigraph conversion, escaped newline splicing, and processing of
14996 most directives. The preprocessor still recognizes and removes
14997 comments, so that you can pass a file preprocessed with -C to the
14998 compiler without problems. In this mode the integrated
14999 preprocessor is little more than a tokenizer for the front ends.
15000
15001 -fpreprocessed is implicit if the input file has one of the
15002 extensions .i, .ii or .mi. These are the extensions that GCC uses
15003 for preprocessed files created by -save-temps.
15004
15005 -fdirectives-only
15006 When preprocessing, handle directives, but do not expand macros.
15007
15008 The option's behavior depends on the -E and -fpreprocessed options.
15009
15010 With -E, preprocessing is limited to the handling of directives
15011 such as "#define", "#ifdef", and "#error". Other preprocessor
15012 operations, such as macro expansion and trigraph conversion are not
15013 performed. In addition, the -dD option is implicitly enabled.
15014
15015 With -fpreprocessed, predefinition of command line and most builtin
15016 macros is disabled. Macros such as "__LINE__", which are
15017 contextually dependent, are handled normally. This enables
15018 compilation of files previously preprocessed with "-E
15019 -fdirectives-only".
15020
15021 With both -E and -fpreprocessed, the rules for -fpreprocessed take
15022 precedence. This enables full preprocessing of files previously
15023 preprocessed with "-E -fdirectives-only".
15024
15025 -fdollars-in-identifiers
15026 Accept $ in identifiers.
15027
15028 -fextended-identifiers
15029 Accept universal character names and extended characters in
15030 identifiers. This option is enabled by default for C99 (and later
15031 C standard versions) and C++.
15032
15033 -fno-canonical-system-headers
15034 When preprocessing, do not shorten system header paths with
15035 canonicalization.
15036
15037 -fmax-include-depth=depth
15038 Set the maximum depth of the nested #include. The default is 200.
15039
15040 -ftabstop=width
15041 Set the distance between tab stops. This helps the preprocessor
15042 report correct column numbers in warnings or errors, even if tabs
15043 appear on the line. If the value is less than 1 or greater than
15044 100, the option is ignored. The default is 8.
15045
15046 -ftrack-macro-expansion[=level]
15047 Track locations of tokens across macro expansions. This allows the
15048 compiler to emit diagnostic about the current macro expansion stack
15049 when a compilation error occurs in a macro expansion. Using this
15050 option makes the preprocessor and the compiler consume more memory.
15051 The level parameter can be used to choose the level of precision of
15052 token location tracking thus decreasing the memory consumption if
15053 necessary. Value 0 of level de-activates this option. Value 1
15054 tracks tokens locations in a degraded mode for the sake of minimal
15055 memory overhead. In this mode all tokens resulting from the
15056 expansion of an argument of a function-like macro have the same
15057 location. Value 2 tracks tokens locations completely. This value is
15058 the most memory hungry. When this option is given no argument, the
15059 default parameter value is 2.
15060
15061 Note that "-ftrack-macro-expansion=2" is activated by default.
15062
15063 -fmacro-prefix-map=old=new
15064 When preprocessing files residing in directory old, expand the
15065 "__FILE__" and "__BASE_FILE__" macros as if the files resided in
15066 directory new instead. This can be used to change an absolute path
15067 to a relative path by using . for new which can result in more
15068 reproducible builds that are location independent. This option
15069 also affects "__builtin_FILE()" during compilation. See also
15070 -ffile-prefix-map and -fcanon-prefix-map.
15071
15072 -fexec-charset=charset
15073 Set the execution character set, used for string and character
15074 constants. The default is UTF-8. charset can be any encoding
15075 supported by the system's "iconv" library routine.
15076
15077 -fwide-exec-charset=charset
15078 Set the wide execution character set, used for wide string and
15079 character constants. The default is one of UTF-32BE, UTF-32LE,
15080 UTF-16BE, or UTF-16LE, whichever corresponds to the width of
15081 "wchar_t" and the big-endian or little-endian byte order being used
15082 for code generation. As with -fexec-charset, charset can be any
15083 encoding supported by the system's "iconv" library routine;
15084 however, you will have problems with encodings that do not fit
15085 exactly in "wchar_t".
15086
15087 -finput-charset=charset
15088 Set the input character set, used for translation from the
15089 character set of the input file to the source character set used by
15090 GCC. If the locale does not specify, or GCC cannot get this
15091 information from the locale, the default is UTF-8. This can be
15092 overridden by either the locale or this command-line option.
15093 Currently the command-line option takes precedence if there's a
15094 conflict. charset can be any encoding supported by the system's
15095 "iconv" library routine.
15096
15097 -fpch-deps
15098 When using precompiled headers, this flag causes the dependency-
15099 output flags to also list the files from the precompiled header's
15100 dependencies. If not specified, only the precompiled header are
15101 listed and not the files that were used to create it, because those
15102 files are not consulted when a precompiled header is used.
15103
15104 -fpch-preprocess
15105 This option allows use of a precompiled header together with -E.
15106 It inserts a special "#pragma", "#pragma GCC pch_preprocess
15107 "filename"" in the output to mark the place where the precompiled
15108 header was found, and its filename. When -fpreprocessed is in use,
15109 GCC recognizes this "#pragma" and loads the PCH.
15110
15111 This option is off by default, because the resulting preprocessed
15112 output is only really suitable as input to GCC. It is switched on
15113 by -save-temps.
15114
15115 You should not write this "#pragma" in your own code, but it is
15116 safe to edit the filename if the PCH file is available in a
15117 different location. The filename may be absolute or it may be
15118 relative to GCC's current directory.
15119
15120 -fworking-directory
15121 Enable generation of linemarkers in the preprocessor output that
15122 let the compiler know the current working directory at the time of
15123 preprocessing. When this option is enabled, the preprocessor
15124 emits, after the initial linemarker, a second linemarker with the
15125 current working directory followed by two slashes. GCC uses this
15126 directory, when it's present in the preprocessed input, as the
15127 directory emitted as the current working directory in some
15128 debugging information formats. This option is implicitly enabled
15129 if debugging information is enabled, but this can be inhibited with
15130 the negated form -fno-working-directory. If the -P flag is present
15131 in the command line, this option has no effect, since no "#line"
15132 directives are emitted whatsoever.
15133
15134 -A predicate=answer
15135 Make an assertion with the predicate predicate and answer answer.
15136 This form is preferred to the older form -A predicate(answer),
15137 which is still supported, because it does not use shell special
15138 characters.
15139
15140 -A -predicate=answer
15141 Cancel an assertion with the predicate predicate and answer answer.
15142
15143 -C Do not discard comments. All comments are passed through to the
15144 output file, except for comments in processed directives, which are
15145 deleted along with the directive.
15146
15147 You should be prepared for side effects when using -C; it causes
15148 the preprocessor to treat comments as tokens in their own right.
15149 For example, comments appearing at the start of what would be a
15150 directive line have the effect of turning that line into an
15151 ordinary source line, since the first token on the line is no
15152 longer a #.
15153
15154 -CC Do not discard comments, including during macro expansion. This is
15155 like -C, except that comments contained within macros are also
15156 passed through to the output file where the macro is expanded.
15157
15158 In addition to the side effects of the -C option, the -CC option
15159 causes all C++-style comments inside a macro to be converted to
15160 C-style comments. This is to prevent later use of that macro from
15161 inadvertently commenting out the remainder of the source line.
15162
15163 The -CC option is generally used to support lint comments.
15164
15165 -P Inhibit generation of linemarkers in the output from the
15166 preprocessor. This might be useful when running the preprocessor
15167 on something that is not C code, and will be sent to a program
15168 which might be confused by the linemarkers.
15169
15170 -traditional
15171 -traditional-cpp
15172 Try to imitate the behavior of pre-standard C preprocessors, as
15173 opposed to ISO C preprocessors. See the GNU CPP manual for
15174 details.
15175
15176 Note that GCC does not otherwise attempt to emulate a pre-standard
15177 C compiler, and these options are only supported with the -E
15178 switch, or when invoking CPP explicitly.
15179
15180 -trigraphs
15181 Support ISO C trigraphs. These are three-character sequences, all
15182 starting with ??, that are defined by ISO C to stand for single
15183 characters. For example, ??/ stands for \, so '??/n' is a
15184 character constant for a newline.
15185
15186 The nine trigraphs and their replacements are
15187
15188 Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-
15189 Replacement: [ ] { } # \ ^ | ~
15190
15191 By default, GCC ignores trigraphs, but in standard-conforming modes
15192 it converts them. See the -std and -ansi options.
15193
15194 -remap
15195 Enable special code to work around file systems which only permit
15196 very short file names, such as MS-DOS.
15197
15198 -H Print the name of each header file used, in addition to other
15199 normal activities. Each name is indented to show how deep in the
15200 #include stack it is. Precompiled header files are also printed,
15201 even if they are found to be invalid; an invalid precompiled header
15202 file is printed with ...x and a valid one with ...! .
15203
15204 -dletters
15205 Says to make debugging dumps during compilation as specified by
15206 letters. The flags documented here are those relevant to the
15207 preprocessor. Other letters are interpreted by the compiler
15208 proper, or reserved for future versions of GCC, and so are silently
15209 ignored. If you specify letters whose behavior conflicts, the
15210 result is undefined.
15211
15212 -dM Instead of the normal output, generate a list of #define
15213 directives for all the macros defined during the execution of
15214 the preprocessor, including predefined macros. This gives you
15215 a way of finding out what is predefined in your version of the
15216 preprocessor. Assuming you have no file foo.h, the command
15217
15218 touch foo.h; cpp -dM foo.h
15219
15220 shows all the predefined macros.
15221
15222 If you use -dM without the -E option, -dM is interpreted as a
15223 synonym for -fdump-rtl-mach.
15224
15225 -dD Like -dM except in two respects: it does not include the
15226 predefined macros, and it outputs both the #define directives
15227 and the result of preprocessing. Both kinds of output go to
15228 the standard output file.
15229
15230 -dN Like -dD, but emit only the macro names, not their expansions.
15231
15232 -dI Output #include directives in addition to the result of
15233 preprocessing.
15234
15235 -dU Like -dD except that only macros that are expanded, or whose
15236 definedness is tested in preprocessor directives, are output;
15237 the output is delayed until the use or test of the macro; and
15238 #undef directives are also output for macros tested but
15239 undefined at the time.
15240
15241 -fdebug-cpp
15242 This option is only useful for debugging GCC. When used from CPP
15243 or with -E, it dumps debugging information about location maps.
15244 Every token in the output is preceded by the dump of the map its
15245 location belongs to.
15246
15247 When used from GCC without -E, this option has no effect.
15248
15249 -Wp,option
15250 You can use -Wp,option to bypass the compiler driver and pass
15251 option directly through to the preprocessor. If option contains
15252 commas, it is split into multiple options at the commas. However,
15253 many options are modified, translated or interpreted by the
15254 compiler driver before being passed to the preprocessor, and -Wp
15255 forcibly bypasses this phase. The preprocessor's direct interface
15256 is undocumented and subject to change, so whenever possible you
15257 should avoid using -Wp and let the driver handle the options
15258 instead.
15259
15260 -Xpreprocessor option
15261 Pass option as an option to the preprocessor. You can use this to
15262 supply system-specific preprocessor options that GCC does not
15263 recognize.
15264
15265 If you want to pass an option that takes an argument, you must use
15266 -Xpreprocessor twice, once for the option and once for the
15267 argument.
15268
15269 -no-integrated-cpp
15270 Perform preprocessing as a separate pass before compilation. By
15271 default, GCC performs preprocessing as an integrated part of input
15272 tokenization and parsing. If this option is provided, the
15273 appropriate language front end (cc1, cc1plus, or cc1obj for C, C++,
15274 and Objective-C, respectively) is instead invoked twice, once for
15275 preprocessing only and once for actual compilation of the
15276 preprocessed input. This option may be useful in conjunction with
15277 the -B or -wrapper options to specify an alternate preprocessor or
15278 perform additional processing of the program source between normal
15279 preprocessing and compilation.
15280
15281 -flarge-source-files
15282 Adjust GCC to expect large source files, at the expense of slower
15283 compilation and higher memory usage.
15284
15285 Specifically, GCC normally tracks both column numbers and line
15286 numbers within source files and it normally prints both of these
15287 numbers in diagnostics. However, once it has processed a certain
15288 number of source lines, it stops tracking column numbers and only
15289 tracks line numbers. This means that diagnostics for later lines
15290 do not include column numbers. It also means that options like
15291 -Wmisleading-indentation cease to work at that point, although the
15292 compiler prints a note if this happens. Passing
15293 -flarge-source-files significantly increases the number of source
15294 lines that GCC can process before it stops tracking columns.
15295
15296 Passing Options to the Assembler
15297 You can pass options to the assembler.
15298
15299 -Wa,option
15300 Pass option as an option to the assembler. If option contains
15301 commas, it is split into multiple options at the commas.
15302
15303 -Xassembler option
15304 Pass option as an option to the assembler. You can use this to
15305 supply system-specific assembler options that GCC does not
15306 recognize.
15307
15308 If you want to pass an option that takes an argument, you must use
15309 -Xassembler twice, once for the option and once for the argument.
15310
15311 Options for Linking
15312 These options come into play when the compiler links object files into
15313 an executable output file. They are meaningless if the compiler is not
15314 doing a link step.
15315
15316 object-file-name
15317 A file name that does not end in a special recognized suffix is
15318 considered to name an object file or library. (Object files are
15319 distinguished from libraries by the linker according to the file
15320 contents.) If linking is done, these object files are used as
15321 input to the linker.
15322
15323 -c
15324 -S
15325 -E If any of these options is used, then the linker is not run, and
15326 object file names should not be used as arguments.
15327
15328 -flinker-output=type
15329 This option controls code generation of the link-time optimizer.
15330 By default the linker output is automatically determined by the
15331 linker plugin. For debugging the compiler and if incremental
15332 linking with a non-LTO object file is desired, it may be useful to
15333 control the type manually.
15334
15335 If type is exec, code generation produces a static binary. In this
15336 case -fpic and -fpie are both disabled.
15337
15338 If type is dyn, code generation produces a shared library. In this
15339 case -fpic or -fPIC is preserved, but not enabled automatically.
15340 This allows to build shared libraries without position-independent
15341 code on architectures where this is possible, i.e. on x86.
15342
15343 If type is pie, code generation produces an -fpie executable. This
15344 results in similar optimizations as exec except that -fpie is not
15345 disabled if specified at compilation time.
15346
15347 If type is rel, the compiler assumes that incremental linking is
15348 done. The sections containing intermediate code for link-time
15349 optimization are merged, pre-optimized, and output to the resulting
15350 object file. In addition, if -ffat-lto-objects is specified, binary
15351 code is produced for future non-LTO linking. The object file
15352 produced by incremental linking is smaller than a static library
15353 produced from the same object files. At link time the result of
15354 incremental linking also loads faster than a static library
15355 assuming that the majority of objects in the library are used.
15356
15357 Finally nolto-rel configures the compiler for incremental linking
15358 where code generation is forced, a final binary is produced, and
15359 the intermediate code for later link-time optimization is stripped.
15360 When multiple object files are linked together the resulting code
15361 is better optimized than with link-time optimizations disabled (for
15362 example, cross-module inlining happens), but most of benefits of
15363 whole program optimizations are lost.
15364
15365 During the incremental link (by -r) the linker plugin defaults to
15366 rel. With current interfaces to GNU Binutils it is however not
15367 possible to incrementally link LTO objects and non-LTO objects into
15368 a single mixed object file. If any of object files in incremental
15369 link cannot be used for link-time optimization, the linker plugin
15370 issues a warning and uses nolto-rel. To maintain whole program
15371 optimization, it is recommended to link such objects into static
15372 library instead. Alternatively it is possible to use H.J. Lu's
15373 binutils with support for mixed objects.
15374
15375 -fuse-ld=bfd
15376 Use the bfd linker instead of the default linker.
15377
15378 -fuse-ld=gold
15379 Use the gold linker instead of the default linker.
15380
15381 -fuse-ld=lld
15382 Use the LLVM lld linker instead of the default linker.
15383
15384 -fuse-ld=mold
15385 Use the Modern Linker (mold) instead of the default linker.
15386
15387 -llibrary
15388 -l library
15389 Search the library named library when linking. (The second
15390 alternative with the library as a separate argument is only for
15391 POSIX compliance and is not recommended.)
15392
15393 The -l option is passed directly to the linker by GCC. Refer to
15394 your linker documentation for exact details. The general
15395 description below applies to the GNU linker.
15396
15397 The linker searches a standard list of directories for the library.
15398 The directories searched include several standard system
15399 directories plus any that you specify with -L.
15400
15401 Static libraries are archives of object files, and have file names
15402 like liblibrary.a. Some targets also support shared libraries,
15403 which typically have names like liblibrary.so. If both static and
15404 shared libraries are found, the linker gives preference to linking
15405 with the shared library unless the -static option is used.
15406
15407 It makes a difference where in the command you write this option;
15408 the linker searches and processes libraries and object files in the
15409 order they are specified. Thus, foo.o -lz bar.o searches library z
15410 after file foo.o but before bar.o. If bar.o refers to functions in
15411 z, those functions may not be loaded.
15412
15413 -lobjc
15414 You need this special case of the -l option in order to link an
15415 Objective-C or Objective-C++ program.
15416
15417 -nostartfiles
15418 Do not use the standard system startup files when linking. The
15419 standard system libraries are used normally, unless -nostdlib,
15420 -nolibc, or -nodefaultlibs is used.
15421
15422 -nodefaultlibs
15423 Do not use the standard system libraries when linking. Only the
15424 libraries you specify are passed to the linker, and options
15425 specifying linkage of the system libraries, such as -static-libgcc
15426 or -shared-libgcc, are ignored. The standard startup files are
15427 used normally, unless -nostartfiles is used.
15428
15429 The compiler may generate calls to "memcmp", "memset", "memcpy" and
15430 "memmove". These entries are usually resolved by entries in libc.
15431 These entry points should be supplied through some other mechanism
15432 when this option is specified.
15433
15434 -nolibc
15435 Do not use the C library or system libraries tightly coupled with
15436 it when linking. Still link with the startup files, libgcc or
15437 toolchain provided language support libraries such as libgnat,
15438 libgfortran or libstdc++ unless options preventing their inclusion
15439 are used as well. This typically removes -lc from the link command
15440 line, as well as system libraries that normally go with it and
15441 become meaningless when absence of a C library is assumed, for
15442 example -lpthread or -lm in some configurations. This is intended
15443 for bare-board targets when there is indeed no C library available.
15444
15445 -nostdlib
15446 Do not use the standard system startup files or libraries when
15447 linking. No startup files and only the libraries you specify are
15448 passed to the linker, and options specifying linkage of the system
15449 libraries, such as -static-libgcc or -shared-libgcc, are ignored.
15450
15451 The compiler may generate calls to "memcmp", "memset", "memcpy" and
15452 "memmove". These entries are usually resolved by entries in libc.
15453 These entry points should be supplied through some other mechanism
15454 when this option is specified.
15455
15456 One of the standard libraries bypassed by -nostdlib and
15457 -nodefaultlibs is libgcc.a, a library of internal subroutines which
15458 GCC uses to overcome shortcomings of particular machines, or
15459 special needs for some languages.
15460
15461 In most cases, you need libgcc.a even when you want to avoid other
15462 standard libraries. In other words, when you specify -nostdlib or
15463 -nodefaultlibs you should usually specify -lgcc as well. This
15464 ensures that you have no unresolved references to internal GCC
15465 library subroutines. (An example of such an internal subroutine is
15466 "__main", used to ensure C++ constructors are called.)
15467
15468 -nostdlib++
15469 Do not implicitly link with standard C++ libraries.
15470
15471 -e entry
15472 --entry=entry
15473 Specify that the program entry point is entry. The argument is
15474 interpreted by the linker; the GNU linker accepts either a symbol
15475 name or an address.
15476
15477 -pie
15478 Produce a dynamically linked position independent executable on
15479 targets that support it. For predictable results, you must also
15480 specify the same set of options used for compilation (-fpie, -fPIE,
15481 or model suboptions) when you specify this linker option.
15482
15483 -no-pie
15484 Don't produce a dynamically linked position independent executable.
15485
15486 -static-pie
15487 Produce a static position independent executable on targets that
15488 support it. A static position independent executable is similar to
15489 a static executable, but can be loaded at any address without a
15490 dynamic linker. For predictable results, you must also specify the
15491 same set of options used for compilation (-fpie, -fPIE, or model
15492 suboptions) when you specify this linker option.
15493
15494 -pthread
15495 Link with the POSIX threads library. This option is supported on
15496 GNU/Linux targets, most other Unix derivatives, and also on x86
15497 Cygwin and MinGW targets. On some targets this option also sets
15498 flags for the preprocessor, so it should be used consistently for
15499 both compilation and linking.
15500
15501 -r Produce a relocatable object as output. This is also known as
15502 partial linking.
15503
15504 -rdynamic
15505 Pass the flag -export-dynamic to the ELF linker, on targets that
15506 support it. This instructs the linker to add all symbols, not only
15507 used ones, to the dynamic symbol table. This option is needed for
15508 some uses of "dlopen" or to allow obtaining backtraces from within
15509 a program.
15510
15511 -s Remove all symbol table and relocation information from the
15512 executable.
15513
15514 -static
15515 On systems that support dynamic linking, this overrides -pie and
15516 prevents linking with the shared libraries. On other systems, this
15517 option has no effect.
15518
15519 -shared
15520 Produce a shared object which can then be linked with other objects
15521 to form an executable. Not all systems support this option. For
15522 predictable results, you must also specify the same set of options
15523 used for compilation (-fpic, -fPIC, or model suboptions) when you
15524 specify this linker option.[1]
15525
15526 -shared-libgcc
15527 -static-libgcc
15528 On systems that provide libgcc as a shared library, these options
15529 force the use of either the shared or static version, respectively.
15530 If no shared version of libgcc was built when the compiler was
15531 configured, these options have no effect.
15532
15533 There are several situations in which an application should use the
15534 shared libgcc instead of the static version. The most common of
15535 these is when the application wishes to throw and catch exceptions
15536 across different shared libraries. In that case, each of the
15537 libraries as well as the application itself should use the shared
15538 libgcc.
15539
15540 Therefore, the G++ driver automatically adds -shared-libgcc
15541 whenever you build a shared library or a main executable, because
15542 C++ programs typically use exceptions, so this is the right thing
15543 to do.
15544
15545 If, instead, you use the GCC driver to create shared libraries, you
15546 may find that they are not always linked with the shared libgcc.
15547 If GCC finds, at its configuration time, that you have a non-GNU
15548 linker or a GNU linker that does not support option --eh-frame-hdr,
15549 it links the shared version of libgcc into shared libraries by
15550 default. Otherwise, it takes advantage of the linker and optimizes
15551 away the linking with the shared version of libgcc, linking with
15552 the static version of libgcc by default. This allows exceptions to
15553 propagate through such shared libraries, without incurring
15554 relocation costs at library load time.
15555
15556 However, if a library or main executable is supposed to throw or
15557 catch exceptions, you must link it using the G++ driver, or using
15558 the option -shared-libgcc, such that it is linked with the shared
15559 libgcc.
15560
15561 -static-libasan
15562 When the -fsanitize=address option is used to link a program, the
15563 GCC driver automatically links against libasan. If libasan is
15564 available as a shared library, and the -static option is not used,
15565 then this links against the shared version of libasan. The
15566 -static-libasan option directs the GCC driver to link libasan
15567 statically, without necessarily linking other libraries statically.
15568
15569 -static-libtsan
15570 When the -fsanitize=thread option is used to link a program, the
15571 GCC driver automatically links against libtsan. If libtsan is
15572 available as a shared library, and the -static option is not used,
15573 then this links against the shared version of libtsan. The
15574 -static-libtsan option directs the GCC driver to link libtsan
15575 statically, without necessarily linking other libraries statically.
15576
15577 -static-liblsan
15578 When the -fsanitize=leak option is used to link a program, the GCC
15579 driver automatically links against liblsan. If liblsan is
15580 available as a shared library, and the -static option is not used,
15581 then this links against the shared version of liblsan. The
15582 -static-liblsan option directs the GCC driver to link liblsan
15583 statically, without necessarily linking other libraries statically.
15584
15585 -static-libubsan
15586 When the -fsanitize=undefined option is used to link a program, the
15587 GCC driver automatically links against libubsan. If libubsan is
15588 available as a shared library, and the -static option is not used,
15589 then this links against the shared version of libubsan. The
15590 -static-libubsan option directs the GCC driver to link libubsan
15591 statically, without necessarily linking other libraries statically.
15592
15593 -static-libstdc++
15594 When the g++ program is used to link a C++ program, it normally
15595 automatically links against libstdc++. If libstdc++ is available
15596 as a shared library, and the -static option is not used, then this
15597 links against the shared version of libstdc++. That is normally
15598 fine. However, it is sometimes useful to freeze the version of
15599 libstdc++ used by the program without going all the way to a fully
15600 static link. The -static-libstdc++ option directs the g++ driver
15601 to link libstdc++ statically, without necessarily linking other
15602 libraries statically.
15603
15604 -symbolic
15605 Bind references to global symbols when building a shared object.
15606 Warn about any unresolved references (unless overridden by the link
15607 editor option -Xlinker -z -Xlinker defs). Only a few systems
15608 support this option.
15609
15610 -T script
15611 Use script as the linker script. This option is supported by most
15612 systems using the GNU linker. On some targets, such as bare-board
15613 targets without an operating system, the -T option may be required
15614 when linking to avoid references to undefined symbols.
15615
15616 -Xlinker option
15617 Pass option as an option to the linker. You can use this to supply
15618 system-specific linker options that GCC does not recognize.
15619
15620 If you want to pass an option that takes a separate argument, you
15621 must use -Xlinker twice, once for the option and once for the
15622 argument. For example, to pass -assert definitions, you must write
15623 -Xlinker -assert -Xlinker definitions. It does not work to write
15624 -Xlinker "-assert definitions", because this passes the entire
15625 string as a single argument, which is not what the linker expects.
15626
15627 When using the GNU linker, it is usually more convenient to pass
15628 arguments to linker options using the option=value syntax than as
15629 separate arguments. For example, you can specify -Xlinker
15630 -Map=output.map rather than -Xlinker -Map -Xlinker output.map.
15631 Other linkers may not support this syntax for command-line options.
15632
15633 -Wl,option
15634 Pass option as an option to the linker. If option contains commas,
15635 it is split into multiple options at the commas. You can use this
15636 syntax to pass an argument to the option. For example,
15637 -Wl,-Map,output.map passes -Map output.map to the linker. When
15638 using the GNU linker, you can also get the same effect with
15639 -Wl,-Map=output.map.
15640
15641 -u symbol
15642 Pretend the symbol symbol is undefined, to force linking of library
15643 modules to define it. You can use -u multiple times with different
15644 symbols to force loading of additional library modules.
15645
15646 -z keyword
15647 -z is passed directly on to the linker along with the keyword
15648 keyword. See the section in the documentation of your linker for
15649 permitted values and their meanings.
15650
15651 Options for Directory Search
15652 These options specify directories to search for header files, for
15653 libraries and for parts of the compiler:
15654
15655 -I dir
15656 -iquote dir
15657 -isystem dir
15658 -idirafter dir
15659 Add the directory dir to the list of directories to be searched for
15660 header files during preprocessing. If dir begins with = or
15661 $SYSROOT, then the = or $SYSROOT is replaced by the sysroot prefix;
15662 see --sysroot and -isysroot.
15663
15664 Directories specified with -iquote apply only to the quote form of
15665 the directive, "#include "file"". Directories specified with -I,
15666 -isystem, or -idirafter apply to lookup for both the
15667 "#include "file"" and "#include <file>" directives.
15668
15669 You can specify any number or combination of these options on the
15670 command line to search for header files in several directories.
15671 The lookup order is as follows:
15672
15673 1. For the quote form of the include directive, the directory of
15674 the current file is searched first.
15675
15676 2. For the quote form of the include directive, the directories
15677 specified by -iquote options are searched in left-to-right
15678 order, as they appear on the command line.
15679
15680 3. Directories specified with -I options are scanned in left-to-
15681 right order.
15682
15683 4. Directories specified with -isystem options are scanned in
15684 left-to-right order.
15685
15686 5. Standard system directories are scanned.
15687
15688 6. Directories specified with -idirafter options are scanned in
15689 left-to-right order.
15690
15691 You can use -I to override a system header file, substituting your
15692 own version, since these directories are searched before the
15693 standard system header file directories. However, you should not
15694 use this option to add directories that contain vendor-supplied
15695 system header files; use -isystem for that.
15696
15697 The -isystem and -idirafter options also mark the directory as a
15698 system directory, so that it gets the same special treatment that
15699 is applied to the standard system directories.
15700
15701 If a standard system include directory, or a directory specified
15702 with -isystem, is also specified with -I, the -I option is ignored.
15703 The directory is still searched but as a system directory at its
15704 normal position in the system include chain. This is to ensure
15705 that GCC's procedure to fix buggy system headers and the ordering
15706 for the "#include_next" directive are not inadvertently changed.
15707 If you really need to change the search order for system
15708 directories, use the -nostdinc and/or -isystem options.
15709
15710 -I- Split the include path. This option has been deprecated. Please
15711 use -iquote instead for -I directories before the -I- and remove
15712 the -I- option.
15713
15714 Any directories specified with -I options before -I- are searched
15715 only for headers requested with "#include "file""; they are not
15716 searched for "#include <file>". If additional directories are
15717 specified with -I options after the -I-, those directories are
15718 searched for all #include directives.
15719
15720 In addition, -I- inhibits the use of the directory of the current
15721 file directory as the first search directory for "#include "file"".
15722 There is no way to override this effect of -I-.
15723
15724 -iprefix prefix
15725 Specify prefix as the prefix for subsequent -iwithprefix options.
15726 If the prefix represents a directory, you should include the final
15727 /.
15728
15729 -iwithprefix dir
15730 -iwithprefixbefore dir
15731 Append dir to the prefix specified previously with -iprefix, and
15732 add the resulting directory to the include search path.
15733 -iwithprefixbefore puts it in the same place -I would; -iwithprefix
15734 puts it where -idirafter would.
15735
15736 -isysroot dir
15737 This option is like the --sysroot option, but applies only to
15738 header files (except for Darwin targets, where it applies to both
15739 header files and libraries). See the --sysroot option for more
15740 information.
15741
15742 -imultilib dir
15743 Use dir as a subdirectory of the directory containing target-
15744 specific C++ headers.
15745
15746 -nostdinc
15747 Do not search the standard system directories for header files.
15748 Only the directories explicitly specified with -I, -iquote,
15749 -isystem, and/or -idirafter options (and the directory of the
15750 current file, if appropriate) are searched.
15751
15752 -nostdinc++
15753 Do not search for header files in the C++-specific standard
15754 directories, but do still search the other standard directories.
15755 (This option is used when building the C++ library.)
15756
15757 -iplugindir=dir
15758 Set the directory to search for plugins that are passed by
15759 -fplugin=name instead of -fplugin=path/name.so. This option is not
15760 meant to be used by the user, but only passed by the driver.
15761
15762 -Ldir
15763 Add directory dir to the list of directories to be searched for -l.
15764
15765 -Bprefix
15766 This option specifies where to find the executables, libraries,
15767 include files, and data files of the compiler itself.
15768
15769 The compiler driver program runs one or more of the subprograms
15770 cpp, cc1, as and ld. It tries prefix as a prefix for each program
15771 it tries to run, both with and without machine/version/ for the
15772 corresponding target machine and compiler version.
15773
15774 For each subprogram to be run, the compiler driver first tries the
15775 -B prefix, if any. If that name is not found, or if -B is not
15776 specified, the driver tries two standard prefixes, /usr/lib/gcc/
15777 and /usr/local/lib/gcc/. If neither of those results in a file
15778 name that is found, the unmodified program name is searched for
15779 using the directories specified in your PATH environment variable.
15780
15781 The compiler checks to see if the path provided by -B refers to a
15782 directory, and if necessary it adds a directory separator character
15783 at the end of the path.
15784
15785 -B prefixes that effectively specify directory names also apply to
15786 libraries in the linker, because the compiler translates these
15787 options into -L options for the linker. They also apply to include
15788 files in the preprocessor, because the compiler translates these
15789 options into -isystem options for the preprocessor. In this case,
15790 the compiler appends include to the prefix.
15791
15792 The runtime support file libgcc.a can also be searched for using
15793 the -B prefix, if needed. If it is not found there, the two
15794 standard prefixes above are tried, and that is all. The file is
15795 left out of the link if it is not found by those means.
15796
15797 Another way to specify a prefix much like the -B prefix is to use
15798 the environment variable GCC_EXEC_PREFIX.
15799
15800 As a special kludge, if the path provided by -B is [dir/]stageN/,
15801 where N is a number in the range 0 to 9, then it is replaced by
15802 [dir/]include. This is to help with boot-strapping the compiler.
15803
15804 -no-canonical-prefixes
15805 Do not expand any symbolic links, resolve references to /../ or
15806 /./, or make the path absolute when generating a relative prefix.
15807
15808 --sysroot=dir
15809 Use dir as the logical root directory for headers and libraries.
15810 For example, if the compiler normally searches for headers in
15811 /usr/include and libraries in /usr/lib, it instead searches
15812 dir/usr/include and dir/usr/lib.
15813
15814 If you use both this option and the -isysroot option, then the
15815 --sysroot option applies to libraries, but the -isysroot option
15816 applies to header files.
15817
15818 The GNU linker (beginning with version 2.16) has the necessary
15819 support for this option. If your linker does not support this
15820 option, the header file aspect of --sysroot still works, but the
15821 library aspect does not.
15822
15823 --no-sysroot-suffix
15824 For some targets, a suffix is added to the root directory specified
15825 with --sysroot, depending on the other options used, so that
15826 headers may for example be found in dir/suffix/usr/include instead
15827 of dir/usr/include. This option disables the addition of such a
15828 suffix.
15829
15830 Options for Code Generation Conventions
15831 These machine-independent options control the interface conventions
15832 used in code generation.
15833
15834 Most of them have both positive and negative forms; the negative form
15835 of -ffoo is -fno-foo. In the table below, only one of the forms is
15836 listed---the one that is not the default. You can figure out the other
15837 form by either removing no- or adding it.
15838
15839 -fstack-reuse=reuse-level
15840 This option controls stack space reuse for user declared local/auto
15841 variables and compiler generated temporaries. reuse_level can be
15842 all, named_vars, or none. all enables stack reuse for all local
15843 variables and temporaries, named_vars enables the reuse only for
15844 user defined local variables with names, and none disables stack
15845 reuse completely. The default value is all. The option is needed
15846 when the program extends the lifetime of a scoped local variable or
15847 a compiler generated temporary beyond the end point defined by the
15848 language. When a lifetime of a variable ends, and if the variable
15849 lives in memory, the optimizing compiler has the freedom to reuse
15850 its stack space with other temporaries or scoped local variables
15851 whose live range does not overlap with it. Legacy code extending
15852 local lifetime is likely to break with the stack reuse
15853 optimization.
15854
15855 For example,
15856
15857 int *p;
15858 {
15859 int local1;
15860
15861 p = &local1;
15862 local1 = 10;
15863 ....
15864 }
15865 {
15866 int local2;
15867 local2 = 20;
15868 ...
15869 }
15870
15871 if (*p == 10) // out of scope use of local1
15872 {
15873
15874 }
15875
15876 Another example:
15877
15878 struct A
15879 {
15880 A(int k) : i(k), j(k) { }
15881 int i;
15882 int j;
15883 };
15884
15885 A *ap;
15886
15887 void foo(const A& ar)
15888 {
15889 ap = &ar;
15890 }
15891
15892 void bar()
15893 {
15894 foo(A(10)); // temp object's lifetime ends when foo returns
15895
15896 {
15897 A a(20);
15898 ....
15899 }
15900 ap->i+= 10; // ap references out of scope temp whose space
15901 // is reused with a. What is the value of ap->i?
15902 }
15903
15904 The lifetime of a compiler generated temporary is well defined by
15905 the C++ standard. When a lifetime of a temporary ends, and if the
15906 temporary lives in memory, the optimizing compiler has the freedom
15907 to reuse its stack space with other temporaries or scoped local
15908 variables whose live range does not overlap with it. However some
15909 of the legacy code relies on the behavior of older compilers in
15910 which temporaries' stack space is not reused, the aggressive stack
15911 reuse can lead to runtime errors. This option is used to control
15912 the temporary stack reuse optimization.
15913
15914 -ftrapv
15915 This option generates traps for signed overflow on addition,
15916 subtraction, multiplication operations. The options -ftrapv and
15917 -fwrapv override each other, so using -ftrapv -fwrapv on the
15918 command-line results in -fwrapv being effective. Note that only
15919 active options override, so using -ftrapv -fwrapv -fno-wrapv on the
15920 command-line results in -ftrapv being effective.
15921
15922 -fwrapv
15923 This option instructs the compiler to assume that signed arithmetic
15924 overflow of addition, subtraction and multiplication wraps around
15925 using twos-complement representation. This flag enables some
15926 optimizations and disables others. The options -ftrapv and -fwrapv
15927 override each other, so using -ftrapv -fwrapv on the command-line
15928 results in -fwrapv being effective. Note that only active options
15929 override, so using -ftrapv -fwrapv -fno-wrapv on the command-line
15930 results in -ftrapv being effective.
15931
15932 -fwrapv-pointer
15933 This option instructs the compiler to assume that pointer
15934 arithmetic overflow on addition and subtraction wraps around using
15935 twos-complement representation. This flag disables some
15936 optimizations which assume pointer overflow is invalid.
15937
15938 -fstrict-overflow
15939 This option implies -fno-wrapv -fno-wrapv-pointer and when negated
15940 implies -fwrapv -fwrapv-pointer.
15941
15942 -fexceptions
15943 Enable exception handling. Generates extra code needed to
15944 propagate exceptions. For some targets, this implies GCC generates
15945 frame unwind information for all functions, which can produce
15946 significant data size overhead, although it does not affect
15947 execution. If you do not specify this option, GCC enables it by
15948 default for languages like C++ that normally require exception
15949 handling, and disables it for languages like C that do not normally
15950 require it. However, you may need to enable this option when
15951 compiling C code that needs to interoperate properly with exception
15952 handlers written in C++. You may also wish to disable this option
15953 if you are compiling older C++ programs that don't use exception
15954 handling.
15955
15956 -fnon-call-exceptions
15957 Generate code that allows trapping instructions to throw
15958 exceptions. Note that this requires platform-specific runtime
15959 support that does not exist everywhere. Moreover, it only allows
15960 trapping instructions to throw exceptions, i.e. memory references
15961 or floating-point instructions. It does not allow exceptions to be
15962 thrown from arbitrary signal handlers such as "SIGALRM". This
15963 enables -fexceptions.
15964
15965 -fdelete-dead-exceptions
15966 Consider that instructions that may throw exceptions but don't
15967 otherwise contribute to the execution of the program can be
15968 optimized away. This does not affect calls to functions except
15969 those with the "pure" or "const" attributes. This option is
15970 enabled by default for the Ada and C++ compilers, as permitted by
15971 the language specifications. Optimization passes that cause dead
15972 exceptions to be removed are enabled independently at different
15973 optimization levels.
15974
15975 -funwind-tables
15976 Similar to -fexceptions, except that it just generates any needed
15977 static data, but does not affect the generated code in any other
15978 way. You normally do not need to enable this option; instead, a
15979 language processor that needs this handling enables it on your
15980 behalf.
15981
15982 -fasynchronous-unwind-tables
15983 Generate unwind table in DWARF format, if supported by target
15984 machine. The table is exact at each instruction boundary, so it
15985 can be used for stack unwinding from asynchronous events (such as
15986 debugger or garbage collector).
15987
15988 -fno-gnu-unique
15989 On systems with recent GNU assembler and C library, the C++
15990 compiler uses the "STB_GNU_UNIQUE" binding to make sure that
15991 definitions of template static data members and static local
15992 variables in inline functions are unique even in the presence of
15993 "RTLD_LOCAL"; this is necessary to avoid problems with a library
15994 used by two different "RTLD_LOCAL" plugins depending on a
15995 definition in one of them and therefore disagreeing with the other
15996 one about the binding of the symbol. But this causes "dlclose" to
15997 be ignored for affected DSOs; if your program relies on
15998 reinitialization of a DSO via "dlclose" and "dlopen", you can use
15999 -fno-gnu-unique.
16000
16001 -fpcc-struct-return
16002 Return "short" "struct" and "union" values in memory like longer
16003 ones, rather than in registers. This convention is less efficient,
16004 but it has the advantage of allowing intercallability between GCC-
16005 compiled files and files compiled with other compilers,
16006 particularly the Portable C Compiler (pcc).
16007
16008 The precise convention for returning structures in memory depends
16009 on the target configuration macros.
16010
16011 Short structures and unions are those whose size and alignment
16012 match that of some integer type.
16013
16014 Warning: code compiled with the -fpcc-struct-return switch is not
16015 binary compatible with code compiled with the -freg-struct-return
16016 switch. Use it to conform to a non-default application binary
16017 interface.
16018
16019 -freg-struct-return
16020 Return "struct" and "union" values in registers when possible.
16021 This is more efficient for small structures than
16022 -fpcc-struct-return.
16023
16024 If you specify neither -fpcc-struct-return nor -freg-struct-return,
16025 GCC defaults to whichever convention is standard for the target.
16026 If there is no standard convention, GCC defaults to
16027 -fpcc-struct-return, except on targets where GCC is the principal
16028 compiler. In those cases, we can choose the standard, and we chose
16029 the more efficient register return alternative.
16030
16031 Warning: code compiled with the -freg-struct-return switch is not
16032 binary compatible with code compiled with the -fpcc-struct-return
16033 switch. Use it to conform to a non-default application binary
16034 interface.
16035
16036 -fshort-enums
16037 Allocate to an "enum" type only as many bytes as it needs for the
16038 declared range of possible values. Specifically, the "enum" type
16039 is equivalent to the smallest integer type that has enough room.
16040
16041 Warning: the -fshort-enums switch causes GCC to generate code that
16042 is not binary compatible with code generated without that switch.
16043 Use it to conform to a non-default application binary interface.
16044
16045 -fshort-wchar
16046 Override the underlying type for "wchar_t" to be "short unsigned
16047 int" instead of the default for the target. This option is useful
16048 for building programs to run under WINE.
16049
16050 Warning: the -fshort-wchar switch causes GCC to generate code that
16051 is not binary compatible with code generated without that switch.
16052 Use it to conform to a non-default application binary interface.
16053
16054 -fcommon
16055 In C code, this option controls the placement of global variables
16056 defined without an initializer, known as tentative definitions in
16057 the C standard. Tentative definitions are distinct from
16058 declarations of a variable with the "extern" keyword, which do not
16059 allocate storage.
16060
16061 The default is -fno-common, which specifies that the compiler
16062 places uninitialized global variables in the BSS section of the
16063 object file. This inhibits the merging of tentative definitions by
16064 the linker so you get a multiple-definition error if the same
16065 variable is accidentally defined in more than one compilation unit.
16066
16067 The -fcommon places uninitialized global variables in a common
16068 block. This allows the linker to resolve all tentative definitions
16069 of the same variable in different compilation units to the same
16070 object, or to a non-tentative definition. This behavior is
16071 inconsistent with C++, and on many targets implies a speed and code
16072 size penalty on global variable references. It is mainly useful to
16073 enable legacy code to link without errors.
16074
16075 -fno-ident
16076 Ignore the "#ident" directive.
16077
16078 -finhibit-size-directive
16079 Don't output a ".size" assembler directive, or anything else that
16080 would cause trouble if the function is split in the middle, and the
16081 two halves are placed at locations far apart in memory. This
16082 option is used when compiling crtstuff.c; you should not need to
16083 use it for anything else.
16084
16085 -fverbose-asm
16086 Put extra commentary information in the generated assembly code to
16087 make it more readable. This option is generally only of use to
16088 those who actually need to read the generated assembly code
16089 (perhaps while debugging the compiler itself).
16090
16091 -fno-verbose-asm, the default, causes the extra information to be
16092 omitted and is useful when comparing two assembler files.
16093
16094 The added comments include:
16095
16096 * information on the compiler version and command-line options,
16097
16098 * the source code lines associated with the assembly
16099 instructions, in the form FILENAME:LINENUMBER:CONTENT OF LINE,
16100
16101 * hints on which high-level expressions correspond to the various
16102 assembly instruction operands.
16103
16104 For example, given this C source file:
16105
16106 int test (int n)
16107 {
16108 int i;
16109 int total = 0;
16110
16111 for (i = 0; i < n; i++)
16112 total += i * i;
16113
16114 return total;
16115 }
16116
16117 compiling to (x86_64) assembly via -S and emitting the result
16118 direct to stdout via -o -
16119
16120 gcc -S test.c -fverbose-asm -Os -o -
16121
16122 gives output similar to this:
16123
16124 .file "test.c"
16125 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
16126 [...snip...]
16127 # options passed:
16128 [...snip...]
16129
16130 .text
16131 .globl test
16132 .type test, @function
16133 test:
16134 .LFB0:
16135 .cfi_startproc
16136 # test.c:4: int total = 0;
16137 xorl %eax, %eax # <retval>
16138 # test.c:6: for (i = 0; i < n; i++)
16139 xorl %edx, %edx # i
16140 .L2:
16141 # test.c:6: for (i = 0; i < n; i++)
16142 cmpl %edi, %edx # n, i
16143 jge .L5 #,
16144 # test.c:7: total += i * i;
16145 movl %edx, %ecx # i, tmp92
16146 imull %edx, %ecx # i, tmp92
16147 # test.c:6: for (i = 0; i < n; i++)
16148 incl %edx # i
16149 # test.c:7: total += i * i;
16150 addl %ecx, %eax # tmp92, <retval>
16151 jmp .L2 #
16152 .L5:
16153 # test.c:10: }
16154 ret
16155 .cfi_endproc
16156 .LFE0:
16157 .size test, .-test
16158 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
16159 .section .note.GNU-stack,"",@progbits
16160
16161 The comments are intended for humans rather than machines and hence
16162 the precise format of the comments is subject to change.
16163
16164 -frecord-gcc-switches
16165 This switch causes the command line used to invoke the compiler to
16166 be recorded into the object file that is being created. This
16167 switch is only implemented on some targets and the exact format of
16168 the recording is target and binary file format dependent, but it
16169 usually takes the form of a section containing ASCII text. This
16170 switch is related to the -fverbose-asm switch, but that switch only
16171 records information in the assembler output file as comments, so it
16172 never reaches the object file. See also -grecord-gcc-switches for
16173 another way of storing compiler options into the object file.
16174
16175 -fpic
16176 Generate position-independent code (PIC) suitable for use in a
16177 shared library, if supported for the target machine. Such code
16178 accesses all constant addresses through a global offset table
16179 (GOT). The dynamic loader resolves the GOT entries when the
16180 program starts (the dynamic loader is not part of GCC; it is part
16181 of the operating system). If the GOT size for the linked
16182 executable exceeds a machine-specific maximum size, you get an
16183 error message from the linker indicating that -fpic does not work;
16184 in that case, recompile with -fPIC instead. (These maximums are 8k
16185 on the SPARC, 28k on AArch64 and 32k on the m68k and RS/6000. The
16186 x86 has no such limit.)
16187
16188 Position-independent code requires special support, and therefore
16189 works only on certain machines. For the x86, GCC supports PIC for
16190 System V but not for the Sun 386i. Code generated for the IBM
16191 RS/6000 is always position-independent.
16192
16193 When this flag is set, the macros "__pic__" and "__PIC__" are
16194 defined to 1.
16195
16196 -fPIC
16197 If supported for the target machine, emit position-independent
16198 code, suitable for dynamic linking and avoiding any limit on the
16199 size of the global offset table. This option makes a difference on
16200 AArch64, m68k, PowerPC and SPARC.
16201
16202 Position-independent code requires special support, and therefore
16203 works only on certain machines.
16204
16205 When this flag is set, the macros "__pic__" and "__PIC__" are
16206 defined to 2.
16207
16208 -fpie
16209 -fPIE
16210 These options are similar to -fpic and -fPIC, but the generated
16211 position-independent code can be only linked into executables.
16212 Usually these options are used to compile code that will be linked
16213 using the -pie GCC option.
16214
16215 -fpie and -fPIE both define the macros "__pie__" and "__PIE__".
16216 The macros have the value 1 for -fpie and 2 for -fPIE.
16217
16218 -fno-plt
16219 Do not use the PLT for external function calls in position-
16220 independent code. Instead, load the callee address at call sites
16221 from the GOT and branch to it. This leads to more efficient code
16222 by eliminating PLT stubs and exposing GOT loads to optimizations.
16223 On architectures such as 32-bit x86 where PLT stubs expect the GOT
16224 pointer in a specific register, this gives more register allocation
16225 freedom to the compiler. Lazy binding requires use of the PLT;
16226 with -fno-plt all external symbols are resolved at load time.
16227
16228 Alternatively, the function attribute "noplt" can be used to avoid
16229 calls through the PLT for specific external functions.
16230
16231 In position-dependent code, a few targets also convert calls to
16232 functions that are marked to not use the PLT to use the GOT
16233 instead.
16234
16235 -fno-jump-tables
16236 Do not use jump tables for switch statements even where it would be
16237 more efficient than other code generation strategies. This option
16238 is of use in conjunction with -fpic or -fPIC for building code that
16239 forms part of a dynamic linker and cannot reference the address of
16240 a jump table. On some targets, jump tables do not require a GOT
16241 and this option is not needed.
16242
16243 -fno-bit-tests
16244 Do not use bit tests for switch statements even where it would be
16245 more efficient than other code generation strategies.
16246
16247 -ffixed-reg
16248 Treat the register named reg as a fixed register; generated code
16249 should never refer to it (except perhaps as a stack pointer, frame
16250 pointer or in some other fixed role).
16251
16252 reg must be the name of a register. The register names accepted
16253 are machine-specific and are defined in the "REGISTER_NAMES" macro
16254 in the machine description macro file.
16255
16256 This flag does not have a negative form, because it specifies a
16257 three-way choice.
16258
16259 -fcall-used-reg
16260 Treat the register named reg as an allocable register that is
16261 clobbered by function calls. It may be allocated for temporaries
16262 or variables that do not live across a call. Functions compiled
16263 this way do not save and restore the register reg.
16264
16265 It is an error to use this flag with the frame pointer or stack
16266 pointer. Use of this flag for other registers that have fixed
16267 pervasive roles in the machine's execution model produces
16268 disastrous results.
16269
16270 This flag does not have a negative form, because it specifies a
16271 three-way choice.
16272
16273 -fcall-saved-reg
16274 Treat the register named reg as an allocable register saved by
16275 functions. It may be allocated even for temporaries or variables
16276 that live across a call. Functions compiled this way save and
16277 restore the register reg if they use it.
16278
16279 It is an error to use this flag with the frame pointer or stack
16280 pointer. Use of this flag for other registers that have fixed
16281 pervasive roles in the machine's execution model produces
16282 disastrous results.
16283
16284 A different sort of disaster results from the use of this flag for
16285 a register in which function values may be returned.
16286
16287 This flag does not have a negative form, because it specifies a
16288 three-way choice.
16289
16290 -fpack-struct[=n]
16291 Without a value specified, pack all structure members together
16292 without holes. When a value is specified (which must be a small
16293 power of two), pack structure members according to this value,
16294 representing the maximum alignment (that is, objects with default
16295 alignment requirements larger than this are output potentially
16296 unaligned at the next fitting location.
16297
16298 Warning: the -fpack-struct switch causes GCC to generate code that
16299 is not binary compatible with code generated without that switch.
16300 Additionally, it makes the code suboptimal. Use it to conform to a
16301 non-default application binary interface.
16302
16303 -fleading-underscore
16304 This option and its counterpart, -fno-leading-underscore, forcibly
16305 change the way C symbols are represented in the object file. One
16306 use is to help link with legacy assembly code.
16307
16308 Warning: the -fleading-underscore switch causes GCC to generate
16309 code that is not binary compatible with code generated without that
16310 switch. Use it to conform to a non-default application binary
16311 interface. Not all targets provide complete support for this
16312 switch.
16313
16314 -ftls-model=model
16315 Alter the thread-local storage model to be used. The model
16316 argument should be one of global-dynamic, local-dynamic, initial-
16317 exec or local-exec. Note that the choice is subject to
16318 optimization: the compiler may use a more efficient model for
16319 symbols not visible outside of the translation unit, or if -fpic is
16320 not given on the command line.
16321
16322 The default without -fpic is initial-exec; with -fpic the default
16323 is global-dynamic.
16324
16325 -ftrampolines
16326 For targets that normally need trampolines for nested functions,
16327 always generate them instead of using descriptors. Otherwise, for
16328 targets that do not need them, like for example HP-PA or IA-64, do
16329 nothing.
16330
16331 A trampoline is a small piece of code that is created at run time
16332 on the stack when the address of a nested function is taken, and is
16333 used to call the nested function indirectly. Therefore, it
16334 requires the stack to be made executable in order for the program
16335 to work properly.
16336
16337 -fno-trampolines is enabled by default on a language by language
16338 basis to let the compiler avoid generating them, if it computes
16339 that this is safe, and replace them with descriptors. Descriptors
16340 are made up of data only, but the generated code must be prepared
16341 to deal with them. As of this writing, -fno-trampolines is enabled
16342 by default only for Ada.
16343
16344 Moreover, code compiled with -ftrampolines and code compiled with
16345 -fno-trampolines are not binary compatible if nested functions are
16346 present. This option must therefore be used on a program-wide
16347 basis and be manipulated with extreme care.
16348
16349 For languages other than Ada, the "-ftrampolines" and
16350 "-fno-trampolines" options currently have no effect, and
16351 trampolines are always generated on platforms that need them for
16352 nested functions.
16353
16354 -fvisibility=[default|internal|hidden|protected]
16355 Set the default ELF image symbol visibility to the specified
16356 option---all symbols are marked with this unless overridden within
16357 the code. Using this feature can very substantially improve
16358 linking and load times of shared object libraries, produce more
16359 optimized code, provide near-perfect API export and prevent symbol
16360 clashes. It is strongly recommended that you use this in any
16361 shared objects you distribute.
16362
16363 Despite the nomenclature, default always means public; i.e.,
16364 available to be linked against from outside the shared object.
16365 protected and internal are pretty useless in real-world usage so
16366 the only other commonly used option is hidden. The default if
16367 -fvisibility isn't specified is default, i.e., make every symbol
16368 public.
16369
16370 A good explanation of the benefits offered by ensuring ELF symbols
16371 have the correct visibility is given by "How To Write Shared
16372 Libraries" by Ulrich Drepper (which can be found at
16373 <https://www.akkadia.org/drepper/>)---however a superior solution
16374 made possible by this option to marking things hidden when the
16375 default is public is to make the default hidden and mark things
16376 public. This is the norm with DLLs on Windows and with
16377 -fvisibility=hidden and "__attribute__ ((visibility("default")))"
16378 instead of "__declspec(dllexport)" you get almost identical
16379 semantics with identical syntax. This is a great boon to those
16380 working with cross-platform projects.
16381
16382 For those adding visibility support to existing code, you may find
16383 "#pragma GCC visibility" of use. This works by you enclosing the
16384 declarations you wish to set visibility for with (for example)
16385 "#pragma GCC visibility push(hidden)" and "#pragma GCC visibility
16386 pop". Bear in mind that symbol visibility should be viewed as part
16387 of the API interface contract and thus all new code should always
16388 specify visibility when it is not the default; i.e., declarations
16389 only for use within the local DSO should always be marked
16390 explicitly as hidden as so to avoid PLT indirection
16391 overheads---making this abundantly clear also aids readability and
16392 self-documentation of the code. Note that due to ISO C++
16393 specification requirements, "operator new" and "operator delete"
16394 must always be of default visibility.
16395
16396 Be aware that headers from outside your project, in particular
16397 system headers and headers from any other library you use, may not
16398 be expecting to be compiled with visibility other than the default.
16399 You may need to explicitly say "#pragma GCC visibility
16400 push(default)" before including any such headers.
16401
16402 "extern" declarations are not affected by -fvisibility, so a lot of
16403 code can be recompiled with -fvisibility=hidden with no
16404 modifications. However, this means that calls to "extern"
16405 functions with no explicit visibility use the PLT, so it is more
16406 effective to use "__attribute ((visibility))" and/or "#pragma GCC
16407 visibility" to tell the compiler which "extern" declarations should
16408 be treated as hidden.
16409
16410 Note that -fvisibility does affect C++ vague linkage entities. This
16411 means that, for instance, an exception class that is be thrown
16412 between DSOs must be explicitly marked with default visibility so
16413 that the type_info nodes are unified between the DSOs.
16414
16415 An overview of these techniques, their benefits and how to use them
16416 is at <https://gcc.gnu.org/wiki/Visibility>.
16417
16418 -fstrict-volatile-bitfields
16419 This option should be used if accesses to volatile bit-fields (or
16420 other structure fields, although the compiler usually honors those
16421 types anyway) should use a single access of the width of the
16422 field's type, aligned to a natural alignment if possible. For
16423 example, targets with memory-mapped peripheral registers might
16424 require all such accesses to be 16 bits wide; with this flag you
16425 can declare all peripheral bit-fields as "unsigned short" (assuming
16426 short is 16 bits on these targets) to force GCC to use 16-bit
16427 accesses instead of, perhaps, a more efficient 32-bit access.
16428
16429 If this option is disabled, the compiler uses the most efficient
16430 instruction. In the previous example, that might be a 32-bit load
16431 instruction, even though that accesses bytes that do not contain
16432 any portion of the bit-field, or memory-mapped registers unrelated
16433 to the one being updated.
16434
16435 In some cases, such as when the "packed" attribute is applied to a
16436 structure field, it may not be possible to access the field with a
16437 single read or write that is correctly aligned for the target
16438 machine. In this case GCC falls back to generating multiple
16439 accesses rather than code that will fault or truncate the result at
16440 run time.
16441
16442 Note: Due to restrictions of the C/C++11 memory model, write
16443 accesses are not allowed to touch non bit-field members. It is
16444 therefore recommended to define all bits of the field's type as
16445 bit-field members.
16446
16447 The default value of this option is determined by the application
16448 binary interface for the target processor.
16449
16450 -fsync-libcalls
16451 This option controls whether any out-of-line instance of the
16452 "__sync" family of functions may be used to implement the C++11
16453 "__atomic" family of functions.
16454
16455 The default value of this option is enabled, thus the only useful
16456 form of the option is -fno-sync-libcalls. This option is used in
16457 the implementation of the libatomic runtime library.
16458
16459 GCC Developer Options
16460 This section describes command-line options that are primarily of
16461 interest to GCC developers, including options to support compiler
16462 testing and investigation of compiler bugs and compile-time performance
16463 problems. This includes options that produce debug dumps at various
16464 points in the compilation; that print statistics such as memory use and
16465 execution time; and that print information about GCC's configuration,
16466 such as where it searches for libraries. You should rarely need to use
16467 any of these options for ordinary compilation and linking tasks.
16468
16469 Many developer options that cause GCC to dump output to a file take an
16470 optional =filename suffix. You can specify stdout or - to dump to
16471 standard output, and stderr for standard error.
16472
16473 If =filename is omitted, a default dump file name is constructed by
16474 concatenating the base dump file name, a pass number, phase letter, and
16475 pass name. The base dump file name is the name of output file produced
16476 by the compiler if explicitly specified and not an executable;
16477 otherwise it is the source file name. The pass number is determined by
16478 the order passes are registered with the compiler's pass manager. This
16479 is generally the same as the order of execution, but passes registered
16480 by plugins, target-specific passes, or passes that are otherwise
16481 registered late are numbered higher than the pass named final, even if
16482 they are executed earlier. The phase letter is one of i (inter-
16483 procedural analysis), l (language-specific), r (RTL), or t (tree). The
16484 files are created in the directory of the output file.
16485
16486 -fcallgraph-info
16487 -fcallgraph-info=MARKERS
16488 Makes the compiler output callgraph information for the program, on
16489 a per-object-file basis. The information is generated in the
16490 common VCG format. It can be decorated with additional, per-node
16491 and/or per-edge information, if a list of comma-separated markers
16492 is additionally specified. When the "su" marker is specified, the
16493 callgraph is decorated with stack usage information; it is
16494 equivalent to -fstack-usage. When the "da" marker is specified,
16495 the callgraph is decorated with information about dynamically
16496 allocated objects.
16497
16498 When compiling with -flto, no callgraph information is output along
16499 with the object file. At LTO link time, -fcallgraph-info may
16500 generate multiple callgraph information files next to intermediate
16501 LTO output files.
16502
16503 -dletters
16504 -fdump-rtl-pass
16505 -fdump-rtl-pass=filename
16506 Says to make debugging dumps during compilation at times specified
16507 by letters. This is used for debugging the RTL-based passes of the
16508 compiler.
16509
16510 Some -dletters switches have different meaning when -E is used for
16511 preprocessing.
16512
16513 Debug dumps can be enabled with a -fdump-rtl switch or some -d
16514 option letters. Here are the possible letters for use in pass and
16515 letters, and their meanings:
16516
16517 -fdump-rtl-alignments
16518 Dump after branch alignments have been computed.
16519
16520 -fdump-rtl-asmcons
16521 Dump after fixing rtl statements that have unsatisfied in/out
16522 constraints.
16523
16524 -fdump-rtl-auto_inc_dec
16525 Dump after auto-inc-dec discovery. This pass is only run on
16526 architectures that have auto inc or auto dec instructions.
16527
16528 -fdump-rtl-barriers
16529 Dump after cleaning up the barrier instructions.
16530
16531 -fdump-rtl-bbpart
16532 Dump after partitioning hot and cold basic blocks.
16533
16534 -fdump-rtl-bbro
16535 Dump after block reordering.
16536
16537 -fdump-rtl-btl1
16538 -fdump-rtl-btl2
16539 -fdump-rtl-btl1 and -fdump-rtl-btl2 enable dumping after the
16540 two branch target load optimization passes.
16541
16542 -fdump-rtl-bypass
16543 Dump after jump bypassing and control flow optimizations.
16544
16545 -fdump-rtl-combine
16546 Dump after the RTL instruction combination pass.
16547
16548 -fdump-rtl-compgotos
16549 Dump after duplicating the computed gotos.
16550
16551 -fdump-rtl-ce1
16552 -fdump-rtl-ce2
16553 -fdump-rtl-ce3
16554 -fdump-rtl-ce1, -fdump-rtl-ce2, and -fdump-rtl-ce3 enable
16555 dumping after the three if conversion passes.
16556
16557 -fdump-rtl-cprop_hardreg
16558 Dump after hard register copy propagation.
16559
16560 -fdump-rtl-csa
16561 Dump after combining stack adjustments.
16562
16563 -fdump-rtl-cse1
16564 -fdump-rtl-cse2
16565 -fdump-rtl-cse1 and -fdump-rtl-cse2 enable dumping after the
16566 two common subexpression elimination passes.
16567
16568 -fdump-rtl-dce
16569 Dump after the standalone dead code elimination passes.
16570
16571 -fdump-rtl-dbr
16572 Dump after delayed branch scheduling.
16573
16574 -fdump-rtl-dce1
16575 -fdump-rtl-dce2
16576 -fdump-rtl-dce1 and -fdump-rtl-dce2 enable dumping after the
16577 two dead store elimination passes.
16578
16579 -fdump-rtl-eh
16580 Dump after finalization of EH handling code.
16581
16582 -fdump-rtl-eh_ranges
16583 Dump after conversion of EH handling range regions.
16584
16585 -fdump-rtl-expand
16586 Dump after RTL generation.
16587
16588 -fdump-rtl-fwprop1
16589 -fdump-rtl-fwprop2
16590 -fdump-rtl-fwprop1 and -fdump-rtl-fwprop2 enable dumping after
16591 the two forward propagation passes.
16592
16593 -fdump-rtl-gcse1
16594 -fdump-rtl-gcse2
16595 -fdump-rtl-gcse1 and -fdump-rtl-gcse2 enable dumping after
16596 global common subexpression elimination.
16597
16598 -fdump-rtl-init-regs
16599 Dump after the initialization of the registers.
16600
16601 -fdump-rtl-initvals
16602 Dump after the computation of the initial value sets.
16603
16604 -fdump-rtl-into_cfglayout
16605 Dump after converting to cfglayout mode.
16606
16607 -fdump-rtl-ira
16608 Dump after iterated register allocation.
16609
16610 -fdump-rtl-jump
16611 Dump after the second jump optimization.
16612
16613 -fdump-rtl-loop2
16614 -fdump-rtl-loop2 enables dumping after the rtl loop
16615 optimization passes.
16616
16617 -fdump-rtl-mach
16618 Dump after performing the machine dependent reorganization
16619 pass, if that pass exists.
16620
16621 -fdump-rtl-mode_sw
16622 Dump after removing redundant mode switches.
16623
16624 -fdump-rtl-rnreg
16625 Dump after register renumbering.
16626
16627 -fdump-rtl-outof_cfglayout
16628 Dump after converting from cfglayout mode.
16629
16630 -fdump-rtl-peephole2
16631 Dump after the peephole pass.
16632
16633 -fdump-rtl-postreload
16634 Dump after post-reload optimizations.
16635
16636 -fdump-rtl-pro_and_epilogue
16637 Dump after generating the function prologues and epilogues.
16638
16639 -fdump-rtl-sched1
16640 -fdump-rtl-sched2
16641 -fdump-rtl-sched1 and -fdump-rtl-sched2 enable dumping after
16642 the basic block scheduling passes.
16643
16644 -fdump-rtl-ree
16645 Dump after sign/zero extension elimination.
16646
16647 -fdump-rtl-seqabstr
16648 Dump after common sequence discovery.
16649
16650 -fdump-rtl-shorten
16651 Dump after shortening branches.
16652
16653 -fdump-rtl-sibling
16654 Dump after sibling call optimizations.
16655
16656 -fdump-rtl-split1
16657 -fdump-rtl-split2
16658 -fdump-rtl-split3
16659 -fdump-rtl-split4
16660 -fdump-rtl-split5
16661 These options enable dumping after five rounds of instruction
16662 splitting.
16663
16664 -fdump-rtl-sms
16665 Dump after modulo scheduling. This pass is only run on some
16666 architectures.
16667
16668 -fdump-rtl-stack
16669 Dump after conversion from GCC's "flat register file" registers
16670 to the x87's stack-like registers. This pass is only run on
16671 x86 variants.
16672
16673 -fdump-rtl-subreg1
16674 -fdump-rtl-subreg2
16675 -fdump-rtl-subreg1 and -fdump-rtl-subreg2 enable dumping after
16676 the two subreg expansion passes.
16677
16678 -fdump-rtl-unshare
16679 Dump after all rtl has been unshared.
16680
16681 -fdump-rtl-vartrack
16682 Dump after variable tracking.
16683
16684 -fdump-rtl-vregs
16685 Dump after converting virtual registers to hard registers.
16686
16687 -fdump-rtl-web
16688 Dump after live range splitting.
16689
16690 -fdump-rtl-regclass
16691 -fdump-rtl-subregs_of_mode_init
16692 -fdump-rtl-subregs_of_mode_finish
16693 -fdump-rtl-dfinit
16694 -fdump-rtl-dfinish
16695 These dumps are defined but always produce empty files.
16696
16697 -da
16698 -fdump-rtl-all
16699 Produce all the dumps listed above.
16700
16701 -dA Annotate the assembler output with miscellaneous debugging
16702 information.
16703
16704 -dD Dump all macro definitions, at the end of preprocessing, in
16705 addition to normal output.
16706
16707 -dH Produce a core dump whenever an error occurs.
16708
16709 -dp Annotate the assembler output with a comment indicating which
16710 pattern and alternative is used. The length and cost of each
16711 instruction are also printed.
16712
16713 -dP Dump the RTL in the assembler output as a comment before each
16714 instruction. Also turns on -dp annotation.
16715
16716 -dx Just generate RTL for a function instead of compiling it.
16717 Usually used with -fdump-rtl-expand.
16718
16719 -fdump-debug
16720 Dump debugging information generated during the debug generation
16721 phase.
16722
16723 -fdump-earlydebug
16724 Dump debugging information generated during the early debug
16725 generation phase.
16726
16727 -fdump-noaddr
16728 When doing debugging dumps, suppress address output. This makes it
16729 more feasible to use diff on debugging dumps for compiler
16730 invocations with different compiler binaries and/or different text
16731 / bss / data / heap / stack / dso start locations.
16732
16733 -freport-bug
16734 Collect and dump debug information into a temporary file if an
16735 internal compiler error (ICE) occurs.
16736
16737 -fdump-unnumbered
16738 When doing debugging dumps, suppress instruction numbers and
16739 address output. This makes it more feasible to use diff on
16740 debugging dumps for compiler invocations with different options, in
16741 particular with and without -g.
16742
16743 -fdump-unnumbered-links
16744 When doing debugging dumps (see -d option above), suppress
16745 instruction numbers for the links to the previous and next
16746 instructions in a sequence.
16747
16748 -fdump-ipa-switch
16749 -fdump-ipa-switch-options
16750 Control the dumping at various stages of inter-procedural analysis
16751 language tree to a file. The file name is generated by appending a
16752 switch specific suffix to the source file name, and the file is
16753 created in the same directory as the output file. The following
16754 dumps are possible:
16755
16756 all Enables all inter-procedural analysis dumps.
16757
16758 cgraph
16759 Dumps information about call-graph optimization, unused
16760 function removal, and inlining decisions.
16761
16762 inline
16763 Dump after function inlining.
16764
16765 Additionally, the options -optimized, -missed, -note, and -all can
16766 be provided, with the same meaning as for -fopt-info, defaulting to
16767 -optimized.
16768
16769 For example, -fdump-ipa-inline-optimized-missed will emit
16770 information on callsites that were inlined, along with callsites
16771 that were not inlined.
16772
16773 By default, the dump will contain messages about successful
16774 optimizations (equivalent to -optimized) together with low-level
16775 details about the analysis.
16776
16777 -fdump-lang
16778 Dump language-specific information. The file name is made by
16779 appending .lang to the source file name.
16780
16781 -fdump-lang-all
16782 -fdump-lang-switch
16783 -fdump-lang-switch-options
16784 -fdump-lang-switch-options=filename
16785 Control the dumping of language-specific information. The options
16786 and filename portions behave as described in the -fdump-tree
16787 option. The following switch values are accepted:
16788
16789 all Enable all language-specific dumps.
16790
16791 class
16792 Dump class hierarchy information. Virtual table information is
16793 emitted unless 'slim' is specified. This option is applicable
16794 to C++ only.
16795
16796 module
16797 Dump module information. Options lineno (locations), graph
16798 (reachability), blocks (clusters), uid (serialization), alias
16799 (mergeable), asmname (Elrond), eh (mapper) & vops (macros) may
16800 provide additional information. This option is applicable to
16801 C++ only.
16802
16803 raw Dump the raw internal tree data. This option is applicable to
16804 C++ only.
16805
16806 -fdump-passes
16807 Print on stderr the list of optimization passes that are turned on
16808 and off by the current command-line options.
16809
16810 -fdump-statistics-option
16811 Enable and control dumping of pass statistics in a separate file.
16812 The file name is generated by appending a suffix ending in
16813 .statistics to the source file name, and the file is created in the
16814 same directory as the output file. If the -option form is used,
16815 -stats causes counters to be summed over the whole compilation unit
16816 while -details dumps every event as the passes generate them. The
16817 default with no option is to sum counters for each function
16818 compiled.
16819
16820 -fdump-tree-all
16821 -fdump-tree-switch
16822 -fdump-tree-switch-options
16823 -fdump-tree-switch-options=filename
16824 Control the dumping at various stages of processing the
16825 intermediate language tree to a file. If the -options form is
16826 used, options is a list of - separated options which control the
16827 details of the dump. Not all options are applicable to all dumps;
16828 those that are not meaningful are ignored. The following options
16829 are available
16830
16831 address
16832 Print the address of each node. Usually this is not meaningful
16833 as it changes according to the environment and source file.
16834 Its primary use is for tying up a dump file with a debug
16835 environment.
16836
16837 asmname
16838 If "DECL_ASSEMBLER_NAME" has been set for a given decl, use
16839 that in the dump instead of "DECL_NAME". Its primary use is
16840 ease of use working backward from mangled names in the assembly
16841 file.
16842
16843 slim
16844 When dumping front-end intermediate representations, inhibit
16845 dumping of members of a scope or body of a function merely
16846 because that scope has been reached. Only dump such items when
16847 they are directly reachable by some other path.
16848
16849 When dumping pretty-printed trees, this option inhibits dumping
16850 the bodies of control structures.
16851
16852 When dumping RTL, print the RTL in slim (condensed) form
16853 instead of the default LISP-like representation.
16854
16855 raw Print a raw representation of the tree. By default, trees are
16856 pretty-printed into a C-like representation.
16857
16858 details
16859 Enable more detailed dumps (not honored by every dump option).
16860 Also include information from the optimization passes.
16861
16862 stats
16863 Enable dumping various statistics about the pass (not honored
16864 by every dump option).
16865
16866 blocks
16867 Enable showing basic block boundaries (disabled in raw dumps).
16868
16869 graph
16870 For each of the other indicated dump files (-fdump-rtl-pass),
16871 dump a representation of the control flow graph suitable for
16872 viewing with GraphViz to file.passid.pass.dot. Each function
16873 in the file is pretty-printed as a subgraph, so that GraphViz
16874 can render them all in a single plot.
16875
16876 This option currently only works for RTL dumps, and the RTL is
16877 always dumped in slim form.
16878
16879 vops
16880 Enable showing virtual operands for every statement.
16881
16882 lineno
16883 Enable showing line numbers for statements.
16884
16885 uid Enable showing the unique ID ("DECL_UID") for each variable.
16886
16887 verbose
16888 Enable showing the tree dump for each statement.
16889
16890 eh Enable showing the EH region number holding each statement.
16891
16892 scev
16893 Enable showing scalar evolution analysis details.
16894
16895 optimized
16896 Enable showing optimization information (only available in
16897 certain passes).
16898
16899 missed
16900 Enable showing missed optimization information (only available
16901 in certain passes).
16902
16903 note
16904 Enable other detailed optimization information (only available
16905 in certain passes).
16906
16907 all Turn on all options, except raw, slim, verbose and lineno.
16908
16909 optall
16910 Turn on all optimization options, i.e., optimized, missed, and
16911 note.
16912
16913 To determine what tree dumps are available or find the dump for a
16914 pass of interest follow the steps below.
16915
16916 1. Invoke GCC with -fdump-passes and in the stderr output look for
16917 a code that corresponds to the pass you are interested in. For
16918 example, the codes "tree-evrp", "tree-vrp1", and "tree-vrp2"
16919 correspond to the three Value Range Propagation passes. The
16920 number at the end distinguishes distinct invocations of the
16921 same pass.
16922
16923 2. To enable the creation of the dump file, append the pass code
16924 to the -fdump- option prefix and invoke GCC with it. For
16925 example, to enable the dump from the Early Value Range
16926 Propagation pass, invoke GCC with the -fdump-tree-evrp option.
16927 Optionally, you may specify the name of the dump file. If you
16928 don't specify one, GCC creates as described below.
16929
16930 3. Find the pass dump in a file whose name is composed of three
16931 components separated by a period: the name of the source file
16932 GCC was invoked to compile, a numeric suffix indicating the
16933 pass number followed by the letter t for tree passes (and the
16934 letter r for RTL passes), and finally the pass code. For
16935 example, the Early VRP pass dump might be in a file named
16936 myfile.c.038t.evrp in the current working directory. Note that
16937 the numeric codes are not stable and may change from one
16938 version of GCC to another.
16939
16940 -fopt-info
16941 -fopt-info-options
16942 -fopt-info-options=filename
16943 Controls optimization dumps from various optimization passes. If
16944 the -options form is used, options is a list of - separated option
16945 keywords to select the dump details and optimizations.
16946
16947 The options can be divided into three groups:
16948
16949 1. options describing what kinds of messages should be emitted,
16950
16951 2. options describing the verbosity of the dump, and
16952
16953 3. options describing which optimizations should be included.
16954
16955 The options from each group can be freely mixed as they are non-
16956 overlapping. However, in case of any conflicts, the later options
16957 override the earlier options on the command line.
16958
16959 The following options control which kinds of messages should be
16960 emitted:
16961
16962 optimized
16963 Print information when an optimization is successfully applied.
16964 It is up to a pass to decide which information is relevant. For
16965 example, the vectorizer passes print the source location of
16966 loops which are successfully vectorized.
16967
16968 missed
16969 Print information about missed optimizations. Individual passes
16970 control which information to include in the output.
16971
16972 note
16973 Print verbose information about optimizations, such as certain
16974 transformations, more detailed messages about decisions etc.
16975
16976 all Print detailed optimization information. This includes
16977 optimized, missed, and note.
16978
16979 The following option controls the dump verbosity:
16980
16981 internals
16982 By default, only "high-level" messages are emitted. This option
16983 enables additional, more detailed, messages, which are likely
16984 to only be of interest to GCC developers.
16985
16986 One or more of the following option keywords can be used to
16987 describe a group of optimizations:
16988
16989 ipa Enable dumps from all interprocedural optimizations.
16990
16991 loop
16992 Enable dumps from all loop optimizations.
16993
16994 inline
16995 Enable dumps from all inlining optimizations.
16996
16997 omp Enable dumps from all OMP (Offloading and Multi Processing)
16998 optimizations.
16999
17000 vec Enable dumps from all vectorization optimizations.
17001
17002 optall
17003 Enable dumps from all optimizations. This is a superset of the
17004 optimization groups listed above.
17005
17006 If options is omitted, it defaults to optimized-optall, which means
17007 to dump messages about successful optimizations from all the
17008 passes, omitting messages that are treated as "internals".
17009
17010 If the filename is provided, then the dumps from all the applicable
17011 optimizations are concatenated into the filename. Otherwise the
17012 dump is output onto stderr. Though multiple -fopt-info options are
17013 accepted, only one of them can include a filename. If other
17014 filenames are provided then all but the first such option are
17015 ignored.
17016
17017 Note that the output filename is overwritten in case of multiple
17018 translation units. If a combined output from multiple translation
17019 units is desired, stderr should be used instead.
17020
17021 In the following example, the optimization info is output to
17022 stderr:
17023
17024 gcc -O3 -fopt-info
17025
17026 This example:
17027
17028 gcc -O3 -fopt-info-missed=missed.all
17029
17030 outputs missed optimization report from all the passes into
17031 missed.all, and this one:
17032
17033 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
17034
17035 prints information about missed optimization opportunities from
17036 vectorization passes on stderr. Note that -fopt-info-vec-missed is
17037 equivalent to -fopt-info-missed-vec. The order of the optimization
17038 group names and message types listed after -fopt-info does not
17039 matter.
17040
17041 As another example,
17042
17043 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
17044
17045 outputs information about missed optimizations as well as optimized
17046 locations from all the inlining passes into inline.txt.
17047
17048 Finally, consider:
17049
17050 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
17051
17052 Here the two output filenames vec.miss and loop.opt are in conflict
17053 since only one output file is allowed. In this case, only the first
17054 option takes effect and the subsequent options are ignored. Thus
17055 only vec.miss is produced which contains dumps from the vectorizer
17056 about missed opportunities.
17057
17058 -fsave-optimization-record
17059 Write a SRCFILE.opt-record.json.gz file detailing what
17060 optimizations were performed, for those optimizations that support
17061 -fopt-info.
17062
17063 This option is experimental and the format of the data within the
17064 compressed JSON file is subject to change.
17065
17066 It is roughly equivalent to a machine-readable version of
17067 -fopt-info-all, as a collection of messages with source file, line
17068 number and column number, with the following additional data for
17069 each message:
17070
17071 * the execution count of the code being optimized, along with
17072 metadata about whether this was from actual profile data, or
17073 just an estimate, allowing consumers to prioritize messages by
17074 code hotness,
17075
17076 * the function name of the code being optimized, where
17077 applicable,
17078
17079 * the "inlining chain" for the code being optimized, so that when
17080 a function is inlined into several different places (which
17081 might themselves be inlined), the reader can distinguish
17082 between the copies,
17083
17084 * objects identifying those parts of the message that refer to
17085 expressions, statements or symbol-table nodes, which of these
17086 categories they are, and, when available, their source code
17087 location,
17088
17089 * the GCC pass that emitted the message, and
17090
17091 * the location in GCC's own code from which the message was
17092 emitted
17093
17094 Additionally, some messages are logically nested within other
17095 messages, reflecting implementation details of the optimization
17096 passes.
17097
17098 -fsched-verbose=n
17099 On targets that use instruction scheduling, this option controls
17100 the amount of debugging output the scheduler prints to the dump
17101 files.
17102
17103 For n greater than zero, -fsched-verbose outputs the same
17104 information as -fdump-rtl-sched1 and -fdump-rtl-sched2. For n
17105 greater than one, it also output basic block probabilities,
17106 detailed ready list information and unit/insn info. For n greater
17107 than two, it includes RTL at abort point, control-flow and regions
17108 info. And for n over four, -fsched-verbose also includes
17109 dependence info.
17110
17111 -fenable-kind-pass
17112 -fdisable-kind-pass=range-list
17113 This is a set of options that are used to explicitly disable/enable
17114 optimization passes. These options are intended for use for
17115 debugging GCC. Compiler users should use regular options for
17116 enabling/disabling passes instead.
17117
17118 -fdisable-ipa-pass
17119 Disable IPA pass pass. pass is the pass name. If the same pass
17120 is statically invoked in the compiler multiple times, the pass
17121 name should be appended with a sequential number starting from
17122 1.
17123
17124 -fdisable-rtl-pass
17125 -fdisable-rtl-pass=range-list
17126 Disable RTL pass pass. pass is the pass name. If the same
17127 pass is statically invoked in the compiler multiple times, the
17128 pass name should be appended with a sequential number starting
17129 from 1. range-list is a comma-separated list of function
17130 ranges or assembler names. Each range is a number pair
17131 separated by a colon. The range is inclusive in both ends. If
17132 the range is trivial, the number pair can be simplified as a
17133 single number. If the function's call graph node's uid falls
17134 within one of the specified ranges, the pass is disabled for
17135 that function. The uid is shown in the function header of a
17136 dump file, and the pass names can be dumped by using option
17137 -fdump-passes.
17138
17139 -fdisable-tree-pass
17140 -fdisable-tree-pass=range-list
17141 Disable tree pass pass. See -fdisable-rtl for the description
17142 of option arguments.
17143
17144 -fenable-ipa-pass
17145 Enable IPA pass pass. pass is the pass name. If the same pass
17146 is statically invoked in the compiler multiple times, the pass
17147 name should be appended with a sequential number starting from
17148 1.
17149
17150 -fenable-rtl-pass
17151 -fenable-rtl-pass=range-list
17152 Enable RTL pass pass. See -fdisable-rtl for option argument
17153 description and examples.
17154
17155 -fenable-tree-pass
17156 -fenable-tree-pass=range-list
17157 Enable tree pass pass. See -fdisable-rtl for the description
17158 of option arguments.
17159
17160 Here are some examples showing uses of these options.
17161
17162 # disable ccp1 for all functions
17163 -fdisable-tree-ccp1
17164 # disable complete unroll for function whose cgraph node uid is 1
17165 -fenable-tree-cunroll=1
17166 # disable gcse2 for functions at the following ranges [1,1],
17167 # [300,400], and [400,1000]
17168 # disable gcse2 for functions foo and foo2
17169 -fdisable-rtl-gcse2=foo,foo2
17170 # disable early inlining
17171 -fdisable-tree-einline
17172 # disable ipa inlining
17173 -fdisable-ipa-inline
17174 # enable tree full unroll
17175 -fenable-tree-unroll
17176
17177 -fchecking
17178 -fchecking=n
17179 Enable internal consistency checking. The default depends on the
17180 compiler configuration. -fchecking=2 enables further internal
17181 consistency checking that might affect code generation.
17182
17183 -frandom-seed=string
17184 This option provides a seed that GCC uses in place of random
17185 numbers in generating certain symbol names that have to be
17186 different in every compiled file. It is also used to place unique
17187 stamps in coverage data files and the object files that produce
17188 them. You can use the -frandom-seed option to produce reproducibly
17189 identical object files.
17190
17191 The string can either be a number (decimal, octal or hex) or an
17192 arbitrary string (in which case it's converted to a number by
17193 computing CRC32).
17194
17195 The string should be different for every file you compile.
17196
17197 -save-temps
17198 Store the usual "temporary" intermediate files permanently; name
17199 them as auxiliary output files, as specified described under
17200 -dumpbase and -dumpdir.
17201
17202 When used in combination with the -x command-line option,
17203 -save-temps is sensible enough to avoid overwriting an input source
17204 file with the same extension as an intermediate file. The
17205 corresponding intermediate file may be obtained by renaming the
17206 source file before using -save-temps.
17207
17208 -save-temps=cwd
17209 Equivalent to -save-temps -dumpdir ./.
17210
17211 -save-temps=obj
17212 Equivalent to -save-temps -dumpdir outdir/, where outdir/ is the
17213 directory of the output file specified after the -o option,
17214 including any directory separators. If the -o option is not used,
17215 the -save-temps=obj switch behaves like -save-temps=cwd.
17216
17217 -time[=file]
17218 Report the CPU time taken by each subprocess in the compilation
17219 sequence. For C source files, this is the compiler proper and
17220 assembler (plus the linker if linking is done).
17221
17222 Without the specification of an output file, the output looks like
17223 this:
17224
17225 # cc1 0.12 0.01
17226 # as 0.00 0.01
17227
17228 The first number on each line is the "user time", that is time
17229 spent executing the program itself. The second number is "system
17230 time", time spent executing operating system routines on behalf of
17231 the program. Both numbers are in seconds.
17232
17233 With the specification of an output file, the output is appended to
17234 the named file, and it looks like this:
17235
17236 0.12 0.01 cc1 <options>
17237 0.00 0.01 as <options>
17238
17239 The "user time" and the "system time" are moved before the program
17240 name, and the options passed to the program are displayed, so that
17241 one can later tell what file was being compiled, and with which
17242 options.
17243
17244 -fdump-final-insns[=file]
17245 Dump the final internal representation (RTL) to file. If the
17246 optional argument is omitted (or if file is "."), the name of the
17247 dump file is determined by appending ".gkd" to the dump base name,
17248 see -dumpbase.
17249
17250 -fcompare-debug[=opts]
17251 If no error occurs during compilation, run the compiler a second
17252 time, adding opts and -fcompare-debug-second to the arguments
17253 passed to the second compilation. Dump the final internal
17254 representation in both compilations, and print an error if they
17255 differ.
17256
17257 If the equal sign is omitted, the default -gtoggle is used.
17258
17259 The environment variable GCC_COMPARE_DEBUG, if defined, non-empty
17260 and nonzero, implicitly enables -fcompare-debug. If
17261 GCC_COMPARE_DEBUG is defined to a string starting with a dash, then
17262 it is used for opts, otherwise the default -gtoggle is used.
17263
17264 -fcompare-debug=, with the equal sign but without opts, is
17265 equivalent to -fno-compare-debug, which disables the dumping of the
17266 final representation and the second compilation, preventing even
17267 GCC_COMPARE_DEBUG from taking effect.
17268
17269 To verify full coverage during -fcompare-debug testing, set
17270 GCC_COMPARE_DEBUG to say -fcompare-debug-not-overridden, which GCC
17271 rejects as an invalid option in any actual compilation (rather than
17272 preprocessing, assembly or linking). To get just a warning,
17273 setting GCC_COMPARE_DEBUG to -w%n-fcompare-debug not overridden
17274 will do.
17275
17276 -fcompare-debug-second
17277 This option is implicitly passed to the compiler for the second
17278 compilation requested by -fcompare-debug, along with options to
17279 silence warnings, and omitting other options that would cause the
17280 compiler to produce output to files or to standard output as a side
17281 effect. Dump files and preserved temporary files are renamed so as
17282 to contain the ".gk" additional extension during the second
17283 compilation, to avoid overwriting those generated by the first.
17284
17285 When this option is passed to the compiler driver, it causes the
17286 first compilation to be skipped, which makes it useful for little
17287 other than debugging the compiler proper.
17288
17289 -gtoggle
17290 Turn off generation of debug info, if leaving out this option
17291 generates it, or turn it on at level 2 otherwise. The position of
17292 this argument in the command line does not matter; it takes effect
17293 after all other options are processed, and it does so only once, no
17294 matter how many times it is given. This is mainly intended to be
17295 used with -fcompare-debug.
17296
17297 -fvar-tracking-assignments-toggle
17298 Toggle -fvar-tracking-assignments, in the same way that -gtoggle
17299 toggles -g.
17300
17301 -Q Makes the compiler print out each function name as it is compiled,
17302 and print some statistics about each pass when it finishes.
17303
17304 -ftime-report
17305 Makes the compiler print some statistics about the time consumed by
17306 each pass when it finishes.
17307
17308 -ftime-report-details
17309 Record the time consumed by infrastructure parts separately for
17310 each pass.
17311
17312 -fira-verbose=n
17313 Control the verbosity of the dump file for the integrated register
17314 allocator. The default value is 5. If the value n is greater or
17315 equal to 10, the dump output is sent to stderr using the same
17316 format as n minus 10.
17317
17318 -flto-report
17319 Prints a report with internal details on the workings of the link-
17320 time optimizer. The contents of this report vary from version to
17321 version. It is meant to be useful to GCC developers when
17322 processing object files in LTO mode (via -flto).
17323
17324 Disabled by default.
17325
17326 -flto-report-wpa
17327 Like -flto-report, but only print for the WPA phase of link-time
17328 optimization.
17329
17330 -fmem-report
17331 Makes the compiler print some statistics about permanent memory
17332 allocation when it finishes.
17333
17334 -fmem-report-wpa
17335 Makes the compiler print some statistics about permanent memory
17336 allocation for the WPA phase only.
17337
17338 -fpre-ipa-mem-report
17339 -fpost-ipa-mem-report
17340 Makes the compiler print some statistics about permanent memory
17341 allocation before or after interprocedural optimization.
17342
17343 -fmultiflags
17344 This option enables multilib-aware "TFLAGS" to be used to build
17345 target libraries with options different from those the compiler is
17346 configured to use by default, through the use of specs
17347
17348 Like "TFLAGS", this allows the target libraries to be built for
17349 portable baseline environments, while the compiler defaults to more
17350 demanding ones. That's useful because users can easily override
17351 the defaults the compiler is configured to use to build their own
17352 programs, if the defaults are not ideal for their target
17353 environment, whereas rebuilding the runtime libraries is usually
17354 not as easy or desirable.
17355
17356 Unlike "TFLAGS", the use of specs enables different flags to be
17357 selected for different multilibs. The way to accomplish that is to
17358 build with make TFLAGS=-fmultiflags, after configuring
17359 --with-specs=%{fmultiflags:...}.
17360
17361 This option is discarded by the driver once it's done processing
17362 driver self spec.
17363
17364 It is also useful to check that "TFLAGS" are being used to build
17365 all target libraries, by configuring a non-bootstrap compiler
17366 --with-specs='%{!fmultiflags:%emissing TFLAGS}' and building the
17367 compiler and target libraries.
17368
17369 -fprofile-report
17370 Makes the compiler print some statistics about consistency of the
17371 (estimated) profile and effect of individual passes.
17372
17373 -fstack-usage
17374 Makes the compiler output stack usage information for the program,
17375 on a per-function basis. The filename for the dump is made by
17376 appending .su to the auxname. auxname is generated from the name
17377 of the output file, if explicitly specified and it is not an
17378 executable, otherwise it is the basename of the source file. An
17379 entry is made up of three fields:
17380
17381 * The name of the function.
17382
17383 * A number of bytes.
17384
17385 * One or more qualifiers: "static", "dynamic", "bounded".
17386
17387 The qualifier "static" means that the function manipulates the
17388 stack statically: a fixed number of bytes are allocated for the
17389 frame on function entry and released on function exit; no stack
17390 adjustments are otherwise made in the function. The second field
17391 is this fixed number of bytes.
17392
17393 The qualifier "dynamic" means that the function manipulates the
17394 stack dynamically: in addition to the static allocation described
17395 above, stack adjustments are made in the body of the function, for
17396 example to push/pop arguments around function calls. If the
17397 qualifier "bounded" is also present, the amount of these
17398 adjustments is bounded at compile time and the second field is an
17399 upper bound of the total amount of stack used by the function. If
17400 it is not present, the amount of these adjustments is not bounded
17401 at compile time and the second field only represents the bounded
17402 part.
17403
17404 -fstats
17405 Emit statistics about front-end processing at the end of the
17406 compilation. This option is supported only by the C++ front end,
17407 and the information is generally only useful to the G++ development
17408 team.
17409
17410 -fdbg-cnt-list
17411 Print the name and the counter upper bound for all debug counters.
17412
17413 -fdbg-cnt=counter-value-list
17414 Set the internal debug counter lower and upper bound. counter-
17415 value-list is a comma-separated list of
17416 name:lower_bound1-upper_bound1 [:lower_bound2-upper_bound2...]
17417 tuples which sets the name of the counter and list of closed
17418 intervals. The lower_bound is optional and is zero initialized if
17419 not set. For example, with -fdbg-cnt=dce:2-4:10-11,tail_call:10,
17420 dbg_cnt(dce) returns true only for second, third, fourth, tenth and
17421 eleventh invocation. For dbg_cnt(tail_call) true is returned for
17422 first 10 invocations.
17423
17424 -print-file-name=library
17425 Print the full absolute name of the library file library that would
17426 be used when linking---and don't do anything else. With this
17427 option, GCC does not compile or link anything; it just prints the
17428 file name.
17429
17430 -print-multi-directory
17431 Print the directory name corresponding to the multilib selected by
17432 any other switches present in the command line. This directory is
17433 supposed to exist in GCC_EXEC_PREFIX.
17434
17435 -print-multi-lib
17436 Print the mapping from multilib directory names to compiler
17437 switches that enable them. The directory name is separated from
17438 the switches by ;, and each switch starts with an @ instead of the
17439 -, without spaces between multiple switches. This is supposed to
17440 ease shell processing.
17441
17442 -print-multi-os-directory
17443 Print the path to OS libraries for the selected multilib, relative
17444 to some lib subdirectory. If OS libraries are present in the lib
17445 subdirectory and no multilibs are used, this is usually just ., if
17446 OS libraries are present in libsuffix sibling directories this
17447 prints e.g. ../lib64, ../lib or ../lib32, or if OS libraries are
17448 present in lib/subdir subdirectories it prints e.g. amd64, sparcv9
17449 or ev6.
17450
17451 -print-multiarch
17452 Print the path to OS libraries for the selected multiarch, relative
17453 to some lib subdirectory.
17454
17455 -print-prog-name=program
17456 Like -print-file-name, but searches for a program such as cpp.
17457
17458 -print-libgcc-file-name
17459 Same as -print-file-name=libgcc.a.
17460
17461 This is useful when you use -nostdlib or -nodefaultlibs but you do
17462 want to link with libgcc.a. You can do:
17463
17464 gcc -nostdlib <files>... `gcc -print-libgcc-file-name`
17465
17466 -print-search-dirs
17467 Print the name of the configured installation directory and a list
17468 of program and library directories gcc searches---and don't do
17469 anything else.
17470
17471 This is useful when gcc prints the error message installation
17472 problem, cannot exec cpp0: No such file or directory. To resolve
17473 this you either need to put cpp0 and the other compiler components
17474 where gcc expects to find them, or you can set the environment
17475 variable GCC_EXEC_PREFIX to the directory where you installed them.
17476 Don't forget the trailing /.
17477
17478 -print-sysroot
17479 Print the target sysroot directory that is used during compilation.
17480 This is the target sysroot specified either at configure time or
17481 using the --sysroot option, possibly with an extra suffix that
17482 depends on compilation options. If no target sysroot is specified,
17483 the option prints nothing.
17484
17485 -print-sysroot-headers-suffix
17486 Print the suffix added to the target sysroot when searching for
17487 headers, or give an error if the compiler is not configured with
17488 such a suffix---and don't do anything else.
17489
17490 -dumpmachine
17491 Print the compiler's target machine (for example,
17492 i686-pc-linux-gnu)---and don't do anything else.
17493
17494 -dumpversion
17495 Print the compiler version (for example, 3.0, 6.3.0 or 7)---and
17496 don't do anything else. This is the compiler version used in
17497 filesystem paths and specs. Depending on how the compiler has been
17498 configured it can be just a single number (major version), two
17499 numbers separated by a dot (major and minor version) or three
17500 numbers separated by dots (major, minor and patchlevel version).
17501
17502 -dumpfullversion
17503 Print the full compiler version---and don't do anything else. The
17504 output is always three numbers separated by dots, major, minor and
17505 patchlevel version.
17506
17507 -dumpspecs
17508 Print the compiler's built-in specs---and don't do anything else.
17509 (This is used when GCC itself is being built.)
17510
17511 Machine-Dependent Options
17512 Each target machine supported by GCC can have its own options---for
17513 example, to allow you to compile for a particular processor variant or
17514 ABI, or to control optimizations specific to that machine. By
17515 convention, the names of machine-specific options start with -m.
17516
17517 Some configurations of the compiler also support additional target-
17518 specific options, usually for compatibility with other compilers on the
17519 same platform.
17520
17521 AArch64 Options
17522 These options are defined for AArch64 implementations:
17523
17524 -mabi=name
17525 Generate code for the specified data model. Permissible values are
17526 ilp32 for SysV-like data model where int, long int and pointers are
17527 32 bits, and lp64 for SysV-like data model where int is 32 bits,
17528 but long int and pointers are 64 bits.
17529
17530 The default depends on the specific target configuration. Note
17531 that the LP64 and ILP32 ABIs are not link-compatible; you must
17532 compile your entire program with the same ABI, and link with a
17533 compatible set of libraries.
17534
17535 -mbig-endian
17536 Generate big-endian code. This is the default when GCC is
17537 configured for an aarch64_be-*-* target.
17538
17539 -mgeneral-regs-only
17540 Generate code which uses only the general-purpose registers. This
17541 will prevent the compiler from using floating-point and Advanced
17542 SIMD registers but will not impose any restrictions on the
17543 assembler.
17544
17545 -mlittle-endian
17546 Generate little-endian code. This is the default when GCC is
17547 configured for an aarch64-*-* but not an aarch64_be-*-* target.
17548
17549 -mcmodel=tiny
17550 Generate code for the tiny code model. The program and its
17551 statically defined symbols must be within 1MB of each other.
17552 Programs can be statically or dynamically linked.
17553
17554 -mcmodel=small
17555 Generate code for the small code model. The program and its
17556 statically defined symbols must be within 4GB of each other.
17557 Programs can be statically or dynamically linked. This is the
17558 default code model.
17559
17560 -mcmodel=large
17561 Generate code for the large code model. This makes no assumptions
17562 about addresses and sizes of sections. Programs can be statically
17563 linked only. The -mcmodel=large option is incompatible with
17564 -mabi=ilp32, -fpic and -fPIC.
17565
17566 -mstrict-align
17567 -mno-strict-align
17568 Avoid or allow generating memory accesses that may not be aligned
17569 on a natural object boundary as described in the architecture
17570 specification.
17571
17572 -momit-leaf-frame-pointer
17573 -mno-omit-leaf-frame-pointer
17574 Omit or keep the frame pointer in leaf functions. The former
17575 behavior is the default.
17576
17577 -mstack-protector-guard=guard
17578 -mstack-protector-guard-reg=reg
17579 -mstack-protector-guard-offset=offset
17580 Generate stack protection code using canary at guard. Supported
17581 locations are global for a global canary or sysreg for a canary in
17582 an appropriate system register.
17583
17584 With the latter choice the options -mstack-protector-guard-reg=reg
17585 and -mstack-protector-guard-offset=offset furthermore specify which
17586 system register to use as base register for reading the canary, and
17587 from what offset from that base register. There is no default
17588 register or offset as this is entirely for use within the Linux
17589 kernel.
17590
17591 -mtls-dialect=desc
17592 Use TLS descriptors as the thread-local storage mechanism for
17593 dynamic accesses of TLS variables. This is the default.
17594
17595 -mtls-dialect=traditional
17596 Use traditional TLS as the thread-local storage mechanism for
17597 dynamic accesses of TLS variables.
17598
17599 -mtls-size=size
17600 Specify bit size of immediate TLS offsets. Valid values are 12,
17601 24, 32, 48. This option requires binutils 2.26 or newer.
17602
17603 -mfix-cortex-a53-835769
17604 -mno-fix-cortex-a53-835769
17605 Enable or disable the workaround for the ARM Cortex-A53 erratum
17606 number 835769. This involves inserting a NOP instruction between
17607 memory instructions and 64-bit integer multiply-accumulate
17608 instructions.
17609
17610 -mfix-cortex-a53-843419
17611 -mno-fix-cortex-a53-843419
17612 Enable or disable the workaround for the ARM Cortex-A53 erratum
17613 number 843419. This erratum workaround is made at link time and
17614 this will only pass the corresponding flag to the linker.
17615
17616 -mlow-precision-recip-sqrt
17617 -mno-low-precision-recip-sqrt
17618 Enable or disable the reciprocal square root approximation. This
17619 option only has an effect if -ffast-math or
17620 -funsafe-math-optimizations is used as well. Enabling this reduces
17621 precision of reciprocal square root results to about 16 bits for
17622 single precision and to 32 bits for double precision.
17623
17624 -mlow-precision-sqrt
17625 -mno-low-precision-sqrt
17626 Enable or disable the square root approximation. This option only
17627 has an effect if -ffast-math or -funsafe-math-optimizations is used
17628 as well. Enabling this reduces precision of square root results to
17629 about 16 bits for single precision and to 32 bits for double
17630 precision. If enabled, it implies -mlow-precision-recip-sqrt.
17631
17632 -mlow-precision-div
17633 -mno-low-precision-div
17634 Enable or disable the division approximation. This option only has
17635 an effect if -ffast-math or -funsafe-math-optimizations is used as
17636 well. Enabling this reduces precision of division results to about
17637 16 bits for single precision and to 32 bits for double precision.
17638
17639 -mtrack-speculation
17640 -mno-track-speculation
17641 Enable or disable generation of additional code to track
17642 speculative execution through conditional branches. The tracking
17643 state can then be used by the compiler when expanding calls to
17644 "__builtin_speculation_safe_copy" to permit a more efficient code
17645 sequence to be generated.
17646
17647 -moutline-atomics
17648 -mno-outline-atomics
17649 Enable or disable calls to out-of-line helpers to implement atomic
17650 operations. These helpers will, at runtime, determine if the LSE
17651 instructions from ARMv8.1-A can be used; if not, they will use the
17652 load/store-exclusive instructions that are present in the base
17653 ARMv8.0 ISA.
17654
17655 This option is only applicable when compiling for the base ARMv8.0
17656 instruction set. If using a later revision, e.g. -march=armv8.1-a
17657 or -march=armv8-a+lse, the ARMv8.1-Atomics instructions will be
17658 used directly. The same applies when using -mcpu= when the
17659 selected cpu supports the lse feature. This option is on by
17660 default.
17661
17662 -march=name
17663 Specify the name of the target architecture and, optionally, one or
17664 more feature modifiers. This option has the form
17665 -march=arch{+[no]feature}*.
17666
17667 The table below summarizes the permissible values for arch and the
17668 features that they enable by default:
17669
17670 arch value : Architecture : Includes by default
17671 armv8-a : Armv8-A : +fp, +simd
17672 armv8.1-a : Armv8.1-A : armv8-a, +crc, +lse, +rdma
17673 armv8.2-a : Armv8.2-A : armv8.1-a
17674 armv8.3-a : Armv8.3-A : armv8.2-a, +pauth
17675 armv8.4-a : Armv8.4-A : armv8.3-a, +flagm, +fp16fml, +dotprod
17676 armv8.5-a : Armv8.5-A : armv8.4-a, +sb, +ssbs, +predres
17677 armv8.6-a : Armv8.6-A : armv8.5-a, +bf16, +i8mm
17678 armv8.7-a : Armv8.7-A : armv8.6-a, +ls64
17679 armv8.8-a : Armv8.8-a : armv8.7-a, +mops
17680 armv9-a : Armv9-A : armv8.5-a, +sve, +sve2
17681 armv9.1-a : Armv9.1-A : armv9-a, +bf16, +i8mm
17682 armv9.2-a : Armv9.2-A : armv9.1-a, +ls64
17683 armv9.3-a : Armv9.3-A : armv9.2-a, +mops
17684 armv8-r : Armv8-R : armv8-r
17685
17686 The value native is available on native AArch64 GNU/Linux and
17687 causes the compiler to pick the architecture of the host system.
17688 This option has no effect if the compiler is unable to recognize
17689 the architecture of the host system,
17690
17691 The permissible values for feature are listed in the sub-section on
17692 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
17693 Where conflicting feature modifiers are specified, the right-most
17694 feature is used.
17695
17696 GCC uses name to determine what kind of instructions it can emit
17697 when generating assembly code. If -march is specified without
17698 either of -mtune or -mcpu also being specified, the code is tuned
17699 to perform well across a range of target processors implementing
17700 the target architecture.
17701
17702 -mtune=name
17703 Specify the name of the target processor for which GCC should tune
17704 the performance of the code. Permissible values for this option
17705 are: generic, cortex-a35, cortex-a53, cortex-a55, cortex-a57,
17706 cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae,
17707 cortex-a77, cortex-a65, cortex-a65ae, cortex-a34, cortex-a78,
17708 cortex-a78ae, cortex-a78c, ares, exynos-m1, emag, falkor,
17709 neoverse-512tvb, neoverse-e1, neoverse-n1, neoverse-n2,
17710 neoverse-v1, neoverse-v2, qdf24xx, saphira, phecda, xgene1, vulcan,
17711 octeontx, octeontx81, octeontx83, octeontx2, octeontx2t98,
17712 octeontx2t96 octeontx2t93, octeontx2f95, octeontx2f95n,
17713 octeontx2f95mm, a64fx, thunderx, thunderxt88, thunderxt88p1,
17714 thunderxt81, tsv110, thunderxt83, thunderx2t99, thunderx3t110,
17715 zeus, cortex-a57.cortex-a53, cortex-a72.cortex-a53,
17716 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
17717 cortex-a75.cortex-a55, cortex-a76.cortex-a55, cortex-r82,
17718 cortex-x1, cortex-x1c, cortex-x2, cortex-x3, cortex-a510,
17719 cortex-a710, cortex-a715, ampere1, ampere1a, and native.
17720
17721 The values cortex-a57.cortex-a53, cortex-a72.cortex-a53,
17722 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
17723 cortex-a75.cortex-a55, cortex-a76.cortex-a55 specify that GCC
17724 should tune for a big.LITTLE system.
17725
17726 The value neoverse-512tvb specifies that GCC should tune for
17727 Neoverse cores that (a) implement SVE and (b) have a total vector
17728 bandwidth of 512 bits per cycle. In other words, the option tells
17729 GCC to tune for Neoverse cores that can execute 4 128-bit Advanced
17730 SIMD arithmetic instructions a cycle and that can execute an
17731 equivalent number of SVE arithmetic instructions per cycle (2 for
17732 256-bit SVE, 4 for 128-bit SVE). This is more general than tuning
17733 for a specific core like Neoverse V1 but is more specific than the
17734 default tuning described below.
17735
17736 Additionally on native AArch64 GNU/Linux systems the value native
17737 tunes performance to the host system. This option has no effect if
17738 the compiler is unable to recognize the processor of the host
17739 system.
17740
17741 Where none of -mtune=, -mcpu= or -march= are specified, the code is
17742 tuned to perform well across a range of target processors.
17743
17744 This option cannot be suffixed by feature modifiers.
17745
17746 -mcpu=name
17747 Specify the name of the target processor, optionally suffixed by
17748 one or more feature modifiers. This option has the form
17749 -mcpu=cpu{+[no]feature}*, where the permissible values for cpu are
17750 the same as those available for -mtune. The permissible values for
17751 feature are documented in the sub-section on
17752 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
17753 Where conflicting feature modifiers are specified, the right-most
17754 feature is used.
17755
17756 GCC uses name to determine what kind of instructions it can emit
17757 when generating assembly code (as if by -march) and to determine
17758 the target processor for which to tune for performance (as if by
17759 -mtune). Where this option is used in conjunction with -march or
17760 -mtune, those options take precedence over the appropriate part of
17761 this option.
17762
17763 -mcpu=neoverse-512tvb is special in that it does not refer to a
17764 specific core, but instead refers to all Neoverse cores that (a)
17765 implement SVE and (b) have a total vector bandwidth of 512 bits a
17766 cycle. Unless overridden by -march, -mcpu=neoverse-512tvb
17767 generates code that can run on a Neoverse V1 core, since Neoverse
17768 V1 is the first Neoverse core with these properties. Unless
17769 overridden by -mtune, -mcpu=neoverse-512tvb tunes code in the same
17770 way as for -mtune=neoverse-512tvb.
17771
17772 -moverride=string
17773 Override tuning decisions made by the back-end in response to a
17774 -mtune= switch. The syntax, semantics, and accepted values for
17775 string in this option are not guaranteed to be consistent across
17776 releases.
17777
17778 This option is only intended to be useful when developing GCC.
17779
17780 -mverbose-cost-dump
17781 Enable verbose cost model dumping in the debug dump files. This
17782 option is provided for use in debugging the compiler.
17783
17784 -mpc-relative-literal-loads
17785 -mno-pc-relative-literal-loads
17786 Enable or disable PC-relative literal loads. With this option
17787 literal pools are accessed using a single instruction and emitted
17788 after each function. This limits the maximum size of functions to
17789 1MB. This is enabled by default for -mcmodel=tiny.
17790
17791 -msign-return-address=scope
17792 Select the function scope on which return address signing will be
17793 applied. Permissible values are none, which disables return
17794 address signing, non-leaf, which enables pointer signing for
17795 functions which are not leaf functions, and all, which enables
17796 pointer signing for all functions. The default value is none. This
17797 option has been deprecated by -mbranch-protection.
17798
17799 -mbranch-protection=none|standard|pac-ret[+leaf+b-key]|bti
17800 Select the branch protection features to use. none is the default
17801 and turns off all types of branch protection. standard turns on
17802 all types of branch protection features. If a feature has
17803 additional tuning options, then standard sets it to its standard
17804 level. pac-ret[+leaf] turns on return address signing to its
17805 standard level: signing functions that save the return address to
17806 memory (non-leaf functions will practically always do this) using
17807 the a-key. The optional argument leaf can be used to extend the
17808 signing to include leaf functions. The optional argument b-key can
17809 be used to sign the functions with the B-key instead of the A-key.
17810 bti turns on branch target identification mechanism.
17811
17812 -mharden-sls=opts
17813 Enable compiler hardening against straight line speculation (SLS).
17814 opts is a comma-separated list of the following options:
17815
17816 retbr
17817 blr
17818
17819 In addition, -mharden-sls=all enables all SLS hardening while
17820 -mharden-sls=none disables all SLS hardening.
17821
17822 -msve-vector-bits=bits
17823 Specify the number of bits in an SVE vector register. This option
17824 only has an effect when SVE is enabled.
17825
17826 GCC supports two forms of SVE code generation: "vector-length
17827 agnostic" output that works with any size of vector register and
17828 "vector-length specific" output that allows GCC to make assumptions
17829 about the vector length when it is useful for optimization reasons.
17830 The possible values of bits are: scalable, 128, 256, 512, 1024 and
17831 2048. Specifying scalable selects vector-length agnostic output.
17832 At present -msve-vector-bits=128 also generates vector-length
17833 agnostic output for big-endian targets. All other values generate
17834 vector-length specific code. The behavior of these values may
17835 change in future releases and no value except scalable should be
17836 relied on for producing code that is portable across different
17837 hardware SVE vector lengths.
17838
17839 The default is -msve-vector-bits=scalable, which produces vector-
17840 length agnostic code.
17841
17842 -march and -mcpu Feature Modifiers
17843
17844 Feature modifiers used with -march and -mcpu can be any of the
17845 following and their inverses nofeature:
17846
17847 crc Enable CRC extension. This is on by default for -march=armv8.1-a.
17848
17849 crypto
17850 Enable Crypto extension. This also enables Advanced SIMD and
17851 floating-point instructions.
17852
17853 fp Enable floating-point instructions. This is on by default for all
17854 possible values for options -march and -mcpu.
17855
17856 simd
17857 Enable Advanced SIMD instructions. This also enables floating-
17858 point instructions. This is on by default for all possible values
17859 for options -march and -mcpu.
17860
17861 sve Enable Scalable Vector Extension instructions. This also enables
17862 Advanced SIMD and floating-point instructions.
17863
17864 lse Enable Large System Extension instructions. This is on by default
17865 for -march=armv8.1-a.
17866
17867 rdma
17868 Enable Round Double Multiply Accumulate instructions. This is on
17869 by default for -march=armv8.1-a.
17870
17871 fp16
17872 Enable FP16 extension. This also enables floating-point
17873 instructions.
17874
17875 fp16fml
17876 Enable FP16 fmla extension. This also enables FP16 extensions and
17877 floating-point instructions. This option is enabled by default for
17878 -march=armv8.4-a. Use of this option with architectures prior to
17879 Armv8.2-A is not supported.
17880
17881 rcpc
17882 Enable the RCpc extension. This enables the use of the LDAPR
17883 instructions for load-acquire atomic semantics, and passes it on to
17884 the assembler, enabling inline asm statements to use instructions
17885 from the RCpc extension.
17886
17887 dotprod
17888 Enable the Dot Product extension. This also enables Advanced SIMD
17889 instructions.
17890
17891 aes Enable the Armv8-a aes and pmull crypto extension. This also
17892 enables Advanced SIMD instructions.
17893
17894 sha2
17895 Enable the Armv8-a sha2 crypto extension. This also enables
17896 Advanced SIMD instructions.
17897
17898 sha3
17899 Enable the sha512 and sha3 crypto extension. This also enables
17900 Advanced SIMD instructions. Use of this option with architectures
17901 prior to Armv8.2-A is not supported.
17902
17903 sm4 Enable the sm3 and sm4 crypto extension. This also enables
17904 Advanced SIMD instructions. Use of this option with architectures
17905 prior to Armv8.2-A is not supported.
17906
17907 profile
17908 Enable the Statistical Profiling extension. This option is only to
17909 enable the extension at the assembler level and does not affect
17910 code generation.
17911
17912 rng Enable the Armv8.5-a Random Number instructions. This option is
17913 only to enable the extension at the assembler level and does not
17914 affect code generation.
17915
17916 memtag
17917 Enable the Armv8.5-a Memory Tagging Extensions. Use of this option
17918 with architectures prior to Armv8.5-A is not supported.
17919
17920 sb Enable the Armv8-a Speculation Barrier instruction. This option is
17921 only to enable the extension at the assembler level and does not
17922 affect code generation. This option is enabled by default for
17923 -march=armv8.5-a.
17924
17925 ssbs
17926 Enable the Armv8-a Speculative Store Bypass Safe instruction. This
17927 option is only to enable the extension at the assembler level and
17928 does not affect code generation. This option is enabled by default
17929 for -march=armv8.5-a.
17930
17931 predres
17932 Enable the Armv8-a Execution and Data Prediction Restriction
17933 instructions. This option is only to enable the extension at the
17934 assembler level and does not affect code generation. This option
17935 is enabled by default for -march=armv8.5-a.
17936
17937 sve2
17938 Enable the Armv8-a Scalable Vector Extension 2. This also enables
17939 SVE instructions.
17940
17941 sve2-bitperm
17942 Enable SVE2 bitperm instructions. This also enables SVE2
17943 instructions.
17944
17945 sve2-sm4
17946 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
17947
17948 sve2-aes
17949 Enable SVE2 aes instructions. This also enables SVE2 instructions.
17950
17951 sve2-sha3
17952 Enable SVE2 sha3 instructions. This also enables SVE2
17953 instructions.
17954
17955 tme Enable the Transactional Memory Extension.
17956
17957 i8mm
17958 Enable 8-bit Integer Matrix Multiply instructions. This also
17959 enables Advanced SIMD and floating-point instructions. This option
17960 is enabled by default for -march=armv8.6-a. Use of this option
17961 with architectures prior to Armv8.2-A is not supported.
17962
17963 f32mm
17964 Enable 32-bit Floating point Matrix Multiply instructions. This
17965 also enables SVE instructions. Use of this option with
17966 architectures prior to Armv8.2-A is not supported.
17967
17968 f64mm
17969 Enable 64-bit Floating point Matrix Multiply instructions. This
17970 also enables SVE instructions. Use of this option with
17971 architectures prior to Armv8.2-A is not supported.
17972
17973 bf16
17974 Enable brain half-precision floating-point instructions. This also
17975 enables Advanced SIMD and floating-point instructions. This option
17976 is enabled by default for -march=armv8.6-a. Use of this option
17977 with architectures prior to Armv8.2-A is not supported.
17978
17979 ls64
17980 Enable the 64-byte atomic load and store instructions for
17981 accelerators. This option is enabled by default for
17982 -march=armv8.7-a.
17983
17984 mops
17985 Enable the instructions to accelerate memory operations like
17986 "memcpy", "memmove", "memset". This option is enabled by default
17987 for -march=armv8.8-a
17988
17989 flagm
17990 Enable the Flag Manipulation instructions Extension.
17991
17992 pauth
17993 Enable the Pointer Authentication Extension.
17994
17995 cssc
17996 Enable the Common Short Sequence Compression instructions.
17997
17998 Feature crypto implies aes, sha2, and simd, which implies fp.
17999 Conversely, nofp implies nosimd, which implies nocrypto, noaes and
18000 nosha2.
18001
18002 Adapteva Epiphany Options
18003 These -m options are defined for Adapteva Epiphany:
18004
18005 -mhalf-reg-file
18006 Don't allocate any register in the range "r32"..."r63". That
18007 allows code to run on hardware variants that lack these registers.
18008
18009 -mprefer-short-insn-regs
18010 Preferentially allocate registers that allow short instruction
18011 generation. This can result in increased instruction count, so
18012 this may either reduce or increase overall code size.
18013
18014 -mbranch-cost=num
18015 Set the cost of branches to roughly num "simple" instructions.
18016 This cost is only a heuristic and is not guaranteed to produce
18017 consistent results across releases.
18018
18019 -mcmove
18020 Enable the generation of conditional moves.
18021
18022 -mnops=num
18023 Emit num NOPs before every other generated instruction.
18024
18025 -mno-soft-cmpsf
18026 For single-precision floating-point comparisons, emit an "fsub"
18027 instruction and test the flags. This is faster than a software
18028 comparison, but can get incorrect results in the presence of NaNs,
18029 or when two different small numbers are compared such that their
18030 difference is calculated as zero. The default is -msoft-cmpsf,
18031 which uses slower, but IEEE-compliant, software comparisons.
18032
18033 -mstack-offset=num
18034 Set the offset between the top of the stack and the stack pointer.
18035 E.g., a value of 8 means that the eight bytes in the range
18036 "sp+0...sp+7" can be used by leaf functions without stack
18037 allocation. Values other than 8 or 16 are untested and unlikely to
18038 work. Note also that this option changes the ABI; compiling a
18039 program with a different stack offset than the libraries have been
18040 compiled with generally does not work. This option can be useful
18041 if you want to evaluate if a different stack offset would give you
18042 better code, but to actually use a different stack offset to build
18043 working programs, it is recommended to configure the toolchain with
18044 the appropriate --with-stack-offset=num option.
18045
18046 -mno-round-nearest
18047 Make the scheduler assume that the rounding mode has been set to
18048 truncating. The default is -mround-nearest.
18049
18050 -mlong-calls
18051 If not otherwise specified by an attribute, assume all calls might
18052 be beyond the offset range of the "b" / "bl" instructions, and
18053 therefore load the function address into a register before
18054 performing a (otherwise direct) call. This is the default.
18055
18056 -mshort-calls
18057 If not otherwise specified by an attribute, assume all direct calls
18058 are in the range of the "b" / "bl" instructions, so use these
18059 instructions for direct calls. The default is -mlong-calls.
18060
18061 -msmall16
18062 Assume addresses can be loaded as 16-bit unsigned values. This
18063 does not apply to function addresses for which -mlong-calls
18064 semantics are in effect.
18065
18066 -mfp-mode=mode
18067 Set the prevailing mode of the floating-point unit. This
18068 determines the floating-point mode that is provided and expected at
18069 function call and return time. Making this mode match the mode you
18070 predominantly need at function start can make your programs smaller
18071 and faster by avoiding unnecessary mode switches.
18072
18073 mode can be set to one the following values:
18074
18075 caller
18076 Any mode at function entry is valid, and retained or restored
18077 when the function returns, and when it calls other functions.
18078 This mode is useful for compiling libraries or other
18079 compilation units you might want to incorporate into different
18080 programs with different prevailing FPU modes, and the
18081 convenience of being able to use a single object file outweighs
18082 the size and speed overhead for any extra mode switching that
18083 might be needed, compared with what would be needed with a more
18084 specific choice of prevailing FPU mode.
18085
18086 truncate
18087 This is the mode used for floating-point calculations with
18088 truncating (i.e. round towards zero) rounding mode. That
18089 includes conversion from floating point to integer.
18090
18091 round-nearest
18092 This is the mode used for floating-point calculations with
18093 round-to-nearest-or-even rounding mode.
18094
18095 int This is the mode used to perform integer calculations in the
18096 FPU, e.g. integer multiply, or integer multiply-and-
18097 accumulate.
18098
18099 The default is -mfp-mode=caller
18100
18101 -mno-split-lohi
18102 -mno-postinc
18103 -mno-postmodify
18104 Code generation tweaks that disable, respectively, splitting of
18105 32-bit loads, generation of post-increment addresses, and
18106 generation of post-modify addresses. The defaults are msplit-lohi,
18107 -mpost-inc, and -mpost-modify.
18108
18109 -mnovect-double
18110 Change the preferred SIMD mode to SImode. The default is
18111 -mvect-double, which uses DImode as preferred SIMD mode.
18112
18113 -max-vect-align=num
18114 The maximum alignment for SIMD vector mode types. num may be 4 or
18115 8. The default is 8. Note that this is an ABI change, even though
18116 many library function interfaces are unaffected if they don't use
18117 SIMD vector modes in places that affect size and/or alignment of
18118 relevant types.
18119
18120 -msplit-vecmove-early
18121 Split vector moves into single word moves before reload. In theory
18122 this can give better register allocation, but so far the reverse
18123 seems to be generally the case.
18124
18125 -m1reg-reg
18126 Specify a register to hold the constant -1, which makes loading
18127 small negative constants and certain bitmasks faster. Allowable
18128 values for reg are r43 and r63, which specify use of that register
18129 as a fixed register, and none, which means that no register is used
18130 for this purpose. The default is -m1reg-none.
18131
18132 AMD GCN Options
18133 These options are defined specifically for the AMD GCN port.
18134
18135 -march=gpu
18136 -mtune=gpu
18137 Set architecture type or tuning for gpu. Supported values for gpu
18138 are
18139
18140 fiji
18141 Compile for GCN3 Fiji devices (gfx803).
18142
18143 gfx900
18144 Compile for GCN5 Vega 10 devices (gfx900).
18145
18146 gfx906
18147 Compile for GCN5 Vega 20 devices (gfx906).
18148
18149 gfx908
18150 Compile for CDNA1 Instinct MI100 series devices (gfx908).
18151
18152 gfx90a
18153 Compile for CDNA2 Instinct MI200 series devices (gfx90a).
18154
18155 -msram-ecc=on
18156 -msram-ecc=off
18157 -msram-ecc=any
18158 Compile binaries suitable for devices with the SRAM-ECC feature
18159 enabled, disabled, or either mode. This feature can be enabled
18160 per-process on some devices. The compiled code must match the
18161 device mode. The default is any, for devices that support it.
18162
18163 -mstack-size=bytes
18164 Specify how many bytes of stack space will be requested for each
18165 GPU thread (wave-front). Beware that there may be many threads and
18166 limited memory available. The size of the stack allocation may
18167 also have an impact on run-time performance. The default is 32KB
18168 when using OpenACC or OpenMP, and 1MB otherwise.
18169
18170 -mxnack
18171 Compile binaries suitable for devices with the XNACK feature
18172 enabled. Some devices always require XNACK and some allow the user
18173 to configure XNACK. The compiled code must match the device mode.
18174 The default is -mno-xnack. At present this option is a placeholder
18175 for support that is not yet implemented.
18176
18177 ARC Options
18178 The following options control the architecture variant for which code
18179 is being compiled:
18180
18181 -mbarrel-shifter
18182 Generate instructions supported by barrel shifter. This is the
18183 default unless -mcpu=ARC601 or -mcpu=ARCEM is in effect.
18184
18185 -mjli-always
18186 Force to call a function using jli_s instruction. This option is
18187 valid only for ARCv2 architecture.
18188
18189 -mcpu=cpu
18190 Set architecture type, register usage, and instruction scheduling
18191 parameters for cpu. There are also shortcut alias options
18192 available for backward compatibility and convenience. Supported
18193 values for cpu are
18194
18195 arc600
18196 Compile for ARC600. Aliases: -mA6, -mARC600.
18197
18198 arc601
18199 Compile for ARC601. Alias: -mARC601.
18200
18201 arc700
18202 Compile for ARC700. Aliases: -mA7, -mARC700. This is the
18203 default when configured with --with-cpu=arc700.
18204
18205 arcem
18206 Compile for ARC EM.
18207
18208 archs
18209 Compile for ARC HS.
18210
18211 em Compile for ARC EM CPU with no hardware extensions.
18212
18213 em4 Compile for ARC EM4 CPU.
18214
18215 em4_dmips
18216 Compile for ARC EM4 DMIPS CPU.
18217
18218 em4_fpus
18219 Compile for ARC EM4 DMIPS CPU with the single-precision
18220 floating-point extension.
18221
18222 em4_fpuda
18223 Compile for ARC EM4 DMIPS CPU with single-precision floating-
18224 point and double assist instructions.
18225
18226 hs Compile for ARC HS CPU with no hardware extensions except the
18227 atomic instructions.
18228
18229 hs34
18230 Compile for ARC HS34 CPU.
18231
18232 hs38
18233 Compile for ARC HS38 CPU.
18234
18235 hs38_linux
18236 Compile for ARC HS38 CPU with all hardware extensions on.
18237
18238 hs4x
18239 Compile for ARC HS4x CPU.
18240
18241 hs4xd
18242 Compile for ARC HS4xD CPU.
18243
18244 hs4x_rel31
18245 Compile for ARC HS4x CPU release 3.10a.
18246
18247 arc600_norm
18248 Compile for ARC 600 CPU with "norm" instructions enabled.
18249
18250 arc600_mul32x16
18251 Compile for ARC 600 CPU with "norm" and 32x16-bit multiply
18252 instructions enabled.
18253
18254 arc600_mul64
18255 Compile for ARC 600 CPU with "norm" and "mul64"-family
18256 instructions enabled.
18257
18258 arc601_norm
18259 Compile for ARC 601 CPU with "norm" instructions enabled.
18260
18261 arc601_mul32x16
18262 Compile for ARC 601 CPU with "norm" and 32x16-bit multiply
18263 instructions enabled.
18264
18265 arc601_mul64
18266 Compile for ARC 601 CPU with "norm" and "mul64"-family
18267 instructions enabled.
18268
18269 nps400
18270 Compile for ARC 700 on NPS400 chip.
18271
18272 em_mini
18273 Compile for ARC EM minimalist configuration featuring reduced
18274 register set.
18275
18276 -mdpfp
18277 -mdpfp-compact
18278 Generate double-precision FPX instructions, tuned for the compact
18279 implementation.
18280
18281 -mdpfp-fast
18282 Generate double-precision FPX instructions, tuned for the fast
18283 implementation.
18284
18285 -mno-dpfp-lrsr
18286 Disable "lr" and "sr" instructions from using FPX extension aux
18287 registers.
18288
18289 -mea
18290 Generate extended arithmetic instructions. Currently only "divaw",
18291 "adds", "subs", and "sat16" are supported. Only valid for
18292 -mcpu=ARC700.
18293
18294 -mno-mpy
18295 Do not generate "mpy"-family instructions for ARC700. This option
18296 is deprecated.
18297
18298 -mmul32x16
18299 Generate 32x16-bit multiply and multiply-accumulate instructions.
18300
18301 -mmul64
18302 Generate "mul64" and "mulu64" instructions. Only valid for
18303 -mcpu=ARC600.
18304
18305 -mnorm
18306 Generate "norm" instructions. This is the default if -mcpu=ARC700
18307 is in effect.
18308
18309 -mspfp
18310 -mspfp-compact
18311 Generate single-precision FPX instructions, tuned for the compact
18312 implementation.
18313
18314 -mspfp-fast
18315 Generate single-precision FPX instructions, tuned for the fast
18316 implementation.
18317
18318 -msimd
18319 Enable generation of ARC SIMD instructions via target-specific
18320 builtins. Only valid for -mcpu=ARC700.
18321
18322 -msoft-float
18323 This option ignored; it is provided for compatibility purposes
18324 only. Software floating-point code is emitted by default, and this
18325 default can overridden by FPX options; -mspfp, -mspfp-compact, or
18326 -mspfp-fast for single precision, and -mdpfp, -mdpfp-compact, or
18327 -mdpfp-fast for double precision.
18328
18329 -mswap
18330 Generate "swap" instructions.
18331
18332 -matomic
18333 This enables use of the locked load/store conditional extension to
18334 implement atomic memory built-in functions. Not available for ARC
18335 6xx or ARC EM cores.
18336
18337 -mdiv-rem
18338 Enable "div" and "rem" instructions for ARCv2 cores.
18339
18340 -mcode-density
18341 Enable code density instructions for ARC EM. This option is on by
18342 default for ARC HS.
18343
18344 -mll64
18345 Enable double load/store operations for ARC HS cores.
18346
18347 -mtp-regno=regno
18348 Specify thread pointer register number.
18349
18350 -mmpy-option=multo
18351 Compile ARCv2 code with a multiplier design option. You can
18352 specify the option using either a string or numeric value for
18353 multo. wlh1 is the default value. The recognized values are:
18354
18355 0
18356 none
18357 No multiplier available.
18358
18359 1
18360 w 16x16 multiplier, fully pipelined. The following instructions
18361 are enabled: "mpyw" and "mpyuw".
18362
18363 2
18364 wlh1
18365 32x32 multiplier, fully pipelined (1 stage). The following
18366 instructions are additionally enabled: "mpy", "mpyu", "mpym",
18367 "mpymu", and "mpy_s".
18368
18369 3
18370 wlh2
18371 32x32 multiplier, fully pipelined (2 stages). The following
18372 instructions are additionally enabled: "mpy", "mpyu", "mpym",
18373 "mpymu", and "mpy_s".
18374
18375 4
18376 wlh3
18377 Two 16x16 multipliers, blocking, sequential. The following
18378 instructions are additionally enabled: "mpy", "mpyu", "mpym",
18379 "mpymu", and "mpy_s".
18380
18381 5
18382 wlh4
18383 One 16x16 multiplier, blocking, sequential. The following
18384 instructions are additionally enabled: "mpy", "mpyu", "mpym",
18385 "mpymu", and "mpy_s".
18386
18387 6
18388 wlh5
18389 One 32x4 multiplier, blocking, sequential. The following
18390 instructions are additionally enabled: "mpy", "mpyu", "mpym",
18391 "mpymu", and "mpy_s".
18392
18393 7
18394 plus_dmpy
18395 ARC HS SIMD support.
18396
18397 8
18398 plus_macd
18399 ARC HS SIMD support.
18400
18401 9
18402 plus_qmacw
18403 ARC HS SIMD support.
18404
18405 This option is only available for ARCv2 cores.
18406
18407 -mfpu=fpu
18408 Enables support for specific floating-point hardware extensions for
18409 ARCv2 cores. Supported values for fpu are:
18410
18411 fpus
18412 Enables support for single-precision floating-point hardware
18413 extensions.
18414
18415 fpud
18416 Enables support for double-precision floating-point hardware
18417 extensions. The single-precision floating-point extension is
18418 also enabled. Not available for ARC EM.
18419
18420 fpuda
18421 Enables support for double-precision floating-point hardware
18422 extensions using double-precision assist instructions. The
18423 single-precision floating-point extension is also enabled.
18424 This option is only available for ARC EM.
18425
18426 fpuda_div
18427 Enables support for double-precision floating-point hardware
18428 extensions using double-precision assist instructions. The
18429 single-precision floating-point, square-root, and divide
18430 extensions are also enabled. This option is only available for
18431 ARC EM.
18432
18433 fpuda_fma
18434 Enables support for double-precision floating-point hardware
18435 extensions using double-precision assist instructions. The
18436 single-precision floating-point and fused multiply and add
18437 hardware extensions are also enabled. This option is only
18438 available for ARC EM.
18439
18440 fpuda_all
18441 Enables support for double-precision floating-point hardware
18442 extensions using double-precision assist instructions. All
18443 single-precision floating-point hardware extensions are also
18444 enabled. This option is only available for ARC EM.
18445
18446 fpus_div
18447 Enables support for single-precision floating-point, square-
18448 root and divide hardware extensions.
18449
18450 fpud_div
18451 Enables support for double-precision floating-point, square-
18452 root and divide hardware extensions. This option includes
18453 option fpus_div. Not available for ARC EM.
18454
18455 fpus_fma
18456 Enables support for single-precision floating-point and fused
18457 multiply and add hardware extensions.
18458
18459 fpud_fma
18460 Enables support for double-precision floating-point and fused
18461 multiply and add hardware extensions. This option includes
18462 option fpus_fma. Not available for ARC EM.
18463
18464 fpus_all
18465 Enables support for all single-precision floating-point
18466 hardware extensions.
18467
18468 fpud_all
18469 Enables support for all single- and double-precision floating-
18470 point hardware extensions. Not available for ARC EM.
18471
18472 -mirq-ctrl-saved=register-range, blink, lp_count
18473 Specifies general-purposes registers that the processor
18474 automatically saves/restores on interrupt entry and exit.
18475 register-range is specified as two registers separated by a dash.
18476 The register range always starts with "r0", the upper limit is "fp"
18477 register. blink and lp_count are optional. This option is only
18478 valid for ARC EM and ARC HS cores.
18479
18480 -mrgf-banked-regs=number
18481 Specifies the number of registers replicated in second register
18482 bank on entry to fast interrupt. Fast interrupts are interrupts
18483 with the highest priority level P0. These interrupts save only PC
18484 and STATUS32 registers to avoid memory transactions during
18485 interrupt entry and exit sequences. Use this option when you are
18486 using fast interrupts in an ARC V2 family processor. Permitted
18487 values are 4, 8, 16, and 32.
18488
18489 -mlpc-width=width
18490 Specify the width of the "lp_count" register. Valid values for
18491 width are 8, 16, 20, 24, 28 and 32 bits. The default width is
18492 fixed to 32 bits. If the width is less than 32, the compiler does
18493 not attempt to transform loops in your program to use the zero-
18494 delay loop mechanism unless it is known that the "lp_count"
18495 register can hold the required loop-counter value. Depending on
18496 the width specified, the compiler and run-time library might
18497 continue to use the loop mechanism for various needs. This option
18498 defines macro "__ARC_LPC_WIDTH__" with the value of width.
18499
18500 -mrf16
18501 This option instructs the compiler to generate code for a 16-entry
18502 register file. This option defines the "__ARC_RF16__" preprocessor
18503 macro.
18504
18505 -mbranch-index
18506 Enable use of "bi" or "bih" instructions to implement jump tables.
18507
18508 The following options are passed through to the assembler, and also
18509 define preprocessor macro symbols.
18510
18511 -mdsp-packa
18512 Passed down to the assembler to enable the DSP Pack A extensions.
18513 Also sets the preprocessor symbol "__Xdsp_packa". This option is
18514 deprecated.
18515
18516 -mdvbf
18517 Passed down to the assembler to enable the dual Viterbi butterfly
18518 extension. Also sets the preprocessor symbol "__Xdvbf". This
18519 option is deprecated.
18520
18521 -mlock
18522 Passed down to the assembler to enable the locked load/store
18523 conditional extension. Also sets the preprocessor symbol
18524 "__Xlock".
18525
18526 -mmac-d16
18527 Passed down to the assembler. Also sets the preprocessor symbol
18528 "__Xxmac_d16". This option is deprecated.
18529
18530 -mmac-24
18531 Passed down to the assembler. Also sets the preprocessor symbol
18532 "__Xxmac_24". This option is deprecated.
18533
18534 -mrtsc
18535 Passed down to the assembler to enable the 64-bit time-stamp
18536 counter extension instruction. Also sets the preprocessor symbol
18537 "__Xrtsc". This option is deprecated.
18538
18539 -mswape
18540 Passed down to the assembler to enable the swap byte ordering
18541 extension instruction. Also sets the preprocessor symbol
18542 "__Xswape".
18543
18544 -mtelephony
18545 Passed down to the assembler to enable dual- and single-operand
18546 instructions for telephony. Also sets the preprocessor symbol
18547 "__Xtelephony". This option is deprecated.
18548
18549 -mxy
18550 Passed down to the assembler to enable the XY memory extension.
18551 Also sets the preprocessor symbol "__Xxy".
18552
18553 The following options control how the assembly code is annotated:
18554
18555 -misize
18556 Annotate assembler instructions with estimated addresses.
18557
18558 -mannotate-align
18559 Explain what alignment considerations lead to the decision to make
18560 an instruction short or long.
18561
18562 The following options are passed through to the linker:
18563
18564 -marclinux
18565 Passed through to the linker, to specify use of the "arclinux"
18566 emulation. This option is enabled by default in tool chains built
18567 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
18568 profiling is not requested.
18569
18570 -marclinux_prof
18571 Passed through to the linker, to specify use of the "arclinux_prof"
18572 emulation. This option is enabled by default in tool chains built
18573 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
18574 profiling is requested.
18575
18576 The following options control the semantics of generated code:
18577
18578 -mlong-calls
18579 Generate calls as register indirect calls, thus providing access to
18580 the full 32-bit address range.
18581
18582 -mmedium-calls
18583 Don't use less than 25-bit addressing range for calls, which is the
18584 offset available for an unconditional branch-and-link instruction.
18585 Conditional execution of function calls is suppressed, to allow use
18586 of the 25-bit range, rather than the 21-bit range with conditional
18587 branch-and-link. This is the default for tool chains built for
18588 "arc-linux-uclibc" and "arceb-linux-uclibc" targets.
18589
18590 -G num
18591 Put definitions of externally-visible data in a small data section
18592 if that data is no bigger than num bytes. The default value of num
18593 is 4 for any ARC configuration, or 8 when we have double load/store
18594 operations.
18595
18596 -mno-sdata
18597 Do not generate sdata references. This is the default for tool
18598 chains built for "arc-linux-uclibc" and "arceb-linux-uclibc"
18599 targets.
18600
18601 -mvolatile-cache
18602 Use ordinarily cached memory accesses for volatile references.
18603 This is the default.
18604
18605 -mno-volatile-cache
18606 Enable cache bypass for volatile references.
18607
18608 The following options fine tune code generation:
18609
18610 -malign-call
18611 Does nothing. Preserved for backward compatibility.
18612
18613 -mauto-modify-reg
18614 Enable the use of pre/post modify with register displacement.
18615
18616 -mbbit-peephole
18617 Enable bbit peephole2.
18618
18619 -mno-brcc
18620 This option disables a target-specific pass in arc_reorg to
18621 generate compare-and-branch ("brcc") instructions. It has no
18622 effect on generation of these instructions driven by the combiner
18623 pass.
18624
18625 -mcase-vector-pcrel
18626 Use PC-relative switch case tables to enable case table shortening.
18627 This is the default for -Os.
18628
18629 -mcompact-casesi
18630 Enable compact "casesi" pattern. This is the default for -Os, and
18631 only available for ARCv1 cores. This option is deprecated.
18632
18633 -mno-cond-exec
18634 Disable the ARCompact-specific pass to generate conditional
18635 execution instructions.
18636
18637 Due to delay slot scheduling and interactions between operand
18638 numbers, literal sizes, instruction lengths, and the support for
18639 conditional execution, the target-independent pass to generate
18640 conditional execution is often lacking, so the ARC port has kept a
18641 special pass around that tries to find more conditional execution
18642 generation opportunities after register allocation, branch
18643 shortening, and delay slot scheduling have been done. This pass
18644 generally, but not always, improves performance and code size, at
18645 the cost of extra compilation time, which is why there is an option
18646 to switch it off. If you have a problem with call instructions
18647 exceeding their allowable offset range because they are
18648 conditionalized, you should consider using -mmedium-calls instead.
18649
18650 -mearly-cbranchsi
18651 Enable pre-reload use of the "cbranchsi" pattern.
18652
18653 -mexpand-adddi
18654 Expand "adddi3" and "subdi3" at RTL generation time into "add.f",
18655 "adc" etc. This option is deprecated.
18656
18657 -mindexed-loads
18658 Enable the use of indexed loads. This can be problematic because
18659 some optimizers then assume that indexed stores exist, which is not
18660 the case.
18661
18662 -mlra
18663 Enable Local Register Allocation. This is still experimental for
18664 ARC, so by default the compiler uses standard reload (i.e.
18665 -mno-lra).
18666
18667 -mlra-priority-none
18668 Don't indicate any priority for target registers.
18669
18670 -mlra-priority-compact
18671 Indicate target register priority for r0..r3 / r12..r15.
18672
18673 -mlra-priority-noncompact
18674 Reduce target register priority for r0..r3 / r12..r15.
18675
18676 -mmillicode
18677 When optimizing for size (using -Os), prologues and epilogues that
18678 have to save or restore a large number of registers are often
18679 shortened by using call to a special function in libgcc; this is
18680 referred to as a millicode call. As these calls can pose
18681 performance issues, and/or cause linking issues when linking in a
18682 nonstandard way, this option is provided to turn on or off
18683 millicode call generation.
18684
18685 -mcode-density-frame
18686 This option enable the compiler to emit "enter" and "leave"
18687 instructions. These instructions are only valid for CPUs with
18688 code-density feature.
18689
18690 -mmixed-code
18691 Does nothing. Preserved for backward compatibility.
18692
18693 -mq-class
18694 Ths option is deprecated. Enable q instruction alternatives. This
18695 is the default for -Os.
18696
18697 -mRcq
18698 Does nothing. Preserved for backward compatibility.
18699
18700 -mRcw
18701 Does nothing. Preserved for backward compatibility.
18702
18703 -msize-level=level
18704 Fine-tune size optimization with regards to instruction lengths and
18705 alignment. The recognized values for level are:
18706
18707 0 No size optimization. This level is deprecated and treated
18708 like 1.
18709
18710 1 Short instructions are used opportunistically.
18711
18712 2 In addition, alignment of loops and of code after barriers are
18713 dropped.
18714
18715 3 In addition, optional data alignment is dropped, and the option
18716 Os is enabled.
18717
18718 This defaults to 3 when -Os is in effect. Otherwise, the behavior
18719 when this is not set is equivalent to level 1.
18720
18721 -mtune=cpu
18722 Set instruction scheduling parameters for cpu, overriding any
18723 implied by -mcpu=.
18724
18725 Supported values for cpu are
18726
18727 ARC600
18728 Tune for ARC600 CPU.
18729
18730 ARC601
18731 Tune for ARC601 CPU.
18732
18733 ARC700
18734 Tune for ARC700 CPU with standard multiplier block.
18735
18736 ARC700-xmac
18737 Tune for ARC700 CPU with XMAC block.
18738
18739 ARC725D
18740 Tune for ARC725D CPU.
18741
18742 ARC750D
18743 Tune for ARC750D CPU.
18744
18745 core3
18746 Tune for ARCv2 core3 type CPU. This option enable usage of
18747 "dbnz" instruction.
18748
18749 release31a
18750 Tune for ARC4x release 3.10a.
18751
18752 -mmultcost=num
18753 Cost to assume for a multiply instruction, with 4 being equal to a
18754 normal instruction.
18755
18756 -munalign-prob-threshold=probability
18757 Does nothing. Preserved for backward compatibility.
18758
18759 The following options are maintained for backward compatibility, but
18760 are now deprecated and will be removed in a future release:
18761
18762 -margonaut
18763 Obsolete FPX.
18764
18765 -mbig-endian
18766 -EB Compile code for big-endian targets. Use of these options is now
18767 deprecated. Big-endian code is supported by configuring GCC to
18768 build "arceb-elf32" and "arceb-linux-uclibc" targets, for which big
18769 endian is the default.
18770
18771 -mlittle-endian
18772 -EL Compile code for little-endian targets. Use of these options is
18773 now deprecated. Little-endian code is supported by configuring GCC
18774 to build "arc-elf32" and "arc-linux-uclibc" targets, for which
18775 little endian is the default.
18776
18777 -mbarrel_shifter
18778 Replaced by -mbarrel-shifter.
18779
18780 -mdpfp_compact
18781 Replaced by -mdpfp-compact.
18782
18783 -mdpfp_fast
18784 Replaced by -mdpfp-fast.
18785
18786 -mdsp_packa
18787 Replaced by -mdsp-packa.
18788
18789 -mEA
18790 Replaced by -mea.
18791
18792 -mmac_24
18793 Replaced by -mmac-24.
18794
18795 -mmac_d16
18796 Replaced by -mmac-d16.
18797
18798 -mspfp_compact
18799 Replaced by -mspfp-compact.
18800
18801 -mspfp_fast
18802 Replaced by -mspfp-fast.
18803
18804 -mtune=cpu
18805 Values arc600, arc601, arc700 and arc700-xmac for cpu are replaced
18806 by ARC600, ARC601, ARC700 and ARC700-xmac respectively.
18807
18808 -multcost=num
18809 Replaced by -mmultcost.
18810
18811 ARM Options
18812 These -m options are defined for the ARM port:
18813
18814 -mabi=name
18815 Generate code for the specified ABI. Permissible values are: apcs-
18816 gnu, atpcs, aapcs, aapcs-linux and iwmmxt.
18817
18818 -mapcs-frame
18819 Generate a stack frame that is compliant with the ARM Procedure
18820 Call Standard for all functions, even if this is not strictly
18821 necessary for correct execution of the code. Specifying
18822 -fomit-frame-pointer with this option causes the stack frames not
18823 to be generated for leaf functions. The default is
18824 -mno-apcs-frame. This option is deprecated.
18825
18826 -mapcs
18827 This is a synonym for -mapcs-frame and is deprecated.
18828
18829 -mthumb-interwork
18830 Generate code that supports calling between the ARM and Thumb
18831 instruction sets. Without this option, on pre-v5 architectures,
18832 the two instruction sets cannot be reliably used inside one
18833 program. The default is -mno-thumb-interwork, since slightly
18834 larger code is generated when -mthumb-interwork is specified. In
18835 AAPCS configurations this option is meaningless.
18836
18837 -mno-sched-prolog
18838 Prevent the reordering of instructions in the function prologue, or
18839 the merging of those instruction with the instructions in the
18840 function's body. This means that all functions start with a
18841 recognizable set of instructions (or in fact one of a choice from a
18842 small set of different function prologues), and this information
18843 can be used to locate the start of functions inside an executable
18844 piece of code. The default is -msched-prolog.
18845
18846 -mfloat-abi=name
18847 Specifies which floating-point ABI to use. Permissible values are:
18848 soft, softfp and hard.
18849
18850 Specifying soft causes GCC to generate output containing library
18851 calls for floating-point operations. softfp allows the generation
18852 of code using hardware floating-point instructions, but still uses
18853 the soft-float calling conventions. hard allows generation of
18854 floating-point instructions and uses FPU-specific calling
18855 conventions.
18856
18857 The default depends on the specific target configuration. Note
18858 that the hard-float and soft-float ABIs are not link-compatible;
18859 you must compile your entire program with the same ABI, and link
18860 with a compatible set of libraries.
18861
18862 -mgeneral-regs-only
18863 Generate code which uses only the general-purpose registers. This
18864 will prevent the compiler from using floating-point and Advanced
18865 SIMD registers but will not impose any restrictions on the
18866 assembler.
18867
18868 -mlittle-endian
18869 Generate code for a processor running in little-endian mode. This
18870 is the default for all standard configurations.
18871
18872 -mbig-endian
18873 Generate code for a processor running in big-endian mode; the
18874 default is to compile code for a little-endian processor.
18875
18876 -mbe8
18877 -mbe32
18878 When linking a big-endian image select between BE8 and BE32
18879 formats. The option has no effect for little-endian images and is
18880 ignored. The default is dependent on the selected target
18881 architecture. For ARMv6 and later architectures the default is
18882 BE8, for older architectures the default is BE32. BE32 format has
18883 been deprecated by ARM.
18884
18885 -march=name[+extension...]
18886 This specifies the name of the target ARM architecture. GCC uses
18887 this name to determine what kind of instructions it can emit when
18888 generating assembly code. This option can be used in conjunction
18889 with or instead of the -mcpu= option.
18890
18891 Permissible names are: armv4t, armv5t, armv5te, armv6, armv6j,
18892 armv6k, armv6kz, armv6t2, armv6z, armv6zk, armv7, armv7-a, armv7ve,
18893 armv8-a, armv8.1-a, armv8.2-a, armv8.3-a, armv8.4-a, armv8.5-a,
18894 armv8.6-a, armv9-a, armv7-r, armv8-r, armv6-m, armv6s-m, armv7-m,
18895 armv7e-m, armv8-m.base, armv8-m.main, armv8.1-m.main, armv9-a,
18896 iwmmxt and iwmmxt2.
18897
18898 Additionally, the following architectures, which lack support for
18899 the Thumb execution state, are recognized but support is
18900 deprecated: armv4.
18901
18902 Many of the architectures support extensions. These can be added
18903 by appending +extension to the architecture name. Extension
18904 options are processed in order and capabilities accumulate. An
18905 extension will also enable any necessary base extensions upon which
18906 it depends. For example, the +crypto extension will always enable
18907 the +simd extension. The exception to the additive construction is
18908 for extensions that are prefixed with +no...: these extensions
18909 disable the specified option and any other extensions that may
18910 depend on the presence of that extension.
18911
18912 For example, -march=armv7-a+simd+nofp+vfpv4 is equivalent to
18913 writing -march=armv7-a+vfpv4 since the +simd option is entirely
18914 disabled by the +nofp option that follows it.
18915
18916 Most extension names are generically named, but have an effect that
18917 is dependent upon the architecture to which it is applied. For
18918 example, the +simd option can be applied to both armv7-a and
18919 armv8-a architectures, but will enable the original ARMv7-A
18920 Advanced SIMD (Neon) extensions for armv7-a and the ARMv8-A variant
18921 for armv8-a.
18922
18923 The table below lists the supported extensions for each
18924 architecture. Architectures not mentioned do not support any
18925 extensions.
18926
18927 armv5te
18928 armv6
18929 armv6j
18930 armv6k
18931 armv6kz
18932 armv6t2
18933 armv6z
18934 armv6zk
18935 +fp The VFPv2 floating-point instructions. The extension
18936 +vfpv2 can be used as an alias for this extension.
18937
18938 +nofp
18939 Disable the floating-point instructions.
18940
18941 armv7
18942 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M
18943 architectures.
18944
18945 +fp The VFPv3 floating-point instructions, with 16 double-
18946 precision registers. The extension +vfpv3-d16 can be used
18947 as an alias for this extension. Note that floating-point
18948 is not supported by the base ARMv7-M architecture, but is
18949 compatible with both the ARMv7-A and ARMv7-R architectures.
18950
18951 +nofp
18952 Disable the floating-point instructions.
18953
18954 armv7-a
18955 +mp The multiprocessing extension.
18956
18957 +sec
18958 The security extension.
18959
18960 +fp The VFPv3 floating-point instructions, with 16 double-
18961 precision registers. The extension +vfpv3-d16 can be used
18962 as an alias for this extension.
18963
18964 +simd
18965 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
18966 instructions. The extensions +neon and +neon-vfpv3 can be
18967 used as aliases for this extension.
18968
18969 +vfpv3
18970 The VFPv3 floating-point instructions, with 32 double-
18971 precision registers.
18972
18973 +vfpv3-d16-fp16
18974 The VFPv3 floating-point instructions, with 16 double-
18975 precision registers and the half-precision floating-point
18976 conversion operations.
18977
18978 +vfpv3-fp16
18979 The VFPv3 floating-point instructions, with 32 double-
18980 precision registers and the half-precision floating-point
18981 conversion operations.
18982
18983 +vfpv4-d16
18984 The VFPv4 floating-point instructions, with 16 double-
18985 precision registers.
18986
18987 +vfpv4
18988 The VFPv4 floating-point instructions, with 32 double-
18989 precision registers.
18990
18991 +neon-fp16
18992 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
18993 instructions, with the half-precision floating-point
18994 conversion operations.
18995
18996 +neon-vfpv4
18997 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
18998 instructions.
18999
19000 +nosimd
19001 Disable the Advanced SIMD instructions (does not disable
19002 floating point).
19003
19004 +nofp
19005 Disable the floating-point and Advanced SIMD instructions.
19006
19007 armv7ve
19008 The extended version of the ARMv7-A architecture with support
19009 for virtualization.
19010
19011 +fp The VFPv4 floating-point instructions, with 16 double-
19012 precision registers. The extension +vfpv4-d16 can be used
19013 as an alias for this extension.
19014
19015 +simd
19016 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
19017 instructions. The extension +neon-vfpv4 can be used as an
19018 alias for this extension.
19019
19020 +vfpv3-d16
19021 The VFPv3 floating-point instructions, with 16 double-
19022 precision registers.
19023
19024 +vfpv3
19025 The VFPv3 floating-point instructions, with 32 double-
19026 precision registers.
19027
19028 +vfpv3-d16-fp16
19029 The VFPv3 floating-point instructions, with 16 double-
19030 precision registers and the half-precision floating-point
19031 conversion operations.
19032
19033 +vfpv3-fp16
19034 The VFPv3 floating-point instructions, with 32 double-
19035 precision registers and the half-precision floating-point
19036 conversion operations.
19037
19038 +vfpv4-d16
19039 The VFPv4 floating-point instructions, with 16 double-
19040 precision registers.
19041
19042 +vfpv4
19043 The VFPv4 floating-point instructions, with 32 double-
19044 precision registers.
19045
19046 +neon
19047 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
19048 instructions. The extension +neon-vfpv3 can be used as an
19049 alias for this extension.
19050
19051 +neon-fp16
19052 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
19053 instructions, with the half-precision floating-point
19054 conversion operations.
19055
19056 +nosimd
19057 Disable the Advanced SIMD instructions (does not disable
19058 floating point).
19059
19060 +nofp
19061 Disable the floating-point and Advanced SIMD instructions.
19062
19063 armv8-a
19064 +crc
19065 The Cyclic Redundancy Check (CRC) instructions.
19066
19067 +simd
19068 The ARMv8-A Advanced SIMD and floating-point instructions.
19069
19070 +crypto
19071 The cryptographic instructions.
19072
19073 +nocrypto
19074 Disable the cryptographic instructions.
19075
19076 +nofp
19077 Disable the floating-point, Advanced SIMD and cryptographic
19078 instructions.
19079
19080 +sb Speculation Barrier Instruction.
19081
19082 +predres
19083 Execution and Data Prediction Restriction Instructions.
19084
19085 armv8.1-a
19086 +simd
19087 The ARMv8.1-A Advanced SIMD and floating-point
19088 instructions.
19089
19090 +crypto
19091 The cryptographic instructions. This also enables the
19092 Advanced SIMD and floating-point instructions.
19093
19094 +nocrypto
19095 Disable the cryptographic instructions.
19096
19097 +nofp
19098 Disable the floating-point, Advanced SIMD and cryptographic
19099 instructions.
19100
19101 +sb Speculation Barrier Instruction.
19102
19103 +predres
19104 Execution and Data Prediction Restriction Instructions.
19105
19106 armv8.2-a
19107 armv8.3-a
19108 +fp16
19109 The half-precision floating-point data processing
19110 instructions. This also enables the Advanced SIMD and
19111 floating-point instructions.
19112
19113 +fp16fml
19114 The half-precision floating-point fmla extension. This
19115 also enables the half-precision floating-point extension
19116 and Advanced SIMD and floating-point instructions.
19117
19118 +simd
19119 The ARMv8.1-A Advanced SIMD and floating-point
19120 instructions.
19121
19122 +crypto
19123 The cryptographic instructions. This also enables the
19124 Advanced SIMD and floating-point instructions.
19125
19126 +dotprod
19127 Enable the Dot Product extension. This also enables
19128 Advanced SIMD instructions.
19129
19130 +nocrypto
19131 Disable the cryptographic extension.
19132
19133 +nofp
19134 Disable the floating-point, Advanced SIMD and cryptographic
19135 instructions.
19136
19137 +sb Speculation Barrier Instruction.
19138
19139 +predres
19140 Execution and Data Prediction Restriction Instructions.
19141
19142 +i8mm
19143 8-bit Integer Matrix Multiply instructions. This also
19144 enables Advanced SIMD and floating-point instructions.
19145
19146 +bf16
19147 Brain half-precision floating-point instructions. This
19148 also enables Advanced SIMD and floating-point instructions.
19149
19150 armv8.4-a
19151 +fp16
19152 The half-precision floating-point data processing
19153 instructions. This also enables the Advanced SIMD and
19154 floating-point instructions as well as the Dot Product
19155 extension and the half-precision floating-point fmla
19156 extension.
19157
19158 +simd
19159 The ARMv8.3-A Advanced SIMD and floating-point instructions
19160 as well as the Dot Product extension.
19161
19162 +crypto
19163 The cryptographic instructions. This also enables the
19164 Advanced SIMD and floating-point instructions as well as
19165 the Dot Product extension.
19166
19167 +nocrypto
19168 Disable the cryptographic extension.
19169
19170 +nofp
19171 Disable the floating-point, Advanced SIMD and cryptographic
19172 instructions.
19173
19174 +sb Speculation Barrier Instruction.
19175
19176 +predres
19177 Execution and Data Prediction Restriction Instructions.
19178
19179 +i8mm
19180 8-bit Integer Matrix Multiply instructions. This also
19181 enables Advanced SIMD and floating-point instructions.
19182
19183 +bf16
19184 Brain half-precision floating-point instructions. This
19185 also enables Advanced SIMD and floating-point instructions.
19186
19187 armv8.5-a
19188 +fp16
19189 The half-precision floating-point data processing
19190 instructions. This also enables the Advanced SIMD and
19191 floating-point instructions as well as the Dot Product
19192 extension and the half-precision floating-point fmla
19193 extension.
19194
19195 +simd
19196 The ARMv8.3-A Advanced SIMD and floating-point instructions
19197 as well as the Dot Product extension.
19198
19199 +crypto
19200 The cryptographic instructions. This also enables the
19201 Advanced SIMD and floating-point instructions as well as
19202 the Dot Product extension.
19203
19204 +nocrypto
19205 Disable the cryptographic extension.
19206
19207 +nofp
19208 Disable the floating-point, Advanced SIMD and cryptographic
19209 instructions.
19210
19211 +i8mm
19212 8-bit Integer Matrix Multiply instructions. This also
19213 enables Advanced SIMD and floating-point instructions.
19214
19215 +bf16
19216 Brain half-precision floating-point instructions. This
19217 also enables Advanced SIMD and floating-point instructions.
19218
19219 armv8.6-a
19220 +fp16
19221 The half-precision floating-point data processing
19222 instructions. This also enables the Advanced SIMD and
19223 floating-point instructions as well as the Dot Product
19224 extension and the half-precision floating-point fmla
19225 extension.
19226
19227 +simd
19228 The ARMv8.3-A Advanced SIMD and floating-point instructions
19229 as well as the Dot Product extension.
19230
19231 +crypto
19232 The cryptographic instructions. This also enables the
19233 Advanced SIMD and floating-point instructions as well as
19234 the Dot Product extension.
19235
19236 +nocrypto
19237 Disable the cryptographic extension.
19238
19239 +nofp
19240 Disable the floating-point, Advanced SIMD and cryptographic
19241 instructions.
19242
19243 +i8mm
19244 8-bit Integer Matrix Multiply instructions. This also
19245 enables Advanced SIMD and floating-point instructions.
19246
19247 +bf16
19248 Brain half-precision floating-point instructions. This
19249 also enables Advanced SIMD and floating-point instructions.
19250
19251 armv7-r
19252 +fp.sp
19253 The single-precision VFPv3 floating-point instructions.
19254 The extension +vfpv3xd can be used as an alias for this
19255 extension.
19256
19257 +fp The VFPv3 floating-point instructions with 16 double-
19258 precision registers. The extension +vfpv3-d16 can be used
19259 as an alias for this extension.
19260
19261 +vfpv3xd-d16-fp16
19262 The single-precision VFPv3 floating-point instructions with
19263 16 double-precision registers and the half-precision
19264 floating-point conversion operations.
19265
19266 +vfpv3-d16-fp16
19267 The VFPv3 floating-point instructions with 16 double-
19268 precision registers and the half-precision floating-point
19269 conversion operations.
19270
19271 +nofp
19272 Disable the floating-point extension.
19273
19274 +idiv
19275 The ARM-state integer division instructions.
19276
19277 +noidiv
19278 Disable the ARM-state integer division extension.
19279
19280 armv7e-m
19281 +fp The single-precision VFPv4 floating-point instructions.
19282
19283 +fpv5
19284 The single-precision FPv5 floating-point instructions.
19285
19286 +fp.dp
19287 The single- and double-precision FPv5 floating-point
19288 instructions.
19289
19290 +nofp
19291 Disable the floating-point extensions.
19292
19293 armv8.1-m.main
19294 +dsp
19295 The DSP instructions.
19296
19297 +mve
19298 The M-Profile Vector Extension (MVE) integer instructions.
19299
19300 +mve.fp
19301 The M-Profile Vector Extension (MVE) integer and single
19302 precision floating-point instructions.
19303
19304 +fp The single-precision floating-point instructions.
19305
19306 +fp.dp
19307 The single- and double-precision floating-point
19308 instructions.
19309
19310 +nofp
19311 Disable the floating-point extension.
19312
19313 +cdecp0, +cdecp1, ... , +cdecp7
19314 Enable the Custom Datapath Extension (CDE) on selected
19315 coprocessors according to the numbers given in the options
19316 in the range 0 to 7.
19317
19318 +pacbti
19319 Enable the Pointer Authentication and Branch Target
19320 Identification Extension.
19321
19322 armv8-m.main
19323 +dsp
19324 The DSP instructions.
19325
19326 +nodsp
19327 Disable the DSP extension.
19328
19329 +fp The single-precision floating-point instructions.
19330
19331 +fp.dp
19332 The single- and double-precision floating-point
19333 instructions.
19334
19335 +nofp
19336 Disable the floating-point extension.
19337
19338 +cdecp0, +cdecp1, ... , +cdecp7
19339 Enable the Custom Datapath Extension (CDE) on selected
19340 coprocessors according to the numbers given in the options
19341 in the range 0 to 7.
19342
19343 armv8-r
19344 +crc
19345 The Cyclic Redundancy Check (CRC) instructions.
19346
19347 +fp.sp
19348 The single-precision FPv5 floating-point instructions.
19349
19350 +simd
19351 The ARMv8-A Advanced SIMD and floating-point instructions.
19352
19353 +crypto
19354 The cryptographic instructions.
19355
19356 +nocrypto
19357 Disable the cryptographic instructions.
19358
19359 +nofp
19360 Disable the floating-point, Advanced SIMD and cryptographic
19361 instructions.
19362
19363 -march=native causes the compiler to auto-detect the architecture
19364 of the build computer. At present, this feature is only supported
19365 on GNU/Linux, and not all architectures are recognized. If the
19366 auto-detect is unsuccessful the option has no effect.
19367
19368 -mtune=name
19369 This option specifies the name of the target ARM processor for
19370 which GCC should tune the performance of the code. For some ARM
19371 implementations better performance can be obtained by using this
19372 option. Permissible names are: arm7tdmi, arm7tdmi-s, arm710t,
19373 arm720t, arm740t, strongarm, strongarm110, strongarm1100,
19374 strongarm1110, arm8, arm810, arm9, arm9e, arm920, arm920t, arm922t,
19375 arm946e-s, arm966e-s, arm968e-s, arm926ej-s, arm940t, arm9tdmi,
19376 arm10tdmi, arm1020t, arm1026ej-s, arm10e, arm1020e, arm1022e,
19377 arm1136j-s, arm1136jf-s, mpcore, mpcorenovfp, arm1156t2-s,
19378 arm1156t2f-s, arm1176jz-s, arm1176jzf-s, generic-armv7-a,
19379 cortex-a5, cortex-a7, cortex-a8, cortex-a9, cortex-a12, cortex-a15,
19380 cortex-a17, cortex-a32, cortex-a35, cortex-a53, cortex-a55,
19381 cortex-a57, cortex-a72, cortex-a73, cortex-a75, cortex-a76,
19382 cortex-a76ae, cortex-a77, cortex-a78, cortex-a78ae, cortex-a78c,
19383 cortex-a710, ares, cortex-r4, cortex-r4f, cortex-r5, cortex-r7,
19384 cortex-r8, cortex-r52, cortex-r52plus, cortex-m0, cortex-m0plus,
19385 cortex-m1, cortex-m3, cortex-m4, cortex-m7, cortex-m23, cortex-m33,
19386 cortex-m35p, cortex-m55, cortex-m85, cortex-x1, cortex-x1c,
19387 cortex-m1.small-multiply, cortex-m0.small-multiply,
19388 cortex-m0plus.small-multiply, exynos-m1, marvell-pj4, neoverse-n1,
19389 neoverse-n2, neoverse-v1, xscale, iwmmxt, iwmmxt2, ep9312, fa526,
19390 fa626, fa606te, fa626te, fmp626, fa726te, star-mc1, xgene1.
19391
19392 Additionally, this option can specify that GCC should tune the
19393 performance of the code for a big.LITTLE system. Permissible names
19394 are: cortex-a15.cortex-a7, cortex-a17.cortex-a7,
19395 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
19396 cortex-a72.cortex-a35, cortex-a73.cortex-a53,
19397 cortex-a75.cortex-a55, cortex-a76.cortex-a55.
19398
19399 -mtune=generic-arch specifies that GCC should tune the performance
19400 for a blend of processors within architecture arch. The aim is to
19401 generate code that run well on the current most popular processors,
19402 balancing between optimizations that benefit some CPUs in the
19403 range, and avoiding performance pitfalls of other CPUs. The
19404 effects of this option may change in future GCC versions as CPU
19405 models come and go.
19406
19407 -mtune permits the same extension options as -mcpu, but the
19408 extension options do not affect the tuning of the generated code.
19409
19410 -mtune=native causes the compiler to auto-detect the CPU of the
19411 build computer. At present, this feature is only supported on
19412 GNU/Linux, and not all architectures are recognized. If the auto-
19413 detect is unsuccessful the option has no effect.
19414
19415 -mcpu=name[+extension...]
19416 This specifies the name of the target ARM processor. GCC uses this
19417 name to derive the name of the target ARM architecture (as if
19418 specified by -march) and the ARM processor type for which to tune
19419 for performance (as if specified by -mtune). Where this option is
19420 used in conjunction with -march or -mtune, those options take
19421 precedence over the appropriate part of this option.
19422
19423 Many of the supported CPUs implement optional architectural
19424 extensions. Where this is so the architectural extensions are
19425 normally enabled by default. If implementations that lack the
19426 extension exist, then the extension syntax can be used to disable
19427 those extensions that have been omitted. For floating-point and
19428 Advanced SIMD (Neon) instructions, the settings of the options
19429 -mfloat-abi and -mfpu must also be considered: floating-point and
19430 Advanced SIMD instructions will only be used if -mfloat-abi is not
19431 set to soft; and any setting of -mfpu other than auto will override
19432 the available floating-point and SIMD extension instructions.
19433
19434 For example, cortex-a9 can be found in three major configurations:
19435 integer only, with just a floating-point unit or with floating-
19436 point and Advanced SIMD. The default is to enable all the
19437 instructions, but the extensions +nosimd and +nofp can be used to
19438 disable just the SIMD or both the SIMD and floating-point
19439 instructions respectively.
19440
19441 Permissible names for this option are the same as those for -mtune.
19442
19443 The following extension options are common to the listed CPUs:
19444
19445 +nodsp
19446 Disable the DSP instructions on cortex-m33, cortex-m35p,
19447 cortex-m55 and cortex-m85. Also disable the M-Profile Vector
19448 Extension (MVE) integer and single precision floating-point
19449 instructions on cortex-m55 and cortex-m85.
19450
19451 +nopacbti
19452 Disable the Pointer Authentication and Branch Target
19453 Identification Extension on cortex-m85.
19454
19455 +nomve
19456 Disable the M-Profile Vector Extension (MVE) integer and single
19457 precision floating-point instructions on cortex-m55 and
19458 cortex-m85.
19459
19460 +nomve.fp
19461 Disable the M-Profile Vector Extension (MVE) single precision
19462 floating-point instructions on cortex-m55 and cortex-m85.
19463
19464 +cdecp0, +cdecp1, ... , +cdecp7
19465 Enable the Custom Datapath Extension (CDE) on selected
19466 coprocessors according to the numbers given in the options in
19467 the range 0 to 7 on cortex-m55.
19468
19469 +nofp
19470 Disables the floating-point instructions on arm9e, arm946e-s,
19471 arm966e-s, arm968e-s, arm10e, arm1020e, arm1022e, arm926ej-s,
19472 arm1026ej-s, cortex-r5, cortex-r7, cortex-r8, cortex-m4,
19473 cortex-m7, cortex-m33, cortex-m35p cortex-m4, cortex-m7,
19474 cortex-m33, cortex-m35p, cortex-m55 and cortex-m85. Disables
19475 the floating-point and SIMD instructions on generic-armv7-a,
19476 cortex-a5, cortex-a7, cortex-a8, cortex-a9, cortex-a12,
19477 cortex-a15, cortex-a17, cortex-a15.cortex-a7,
19478 cortex-a17.cortex-a7, cortex-a32, cortex-a35, cortex-a53 and
19479 cortex-a55.
19480
19481 +nofp.dp
19482 Disables the double-precision component of the floating-point
19483 instructions on cortex-r5, cortex-r7, cortex-r8, cortex-r52,
19484 cortex-r52plus and cortex-m7.
19485
19486 +nosimd
19487 Disables the SIMD (but not floating-point) instructions on
19488 generic-armv7-a, cortex-a5, cortex-a7 and cortex-a9.
19489
19490 +crypto
19491 Enables the cryptographic instructions on cortex-a32,
19492 cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a72,
19493 cortex-a73, cortex-a75, exynos-m1, xgene1,
19494 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
19495 cortex-a73.cortex-a35, cortex-a73.cortex-a53 and
19496 cortex-a75.cortex-a55.
19497
19498 Additionally the generic-armv7-a pseudo target defaults to VFPv3
19499 with 16 double-precision registers. It supports the following
19500 extension options: mp, sec, vfpv3-d16, vfpv3, vfpv3-d16-fp16,
19501 vfpv3-fp16, vfpv4-d16, vfpv4, neon, neon-vfpv3, neon-fp16,
19502 neon-vfpv4. The meanings are the same as for the extensions to
19503 -march=armv7-a.
19504
19505 -mcpu=generic-arch is also permissible, and is equivalent to
19506 -march=arch -mtune=generic-arch. See -mtune for more information.
19507
19508 -mcpu=native causes the compiler to auto-detect the CPU of the
19509 build computer. At present, this feature is only supported on
19510 GNU/Linux, and not all architectures are recognized. If the auto-
19511 detect is unsuccessful the option has no effect.
19512
19513 -mfpu=name
19514 This specifies what floating-point hardware (or hardware emulation)
19515 is available on the target. Permissible names are: auto, vfpv2,
19516 vfpv3, vfpv3-fp16, vfpv3-d16, vfpv3-d16-fp16, vfpv3xd,
19517 vfpv3xd-fp16, neon-vfpv3, neon-fp16, vfpv4, vfpv4-d16, fpv4-sp-d16,
19518 neon-vfpv4, fpv5-d16, fpv5-sp-d16, fp-armv8, neon-fp-armv8 and
19519 crypto-neon-fp-armv8. Note that neon is an alias for neon-vfpv3
19520 and vfp is an alias for vfpv2.
19521
19522 The setting auto is the default and is special. It causes the
19523 compiler to select the floating-point and Advanced SIMD
19524 instructions based on the settings of -mcpu and -march.
19525
19526 If the selected floating-point hardware includes the NEON extension
19527 (e.g. -mfpu=neon), note that floating-point operations are not
19528 generated by GCC's auto-vectorization pass unless
19529 -funsafe-math-optimizations is also specified. This is because
19530 NEON hardware does not fully implement the IEEE 754 standard for
19531 floating-point arithmetic (in particular denormal values are
19532 treated as zero), so the use of NEON instructions may lead to a
19533 loss of precision.
19534
19535 You can also set the fpu name at function level by using the
19536 target("fpu=") function attributes or pragmas.
19537
19538 -mfp16-format=name
19539 Specify the format of the "__fp16" half-precision floating-point
19540 type. Permissible names are none, ieee, and alternative; the
19541 default is none, in which case the "__fp16" type is not defined.
19542
19543 -mstructure-size-boundary=n
19544 The sizes of all structures and unions are rounded up to a multiple
19545 of the number of bits set by this option. Permissible values are
19546 8, 32 and 64. The default value varies for different toolchains.
19547 For the COFF targeted toolchain the default value is 8. A value of
19548 64 is only allowed if the underlying ABI supports it.
19549
19550 Specifying a larger number can produce faster, more efficient code,
19551 but can also increase the size of the program. Different values
19552 are potentially incompatible. Code compiled with one value cannot
19553 necessarily expect to work with code or libraries compiled with
19554 another value, if they exchange information using structures or
19555 unions.
19556
19557 This option is deprecated.
19558
19559 -mabort-on-noreturn
19560 Generate a call to the function "abort" at the end of a "noreturn"
19561 function. It is executed if the function tries to return.
19562
19563 -mlong-calls
19564 -mno-long-calls
19565 Tells the compiler to perform function calls by first loading the
19566 address of the function into a register and then performing a
19567 subroutine call on this register. This switch is needed if the
19568 target function lies outside of the 64-megabyte addressing range of
19569 the offset-based version of subroutine call instruction.
19570
19571 Even if this switch is enabled, not all function calls are turned
19572 into long calls. The heuristic is that static functions, functions
19573 that have the "short_call" attribute, functions that are inside the
19574 scope of a "#pragma no_long_calls" directive, and functions whose
19575 definitions have already been compiled within the current
19576 compilation unit are not turned into long calls. The exceptions to
19577 this rule are that weak function definitions, functions with the
19578 "long_call" attribute or the "section" attribute, and functions
19579 that are within the scope of a "#pragma long_calls" directive are
19580 always turned into long calls.
19581
19582 This feature is not enabled by default. Specifying -mno-long-calls
19583 restores the default behavior, as does placing the function calls
19584 within the scope of a "#pragma long_calls_off" directive. Note
19585 these switches have no effect on how the compiler generates code to
19586 handle function calls via function pointers.
19587
19588 -msingle-pic-base
19589 Treat the register used for PIC addressing as read-only, rather
19590 than loading it in the prologue for each function. The runtime
19591 system is responsible for initializing this register with an
19592 appropriate value before execution begins.
19593
19594 -mpic-register=reg
19595 Specify the register to be used for PIC addressing. For standard
19596 PIC base case, the default is any suitable register determined by
19597 compiler. For single PIC base case, the default is R9 if target is
19598 EABI based or stack-checking is enabled, otherwise the default is
19599 R10.
19600
19601 -mpic-data-is-text-relative
19602 Assume that the displacement between the text and data segments is
19603 fixed at static link time. This permits using PC-relative
19604 addressing operations to access data known to be in the data
19605 segment. For non-VxWorks RTP targets, this option is enabled by
19606 default. When disabled on such targets, it will enable
19607 -msingle-pic-base by default.
19608
19609 -mpoke-function-name
19610 Write the name of each function into the text section, directly
19611 preceding the function prologue. The generated code is similar to
19612 this:
19613
19614 t0
19615 .ascii "arm_poke_function_name", 0
19616 .align
19617 t1
19618 .word 0xff000000 + (t1 - t0)
19619 arm_poke_function_name
19620 mov ip, sp
19621 stmfd sp!, {fp, ip, lr, pc}
19622 sub fp, ip, #4
19623
19624 When performing a stack backtrace, code can inspect the value of
19625 "pc" stored at "fp + 0". If the trace function then looks at
19626 location "pc - 12" and the top 8 bits are set, then we know that
19627 there is a function name embedded immediately preceding this
19628 location and has length "((pc[-3]) & 0xff000000)".
19629
19630 -mthumb
19631 -marm
19632 Select between generating code that executes in ARM and Thumb
19633 states. The default for most configurations is to generate code
19634 that executes in ARM state, but the default can be changed by
19635 configuring GCC with the --with-mode=state configure option.
19636
19637 You can also override the ARM and Thumb mode for each function by
19638 using the target("thumb") and target("arm") function attributes or
19639 pragmas.
19640
19641 -mflip-thumb
19642 Switch ARM/Thumb modes on alternating functions. This option is
19643 provided for regression testing of mixed Thumb/ARM code generation,
19644 and is not intended for ordinary use in compiling code.
19645
19646 -mtpcs-frame
19647 Generate a stack frame that is compliant with the Thumb Procedure
19648 Call Standard for all non-leaf functions. (A leaf function is one
19649 that does not call any other functions.) The default is
19650 -mno-tpcs-frame.
19651
19652 -mtpcs-leaf-frame
19653 Generate a stack frame that is compliant with the Thumb Procedure
19654 Call Standard for all leaf functions. (A leaf function is one that
19655 does not call any other functions.) The default is
19656 -mno-apcs-leaf-frame.
19657
19658 -mcallee-super-interworking
19659 Gives all externally visible functions in the file being compiled
19660 an ARM instruction set header which switches to Thumb mode before
19661 executing the rest of the function. This allows these functions to
19662 be called from non-interworking code. This option is not valid in
19663 AAPCS configurations because interworking is enabled by default.
19664
19665 -mcaller-super-interworking
19666 Allows calls via function pointers (including virtual functions) to
19667 execute correctly regardless of whether the target code has been
19668 compiled for interworking or not. There is a small overhead in the
19669 cost of executing a function pointer if this option is enabled.
19670 This option is not valid in AAPCS configurations because
19671 interworking is enabled by default.
19672
19673 -mtp=name
19674 Specify the access model for the thread local storage pointer. The
19675 valid models are soft, which generates calls to "__aeabi_read_tp",
19676 cp15, which fetches the thread pointer from "cp15" directly
19677 (supported in the arm6k architecture), and auto, which uses the
19678 best available method for the selected processor. The default
19679 setting is auto.
19680
19681 -mtls-dialect=dialect
19682 Specify the dialect to use for accessing thread local storage. Two
19683 dialects are supported---gnu and gnu2. The gnu dialect selects the
19684 original GNU scheme for supporting local and global dynamic TLS
19685 models. The gnu2 dialect selects the GNU descriptor scheme, which
19686 provides better performance for shared libraries. The GNU
19687 descriptor scheme is compatible with the original scheme, but does
19688 require new assembler, linker and library support. Initial and
19689 local exec TLS models are unaffected by this option and always use
19690 the original scheme.
19691
19692 -mword-relocations
19693 Only generate absolute relocations on word-sized values (i.e.
19694 R_ARM_ABS32). This is enabled by default on targets (uClinux,
19695 SymbianOS) where the runtime loader imposes this restriction, and
19696 when -fpic or -fPIC is specified. This option conflicts with
19697 -mslow-flash-data.
19698
19699 -mfix-cortex-m3-ldrd
19700 Some Cortex-M3 cores can cause data corruption when "ldrd"
19701 instructions with overlapping destination and base registers are
19702 used. This option avoids generating these instructions. This
19703 option is enabled by default when -mcpu=cortex-m3 is specified.
19704
19705 -mfix-cortex-a57-aes-1742098
19706 -mno-fix-cortex-a57-aes-1742098
19707 -mfix-cortex-a72-aes-1655431
19708 -mno-fix-cortex-a72-aes-1655431
19709 Enable (disable) mitigation for an erratum on Cortex-A57 and
19710 Cortex-A72 that affects the AES cryptographic instructions. This
19711 option is enabled by default when either -mcpu=cortex-a57 or
19712 -mcpu=cortex-a72 is specified.
19713
19714 -munaligned-access
19715 -mno-unaligned-access
19716 Enables (or disables) reading and writing of 16- and 32- bit values
19717 from addresses that are not 16- or 32- bit aligned. By default
19718 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
19719 ARMv8-M Baseline architectures, and enabled for all other
19720 architectures. If unaligned access is not enabled then words in
19721 packed data structures are accessed a byte at a time.
19722
19723 The ARM attribute "Tag_CPU_unaligned_access" is set in the
19724 generated object file to either true or false, depending upon the
19725 setting of this option. If unaligned access is enabled then the
19726 preprocessor symbol "__ARM_FEATURE_UNALIGNED" is also defined.
19727
19728 -mneon-for-64bits
19729 This option is deprecated and has no effect.
19730
19731 -mslow-flash-data
19732 Assume loading data from flash is slower than fetching instruction.
19733 Therefore literal load is minimized for better performance. This
19734 option is only supported when compiling for ARMv7 M-profile and off
19735 by default. It conflicts with -mword-relocations.
19736
19737 -masm-syntax-unified
19738 Assume inline assembler is using unified asm syntax. The default
19739 is currently off which implies divided syntax. This option has no
19740 impact on Thumb2. However, this may change in future releases of
19741 GCC. Divided syntax should be considered deprecated.
19742
19743 -mrestrict-it
19744 Restricts generation of IT blocks to conform to the rules of
19745 ARMv8-A. IT blocks can only contain a single 16-bit instruction
19746 from a select set of instructions. This option is on by default for
19747 ARMv8-A Thumb mode.
19748
19749 -mprint-tune-info
19750 Print CPU tuning information as comment in assembler file. This is
19751 an option used only for regression testing of the compiler and not
19752 intended for ordinary use in compiling code. This option is
19753 disabled by default.
19754
19755 -mverbose-cost-dump
19756 Enable verbose cost model dumping in the debug dump files. This
19757 option is provided for use in debugging the compiler.
19758
19759 -mpure-code
19760 Do not allow constant data to be placed in code sections.
19761 Additionally, when compiling for ELF object format give all text
19762 sections the ELF processor-specific section attribute
19763 "SHF_ARM_PURECODE". This option is only available when generating
19764 non-pic code for M-profile targets.
19765
19766 -mcmse
19767 Generate secure code as per the "ARMv8-M Security Extensions:
19768 Requirements on Development Tools Engineering Specification", which
19769 can be found on
19770 <https://developer.arm.com/documentation/ecm0359818/latest/>.
19771
19772 -mfix-cmse-cve-2021-35465
19773 Mitigate against a potential security issue with the "VLLDM"
19774 instruction in some M-profile devices when using CMSE
19775 (CVE-2021-365465). This option is enabled by default when the
19776 option -mcpu= is used with "cortex-m33", "cortex-m35p",
19777 "cortex-m55", "cortex-m85" or "star-mc1". The option
19778 -mno-fix-cmse-cve-2021-35465 can be used to disable the mitigation.
19779
19780 -mstack-protector-guard=guard
19781 -mstack-protector-guard-offset=offset
19782 Generate stack protection code using canary at guard. Supported
19783 locations are global for a global canary or tls for a canary
19784 accessible via the TLS register. The option
19785 -mstack-protector-guard-offset= is for use with
19786 -fstack-protector-guard=tls and not for use in user-land code.
19787
19788 -mfdpic
19789 -mno-fdpic
19790 Select the FDPIC ABI, which uses 64-bit function descriptors to
19791 represent pointers to functions. When the compiler is configured
19792 for "arm-*-uclinuxfdpiceabi" targets, this option is on by default
19793 and implies -fPIE if none of the PIC/PIE-related options is
19794 provided. On other targets, it only enables the FDPIC-specific
19795 code generation features, and the user should explicitly provide
19796 the PIC/PIE-related options as needed.
19797
19798 Note that static linking is not supported because it would still
19799 involve the dynamic linker when the program self-relocates. If
19800 such behavior is acceptable, use -static and -Wl,-dynamic-linker
19801 options.
19802
19803 The opposite -mno-fdpic option is useful (and required) to build
19804 the Linux kernel using the same ("arm-*-uclinuxfdpiceabi")
19805 toolchain as the one used to build the userland programs.
19806
19807 -mbranch-protection=none|standard|pac-ret[+leaf][+bti]|bti[+pac-
19808 ret[+leaf]]
19809 Enable branch protection features (armv8.1-m.main only). none
19810 generate code without branch protection or return address signing.
19811 standard[+leaf] generate code with all branch protection features
19812 enabled at their standard level. pac-ret[+leaf] generate code with
19813 return address signing set to its standard level, which is to sign
19814 all functions that save the return address to memory. leaf When
19815 return address signing is enabled, also sign leaf functions even if
19816 they do not write the return address to memory. +bti Add landing-
19817 pad instructions at the permitted targets of indirect branch
19818 instructions.
19819
19820 If the +pacbti architecture extension is not enabled, then all
19821 branch protection and return address signing operations are
19822 constrained to use only the instructions defined in the
19823 architectural-NOP space. The generated code will remain backwards-
19824 compatible with earlier versions of the architecture, but the
19825 additional security can be enabled at run time on processors that
19826 support the PACBTI extension.
19827
19828 Branch target enforcement using BTI can only be enabled at runtime
19829 if all code in the application has been compiled with at least
19830 -mbranch-protection=bti.
19831
19832 Any setting other than none is supported only on armv8-m.main or
19833 later.
19834
19835 The default is to generate code without branch protection or return
19836 address signing.
19837
19838 AVR Options
19839 These options are defined for AVR implementations:
19840
19841 -mmcu=mcu
19842 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
19843
19844 The default for this option is avr2.
19845
19846 GCC supports the following AVR devices and ISAs:
19847
19848 "avr2"
19849 "Classic" devices with up to 8 KiB of program memory. mcu =
19850 "attiny22", "attiny26", "at90s2313", "at90s2323", "at90s2333",
19851 "at90s2343", "at90s4414", "at90s4433", "at90s4434",
19852 "at90c8534", "at90s8515", "at90s8535".
19853
19854 "avr25"
19855 "Classic" devices with up to 8 KiB of program memory and with
19856 the "MOVW" instruction. mcu = "attiny13", "attiny13a",
19857 "attiny24", "attiny24a", "attiny25", "attiny261", "attiny261a",
19858 "attiny2313", "attiny2313a", "attiny43u", "attiny44",
19859 "attiny44a", "attiny45", "attiny48", "attiny441", "attiny461",
19860 "attiny461a", "attiny4313", "attiny84", "attiny84a",
19861 "attiny85", "attiny87", "attiny88", "attiny828", "attiny841",
19862 "attiny861", "attiny861a", "ata5272", "ata6616c", "at86rf401".
19863
19864 "avr3"
19865 "Classic" devices with 16 KiB up to 64 KiB of program memory.
19866 mcu = "at76c711", "at43usb355".
19867
19868 "avr31"
19869 "Classic" devices with 128 KiB of program memory. mcu =
19870 "atmega103", "at43usb320".
19871
19872 "avr35"
19873 "Classic" devices with 16 KiB up to 64 KiB of program memory
19874 and with the "MOVW" instruction. mcu = "attiny167",
19875 "attiny1634", "atmega8u2", "atmega16u2", "atmega32u2",
19876 "ata5505", "ata6617c", "ata664251", "at90usb82", "at90usb162".
19877
19878 "avr4"
19879 "Enhanced" devices with up to 8 KiB of program memory. mcu =
19880 "atmega48", "atmega48a", "atmega48p", "atmega48pa",
19881 "atmega48pb", "atmega8", "atmega8a", "atmega8hva", "atmega88",
19882 "atmega88a", "atmega88p", "atmega88pa", "atmega88pb",
19883 "atmega8515", "atmega8535", "ata6285", "ata6286", "ata6289",
19884 "ata6612c", "at90pwm1", "at90pwm2", "at90pwm2b", "at90pwm3",
19885 "at90pwm3b", "at90pwm81".
19886
19887 "avr5"
19888 "Enhanced" devices with 16 KiB up to 64 KiB of program memory.
19889 mcu = "atmega16", "atmega16a", "atmega16hva", "atmega16hva2",
19890 "atmega16hvb", "atmega16hvbrevb", "atmega16m1", "atmega16u4",
19891 "atmega161", "atmega162", "atmega163", "atmega164a",
19892 "atmega164p", "atmega164pa", "atmega165", "atmega165a",
19893 "atmega165p", "atmega165pa", "atmega168", "atmega168a",
19894 "atmega168p", "atmega168pa", "atmega168pb", "atmega169",
19895 "atmega169a", "atmega169p", "atmega169pa", "atmega32",
19896 "atmega32a", "atmega32c1", "atmega32hvb", "atmega32hvbrevb",
19897 "atmega32m1", "atmega32u4", "atmega32u6", "atmega323",
19898 "atmega324a", "atmega324p", "atmega324pa", "atmega324pb",
19899 "atmega325", "atmega325a", "atmega325p", "atmega325pa",
19900 "atmega328", "atmega328p", "atmega328pb", "atmega329",
19901 "atmega329a", "atmega329p", "atmega329pa", "atmega3250",
19902 "atmega3250a", "atmega3250p", "atmega3250pa", "atmega3290",
19903 "atmega3290a", "atmega3290p", "atmega3290pa", "atmega406",
19904 "atmega64", "atmega64a", "atmega64c1", "atmega64hve",
19905 "atmega64hve2", "atmega64m1", "atmega64rfr2", "atmega640",
19906 "atmega644", "atmega644a", "atmega644p", "atmega644pa",
19907 "atmega644rfr2", "atmega645", "atmega645a", "atmega645p",
19908 "atmega649", "atmega649a", "atmega649p", "atmega6450",
19909 "atmega6450a", "atmega6450p", "atmega6490", "atmega6490a",
19910 "atmega6490p", "ata5795", "ata5790", "ata5790n", "ata5791",
19911 "ata6613c", "ata6614q", "ata5782", "ata5831", "ata8210",
19912 "ata8510", "ata5702m322", "at90pwm161", "at90pwm216",
19913 "at90pwm316", "at90can32", "at90can64", "at90scr100",
19914 "at90usb646", "at90usb647", "at94k", "m3000".
19915
19916 "avr51"
19917 "Enhanced" devices with 128 KiB of program memory. mcu =
19918 "atmega128", "atmega128a", "atmega128rfa1", "atmega128rfr2",
19919 "atmega1280", "atmega1281", "atmega1284", "atmega1284p",
19920 "atmega1284rfr2", "at90can128", "at90usb1286", "at90usb1287".
19921
19922 "avr6"
19923 "Enhanced" devices with 3-byte PC, i.e. with more than 128 KiB
19924 of program memory. mcu = "atmega256rfr2", "atmega2560",
19925 "atmega2561", "atmega2564rfr2".
19926
19927 "avrxmega2"
19928 "XMEGA" devices with more than 8 KiB and up to 64 KiB of
19929 program memory. mcu = "atxmega8e5", "atxmega16a4",
19930 "atxmega16a4u", "atxmega16c4", "atxmega16d4", "atxmega16e5",
19931 "atxmega32a4", "atxmega32a4u", "atxmega32c3", "atxmega32c4",
19932 "atxmega32d3", "atxmega32d4", "atxmega32e5", "avr64da28",
19933 "avr64da32", "avr64da48", "avr64da64", "avr64db28",
19934 "avr64db32", "avr64db48", "avr64db64", "avr64dd14",
19935 "avr64dd20", "avr64dd28", "avr64dd32", "avr64ea28",
19936 "avr64ea32", "avr64ea48".
19937
19938 "avrxmega3"
19939 "XMEGA" devices with up to 64 KiB of combined program memory
19940 and RAM, and with program memory visible in the RAM address
19941 space. mcu = "attiny202", "attiny204", "attiny212",
19942 "attiny214", "attiny402", "attiny404", "attiny406",
19943 "attiny412", "attiny414", "attiny416", "attiny417",
19944 "attiny424", "attiny426", "attiny427", "attiny804",
19945 "attiny806", "attiny807", "attiny814", "attiny816",
19946 "attiny817", "attiny824", "attiny826", "attiny827",
19947 "attiny1604", "attiny1606", "attiny1607", "attiny1614",
19948 "attiny1616", "attiny1617", "attiny1624", "attiny1626",
19949 "attiny1627", "attiny3214", "attiny3216", "attiny3217",
19950 "attiny3224", "attiny3226", "attiny3227", "atmega808",
19951 "atmega809", "atmega1608", "atmega1609", "atmega3208",
19952 "atmega3209", "atmega4808", "atmega4809", "avr16dd14",
19953 "avr16dd20", "avr16dd28", "avr16dd32", "avr32da28",
19954 "avr32da32", "avr32da48", "avr32db28", "avr32db32",
19955 "avr32db48", "avr32dd14", "avr32dd20", "avr32dd28",
19956 "avr32dd32".
19957
19958 "avrxmega4"
19959 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
19960 program memory. mcu = "atxmega64a3", "atxmega64a3u",
19961 "atxmega64a4u", "atxmega64b1", "atxmega64b3", "atxmega64c3",
19962 "atxmega64d3", "atxmega64d4", "avr128da28", "avr128da32",
19963 "avr128da48", "avr128da64", "avr128db28", "avr128db32",
19964 "avr128db48", "avr128db64".
19965
19966 "avrxmega5"
19967 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
19968 program memory and more than 64 KiB of RAM. mcu =
19969 "atxmega64a1", "atxmega64a1u".
19970
19971 "avrxmega6"
19972 "XMEGA" devices with more than 128 KiB of program memory. mcu
19973 = "atxmega128a3", "atxmega128a3u", "atxmega128b1",
19974 "atxmega128b3", "atxmega128c3", "atxmega128d3", "atxmega128d4",
19975 "atxmega192a3", "atxmega192a3u", "atxmega192c3",
19976 "atxmega192d3", "atxmega256a3", "atxmega256a3b",
19977 "atxmega256a3bu", "atxmega256a3u", "atxmega256c3",
19978 "atxmega256d3", "atxmega384c3", "atxmega384d3".
19979
19980 "avrxmega7"
19981 "XMEGA" devices with more than 128 KiB of program memory and
19982 more than 64 KiB of RAM. mcu = "atxmega128a1",
19983 "atxmega128a1u", "atxmega128a4u".
19984
19985 "avrtiny"
19986 "TINY" Tiny core devices with 512 B up to 4 KiB of program
19987 memory. mcu = "attiny4", "attiny5", "attiny9", "attiny10",
19988 "attiny102", "attiny104", "attiny20", "attiny40".
19989
19990 "avr1"
19991 This ISA is implemented by the minimal AVR core and supported
19992 for assembler only. mcu = "attiny11", "attiny12", "attiny15",
19993 "attiny28", "at90s1200".
19994
19995 -mabsdata
19996 Assume that all data in static storage can be accessed by LDS / STS
19997 instructions. This option has only an effect on reduced Tiny
19998 devices like ATtiny40. See also the "absdata" AVR Variable
19999 Attributes,variable attribute.
20000
20001 -maccumulate-args
20002 Accumulate outgoing function arguments and acquire/release the
20003 needed stack space for outgoing function arguments once in function
20004 prologue/epilogue. Without this option, outgoing arguments are
20005 pushed before calling a function and popped afterwards.
20006
20007 Popping the arguments after the function call can be expensive on
20008 AVR so that accumulating the stack space might lead to smaller
20009 executables because arguments need not be removed from the stack
20010 after such a function call.
20011
20012 This option can lead to reduced code size for functions that
20013 perform several calls to functions that get their arguments on the
20014 stack like calls to printf-like functions.
20015
20016 -mbranch-cost=cost
20017 Set the branch costs for conditional branch instructions to cost.
20018 Reasonable values for cost are small, non-negative integers. The
20019 default branch cost is 0.
20020
20021 -mcall-prologues
20022 Functions prologues/epilogues are expanded as calls to appropriate
20023 subroutines. Code size is smaller.
20024
20025 -mdouble=bits
20026 -mlong-double=bits
20027 Set the size (in bits) of the "double" or "long double" type,
20028 respectively. Possible values for bits are 32 and 64. Whether or
20029 not a specific value for bits is allowed depends on the
20030 "--with-double=" and "--with-long-double=" configure options
20031 ("https://gcc.gnu.org/install/configure.html#avr"), and the same
20032 applies for the default values of the options.
20033
20034 -mgas-isr-prologues
20035 Interrupt service routines (ISRs) may use the "__gcc_isr" pseudo
20036 instruction supported by GNU Binutils. If this option is on, the
20037 feature can still be disabled for individual ISRs by means of the
20038 AVR Function Attributes,,"no_gccisr" function attribute. This
20039 feature is activated per default if optimization is on (but not
20040 with -Og, @pxref{Optimize Options}), and if GNU Binutils support
20041 PR21683 ("https://sourceware.org/PR21683").
20042
20043 -mint8
20044 Assume "int" to be 8-bit integer. This affects the sizes of all
20045 types: a "char" is 1 byte, an "int" is 1 byte, a "long" is 2 bytes,
20046 and "long long" is 4 bytes. Please note that this option does not
20047 conform to the C standards, but it results in smaller code size.
20048
20049 -mmain-is-OS_task
20050 Do not save registers in "main". The effect is the same like
20051 attaching attribute AVR Function Attributes,,"OS_task" to "main".
20052 It is activated per default if optimization is on.
20053
20054 -mn-flash=num
20055 Assume that the flash memory has a size of num times 64 KiB.
20056
20057 -mno-interrupts
20058 Generated code is not compatible with hardware interrupts. Code
20059 size is smaller.
20060
20061 -mrelax
20062 Try to replace "CALL" resp. "JMP" instruction by the shorter
20063 "RCALL" resp. "RJMP" instruction if applicable. Setting -mrelax
20064 just adds the --mlink-relax option to the assembler's command line
20065 and the --relax option to the linker's command line.
20066
20067 Jump relaxing is performed by the linker because jump offsets are
20068 not known before code is located. Therefore, the assembler code
20069 generated by the compiler is the same, but the instructions in the
20070 executable may differ from instructions in the assembler code.
20071
20072 Relaxing must be turned on if linker stubs are needed, see the
20073 section on "EIND" and linker stubs below.
20074
20075 -mrmw
20076 Assume that the device supports the Read-Modify-Write instructions
20077 "XCH", "LAC", "LAS" and "LAT".
20078
20079 -mshort-calls
20080 Assume that "RJMP" and "RCALL" can target the whole program memory.
20081
20082 This option is used internally for multilib selection. It is not
20083 an optimization option, and you don't need to set it by hand.
20084
20085 -msp8
20086 Treat the stack pointer register as an 8-bit register, i.e. assume
20087 the high byte of the stack pointer is zero. In general, you don't
20088 need to set this option by hand.
20089
20090 This option is used internally by the compiler to select and build
20091 multilibs for architectures "avr2" and "avr25". These
20092 architectures mix devices with and without "SPH". For any setting
20093 other than -mmcu=avr2 or -mmcu=avr25 the compiler driver adds or
20094 removes this option from the compiler proper's command line,
20095 because the compiler then knows if the device or architecture has
20096 an 8-bit stack pointer and thus no "SPH" register or not.
20097
20098 -mstrict-X
20099 Use address register "X" in a way proposed by the hardware. This
20100 means that "X" is only used in indirect, post-increment or pre-
20101 decrement addressing.
20102
20103 Without this option, the "X" register may be used in the same way
20104 as "Y" or "Z" which then is emulated by additional instructions.
20105 For example, loading a value with "X+const" addressing with a small
20106 non-negative "const < 64" to a register Rn is performed as
20107
20108 adiw r26, const ; X += const
20109 ld <Rn>, X ; <Rn> = *X
20110 sbiw r26, const ; X -= const
20111
20112 -mtiny-stack
20113 Only change the lower 8 bits of the stack pointer.
20114
20115 -mfract-convert-truncate
20116 Allow to use truncation instead of rounding towards zero for
20117 fractional fixed-point types.
20118
20119 -nodevicelib
20120 Don't link against AVR-LibC's device specific library "lib<mcu>.a".
20121
20122 -nodevicespecs
20123 Don't add -specs=device-specs/specs-mcu to the compiler driver's
20124 command line. The user takes responsibility for supplying the sub-
20125 processes like compiler proper, assembler and linker with
20126 appropriate command line options. This means that the user has to
20127 supply her private device specs file by means of -specs=path-to-
20128 specs-file. There is no more need for option -mmcu=mcu.
20129
20130 This option can also serve as a replacement for the older way of
20131 specifying custom device-specs files that needed -B some-path to
20132 point to a directory which contains a folder named "device-specs"
20133 which contains a specs file named "specs-mcu", where mcu was
20134 specified by -mmcu=mcu.
20135
20136 -Waddr-space-convert
20137 Warn about conversions between address spaces in the case where the
20138 resulting address space is not contained in the incoming address
20139 space.
20140
20141 -Wmisspelled-isr
20142 Warn if the ISR is misspelled, i.e. without __vector prefix.
20143 Enabled by default.
20144
20145 "EIND" and Devices with More Than 128 Ki Bytes of Flash
20146
20147 Pointers in the implementation are 16 bits wide. The address of a
20148 function or label is represented as word address so that indirect jumps
20149 and calls can target any code address in the range of 64 Ki words.
20150
20151 In order to facilitate indirect jump on devices with more than 128 Ki
20152 bytes of program memory space, there is a special function register
20153 called "EIND" that serves as most significant part of the target
20154 address when "EICALL" or "EIJMP" instructions are used.
20155
20156 Indirect jumps and calls on these devices are handled as follows by the
20157 compiler and are subject to some limitations:
20158
20159 * The compiler never sets "EIND".
20160
20161 * The compiler uses "EIND" implicitly in "EICALL"/"EIJMP"
20162 instructions or might read "EIND" directly in order to emulate an
20163 indirect call/jump by means of a "RET" instruction.
20164
20165 * The compiler assumes that "EIND" never changes during the startup
20166 code or during the application. In particular, "EIND" is not
20167 saved/restored in function or interrupt service routine
20168 prologue/epilogue.
20169
20170 * For indirect calls to functions and computed goto, the linker
20171 generates stubs. Stubs are jump pads sometimes also called
20172 trampolines. Thus, the indirect call/jump jumps to such a stub.
20173 The stub contains a direct jump to the desired address.
20174
20175 * Linker relaxation must be turned on so that the linker generates
20176 the stubs correctly in all situations. See the compiler option
20177 -mrelax and the linker option --relax. There are corner cases
20178 where the linker is supposed to generate stubs but aborts without
20179 relaxation and without a helpful error message.
20180
20181 * The default linker script is arranged for code with "EIND = 0". If
20182 code is supposed to work for a setup with "EIND != 0", a custom
20183 linker script has to be used in order to place the sections whose
20184 name start with ".trampolines" into the segment where "EIND" points
20185 to.
20186
20187 * The startup code from libgcc never sets "EIND". Notice that
20188 startup code is a blend of code from libgcc and AVR-LibC. For the
20189 impact of AVR-LibC on "EIND", see the AVR-LibC user manual
20190 ("https://www.nongnu.org/avr-libc/user-manual/").
20191
20192 * It is legitimate for user-specific startup code to set up "EIND"
20193 early, for example by means of initialization code located in
20194 section ".init3". Such code runs prior to general startup code that
20195 initializes RAM and calls constructors, but after the bit of
20196 startup code from AVR-LibC that sets "EIND" to the segment where
20197 the vector table is located.
20198
20199 #include <avr/io.h>
20200
20201 static void
20202 __attribute__((section(".init3"),naked,used,no_instrument_function))
20203 init3_set_eind (void)
20204 {
20205 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
20206 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
20207 }
20208
20209 The "__trampolines_start" symbol is defined in the linker script.
20210
20211 * Stubs are generated automatically by the linker if the following
20212 two conditions are met:
20213
20214 -<The address of a label is taken by means of the "gs" modifier>
20215 (short for generate stubs) like so:
20216
20217 LDI r24, lo8(gs(<func>))
20218 LDI r25, hi8(gs(<func>))
20219
20220 -<The final location of that label is in a code segment>
20221 outside the segment where the stubs are located.
20222
20223 * The compiler emits such "gs" modifiers for code labels in the
20224 following situations:
20225
20226 -<Taking address of a function or code label.>
20227 -<Computed goto.>
20228 -<If prologue-save function is used, see -mcall-prologues>
20229 command-line option.
20230
20231 -<Switch/case dispatch tables. If you do not want such dispatch>
20232 tables you can specify the -fno-jump-tables command-line
20233 option.
20234
20235 -<C and C++ constructors/destructors called during
20236 startup/shutdown.>
20237 -<If the tools hit a gs() modifier explained above.>
20238 * Jumping to non-symbolic addresses like so is not supported:
20239
20240 int main (void)
20241 {
20242 /* Call function at word address 0x2 */
20243 return ((int(*)(void)) 0x2)();
20244 }
20245
20246 Instead, a stub has to be set up, i.e. the function has to be
20247 called through a symbol ("func_4" in the example):
20248
20249 int main (void)
20250 {
20251 extern int func_4 (void);
20252
20253 /* Call function at byte address 0x4 */
20254 return func_4();
20255 }
20256
20257 and the application be linked with -Wl,--defsym,func_4=0x4.
20258 Alternatively, "func_4" can be defined in the linker script.
20259
20260 Handling of the "RAMPD", "RAMPX", "RAMPY" and "RAMPZ" Special Function
20261 Registers
20262
20263 Some AVR devices support memories larger than the 64 KiB range that can
20264 be accessed with 16-bit pointers. To access memory locations outside
20265 this 64 KiB range, the content of a "RAMP" register is used as high
20266 part of the address: The "X", "Y", "Z" address register is concatenated
20267 with the "RAMPX", "RAMPY", "RAMPZ" special function register,
20268 respectively, to get a wide address. Similarly, "RAMPD" is used
20269 together with direct addressing.
20270
20271 * The startup code initializes the "RAMP" special function registers
20272 with zero.
20273
20274 * If a AVR Named Address Spaces,named address space other than
20275 generic or "__flash" is used, then "RAMPZ" is set as needed before
20276 the operation.
20277
20278 * If the device supports RAM larger than 64 KiB and the compiler
20279 needs to change "RAMPZ" to accomplish an operation, "RAMPZ" is
20280 reset to zero after the operation.
20281
20282 * If the device comes with a specific "RAMP" register, the ISR
20283 prologue/epilogue saves/restores that SFR and initializes it with
20284 zero in case the ISR code might (implicitly) use it.
20285
20286 * RAM larger than 64 KiB is not supported by GCC for AVR targets. If
20287 you use inline assembler to read from locations outside the 16-bit
20288 address range and change one of the "RAMP" registers, you must
20289 reset it to zero after the access.
20290
20291 AVR Built-in Macros
20292
20293 GCC defines several built-in macros so that the user code can test for
20294 the presence or absence of features. Almost any of the following
20295 built-in macros are deduced from device capabilities and thus triggered
20296 by the -mmcu= command-line option.
20297
20298 For even more AVR-specific built-in macros see AVR Named Address Spaces
20299 and AVR Built-in Functions.
20300
20301 "__AVR_ARCH__"
20302 Build-in macro that resolves to a decimal number that identifies
20303 the architecture and depends on the -mmcu=mcu option. Possible
20304 values are:
20305
20306 2, 25, 3, 31, 35, 4, 5, 51, 6
20307
20308 for mcu="avr2", "avr25", "avr3", "avr31", "avr35", "avr4", "avr5",
20309 "avr51", "avr6",
20310
20311 respectively and
20312
20313 100, 102, 103, 104, 105, 106, 107
20314
20315 for mcu="avrtiny", "avrxmega2", "avrxmega3", "avrxmega4",
20316 "avrxmega5", "avrxmega6", "avrxmega7", respectively. If mcu
20317 specifies a device, this built-in macro is set accordingly. For
20318 example, with -mmcu=atmega8 the macro is defined to 4.
20319
20320 "__AVR_Device__"
20321 Setting -mmcu=device defines this built-in macro which reflects the
20322 device's name. For example, -mmcu=atmega8 defines the built-in
20323 macro "__AVR_ATmega8__", -mmcu=attiny261a defines
20324 "__AVR_ATtiny261A__", etc.
20325
20326 The built-in macros' names follow the scheme "__AVR_Device__" where
20327 Device is the device name as from the AVR user manual. The
20328 difference between Device in the built-in macro and device in
20329 -mmcu=device is that the latter is always lowercase.
20330
20331 If device is not a device but only a core architecture like avr51,
20332 this macro is not defined.
20333
20334 "__AVR_DEVICE_NAME__"
20335 Setting -mmcu=device defines this built-in macro to the device's
20336 name. For example, with -mmcu=atmega8 the macro is defined to
20337 "atmega8".
20338
20339 If device is not a device but only a core architecture like avr51,
20340 this macro is not defined.
20341
20342 "__AVR_XMEGA__"
20343 The device / architecture belongs to the XMEGA family of devices.
20344
20345 "__AVR_HAVE_ELPM__"
20346 The device has the "ELPM" instruction.
20347
20348 "__AVR_HAVE_ELPMX__"
20349 The device has the "ELPM Rn,Z" and "ELPM Rn,Z+" instructions.
20350
20351 "__AVR_HAVE_MOVW__"
20352 The device has the "MOVW" instruction to perform 16-bit register-
20353 register moves.
20354
20355 "__AVR_HAVE_LPMX__"
20356 The device has the "LPM Rn,Z" and "LPM Rn,Z+" instructions.
20357
20358 "__AVR_HAVE_MUL__"
20359 The device has a hardware multiplier.
20360
20361 "__AVR_HAVE_JMP_CALL__"
20362 The device has the "JMP" and "CALL" instructions. This is the case
20363 for devices with more than 8 KiB of program memory.
20364
20365 "__AVR_HAVE_EIJMP_EICALL__"
20366 "__AVR_3_BYTE_PC__"
20367 The device has the "EIJMP" and "EICALL" instructions. This is the
20368 case for devices with more than 128 KiB of program memory. This
20369 also means that the program counter (PC) is 3 bytes wide.
20370
20371 "__AVR_2_BYTE_PC__"
20372 The program counter (PC) is 2 bytes wide. This is the case for
20373 devices with up to 128 KiB of program memory.
20374
20375 "__AVR_HAVE_8BIT_SP__"
20376 "__AVR_HAVE_16BIT_SP__"
20377 The stack pointer (SP) register is treated as 8-bit respectively
20378 16-bit register by the compiler. The definition of these macros is
20379 affected by -mtiny-stack.
20380
20381 "__AVR_HAVE_SPH__"
20382 "__AVR_SP8__"
20383 The device has the SPH (high part of stack pointer) special
20384 function register or has an 8-bit stack pointer, respectively. The
20385 definition of these macros is affected by -mmcu= and in the cases
20386 of -mmcu=avr2 and -mmcu=avr25 also by -msp8.
20387
20388 "__AVR_HAVE_RAMPD__"
20389 "__AVR_HAVE_RAMPX__"
20390 "__AVR_HAVE_RAMPY__"
20391 "__AVR_HAVE_RAMPZ__"
20392 The device has the "RAMPD", "RAMPX", "RAMPY", "RAMPZ" special
20393 function register, respectively.
20394
20395 "__NO_INTERRUPTS__"
20396 This macro reflects the -mno-interrupts command-line option.
20397
20398 "__AVR_ERRATA_SKIP__"
20399 "__AVR_ERRATA_SKIP_JMP_CALL__"
20400 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
20401 instructions because of a hardware erratum. Skip instructions are
20402 "SBRS", "SBRC", "SBIS", "SBIC" and "CPSE". The second macro is
20403 only defined if "__AVR_HAVE_JMP_CALL__" is also set.
20404
20405 "__AVR_ISA_RMW__"
20406 The device has Read-Modify-Write instructions (XCH, LAC, LAS and
20407 LAT).
20408
20409 "__AVR_SFR_OFFSET__=offset"
20410 Instructions that can address I/O special function registers
20411 directly like "IN", "OUT", "SBI", etc. may use a different address
20412 as if addressed by an instruction to access RAM like "LD" or "STS".
20413 This offset depends on the device architecture and has to be
20414 subtracted from the RAM address in order to get the respective I/O
20415 address.
20416
20417 "__AVR_SHORT_CALLS__"
20418 The -mshort-calls command line option is set.
20419
20420 "__AVR_PM_BASE_ADDRESS__=addr"
20421 Some devices support reading from flash memory by means of "LD*"
20422 instructions. The flash memory is seen in the data address space
20423 at an offset of "__AVR_PM_BASE_ADDRESS__". If this macro is not
20424 defined, this feature is not available. If defined, the address
20425 space is linear and there is no need to put ".rodata" into RAM.
20426 This is handled by the default linker description file, and is
20427 currently available for "avrtiny" and "avrxmega3". Even more
20428 convenient, there is no need to use address spaces like "__flash"
20429 or features like attribute "progmem" and "pgm_read_*".
20430
20431 "__WITH_AVRLIBC__"
20432 The compiler is configured to be used together with AVR-Libc. See
20433 the --with-avrlibc configure option.
20434
20435 "__HAVE_DOUBLE_MULTILIB__"
20436 Defined if -mdouble= acts as a multilib option.
20437
20438 "__HAVE_DOUBLE32__"
20439 "__HAVE_DOUBLE64__"
20440 Defined if the compiler supports 32-bit double resp. 64-bit double.
20441 The actual layout is specified by option -mdouble=.
20442
20443 "__DEFAULT_DOUBLE__"
20444 The size in bits of "double" if -mdouble= is not set. To test the
20445 layout of "double" in a program, use the built-in macro
20446 "__SIZEOF_DOUBLE__".
20447
20448 "__HAVE_LONG_DOUBLE32__"
20449 "__HAVE_LONG_DOUBLE64__"
20450 "__HAVE_LONG_DOUBLE_MULTILIB__"
20451 "__DEFAULT_LONG_DOUBLE__"
20452 Same as above, but for "long double" instead of "double".
20453
20454 "__WITH_DOUBLE_COMPARISON__"
20455 Reflects the "--with-double-comparison={tristate|bool|libf7}"
20456 configure option ("https://gcc.gnu.org/install/configure.html#avr")
20457 and is defined to 2 or 3.
20458
20459 "__WITH_LIBF7_LIBGCC__"
20460 "__WITH_LIBF7_MATH__"
20461 "__WITH_LIBF7_MATH_SYMBOLS__"
20462 Reflects the "--with-libf7={libgcc|math|math-symbols}"
20463 configure option
20464 ("https://gcc.gnu.org/install/configure.html#avr").
20465
20466 Blackfin Options
20467 -mcpu=cpu[-sirevision]
20468 Specifies the name of the target Blackfin processor. Currently,
20469 cpu can be one of bf512, bf514, bf516, bf518, bf522, bf523, bf524,
20470 bf525, bf526, bf527, bf531, bf532, bf533, bf534, bf536, bf537,
20471 bf538, bf539, bf542, bf544, bf547, bf548, bf549, bf542m, bf544m,
20472 bf547m, bf548m, bf549m, bf561, bf592.
20473
20474 The optional sirevision specifies the silicon revision of the
20475 target Blackfin processor. Any workarounds available for the
20476 targeted silicon revision are enabled. If sirevision is none, no
20477 workarounds are enabled. If sirevision is any, all workarounds for
20478 the targeted processor are enabled. The "__SILICON_REVISION__"
20479 macro is defined to two hexadecimal digits representing the major
20480 and minor numbers in the silicon revision. If sirevision is none,
20481 the "__SILICON_REVISION__" is not defined. If sirevision is any,
20482 the "__SILICON_REVISION__" is defined to be 0xffff. If this
20483 optional sirevision is not used, GCC assumes the latest known
20484 silicon revision of the targeted Blackfin processor.
20485
20486 GCC defines a preprocessor macro for the specified cpu. For the
20487 bfin-elf toolchain, this option causes the hardware BSP provided by
20488 libgloss to be linked in if -msim is not given.
20489
20490 Without this option, bf532 is used as the processor by default.
20491
20492 Note that support for bf561 is incomplete. For bf561, only the
20493 preprocessor macro is defined.
20494
20495 -msim
20496 Specifies that the program will be run on the simulator. This
20497 causes the simulator BSP provided by libgloss to be linked in.
20498 This option has effect only for bfin-elf toolchain. Certain other
20499 options, such as -mid-shared-library and -mfdpic, imply -msim.
20500
20501 -momit-leaf-frame-pointer
20502 Don't keep the frame pointer in a register for leaf functions.
20503 This avoids the instructions to save, set up and restore frame
20504 pointers and makes an extra register available in leaf functions.
20505
20506 -mspecld-anomaly
20507 When enabled, the compiler ensures that the generated code does not
20508 contain speculative loads after jump instructions. If this option
20509 is used, "__WORKAROUND_SPECULATIVE_LOADS" is defined.
20510
20511 -mno-specld-anomaly
20512 Don't generate extra code to prevent speculative loads from
20513 occurring.
20514
20515 -mcsync-anomaly
20516 When enabled, the compiler ensures that the generated code does not
20517 contain CSYNC or SSYNC instructions too soon after conditional
20518 branches. If this option is used, "__WORKAROUND_SPECULATIVE_SYNCS"
20519 is defined.
20520
20521 -mno-csync-anomaly
20522 Don't generate extra code to prevent CSYNC or SSYNC instructions
20523 from occurring too soon after a conditional branch.
20524
20525 -mlow64k
20526 When enabled, the compiler is free to take advantage of the
20527 knowledge that the entire program fits into the low 64k of memory.
20528
20529 -mno-low64k
20530 Assume that the program is arbitrarily large. This is the default.
20531
20532 -mstack-check-l1
20533 Do stack checking using information placed into L1 scratchpad
20534 memory by the uClinux kernel.
20535
20536 -mid-shared-library
20537 Generate code that supports shared libraries via the library ID
20538 method. This allows for execute in place and shared libraries in
20539 an environment without virtual memory management. This option
20540 implies -fPIC. With a bfin-elf target, this option implies -msim.
20541
20542 -mno-id-shared-library
20543 Generate code that doesn't assume ID-based shared libraries are
20544 being used. This is the default.
20545
20546 -mleaf-id-shared-library
20547 Generate code that supports shared libraries via the library ID
20548 method, but assumes that this library or executable won't link
20549 against any other ID shared libraries. That allows the compiler to
20550 use faster code for jumps and calls.
20551
20552 -mno-leaf-id-shared-library
20553 Do not assume that the code being compiled won't link against any
20554 ID shared libraries. Slower code is generated for jump and call
20555 insns.
20556
20557 -mshared-library-id=n
20558 Specifies the identification number of the ID-based shared library
20559 being compiled. Specifying a value of 0 generates more compact
20560 code; specifying other values forces the allocation of that number
20561 to the current library but is no more space- or time-efficient than
20562 omitting this option.
20563
20564 -msep-data
20565 Generate code that allows the data segment to be located in a
20566 different area of memory from the text segment. This allows for
20567 execute in place in an environment without virtual memory
20568 management by eliminating relocations against the text section.
20569
20570 -mno-sep-data
20571 Generate code that assumes that the data segment follows the text
20572 segment. This is the default.
20573
20574 -mlong-calls
20575 -mno-long-calls
20576 Tells the compiler to perform function calls by first loading the
20577 address of the function into a register and then performing a
20578 subroutine call on this register. This switch is needed if the
20579 target function lies outside of the 24-bit addressing range of the
20580 offset-based version of subroutine call instruction.
20581
20582 This feature is not enabled by default. Specifying -mno-long-calls
20583 restores the default behavior. Note these switches have no effect
20584 on how the compiler generates code to handle function calls via
20585 function pointers.
20586
20587 -mfast-fp
20588 Link with the fast floating-point library. This library relaxes
20589 some of the IEEE floating-point standard's rules for checking
20590 inputs against Not-a-Number (NAN), in the interest of performance.
20591
20592 -minline-plt
20593 Enable inlining of PLT entries in function calls to functions that
20594 are not known to bind locally. It has no effect without -mfdpic.
20595
20596 -mmulticore
20597 Build a standalone application for multicore Blackfin processors.
20598 This option causes proper start files and link scripts supporting
20599 multicore to be used, and defines the macro "__BFIN_MULTICORE". It
20600 can only be used with -mcpu=bf561[-sirevision].
20601
20602 This option can be used with -mcorea or -mcoreb, which selects the
20603 one-application-per-core programming model. Without -mcorea or
20604 -mcoreb, the single-application/dual-core programming model is
20605 used. In this model, the main function of Core B should be named as
20606 "coreb_main".
20607
20608 If this option is not used, the single-core application programming
20609 model is used.
20610
20611 -mcorea
20612 Build a standalone application for Core A of BF561 when using the
20613 one-application-per-core programming model. Proper start files and
20614 link scripts are used to support Core A, and the macro
20615 "__BFIN_COREA" is defined. This option can only be used in
20616 conjunction with -mmulticore.
20617
20618 -mcoreb
20619 Build a standalone application for Core B of BF561 when using the
20620 one-application-per-core programming model. Proper start files and
20621 link scripts are used to support Core B, and the macro
20622 "__BFIN_COREB" is defined. When this option is used, "coreb_main"
20623 should be used instead of "main". This option can only be used in
20624 conjunction with -mmulticore.
20625
20626 -msdram
20627 Build a standalone application for SDRAM. Proper start files and
20628 link scripts are used to put the application into SDRAM, and the
20629 macro "__BFIN_SDRAM" is defined. The loader should initialize
20630 SDRAM before loading the application.
20631
20632 -micplb
20633 Assume that ICPLBs are enabled at run time. This has an effect on
20634 certain anomaly workarounds. For Linux targets, the default is to
20635 assume ICPLBs are enabled; for standalone applications the default
20636 is off.
20637
20638 C6X Options
20639 -march=name
20640 This specifies the name of the target architecture. GCC uses this
20641 name to determine what kind of instructions it can emit when
20642 generating assembly code. Permissible names are: c62x, c64x,
20643 c64x+, c67x, c67x+, c674x.
20644
20645 -mbig-endian
20646 Generate code for a big-endian target.
20647
20648 -mlittle-endian
20649 Generate code for a little-endian target. This is the default.
20650
20651 -msim
20652 Choose startup files and linker script suitable for the simulator.
20653
20654 -msdata=default
20655 Put small global and static data in the ".neardata" section, which
20656 is pointed to by register "B14". Put small uninitialized global
20657 and static data in the ".bss" section, which is adjacent to the
20658 ".neardata" section. Put small read-only data into the ".rodata"
20659 section. The corresponding sections used for large pieces of data
20660 are ".fardata", ".far" and ".const".
20661
20662 -msdata=all
20663 Put all data, not just small objects, into the sections reserved
20664 for small data, and use addressing relative to the "B14" register
20665 to access them.
20666
20667 -msdata=none
20668 Make no use of the sections reserved for small data, and use
20669 absolute addresses to access all data. Put all initialized global
20670 and static data in the ".fardata" section, and all uninitialized
20671 data in the ".far" section. Put all constant data into the
20672 ".const" section.
20673
20674 CRIS Options
20675 These options are defined specifically for the CRIS ports.
20676
20677 -march=architecture-type
20678 -mcpu=architecture-type
20679 Generate code for the specified architecture. The choices for
20680 architecture-type are v3, v8 and v10 for respectively ETRAX 4,
20681 ETRAX 100, and ETRAX 100 LX. Default is v0.
20682
20683 -mtune=architecture-type
20684 Tune to architecture-type everything applicable about the generated
20685 code, except for the ABI and the set of available instructions.
20686 The choices for architecture-type are the same as for
20687 -march=architecture-type.
20688
20689 -mmax-stack-frame=n
20690 Warn when the stack frame of a function exceeds n bytes.
20691
20692 -metrax4
20693 -metrax100
20694 The options -metrax4 and -metrax100 are synonyms for -march=v3 and
20695 -march=v8 respectively.
20696
20697 -mmul-bug-workaround
20698 -mno-mul-bug-workaround
20699 Work around a bug in the "muls" and "mulu" instructions for CPU
20700 models where it applies. This option is disabled by default.
20701
20702 -mpdebug
20703 Enable CRIS-specific verbose debug-related information in the
20704 assembly code. This option also has the effect of turning off the
20705 #NO_APP formatted-code indicator to the assembler at the beginning
20706 of the assembly file.
20707
20708 -mcc-init
20709 Do not use condition-code results from previous instruction; always
20710 emit compare and test instructions before use of condition codes.
20711
20712 -mno-side-effects
20713 Do not emit instructions with side effects in addressing modes
20714 other than post-increment.
20715
20716 -mstack-align
20717 -mno-stack-align
20718 -mdata-align
20719 -mno-data-align
20720 -mconst-align
20721 -mno-const-align
20722 These options (no- options) arrange (eliminate arrangements) for
20723 the stack frame, individual data and constants to be aligned for
20724 the maximum single data access size for the chosen CPU model. The
20725 default is to arrange for 32-bit alignment. ABI details such as
20726 structure layout are not affected by these options.
20727
20728 -m32-bit
20729 -m16-bit
20730 -m8-bit
20731 Similar to the stack- data- and const-align options above, these
20732 options arrange for stack frame, writable data and constants to all
20733 be 32-bit, 16-bit or 8-bit aligned. The default is 32-bit
20734 alignment.
20735
20736 -mno-prologue-epilogue
20737 -mprologue-epilogue
20738 With -mno-prologue-epilogue, the normal function prologue and
20739 epilogue which set up the stack frame are omitted and no return
20740 instructions or return sequences are generated in the code. Use
20741 this option only together with visual inspection of the compiled
20742 code: no warnings or errors are generated when call-saved registers
20743 must be saved, or storage for local variables needs to be
20744 allocated.
20745
20746 -melf
20747 Legacy no-op option.
20748
20749 -sim
20750 This option arranges to link with input-output functions from a
20751 simulator library. Code, initialized data and zero-initialized
20752 data are allocated consecutively.
20753
20754 -sim2
20755 Like -sim, but pass linker options to locate initialized data at
20756 0x40000000 and zero-initialized data at 0x80000000.
20757
20758 C-SKY Options
20759 GCC supports these options when compiling for C-SKY V2 processors.
20760
20761 -march=arch
20762 Specify the C-SKY target architecture. Valid values for arch are:
20763 ck801, ck802, ck803, ck807, and ck810. The default is ck810.
20764
20765 -mcpu=cpu
20766 Specify the C-SKY target processor. Valid values for cpu are:
20767 ck801, ck801t, ck802, ck802t, ck802j, ck803, ck803h, ck803t,
20768 ck803ht, ck803f, ck803fh, ck803e, ck803eh, ck803et, ck803eht,
20769 ck803ef, ck803efh, ck803ft, ck803eft, ck803efht, ck803r1, ck803hr1,
20770 ck803tr1, ck803htr1, ck803fr1, ck803fhr1, ck803er1, ck803ehr1,
20771 ck803etr1, ck803ehtr1, ck803efr1, ck803efhr1, ck803ftr1,
20772 ck803eftr1, ck803efhtr1, ck803s, ck803st, ck803se, ck803sf,
20773 ck803sef, ck803seft, ck807e, ck807ef, ck807, ck807f, ck810e,
20774 ck810et, ck810ef, ck810eft, ck810, ck810v, ck810f, ck810t, ck810fv,
20775 ck810tv, ck810ft, and ck810ftv.
20776
20777 -mbig-endian
20778 -EB
20779 -mlittle-endian
20780 -EL Select big- or little-endian code. The default is little-endian.
20781
20782 -mfloat-abi=name
20783 Specifies which floating-point ABI to use. Permissible values are:
20784 soft, softfp and hard.
20785
20786 Specifying soft causes GCC to generate output containing library
20787 calls for floating-point operations. softfp allows the generation
20788 of code using hardware floating-point instructions, but still uses
20789 the soft-float calling conventions. hard allows generation of
20790 floating-point instructions and uses FPU-specific calling
20791 conventions.
20792
20793 The default depends on the specific target configuration. Note
20794 that the hard-float and soft-float ABIs are not link-compatible;
20795 you must compile your entire program with the same ABI, and link
20796 with a compatible set of libraries.
20797
20798 -mhard-float
20799 -msoft-float
20800 Select hardware or software floating-point implementations. The
20801 default is soft float.
20802
20803 -mdouble-float
20804 -mno-double-float
20805 When -mhard-float is in effect, enable generation of double-
20806 precision float instructions. This is the default except when
20807 compiling for CK803.
20808
20809 -mfdivdu
20810 -mno-fdivdu
20811 When -mhard-float is in effect, enable generation of "frecipd",
20812 "fsqrtd", and "fdivd" instructions. This is the default except
20813 when compiling for CK803.
20814
20815 -mfpu=fpu
20816 Select the floating-point processor. This option can only be used
20817 with -mhard-float. Values for fpu are fpv2_sf (equivalent to
20818 -mno-double-float -mno-fdivdu), fpv2 (-mdouble-float -mno-divdu),
20819 and fpv2_divd (-mdouble-float -mdivdu).
20820
20821 -melrw
20822 -mno-elrw
20823 Enable the extended "lrw" instruction. This option defaults to on
20824 for CK801 and off otherwise.
20825
20826 -mistack
20827 -mno-istack
20828 Enable interrupt stack instructions; the default is off.
20829
20830 The -mistack option is required to handle the "interrupt" and "isr"
20831 function attributes.
20832
20833 -mmp
20834 Enable multiprocessor instructions; the default is off.
20835
20836 -mcp
20837 Enable coprocessor instructions; the default is off.
20838
20839 -mcache
20840 Enable coprocessor instructions; the default is off.
20841
20842 -msecurity
20843 Enable C-SKY security instructions; the default is off.
20844
20845 -mtrust
20846 Enable C-SKY trust instructions; the default is off.
20847
20848 -mdsp
20849 -medsp
20850 -mvdsp
20851 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions,
20852 respectively. All of these options default to off.
20853
20854 -mdiv
20855 -mno-div
20856 Generate divide instructions. Default is off.
20857
20858 -msmart
20859 -mno-smart
20860 Generate code for Smart Mode, using only registers numbered 0-7 to
20861 allow use of 16-bit instructions. This option is ignored for CK801
20862 where this is the required behavior, and it defaults to on for
20863 CK802. For other targets, the default is off.
20864
20865 -mhigh-registers
20866 -mno-high-registers
20867 Generate code using the high registers numbered 16-31. This option
20868 is not supported on CK801, CK802, or CK803, and is enabled by
20869 default for other processors.
20870
20871 -manchor
20872 -mno-anchor
20873 Generate code using global anchor symbol addresses.
20874
20875 -mpushpop
20876 -mno-pushpop
20877 Generate code using "push" and "pop" instructions. This option
20878 defaults to on.
20879
20880 -mmultiple-stld
20881 -mstm
20882 -mno-multiple-stld
20883 -mno-stm
20884 Generate code using "stm" and "ldm" instructions. This option
20885 isn't supported on CK801 but is enabled by default on other
20886 processors.
20887
20888 -mconstpool
20889 -mno-constpool
20890 Create constant pools in the compiler instead of deferring it to
20891 the assembler. This option is the default and required for correct
20892 code generation on CK801 and CK802, and is optional on other
20893 processors.
20894
20895 -mstack-size
20896 -mno-stack-size
20897 Emit ".stack_size" directives for each function in the assembly
20898 output. This option defaults to off.
20899
20900 -mccrt
20901 -mno-ccrt
20902 Generate code for the C-SKY compiler runtime instead of libgcc.
20903 This option defaults to off.
20904
20905 -mbranch-cost=n
20906 Set the branch costs to roughly "n" instructions. The default is
20907 1.
20908
20909 -msched-prolog
20910 -mno-sched-prolog
20911 Permit scheduling of function prologue and epilogue sequences.
20912 Using this option can result in code that is not compliant with the
20913 C-SKY V2 ABI prologue requirements and that cannot be debugged or
20914 backtraced. It is disabled by default.
20915
20916 -msim
20917 Links the library libsemi.a which is in compatible with simulator.
20918 Applicable to ELF compiler only.
20919
20920 Darwin Options
20921 These options are defined for all architectures running the Darwin
20922 operating system.
20923
20924 FSF GCC on Darwin does not create "fat" object files; it creates an
20925 object file for the single architecture that GCC was built to target.
20926 Apple's GCC on Darwin does create "fat" files if multiple -arch options
20927 are used; it does so by running the compiler or linker multiple times
20928 and joining the results together with lipo.
20929
20930 The subtype of the file created (like ppc7400 or ppc970 or i686) is
20931 determined by the flags that specify the ISA that GCC is targeting,
20932 like -mcpu or -march. The -force_cpusubtype_ALL option can be used to
20933 override this.
20934
20935 The Darwin tools vary in their behavior when presented with an ISA
20936 mismatch. The assembler, as, only permits instructions to be used that
20937 are valid for the subtype of the file it is generating, so you cannot
20938 put 64-bit instructions in a ppc750 object file. The linker for shared
20939 libraries, /usr/bin/libtool, fails and prints an error if asked to
20940 create a shared library with a less restrictive subtype than its input
20941 files (for instance, trying to put a ppc970 object file in a ppc7400
20942 library). The linker for executables, ld, quietly gives the executable
20943 the most restrictive subtype of any of its input files.
20944
20945 -Fdir
20946 Add the framework directory dir to the head of the list of
20947 directories to be searched for header files. These directories are
20948 interleaved with those specified by -I options and are scanned in a
20949 left-to-right order.
20950
20951 A framework directory is a directory with frameworks in it. A
20952 framework is a directory with a Headers and/or PrivateHeaders
20953 directory contained directly in it that ends in .framework. The
20954 name of a framework is the name of this directory excluding the
20955 .framework. Headers associated with the framework are found in one
20956 of those two directories, with Headers being searched first. A
20957 subframework is a framework directory that is in a framework's
20958 Frameworks directory. Includes of subframework headers can only
20959 appear in a header of a framework that contains the subframework,
20960 or in a sibling subframework header. Two subframeworks are
20961 siblings if they occur in the same framework. A subframework
20962 should not have the same name as a framework; a warning is issued
20963 if this is violated. Currently a subframework cannot have
20964 subframeworks; in the future, the mechanism may be extended to
20965 support this. The standard frameworks can be found in
20966 /System/Library/Frameworks and /Library/Frameworks. An example
20967 include looks like "#include <Framework/header.h>", where Framework
20968 denotes the name of the framework and header.h is found in the
20969 PrivateHeaders or Headers directory.
20970
20971 -iframeworkdir
20972 Like -F except the directory is a treated as a system directory.
20973 The main difference between this -iframework and -F is that with
20974 -iframework the compiler does not warn about constructs contained
20975 within header files found via dir. This option is valid only for
20976 the C family of languages.
20977
20978 -gused
20979 Emit debugging information for symbols that are used. For stabs
20980 debugging format, this enables -feliminate-unused-debug-symbols.
20981 This is by default ON.
20982
20983 -gfull
20984 Emit debugging information for all symbols and types.
20985
20986 -fconstant-cfstrings
20987 The -fconstant-cfstrings is an alias for -mconstant-cfstrings.
20988
20989 -mconstant-cfstrings
20990 When the NeXT runtime is being used (the default on these systems),
20991 override any -fconstant-string-class setting and cause "@"...""
20992 literals to be laid out as constant CoreFoundation strings.
20993
20994 -mmacosx-version-min=version
20995 The earliest version of MacOS X that this executable will run on is
20996 version. Typical values supported for version include 12, 10.12,
20997 and 10.5.8.
20998
20999 If the compiler was built to use the system's headers by default,
21000 then the default for this option is the system version on which the
21001 compiler is running, otherwise the default is to make choices that
21002 are compatible with as many systems and code bases as possible.
21003
21004 -mkernel
21005 Enable kernel development mode. The -mkernel option sets -static,
21006 -fno-common, -fno-use-cxa-atexit, -fno-exceptions,
21007 -fno-non-call-exceptions, -fapple-kext, -fno-weak and -fno-rtti
21008 where applicable. This mode also sets -mno-altivec, -msoft-float,
21009 -fno-builtin and -mlong-branch for PowerPC targets.
21010
21011 -mone-byte-bool
21012 Override the defaults for "bool" so that "sizeof(bool)==1". By
21013 default sizeof(bool) is 4 when compiling for Darwin/PowerPC and 1
21014 when compiling for Darwin/x86, so this option has no effect on x86.
21015
21016 Warning: The -mone-byte-bool switch causes GCC to generate code
21017 that is not binary compatible with code generated without that
21018 switch. Using this switch may require recompiling all other
21019 modules in a program, including system libraries. Use this switch
21020 to conform to a non-default data model.
21021
21022 -mfix-and-continue
21023 -ffix-and-continue
21024 -findirect-data
21025 Generate code suitable for fast turnaround development, such as to
21026 allow GDB to dynamically load .o files into already-running
21027 programs. -findirect-data and -ffix-and-continue are provided for
21028 backwards compatibility.
21029
21030 -all_load
21031 Loads all members of static archive libraries. See man ld(1) for
21032 more information.
21033
21034 -arch_errors_fatal
21035 Cause the errors having to do with files that have the wrong
21036 architecture to be fatal.
21037
21038 -bind_at_load
21039 Causes the output file to be marked such that the dynamic linker
21040 will bind all undefined references when the file is loaded or
21041 launched.
21042
21043 -bundle
21044 Produce a Mach-o bundle format file. See man ld(1) for more
21045 information.
21046
21047 -bundle_loader executable
21048 This option specifies the executable that will load the build
21049 output file being linked. See man ld(1) for more information.
21050
21051 -dynamiclib
21052 When passed this option, GCC produces a dynamic library instead of
21053 an executable when linking, using the Darwin libtool command.
21054
21055 -force_cpusubtype_ALL
21056 This causes GCC's output file to have the ALL subtype, instead of
21057 one controlled by the -mcpu or -march option.
21058
21059 -allowable_client client_name
21060 -client_name
21061 -compatibility_version
21062 -current_version
21063 -dead_strip
21064 -dependency-file
21065 -dylib_file
21066 -dylinker_install_name
21067 -dynamic
21068 -exported_symbols_list
21069 -filelist
21070 -flat_namespace
21071 -force_flat_namespace
21072 -headerpad_max_install_names
21073 -image_base
21074 -init
21075 -install_name
21076 -keep_private_externs
21077 -multi_module
21078 -multiply_defined
21079 -multiply_defined_unused
21080 -noall_load
21081 -no_dead_strip_inits_and_terms
21082 -nofixprebinding
21083 -nomultidefs
21084 -noprebind
21085 -noseglinkedit
21086 -pagezero_size
21087 -prebind
21088 -prebind_all_twolevel_modules
21089 -private_bundle
21090 -read_only_relocs
21091 -sectalign
21092 -sectobjectsymbols
21093 -whyload
21094 -seg1addr
21095 -sectcreate
21096 -sectobjectsymbols
21097 -sectorder
21098 -segaddr
21099 -segs_read_only_addr
21100 -segs_read_write_addr
21101 -seg_addr_table
21102 -seg_addr_table_filename
21103 -seglinkedit
21104 -segprot
21105 -segs_read_only_addr
21106 -segs_read_write_addr
21107 -single_module
21108 -static
21109 -sub_library
21110 -sub_umbrella
21111 -twolevel_namespace
21112 -umbrella
21113 -undefined
21114 -unexported_symbols_list
21115 -weak_reference_mismatches
21116 -whatsloaded
21117 These options are passed to the Darwin linker. The Darwin linker
21118 man page describes them in detail.
21119
21120 DEC Alpha Options
21121 These -m options are defined for the DEC Alpha implementations:
21122
21123 -mno-soft-float
21124 -msoft-float
21125 Use (do not use) the hardware floating-point instructions for
21126 floating-point operations. When -msoft-float is specified,
21127 functions in libgcc.a are used to perform floating-point
21128 operations. Unless they are replaced by routines that emulate the
21129 floating-point operations, or compiled in such a way as to call
21130 such emulations routines, these routines issue floating-point
21131 operations. If you are compiling for an Alpha without floating-
21132 point operations, you must ensure that the library is built so as
21133 not to call them.
21134
21135 Note that Alpha implementations without floating-point operations
21136 are required to have floating-point registers.
21137
21138 -mfp-reg
21139 -mno-fp-regs
21140 Generate code that uses (does not use) the floating-point register
21141 set. -mno-fp-regs implies -msoft-float. If the floating-point
21142 register set is not used, floating-point operands are passed in
21143 integer registers as if they were integers and floating-point
21144 results are passed in $0 instead of $f0. This is a non-standard
21145 calling sequence, so any function with a floating-point argument or
21146 return value called by code compiled with -mno-fp-regs must also be
21147 compiled with that option.
21148
21149 A typical use of this option is building a kernel that does not
21150 use, and hence need not save and restore, any floating-point
21151 registers.
21152
21153 -mieee
21154 The Alpha architecture implements floating-point hardware optimized
21155 for maximum performance. It is mostly compliant with the IEEE
21156 floating-point standard. However, for full compliance, software
21157 assistance is required. This option generates code fully IEEE-
21158 compliant code except that the inexact-flag is not maintained (see
21159 below). If this option is turned on, the preprocessor macro
21160 "_IEEE_FP" is defined during compilation. The resulting code is
21161 less efficient but is able to correctly support denormalized
21162 numbers and exceptional IEEE values such as not-a-number and
21163 plus/minus infinity. Other Alpha compilers call this option
21164 -ieee_with_no_inexact.
21165
21166 -mieee-with-inexact
21167 This is like -mieee except the generated code also maintains the
21168 IEEE inexact-flag. Turning on this option causes the generated
21169 code to implement fully-compliant IEEE math. In addition to
21170 "_IEEE_FP", "_IEEE_FP_EXACT" is defined as a preprocessor macro.
21171 On some Alpha implementations the resulting code may execute
21172 significantly slower than the code generated by default. Since
21173 there is very little code that depends on the inexact-flag, you
21174 should normally not specify this option. Other Alpha compilers
21175 call this option -ieee_with_inexact.
21176
21177 -mfp-trap-mode=trap-mode
21178 This option controls what floating-point related traps are enabled.
21179 Other Alpha compilers call this option -fptm trap-mode. The trap
21180 mode can be set to one of four values:
21181
21182 n This is the default (normal) setting. The only traps that are
21183 enabled are the ones that cannot be disabled in software (e.g.,
21184 division by zero trap).
21185
21186 u In addition to the traps enabled by n, underflow traps are
21187 enabled as well.
21188
21189 su Like u, but the instructions are marked to be safe for software
21190 completion (see Alpha architecture manual for details).
21191
21192 sui Like su, but inexact traps are enabled as well.
21193
21194 -mfp-rounding-mode=rounding-mode
21195 Selects the IEEE rounding mode. Other Alpha compilers call this
21196 option -fprm rounding-mode. The rounding-mode can be one of:
21197
21198 n Normal IEEE rounding mode. Floating-point numbers are rounded
21199 towards the nearest machine number or towards the even machine
21200 number in case of a tie.
21201
21202 m Round towards minus infinity.
21203
21204 c Chopped rounding mode. Floating-point numbers are rounded
21205 towards zero.
21206
21207 d Dynamic rounding mode. A field in the floating-point control
21208 register (fpcr, see Alpha architecture reference manual)
21209 controls the rounding mode in effect. The C library
21210 initializes this register for rounding towards plus infinity.
21211 Thus, unless your program modifies the fpcr, d corresponds to
21212 round towards plus infinity.
21213
21214 -mtrap-precision=trap-precision
21215 In the Alpha architecture, floating-point traps are imprecise.
21216 This means without software assistance it is impossible to recover
21217 from a floating trap and program execution normally needs to be
21218 terminated. GCC can generate code that can assist operating system
21219 trap handlers in determining the exact location that caused a
21220 floating-point trap. Depending on the requirements of an
21221 application, different levels of precisions can be selected:
21222
21223 p Program precision. This option is the default and means a trap
21224 handler can only identify which program caused a floating-point
21225 exception.
21226
21227 f Function precision. The trap handler can determine the
21228 function that caused a floating-point exception.
21229
21230 i Instruction precision. The trap handler can determine the
21231 exact instruction that caused a floating-point exception.
21232
21233 Other Alpha compilers provide the equivalent options called
21234 -scope_safe and -resumption_safe.
21235
21236 -mieee-conformant
21237 This option marks the generated code as IEEE conformant. You must
21238 not use this option unless you also specify -mtrap-precision=i and
21239 either -mfp-trap-mode=su or -mfp-trap-mode=sui. Its only effect is
21240 to emit the line .eflag 48 in the function prologue of the
21241 generated assembly file.
21242
21243 -mbuild-constants
21244 Normally GCC examines a 32- or 64-bit integer constant to see if it
21245 can construct it from smaller constants in two or three
21246 instructions. If it cannot, it outputs the constant as a literal
21247 and generates code to load it from the data segment at run time.
21248
21249 Use this option to require GCC to construct all integer constants
21250 using code, even if it takes more instructions (the maximum is
21251 six).
21252
21253 You typically use this option to build a shared library dynamic
21254 loader. Itself a shared library, it must relocate itself in memory
21255 before it can find the variables and constants in its own data
21256 segment.
21257
21258 -mbwx
21259 -mno-bwx
21260 -mcix
21261 -mno-cix
21262 -mfix
21263 -mno-fix
21264 -mmax
21265 -mno-max
21266 Indicate whether GCC should generate code to use the optional BWX,
21267 CIX, FIX and MAX instruction sets. The default is to use the
21268 instruction sets supported by the CPU type specified via -mcpu=
21269 option or that of the CPU on which GCC was built if none is
21270 specified.
21271
21272 -mfloat-vax
21273 -mfloat-ieee
21274 Generate code that uses (does not use) VAX F and G floating-point
21275 arithmetic instead of IEEE single and double precision.
21276
21277 -mexplicit-relocs
21278 -mno-explicit-relocs
21279 Older Alpha assemblers provided no way to generate symbol
21280 relocations except via assembler macros. Use of these macros does
21281 not allow optimal instruction scheduling. GNU binutils as of
21282 version 2.12 supports a new syntax that allows the compiler to
21283 explicitly mark which relocations should apply to which
21284 instructions. This option is mostly useful for debugging, as GCC
21285 detects the capabilities of the assembler when it is built and sets
21286 the default accordingly.
21287
21288 -msmall-data
21289 -mlarge-data
21290 When -mexplicit-relocs is in effect, static data is accessed via
21291 gp-relative relocations. When -msmall-data is used, objects 8
21292 bytes long or smaller are placed in a small data area (the ".sdata"
21293 and ".sbss" sections) and are accessed via 16-bit relocations off
21294 of the $gp register. This limits the size of the small data area
21295 to 64KB, but allows the variables to be directly accessed via a
21296 single instruction.
21297
21298 The default is -mlarge-data. With this option the data area is
21299 limited to just below 2GB. Programs that require more than 2GB of
21300 data must use "malloc" or "mmap" to allocate the data in the heap
21301 instead of in the program's data segment.
21302
21303 When generating code for shared libraries, -fpic implies
21304 -msmall-data and -fPIC implies -mlarge-data.
21305
21306 -msmall-text
21307 -mlarge-text
21308 When -msmall-text is used, the compiler assumes that the code of
21309 the entire program (or shared library) fits in 4MB, and is thus
21310 reachable with a branch instruction. When -msmall-data is used,
21311 the compiler can assume that all local symbols share the same $gp
21312 value, and thus reduce the number of instructions required for a
21313 function call from 4 to 1.
21314
21315 The default is -mlarge-text.
21316
21317 -mcpu=cpu_type
21318 Set the instruction set and instruction scheduling parameters for
21319 machine type cpu_type. You can specify either the EV style name or
21320 the corresponding chip number. GCC supports scheduling parameters
21321 for the EV4, EV5 and EV6 family of processors and chooses the
21322 default values for the instruction set from the processor you
21323 specify. If you do not specify a processor type, GCC defaults to
21324 the processor on which the compiler was built.
21325
21326 Supported values for cpu_type are
21327
21328 ev4
21329 ev45
21330 21064
21331 Schedules as an EV4 and has no instruction set extensions.
21332
21333 ev5
21334 21164
21335 Schedules as an EV5 and has no instruction set extensions.
21336
21337 ev56
21338 21164a
21339 Schedules as an EV5 and supports the BWX extension.
21340
21341 pca56
21342 21164pc
21343 21164PC
21344 Schedules as an EV5 and supports the BWX and MAX extensions.
21345
21346 ev6
21347 21264
21348 Schedules as an EV6 and supports the BWX, FIX, and MAX
21349 extensions.
21350
21351 ev67
21352 21264a
21353 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX
21354 extensions.
21355
21356 Native toolchains also support the value native, which selects the
21357 best architecture option for the host processor. -mcpu=native has
21358 no effect if GCC does not recognize the processor.
21359
21360 -mtune=cpu_type
21361 Set only the instruction scheduling parameters for machine type
21362 cpu_type. The instruction set is not changed.
21363
21364 Native toolchains also support the value native, which selects the
21365 best architecture option for the host processor. -mtune=native has
21366 no effect if GCC does not recognize the processor.
21367
21368 -mmemory-latency=time
21369 Sets the latency the scheduler should assume for typical memory
21370 references as seen by the application. This number is highly
21371 dependent on the memory access patterns used by the application and
21372 the size of the external cache on the machine.
21373
21374 Valid options for time are
21375
21376 number
21377 A decimal number representing clock cycles.
21378
21379 L1
21380 L2
21381 L3
21382 main
21383 The compiler contains estimates of the number of clock cycles
21384 for "typical" EV4 & EV5 hardware for the Level 1, 2 & 3 caches
21385 (also called Dcache, Scache, and Bcache), as well as to main
21386 memory. Note that L3 is only valid for EV5.
21387
21388 eBPF Options
21389 -mframe-limit=bytes
21390 This specifies the hard limit for frame sizes, in bytes.
21391 Currently, the value that can be specified should be less than or
21392 equal to 32767. Defaults to whatever limit is imposed by the
21393 version of the Linux kernel targeted.
21394
21395 -mkernel=version
21396 This specifies the minimum version of the kernel that will run the
21397 compiled program. GCC uses this version to determine which
21398 instructions to use, what kernel helpers to allow, etc. Currently,
21399 version can be one of 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8,
21400 4.9, 4.10, 4.11, 4.12, 4.13, 4.14, 4.15, 4.16, 4.17, 4.18, 4.19,
21401 4.20, 5.0, 5.1, 5.2, latest and native.
21402
21403 -mbig-endian
21404 Generate code for a big-endian target.
21405
21406 -mlittle-endian
21407 Generate code for a little-endian target. This is the default.
21408
21409 -mjmpext
21410 Enable generation of extra conditional-branch instructions.
21411 Enabled for CPU v2 and above.
21412
21413 -mjmp32
21414 Enable 32-bit jump instructions. Enabled for CPU v3 and above.
21415
21416 -malu32
21417 Enable 32-bit ALU instructions. Enabled for CPU v3 and above.
21418
21419 -mcpu=version
21420 This specifies which version of the eBPF ISA to target. Newer
21421 versions may not be supported by all kernels. The default is v3.
21422
21423 Supported values for version are:
21424
21425 v1 The first stable eBPF ISA with no special features or
21426 extensions.
21427
21428 v2 Supports the jump extensions, as in -mjmpext.
21429
21430 v3 All features of v2, plus:
21431
21432 -<32-bit jump operations, as in -mjmp32>
21433 -<32-bit ALU operations, as in -malu32>
21434 -mco-re
21435 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires
21436 and is implied by -gbtf.
21437
21438 -mno-co-re
21439 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-
21440 RE support is enabled by default when generating BTF debug
21441 information for the BPF target.
21442
21443 -mxbpf
21444 Generate code for an expanded version of BPF, which relaxes some of
21445 the restrictions imposed by the BPF architecture:
21446
21447 -<Save and restore callee-saved registers at function entry and>
21448 exit, respectively.
21449
21450 FR30 Options
21451 These options are defined specifically for the FR30 port.
21452
21453 -msmall-model
21454 Use the small address space model. This can produce smaller code,
21455 but it does assume that all symbolic values and addresses fit into
21456 a 20-bit range.
21457
21458 -mno-lsim
21459 Assume that runtime support has been provided and so there is no
21460 need to include the simulator library (libsim.a) on the linker
21461 command line.
21462
21463 FT32 Options
21464 These options are defined specifically for the FT32 port.
21465
21466 -msim
21467 Specifies that the program will be run on the simulator. This
21468 causes an alternate runtime startup and library to be linked. You
21469 must not use this option when generating programs that will run on
21470 real hardware; you must provide your own runtime library for
21471 whatever I/O functions are needed.
21472
21473 -mlra
21474 Enable Local Register Allocation. This is still experimental for
21475 FT32, so by default the compiler uses standard reload.
21476
21477 -mnodiv
21478 Do not use div and mod instructions.
21479
21480 -mft32b
21481 Enable use of the extended instructions of the FT32B processor.
21482
21483 -mcompress
21484 Compress all code using the Ft32B code compression scheme.
21485
21486 -mnopm
21487 Do not generate code that reads program memory.
21488
21489 FRV Options
21490 -mgpr-32
21491 Only use the first 32 general-purpose registers.
21492
21493 -mgpr-64
21494 Use all 64 general-purpose registers.
21495
21496 -mfpr-32
21497 Use only the first 32 floating-point registers.
21498
21499 -mfpr-64
21500 Use all 64 floating-point registers.
21501
21502 -mhard-float
21503 Use hardware instructions for floating-point operations.
21504
21505 -msoft-float
21506 Use library routines for floating-point operations.
21507
21508 -malloc-cc
21509 Dynamically allocate condition code registers.
21510
21511 -mfixed-cc
21512 Do not try to dynamically allocate condition code registers, only
21513 use "icc0" and "fcc0".
21514
21515 -mdword
21516 Change ABI to use double word insns.
21517
21518 -mno-dword
21519 Do not use double word instructions.
21520
21521 -mdouble
21522 Use floating-point double instructions.
21523
21524 -mno-double
21525 Do not use floating-point double instructions.
21526
21527 -mmedia
21528 Use media instructions.
21529
21530 -mno-media
21531 Do not use media instructions.
21532
21533 -mmuladd
21534 Use multiply and add/subtract instructions.
21535
21536 -mno-muladd
21537 Do not use multiply and add/subtract instructions.
21538
21539 -mfdpic
21540 Select the FDPIC ABI, which uses function descriptors to represent
21541 pointers to functions. Without any PIC/PIE-related options, it
21542 implies -fPIE. With -fpic or -fpie, it assumes GOT entries and
21543 small data are within a 12-bit range from the GOT base address;
21544 with -fPIC or -fPIE, GOT offsets are computed with 32 bits. With a
21545 bfin-elf target, this option implies -msim.
21546
21547 -minline-plt
21548 Enable inlining of PLT entries in function calls to functions that
21549 are not known to bind locally. It has no effect without -mfdpic.
21550 It's enabled by default if optimizing for speed and compiling for
21551 shared libraries (i.e., -fPIC or -fpic), or when an optimization
21552 option such as -O3 or above is present in the command line.
21553
21554 -mTLS
21555 Assume a large TLS segment when generating thread-local code.
21556
21557 -mtls
21558 Do not assume a large TLS segment when generating thread-local
21559 code.
21560
21561 -mgprel-ro
21562 Enable the use of "GPREL" relocations in the FDPIC ABI for data
21563 that is known to be in read-only sections. It's enabled by
21564 default, except for -fpic or -fpie: even though it may help make
21565 the global offset table smaller, it trades 1 instruction for 4.
21566 With -fPIC or -fPIE, it trades 3 instructions for 4, one of which
21567 may be shared by multiple symbols, and it avoids the need for a GOT
21568 entry for the referenced symbol, so it's more likely to be a win.
21569 If it is not, -mno-gprel-ro can be used to disable it.
21570
21571 -multilib-library-pic
21572 Link with the (library, not FD) pic libraries. It's implied by
21573 -mlibrary-pic, as well as by -fPIC and -fpic without -mfdpic. You
21574 should never have to use it explicitly.
21575
21576 -mlinked-fp
21577 Follow the EABI requirement of always creating a frame pointer
21578 whenever a stack frame is allocated. This option is enabled by
21579 default and can be disabled with -mno-linked-fp.
21580
21581 -mlong-calls
21582 Use indirect addressing to call functions outside the current
21583 compilation unit. This allows the functions to be placed anywhere
21584 within the 32-bit address space.
21585
21586 -malign-labels
21587 Try to align labels to an 8-byte boundary by inserting NOPs into
21588 the previous packet. This option only has an effect when VLIW
21589 packing is enabled. It doesn't create new packets; it merely adds
21590 NOPs to existing ones.
21591
21592 -mlibrary-pic
21593 Generate position-independent EABI code.
21594
21595 -macc-4
21596 Use only the first four media accumulator registers.
21597
21598 -macc-8
21599 Use all eight media accumulator registers.
21600
21601 -mpack
21602 Pack VLIW instructions.
21603
21604 -mno-pack
21605 Do not pack VLIW instructions.
21606
21607 -mno-eflags
21608 Do not mark ABI switches in e_flags.
21609
21610 -mcond-move
21611 Enable the use of conditional-move instructions (default).
21612
21613 This switch is mainly for debugging the compiler and will likely be
21614 removed in a future version.
21615
21616 -mno-cond-move
21617 Disable the use of conditional-move instructions.
21618
21619 This switch is mainly for debugging the compiler and will likely be
21620 removed in a future version.
21621
21622 -mscc
21623 Enable the use of conditional set instructions (default).
21624
21625 This switch is mainly for debugging the compiler and will likely be
21626 removed in a future version.
21627
21628 -mno-scc
21629 Disable the use of conditional set instructions.
21630
21631 This switch is mainly for debugging the compiler and will likely be
21632 removed in a future version.
21633
21634 -mcond-exec
21635 Enable the use of conditional execution (default).
21636
21637 This switch is mainly for debugging the compiler and will likely be
21638 removed in a future version.
21639
21640 -mno-cond-exec
21641 Disable the use of conditional execution.
21642
21643 This switch is mainly for debugging the compiler and will likely be
21644 removed in a future version.
21645
21646 -mvliw-branch
21647 Run a pass to pack branches into VLIW instructions (default).
21648
21649 This switch is mainly for debugging the compiler and will likely be
21650 removed in a future version.
21651
21652 -mno-vliw-branch
21653 Do not run a pass to pack branches into VLIW instructions.
21654
21655 This switch is mainly for debugging the compiler and will likely be
21656 removed in a future version.
21657
21658 -mmulti-cond-exec
21659 Enable optimization of "&&" and "||" in conditional execution
21660 (default).
21661
21662 This switch is mainly for debugging the compiler and will likely be
21663 removed in a future version.
21664
21665 -mno-multi-cond-exec
21666 Disable optimization of "&&" and "||" in conditional execution.
21667
21668 This switch is mainly for debugging the compiler and will likely be
21669 removed in a future version.
21670
21671 -mnested-cond-exec
21672 Enable nested conditional execution optimizations (default).
21673
21674 This switch is mainly for debugging the compiler and will likely be
21675 removed in a future version.
21676
21677 -mno-nested-cond-exec
21678 Disable nested conditional execution optimizations.
21679
21680 This switch is mainly for debugging the compiler and will likely be
21681 removed in a future version.
21682
21683 -moptimize-membar
21684 This switch removes redundant "membar" instructions from the
21685 compiler-generated code. It is enabled by default.
21686
21687 -mno-optimize-membar
21688 This switch disables the automatic removal of redundant "membar"
21689 instructions from the generated code.
21690
21691 -mtomcat-stats
21692 Cause gas to print out tomcat statistics.
21693
21694 -mcpu=cpu
21695 Select the processor type for which to generate code. Possible
21696 values are frv, fr550, tomcat, fr500, fr450, fr405, fr400, fr300
21697 and simple.
21698
21699 GNU/Linux Options
21700 These -m options are defined for GNU/Linux targets:
21701
21702 -mglibc
21703 Use the GNU C library. This is the default except on
21704 *-*-linux-*uclibc*, *-*-linux-*musl* and *-*-linux-*android*
21705 targets.
21706
21707 -muclibc
21708 Use uClibc C library. This is the default on *-*-linux-*uclibc*
21709 targets.
21710
21711 -mmusl
21712 Use the musl C library. This is the default on *-*-linux-*musl*
21713 targets.
21714
21715 -mbionic
21716 Use Bionic C library. This is the default on *-*-linux-*android*
21717 targets.
21718
21719 -mandroid
21720 Compile code compatible with Android platform. This is the default
21721 on *-*-linux-*android* targets.
21722
21723 When compiling, this option enables -mbionic, -fPIC,
21724 -fno-exceptions and -fno-rtti by default. When linking, this
21725 option makes the GCC driver pass Android-specific options to the
21726 linker. Finally, this option causes the preprocessor macro
21727 "__ANDROID__" to be defined.
21728
21729 -tno-android-cc
21730 Disable compilation effects of -mandroid, i.e., do not enable
21731 -mbionic, -fPIC, -fno-exceptions and -fno-rtti by default.
21732
21733 -tno-android-ld
21734 Disable linking effects of -mandroid, i.e., pass standard Linux
21735 linking options to the linker.
21736
21737 H8/300 Options
21738 These -m options are defined for the H8/300 implementations:
21739
21740 -mrelax
21741 Shorten some address references at link time, when possible; uses
21742 the linker option -relax.
21743
21744 -mh Generate code for the H8/300H.
21745
21746 -ms Generate code for the H8S.
21747
21748 -mn Generate code for the H8S and H8/300H in the normal mode. This
21749 switch must be used either with -mh or -ms.
21750
21751 -ms2600
21752 Generate code for the H8S/2600. This switch must be used with -ms.
21753
21754 -mexr
21755 Extended registers are stored on stack before execution of function
21756 with monitor attribute. Default option is -mexr. This option is
21757 valid only for H8S targets.
21758
21759 -mno-exr
21760 Extended registers are not stored on stack before execution of
21761 function with monitor attribute. Default option is -mno-exr. This
21762 option is valid only for H8S targets.
21763
21764 -mint32
21765 Make "int" data 32 bits by default.
21766
21767 -malign-300
21768 On the H8/300H and H8S, use the same alignment rules as for the
21769 H8/300. The default for the H8/300H and H8S is to align longs and
21770 floats on 4-byte boundaries. -malign-300 causes them to be aligned
21771 on 2-byte boundaries. This option has no effect on the H8/300.
21772
21773 HPPA Options
21774 These -m options are defined for the HPPA family of computers:
21775
21776 -march=architecture-type
21777 Generate code for the specified architecture. The choices for
21778 architecture-type are 1.0 for PA 1.0, 1.1 for PA 1.1, and 2.0 for
21779 PA 2.0 processors. Refer to /usr/lib/sched.models on an HP-UX
21780 system to determine the proper architecture option for your
21781 machine. Code compiled for lower numbered architectures runs on
21782 higher numbered architectures, but not the other way around.
21783
21784 -mpa-risc-1-0
21785 -mpa-risc-1-1
21786 -mpa-risc-2-0
21787 Synonyms for -march=1.0, -march=1.1, and -march=2.0 respectively.
21788
21789 -matomic-libcalls
21790 Generate libcalls for atomic loads and stores when sync libcalls
21791 are disabled. This option is enabled by default. It only affects
21792 the generation of atomic libcalls by the HPPA backend.
21793
21794 Both the sync and libatomic libcall implementations use locking.
21795 As a result, processor stores are not atomic with respect to other
21796 atomic operations. Processor loads up to DImode are atomic with
21797 respect to other atomic operations provided they are implemented as
21798 a single access.
21799
21800 The PA-RISC architecture does not support any atomic operations in
21801 hardware except for the "ldcw" instruction. Thus, all atomic
21802 support is implemented using sync and atomic libcalls. Sync
21803 libcall support is in libgcc.a. Atomic libcall support is in
21804 libatomic.
21805
21806 This option generates "__atomic_exchange" calls for atomic stores.
21807 It also provides special handling for atomic DImode accesses on
21808 32-bit targets.
21809
21810 -mbig-switch
21811 Does nothing. Preserved for backward compatibility.
21812
21813 -mcaller-copies
21814 The caller copies function arguments passed by hidden reference.
21815 This option should be used with care as it is not compatible with
21816 the default 32-bit runtime. However, only aggregates larger than
21817 eight bytes are passed by hidden reference and the option provides
21818 better compatibility with OpenMP.
21819
21820 -mcoherent-ldcw
21821 Use ldcw/ldcd coherent cache-control hint.
21822
21823 -mdisable-fpregs
21824 Disable floating-point registers. Equivalent to "-msoft-float".
21825
21826 -mdisable-indexing
21827 Prevent the compiler from using indexing address modes. This
21828 avoids some rather obscure problems when compiling MIG generated
21829 code under MACH.
21830
21831 -mfast-indirect-calls
21832 Generate code that assumes calls never cross space boundaries.
21833 This allows GCC to emit code that performs faster indirect calls.
21834
21835 This option does not work in the presence of shared libraries or
21836 nested functions.
21837
21838 -mfixed-range=register-range
21839 Generate code treating the given register range as fixed registers.
21840 A fixed register is one that the register allocator cannot use.
21841 This is useful when compiling kernel code. A register range is
21842 specified as two registers separated by a dash. Multiple register
21843 ranges can be specified separated by a comma.
21844
21845 -mgas
21846 Enable the use of assembler directives only GAS understands.
21847
21848 -mgnu-ld
21849 Use options specific to GNU ld. This passes -shared to ld when
21850 building a shared library. It is the default when GCC is
21851 configured, explicitly or implicitly, with the GNU linker. This
21852 option does not affect which ld is called; it only changes what
21853 parameters are passed to that ld. The ld that is called is
21854 determined by the --with-ld configure option, GCC's program search
21855 path, and finally by the user's PATH. The linker used by GCC can
21856 be printed using which `gcc -print-prog-name=ld`. This option is
21857 only available on the 64-bit HP-UX GCC, i.e. configured with
21858 hppa*64*-*-hpux*.
21859
21860 -mhp-ld
21861 Use options specific to HP ld. This passes -b to ld when building
21862 a shared library and passes +Accept TypeMismatch to ld on all
21863 links. It is the default when GCC is configured, explicitly or
21864 implicitly, with the HP linker. This option does not affect which
21865 ld is called; it only changes what parameters are passed to that
21866 ld. The ld that is called is determined by the --with-ld configure
21867 option, GCC's program search path, and finally by the user's PATH.
21868 The linker used by GCC can be printed using which `gcc
21869 -print-prog-name=ld`. This option is only available on the 64-bit
21870 HP-UX GCC, i.e. configured with hppa*64*-*-hpux*.
21871
21872 -mlinker-opt
21873 Enable the optimization pass in the HP-UX linker. Note this makes
21874 symbolic debugging impossible. It also triggers a bug in the HP-UX
21875 8 and HP-UX 9 linkers in which they give bogus error messages when
21876 linking some programs.
21877
21878 -mlong-calls
21879 Generate code that uses long call sequences. This ensures that a
21880 call is always able to reach linker generated stubs. The default
21881 is to generate long calls only when the distance from the call site
21882 to the beginning of the function or translation unit, as the case
21883 may be, exceeds a predefined limit set by the branch type being
21884 used. The limits for normal calls are 7,600,000 and 240,000 bytes,
21885 respectively for the PA 2.0 and PA 1.X architectures. Sibcalls are
21886 always limited at 240,000 bytes.
21887
21888 Distances are measured from the beginning of functions when using
21889 the -ffunction-sections option, or when using the -mgas and
21890 -mno-portable-runtime options together under HP-UX with the SOM
21891 linker.
21892
21893 It is normally not desirable to use this option as it degrades
21894 performance. However, it may be useful in large applications,
21895 particularly when partial linking is used to build the application.
21896
21897 The types of long calls used depends on the capabilities of the
21898 assembler and linker, and the type of code being generated. The
21899 impact on systems that support long absolute calls, and long pic
21900 symbol-difference or pc-relative calls should be relatively small.
21901 However, an indirect call is used on 32-bit ELF systems in pic code
21902 and it is quite long.
21903
21904 -mlong-load-store
21905 Generate 3-instruction load and store sequences as sometimes
21906 required by the HP-UX 10 linker. This is equivalent to the +k
21907 option to the HP compilers.
21908
21909 -mjump-in-delay
21910 This option is ignored and provided for compatibility purposes
21911 only.
21912
21913 -mno-space-regs
21914 Generate code that assumes the target has no space registers. This
21915 allows GCC to generate faster indirect calls and use unscaled index
21916 address modes.
21917
21918 Such code is suitable for level 0 PA systems and kernels.
21919
21920 -mordered
21921 Assume memory references are ordered and barriers are not needed.
21922
21923 -mportable-runtime
21924 Use the portable calling conventions proposed by HP for ELF
21925 systems.
21926
21927 -mschedule=cpu-type
21928 Schedule code according to the constraints for the machine type
21929 cpu-type. The choices for cpu-type are 700 7100, 7100LC, 7200,
21930 7300 and 8000. Refer to /usr/lib/sched.models on an HP-UX system
21931 to determine the proper scheduling option for your machine. The
21932 default scheduling is 8000.
21933
21934 -msio
21935 Generate the predefine, "_SIO", for server IO. The default is
21936 -mwsio. This generates the predefines, "__hp9000s700",
21937 "__hp9000s700__" and "_WSIO", for workstation IO. These options
21938 are available under HP-UX and HI-UX.
21939
21940 -msoft-float
21941 Generate output containing library calls for floating point.
21942 Warning: the requisite libraries are not available for all HPPA
21943 targets. Normally the facilities of the machine's usual C compiler
21944 are used, but this cannot be done directly in cross-compilation.
21945 You must make your own arrangements to provide suitable library
21946 functions for cross-compilation.
21947
21948 -msoft-float changes the calling convention in the output file;
21949 therefore, it is only useful if you compile all of a program with
21950 this option. In particular, you need to compile libgcc.a, the
21951 library that comes with GCC, with -msoft-float in order for this to
21952 work.
21953
21954 -msoft-mult
21955 Use software integer multiplication.
21956
21957 This disables the use of the "xmpyu" instruction.
21958
21959 -munix=unix-std
21960 Generate compiler predefines and select a startfile for the
21961 specified UNIX standard. The choices for unix-std are 93, 95 and
21962 98. 93 is supported on all HP-UX versions. 95 is available on HP-
21963 UX 10.10 and later. 98 is available on HP-UX 11.11 and later. The
21964 default values are 93 for HP-UX 10.00, 95 for HP-UX 10.10 though to
21965 11.00, and 98 for HP-UX 11.11 and later.
21966
21967 -munix=93 provides the same predefines as GCC 3.3 and 3.4.
21968 -munix=95 provides additional predefines for "XOPEN_UNIX" and
21969 "_XOPEN_SOURCE_EXTENDED", and the startfile unix95.o. -munix=98
21970 provides additional predefines for "_XOPEN_UNIX",
21971 "_XOPEN_SOURCE_EXTENDED", "_INCLUDE__STDC_A1_SOURCE" and
21972 "_INCLUDE_XOPEN_SOURCE_500", and the startfile unix98.o.
21973
21974 It is important to note that this option changes the interfaces for
21975 various library routines. It also affects the operational behavior
21976 of the C library. Thus, extreme care is needed in using this
21977 option.
21978
21979 Library code that is intended to operate with more than one UNIX
21980 standard must test, set and restore the variable
21981 "__xpg4_extended_mask" as appropriate. Most GNU software doesn't
21982 provide this capability.
21983
21984 -nolibdld
21985 Suppress the generation of link options to search libdld.sl when
21986 the -static option is specified on HP-UX 10 and later.
21987
21988 -static
21989 The HP-UX implementation of setlocale in libc has a dependency on
21990 libdld.sl. There isn't an archive version of libdld.sl. Thus,
21991 when the -static option is specified, special link options are
21992 needed to resolve this dependency.
21993
21994 On HP-UX 10 and later, the GCC driver adds the necessary options to
21995 link with libdld.sl when the -static option is specified. This
21996 causes the resulting binary to be dynamic. On the 64-bit port, the
21997 linkers generate dynamic binaries by default in any case. The
21998 -nolibdld option can be used to prevent the GCC driver from adding
21999 these link options.
22000
22001 -threads
22002 Add support for multithreading with the dce thread library under
22003 HP-UX. This option sets flags for both the preprocessor and
22004 linker.
22005
22006 IA-64 Options
22007 These are the -m options defined for the Intel IA-64 architecture.
22008
22009 -mbig-endian
22010 Generate code for a big-endian target. This is the default for HP-
22011 UX.
22012
22013 -mlittle-endian
22014 Generate code for a little-endian target. This is the default for
22015 AIX5 and GNU/Linux.
22016
22017 -mgnu-as
22018 -mno-gnu-as
22019 Generate (or don't) code for the GNU assembler. This is the
22020 default.
22021
22022 -mgnu-ld
22023 -mno-gnu-ld
22024 Generate (or don't) code for the GNU linker. This is the default.
22025
22026 -mno-pic
22027 Generate code that does not use a global pointer register. The
22028 result is not position independent code, and violates the IA-64
22029 ABI.
22030
22031 -mvolatile-asm-stop
22032 -mno-volatile-asm-stop
22033 Generate (or don't) a stop bit immediately before and after
22034 volatile asm statements.
22035
22036 -mregister-names
22037 -mno-register-names
22038 Generate (or don't) in, loc, and out register names for the stacked
22039 registers. This may make assembler output more readable.
22040
22041 -mno-sdata
22042 -msdata
22043 Disable (or enable) optimizations that use the small data section.
22044 This may be useful for working around optimizer bugs.
22045
22046 -mconstant-gp
22047 Generate code that uses a single constant global pointer value.
22048 This is useful when compiling kernel code.
22049
22050 -mauto-pic
22051 Generate code that is self-relocatable. This implies
22052 -mconstant-gp. This is useful when compiling firmware code.
22053
22054 -minline-float-divide-min-latency
22055 Generate code for inline divides of floating-point values using the
22056 minimum latency algorithm.
22057
22058 -minline-float-divide-max-throughput
22059 Generate code for inline divides of floating-point values using the
22060 maximum throughput algorithm.
22061
22062 -mno-inline-float-divide
22063 Do not generate inline code for divides of floating-point values.
22064
22065 -minline-int-divide-min-latency
22066 Generate code for inline divides of integer values using the
22067 minimum latency algorithm.
22068
22069 -minline-int-divide-max-throughput
22070 Generate code for inline divides of integer values using the
22071 maximum throughput algorithm.
22072
22073 -mno-inline-int-divide
22074 Do not generate inline code for divides of integer values.
22075
22076 -minline-sqrt-min-latency
22077 Generate code for inline square roots using the minimum latency
22078 algorithm.
22079
22080 -minline-sqrt-max-throughput
22081 Generate code for inline square roots using the maximum throughput
22082 algorithm.
22083
22084 -mno-inline-sqrt
22085 Do not generate inline code for "sqrt".
22086
22087 -mfused-madd
22088 -mno-fused-madd
22089 Do (don't) generate code that uses the fused multiply/add or
22090 multiply/subtract instructions. The default is to use these
22091 instructions.
22092
22093 -mno-dwarf2-asm
22094 -mdwarf2-asm
22095 Don't (or do) generate assembler code for the DWARF line number
22096 debugging info. This may be useful when not using the GNU
22097 assembler.
22098
22099 -mearly-stop-bits
22100 -mno-early-stop-bits
22101 Allow stop bits to be placed earlier than immediately preceding the
22102 instruction that triggered the stop bit. This can improve
22103 instruction scheduling, but does not always do so.
22104
22105 -mfixed-range=register-range
22106 Generate code treating the given register range as fixed registers.
22107 A fixed register is one that the register allocator cannot use.
22108 This is useful when compiling kernel code. A register range is
22109 specified as two registers separated by a dash. Multiple register
22110 ranges can be specified separated by a comma.
22111
22112 -mtls-size=tls-size
22113 Specify bit size of immediate TLS offsets. Valid values are 14,
22114 22, and 64.
22115
22116 -mtune=cpu-type
22117 Tune the instruction scheduling for a particular CPU, Valid values
22118 are itanium, itanium1, merced, itanium2, and mckinley.
22119
22120 -milp32
22121 -mlp64
22122 Generate code for a 32-bit or 64-bit environment. The 32-bit
22123 environment sets int, long and pointer to 32 bits. The 64-bit
22124 environment sets int to 32 bits and long and pointer to 64 bits.
22125 These are HP-UX specific flags.
22126
22127 -mno-sched-br-data-spec
22128 -msched-br-data-spec
22129 (Dis/En)able data speculative scheduling before reload. This
22130 results in generation of "ld.a" instructions and the corresponding
22131 check instructions ("ld.c" / "chk.a"). The default setting is
22132 disabled.
22133
22134 -msched-ar-data-spec
22135 -mno-sched-ar-data-spec
22136 (En/Dis)able data speculative scheduling after reload. This
22137 results in generation of "ld.a" instructions and the corresponding
22138 check instructions ("ld.c" / "chk.a"). The default setting is
22139 enabled.
22140
22141 -mno-sched-control-spec
22142 -msched-control-spec
22143 (Dis/En)able control speculative scheduling. This feature is
22144 available only during region scheduling (i.e. before reload). This
22145 results in generation of the "ld.s" instructions and the
22146 corresponding check instructions "chk.s". The default setting is
22147 disabled.
22148
22149 -msched-br-in-data-spec
22150 -mno-sched-br-in-data-spec
22151 (En/Dis)able speculative scheduling of the instructions that are
22152 dependent on the data speculative loads before reload. This is
22153 effective only with -msched-br-data-spec enabled. The default
22154 setting is enabled.
22155
22156 -msched-ar-in-data-spec
22157 -mno-sched-ar-in-data-spec
22158 (En/Dis)able speculative scheduling of the instructions that are
22159 dependent on the data speculative loads after reload. This is
22160 effective only with -msched-ar-data-spec enabled. The default
22161 setting is enabled.
22162
22163 -msched-in-control-spec
22164 -mno-sched-in-control-spec
22165 (En/Dis)able speculative scheduling of the instructions that are
22166 dependent on the control speculative loads. This is effective only
22167 with -msched-control-spec enabled. The default setting is enabled.
22168
22169 -mno-sched-prefer-non-data-spec-insns
22170 -msched-prefer-non-data-spec-insns
22171 If enabled, data-speculative instructions are chosen for schedule
22172 only if there are no other choices at the moment. This makes the
22173 use of the data speculation much more conservative. The default
22174 setting is disabled.
22175
22176 -mno-sched-prefer-non-control-spec-insns
22177 -msched-prefer-non-control-spec-insns
22178 If enabled, control-speculative instructions are chosen for
22179 schedule only if there are no other choices at the moment. This
22180 makes the use of the control speculation much more conservative.
22181 The default setting is disabled.
22182
22183 -mno-sched-count-spec-in-critical-path
22184 -msched-count-spec-in-critical-path
22185 If enabled, speculative dependencies are considered during
22186 computation of the instructions priorities. This makes the use of
22187 the speculation a bit more conservative. The default setting is
22188 disabled.
22189
22190 -msched-spec-ldc
22191 Use a simple data speculation check. This option is on by default.
22192
22193 -msched-control-spec-ldc
22194 Use a simple check for control speculation. This option is on by
22195 default.
22196
22197 -msched-stop-bits-after-every-cycle
22198 Place a stop bit after every cycle when scheduling. This option is
22199 on by default.
22200
22201 -msched-fp-mem-deps-zero-cost
22202 Assume that floating-point stores and loads are not likely to cause
22203 a conflict when placed into the same instruction group. This
22204 option is disabled by default.
22205
22206 -msel-sched-dont-check-control-spec
22207 Generate checks for control speculation in selective scheduling.
22208 This flag is disabled by default.
22209
22210 -msched-max-memory-insns=max-insns
22211 Limit on the number of memory insns per instruction group, giving
22212 lower priority to subsequent memory insns attempting to schedule in
22213 the same instruction group. Frequently useful to prevent cache bank
22214 conflicts. The default value is 1.
22215
22216 -msched-max-memory-insns-hard-limit
22217 Makes the limit specified by msched-max-memory-insns a hard limit,
22218 disallowing more than that number in an instruction group.
22219 Otherwise, the limit is "soft", meaning that non-memory operations
22220 are preferred when the limit is reached, but memory operations may
22221 still be scheduled.
22222
22223 LM32 Options
22224 These -m options are defined for the LatticeMico32 architecture:
22225
22226 -mbarrel-shift-enabled
22227 Enable barrel-shift instructions.
22228
22229 -mdivide-enabled
22230 Enable divide and modulus instructions.
22231
22232 -mmultiply-enabled
22233 Enable multiply instructions.
22234
22235 -msign-extend-enabled
22236 Enable sign extend instructions.
22237
22238 -muser-enabled
22239 Enable user-defined instructions.
22240
22241 LoongArch Options
22242 These command-line options are defined for LoongArch targets:
22243
22244 -march=cpu-type
22245 Generate instructions for the machine type cpu-type. In contrast
22246 to -mtune=cpu-type, which merely tunes the generated code for the
22247 specified cpu-type, -march=cpu-type allows GCC to generate code
22248 that may not run at all on processors other than the one indicated.
22249 Specifying -march=cpu-type implies -mtune=cpu-type, except where
22250 noted otherwise.
22251
22252 The choices for cpu-type are:
22253
22254 native
22255 This selects the CPU to generate code for at compilation time
22256 by determining the processor type of the compiling machine.
22257 Using -march=native enables all instruction subsets supported
22258 by the local machine (hence the result might not run on
22259 different machines). Using -mtune=native produces code
22260 optimized for the local machine under the constraints of the
22261 selected instruction set.
22262
22263 loongarch64
22264 A generic CPU with 64-bit extensions.
22265
22266 la464
22267 LoongArch LA464 CPU with LBT, LSX, LASX, LVZ.
22268
22269 -mtune=cpu-type
22270 Optimize the output for the given processor, specified by
22271 microarchitecture name.
22272
22273 -mabi=base-abi-type
22274 Generate code for the specified calling convention. base-abi-type
22275 can be one of:
22276
22277 lp64d
22278 Uses 64-bit general purpose registers and 32/64-bit floating-
22279 point registers for parameter passing. Data model is LP64,
22280 where int is 32 bits, while long int and pointers are 64 bits.
22281
22282 lp64f
22283 Uses 64-bit general purpose registers and 32-bit floating-point
22284 registers for parameter passing. Data model is LP64, where int
22285 is 32 bits, while long int and pointers are 64 bits.
22286
22287 lp64s
22288 Uses 64-bit general purpose registers and no floating-point
22289 registers for parameter passing. Data model is LP64, where int
22290 is 32 bits, while long int and pointers are 64 bits.
22291
22292 -mfpu=fpu-type
22293 Generate code for the specified FPU type, which can be one of:
22294
22295 64 Allow the use of hardware floating-point instructions for
22296 32-bit and 64-bit operations.
22297
22298 32 Allow the use of hardware floating-point instructions for
22299 32-bit operations.
22300
22301 none
22302 0 Prevent the use of hardware floating-point instructions.
22303
22304 -msoft-float
22305 Force -mfpu=none and prevents the use of floating-point registers
22306 for parameter passing. This option may change the target ABI.
22307
22308 -msingle-float
22309 Force -mfpu=32 and allow the use of 32-bit floating-point registers
22310 for parameter passing. This option may change the target ABI.
22311
22312 -mdouble-float
22313 Force -mfpu=64 and allow the use of 32/64-bit floating-point
22314 registers for parameter passing. This option may change the target
22315 ABI.
22316
22317 -mbranch-cost=n
22318 Set the cost of branches to roughly n instructions.
22319
22320 -mcheck-zero-division
22321 -mno-check-zero-divison
22322 Trap (do not trap) on integer division by zero. The default is
22323 -mcheck-zero-division for -O0 or -Og, and -mno-check-zero-division
22324 for other optimization levels.
22325
22326 -mcond-move-int
22327 -mno-cond-move-int
22328 Conditional moves for integral data in general-purpose registers
22329 are enabled (disabled). The default is -mcond-move-int.
22330
22331 -mcond-move-float
22332 -mno-cond-move-float
22333 Conditional moves for floating-point registers are enabled
22334 (disabled). The default is -mcond-move-float.
22335
22336 -mmemcpy
22337 -mno-memcpy
22338 Force (do not force) the use of "memcpy" for non-trivial block
22339 moves. The default is -mno-memcpy, which allows GCC to inline most
22340 constant-sized copies. Setting optimization level to -Os also
22341 forces the use of "memcpy", but -mno-memcpy may override this
22342 behavior if explicitly specified, regardless of the order these
22343 options on the command line.
22344
22345 -mstrict-align
22346 -mno-strict-align
22347 Avoid or allow generating memory accesses that may not be aligned
22348 on a natural object boundary as described in the architecture
22349 specification. The default is -mno-strict-align.
22350
22351 -msmall-data-limit=number
22352 Put global and static data smaller than number bytes into a special
22353 section (on some targets). The default value is 0.
22354
22355 -mmax-inline-memcpy-size=n
22356 Inline all block moves (such as calls to "memcpy" or structure
22357 copies) less than or equal to n bytes. The default value of n is
22358 1024.
22359
22360 -mcmodel=code-model
22361 Set the code model to one of:
22362
22363 tiny-static (Not implemented yet)
22364 tiny (Not implemented yet)
22365 normal
22366 The text segment must be within 128MB addressing space. The
22367 data segment must be within 2GB addressing space.
22368
22369 medium
22370 The text segment and data segment must be within 2GB addressing
22371 space.
22372
22373 large (Not implemented yet)
22374 extreme
22375 This mode does not limit the size of the code segment and data
22376 segment. The -mcmodel=extreme option is incompatible with
22377 -fplt and -mno-explicit-relocs.
22378
22379 The default code model is "normal".
22380
22381 -mexplicit-relocs
22382 -mno-explicit-relocs
22383 Use or do not use assembler relocation operators when dealing with
22384 symbolic addresses. The alternative is to use assembler macros
22385 instead, which may limit optimization. The default value for the
22386 option is determined during GCC build-time by detecting
22387 corresponding assembler support: "-mexplicit-relocs" if said
22388 support is present, "-mno-explicit-relocs" otherwise. This option
22389 is mostly useful for debugging, or interoperation with assemblers
22390 different from the build-time one.
22391
22392 -mdirect-extern-access
22393 -mno-direct-extern-access
22394 Do not use or use GOT to access external symbols. The default is
22395 -mno-direct-extern-access: GOT is used for external symbols with
22396 default visibility, but not used for other external symbols.
22397
22398 With -mdirect-extern-access, GOT is not used and all external
22399 symbols are PC-relatively addressed. It is only suitable for
22400 environments where no dynamic link is performed, like firmwares, OS
22401 kernels, executables linked with -static or -static-pie.
22402 -mdirect-extern-access is not compatible with -fPIC or -fpic.
22403
22404 M32C Options
22405 -mcpu=name
22406 Select the CPU for which code is generated. name may be one of r8c
22407 for the R8C/Tiny series, m16c for the M16C (up to /60) series,
22408 m32cm for the M16C/80 series, or m32c for the M32C/80 series.
22409
22410 -msim
22411 Specifies that the program will be run on the simulator. This
22412 causes an alternate runtime library to be linked in which supports,
22413 for example, file I/O. You must not use this option when
22414 generating programs that will run on real hardware; you must
22415 provide your own runtime library for whatever I/O functions are
22416 needed.
22417
22418 -memregs=number
22419 Specifies the number of memory-based pseudo-registers GCC uses
22420 during code generation. These pseudo-registers are used like real
22421 registers, so there is a tradeoff between GCC's ability to fit the
22422 code into available registers, and the performance penalty of using
22423 memory instead of registers. Note that all modules in a program
22424 must be compiled with the same value for this option. Because of
22425 that, you must not use this option with GCC's default runtime
22426 libraries.
22427
22428 M32R/D Options
22429 These -m options are defined for Renesas M32R/D architectures:
22430
22431 -m32r2
22432 Generate code for the M32R/2.
22433
22434 -m32rx
22435 Generate code for the M32R/X.
22436
22437 -m32r
22438 Generate code for the M32R. This is the default.
22439
22440 -mmodel=small
22441 Assume all objects live in the lower 16MB of memory (so that their
22442 addresses can be loaded with the "ld24" instruction), and assume
22443 all subroutines are reachable with the "bl" instruction. This is
22444 the default.
22445
22446 The addressability of a particular object can be set with the
22447 "model" attribute.
22448
22449 -mmodel=medium
22450 Assume objects may be anywhere in the 32-bit address space (the
22451 compiler generates "seth/add3" instructions to load their
22452 addresses), and assume all subroutines are reachable with the "bl"
22453 instruction.
22454
22455 -mmodel=large
22456 Assume objects may be anywhere in the 32-bit address space (the
22457 compiler generates "seth/add3" instructions to load their
22458 addresses), and assume subroutines may not be reachable with the
22459 "bl" instruction (the compiler generates the much slower
22460 "seth/add3/jl" instruction sequence).
22461
22462 -msdata=none
22463 Disable use of the small data area. Variables are put into one of
22464 ".data", ".bss", or ".rodata" (unless the "section" attribute has
22465 been specified). This is the default.
22466
22467 The small data area consists of sections ".sdata" and ".sbss".
22468 Objects may be explicitly put in the small data area with the
22469 "section" attribute using one of these sections.
22470
22471 -msdata=sdata
22472 Put small global and static data in the small data area, but do not
22473 generate special code to reference them.
22474
22475 -msdata=use
22476 Put small global and static data in the small data area, and
22477 generate special instructions to reference them.
22478
22479 -G num
22480 Put global and static objects less than or equal to num bytes into
22481 the small data or BSS sections instead of the normal data or BSS
22482 sections. The default value of num is 8. The -msdata option must
22483 be set to one of sdata or use for this option to have any effect.
22484
22485 All modules should be compiled with the same -G num value.
22486 Compiling with different values of num may or may not work; if it
22487 doesn't the linker gives an error message---incorrect code is not
22488 generated.
22489
22490 -mdebug
22491 Makes the M32R-specific code in the compiler display some
22492 statistics that might help in debugging programs.
22493
22494 -malign-loops
22495 Align all loops to a 32-byte boundary.
22496
22497 -mno-align-loops
22498 Do not enforce a 32-byte alignment for loops. This is the default.
22499
22500 -missue-rate=number
22501 Issue number instructions per cycle. number can only be 1 or 2.
22502
22503 -mbranch-cost=number
22504 number can only be 1 or 2. If it is 1 then branches are preferred
22505 over conditional code, if it is 2, then the opposite applies.
22506
22507 -mflush-trap=number
22508 Specifies the trap number to use to flush the cache. The default
22509 is 12. Valid numbers are between 0 and 15 inclusive.
22510
22511 -mno-flush-trap
22512 Specifies that the cache cannot be flushed by using a trap.
22513
22514 -mflush-func=name
22515 Specifies the name of the operating system function to call to
22516 flush the cache. The default is _flush_cache, but a function call
22517 is only used if a trap is not available.
22518
22519 -mno-flush-func
22520 Indicates that there is no OS function for flushing the cache.
22521
22522 M680x0 Options
22523 These are the -m options defined for M680x0 and ColdFire processors.
22524 The default settings depend on which architecture was selected when the
22525 compiler was configured; the defaults for the most common choices are
22526 given below.
22527
22528 -march=arch
22529 Generate code for a specific M680x0 or ColdFire instruction set
22530 architecture. Permissible values of arch for M680x0 architectures
22531 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. ColdFire
22532 architectures are selected according to Freescale's ISA
22533 classification and the permissible values are: isaa, isaaplus, isab
22534 and isac.
22535
22536 GCC defines a macro "__mcfarch__" whenever it is generating code
22537 for a ColdFire target. The arch in this macro is one of the -march
22538 arguments given above.
22539
22540 When used together, -march and -mtune select code that runs on a
22541 family of similar processors but that is optimized for a particular
22542 microarchitecture.
22543
22544 -mcpu=cpu
22545 Generate code for a specific M680x0 or ColdFire processor. The
22546 M680x0 cpus are: 68000, 68010, 68020, 68030, 68040, 68060, 68302,
22547 68332 and cpu32. The ColdFire cpus are given by the table below,
22548 which also classifies the CPUs into families:
22549
22550 Family : -mcpu arguments
22551 51 : 51 51ac 51ag 51cn 51em 51je 51jf 51jg 51jm 51mm 51qe 51qm
22552 5206 : 5202 5204 5206
22553 5206e : 5206e
22554 5208 : 5207 5208
22555 5211a : 5210a 5211a
22556 5213 : 5211 5212 5213
22557 5216 : 5214 5216
22558 52235 : 52230 52231 52232 52233 52234 52235
22559 5225 : 5224 5225
22560 52259 : 52252 52254 52255 52256 52258 52259
22561 5235 : 5232 5233 5234 5235 523x
22562 5249 : 5249
22563 5250 : 5250
22564 5271 : 5270 5271
22565 5272 : 5272
22566 5275 : 5274 5275
22567 5282 : 5280 5281 5282 528x
22568 53017 : 53011 53012 53013 53014 53015 53016 53017
22569 5307 : 5307
22570 5329 : 5327 5328 5329 532x
22571 5373 : 5372 5373 537x
22572 5407 : 5407
22573 5475 : 5470 5471 5472 5473 5474 5475 547x 5480 5481 5482 5483 5484
22574 5485
22575
22576 -mcpu=cpu overrides -march=arch if arch is compatible with cpu.
22577 Other combinations of -mcpu and -march are rejected.
22578
22579 GCC defines the macro "__mcf_cpu_cpu" when ColdFire target cpu is
22580 selected. It also defines "__mcf_family_family", where the value
22581 of family is given by the table above.
22582
22583 -mtune=tune
22584 Tune the code for a particular microarchitecture within the
22585 constraints set by -march and -mcpu. The M680x0 microarchitectures
22586 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. The
22587 ColdFire microarchitectures are: cfv1, cfv2, cfv3, cfv4 and cfv4e.
22588
22589 You can also use -mtune=68020-40 for code that needs to run
22590 relatively well on 68020, 68030 and 68040 targets. -mtune=68020-60
22591 is similar but includes 68060 targets as well. These two options
22592 select the same tuning decisions as -m68020-40 and -m68020-60
22593 respectively.
22594
22595 GCC defines the macros "__mcarch" and "__mcarch__" when tuning for
22596 680x0 architecture arch. It also defines "mcarch" unless either
22597 -ansi or a non-GNU -std option is used. If GCC is tuning for a
22598 range of architectures, as selected by -mtune=68020-40 or
22599 -mtune=68020-60, it defines the macros for every architecture in
22600 the range.
22601
22602 GCC also defines the macro "__muarch__" when tuning for ColdFire
22603 microarchitecture uarch, where uarch is one of the arguments given
22604 above.
22605
22606 -m68000
22607 -mc68000
22608 Generate output for a 68000. This is the default when the compiler
22609 is configured for 68000-based systems. It is equivalent to
22610 -march=68000.
22611
22612 Use this option for microcontrollers with a 68000 or EC000 core,
22613 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
22614
22615 -m68010
22616 Generate output for a 68010. This is the default when the compiler
22617 is configured for 68010-based systems. It is equivalent to
22618 -march=68010.
22619
22620 -m68020
22621 -mc68020
22622 Generate output for a 68020. This is the default when the compiler
22623 is configured for 68020-based systems. It is equivalent to
22624 -march=68020.
22625
22626 -m68030
22627 Generate output for a 68030. This is the default when the compiler
22628 is configured for 68030-based systems. It is equivalent to
22629 -march=68030.
22630
22631 -m68040
22632 Generate output for a 68040. This is the default when the compiler
22633 is configured for 68040-based systems. It is equivalent to
22634 -march=68040.
22635
22636 This option inhibits the use of 68881/68882 instructions that have
22637 to be emulated by software on the 68040. Use this option if your
22638 68040 does not have code to emulate those instructions.
22639
22640 -m68060
22641 Generate output for a 68060. This is the default when the compiler
22642 is configured for 68060-based systems. It is equivalent to
22643 -march=68060.
22644
22645 This option inhibits the use of 68020 and 68881/68882 instructions
22646 that have to be emulated by software on the 68060. Use this option
22647 if your 68060 does not have code to emulate those instructions.
22648
22649 -mcpu32
22650 Generate output for a CPU32. This is the default when the compiler
22651 is configured for CPU32-based systems. It is equivalent to
22652 -march=cpu32.
22653
22654 Use this option for microcontrollers with a CPU32 or CPU32+ core,
22655 including the 68330, 68331, 68332, 68333, 68334, 68336, 68340,
22656 68341, 68349 and 68360.
22657
22658 -m5200
22659 Generate output for a 520X ColdFire CPU. This is the default when
22660 the compiler is configured for 520X-based systems. It is
22661 equivalent to -mcpu=5206, and is now deprecated in favor of that
22662 option.
22663
22664 Use this option for microcontroller with a 5200 core, including the
22665 MCF5202, MCF5203, MCF5204 and MCF5206.
22666
22667 -m5206e
22668 Generate output for a 5206e ColdFire CPU. The option is now
22669 deprecated in favor of the equivalent -mcpu=5206e.
22670
22671 -m528x
22672 Generate output for a member of the ColdFire 528X family. The
22673 option is now deprecated in favor of the equivalent -mcpu=528x.
22674
22675 -m5307
22676 Generate output for a ColdFire 5307 CPU. The option is now
22677 deprecated in favor of the equivalent -mcpu=5307.
22678
22679 -m5407
22680 Generate output for a ColdFire 5407 CPU. The option is now
22681 deprecated in favor of the equivalent -mcpu=5407.
22682
22683 -mcfv4e
22684 Generate output for a ColdFire V4e family CPU (e.g. 547x/548x).
22685 This includes use of hardware floating-point instructions. The
22686 option is equivalent to -mcpu=547x, and is now deprecated in favor
22687 of that option.
22688
22689 -m68020-40
22690 Generate output for a 68040, without using any of the new
22691 instructions. This results in code that can run relatively
22692 efficiently on either a 68020/68881 or a 68030 or a 68040. The
22693 generated code does use the 68881 instructions that are emulated on
22694 the 68040.
22695
22696 The option is equivalent to -march=68020 -mtune=68020-40.
22697
22698 -m68020-60
22699 Generate output for a 68060, without using any of the new
22700 instructions. This results in code that can run relatively
22701 efficiently on either a 68020/68881 or a 68030 or a 68040. The
22702 generated code does use the 68881 instructions that are emulated on
22703 the 68060.
22704
22705 The option is equivalent to -march=68020 -mtune=68020-60.
22706
22707 -mhard-float
22708 -m68881
22709 Generate floating-point instructions. This is the default for
22710 68020 and above, and for ColdFire devices that have an FPU. It
22711 defines the macro "__HAVE_68881__" on M680x0 targets and
22712 "__mcffpu__" on ColdFire targets.
22713
22714 -msoft-float
22715 Do not generate floating-point instructions; use library calls
22716 instead. This is the default for 68000, 68010, and 68832 targets.
22717 It is also the default for ColdFire devices that have no FPU.
22718
22719 -mdiv
22720 -mno-div
22721 Generate (do not generate) ColdFire hardware divide and remainder
22722 instructions. If -march is used without -mcpu, the default is "on"
22723 for ColdFire architectures and "off" for M680x0 architectures.
22724 Otherwise, the default is taken from the target CPU (either the
22725 default CPU, or the one specified by -mcpu). For example, the
22726 default is "off" for -mcpu=5206 and "on" for -mcpu=5206e.
22727
22728 GCC defines the macro "__mcfhwdiv__" when this option is enabled.
22729
22730 -mshort
22731 Consider type "int" to be 16 bits wide, like "short int".
22732 Additionally, parameters passed on the stack are also aligned to a
22733 16-bit boundary even on targets whose API mandates promotion to
22734 32-bit.
22735
22736 -mno-short
22737 Do not consider type "int" to be 16 bits wide. This is the
22738 default.
22739
22740 -mnobitfield
22741 -mno-bitfield
22742 Do not use the bit-field instructions. The -m68000, -mcpu32 and
22743 -m5200 options imply -mnobitfield.
22744
22745 -mbitfield
22746 Do use the bit-field instructions. The -m68020 option implies
22747 -mbitfield. This is the default if you use a configuration
22748 designed for a 68020.
22749
22750 -mrtd
22751 Use a different function-calling convention, in which functions
22752 that take a fixed number of arguments return with the "rtd"
22753 instruction, which pops their arguments while returning. This
22754 saves one instruction in the caller since there is no need to pop
22755 the arguments there.
22756
22757 This calling convention is incompatible with the one normally used
22758 on Unix, so you cannot use it if you need to call libraries
22759 compiled with the Unix compiler.
22760
22761 Also, you must provide function prototypes for all functions that
22762 take variable numbers of arguments (including "printf"); otherwise
22763 incorrect code is generated for calls to those functions.
22764
22765 In addition, seriously incorrect code results if you call a
22766 function with too many arguments. (Normally, extra arguments are
22767 harmlessly ignored.)
22768
22769 The "rtd" instruction is supported by the 68010, 68020, 68030,
22770 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
22771
22772 The default is -mno-rtd.
22773
22774 -malign-int
22775 -mno-align-int
22776 Control whether GCC aligns "int", "long", "long long", "float",
22777 "double", and "long double" variables on a 32-bit boundary
22778 (-malign-int) or a 16-bit boundary (-mno-align-int). Aligning
22779 variables on 32-bit boundaries produces code that runs somewhat
22780 faster on processors with 32-bit busses at the expense of more
22781 memory.
22782
22783 Warning: if you use the -malign-int switch, GCC aligns structures
22784 containing the above types differently than most published
22785 application binary interface specifications for the m68k.
22786
22787 Use the pc-relative addressing mode of the 68000 directly, instead
22788 of using a global offset table. At present, this option implies
22789 -fpic, allowing at most a 16-bit offset for pc-relative addressing.
22790 -fPIC is not presently supported with -mpcrel, though this could be
22791 supported for 68020 and higher processors.
22792
22793 -mno-strict-align
22794 -mstrict-align
22795 Do not (do) assume that unaligned memory references are handled by
22796 the system.
22797
22798 -msep-data
22799 Generate code that allows the data segment to be located in a
22800 different area of memory from the text segment. This allows for
22801 execute-in-place in an environment without virtual memory
22802 management. This option implies -fPIC.
22803
22804 -mno-sep-data
22805 Generate code that assumes that the data segment follows the text
22806 segment. This is the default.
22807
22808 -mid-shared-library
22809 Generate code that supports shared libraries via the library ID
22810 method. This allows for execute-in-place and shared libraries in
22811 an environment without virtual memory management. This option
22812 implies -fPIC.
22813
22814 -mno-id-shared-library
22815 Generate code that doesn't assume ID-based shared libraries are
22816 being used. This is the default.
22817
22818 -mshared-library-id=n
22819 Specifies the identification number of the ID-based shared library
22820 being compiled. Specifying a value of 0 generates more compact
22821 code; specifying other values forces the allocation of that number
22822 to the current library, but is no more space- or time-efficient
22823 than omitting this option.
22824
22825 -mxgot
22826 -mno-xgot
22827 When generating position-independent code for ColdFire, generate
22828 code that works if the GOT has more than 8192 entries. This code
22829 is larger and slower than code generated without this option. On
22830 M680x0 processors, this option is not needed; -fPIC suffices.
22831
22832 GCC normally uses a single instruction to load values from the GOT.
22833 While this is relatively efficient, it only works if the GOT is
22834 smaller than about 64k. Anything larger causes the linker to
22835 report an error such as:
22836
22837 relocation truncated to fit: R_68K_GOT16O foobar
22838
22839 If this happens, you should recompile your code with -mxgot. It
22840 should then work with very large GOTs. However, code generated
22841 with -mxgot is less efficient, since it takes 4 instructions to
22842 fetch the value of a global symbol.
22843
22844 Note that some linkers, including newer versions of the GNU linker,
22845 can create multiple GOTs and sort GOT entries. If you have such a
22846 linker, you should only need to use -mxgot when compiling a single
22847 object file that accesses more than 8192 GOT entries. Very few do.
22848
22849 These options have no effect unless GCC is generating position-
22850 independent code.
22851
22852 -mlong-jump-table-offsets
22853 Use 32-bit offsets in "switch" tables. The default is to use
22854 16-bit offsets.
22855
22856 MCore Options
22857 These are the -m options defined for the Motorola M*Core processors.
22858
22859 -mhardlit
22860 -mno-hardlit
22861 Inline constants into the code stream if it can be done in two
22862 instructions or less.
22863
22864 -mdiv
22865 -mno-div
22866 Use the divide instruction. (Enabled by default).
22867
22868 -mrelax-immediate
22869 -mno-relax-immediate
22870 Allow arbitrary-sized immediates in bit operations.
22871
22872 -mwide-bitfields
22873 -mno-wide-bitfields
22874 Always treat bit-fields as "int"-sized.
22875
22876 -m4byte-functions
22877 -mno-4byte-functions
22878 Force all functions to be aligned to a 4-byte boundary.
22879
22880 -mcallgraph-data
22881 -mno-callgraph-data
22882 Emit callgraph information.
22883
22884 -mslow-bytes
22885 -mno-slow-bytes
22886 Prefer word access when reading byte quantities.
22887
22888 -mlittle-endian
22889 -mbig-endian
22890 Generate code for a little-endian target.
22891
22892 -m210
22893 -m340
22894 Generate code for the 210 processor.
22895
22896 -mno-lsim
22897 Assume that runtime support has been provided and so omit the
22898 simulator library (libsim.a) from the linker command line.
22899
22900 -mstack-increment=size
22901 Set the maximum amount for a single stack increment operation.
22902 Large values can increase the speed of programs that contain
22903 functions that need a large amount of stack space, but they can
22904 also trigger a segmentation fault if the stack is extended too
22905 much. The default value is 0x1000.
22906
22907 MicroBlaze Options
22908 -msoft-float
22909 Use software emulation for floating point (default).
22910
22911 -mhard-float
22912 Use hardware floating-point instructions.
22913
22914 -mmemcpy
22915 Do not optimize block moves, use "memcpy".
22916
22917 -mno-clearbss
22918 This option is deprecated. Use -fno-zero-initialized-in-bss
22919 instead.
22920
22921 -mcpu=cpu-type
22922 Use features of, and schedule code for, the given CPU. Supported
22923 values are in the format vX.YY.Z, where X is a major version, YY is
22924 the minor version, and Z is compatibility code. Example values are
22925 v3.00.a, v4.00.b, v5.00.a, v5.00.b, v6.00.a.
22926
22927 -mxl-soft-mul
22928 Use software multiply emulation (default).
22929
22930 -mxl-soft-div
22931 Use software emulation for divides (default).
22932
22933 -mxl-barrel-shift
22934 Use the hardware barrel shifter.
22935
22936 -mxl-pattern-compare
22937 Use pattern compare instructions.
22938
22939 -msmall-divides
22940 Use table lookup optimization for small signed integer divisions.
22941
22942 -mxl-stack-check
22943 This option is deprecated. Use -fstack-check instead.
22944
22945 -mxl-gp-opt
22946 Use GP-relative ".sdata"/".sbss" sections.
22947
22948 -mxl-multiply-high
22949 Use multiply high instructions for high part of 32x32 multiply.
22950
22951 -mxl-float-convert
22952 Use hardware floating-point conversion instructions.
22953
22954 -mxl-float-sqrt
22955 Use hardware floating-point square root instruction.
22956
22957 -mbig-endian
22958 Generate code for a big-endian target.
22959
22960 -mlittle-endian
22961 Generate code for a little-endian target.
22962
22963 -mxl-reorder
22964 Use reorder instructions (swap and byte reversed load/store).
22965
22966 -mxl-mode-app-model
22967 Select application model app-model. Valid models are
22968
22969 executable
22970 normal executable (default), uses startup code crt0.o.
22971
22972 xmdstub
22973 for use with Xilinx Microprocessor Debugger (XMD) based
22974 software intrusive debug agent called xmdstub. This uses
22975 startup file crt1.o and sets the start address of the program
22976 to 0x800.
22977
22978 bootstrap
22979 for applications that are loaded using a bootloader. This
22980 model uses startup file crt2.o which does not contain a
22981 processor reset vector handler. This is suitable for
22982 transferring control on a processor reset to the bootloader
22983 rather than the application.
22984
22985 novectors
22986 for applications that do not require any of the MicroBlaze
22987 vectors. This option may be useful for applications running
22988 within a monitoring application. This model uses crt3.o as a
22989 startup file.
22990
22991 Option -xl-mode-app-model is a deprecated alias for -mxl-mode-app-
22992 model.
22993
22994 -mpic-data-is-text-relative
22995 Assume that the displacement between the text and data segments is
22996 fixed at static link time. This allows data to be referenced by
22997 offset from start of text address instead of GOT since PC-relative
22998 addressing is not supported.
22999
23000 MIPS Options
23001 -EB Generate big-endian code.
23002
23003 -EL Generate little-endian code. This is the default for mips*el-*-*
23004 configurations.
23005
23006 -march=arch
23007 Generate code that runs on arch, which can be the name of a generic
23008 MIPS ISA, or the name of a particular processor. The ISA names
23009 are: mips1, mips2, mips3, mips4, mips32, mips32r2, mips32r3,
23010 mips32r5, mips32r6, mips64, mips64r2, mips64r3, mips64r5 and
23011 mips64r6. The processor names are: 4kc, 4km, 4kp, 4ksc, 4kec,
23012 4kem, 4kep, 4ksd, 5kc, 5kf, 20kc, 24kc, 24kf2_1, 24kf1_1, 24kec,
23013 24kef2_1, 24kef1_1, 34kc, 34kf2_1, 34kf1_1, 34kn, 74kc, 74kf2_1,
23014 74kf1_1, 74kf3_2, 1004kc, 1004kf2_1, 1004kf1_1, i6400, i6500,
23015 interaptiv, loongson2e, loongson2f, loongson3a, gs464, gs464e,
23016 gs264e, m4k, m14k, m14kc, m14ke, m14kec, m5100, m5101, octeon,
23017 octeon+, octeon2, octeon3, orion, p5600, p6600, r2000, r3000,
23018 r3900, r4000, r4400, r4600, r4650, r4700, r5900, r6000, r8000,
23019 rm7000, rm9000, r10000, r12000, r14000, r16000, sb1, sr71000,
23020 vr4100, vr4111, vr4120, vr4130, vr4300, vr5000, vr5400, vr5500, xlr
23021 and xlp. The special value from-abi selects the most compatible
23022 architecture for the selected ABI (that is, mips1 for 32-bit ABIs
23023 and mips3 for 64-bit ABIs).
23024
23025 The native Linux/GNU toolchain also supports the value native,
23026 which selects the best architecture option for the host processor.
23027 -march=native has no effect if GCC does not recognize the
23028 processor.
23029
23030 In processor names, a final 000 can be abbreviated as k (for
23031 example, -march=r2k). Prefixes are optional, and vr may be written
23032 r.
23033
23034 Names of the form nf2_1 refer to processors with FPUs clocked at
23035 half the rate of the core, names of the form nf1_1 refer to
23036 processors with FPUs clocked at the same rate as the core, and
23037 names of the form nf3_2 refer to processors with FPUs clocked a
23038 ratio of 3:2 with respect to the core. For compatibility reasons,
23039 nf is accepted as a synonym for nf2_1 while nx and bfx are accepted
23040 as synonyms for nf1_1.
23041
23042 GCC defines two macros based on the value of this option. The
23043 first is "_MIPS_ARCH", which gives the name of target architecture,
23044 as a string. The second has the form "_MIPS_ARCH_foo", where foo
23045 is the capitalized value of "_MIPS_ARCH". For example,
23046 -march=r2000 sets "_MIPS_ARCH" to "r2000" and defines the macro
23047 "_MIPS_ARCH_R2000".
23048
23049 Note that the "_MIPS_ARCH" macro uses the processor names given
23050 above. In other words, it has the full prefix and does not
23051 abbreviate 000 as k. In the case of from-abi, the macro names the
23052 resolved architecture (either "mips1" or "mips3"). It names the
23053 default architecture when no -march option is given.
23054
23055 -mtune=arch
23056 Optimize for arch. Among other things, this option controls the
23057 way instructions are scheduled, and the perceived cost of
23058 arithmetic operations. The list of arch values is the same as for
23059 -march.
23060
23061 When this option is not used, GCC optimizes for the processor
23062 specified by -march. By using -march and -mtune together, it is
23063 possible to generate code that runs on a family of processors, but
23064 optimize the code for one particular member of that family.
23065
23066 -mtune defines the macros "_MIPS_TUNE" and "_MIPS_TUNE_foo", which
23067 work in the same way as the -march ones described above.
23068
23069 -mips1
23070 Equivalent to -march=mips1.
23071
23072 -mips2
23073 Equivalent to -march=mips2.
23074
23075 -mips3
23076 Equivalent to -march=mips3.
23077
23078 -mips4
23079 Equivalent to -march=mips4.
23080
23081 -mips32
23082 Equivalent to -march=mips32.
23083
23084 -mips32r3
23085 Equivalent to -march=mips32r3.
23086
23087 -mips32r5
23088 Equivalent to -march=mips32r5.
23089
23090 -mips32r6
23091 Equivalent to -march=mips32r6.
23092
23093 -mips64
23094 Equivalent to -march=mips64.
23095
23096 -mips64r2
23097 Equivalent to -march=mips64r2.
23098
23099 -mips64r3
23100 Equivalent to -march=mips64r3.
23101
23102 -mips64r5
23103 Equivalent to -march=mips64r5.
23104
23105 -mips64r6
23106 Equivalent to -march=mips64r6.
23107
23108 -mips16
23109 -mno-mips16
23110 Generate (do not generate) MIPS16 code. If GCC is targeting a
23111 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE.
23112
23113 MIPS16 code generation can also be controlled on a per-function
23114 basis by means of "mips16" and "nomips16" attributes.
23115
23116 -mflip-mips16
23117 Generate MIPS16 code on alternating functions. This option is
23118 provided for regression testing of mixed MIPS16/non-MIPS16 code
23119 generation, and is not intended for ordinary use in compiling user
23120 code.
23121
23122 -minterlink-compressed
23123 -mno-interlink-compressed
23124 Require (do not require) that code using the standard
23125 (uncompressed) MIPS ISA be link-compatible with MIPS16 and
23126 microMIPS code, and vice versa.
23127
23128 For example, code using the standard ISA encoding cannot jump
23129 directly to MIPS16 or microMIPS code; it must either use a call or
23130 an indirect jump. -minterlink-compressed therefore disables direct
23131 jumps unless GCC knows that the target of the jump is not
23132 compressed.
23133
23134 -minterlink-mips16
23135 -mno-interlink-mips16
23136 Aliases of -minterlink-compressed and -mno-interlink-compressed.
23137 These options predate the microMIPS ASE and are retained for
23138 backwards compatibility.
23139
23140 -mabi=32
23141 -mabi=o64
23142 -mabi=n32
23143 -mabi=64
23144 -mabi=eabi
23145 Generate code for the given ABI.
23146
23147 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
23148 generates 64-bit code when you select a 64-bit architecture, but
23149 you can use -mgp32 to get 32-bit code instead.
23150
23151 For information about the O64 ABI, see
23152 <https://gcc.gnu.org/projects/mipso64-abi.html>.
23153
23154 GCC supports a variant of the o32 ABI in which floating-point
23155 registers are 64 rather than 32 bits wide. You can select this
23156 combination with -mabi=32 -mfp64. This ABI relies on the "mthc1"
23157 and "mfhc1" instructions and is therefore only supported for
23158 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
23159
23160 The register assignments for arguments and return values remain the
23161 same, but each scalar value is passed in a single 64-bit register
23162 rather than a pair of 32-bit registers. For example, scalar
23163 floating-point values are returned in $f0 only, not a $f0/$f1 pair.
23164 The set of call-saved registers also remains the same in that the
23165 even-numbered double-precision registers are saved.
23166
23167 Two additional variants of the o32 ABI are supported to enable a
23168 transition from 32-bit to 64-bit registers. These are FPXX
23169 (-mfpxx) and FP64A (-mfp64 -mno-odd-spreg). The FPXX extension
23170 mandates that all code must execute correctly when run using 32-bit
23171 or 64-bit registers. The code can be interlinked with either FP32
23172 or FP64, but not both. The FP64A extension is similar to the FP64
23173 extension but forbids the use of odd-numbered single-precision
23174 registers. This can be used in conjunction with the "FRE" mode of
23175 FPUs in MIPS32R5 processors and allows both FP32 and FP64A code to
23176 interlink and run in the same process without changing FPU modes.
23177
23178 -mabicalls
23179 -mno-abicalls
23180 Generate (do not generate) code that is suitable for SVR4-style
23181 dynamic objects. -mabicalls is the default for SVR4-based systems.
23182
23183 -mshared
23184 -mno-shared
23185 Generate (do not generate) code that is fully position-independent,
23186 and that can therefore be linked into shared libraries. This
23187 option only affects -mabicalls.
23188
23189 All -mabicalls code has traditionally been position-independent,
23190 regardless of options like -fPIC and -fpic. However, as an
23191 extension, the GNU toolchain allows executables to use absolute
23192 accesses for locally-binding symbols. It can also use shorter GP
23193 initialization sequences and generate direct calls to locally-
23194 defined functions. This mode is selected by -mno-shared.
23195
23196 -mno-shared depends on binutils 2.16 or higher and generates
23197 objects that can only be linked by the GNU linker. However, the
23198 option does not affect the ABI of the final executable; it only
23199 affects the ABI of relocatable objects. Using -mno-shared
23200 generally makes executables both smaller and quicker.
23201
23202 -mshared is the default.
23203
23204 -mplt
23205 -mno-plt
23206 Assume (do not assume) that the static and dynamic linkers support
23207 PLTs and copy relocations. This option only affects -mno-shared
23208 -mabicalls. For the n64 ABI, this option has no effect without
23209 -msym32.
23210
23211 You can make -mplt the default by configuring GCC with
23212 --with-mips-plt. The default is -mno-plt otherwise.
23213
23214 -mxgot
23215 -mno-xgot
23216 Lift (do not lift) the usual restrictions on the size of the global
23217 offset table.
23218
23219 GCC normally uses a single instruction to load values from the GOT.
23220 While this is relatively efficient, it only works if the GOT is
23221 smaller than about 64k. Anything larger causes the linker to
23222 report an error such as:
23223
23224 relocation truncated to fit: R_MIPS_GOT16 foobar
23225
23226 If this happens, you should recompile your code with -mxgot. This
23227 works with very large GOTs, although the code is also less
23228 efficient, since it takes three instructions to fetch the value of
23229 a global symbol.
23230
23231 Note that some linkers can create multiple GOTs. If you have such
23232 a linker, you should only need to use -mxgot when a single object
23233 file accesses more than 64k's worth of GOT entries. Very few do.
23234
23235 These options have no effect unless GCC is generating position
23236 independent code.
23237
23238 -mgp32
23239 Assume that general-purpose registers are 32 bits wide.
23240
23241 -mgp64
23242 Assume that general-purpose registers are 64 bits wide.
23243
23244 -mfp32
23245 Assume that floating-point registers are 32 bits wide.
23246
23247 -mfp64
23248 Assume that floating-point registers are 64 bits wide.
23249
23250 -mfpxx
23251 Do not assume the width of floating-point registers.
23252
23253 -mhard-float
23254 Use floating-point coprocessor instructions.
23255
23256 -msoft-float
23257 Do not use floating-point coprocessor instructions. Implement
23258 floating-point calculations using library calls instead.
23259
23260 -mno-float
23261 Equivalent to -msoft-float, but additionally asserts that the
23262 program being compiled does not perform any floating-point
23263 operations. This option is presently supported only by some bare-
23264 metal MIPS configurations, where it may select a special set of
23265 libraries that lack all floating-point support (including, for
23266 example, the floating-point "printf" formats). If code compiled
23267 with -mno-float accidentally contains floating-point operations, it
23268 is likely to suffer a link-time or run-time failure.
23269
23270 -msingle-float
23271 Assume that the floating-point coprocessor only supports single-
23272 precision operations.
23273
23274 -mdouble-float
23275 Assume that the floating-point coprocessor supports double-
23276 precision operations. This is the default.
23277
23278 -modd-spreg
23279 -mno-odd-spreg
23280 Enable the use of odd-numbered single-precision floating-point
23281 registers for the o32 ABI. This is the default for processors that
23282 are known to support these registers. When using the o32 FPXX ABI,
23283 -mno-odd-spreg is set by default.
23284
23285 -mabs=2008
23286 -mabs=legacy
23287 These options control the treatment of the special not-a-number
23288 (NaN) IEEE 754 floating-point data with the "abs.fmt" and "neg.fmt"
23289 machine instructions.
23290
23291 By default or when -mabs=legacy is used the legacy treatment is
23292 selected. In this case these instructions are considered
23293 arithmetic and avoided where correct operation is required and the
23294 input operand might be a NaN. A longer sequence of instructions
23295 that manipulate the sign bit of floating-point datum manually is
23296 used instead unless the -ffinite-math-only option has also been
23297 specified.
23298
23299 The -mabs=2008 option selects the IEEE 754-2008 treatment. In this
23300 case these instructions are considered non-arithmetic and therefore
23301 operating correctly in all cases, including in particular where the
23302 input operand is a NaN. These instructions are therefore always
23303 used for the respective operations.
23304
23305 -mnan=2008
23306 -mnan=legacy
23307 These options control the encoding of the special not-a-number
23308 (NaN) IEEE 754 floating-point data.
23309
23310 The -mnan=legacy option selects the legacy encoding. In this case
23311 quiet NaNs (qNaNs) are denoted by the first bit of their trailing
23312 significand field being 0, whereas signaling NaNs (sNaNs) are
23313 denoted by the first bit of their trailing significand field being
23314 1.
23315
23316 The -mnan=2008 option selects the IEEE 754-2008 encoding. In this
23317 case qNaNs are denoted by the first bit of their trailing
23318 significand field being 1, whereas sNaNs are denoted by the first
23319 bit of their trailing significand field being 0.
23320
23321 The default is -mnan=legacy unless GCC has been configured with
23322 --with-nan=2008.
23323
23324 -mllsc
23325 -mno-llsc
23326 Use (do not use) ll, sc, and sync instructions to implement atomic
23327 memory built-in functions. When neither option is specified, GCC
23328 uses the instructions if the target architecture supports them.
23329
23330 -mllsc is useful if the runtime environment can emulate the
23331 instructions and -mno-llsc can be useful when compiling for
23332 nonstandard ISAs. You can make either option the default by
23333 configuring GCC with --with-llsc and --without-llsc respectively.
23334 --with-llsc is the default for some configurations; see the
23335 installation documentation for details.
23336
23337 -mdsp
23338 -mno-dsp
23339 Use (do not use) revision 1 of the MIPS DSP ASE.
23340 This option defines the preprocessor macro "__mips_dsp". It also
23341 defines "__mips_dsp_rev" to 1.
23342
23343 -mdspr2
23344 -mno-dspr2
23345 Use (do not use) revision 2 of the MIPS DSP ASE.
23346 This option defines the preprocessor macros "__mips_dsp" and
23347 "__mips_dspr2". It also defines "__mips_dsp_rev" to 2.
23348
23349 -msmartmips
23350 -mno-smartmips
23351 Use (do not use) the MIPS SmartMIPS ASE.
23352
23353 -mpaired-single
23354 -mno-paired-single
23355 Use (do not use) paired-single floating-point instructions.
23356 This option requires hardware floating-point support to be
23357 enabled.
23358
23359 -mdmx
23360 -mno-mdmx
23361 Use (do not use) MIPS Digital Media Extension instructions. This
23362 option can only be used when generating 64-bit code and requires
23363 hardware floating-point support to be enabled.
23364
23365 -mips3d
23366 -mno-mips3d
23367 Use (do not use) the MIPS-3D ASE. The option -mips3d implies
23368 -mpaired-single.
23369
23370 -mmicromips
23371 -mno-micromips
23372 Generate (do not generate) microMIPS code.
23373
23374 MicroMIPS code generation can also be controlled on a per-function
23375 basis by means of "micromips" and "nomicromips" attributes.
23376
23377 -mmt
23378 -mno-mt
23379 Use (do not use) MT Multithreading instructions.
23380
23381 -mmcu
23382 -mno-mcu
23383 Use (do not use) the MIPS MCU ASE instructions.
23384
23385 -meva
23386 -mno-eva
23387 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
23388
23389 -mvirt
23390 -mno-virt
23391 Use (do not use) the MIPS Virtualization (VZ) instructions.
23392
23393 -mxpa
23394 -mno-xpa
23395 Use (do not use) the MIPS eXtended Physical Address (XPA)
23396 instructions.
23397
23398 -mcrc
23399 -mno-crc
23400 Use (do not use) the MIPS Cyclic Redundancy Check (CRC)
23401 instructions.
23402
23403 -mginv
23404 -mno-ginv
23405 Use (do not use) the MIPS Global INValidate (GINV) instructions.
23406
23407 -mloongson-mmi
23408 -mno-loongson-mmi
23409 Use (do not use) the MIPS Loongson MultiMedia extensions
23410 Instructions (MMI).
23411
23412 -mloongson-ext
23413 -mno-loongson-ext
23414 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
23415
23416 -mloongson-ext2
23417 -mno-loongson-ext2
23418 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2)
23419 instructions.
23420
23421 -mlong64
23422 Force "long" types to be 64 bits wide. See -mlong32 for an
23423 explanation of the default and the way that the pointer size is
23424 determined.
23425
23426 -mlong32
23427 Force "long", "int", and pointer types to be 32 bits wide.
23428
23429 The default size of "int"s, "long"s and pointers depends on the
23430 ABI. All the supported ABIs use 32-bit "int"s. The n64 ABI uses
23431 64-bit "long"s, as does the 64-bit EABI; the others use 32-bit
23432 "long"s. Pointers are the same size as "long"s, or the same size
23433 as integer registers, whichever is smaller.
23434
23435 -msym32
23436 -mno-sym32
23437 Assume (do not assume) that all symbols have 32-bit values,
23438 regardless of the selected ABI. This option is useful in
23439 combination with -mabi=64 and -mno-abicalls because it allows GCC
23440 to generate shorter and faster references to symbolic addresses.
23441
23442 -G num
23443 Put definitions of externally-visible data in a small data section
23444 if that data is no bigger than num bytes. GCC can then generate
23445 more efficient accesses to the data; see -mgpopt for details.
23446
23447 The default -G option depends on the configuration.
23448
23449 -mlocal-sdata
23450 -mno-local-sdata
23451 Extend (do not extend) the -G behavior to local data too, such as
23452 to static variables in C. -mlocal-sdata is the default for all
23453 configurations.
23454
23455 If the linker complains that an application is using too much small
23456 data, you might want to try rebuilding the less performance-
23457 critical parts with -mno-local-sdata. You might also want to build
23458 large libraries with -mno-local-sdata, so that the libraries leave
23459 more room for the main program.
23460
23461 -mextern-sdata
23462 -mno-extern-sdata
23463 Assume (do not assume) that externally-defined data is in a small
23464 data section if the size of that data is within the -G limit.
23465 -mextern-sdata is the default for all configurations.
23466
23467 If you compile a module Mod with -mextern-sdata -G num -mgpopt, and
23468 Mod references a variable Var that is no bigger than num bytes, you
23469 must make sure that Var is placed in a small data section. If Var
23470 is defined by another module, you must either compile that module
23471 with a high-enough -G setting or attach a "section" attribute to
23472 Var's definition. If Var is common, you must link the application
23473 with a high-enough -G setting.
23474
23475 The easiest way of satisfying these restrictions is to compile and
23476 link every module with the same -G option. However, you may wish
23477 to build a library that supports several different small data
23478 limits. You can do this by compiling the library with the highest
23479 supported -G setting and additionally using -mno-extern-sdata to
23480 stop the library from making assumptions about externally-defined
23481 data.
23482
23483 -mgpopt
23484 -mno-gpopt
23485 Use (do not use) GP-relative accesses for symbols that are known to
23486 be in a small data section; see -G, -mlocal-sdata and
23487 -mextern-sdata. -mgpopt is the default for all configurations.
23488
23489 -mno-gpopt is useful for cases where the $gp register might not
23490 hold the value of "_gp". For example, if the code is part of a
23491 library that might be used in a boot monitor, programs that call
23492 boot monitor routines pass an unknown value in $gp. (In such
23493 situations, the boot monitor itself is usually compiled with -G0.)
23494
23495 -mno-gpopt implies -mno-local-sdata and -mno-extern-sdata.
23496
23497 -membedded-data
23498 -mno-embedded-data
23499 Allocate variables to the read-only data section first if possible,
23500 then next in the small data section if possible, otherwise in data.
23501 This gives slightly slower code than the default, but reduces the
23502 amount of RAM required when executing, and thus may be preferred
23503 for some embedded systems.
23504
23505 -muninit-const-in-rodata
23506 -mno-uninit-const-in-rodata
23507 Put uninitialized "const" variables in the read-only data section.
23508 This option is only meaningful in conjunction with -membedded-data.
23509
23510 -mcode-readable=setting
23511 Specify whether GCC may generate code that reads from executable
23512 sections. There are three possible settings:
23513
23514 -mcode-readable=yes
23515 Instructions may freely access executable sections. This is
23516 the default setting.
23517
23518 -mcode-readable=pcrel
23519 MIPS16 PC-relative load instructions can access executable
23520 sections, but other instructions must not do so. This option
23521 is useful on 4KSc and 4KSd processors when the code TLBs have
23522 the Read Inhibit bit set. It is also useful on processors that
23523 can be configured to have a dual instruction/data SRAM
23524 interface and that, like the M4K, automatically redirect PC-
23525 relative loads to the instruction RAM.
23526
23527 -mcode-readable=no
23528 Instructions must not access executable sections. This option
23529 can be useful on targets that are configured to have a dual
23530 instruction/data SRAM interface but that (unlike the M4K) do
23531 not automatically redirect PC-relative loads to the instruction
23532 RAM.
23533
23534 -msplit-addresses
23535 -mno-split-addresses
23536 Enable (disable) use of the %hi() and %lo() assembler relocation
23537 operators. This option has been superseded by -mexplicit-relocs
23538 but is retained for backwards compatibility.
23539
23540 -mexplicit-relocs
23541 -mno-explicit-relocs
23542 Use (do not use) assembler relocation operators when dealing with
23543 symbolic addresses. The alternative, selected by
23544 -mno-explicit-relocs, is to use assembler macros instead.
23545
23546 -mexplicit-relocs is the default if GCC was configured to use an
23547 assembler that supports relocation operators.
23548
23549 -mcheck-zero-division
23550 -mno-check-zero-division
23551 Trap (do not trap) on integer division by zero.
23552
23553 The default is -mcheck-zero-division.
23554
23555 -mdivide-traps
23556 -mdivide-breaks
23557 MIPS systems check for division by zero by generating either a
23558 conditional trap or a break instruction. Using traps results in
23559 smaller code, but is only supported on MIPS II and later. Also,
23560 some versions of the Linux kernel have a bug that prevents trap
23561 from generating the proper signal ("SIGFPE"). Use -mdivide-traps
23562 to allow conditional traps on architectures that support them and
23563 -mdivide-breaks to force the use of breaks.
23564
23565 The default is usually -mdivide-traps, but this can be overridden
23566 at configure time using --with-divide=breaks. Divide-by-zero
23567 checks can be completely disabled using -mno-check-zero-division.
23568
23569 -mload-store-pairs
23570 -mno-load-store-pairs
23571 Enable (disable) an optimization that pairs consecutive load or
23572 store instructions to enable load/store bonding. This option is
23573 enabled by default but only takes effect when the selected
23574 architecture is known to support bonding.
23575
23576 -munaligned-access
23577 -mno-unaligned-access
23578 Enable (disable) direct unaligned access for MIPS Release 6.
23579 MIPSr6 requires load/store unaligned-access support, by hardware or
23580 trap&emulate. So -mno-unaligned-access may be needed by kernel.
23581
23582 -mmemcpy
23583 -mno-memcpy
23584 Force (do not force) the use of "memcpy" for non-trivial block
23585 moves. The default is -mno-memcpy, which allows GCC to inline most
23586 constant-sized copies.
23587
23588 -mlong-calls
23589 -mno-long-calls
23590 Disable (do not disable) use of the "jal" instruction. Calling
23591 functions using "jal" is more efficient but requires the caller and
23592 callee to be in the same 256 megabyte segment.
23593
23594 This option has no effect on abicalls code. The default is
23595 -mno-long-calls.
23596
23597 -mmad
23598 -mno-mad
23599 Enable (disable) use of the "mad", "madu" and "mul" instructions,
23600 as provided by the R4650 ISA.
23601
23602 -mimadd
23603 -mno-imadd
23604 Enable (disable) use of the "madd" and "msub" integer instructions.
23605 The default is -mimadd on architectures that support "madd" and
23606 "msub" except for the 74k architecture where it was found to
23607 generate slower code.
23608
23609 -mfused-madd
23610 -mno-fused-madd
23611 Enable (disable) use of the floating-point multiply-accumulate
23612 instructions, when they are available. The default is
23613 -mfused-madd.
23614
23615 On the R8000 CPU when multiply-accumulate instructions are used,
23616 the intermediate product is calculated to infinite precision and is
23617 not subject to the FCSR Flush to Zero bit. This may be undesirable
23618 in some circumstances. On other processors the result is
23619 numerically identical to the equivalent computation using separate
23620 multiply, add, subtract and negate instructions.
23621
23622 -nocpp
23623 Tell the MIPS assembler to not run its preprocessor over user
23624 assembler files (with a .s suffix) when assembling them.
23625
23626 -mfix-24k
23627 -mno-fix-24k
23628 Work around the 24K E48 (lost data on stores during refill) errata.
23629 The workarounds are implemented by the assembler rather than by
23630 GCC.
23631
23632 -mfix-r4000
23633 -mno-fix-r4000
23634 Work around certain R4000 CPU errata:
23635
23636 - A double-word or a variable shift may give an incorrect result
23637 if executed immediately after starting an integer division.
23638
23639 - A double-word or a variable shift may give an incorrect result
23640 if executed while an integer multiplication is in progress.
23641
23642 - An integer division may give an incorrect result if started in
23643 a delay slot of a taken branch or a jump.
23644
23645 -mfix-r4400
23646 -mno-fix-r4400
23647 Work around certain R4400 CPU errata:
23648
23649 - A double-word or a variable shift may give an incorrect result
23650 if executed immediately after starting an integer division.
23651
23652 -mfix-r10000
23653 -mno-fix-r10000
23654 Work around certain R10000 errata:
23655
23656 - "ll"/"sc" sequences may not behave atomically on revisions
23657 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
23658
23659 This option can only be used if the target architecture supports
23660 branch-likely instructions. -mfix-r10000 is the default when
23661 -march=r10000 is used; -mno-fix-r10000 is the default otherwise.
23662
23663 -mfix-r5900
23664 -mno-fix-r5900
23665 Do not attempt to schedule the preceding instruction into the delay
23666 slot of a branch instruction placed at the end of a short loop of
23667 six instructions or fewer and always schedule a "nop" instruction
23668 there instead. The short loop bug under certain conditions causes
23669 loops to execute only once or twice, due to a hardware bug in the
23670 R5900 chip. The workaround is implemented by the assembler rather
23671 than by GCC.
23672
23673 -mfix-rm7000
23674 -mno-fix-rm7000
23675 Work around the RM7000 "dmult"/"dmultu" errata. The workarounds
23676 are implemented by the assembler rather than by GCC.
23677
23678 -mfix-vr4120
23679 -mno-fix-vr4120
23680 Work around certain VR4120 errata:
23681
23682 - "dmultu" does not always produce the correct result.
23683
23684 - "div" and "ddiv" do not always produce the correct result if
23685 one of the operands is negative.
23686
23687 The workarounds for the division errata rely on special functions
23688 in libgcc.a. At present, these functions are only provided by the
23689 "mips64vr*-elf" configurations.
23690
23691 Other VR4120 errata require a NOP to be inserted between certain
23692 pairs of instructions. These errata are handled by the assembler,
23693 not by GCC itself.
23694
23695 -mfix-vr4130
23696 Work around the VR4130 "mflo"/"mfhi" errata. The workarounds are
23697 implemented by the assembler rather than by GCC, although GCC
23698 avoids using "mflo" and "mfhi" if the VR4130 "macc", "macchi",
23699 "dmacc" and "dmacchi" instructions are available instead.
23700
23701 -mfix-sb1
23702 -mno-fix-sb1
23703 Work around certain SB-1 CPU core errata. (This flag currently
23704 works around the SB-1 revision 2 "F1" and "F2" floating-point
23705 errata.)
23706
23707 -mr10k-cache-barrier=setting
23708 Specify whether GCC should insert cache barriers to avoid the side
23709 effects of speculation on R10K processors.
23710
23711 In common with many processors, the R10K tries to predict the
23712 outcome of a conditional branch and speculatively executes
23713 instructions from the "taken" branch. It later aborts these
23714 instructions if the predicted outcome is wrong. However, on the
23715 R10K, even aborted instructions can have side effects.
23716
23717 This problem only affects kernel stores and, depending on the
23718 system, kernel loads. As an example, a speculatively-executed
23719 store may load the target memory into cache and mark the cache line
23720 as dirty, even if the store itself is later aborted. If a DMA
23721 operation writes to the same area of memory before the "dirty" line
23722 is flushed, the cached data overwrites the DMA-ed data. See the
23723 R10K processor manual for a full description, including other
23724 potential problems.
23725
23726 One workaround is to insert cache barrier instructions before every
23727 memory access that might be speculatively executed and that might
23728 have side effects even if aborted. -mr10k-cache-barrier=setting
23729 controls GCC's implementation of this workaround. It assumes that
23730 aborted accesses to any byte in the following regions does not have
23731 side effects:
23732
23733 1. the memory occupied by the current function's stack frame;
23734
23735 2. the memory occupied by an incoming stack argument;
23736
23737 3. the memory occupied by an object with a link-time-constant
23738 address.
23739
23740 It is the kernel's responsibility to ensure that speculative
23741 accesses to these regions are indeed safe.
23742
23743 If the input program contains a function declaration such as:
23744
23745 void foo (void);
23746
23747 then the implementation of "foo" must allow "j foo" and "jal foo"
23748 to be executed speculatively. GCC honors this restriction for
23749 functions it compiles itself. It expects non-GCC functions (such
23750 as hand-written assembly code) to do the same.
23751
23752 The option has three forms:
23753
23754 -mr10k-cache-barrier=load-store
23755 Insert a cache barrier before a load or store that might be
23756 speculatively executed and that might have side effects even if
23757 aborted.
23758
23759 -mr10k-cache-barrier=store
23760 Insert a cache barrier before a store that might be
23761 speculatively executed and that might have side effects even if
23762 aborted.
23763
23764 -mr10k-cache-barrier=none
23765 Disable the insertion of cache barriers. This is the default
23766 setting.
23767
23768 -mflush-func=func
23769 -mno-flush-func
23770 Specifies the function to call to flush the I and D caches, or to
23771 not call any such function. If called, the function must take the
23772 same arguments as the common "_flush_func", that is, the address of
23773 the memory range for which the cache is being flushed, the size of
23774 the memory range, and the number 3 (to flush both caches). The
23775 default depends on the target GCC was configured for, but commonly
23776 is either "_flush_func" or "__cpu_flush".
23777
23778 mbranch-cost=num
23779 Set the cost of branches to roughly num "simple" instructions.
23780 This cost is only a heuristic and is not guaranteed to produce
23781 consistent results across releases. A zero cost redundantly
23782 selects the default, which is based on the -mtune setting.
23783
23784 -mbranch-likely
23785 -mno-branch-likely
23786 Enable or disable use of Branch Likely instructions, regardless of
23787 the default for the selected architecture. By default, Branch
23788 Likely instructions may be generated if they are supported by the
23789 selected architecture. An exception is for the MIPS32 and MIPS64
23790 architectures and processors that implement those architectures;
23791 for those, Branch Likely instructions are not be generated by
23792 default because the MIPS32 and MIPS64 architectures specifically
23793 deprecate their use.
23794
23795 -mcompact-branches=never
23796 -mcompact-branches=optimal
23797 -mcompact-branches=always
23798 These options control which form of branches will be generated.
23799 The default is -mcompact-branches=optimal.
23800
23801 The -mcompact-branches=never option ensures that compact branch
23802 instructions will never be generated.
23803
23804 The -mcompact-branches=always option ensures that a compact branch
23805 instruction will be generated if available for MIPS Release 6
23806 onwards. If a compact branch instruction is not available (or
23807 pre-R6), a delay slot form of the branch will be used instead.
23808
23809 If it is used for MIPS16/microMIPS targets, it will be just ignored
23810 now. The behaviour for MIPS16/microMIPS may change in future,
23811 since they do have some compact branch instructions.
23812
23813 The -mcompact-branches=optimal option will cause a delay slot
23814 branch to be used if one is available in the current ISA and the
23815 delay slot is successfully filled. If the delay slot is not
23816 filled, a compact branch will be chosen if one is available.
23817
23818 -mfp-exceptions
23819 -mno-fp-exceptions
23820 Specifies whether FP exceptions are enabled. This affects how FP
23821 instructions are scheduled for some processors. The default is
23822 that FP exceptions are enabled.
23823
23824 For instance, on the SB-1, if FP exceptions are disabled, and we
23825 are emitting 64-bit code, then we can use both FP pipes.
23826 Otherwise, we can only use one FP pipe.
23827
23828 -mvr4130-align
23829 -mno-vr4130-align
23830 The VR4130 pipeline is two-way superscalar, but can only issue two
23831 instructions together if the first one is 8-byte aligned. When
23832 this option is enabled, GCC aligns pairs of instructions that it
23833 thinks should execute in parallel.
23834
23835 This option only has an effect when optimizing for the VR4130. It
23836 normally makes code faster, but at the expense of making it bigger.
23837 It is enabled by default at optimization level -O3.
23838
23839 -msynci
23840 -mno-synci
23841 Enable (disable) generation of "synci" instructions on
23842 architectures that support it. The "synci" instructions (if
23843 enabled) are generated when "__builtin___clear_cache" is compiled.
23844
23845 This option defaults to -mno-synci, but the default can be
23846 overridden by configuring GCC with --with-synci.
23847
23848 When compiling code for single processor systems, it is generally
23849 safe to use "synci". However, on many multi-core (SMP) systems, it
23850 does not invalidate the instruction caches on all cores and may
23851 lead to undefined behavior.
23852
23853 -mrelax-pic-calls
23854 -mno-relax-pic-calls
23855 Try to turn PIC calls that are normally dispatched via register $25
23856 into direct calls. This is only possible if the linker can resolve
23857 the destination at link time and if the destination is within range
23858 for a direct call.
23859
23860 -mrelax-pic-calls is the default if GCC was configured to use an
23861 assembler and a linker that support the ".reloc" assembly directive
23862 and -mexplicit-relocs is in effect. With -mno-explicit-relocs,
23863 this optimization can be performed by the assembler and the linker
23864 alone without help from the compiler.
23865
23866 -mmcount-ra-address
23867 -mno-mcount-ra-address
23868 Emit (do not emit) code that allows "_mcount" to modify the calling
23869 function's return address. When enabled, this option extends the
23870 usual "_mcount" interface with a new ra-address parameter, which
23871 has type "intptr_t *" and is passed in register $12. "_mcount" can
23872 then modify the return address by doing both of the following:
23873
23874 * Returning the new address in register $31.
23875
23876 * Storing the new address in "*ra-address", if ra-address is
23877 nonnull.
23878
23879 The default is -mno-mcount-ra-address.
23880
23881 -mframe-header-opt
23882 -mno-frame-header-opt
23883 Enable (disable) frame header optimization in the o32 ABI. When
23884 using the o32 ABI, calling functions will allocate 16 bytes on the
23885 stack for the called function to write out register arguments.
23886 When enabled, this optimization will suppress the allocation of the
23887 frame header if it can be determined that it is unused.
23888
23889 This optimization is off by default at all optimization levels.
23890
23891 -mlxc1-sxc1
23892 -mno-lxc1-sxc1
23893 When applicable, enable (disable) the generation of "lwxc1",
23894 "swxc1", "ldxc1", "sdxc1" instructions. Enabled by default.
23895
23896 -mmadd4
23897 -mno-madd4
23898 When applicable, enable (disable) the generation of 4-operand
23899 "madd.s", "madd.d" and related instructions. Enabled by default.
23900
23901 MMIX Options
23902 These options are defined for the MMIX:
23903
23904 -mlibfuncs
23905 -mno-libfuncs
23906 Specify that intrinsic library functions are being compiled,
23907 passing all values in registers, no matter the size.
23908
23909 -mepsilon
23910 -mno-epsilon
23911 Generate floating-point comparison instructions that compare with
23912 respect to the "rE" epsilon register.
23913
23914 -mabi=mmixware
23915 -mabi=gnu
23916 Generate code that passes function parameters and return values
23917 that (in the called function) are seen as registers $0 and up, as
23918 opposed to the GNU ABI which uses global registers $231 and up.
23919
23920 -mzero-extend
23921 -mno-zero-extend
23922 When reading data from memory in sizes shorter than 64 bits, use
23923 (do not use) zero-extending load instructions by default, rather
23924 than sign-extending ones.
23925
23926 -mknuthdiv
23927 -mno-knuthdiv
23928 Make the result of a division yielding a remainder have the same
23929 sign as the divisor. With the default, -mno-knuthdiv, the sign of
23930 the remainder follows the sign of the dividend. Both methods are
23931 arithmetically valid, the latter being almost exclusively used.
23932
23933 -mtoplevel-symbols
23934 -mno-toplevel-symbols
23935 Prepend (do not prepend) a : to all global symbols, so the assembly
23936 code can be used with the "PREFIX" assembly directive.
23937
23938 -melf
23939 Generate an executable in the ELF format, rather than the default
23940 mmo format used by the mmix simulator.
23941
23942 -mbranch-predict
23943 -mno-branch-predict
23944 Use (do not use) the probable-branch instructions, when static
23945 branch prediction indicates a probable branch.
23946
23947 -mbase-addresses
23948 -mno-base-addresses
23949 Generate (do not generate) code that uses base addresses. Using a
23950 base address automatically generates a request (handled by the
23951 assembler and the linker) for a constant to be set up in a global
23952 register. The register is used for one or more base address
23953 requests within the range 0 to 255 from the value held in the
23954 register. The generally leads to short and fast code, but the
23955 number of different data items that can be addressed is limited.
23956 This means that a program that uses lots of static data may require
23957 -mno-base-addresses.
23958
23959 -msingle-exit
23960 -mno-single-exit
23961 Force (do not force) generated code to have a single exit point in
23962 each function.
23963
23964 MN10300 Options
23965 These -m options are defined for Matsushita MN10300 architectures:
23966
23967 -mmult-bug
23968 Generate code to avoid bugs in the multiply instructions for the
23969 MN10300 processors. This is the default.
23970
23971 -mno-mult-bug
23972 Do not generate code to avoid bugs in the multiply instructions for
23973 the MN10300 processors.
23974
23975 -mam33
23976 Generate code using features specific to the AM33 processor.
23977
23978 -mno-am33
23979 Do not generate code using features specific to the AM33 processor.
23980 This is the default.
23981
23982 -mam33-2
23983 Generate code using features specific to the AM33/2.0 processor.
23984
23985 -mam34
23986 Generate code using features specific to the AM34 processor.
23987
23988 -mtune=cpu-type
23989 Use the timing characteristics of the indicated CPU type when
23990 scheduling instructions. This does not change the targeted
23991 processor type. The CPU type must be one of mn10300, am33, am33-2
23992 or am34.
23993
23994 -mreturn-pointer-on-d0
23995 When generating a function that returns a pointer, return the
23996 pointer in both "a0" and "d0". Otherwise, the pointer is returned
23997 only in "a0", and attempts to call such functions without a
23998 prototype result in errors. Note that this option is on by
23999 default; use -mno-return-pointer-on-d0 to disable it.
24000
24001 -mno-crt0
24002 Do not link in the C run-time initialization object file.
24003
24004 -mrelax
24005 Indicate to the linker that it should perform a relaxation
24006 optimization pass to shorten branches, calls and absolute memory
24007 addresses. This option only has an effect when used on the command
24008 line for the final link step.
24009
24010 This option makes symbolic debugging impossible.
24011
24012 -mliw
24013 Allow the compiler to generate Long Instruction Word instructions
24014 if the target is the AM33 or later. This is the default. This
24015 option defines the preprocessor macro "__LIW__".
24016
24017 -mno-liw
24018 Do not allow the compiler to generate Long Instruction Word
24019 instructions. This option defines the preprocessor macro
24020 "__NO_LIW__".
24021
24022 -msetlb
24023 Allow the compiler to generate the SETLB and Lcc instructions if
24024 the target is the AM33 or later. This is the default. This option
24025 defines the preprocessor macro "__SETLB__".
24026
24027 -mno-setlb
24028 Do not allow the compiler to generate SETLB or Lcc instructions.
24029 This option defines the preprocessor macro "__NO_SETLB__".
24030
24031 Moxie Options
24032 -meb
24033 Generate big-endian code. This is the default for moxie-*-*
24034 configurations.
24035
24036 -mel
24037 Generate little-endian code.
24038
24039 -mmul.x
24040 Generate mul.x and umul.x instructions. This is the default for
24041 moxiebox-*-* configurations.
24042
24043 -mno-crt0
24044 Do not link in the C run-time initialization object file.
24045
24046 MSP430 Options
24047 These options are defined for the MSP430:
24048
24049 -masm-hex
24050 Force assembly output to always use hex constants. Normally such
24051 constants are signed decimals, but this option is available for
24052 testsuite and/or aesthetic purposes.
24053
24054 -mmcu=
24055 Select the MCU to target. This is used to create a C preprocessor
24056 symbol based upon the MCU name, converted to upper case and pre-
24057 and post-fixed with __. This in turn is used by the msp430.h
24058 header file to select an MCU-specific supplementary header file.
24059
24060 The option also sets the ISA to use. If the MCU name is one that
24061 is known to only support the 430 ISA then that is selected,
24062 otherwise the 430X ISA is selected. A generic MCU name of msp430
24063 can also be used to select the 430 ISA. Similarly the generic
24064 msp430x MCU name selects the 430X ISA.
24065
24066 In addition an MCU-specific linker script is added to the linker
24067 command line. The script's name is the name of the MCU with .ld
24068 appended. Thus specifying -mmcu=xxx on the gcc command line
24069 defines the C preprocessor symbol "__XXX__" and cause the linker to
24070 search for a script called xxx.ld.
24071
24072 The ISA and hardware multiply supported for the different MCUs is
24073 hard-coded into GCC. However, an external devices.csv file can be
24074 used to extend device support beyond those that have been hard-
24075 coded.
24076
24077 GCC searches for the devices.csv file using the following methods
24078 in the given precedence order, where the first method takes
24079 precendence over the second which takes precedence over the third.
24080
24081 Include path specified with "-I" and "-L"
24082 devices.csv will be searched for in each of the directories
24083 specified by include paths and linker library search paths.
24084
24085 Path specified by the environment variable MSP430_GCC_INCLUDE_DIR
24086 Define the value of the global environment variable
24087 MSP430_GCC_INCLUDE_DIR to the full path to the directory
24088 containing devices.csv, and GCC will search this directory for
24089 devices.csv. If devices.csv is found, this directory will also
24090 be registered as an include path, and linker library path.
24091 Header files and linker scripts in this directory can therefore
24092 be used without manually specifying "-I" and "-L" on the
24093 command line.
24094
24095 The msp430-elf{,bare}/include/devices directory
24096 Finally, GCC will examine msp430-elf{,bare}/include/devices
24097 from the toolchain root directory. This directory does not
24098 exist in a default installation, but if the user has created it
24099 and copied devices.csv there, then the MCU data will be read.
24100 As above, this directory will also be registered as an include
24101 path, and linker library path.
24102
24103 If none of the above search methods find devices.csv, then the
24104 hard-coded MCU data is used.
24105
24106 -mwarn-mcu
24107 -mno-warn-mcu
24108 This option enables or disables warnings about conflicts between
24109 the MCU name specified by the -mmcu option and the ISA set by the
24110 -mcpu option and/or the hardware multiply support set by the
24111 -mhwmult option. It also toggles warnings about unrecognized MCU
24112 names. This option is on by default.
24113
24114 -mcpu=
24115 Specifies the ISA to use. Accepted values are msp430, msp430x and
24116 msp430xv2. This option is deprecated. The -mmcu= option should be
24117 used to select the ISA.
24118
24119 -msim
24120 Link to the simulator runtime libraries and linker script.
24121 Overrides any scripts that would be selected by the -mmcu= option.
24122
24123 -mlarge
24124 Use large-model addressing (20-bit pointers, 20-bit "size_t").
24125
24126 -msmall
24127 Use small-model addressing (16-bit pointers, 16-bit "size_t").
24128
24129 -mrelax
24130 This option is passed to the assembler and linker, and allows the
24131 linker to perform certain optimizations that cannot be done until
24132 the final link.
24133
24134 mhwmult=
24135 Describes the type of hardware multiply supported by the target.
24136 Accepted values are none for no hardware multiply, 16bit for the
24137 original 16-bit-only multiply supported by early MCUs. 32bit for
24138 the 16/32-bit multiply supported by later MCUs and f5series for the
24139 16/32-bit multiply supported by F5-series MCUs. A value of auto
24140 can also be given. This tells GCC to deduce the hardware multiply
24141 support based upon the MCU name provided by the -mmcu option. If
24142 no -mmcu option is specified or if the MCU name is not recognized
24143 then no hardware multiply support is assumed. "auto" is the
24144 default setting.
24145
24146 Hardware multiplies are normally performed by calling a library
24147 routine. This saves space in the generated code. When compiling
24148 at -O3 or higher however the hardware multiplier is invoked inline.
24149 This makes for bigger, but faster code.
24150
24151 The hardware multiply routines disable interrupts whilst running
24152 and restore the previous interrupt state when they finish. This
24153 makes them safe to use inside interrupt handlers as well as in
24154 normal code.
24155
24156 -minrt
24157 Enable the use of a minimum runtime environment - no static
24158 initializers or constructors. This is intended for memory-
24159 constrained devices. The compiler includes special symbols in some
24160 objects that tell the linker and runtime which code fragments are
24161 required.
24162
24163 -mtiny-printf
24164 Enable reduced code size "printf" and "puts" library functions.
24165 The tiny implementations of these functions are not reentrant, so
24166 must be used with caution in multi-threaded applications.
24167
24168 Support for streams has been removed and the string to be printed
24169 will always be sent to stdout via the "write" syscall. The string
24170 is not buffered before it is sent to write.
24171
24172 This option requires Newlib Nano IO, so GCC must be configured with
24173 --enable-newlib-nano-formatted-io.
24174
24175 -mmax-inline-shift=
24176 This option takes an integer between 0 and 64 inclusive, and sets
24177 the maximum number of inline shift instructions which should be
24178 emitted to perform a shift operation by a constant amount. When
24179 this value needs to be exceeded, an mspabi helper function is used
24180 instead. The default value is 4.
24181
24182 This only affects cases where a shift by multiple positions cannot
24183 be completed with a single instruction (e.g. all shifts >1 on the
24184 430 ISA).
24185
24186 Shifts of a 32-bit value are at least twice as costly, so the value
24187 passed for this option is divided by 2 and the resulting value used
24188 instead.
24189
24190 -mcode-region=
24191 -mdata-region=
24192 These options tell the compiler where to place functions and data
24193 that do not have one of the "lower", "upper", "either" or "section"
24194 attributes. Possible values are "lower", "upper", "either" or
24195 "any". The first three behave like the corresponding attribute.
24196 The fourth possible value - "any" - is the default. It leaves
24197 placement entirely up to the linker script and how it assigns the
24198 standard sections (".text", ".data", etc) to the memory regions.
24199
24200 -msilicon-errata=
24201 This option passes on a request to assembler to enable the fixes
24202 for the named silicon errata.
24203
24204 -msilicon-errata-warn=
24205 This option passes on a request to the assembler to enable warning
24206 messages when a silicon errata might need to be applied.
24207
24208 -mwarn-devices-csv
24209 -mno-warn-devices-csv
24210 Warn if devices.csv is not found or there are problem parsing it
24211 (default: on).
24212
24213 NDS32 Options
24214 These options are defined for NDS32 implementations:
24215
24216 -mbig-endian
24217 Generate code in big-endian mode.
24218
24219 -mlittle-endian
24220 Generate code in little-endian mode.
24221
24222 -mreduced-regs
24223 Use reduced-set registers for register allocation.
24224
24225 -mfull-regs
24226 Use full-set registers for register allocation.
24227
24228 -mcmov
24229 Generate conditional move instructions.
24230
24231 -mno-cmov
24232 Do not generate conditional move instructions.
24233
24234 -mext-perf
24235 Generate performance extension instructions.
24236
24237 -mno-ext-perf
24238 Do not generate performance extension instructions.
24239
24240 -mext-perf2
24241 Generate performance extension 2 instructions.
24242
24243 -mno-ext-perf2
24244 Do not generate performance extension 2 instructions.
24245
24246 -mext-string
24247 Generate string extension instructions.
24248
24249 -mno-ext-string
24250 Do not generate string extension instructions.
24251
24252 -mv3push
24253 Generate v3 push25/pop25 instructions.
24254
24255 -mno-v3push
24256 Do not generate v3 push25/pop25 instructions.
24257
24258 -m16-bit
24259 Generate 16-bit instructions.
24260
24261 -mno-16-bit
24262 Do not generate 16-bit instructions.
24263
24264 -misr-vector-size=num
24265 Specify the size of each interrupt vector, which must be 4 or 16.
24266
24267 -mcache-block-size=num
24268 Specify the size of each cache block, which must be a power of 2
24269 between 4 and 512.
24270
24271 -march=arch
24272 Specify the name of the target architecture.
24273
24274 -mcmodel=code-model
24275 Set the code model to one of
24276
24277 small
24278 All the data and read-only data segments must be within 512KB
24279 addressing space. The text segment must be within 16MB
24280 addressing space.
24281
24282 medium
24283 The data segment must be within 512KB while the read-only data
24284 segment can be within 4GB addressing space. The text segment
24285 should be still within 16MB addressing space.
24286
24287 large
24288 All the text and data segments can be within 4GB addressing
24289 space.
24290
24291 -mctor-dtor
24292 Enable constructor/destructor feature.
24293
24294 -mrelax
24295 Guide linker to relax instructions.
24296
24297 Nios II Options
24298 These are the options defined for the Altera Nios II processor.
24299
24300 -G num
24301 Put global and static objects less than or equal to num bytes into
24302 the small data or BSS sections instead of the normal data or BSS
24303 sections. The default value of num is 8.
24304
24305 -mgpopt=option
24306 -mgpopt
24307 -mno-gpopt
24308 Generate (do not generate) GP-relative accesses. The following
24309 option names are recognized:
24310
24311 none
24312 Do not generate GP-relative accesses.
24313
24314 local
24315 Generate GP-relative accesses for small data objects that are
24316 not external, weak, or uninitialized common symbols. Also use
24317 GP-relative addressing for objects that have been explicitly
24318 placed in a small data section via a "section" attribute.
24319
24320 global
24321 As for local, but also generate GP-relative accesses for small
24322 data objects that are external, weak, or common. If you use
24323 this option, you must ensure that all parts of your program
24324 (including libraries) are compiled with the same -G setting.
24325
24326 data
24327 Generate GP-relative accesses for all data objects in the
24328 program. If you use this option, the entire data and BSS
24329 segments of your program must fit in 64K of memory and you must
24330 use an appropriate linker script to allocate them within the
24331 addressable range of the global pointer.
24332
24333 all Generate GP-relative addresses for function pointers as well as
24334 data pointers. If you use this option, the entire text, data,
24335 and BSS segments of your program must fit in 64K of memory and
24336 you must use an appropriate linker script to allocate them
24337 within the addressable range of the global pointer.
24338
24339 -mgpopt is equivalent to -mgpopt=local, and -mno-gpopt is
24340 equivalent to -mgpopt=none.
24341
24342 The default is -mgpopt except when -fpic or -fPIC is specified to
24343 generate position-independent code. Note that the Nios II ABI does
24344 not permit GP-relative accesses from shared libraries.
24345
24346 You may need to specify -mno-gpopt explicitly when building
24347 programs that include large amounts of small data, including large
24348 GOT data sections. In this case, the 16-bit offset for GP-relative
24349 addressing may not be large enough to allow access to the entire
24350 small data section.
24351
24352 -mgprel-sec=regexp
24353 This option specifies additional section names that can be accessed
24354 via GP-relative addressing. It is most useful in conjunction with
24355 "section" attributes on variable declarations and a custom linker
24356 script. The regexp is a POSIX Extended Regular Expression.
24357
24358 This option does not affect the behavior of the -G option, and the
24359 specified sections are in addition to the standard ".sdata" and
24360 ".sbss" small-data sections that are recognized by -mgpopt.
24361
24362 -mr0rel-sec=regexp
24363 This option specifies names of sections that can be accessed via a
24364 16-bit offset from "r0"; that is, in the low 32K or high 32K of the
24365 32-bit address space. It is most useful in conjunction with
24366 "section" attributes on variable declarations and a custom linker
24367 script. The regexp is a POSIX Extended Regular Expression.
24368
24369 In contrast to the use of GP-relative addressing for small data,
24370 zero-based addressing is never generated by default and there are
24371 no conventional section names used in standard linker scripts for
24372 sections in the low or high areas of memory.
24373
24374 -mel
24375 -meb
24376 Generate little-endian (default) or big-endian (experimental) code,
24377 respectively.
24378
24379 -march=arch
24380 This specifies the name of the target Nios II architecture. GCC
24381 uses this name to determine what kind of instructions it can emit
24382 when generating assembly code. Permissible names are: r1, r2.
24383
24384 The preprocessor macro "__nios2_arch__" is available to programs,
24385 with value 1 or 2, indicating the targeted ISA level.
24386
24387 -mbypass-cache
24388 -mno-bypass-cache
24389 Force all load and store instructions to always bypass cache by
24390 using I/O variants of the instructions. The default is not to
24391 bypass the cache.
24392
24393 -mno-cache-volatile
24394 -mcache-volatile
24395 Volatile memory access bypass the cache using the I/O variants of
24396 the load and store instructions. The default is not to bypass the
24397 cache.
24398
24399 -mno-fast-sw-div
24400 -mfast-sw-div
24401 Do not use table-based fast divide for small numbers. The default
24402 is to use the fast divide at -O3 and above.
24403
24404 -mno-hw-mul
24405 -mhw-mul
24406 -mno-hw-mulx
24407 -mhw-mulx
24408 -mno-hw-div
24409 -mhw-div
24410 Enable or disable emitting "mul", "mulx" and "div" family of
24411 instructions by the compiler. The default is to emit "mul" and not
24412 emit "div" and "mulx".
24413
24414 -mbmx
24415 -mno-bmx
24416 -mcdx
24417 -mno-cdx
24418 Enable or disable generation of Nios II R2 BMX (bit manipulation)
24419 and CDX (code density) instructions. Enabling these instructions
24420 also requires -march=r2. Since these instructions are optional
24421 extensions to the R2 architecture, the default is not to emit them.
24422
24423 -mcustom-insn=N
24424 -mno-custom-insn
24425 Each -mcustom-insn=N option enables use of a custom instruction
24426 with encoding N when generating code that uses insn. For example,
24427 -mcustom-fadds=253 generates custom instruction 253 for single-
24428 precision floating-point add operations instead of the default
24429 behavior of using a library call.
24430
24431 The following values of insn are supported. Except as otherwise
24432 noted, floating-point operations are expected to be implemented
24433 with normal IEEE 754 semantics and correspond directly to the C
24434 operators or the equivalent GCC built-in functions.
24435
24436 Single-precision floating point:
24437
24438 fadds, fsubs, fdivs, fmuls
24439 Binary arithmetic operations.
24440
24441 fnegs
24442 Unary negation.
24443
24444 fabss
24445 Unary absolute value.
24446
24447 fcmpeqs, fcmpges, fcmpgts, fcmples, fcmplts, fcmpnes
24448 Comparison operations.
24449
24450 fmins, fmaxs
24451 Floating-point minimum and maximum. These instructions are
24452 only generated if -ffinite-math-only is specified.
24453
24454 fsqrts
24455 Unary square root operation.
24456
24457 fcoss, fsins, ftans, fatans, fexps, flogs
24458 Floating-point trigonometric and exponential functions. These
24459 instructions are only generated if -funsafe-math-optimizations
24460 is also specified.
24461
24462 Double-precision floating point:
24463
24464 faddd, fsubd, fdivd, fmuld
24465 Binary arithmetic operations.
24466
24467 fnegd
24468 Unary negation.
24469
24470 fabsd
24471 Unary absolute value.
24472
24473 fcmpeqd, fcmpged, fcmpgtd, fcmpled, fcmpltd, fcmpned
24474 Comparison operations.
24475
24476 fmind, fmaxd
24477 Double-precision minimum and maximum. These instructions are
24478 only generated if -ffinite-math-only is specified.
24479
24480 fsqrtd
24481 Unary square root operation.
24482
24483 fcosd, fsind, ftand, fatand, fexpd, flogd
24484 Double-precision trigonometric and exponential functions.
24485 These instructions are only generated if
24486 -funsafe-math-optimizations is also specified.
24487
24488 Conversions:
24489
24490 fextsd
24491 Conversion from single precision to double precision.
24492
24493 ftruncds
24494 Conversion from double precision to single precision.
24495
24496 fixsi, fixsu, fixdi, fixdu
24497 Conversion from floating point to signed or unsigned integer
24498 types, with truncation towards zero.
24499
24500 round
24501 Conversion from single-precision floating point to signed
24502 integer, rounding to the nearest integer and ties away from
24503 zero. This corresponds to the "__builtin_lroundf" function
24504 when -fno-math-errno is used.
24505
24506 floatis, floatus, floatid, floatud
24507 Conversion from signed or unsigned integer types to floating-
24508 point types.
24509
24510 In addition, all of the following transfer instructions for
24511 internal registers X and Y must be provided to use any of the
24512 double-precision floating-point instructions. Custom instructions
24513 taking two double-precision source operands expect the first
24514 operand in the 64-bit register X. The other operand (or only
24515 operand of a unary operation) is given to the custom arithmetic
24516 instruction with the least significant half in source register src1
24517 and the most significant half in src2. A custom instruction that
24518 returns a double-precision result returns the most significant 32
24519 bits in the destination register and the other half in 32-bit
24520 register Y. GCC automatically generates the necessary code
24521 sequences to write register X and/or read register Y when double-
24522 precision floating-point instructions are used.
24523
24524 fwrx
24525 Write src1 into the least significant half of X and src2 into
24526 the most significant half of X.
24527
24528 fwry
24529 Write src1 into Y.
24530
24531 frdxhi, frdxlo
24532 Read the most or least (respectively) significant half of X and
24533 store it in dest.
24534
24535 frdy
24536 Read the value of Y and store it into dest.
24537
24538 Note that you can gain more local control over generation of Nios
24539 II custom instructions by using the target("custom-insn=N") and
24540 target("no-custom-insn") function attributes or pragmas.
24541
24542 -mcustom-fpu-cfg=name
24543 This option enables a predefined, named set of custom instruction
24544 encodings (see -mcustom-insn above). Currently, the following sets
24545 are defined:
24546
24547 -mcustom-fpu-cfg=60-1 is equivalent to: -mcustom-fmuls=252
24548 -mcustom-fadds=253 -mcustom-fsubs=254 -fsingle-precision-constant
24549
24550 -mcustom-fpu-cfg=60-2 is equivalent to: -mcustom-fmuls=252
24551 -mcustom-fadds=253 -mcustom-fsubs=254 -mcustom-fdivs=255
24552 -fsingle-precision-constant
24553
24554 -mcustom-fpu-cfg=72-3 is equivalent to: -mcustom-floatus=243
24555 -mcustom-fixsi=244 -mcustom-floatis=245 -mcustom-fcmpgts=246
24556 -mcustom-fcmples=249 -mcustom-fcmpeqs=250 -mcustom-fcmpnes=251
24557 -mcustom-fmuls=252 -mcustom-fadds=253 -mcustom-fsubs=254
24558 -mcustom-fdivs=255 -fsingle-precision-constant
24559
24560 -mcustom-fpu-cfg=fph2 is equivalent to: -mcustom-fabss=224
24561 -mcustom-fnegs=225 -mcustom-fcmpnes=226 -mcustom-fcmpeqs=227
24562 -mcustom-fcmpges=228 -mcustom-fcmpgts=229 -mcustom-fcmples=230
24563 -mcustom-fcmplts=231 -mcustom-fmaxs=232 -mcustom-fmins=233
24564 -mcustom-round=248 -mcustom-fixsi=249 -mcustom-floatis=250
24565 -mcustom-fsqrts=251 -mcustom-fmuls=252 -mcustom-fadds=253
24566 -mcustom-fsubs=254 -mcustom-fdivs=255
24567
24568 Custom instruction assignments given by individual -mcustom-insn=
24569 options override those given by -mcustom-fpu-cfg=, regardless of
24570 the order of the options on the command line.
24571
24572 Note that you can gain more local control over selection of a FPU
24573 configuration by using the target("custom-fpu-cfg=name") function
24574 attribute or pragma.
24575
24576 The name fph2 is an abbreviation for Nios II Floating Point
24577 Hardware 2 Component. Please note that the custom instructions
24578 enabled by -mcustom-fmins=233 and -mcustom-fmaxs=234 are only
24579 generated if -ffinite-math-only is specified. The custom
24580 instruction enabled by -mcustom-round=248 is only generated if
24581 -fno-math-errno is specified. In contrast to the other
24582 configurations, -fsingle-precision-constant is not set.
24583
24584 These additional -m options are available for the Altera Nios II ELF
24585 (bare-metal) target:
24586
24587 -mhal
24588 Link with HAL BSP. This suppresses linking with the GCC-provided C
24589 runtime startup and termination code, and is typically used in
24590 conjunction with -msys-crt0= to specify the location of the
24591 alternate startup code provided by the HAL BSP.
24592
24593 -msmallc
24594 Link with a limited version of the C library, -lsmallc, rather than
24595 Newlib.
24596
24597 -msys-crt0=startfile
24598 startfile is the file name of the startfile (crt0) to use when
24599 linking. This option is only useful in conjunction with -mhal.
24600
24601 -msys-lib=systemlib
24602 systemlib is the library name of the library that provides low-
24603 level system calls required by the C library, e.g. "read" and
24604 "write". This option is typically used to link with a library
24605 provided by a HAL BSP.
24606
24607 Nvidia PTX Options
24608 These options are defined for Nvidia PTX:
24609
24610 -m64
24611 Ignored, but preserved for backward compatibility. Only 64-bit ABI
24612 is supported.
24613
24614 -march=architecture-string
24615 Generate code for the specified PTX ISA target architecture (e.g.
24616 sm_35). Valid architecture strings are sm_30, sm_35, sm_53, sm_70,
24617 sm_75 and sm_80. The default depends on how the compiler has been
24618 configured, see --with-arch.
24619
24620 This option sets the value of the preprocessor macro "__PTX_SM__";
24621 for instance, for sm_35, it has the value 350.
24622
24623 -misa=architecture-string
24624 Alias of -march=.
24625
24626 -march-map=architecture-string
24627 Select the closest available -march= value that is not more
24628 capable. For instance, for -march-map=sm_50 select -march=sm_35,
24629 and for -march-map=sm_53 select -march=sm_53.
24630
24631 -mptx=version-string
24632 Generate code for the specified PTX ISA version (e.g. 7.0). Valid
24633 version strings include 3.1, 6.0, 6.3, and 7.0. The default PTX
24634 ISA version is 6.0, unless a higher version is required for
24635 specified PTX ISA target architecture via option -march=.
24636
24637 This option sets the values of the preprocessor macros
24638 "__PTX_ISA_VERSION_MAJOR__" and "__PTX_ISA_VERSION_MINOR__"; for
24639 instance, for 3.1 the macros have the values 3 and 1, respectively.
24640
24641 -mmainkernel
24642 Link in code for a __main kernel. This is for stand-alone instead
24643 of offloading execution.
24644
24645 -moptimize
24646 Apply partitioned execution optimizations. This is the default
24647 when any level of optimization is selected.
24648
24649 -msoft-stack
24650 Generate code that does not use ".local" memory directly for stack
24651 storage. Instead, a per-warp stack pointer is maintained
24652 explicitly. This enables variable-length stack allocation (with
24653 variable-length arrays or "alloca"), and when global memory is used
24654 for underlying storage, makes it possible to access automatic
24655 variables from other threads, or with atomic instructions. This
24656 code generation variant is used for OpenMP offloading, but the
24657 option is exposed on its own for the purpose of testing the
24658 compiler; to generate code suitable for linking into programs using
24659 OpenMP offloading, use option -mgomp.
24660
24661 -muniform-simt
24662 Switch to code generation variant that allows to execute all
24663 threads in each warp, while maintaining memory state and side
24664 effects as if only one thread in each warp was active outside of
24665 OpenMP SIMD regions. All atomic operations and calls to runtime
24666 (malloc, free, vprintf) are conditionally executed (iff current
24667 lane index equals the master lane index), and the register being
24668 assigned is copied via a shuffle instruction from the master lane.
24669 Outside of SIMD regions lane 0 is the master; inside, each thread
24670 sees itself as the master. Shared memory array "int __nvptx_uni[]"
24671 stores all-zeros or all-ones bitmasks for each warp, indicating
24672 current mode (0 outside of SIMD regions). Each thread can bitwise-
24673 and the bitmask at position "tid.y" with current lane index to
24674 compute the master lane index.
24675
24676 -mgomp
24677 Generate code for use in OpenMP offloading: enables -msoft-stack
24678 and -muniform-simt options, and selects corresponding multilib
24679 variant.
24680
24681 OpenRISC Options
24682 These options are defined for OpenRISC:
24683
24684 -mboard=name
24685 Configure a board specific runtime. This will be passed to the
24686 linker for newlib board library linking. The default is "or1ksim".
24687
24688 -mnewlib
24689 This option is ignored; it is for compatibility purposes only.
24690 This used to select linker and preprocessor options for use with
24691 newlib.
24692
24693 -msoft-div
24694 -mhard-div
24695 Select software or hardware divide ("l.div", "l.divu")
24696 instructions. This default is hardware divide.
24697
24698 -msoft-mul
24699 -mhard-mul
24700 Select software or hardware multiply ("l.mul", "l.muli")
24701 instructions. This default is hardware multiply.
24702
24703 -msoft-float
24704 -mhard-float
24705 Select software or hardware for floating point operations. The
24706 default is software.
24707
24708 -mdouble-float
24709 When -mhard-float is selected, enables generation of double-
24710 precision floating point instructions. By default functions from
24711 libgcc are used to perform double-precision floating point
24712 operations.
24713
24714 -munordered-float
24715 When -mhard-float is selected, enables generation of unordered
24716 floating point compare and set flag ("lf.sfun*") instructions. By
24717 default functions from libgcc are used to perform unordered
24718 floating point compare and set flag operations.
24719
24720 -mcmov
24721 Enable generation of conditional move ("l.cmov") instructions. By
24722 default the equivalent will be generated using set and branch.
24723
24724 -mror
24725 Enable generation of rotate right ("l.ror") instructions. By
24726 default functions from libgcc are used to perform rotate right
24727 operations.
24728
24729 -mrori
24730 Enable generation of rotate right with immediate ("l.rori")
24731 instructions. By default functions from libgcc are used to perform
24732 rotate right with immediate operations.
24733
24734 -msext
24735 Enable generation of sign extension ("l.ext*") instructions. By
24736 default memory loads are used to perform sign extension.
24737
24738 -msfimm
24739 Enable generation of compare and set flag with immediate ("l.sf*i")
24740 instructions. By default extra instructions will be generated to
24741 store the immediate to a register first.
24742
24743 -mshftimm
24744 Enable generation of shift with immediate ("l.srai", "l.srli",
24745 "l.slli") instructions. By default extra instructions will be
24746 generated to store the immediate to a register first.
24747
24748 -mcmodel=small
24749 Generate OpenRISC code for the small model: The GOT is limited to
24750 64k. This is the default model.
24751
24752 -mcmodel=large
24753 Generate OpenRISC code for the large model: The GOT may grow up to
24754 4G in size.
24755
24756 PDP-11 Options
24757 These options are defined for the PDP-11:
24758
24759 -mfpu
24760 Use hardware FPP floating point. This is the default. (FIS
24761 floating point on the PDP-11/40 is not supported.) Implies -m45.
24762
24763 -msoft-float
24764 Do not use hardware floating point.
24765
24766 -mac0
24767 Return floating-point results in ac0 (fr0 in Unix assembler
24768 syntax).
24769
24770 -mno-ac0
24771 Return floating-point results in memory. This is the default.
24772
24773 -m40
24774 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
24775
24776 -m45
24777 Generate code for a PDP-11/45. This is the default.
24778
24779 -m10
24780 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
24781
24782 -mint16
24783 -mno-int32
24784 Use 16-bit "int". This is the default.
24785
24786 -mint32
24787 -mno-int16
24788 Use 32-bit "int".
24789
24790 -msplit
24791 Target has split instruction and data space. Implies -m45.
24792
24793 -munix-asm
24794 Use Unix assembler syntax.
24795
24796 -mdec-asm
24797 Use DEC assembler syntax.
24798
24799 -mgnu-asm
24800 Use GNU assembler syntax. This is the default.
24801
24802 -mlra
24803 Use the new LRA register allocator. By default, the old "reload"
24804 allocator is used.
24805
24806 PowerPC Options
24807 These are listed under
24808
24809 PRU Options
24810 These command-line options are defined for PRU target:
24811
24812 -minrt
24813 Link with a minimum runtime environment, with no support for static
24814 initializers and constructors. Using this option can significantly
24815 reduce the size of the final ELF binary. Beware that the compiler
24816 could still generate code with static initializers and
24817 constructors. It is up to the programmer to ensure that the source
24818 program will not use those features.
24819
24820 -mmcu=mcu
24821 Specify the PRU MCU variant to use. Check Newlib for the exact
24822 list of supported MCUs.
24823
24824 -mno-relax
24825 Make GCC pass the --no-relax command-line option to the linker
24826 instead of the --relax option.
24827
24828 -mloop
24829 Allow (or do not allow) GCC to use the LOOP instruction.
24830
24831 -mabi=variant
24832 Specify the ABI variant to output code for. -mabi=ti selects the
24833 unmodified TI ABI while -mabi=gnu selects a GNU variant that copes
24834 more naturally with certain GCC assumptions. These are the
24835 differences:
24836
24837 Function Pointer Size
24838 TI ABI specifies that function (code) pointers are 16-bit,
24839 whereas GNU supports only 32-bit data and code pointers.
24840
24841 Optional Return Value Pointer
24842 Function return values larger than 64 bits are passed by using
24843 a hidden pointer as the first argument of the function. TI
24844 ABI, though, mandates that the pointer can be NULL in case the
24845 caller is not using the returned value. GNU always passes and
24846 expects a valid return value pointer.
24847
24848 The current -mabi=ti implementation simply raises a compile error
24849 when any of the above code constructs is detected. As a
24850 consequence the standard C library cannot be built and it is
24851 omitted when linking with -mabi=ti.
24852
24853 Relaxation is a GNU feature and for safety reasons is disabled when
24854 using -mabi=ti. The TI toolchain does not emit relocations for
24855 QBBx instructions, so the GNU linker cannot adjust them when
24856 shortening adjacent LDI32 pseudo instructions.
24857
24858 RISC-V Options
24859 These command-line options are defined for RISC-V targets:
24860
24861 -mbranch-cost=n
24862 Set the cost of branches to roughly n instructions.
24863
24864 -mplt
24865 -mno-plt
24866 When generating PIC code, do or don't allow the use of PLTs.
24867 Ignored for non-PIC. The default is -mplt.
24868
24869 -mabi=ABI-string
24870 Specify integer and floating-point calling convention. ABI-string
24871 contains two parts: the size of integer types and the registers
24872 used for floating-point types. For example -march=rv64ifd
24873 -mabi=lp64d means that long and pointers are 64-bit (implicitly
24874 defining int to be 32-bit), and that floating-point values up to 64
24875 bits wide are passed in F registers. Contrast this with
24876 -march=rv64ifd -mabi=lp64f, which still allows the compiler to
24877 generate code that uses the F and D extensions but only allows
24878 floating-point values up to 32 bits long to be passed in registers;
24879 or -march=rv64ifd -mabi=lp64, in which no floating-point arguments
24880 will be passed in registers.
24881
24882 The default for this argument is system dependent, users who want a
24883 specific calling convention should specify one explicitly. The
24884 valid calling conventions are: ilp32, ilp32f, ilp32d, lp64, lp64f,
24885 and lp64d. Some calling conventions are impossible to implement on
24886 some ISAs: for example, -march=rv32if -mabi=ilp32d is invalid
24887 because the ABI requires 64-bit values be passed in F registers,
24888 but F registers are only 32 bits wide. There is also the ilp32e
24889 ABI that can only be used with the rv32e architecture. This ABI is
24890 not well specified at present, and is subject to change.
24891
24892 -mfdiv
24893 -mno-fdiv
24894 Do or don't use hardware floating-point divide and square root
24895 instructions. This requires the F or D extensions for floating-
24896 point registers. The default is to use them if the specified
24897 architecture has these instructions.
24898
24899 -mdiv
24900 -mno-div
24901 Do or don't use hardware instructions for integer division. This
24902 requires the M extension. The default is to use them if the
24903 specified architecture has these instructions.
24904
24905 -misa-spec=ISA-spec-string
24906 Specify the version of the RISC-V Unprivileged (formerly User-
24907 Level) ISA specification to produce code conforming to. The
24908 possibilities for ISA-spec-string are:
24909
24910 2.2 Produce code conforming to version 2.2.
24911
24912 20190608
24913 Produce code conforming to version 20190608.
24914
24915 20191213
24916 Produce code conforming to version 20191213.
24917
24918 The default is -misa-spec=20191213 unless GCC has been configured
24919 with --with-isa-spec= specifying a different default version.
24920
24921 -march=ISA-string
24922 Generate code for given RISC-V ISA (e.g. rv64im). ISA strings must
24923 be lower-case. Examples include rv64i, rv32g, rv32e, and rv32imaf.
24924
24925 When -march= is not specified, use the setting from -mcpu.
24926
24927 If both -march and -mcpu= are not specified, the default for this
24928 argument is system dependent, users who want a specific
24929 architecture extensions should specify one explicitly.
24930
24931 -mcpu=processor-string
24932 Use architecture of and optimize the output for the given
24933 processor, specified by particular CPU name. Permissible values
24934 for this option are: sifive-e20, sifive-e21, sifive-e24,
24935 sifive-e31, sifive-e34, sifive-e76, sifive-s21, sifive-s51,
24936 sifive-s54, sifive-s76, sifive-u54, and sifive-u74.
24937
24938 -mtune=processor-string
24939 Optimize the output for the given processor, specified by
24940 microarchitecture or particular CPU name. Permissible values for
24941 this option are: rocket, sifive-3-series, sifive-5-series,
24942 sifive-7-series, thead-c906, size, and all valid options for
24943 -mcpu=.
24944
24945 When -mtune= is not specified, use the setting from -mcpu, the
24946 default is rocket if both are not specified.
24947
24948 The size choice is not intended for use by end-users. This is used
24949 when -Os is specified. It overrides the instruction cost info
24950 provided by -mtune=, but does not override the pipeline info. This
24951 helps reduce code size while still giving good performance.
24952
24953 -mpreferred-stack-boundary=num
24954 Attempt to keep the stack boundary aligned to a 2 raised to num
24955 byte boundary. If -mpreferred-stack-boundary is not specified, the
24956 default is 4 (16 bytes or 128-bits).
24957
24958 Warning: If you use this switch, then you must build all modules
24959 with the same value, including any libraries. This includes the
24960 system libraries and startup modules.
24961
24962 -msmall-data-limit=n
24963 Put global and static data smaller than n bytes into a special
24964 section (on some targets).
24965
24966 -msave-restore
24967 -mno-save-restore
24968 Do or don't use smaller but slower prologue and epilogue code that
24969 uses library function calls. The default is to use fast inline
24970 prologues and epilogues.
24971
24972 -minline-atomics
24973 -mno-inline-atomics
24974 Do or don't use smaller but slower subword atomic emulation code
24975 that uses libatomic function calls. The default is to use fast
24976 inline subword atomics that do not require libatomic.
24977
24978 -mshorten-memrefs
24979 -mno-shorten-memrefs
24980 Do or do not attempt to make more use of compressed load/store
24981 instructions by replacing a load/store of 'base register + large
24982 offset' with a new load/store of 'new base + small offset'. If the
24983 new base gets stored in a compressed register, then the new
24984 load/store can be compressed. Currently targets 32-bit integer
24985 load/stores only.
24986
24987 -mstrict-align
24988 -mno-strict-align
24989 Do not or do generate unaligned memory accesses. The default is
24990 set depending on whether the processor we are optimizing for
24991 supports fast unaligned access or not.
24992
24993 -mcmodel=medlow
24994 Generate code for the medium-low code model. The program and its
24995 statically defined symbols must lie within a single 2 GiB address
24996 range and must lie between absolute addresses -2 GiB and +2 GiB.
24997 Programs can be statically or dynamically linked. This is the
24998 default code model.
24999
25000 -mcmodel=medany
25001 Generate code for the medium-any code model. The program and its
25002 statically defined symbols must be within any single 2 GiB address
25003 range. Programs can be statically or dynamically linked.
25004
25005 The code generated by the medium-any code model is position-
25006 independent, but is not guaranteed to function correctly when
25007 linked into position-independent executables or libraries.
25008
25009 -mexplicit-relocs
25010 -mno-exlicit-relocs
25011 Use or do not use assembler relocation operators when dealing with
25012 symbolic addresses. The alternative is to use assembler macros
25013 instead, which may limit optimization.
25014
25015 -mrelax
25016 -mno-relax
25017 Take advantage of linker relaxations to reduce the number of
25018 instructions required to materialize symbol addresses. The default
25019 is to take advantage of linker relaxations.
25020
25021 -mriscv-attribute
25022 -mno-riscv-attribute
25023 Emit (do not emit) RISC-V attribute to record extra information
25024 into ELF objects. This feature requires at least binutils 2.32.
25025
25026 -mcsr-check
25027 -mno-csr-check
25028 Enables or disables the CSR checking.
25029
25030 -malign-data=type
25031 Control how GCC aligns variables and constants of array, structure,
25032 or union types. Supported values for type are xlen which uses x
25033 register width as the alignment value, and natural which uses
25034 natural alignment. xlen is the default.
25035
25036 -mbig-endian
25037 Generate big-endian code. This is the default when GCC is
25038 configured for a riscv64be-*-* or riscv32be-*-* target.
25039
25040 -mlittle-endian
25041 Generate little-endian code. This is the default when GCC is
25042 configured for a riscv64-*-* or riscv32-*-* but not a riscv64be-*-*
25043 or riscv32be-*-* target.
25044
25045 -mstack-protector-guard=guard
25046 -mstack-protector-guard-reg=reg
25047 -mstack-protector-guard-offset=offset
25048 Generate stack protection code using canary at guard. Supported
25049 locations are global for a global canary or tls for per-thread
25050 canary in the TLS block.
25051
25052 With the latter choice the options -mstack-protector-guard-reg=reg
25053 and -mstack-protector-guard-offset=offset furthermore specify which
25054 register to use as base register for reading the canary, and from
25055 what offset from that base register. There is no default register
25056 or offset as this is entirely for use within the Linux kernel.
25057
25058 RL78 Options
25059 -msim
25060 Links in additional target libraries to support operation within a
25061 simulator.
25062
25063 -mmul=none
25064 -mmul=g10
25065 -mmul=g13
25066 -mmul=g14
25067 -mmul=rl78
25068 Specifies the type of hardware multiplication and division support
25069 to be used. The simplest is "none", which uses software for both
25070 multiplication and division. This is the default. The "g13" value
25071 is for the hardware multiply/divide peripheral found on the
25072 RL78/G13 (S2 core) targets. The "g14" value selects the use of the
25073 multiplication and division instructions supported by the RL78/G14
25074 (S3 core) parts. The value "rl78" is an alias for "g14" and the
25075 value "mg10" is an alias for "none".
25076
25077 In addition a C preprocessor macro is defined, based upon the
25078 setting of this option. Possible values are: "__RL78_MUL_NONE__",
25079 "__RL78_MUL_G13__" or "__RL78_MUL_G14__".
25080
25081 -mcpu=g10
25082 -mcpu=g13
25083 -mcpu=g14
25084 -mcpu=rl78
25085 Specifies the RL78 core to target. The default is the G14 core,
25086 also known as an S3 core or just RL78. The G13 or S2 core does not
25087 have multiply or divide instructions, instead it uses a hardware
25088 peripheral for these operations. The G10 or S1 core does not have
25089 register banks, so it uses a different calling convention.
25090
25091 If this option is set it also selects the type of hardware multiply
25092 support to use, unless this is overridden by an explicit -mmul=none
25093 option on the command line. Thus specifying -mcpu=g13 enables the
25094 use of the G13 hardware multiply peripheral and specifying
25095 -mcpu=g10 disables the use of hardware multiplications altogether.
25096
25097 Note, although the RL78/G14 core is the default target, specifying
25098 -mcpu=g14 or -mcpu=rl78 on the command line does change the
25099 behavior of the toolchain since it also enables G14 hardware
25100 multiply support. If these options are not specified on the
25101 command line then software multiplication routines will be used
25102 even though the code targets the RL78 core. This is for backwards
25103 compatibility with older toolchains which did not have hardware
25104 multiply and divide support.
25105
25106 In addition a C preprocessor macro is defined, based upon the
25107 setting of this option. Possible values are: "__RL78_G10__",
25108 "__RL78_G13__" or "__RL78_G14__".
25109
25110 -mg10
25111 -mg13
25112 -mg14
25113 -mrl78
25114 These are aliases for the corresponding -mcpu= option. They are
25115 provided for backwards compatibility.
25116
25117 -mallregs
25118 Allow the compiler to use all of the available registers. By
25119 default registers "r24..r31" are reserved for use in interrupt
25120 handlers. With this option enabled these registers can be used in
25121 ordinary functions as well.
25122
25123 -m64bit-doubles
25124 -m32bit-doubles
25125 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
25126 (-m32bit-doubles) in size. The default is -m32bit-doubles.
25127
25128 -msave-mduc-in-interrupts
25129 -mno-save-mduc-in-interrupts
25130 Specifies that interrupt handler functions should preserve the MDUC
25131 registers. This is only necessary if normal code might use the
25132 MDUC registers, for example because it performs multiplication and
25133 division operations. The default is to ignore the MDUC registers
25134 as this makes the interrupt handlers faster. The target option
25135 -mg13 needs to be passed for this to work as this feature is only
25136 available on the G13 target (S2 core). The MDUC registers will
25137 only be saved if the interrupt handler performs a multiplication or
25138 division operation or it calls another function.
25139
25140 IBM RS/6000 and PowerPC Options
25141 These -m options are defined for the IBM RS/6000 and PowerPC:
25142
25143 -mpowerpc-gpopt
25144 -mno-powerpc-gpopt
25145 -mpowerpc-gfxopt
25146 -mno-powerpc-gfxopt
25147 -mpowerpc64
25148 -mno-powerpc64
25149 -mmfcrf
25150 -mno-mfcrf
25151 -mpopcntb
25152 -mno-popcntb
25153 -mpopcntd
25154 -mno-popcntd
25155 -mfprnd
25156 -mno-fprnd
25157 -mcmpb
25158 -mno-cmpb
25159 -mhard-dfp
25160 -mno-hard-dfp
25161 You use these options to specify which instructions are available
25162 on the processor you are using. The default value of these options
25163 is determined when configuring GCC. Specifying the -mcpu=cpu_type
25164 overrides the specification of these options. We recommend you use
25165 the -mcpu=cpu_type option rather than the options listed above.
25166
25167 Specifying -mpowerpc-gpopt allows GCC to use the optional PowerPC
25168 architecture instructions in the General Purpose group, including
25169 floating-point square root. Specifying -mpowerpc-gfxopt allows GCC
25170 to use the optional PowerPC architecture instructions in the
25171 Graphics group, including floating-point select.
25172
25173 The -mmfcrf option allows GCC to generate the move from condition
25174 register field instruction implemented on the POWER4 processor and
25175 other processors that support the PowerPC V2.01 architecture. The
25176 -mpopcntb option allows GCC to generate the popcount and double-
25177 precision FP reciprocal estimate instruction implemented on the
25178 POWER5 processor and other processors that support the PowerPC
25179 V2.02 architecture. The -mpopcntd option allows GCC to generate
25180 the popcount instruction implemented on the POWER7 processor and
25181 other processors that support the PowerPC V2.06 architecture. The
25182 -mfprnd option allows GCC to generate the FP round to integer
25183 instructions implemented on the POWER5+ processor and other
25184 processors that support the PowerPC V2.03 architecture. The -mcmpb
25185 option allows GCC to generate the compare bytes instruction
25186 implemented on the POWER6 processor and other processors that
25187 support the PowerPC V2.05 architecture. The -mhard-dfp option
25188 allows GCC to generate the decimal floating-point instructions
25189 implemented on some POWER processors.
25190
25191 The -mpowerpc64 option allows GCC to generate the additional 64-bit
25192 instructions that are found in the full PowerPC64 architecture and
25193 to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
25194 -mno-powerpc64.
25195
25196 -mcpu=cpu_type
25197 Set architecture type, register usage, and instruction scheduling
25198 parameters for machine type cpu_type. Supported values for
25199 cpu_type are 401, 403, 405, 405fp, 440, 440fp, 464, 464fp, 476,
25200 476fp, 505, 601, 602, 603, 603e, 604, 604e, 620, 630, 740, 7400,
25201 7450, 750, 801, 821, 823, 860, 970, 8540, a2, e300c2, e300c3,
25202 e500mc, e500mc64, e5500, e6500, ec603e, G3, G4, G5, titan, power3,
25203 power4, power5, power5+, power6, power6x, power7, power8, power9,
25204 power10, powerpc, powerpc64, powerpc64le, rs64, and native.
25205
25206 -mcpu=powerpc, -mcpu=powerpc64, and -mcpu=powerpc64le specify pure
25207 32-bit PowerPC (either endian), 64-bit big endian PowerPC and
25208 64-bit little endian PowerPC architecture machine types, with an
25209 appropriate, generic processor model assumed for scheduling
25210 purposes.
25211
25212 Specifying native as cpu type detects and selects the architecture
25213 option that corresponds to the host processor of the system
25214 performing the compilation. -mcpu=native has no effect if GCC does
25215 not recognize the processor.
25216
25217 The other options specify a specific processor. Code generated
25218 under those options runs best on that processor, and may not run at
25219 all on others.
25220
25221 The -mcpu options automatically enable or disable the following
25222 options:
25223
25224 -maltivec -mfprnd -mhard-float -mmfcrf -mmultiple -mpopcntb
25225 -mpopcntd -mpowerpc64 -mpowerpc-gpopt -mpowerpc-gfxopt -mmulhw
25226 -mdlmzb -mmfpgpr -mvsx -mcrypto -mhtm -mpower8-fusion
25227 -mpower8-vector -mquad-memory -mquad-memory-atomic -mfloat128
25228 -mfloat128-hardware -mprefixed -mpcrel -mmma -mrop-protect
25229
25230 The particular options set for any particular CPU varies between
25231 compiler versions, depending on what setting seems to produce
25232 optimal code for that CPU; it doesn't necessarily reflect the
25233 actual hardware's capabilities. If you wish to set an individual
25234 option to a particular value, you may specify it after the -mcpu
25235 option, like -mcpu=970 -mno-altivec.
25236
25237 On AIX, the -maltivec and -mpowerpc64 options are not enabled or
25238 disabled by the -mcpu option at present because AIX does not have
25239 full support for these options. You may still enable or disable
25240 them individually if you're sure it'll work in your environment.
25241
25242 -mtune=cpu_type
25243 Set the instruction scheduling parameters for machine type
25244 cpu_type, but do not set the architecture type or register usage,
25245 as -mcpu=cpu_type does. The same values for cpu_type are used for
25246 -mtune as for -mcpu. If both are specified, the code generated
25247 uses the architecture and registers set by -mcpu, but the
25248 scheduling parameters set by -mtune.
25249
25250 -mcmodel=small
25251 Generate PowerPC64 code for the small model: The TOC is limited to
25252 64k.
25253
25254 -mcmodel=medium
25255 Generate PowerPC64 code for the medium model: The TOC and other
25256 static data may be up to a total of 4G in size. This is the
25257 default for 64-bit Linux.
25258
25259 -mcmodel=large
25260 Generate PowerPC64 code for the large model: The TOC may be up to
25261 4G in size. Other data and code is only limited by the 64-bit
25262 address space.
25263
25264 -maltivec
25265 -mno-altivec
25266 Generate code that uses (does not use) AltiVec instructions, and
25267 also enable the use of built-in functions that allow more direct
25268 access to the AltiVec instruction set. You may also need to set
25269 -mabi=altivec to adjust the current ABI with AltiVec ABI
25270 enhancements.
25271
25272 When -maltivec is used, the element order for AltiVec intrinsics
25273 such as "vec_splat", "vec_extract", and "vec_insert" match array
25274 element order corresponding to the endianness of the target. That
25275 is, element zero identifies the leftmost element in a vector
25276 register when targeting a big-endian platform, and identifies the
25277 rightmost element in a vector register when targeting a little-
25278 endian platform.
25279
25280 -mvrsave
25281 -mno-vrsave
25282 Generate VRSAVE instructions when generating AltiVec code.
25283
25284 -msecure-plt
25285 Generate code that allows ld and ld.so to build executables and
25286 shared libraries with non-executable ".plt" and ".got" sections.
25287 This is a PowerPC 32-bit SYSV ABI option.
25288
25289 -mbss-plt
25290 Generate code that uses a BSS ".plt" section that ld.so fills in,
25291 and requires ".plt" and ".got" sections that are both writable and
25292 executable. This is a PowerPC 32-bit SYSV ABI option.
25293
25294 -misel
25295 -mno-isel
25296 This switch enables or disables the generation of ISEL
25297 instructions.
25298
25299 -mvsx
25300 -mno-vsx
25301 Generate code that uses (does not use) vector/scalar (VSX)
25302 instructions, and also enable the use of built-in functions that
25303 allow more direct access to the VSX instruction set.
25304
25305 -mcrypto
25306 -mno-crypto
25307 Enable the use (disable) of the built-in functions that allow
25308 direct access to the cryptographic instructions that were added in
25309 version 2.07 of the PowerPC ISA.
25310
25311 -mhtm
25312 -mno-htm
25313 Enable (disable) the use of the built-in functions that allow
25314 direct access to the Hardware Transactional Memory (HTM)
25315 instructions that were added in version 2.07 of the PowerPC ISA.
25316
25317 -mpower8-fusion
25318 -mno-power8-fusion
25319 Generate code that keeps (does not keeps) some integer operations
25320 adjacent so that the instructions can be fused together on power8
25321 and later processors.
25322
25323 -mpower8-vector
25324 -mno-power8-vector
25325 Generate code that uses (does not use) the vector and scalar
25326 instructions that were added in version 2.07 of the PowerPC ISA.
25327 Also enable the use of built-in functions that allow more direct
25328 access to the vector instructions.
25329
25330 -mquad-memory
25331 -mno-quad-memory
25332 Generate code that uses (does not use) the non-atomic quad word
25333 memory instructions. The -mquad-memory option requires use of
25334 64-bit mode.
25335
25336 -mquad-memory-atomic
25337 -mno-quad-memory-atomic
25338 Generate code that uses (does not use) the atomic quad word memory
25339 instructions. The -mquad-memory-atomic option requires use of
25340 64-bit mode.
25341
25342 -mfloat128
25343 -mno-float128
25344 Enable/disable the __float128 keyword for IEEE 128-bit floating
25345 point and use either software emulation for IEEE 128-bit floating
25346 point or hardware instructions.
25347
25348 The VSX instruction set (-mvsx) must be enabled to use the IEEE
25349 128-bit floating point support. The IEEE 128-bit floating point is
25350 only supported on Linux.
25351
25352 The default for -mfloat128 is enabled on PowerPC Linux systems
25353 using the VSX instruction set, and disabled on other systems.
25354
25355 If you use the ISA 3.0 instruction set (-mpower9-vector or
25356 -mcpu=power9) on a 64-bit system, the IEEE 128-bit floating point
25357 support will also enable the generation of ISA 3.0 IEEE 128-bit
25358 floating point instructions. Otherwise, if you do not specify to
25359 generate ISA 3.0 instructions or you are targeting a 32-bit big
25360 endian system, IEEE 128-bit floating point will be done with
25361 software emulation.
25362
25363 -mfloat128-hardware
25364 -mno-float128-hardware
25365 Enable/disable using ISA 3.0 hardware instructions to support the
25366 __float128 data type.
25367
25368 The default for -mfloat128-hardware is enabled on PowerPC Linux
25369 systems using the ISA 3.0 instruction set, and disabled on other
25370 systems.
25371
25372 -m32
25373 -m64
25374 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
25375 targets (including GNU/Linux). The 32-bit environment sets int,
25376 long and pointer to 32 bits and generates code that runs on any
25377 PowerPC variant. The 64-bit environment sets int to 32 bits and
25378 long and pointer to 64 bits, and generates code for PowerPC64, as
25379 for -mpowerpc64.
25380
25381 -mfull-toc
25382 -mno-fp-in-toc
25383 -mno-sum-in-toc
25384 -mminimal-toc
25385 Modify generation of the TOC (Table Of Contents), which is created
25386 for every executable file. The -mfull-toc option is selected by
25387 default. In that case, GCC allocates at least one TOC entry for
25388 each unique non-automatic variable reference in your program. GCC
25389 also places floating-point constants in the TOC. However, only
25390 16,384 entries are available in the TOC.
25391
25392 If you receive a linker error message that saying you have
25393 overflowed the available TOC space, you can reduce the amount of
25394 TOC space used with the -mno-fp-in-toc and -mno-sum-in-toc options.
25395 -mno-fp-in-toc prevents GCC from putting floating-point constants
25396 in the TOC and -mno-sum-in-toc forces GCC to generate code to
25397 calculate the sum of an address and a constant at run time instead
25398 of putting that sum into the TOC. You may specify one or both of
25399 these options. Each causes GCC to produce very slightly slower and
25400 larger code at the expense of conserving TOC space.
25401
25402 If you still run out of space in the TOC even when you specify both
25403 of these options, specify -mminimal-toc instead. This option
25404 causes GCC to make only one TOC entry for every file. When you
25405 specify this option, GCC produces code that is slower and larger
25406 but which uses extremely little TOC space. You may wish to use
25407 this option only on files that contain less frequently-executed
25408 code.
25409
25410 -maix64
25411 -maix32
25412 Enable 64-bit AIX ABI and calling convention: 64-bit pointers,
25413 64-bit "long" type, and the infrastructure needed to support them.
25414 Specifying -maix64 implies -mpowerpc64, while -maix32 disables the
25415 64-bit ABI and implies -mno-powerpc64. GCC defaults to -maix32.
25416
25417 -mxl-compat
25418 -mno-xl-compat
25419 Produce code that conforms more closely to IBM XL compiler
25420 semantics when using AIX-compatible ABI. Pass floating-point
25421 arguments to prototyped functions beyond the register save area
25422 (RSA) on the stack in addition to argument FPRs. Do not assume
25423 that most significant double in 128-bit long double value is
25424 properly rounded when comparing values and converting to double.
25425 Use XL symbol names for long double support routines.
25426
25427 The AIX calling convention was extended but not initially
25428 documented to handle an obscure K&R C case of calling a function
25429 that takes the address of its arguments with fewer arguments than
25430 declared. IBM XL compilers access floating-point arguments that do
25431 not fit in the RSA from the stack when a subroutine is compiled
25432 without optimization. Because always storing floating-point
25433 arguments on the stack is inefficient and rarely needed, this
25434 option is not enabled by default and only is necessary when calling
25435 subroutines compiled by IBM XL compilers without optimization.
25436
25437 -mpe
25438 Support IBM RS/6000 SP Parallel Environment (PE). Link an
25439 application written to use message passing with special startup
25440 code to enable the application to run. The system must have PE
25441 installed in the standard location (/usr/lpp/ppe.poe/), or the
25442 specs file must be overridden with the -specs= option to specify
25443 the appropriate directory location. The Parallel Environment does
25444 not support threads, so the -mpe option and the -pthread option are
25445 incompatible.
25446
25447 -malign-natural
25448 -malign-power
25449 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
25450 -malign-natural overrides the ABI-defined alignment of larger
25451 types, such as floating-point doubles, on their natural size-based
25452 boundary. The option -malign-power instructs GCC to follow the
25453 ABI-specified alignment rules. GCC defaults to the standard
25454 alignment defined in the ABI.
25455
25456 On 64-bit Darwin, natural alignment is the default, and
25457 -malign-power is not supported.
25458
25459 -msoft-float
25460 -mhard-float
25461 Generate code that does not use (uses) the floating-point register
25462 set. Software floating-point emulation is provided if you use the
25463 -msoft-float option, and pass the option to GCC when linking.
25464
25465 -mmultiple
25466 -mno-multiple
25467 Generate code that uses (does not use) the load multiple word
25468 instructions and the store multiple word instructions. These
25469 instructions are generated by default on POWER systems, and not
25470 generated on PowerPC systems. Do not use -mmultiple on little-
25471 endian PowerPC systems, since those instructions do not work when
25472 the processor is in little-endian mode. The exceptions are PPC740
25473 and PPC750 which permit these instructions in little-endian mode.
25474
25475 -mupdate
25476 -mno-update
25477 Generate code that uses (does not use) the load or store
25478 instructions that update the base register to the address of the
25479 calculated memory location. These instructions are generated by
25480 default. If you use -mno-update, there is a small window between
25481 the time that the stack pointer is updated and the address of the
25482 previous frame is stored, which means code that walks the stack
25483 frame across interrupts or signals may get corrupted data.
25484
25485 -mavoid-indexed-addresses
25486 -mno-avoid-indexed-addresses
25487 Generate code that tries to avoid (not avoid) the use of indexed
25488 load or store instructions. These instructions can incur a
25489 performance penalty on Power6 processors in certain situations,
25490 such as when stepping through large arrays that cross a 16M
25491 boundary. This option is enabled by default when targeting Power6
25492 and disabled otherwise.
25493
25494 -mfused-madd
25495 -mno-fused-madd
25496 Generate code that uses (does not use) the floating-point multiply
25497 and accumulate instructions. These instructions are generated by
25498 default if hardware floating point is used. The machine-dependent
25499 -mfused-madd option is now mapped to the machine-independent
25500 -ffp-contract=fast option, and -mno-fused-madd is mapped to
25501 -ffp-contract=off.
25502
25503 -mmulhw
25504 -mno-mulhw
25505 Generate code that uses (does not use) the half-word multiply and
25506 multiply-accumulate instructions on the IBM 405, 440, 464 and 476
25507 processors. These instructions are generated by default when
25508 targeting those processors.
25509
25510 -mdlmzb
25511 -mno-dlmzb
25512 Generate code that uses (does not use) the string-search dlmzb
25513 instruction on the IBM 405, 440, 464 and 476 processors. This
25514 instruction is generated by default when targeting those
25515 processors.
25516
25517 -mno-bit-align
25518 -mbit-align
25519 On System V.4 and embedded PowerPC systems do not (do) force
25520 structures and unions that contain bit-fields to be aligned to the
25521 base type of the bit-field.
25522
25523 For example, by default a structure containing nothing but 8
25524 "unsigned" bit-fields of length 1 is aligned to a 4-byte boundary
25525 and has a size of 4 bytes. By using -mno-bit-align, the structure
25526 is aligned to a 1-byte boundary and is 1 byte in size.
25527
25528 -mno-strict-align
25529 -mstrict-align
25530 On System V.4 and embedded PowerPC systems do not (do) assume that
25531 unaligned memory references are handled by the system.
25532
25533 -mrelocatable
25534 -mno-relocatable
25535 Generate code that allows (does not allow) a static executable to
25536 be relocated to a different address at run time. A simple embedded
25537 PowerPC system loader should relocate the entire contents of
25538 ".got2" and 4-byte locations listed in the ".fixup" section, a
25539 table of 32-bit addresses generated by this option. For this to
25540 work, all objects linked together must be compiled with
25541 -mrelocatable or -mrelocatable-lib. -mrelocatable code aligns the
25542 stack to an 8-byte boundary.
25543
25544 -mrelocatable-lib
25545 -mno-relocatable-lib
25546 Like -mrelocatable, -mrelocatable-lib generates a ".fixup" section
25547 to allow static executables to be relocated at run time, but
25548 -mrelocatable-lib does not use the smaller stack alignment of
25549 -mrelocatable. Objects compiled with -mrelocatable-lib may be
25550 linked with objects compiled with any combination of the
25551 -mrelocatable options.
25552
25553 -mno-toc
25554 -mtoc
25555 On System V.4 and embedded PowerPC systems do not (do) assume that
25556 register 2 contains a pointer to a global area pointing to the
25557 addresses used in the program.
25558
25559 -mlittle
25560 -mlittle-endian
25561 On System V.4 and embedded PowerPC systems compile code for the
25562 processor in little-endian mode. The -mlittle-endian option is the
25563 same as -mlittle.
25564
25565 -mbig
25566 -mbig-endian
25567 On System V.4 and embedded PowerPC systems compile code for the
25568 processor in big-endian mode. The -mbig-endian option is the same
25569 as -mbig.
25570
25571 -mdynamic-no-pic
25572 On Darwin and Mac OS X systems, compile code so that it is not
25573 relocatable, but that its external references are relocatable. The
25574 resulting code is suitable for applications, but not shared
25575 libraries.
25576
25577 -msingle-pic-base
25578 Treat the register used for PIC addressing as read-only, rather
25579 than loading it in the prologue for each function. The runtime
25580 system is responsible for initializing this register with an
25581 appropriate value before execution begins.
25582
25583 -mprioritize-restricted-insns=priority
25584 This option controls the priority that is assigned to dispatch-slot
25585 restricted instructions during the second scheduling pass. The
25586 argument priority takes the value 0, 1, or 2 to assign no, highest,
25587 or second-highest (respectively) priority to dispatch-slot
25588 restricted instructions.
25589
25590 -msched-costly-dep=dependence_type
25591 This option controls which dependences are considered costly by the
25592 target during instruction scheduling. The argument dependence_type
25593 takes one of the following values:
25594
25595 no No dependence is costly.
25596
25597 all All dependences are costly.
25598
25599 true_store_to_load
25600 A true dependence from store to load is costly.
25601
25602 store_to_load
25603 Any dependence from store to load is costly.
25604
25605 number
25606 Any dependence for which the latency is greater than or equal
25607 to number is costly.
25608
25609 -minsert-sched-nops=scheme
25610 This option controls which NOP insertion scheme is used during the
25611 second scheduling pass. The argument scheme takes one of the
25612 following values:
25613
25614 no Don't insert NOPs.
25615
25616 pad Pad with NOPs any dispatch group that has vacant issue slots,
25617 according to the scheduler's grouping.
25618
25619 regroup_exact
25620 Insert NOPs to force costly dependent insns into separate
25621 groups. Insert exactly as many NOPs as needed to force an insn
25622 to a new group, according to the estimated processor grouping.
25623
25624 number
25625 Insert NOPs to force costly dependent insns into separate
25626 groups. Insert number NOPs to force an insn to a new group.
25627
25628 -mcall-sysv
25629 On System V.4 and embedded PowerPC systems compile code using
25630 calling conventions that adhere to the March 1995 draft of the
25631 System V Application Binary Interface, PowerPC processor
25632 supplement. This is the default unless you configured GCC using
25633 powerpc-*-eabiaix.
25634
25635 -mcall-sysv-eabi
25636 -mcall-eabi
25637 Specify both -mcall-sysv and -meabi options.
25638
25639 -mcall-sysv-noeabi
25640 Specify both -mcall-sysv and -mno-eabi options.
25641
25642 -mcall-aixdesc
25643 On System V.4 and embedded PowerPC systems compile code for the AIX
25644 operating system.
25645
25646 -mcall-linux
25647 On System V.4 and embedded PowerPC systems compile code for the
25648 Linux-based GNU system.
25649
25650 -mcall-freebsd
25651 On System V.4 and embedded PowerPC systems compile code for the
25652 FreeBSD operating system.
25653
25654 -mcall-netbsd
25655 On System V.4 and embedded PowerPC systems compile code for the
25656 NetBSD operating system.
25657
25658 -mcall-openbsd
25659 On System V.4 and embedded PowerPC systems compile code for the
25660 OpenBSD operating system.
25661
25662 -mtraceback=traceback_type
25663 Select the type of traceback table. Valid values for traceback_type
25664 are full, part, and no.
25665
25666 -maix-struct-return
25667 Return all structures in memory (as specified by the AIX ABI).
25668
25669 -msvr4-struct-return
25670 Return structures smaller than 8 bytes in registers (as specified
25671 by the SVR4 ABI).
25672
25673 -mabi=abi-type
25674 Extend the current ABI with a particular extension, or remove such
25675 extension. Valid values are: altivec, no-altivec, ibmlongdouble,
25676 ieeelongdouble, elfv1, elfv2, and for AIX: vec-extabi, vec-default.
25677
25678 -mabi=ibmlongdouble
25679 Change the current ABI to use IBM extended-precision long double.
25680 This is not likely to work if your system defaults to using IEEE
25681 extended-precision long double. If you change the long double type
25682 from IEEE extended-precision, the compiler will issue a warning
25683 unless you use the -Wno-psabi option. Requires -mlong-double-128
25684 to be enabled.
25685
25686 -mabi=ieeelongdouble
25687 Change the current ABI to use IEEE extended-precision long double.
25688 This is not likely to work if your system defaults to using IBM
25689 extended-precision long double. If you change the long double type
25690 from IBM 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=elfv1
25695 Change the current ABI to use the ELFv1 ABI. This is the default
25696 ABI for big-endian PowerPC 64-bit Linux. Overriding the default
25697 ABI requires special system support and is likely to fail in
25698 spectacular ways.
25699
25700 -mabi=elfv2
25701 Change the current ABI to use the ELFv2 ABI. This is the default
25702 ABI for little-endian PowerPC 64-bit Linux. Overriding the default
25703 ABI requires special system support and is likely to fail in
25704 spectacular ways.
25705
25706 -mgnu-attribute
25707 -mno-gnu-attribute
25708 Emit .gnu_attribute assembly directives to set tag/value pairs in a
25709 .gnu.attributes section that specify ABI variations in function
25710 parameters or return values.
25711
25712 -mprototype
25713 -mno-prototype
25714 On System V.4 and embedded PowerPC systems assume that all calls to
25715 variable argument functions are properly prototyped. Otherwise,
25716 the compiler must insert an instruction before every non-prototyped
25717 call to set or clear bit 6 of the condition code register ("CR") to
25718 indicate whether floating-point values are passed in the floating-
25719 point registers in case the function takes variable arguments.
25720 With -mprototype, only calls to prototyped variable argument
25721 functions set or clear the bit.
25722
25723 -msim
25724 On embedded PowerPC systems, assume that the startup module is
25725 called sim-crt0.o and that the standard C libraries are libsim.a
25726 and libc.a. This is the default for powerpc-*-eabisim
25727 configurations.
25728
25729 -mmvme
25730 On embedded PowerPC systems, assume that the startup module is
25731 called crt0.o and the standard C libraries are libmvme.a and
25732 libc.a.
25733
25734 -mads
25735 On embedded PowerPC systems, assume that the startup module is
25736 called crt0.o and the standard C libraries are libads.a and libc.a.
25737
25738 -myellowknife
25739 On embedded PowerPC systems, assume that the startup module is
25740 called crt0.o and the standard C libraries are libyk.a and libc.a.
25741
25742 -mvxworks
25743 On System V.4 and embedded PowerPC systems, specify that you are
25744 compiling for a VxWorks system.
25745
25746 -memb
25747 On embedded PowerPC systems, set the "PPC_EMB" bit in the ELF flags
25748 header to indicate that eabi extended relocations are used.
25749
25750 -meabi
25751 -mno-eabi
25752 On System V.4 and embedded PowerPC systems do (do not) adhere to
25753 the Embedded Applications Binary Interface (EABI), which is a set
25754 of modifications to the System V.4 specifications. Selecting
25755 -meabi means that the stack is aligned to an 8-byte boundary, a
25756 function "__eabi" is called from "main" to set up the EABI
25757 environment, and the -msdata option can use both "r2" and "r13" to
25758 point to two separate small data areas. Selecting -mno-eabi means
25759 that the stack is aligned to a 16-byte boundary, no EABI
25760 initialization function is called from "main", and the -msdata
25761 option only uses "r13" to point to a single small data area. The
25762 -meabi option is on by default if you configured GCC using one of
25763 the powerpc*-*-eabi* options.
25764
25765 -msdata=eabi
25766 On System V.4 and embedded PowerPC systems, put small initialized
25767 "const" global and static data in the ".sdata2" section, which is
25768 pointed to by register "r2". Put small initialized non-"const"
25769 global and static data in the ".sdata" section, which is pointed to
25770 by register "r13". Put small uninitialized global and static data
25771 in the ".sbss" section, which is adjacent to the ".sdata" section.
25772 The -msdata=eabi option is incompatible with the -mrelocatable
25773 option. The -msdata=eabi option also sets the -memb option.
25774
25775 -msdata=sysv
25776 On System V.4 and embedded PowerPC systems, put small global and
25777 static data in the ".sdata" section, which is pointed to by
25778 register "r13". Put small uninitialized global and static data in
25779 the ".sbss" section, which is adjacent to the ".sdata" section.
25780 The -msdata=sysv option is incompatible with the -mrelocatable
25781 option.
25782
25783 -msdata=default
25784 -msdata
25785 On System V.4 and embedded PowerPC systems, if -meabi is used,
25786 compile code the same as -msdata=eabi, otherwise compile code the
25787 same as -msdata=sysv.
25788
25789 -msdata=data
25790 On System V.4 and embedded PowerPC systems, put small global data
25791 in the ".sdata" section. Put small uninitialized global data in
25792 the ".sbss" section. Do not use register "r13" to address small
25793 data however. This is the default behavior unless other -msdata
25794 options are used.
25795
25796 -msdata=none
25797 -mno-sdata
25798 On embedded PowerPC systems, put all initialized global and static
25799 data in the ".data" section, and all uninitialized data in the
25800 ".bss" section.
25801
25802 -mreadonly-in-sdata
25803 Put read-only objects in the ".sdata" section as well. This is the
25804 default.
25805
25806 -mblock-move-inline-limit=num
25807 Inline all block moves (such as calls to "memcpy" or structure
25808 copies) less than or equal to num bytes. The minimum value for num
25809 is 32 bytes on 32-bit targets and 64 bytes on 64-bit targets. The
25810 default value is target-specific.
25811
25812 -mblock-compare-inline-limit=num
25813 Generate non-looping inline code for all block compares (such as
25814 calls to "memcmp" or structure compares) less than or equal to num
25815 bytes. If num is 0, all inline expansion (non-loop and loop) of
25816 block compare is disabled. The default value is target-specific.
25817
25818 -mblock-compare-inline-loop-limit=num
25819 Generate an inline expansion using loop code for all block compares
25820 that are less than or equal to num bytes, but greater than the
25821 limit for non-loop inline block compare expansion. If the block
25822 length is not constant, at most num bytes will be compared before
25823 "memcmp" is called to compare the remainder of the block. The
25824 default value is target-specific.
25825
25826 -mstring-compare-inline-limit=num
25827 Compare at most num string bytes with inline code. If the
25828 difference or end of string is not found at the end of the inline
25829 compare a call to "strcmp" or "strncmp" will take care of the rest
25830 of the comparison. The default is 64 bytes.
25831
25832 -G num
25833 On embedded PowerPC systems, put global and static items less than
25834 or equal to num bytes into the small data or BSS sections instead
25835 of the normal data or BSS section. By default, num is 8. The -G
25836 num switch is also passed to the linker. All modules should be
25837 compiled with the same -G num value.
25838
25839 -mregnames
25840 -mno-regnames
25841 On System V.4 and embedded PowerPC systems do (do not) emit
25842 register names in the assembly language output using symbolic
25843 forms.
25844
25845 -mlongcall
25846 -mno-longcall
25847 By default assume that all calls are far away so that a longer and
25848 more expensive calling sequence is required. This is required for
25849 calls farther than 32 megabytes (33,554,432 bytes) from the current
25850 location. A short call is generated if the compiler knows the call
25851 cannot be that far away. This setting can be overridden by the
25852 "shortcall" function attribute, or by #pragma longcall(0).
25853
25854 Some linkers are capable of detecting out-of-range calls and
25855 generating glue code on the fly. On these systems, long calls are
25856 unnecessary and generate slower code. As of this writing, the AIX
25857 linker can do this, as can the GNU linker for PowerPC/64. It is
25858 planned to add this feature to the GNU linker for 32-bit PowerPC
25859 systems as well.
25860
25861 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
25862 linkers, GCC can generate long calls using an inline PLT call
25863 sequence (see -mpltseq). PowerPC with -mbss-plt and PowerPC64
25864 ELFv1 (big-endian) do not support inline PLT calls.
25865
25866 On Darwin/PPC systems, "#pragma longcall" generates "jbsr callee,
25867 L42", plus a branch island (glue code). The two target addresses
25868 represent the callee and the branch island. The Darwin/PPC linker
25869 prefers the first address and generates a "bl callee" if the PPC
25870 "bl" instruction reaches the callee directly; otherwise, the linker
25871 generates "bl L42" to call the branch island. The branch island is
25872 appended to the body of the calling function; it computes the full
25873 32-bit address of the callee and jumps to it.
25874
25875 On Mach-O (Darwin) systems, this option directs the compiler emit
25876 to the glue for every direct call, and the Darwin linker decides
25877 whether to use or discard it.
25878
25879 In the future, GCC may ignore all longcall specifications when the
25880 linker is known to generate glue.
25881
25882 -mpltseq
25883 -mno-pltseq
25884 Implement (do not implement) -fno-plt and long calls using an
25885 inline PLT call sequence that supports lazy linking and long calls
25886 to functions in dlopen'd shared libraries. Inline PLT calls are
25887 only supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with
25888 newer GNU linkers, and are enabled by default if the support is
25889 detected when configuring GCC, and, in the case of 32-bit PowerPC,
25890 if GCC is configured with --enable-secureplt. -mpltseq code and
25891 -mbss-plt 32-bit PowerPC relocatable objects may not be linked
25892 together.
25893
25894 -mtls-markers
25895 -mno-tls-markers
25896 Mark (do not mark) calls to "__tls_get_addr" with a relocation
25897 specifying the function argument. The relocation allows the linker
25898 to reliably associate function call with argument setup
25899 instructions for TLS optimization, which in turn allows GCC to
25900 better schedule the sequence.
25901
25902 -mrecip
25903 -mno-recip
25904 This option enables use of the reciprocal estimate and reciprocal
25905 square root estimate instructions with additional Newton-Raphson
25906 steps to increase precision instead of doing a divide or square
25907 root and divide for floating-point arguments. You should use the
25908 -ffast-math option when using -mrecip (or at least
25909 -funsafe-math-optimizations, -ffinite-math-only, -freciprocal-math
25910 and -fno-trapping-math). Note that while the throughput of the
25911 sequence is generally higher than the throughput of the non-
25912 reciprocal instruction, the precision of the sequence can be
25913 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
25914 0.99999994) for reciprocal square roots.
25915
25916 -mrecip=opt
25917 This option controls which reciprocal estimate instructions may be
25918 used. opt is a comma-separated list of options, which may be
25919 preceded by a "!" to invert the option:
25920
25921 all Enable all estimate instructions.
25922
25923 default
25924 Enable the default instructions, equivalent to -mrecip.
25925
25926 none
25927 Disable all estimate instructions, equivalent to -mno-recip.
25928
25929 div Enable the reciprocal approximation instructions for both
25930 single and double precision.
25931
25932 divf
25933 Enable the single-precision reciprocal approximation
25934 instructions.
25935
25936 divd
25937 Enable the double-precision reciprocal approximation
25938 instructions.
25939
25940 rsqrt
25941 Enable the reciprocal square root approximation instructions
25942 for both single and double precision.
25943
25944 rsqrtf
25945 Enable the single-precision reciprocal square root
25946 approximation instructions.
25947
25948 rsqrtd
25949 Enable the double-precision reciprocal square root
25950 approximation instructions.
25951
25952 So, for example, -mrecip=all,!rsqrtd enables all of the reciprocal
25953 estimate instructions, except for the "FRSQRTE", "XSRSQRTEDP", and
25954 "XVRSQRTEDP" instructions which handle the double-precision
25955 reciprocal square root calculations.
25956
25957 -mrecip-precision
25958 -mno-recip-precision
25959 Assume (do not assume) that the reciprocal estimate instructions
25960 provide higher-precision estimates than is mandated by the PowerPC
25961 ABI. Selecting -mcpu=power6, -mcpu=power7 or -mcpu=power8
25962 automatically selects -mrecip-precision. The double-precision
25963 square root estimate instructions are not generated by default on
25964 low-precision machines, since they do not provide an estimate that
25965 converges after three steps.
25966
25967 -mveclibabi=type
25968 Specifies the ABI type to use for vectorizing intrinsics using an
25969 external library. The only type supported at present is mass,
25970 which specifies to use IBM's Mathematical Acceleration Subsystem
25971 (MASS) libraries for vectorizing intrinsics using external
25972 libraries. GCC currently emits calls to "acosd2", "acosf4",
25973 "acoshd2", "acoshf4", "asind2", "asinf4", "asinhd2", "asinhf4",
25974 "atan2d2", "atan2f4", "atand2", "atanf4", "atanhd2", "atanhf4",
25975 "cbrtd2", "cbrtf4", "cosd2", "cosf4", "coshd2", "coshf4", "erfcd2",
25976 "erfcf4", "erfd2", "erff4", "exp2d2", "exp2f4", "expd2", "expf4",
25977 "expm1d2", "expm1f4", "hypotd2", "hypotf4", "lgammad2", "lgammaf4",
25978 "log10d2", "log10f4", "log1pd2", "log1pf4", "log2d2", "log2f4",
25979 "logd2", "logf4", "powd2", "powf4", "sind2", "sinf4", "sinhd2",
25980 "sinhf4", "sqrtd2", "sqrtf4", "tand2", "tanf4", "tanhd2", and
25981 "tanhf4" when generating code for power7. Both -ftree-vectorize
25982 and -funsafe-math-optimizations must also be enabled. The MASS
25983 libraries must be specified at link time.
25984
25985 -mfriz
25986 -mno-friz
25987 Generate (do not generate) the "friz" instruction when the
25988 -funsafe-math-optimizations option is used to optimize rounding of
25989 floating-point values to 64-bit integer and back to floating point.
25990 The "friz" instruction does not return the same value if the
25991 floating-point number is too large to fit in an integer.
25992
25993 -mpointers-to-nested-functions
25994 -mno-pointers-to-nested-functions
25995 Generate (do not generate) code to load up the static chain
25996 register ("r11") when calling through a pointer on AIX and 64-bit
25997 Linux systems where a function pointer points to a 3-word
25998 descriptor giving the function address, TOC value to be loaded in
25999 register "r2", and static chain value to be loaded in register
26000 "r11". The -mpointers-to-nested-functions is on by default. You
26001 cannot call through pointers to nested functions or pointers to
26002 functions compiled in other languages that use the static chain if
26003 you use -mno-pointers-to-nested-functions.
26004
26005 -msave-toc-indirect
26006 -mno-save-toc-indirect
26007 Generate (do not generate) code to save the TOC value in the
26008 reserved stack location in the function prologue if the function
26009 calls through a pointer on AIX and 64-bit Linux systems. If the
26010 TOC value is not saved in the prologue, it is saved just before the
26011 call through the pointer. The -mno-save-toc-indirect option is the
26012 default.
26013
26014 -mcompat-align-parm
26015 -mno-compat-align-parm
26016 Generate (do not generate) code to pass structure parameters with a
26017 maximum alignment of 64 bits, for compatibility with older versions
26018 of GCC.
26019
26020 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
26021 structure parameter on a 128-bit boundary when that structure
26022 contained a member requiring 128-bit alignment. This is corrected
26023 in more recent versions of GCC. This option may be used to
26024 generate code that is compatible with functions compiled with older
26025 versions of GCC.
26026
26027 The -mno-compat-align-parm option is the default.
26028
26029 -mstack-protector-guard=guard
26030 -mstack-protector-guard-reg=reg
26031 -mstack-protector-guard-offset=offset
26032 -mstack-protector-guard-symbol=symbol
26033 Generate stack protection code using canary at guard. Supported
26034 locations are global for global canary or tls for per-thread canary
26035 in the TLS block (the default with GNU libc version 2.4 or later).
26036
26037 With the latter choice the options -mstack-protector-guard-reg=reg
26038 and -mstack-protector-guard-offset=offset furthermore specify which
26039 register to use as base register for reading the canary, and from
26040 what offset from that base register. The default for those is as
26041 specified in the relevant ABI.
26042 -mstack-protector-guard-symbol=symbol overrides the offset with a
26043 symbol reference to a canary in the TLS block.
26044
26045 -mpcrel
26046 -mno-pcrel
26047 Generate (do not generate) pc-relative addressing. The -mpcrel
26048 option requires that the medium code model (-mcmodel=medium) and
26049 prefixed addressing (-mprefixed) options are enabled.
26050
26051 -mprefixed
26052 -mno-prefixed
26053 Generate (do not generate) addressing modes using prefixed load and
26054 store instructions. The -mprefixed option requires that the option
26055 -mcpu=power10 (or later) is enabled.
26056
26057 -mmma
26058 -mno-mma
26059 Generate (do not generate) the MMA instructions. The -mma option
26060 requires that the option -mcpu=power10 (or later) is enabled.
26061
26062 -mrop-protect
26063 -mno-rop-protect
26064 Generate (do not generate) ROP protection instructions when the
26065 target processor supports them. Currently this option disables the
26066 shrink-wrap optimization (-fshrink-wrap).
26067
26068 -mprivileged
26069 -mno-privileged
26070 Generate (do not generate) code that will run in privileged state.
26071
26072 -mblock-ops-unaligned-vsx
26073 -mno-block-ops-unaligned-vsx
26074 Generate (do not generate) unaligned vsx loads and stores for
26075 inline expansion of "memcpy" and "memmove".
26076
26077 --param rs6000-vect-unroll-limit=
26078 The vectorizer will check with target information to determine
26079 whether it would be beneficial to unroll the main vectorized loop
26080 and by how much. This parameter sets the upper bound of how much
26081 the vectorizer will unroll the main loop. The default value is
26082 four.
26083
26084 RX Options
26085 These command-line options are defined for RX targets:
26086
26087 -m64bit-doubles
26088 -m32bit-doubles
26089 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
26090 (-m32bit-doubles) in size. The default is -m32bit-doubles. Note
26091 RX floating-point hardware only works on 32-bit values, which is
26092 why the default is -m32bit-doubles.
26093
26094 -fpu
26095 -nofpu
26096 Enables (-fpu) or disables (-nofpu) the use of RX floating-point
26097 hardware. The default is enabled for the RX600 series and disabled
26098 for the RX200 series.
26099
26100 Floating-point instructions are only generated for 32-bit floating-
26101 point values, however, so the FPU hardware is not used for doubles
26102 if the -m64bit-doubles option is used.
26103
26104 Note If the -fpu option is enabled then -funsafe-math-optimizations
26105 is also enabled automatically. This is because the RX FPU
26106 instructions are themselves unsafe.
26107
26108 -mcpu=name
26109 Selects the type of RX CPU to be targeted. Currently three types
26110 are supported, the generic RX600 and RX200 series hardware and the
26111 specific RX610 CPU. The default is RX600.
26112
26113 The only difference between RX600 and RX610 is that the RX610 does
26114 not support the "MVTIPL" instruction.
26115
26116 The RX200 series does not have a hardware floating-point unit and
26117 so -nofpu is enabled by default when this type is selected.
26118
26119 -mbig-endian-data
26120 -mlittle-endian-data
26121 Store data (but not code) in the big-endian format. The default is
26122 -mlittle-endian-data, i.e. to store data in the little-endian
26123 format.
26124
26125 -msmall-data-limit=N
26126 Specifies the maximum size in bytes of global and static variables
26127 which can be placed into the small data area. Using the small data
26128 area can lead to smaller and faster code, but the size of area is
26129 limited and it is up to the programmer to ensure that the area does
26130 not overflow. Also when the small data area is used one of the
26131 RX's registers (usually "r13") is reserved for use pointing to this
26132 area, so it is no longer available for use by the compiler. This
26133 could result in slower and/or larger code if variables are pushed
26134 onto the stack instead of being held in this register.
26135
26136 Note, common variables (variables that have not been initialized)
26137 and constants are not placed into the small data area as they are
26138 assigned to other sections in the output executable.
26139
26140 The default value is zero, which disables this feature. Note, this
26141 feature is not enabled by default with higher optimization levels
26142 (-O2 etc) because of the potentially detrimental effects of
26143 reserving a register. It is up to the programmer to experiment and
26144 discover whether this feature is of benefit to their program. See
26145 the description of the -mpid option for a description of how the
26146 actual register to hold the small data area pointer is chosen.
26147
26148 -msim
26149 -mno-sim
26150 Use the simulator runtime. The default is to use the libgloss
26151 board-specific runtime.
26152
26153 -mas100-syntax
26154 -mno-as100-syntax
26155 When generating assembler output use a syntax that is compatible
26156 with Renesas's AS100 assembler. This syntax can also be handled by
26157 the GAS assembler, but it has some restrictions so it is not
26158 generated by default.
26159
26160 -mmax-constant-size=N
26161 Specifies the maximum size, in bytes, of a constant that can be
26162 used as an operand in a RX instruction. Although the RX
26163 instruction set does allow constants of up to 4 bytes in length to
26164 be used in instructions, a longer value equates to a longer
26165 instruction. Thus in some circumstances it can be beneficial to
26166 restrict the size of constants that are used in instructions.
26167 Constants that are too big are instead placed into a constant pool
26168 and referenced via register indirection.
26169
26170 The value N can be between 0 and 4. A value of 0 (the default) or
26171 4 means that constants of any size are allowed.
26172
26173 -mrelax
26174 Enable linker relaxation. Linker relaxation is a process whereby
26175 the linker attempts to reduce the size of a program by finding
26176 shorter versions of various instructions. Disabled by default.
26177
26178 -mint-register=N
26179 Specify the number of registers to reserve for fast interrupt
26180 handler functions. The value N can be between 0 and 4. A value of
26181 1 means that register "r13" is reserved for the exclusive use of
26182 fast interrupt handlers. A value of 2 reserves "r13" and "r12". A
26183 value of 3 reserves "r13", "r12" and "r11", and a value of 4
26184 reserves "r13" through "r10". A value of 0, the default, does not
26185 reserve any registers.
26186
26187 -msave-acc-in-interrupts
26188 Specifies that interrupt handler functions should preserve the
26189 accumulator register. This is only necessary if normal code might
26190 use the accumulator register, for example because it performs
26191 64-bit multiplications. The default is to ignore the accumulator
26192 as this makes the interrupt handlers faster.
26193
26194 -mpid
26195 -mno-pid
26196 Enables the generation of position independent data. When enabled
26197 any access to constant data is done via an offset from a base
26198 address held in a register. This allows the location of constant
26199 data to be determined at run time without requiring the executable
26200 to be relocated, which is a benefit to embedded applications with
26201 tight memory constraints. Data that can be modified is not
26202 affected by this option.
26203
26204 Note, using this feature reserves a register, usually "r13", for
26205 the constant data base address. This can result in slower and/or
26206 larger code, especially in complicated functions.
26207
26208 The actual register chosen to hold the constant data base address
26209 depends upon whether the -msmall-data-limit and/or the
26210 -mint-register command-line options are enabled. Starting with
26211 register "r13" and proceeding downwards, registers are allocated
26212 first to satisfy the requirements of -mint-register, then -mpid and
26213 finally -msmall-data-limit. Thus it is possible for the small data
26214 area register to be "r8" if both -mint-register=4 and -mpid are
26215 specified on the command line.
26216
26217 By default this feature is not enabled. The default can be
26218 restored via the -mno-pid command-line option.
26219
26220 -mno-warn-multiple-fast-interrupts
26221 -mwarn-multiple-fast-interrupts
26222 Prevents GCC from issuing a warning message if it finds more than
26223 one fast interrupt handler when it is compiling a file. The
26224 default is to issue a warning for each extra fast interrupt handler
26225 found, as the RX only supports one such interrupt.
26226
26227 -mallow-string-insns
26228 -mno-allow-string-insns
26229 Enables or disables the use of the string manipulation instructions
26230 "SMOVF", "SCMPU", "SMOVB", "SMOVU", "SUNTIL" "SWHILE" and also the
26231 "RMPA" instruction. These instructions may prefetch data, which is
26232 not safe to do if accessing an I/O register. (See section 12.2.7
26233 of the RX62N Group User's Manual for more information).
26234
26235 The default is to allow these instructions, but it is not possible
26236 for GCC to reliably detect all circumstances where a string
26237 instruction might be used to access an I/O register, so their use
26238 cannot be disabled automatically. Instead it is reliant upon the
26239 programmer to use the -mno-allow-string-insns option if their
26240 program accesses I/O space.
26241
26242 When the instructions are enabled GCC defines the C preprocessor
26243 symbol "__RX_ALLOW_STRING_INSNS__", otherwise it defines the symbol
26244 "__RX_DISALLOW_STRING_INSNS__".
26245
26246 -mjsr
26247 -mno-jsr
26248 Use only (or not only) "JSR" instructions to access functions.
26249 This option can be used when code size exceeds the range of "BSR"
26250 instructions. Note that -mno-jsr does not mean to not use "JSR"
26251 but instead means that any type of branch may be used.
26252
26253 Note: The generic GCC command-line option -ffixed-reg has special
26254 significance to the RX port when used with the "interrupt" function
26255 attribute. This attribute indicates a function intended to process
26256 fast interrupts. GCC ensures that it only uses the registers "r10",
26257 "r11", "r12" and/or "r13" and only provided that the normal use of the
26258 corresponding registers have been restricted via the -ffixed-reg or
26259 -mint-register command-line options.
26260
26261 S/390 and zSeries Options
26262 These are the -m options defined for the S/390 and zSeries
26263 architecture.
26264
26265 -mhard-float
26266 -msoft-float
26267 Use (do not use) the hardware floating-point instructions and
26268 registers for floating-point operations. When -msoft-float is
26269 specified, functions in libgcc.a are used to perform floating-point
26270 operations. When -mhard-float is specified, the compiler generates
26271 IEEE floating-point instructions. This is the default.
26272
26273 -mhard-dfp
26274 -mno-hard-dfp
26275 Use (do not use) the hardware decimal-floating-point instructions
26276 for decimal-floating-point operations. When -mno-hard-dfp is
26277 specified, functions in libgcc.a are used to perform decimal-
26278 floating-point operations. When -mhard-dfp is specified, the
26279 compiler generates decimal-floating-point hardware instructions.
26280 This is the default for -march=z9-ec or higher.
26281
26282 -mlong-double-64
26283 -mlong-double-128
26284 These switches control the size of "long double" type. A size of 64
26285 bits makes the "long double" type equivalent to the "double" type.
26286 This is the default.
26287
26288 -mbackchain
26289 -mno-backchain
26290 Store (do not store) the address of the caller's frame as backchain
26291 pointer into the callee's stack frame. A backchain may be needed
26292 to allow debugging using tools that do not understand DWARF call
26293 frame information. When -mno-packed-stack is in effect, the
26294 backchain pointer is stored at the bottom of the stack frame; when
26295 -mpacked-stack is in effect, the backchain is placed into the
26296 topmost word of the 96/160 byte register save area.
26297
26298 In general, code compiled with -mbackchain is call-compatible with
26299 code compiled with -mno-backchain; however, use of the backchain
26300 for debugging purposes usually requires that the whole binary is
26301 built with -mbackchain. Note that the combination of -mbackchain,
26302 -mpacked-stack and -mhard-float is not supported. In order to
26303 build a linux kernel use -msoft-float.
26304
26305 The default is to not maintain the backchain.
26306
26307 -mpacked-stack
26308 -mno-packed-stack
26309 Use (do not use) the packed stack layout. When -mno-packed-stack
26310 is specified, the compiler uses the all fields of the 96/160 byte
26311 register save area only for their default purpose; unused fields
26312 still take up stack space. When -mpacked-stack is specified,
26313 register save slots are densely packed at the top of the register
26314 save area; unused space is reused for other purposes, allowing for
26315 more efficient use of the available stack space. However, when
26316 -mbackchain is also in effect, the topmost word of the save area is
26317 always used to store the backchain, and the return address register
26318 is always saved two words below the backchain.
26319
26320 As long as the stack frame backchain is not used, code generated
26321 with -mpacked-stack is call-compatible with code generated with
26322 -mno-packed-stack. Note that some non-FSF releases of GCC 2.95 for
26323 S/390 or zSeries generated code that uses the stack frame backchain
26324 at run time, not just for debugging purposes. Such code is not
26325 call-compatible with code compiled with -mpacked-stack. Also, note
26326 that the combination of -mbackchain, -mpacked-stack and
26327 -mhard-float is not supported. In order to build a linux kernel
26328 use -msoft-float.
26329
26330 The default is to not use the packed stack layout.
26331
26332 -msmall-exec
26333 -mno-small-exec
26334 Generate (or do not generate) code using the "bras" instruction to
26335 do subroutine calls. This only works reliably if the total
26336 executable size does not exceed 64k. The default is to use the
26337 "basr" instruction instead, which does not have this limitation.
26338
26339 -m64
26340 -m31
26341 When -m31 is specified, generate code compliant to the GNU/Linux
26342 for S/390 ABI. When -m64 is specified, generate code compliant to
26343 the GNU/Linux for zSeries ABI. This allows GCC in particular to
26344 generate 64-bit instructions. For the s390 targets, the default is
26345 -m31, while the s390x targets default to -m64.
26346
26347 -mzarch
26348 -mesa
26349 When -mzarch is specified, generate code using the instructions
26350 available on z/Architecture. When -mesa is specified, generate
26351 code using the instructions available on ESA/390. Note that -mesa
26352 is not possible with -m64. When generating code compliant to the
26353 GNU/Linux for S/390 ABI, the default is -mesa. When generating
26354 code compliant to the GNU/Linux for zSeries ABI, the default is
26355 -mzarch.
26356
26357 -mhtm
26358 -mno-htm
26359 The -mhtm option enables a set of builtins making use of
26360 instructions available with the transactional execution facility
26361 introduced with the IBM zEnterprise EC12 machine generation S/390
26362 System z Built-in Functions. -mhtm is enabled by default when
26363 using -march=zEC12.
26364
26365 -mvx
26366 -mno-vx
26367 When -mvx is specified, generate code using the instructions
26368 available with the vector extension facility introduced with the
26369 IBM z13 machine generation. This option changes the ABI for some
26370 vector type values with regard to alignment and calling
26371 conventions. In case vector type values are being used in an ABI-
26372 relevant context a GAS .gnu_attribute command will be added to mark
26373 the resulting binary with the ABI used. -mvx is enabled by default
26374 when using -march=z13.
26375
26376 -mzvector
26377 -mno-zvector
26378 The -mzvector option enables vector language extensions and
26379 builtins using instructions available with the vector extension
26380 facility introduced with the IBM z13 machine generation. This
26381 option adds support for vector to be used as a keyword to define
26382 vector type variables and arguments. vector is only available when
26383 GNU extensions are enabled. It will not be expanded when
26384 requesting strict standard compliance e.g. with -std=c99. In
26385 addition to the GCC low-level builtins -mzvector enables a set of
26386 builtins added for compatibility with AltiVec-style implementations
26387 like Power and Cell. In order to make use of these builtins the
26388 header file vecintrin.h needs to be included. -mzvector is
26389 disabled by default.
26390
26391 -mmvcle
26392 -mno-mvcle
26393 Generate (or do not generate) code using the "mvcle" instruction to
26394 perform block moves. When -mno-mvcle is specified, use a "mvc"
26395 loop instead. This is the default unless optimizing for size.
26396
26397 -mdebug
26398 -mno-debug
26399 Print (or do not print) additional debug information when
26400 compiling. The default is to not print debug information.
26401
26402 -march=cpu-type
26403 Generate code that runs on cpu-type, which is the name of a system
26404 representing a certain processor type. Possible values for cpu-
26405 type are z900/arch5, z990/arch6, z9-109, z9-ec/arch7, z10/arch8,
26406 z196/arch9, zEC12, z13/arch11, z14/arch12, z15/arch13, z16/arch14,
26407 and native.
26408
26409 The default is -march=z900.
26410
26411 Specifying native as cpu type can be used to select the best
26412 architecture option for the host processor. -march=native has no
26413 effect if GCC does not recognize the processor.
26414
26415 -mtune=cpu-type
26416 Tune to cpu-type everything applicable about the generated code,
26417 except for the ABI and the set of available instructions. The list
26418 of cpu-type values is the same as for -march. The default is the
26419 value used for -march.
26420
26421 -mtpf-trace
26422 -mno-tpf-trace
26423 Generate code that adds (does not add) in TPF OS specific branches
26424 to trace routines in the operating system. This option is off by
26425 default, even when compiling for the TPF OS.
26426
26427 -mtpf-trace-skip
26428 -mno-tpf-trace-skip
26429 Generate code that changes (does not change) the default branch
26430 targets enabled by -mtpf-trace to point to specialized trace
26431 routines providing the ability of selectively skipping function
26432 trace entries for the TPF OS. This option is off by default, even
26433 when compiling for the TPF OS and specifying -mtpf-trace.
26434
26435 -mfused-madd
26436 -mno-fused-madd
26437 Generate code that uses (does not use) the floating-point multiply
26438 and accumulate instructions. These instructions are generated by
26439 default if hardware floating point is used.
26440
26441 -mwarn-framesize=framesize
26442 Emit a warning if the current function exceeds the given frame
26443 size. Because this is a compile-time check it doesn't need to be a
26444 real problem when the program runs. It is intended to identify
26445 functions that most probably cause a stack overflow. It is useful
26446 to be used in an environment with limited stack size e.g. the linux
26447 kernel.
26448
26449 -mwarn-dynamicstack
26450 Emit a warning if the function calls "alloca" or uses dynamically-
26451 sized arrays. This is generally a bad idea with a limited stack
26452 size.
26453
26454 -mstack-guard=stack-guard
26455 -mstack-size=stack-size
26456 If these options are provided the S/390 back end emits additional
26457 instructions in the function prologue that trigger a trap if the
26458 stack size is stack-guard bytes above the stack-size (remember that
26459 the stack on S/390 grows downward). If the stack-guard option is
26460 omitted the smallest power of 2 larger than the frame size of the
26461 compiled function is chosen. These options are intended to be used
26462 to help debugging stack overflow problems. The additionally
26463 emitted code causes only little overhead and hence can also be used
26464 in production-like systems without greater performance degradation.
26465 The given values have to be exact powers of 2 and stack-size has to
26466 be greater than stack-guard without exceeding 64k. In order to be
26467 efficient the extra code makes the assumption that the stack starts
26468 at an address aligned to the value given by stack-size. The stack-
26469 guard option can only be used in conjunction with stack-size.
26470
26471 -mhotpatch=pre-halfwords,post-halfwords
26472 If the hotpatch option is enabled, a "hot-patching" function
26473 prologue is generated for all functions in the compilation unit.
26474 The funtion label is prepended with the given number of two-byte
26475 NOP instructions (pre-halfwords, maximum 1000000). After the
26476 label, 2 * post-halfwords bytes are appended, using the largest NOP
26477 like instructions the architecture allows (maximum 1000000).
26478
26479 If both arguments are zero, hotpatching is disabled.
26480
26481 This option can be overridden for individual functions with the
26482 "hotpatch" attribute.
26483
26484 SH Options
26485 These -m options are defined for the SH implementations:
26486
26487 -m1 Generate code for the SH1.
26488
26489 -m2 Generate code for the SH2.
26490
26491 -m2e
26492 Generate code for the SH2e.
26493
26494 -m2a-nofpu
26495 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a
26496 way that the floating-point unit is not used.
26497
26498 -m2a-single-only
26499 Generate code for the SH2a-FPU, in such a way that no double-
26500 precision floating-point operations are used.
26501
26502 -m2a-single
26503 Generate code for the SH2a-FPU assuming the floating-point unit is
26504 in single-precision mode by default.
26505
26506 -m2a
26507 Generate code for the SH2a-FPU assuming the floating-point unit is
26508 in double-precision mode by default.
26509
26510 -m3 Generate code for the SH3.
26511
26512 -m3e
26513 Generate code for the SH3e.
26514
26515 -m4-nofpu
26516 Generate code for the SH4 without a floating-point unit.
26517
26518 -m4-single-only
26519 Generate code for the SH4 with a floating-point unit that only
26520 supports single-precision arithmetic.
26521
26522 -m4-single
26523 Generate code for the SH4 assuming the floating-point unit is in
26524 single-precision mode by default.
26525
26526 -m4 Generate code for the SH4.
26527
26528 -m4-100
26529 Generate code for SH4-100.
26530
26531 -m4-100-nofpu
26532 Generate code for SH4-100 in such a way that the floating-point
26533 unit is not used.
26534
26535 -m4-100-single
26536 Generate code for SH4-100 assuming the floating-point unit is in
26537 single-precision mode by default.
26538
26539 -m4-100-single-only
26540 Generate code for SH4-100 in such a way that no double-precision
26541 floating-point operations are used.
26542
26543 -m4-200
26544 Generate code for SH4-200.
26545
26546 -m4-200-nofpu
26547 Generate code for SH4-200 without in such a way that the floating-
26548 point unit is not used.
26549
26550 -m4-200-single
26551 Generate code for SH4-200 assuming the floating-point unit is in
26552 single-precision mode by default.
26553
26554 -m4-200-single-only
26555 Generate code for SH4-200 in such a way that no double-precision
26556 floating-point operations are used.
26557
26558 -m4-300
26559 Generate code for SH4-300.
26560
26561 -m4-300-nofpu
26562 Generate code for SH4-300 without in such a way that the floating-
26563 point unit is not used.
26564
26565 -m4-300-single
26566 Generate code for SH4-300 in such a way that no double-precision
26567 floating-point operations are used.
26568
26569 -m4-300-single-only
26570 Generate code for SH4-300 in such a way that no double-precision
26571 floating-point operations are used.
26572
26573 -m4-340
26574 Generate code for SH4-340 (no MMU, no FPU).
26575
26576 -m4-500
26577 Generate code for SH4-500 (no FPU). Passes -isa=sh4-nofpu to the
26578 assembler.
26579
26580 -m4a-nofpu
26581 Generate code for the SH4al-dsp, or for a SH4a in such a way that
26582 the floating-point unit is not used.
26583
26584 -m4a-single-only
26585 Generate code for the SH4a, in such a way that no double-precision
26586 floating-point operations are used.
26587
26588 -m4a-single
26589 Generate code for the SH4a assuming the floating-point unit is in
26590 single-precision mode by default.
26591
26592 -m4a
26593 Generate code for the SH4a.
26594
26595 -m4al
26596 Same as -m4a-nofpu, except that it implicitly passes -dsp to the
26597 assembler. GCC doesn't generate any DSP instructions at the
26598 moment.
26599
26600 -mb Compile code for the processor in big-endian mode.
26601
26602 -ml Compile code for the processor in little-endian mode.
26603
26604 -mdalign
26605 Align doubles at 64-bit boundaries. Note that this changes the
26606 calling conventions, and thus some functions from the standard C
26607 library do not work unless you recompile it first with -mdalign.
26608
26609 -mrelax
26610 Shorten some address references at link time, when possible; uses
26611 the linker option -relax.
26612
26613 -mbigtable
26614 Use 32-bit offsets in "switch" tables. The default is to use
26615 16-bit offsets.
26616
26617 -mbitops
26618 Enable the use of bit manipulation instructions on SH2A.
26619
26620 -mfmovd
26621 Enable the use of the instruction "fmovd". Check -mdalign for
26622 alignment constraints.
26623
26624 -mrenesas
26625 Comply with the calling conventions defined by Renesas.
26626
26627 -mno-renesas
26628 Comply with the calling conventions defined for GCC before the
26629 Renesas conventions were available. This option is the default for
26630 all targets of the SH toolchain.
26631
26632 -mnomacsave
26633 Mark the "MAC" register as call-clobbered, even if -mrenesas is
26634 given.
26635
26636 -mieee
26637 -mno-ieee
26638 Control the IEEE compliance of floating-point comparisons, which
26639 affects the handling of cases where the result of a comparison is
26640 unordered. By default -mieee is implicitly enabled. If
26641 -ffinite-math-only is enabled -mno-ieee is implicitly set, which
26642 results in faster floating-point greater-equal and less-equal
26643 comparisons. The implicit settings can be overridden by specifying
26644 either -mieee or -mno-ieee.
26645
26646 -minline-ic_invalidate
26647 Inline code to invalidate instruction cache entries after setting
26648 up nested function trampolines. This option has no effect if
26649 -musermode is in effect and the selected code generation option
26650 (e.g. -m4) does not allow the use of the "icbi" instruction. If
26651 the selected code generation option does not allow the use of the
26652 "icbi" instruction, and -musermode is not in effect, the inlined
26653 code manipulates the instruction cache address array directly with
26654 an associative write. This not only requires privileged mode at
26655 run time, but it also fails if the cache line had been mapped via
26656 the TLB and has become unmapped.
26657
26658 -misize
26659 Dump instruction size and location in the assembly code.
26660
26661 -mpadstruct
26662 This option is deprecated. It pads structures to multiple of 4
26663 bytes, which is incompatible with the SH ABI.
26664
26665 -matomic-model=model
26666 Sets the model of atomic operations and additional parameters as a
26667 comma separated list. For details on the atomic built-in functions
26668 see __atomic Builtins. The following models and parameters are
26669 supported:
26670
26671 none
26672 Disable compiler generated atomic sequences and emit library
26673 calls for atomic operations. This is the default if the target
26674 is not "sh*-*-linux*".
26675
26676 soft-gusa
26677 Generate GNU/Linux compatible gUSA software atomic sequences
26678 for the atomic built-in functions. The generated atomic
26679 sequences require additional support from the
26680 interrupt/exception handling code of the system and are only
26681 suitable for SH3* and SH4* single-core systems. This option is
26682 enabled by default when the target is "sh*-*-linux*" and SH3*
26683 or SH4*. When the target is SH4A, this option also partially
26684 utilizes the hardware atomic instructions "movli.l" and
26685 "movco.l" to create more efficient code, unless strict is
26686 specified.
26687
26688 soft-tcb
26689 Generate software atomic sequences that use a variable in the
26690 thread control block. This is a variation of the gUSA
26691 sequences which can also be used on SH1* and SH2* targets. The
26692 generated atomic sequences require additional support from the
26693 interrupt/exception handling code of the system and are only
26694 suitable for single-core systems. When using this model, the
26695 gbr-offset= parameter has to be specified as well.
26696
26697 soft-imask
26698 Generate software atomic sequences that temporarily disable
26699 interrupts by setting "SR.IMASK = 1111". This model works only
26700 when the program runs in privileged mode and is only suitable
26701 for single-core systems. Additional support from the
26702 interrupt/exception handling code of the system is not
26703 required. This model is enabled by default when the target is
26704 "sh*-*-linux*" and SH1* or SH2*.
26705
26706 hard-llcs
26707 Generate hardware atomic sequences using the "movli.l" and
26708 "movco.l" instructions only. This is only available on SH4A
26709 and is suitable for multi-core systems. Since the hardware
26710 instructions support only 32 bit atomic variables access to 8
26711 or 16 bit variables is emulated with 32 bit accesses. Code
26712 compiled with this option is also compatible with other
26713 software atomic model interrupt/exception handling systems if
26714 executed on an SH4A system. Additional support from the
26715 interrupt/exception handling code of the system is not required
26716 for this model.
26717
26718 gbr-offset=
26719 This parameter specifies the offset in bytes of the variable in
26720 the thread control block structure that should be used by the
26721 generated atomic sequences when the soft-tcb model has been
26722 selected. For other models this parameter is ignored. The
26723 specified value must be an integer multiple of four and in the
26724 range 0-1020.
26725
26726 strict
26727 This parameter prevents mixed usage of multiple atomic models,
26728 even if they are compatible, and makes the compiler generate
26729 atomic sequences of the specified model only.
26730
26731 -mtas
26732 Generate the "tas.b" opcode for "__atomic_test_and_set". Notice
26733 that depending on the particular hardware and software
26734 configuration this can degrade overall performance due to the
26735 operand cache line flushes that are implied by the "tas.b"
26736 instruction. On multi-core SH4A processors the "tas.b" instruction
26737 must be used with caution since it can result in data corruption
26738 for certain cache configurations.
26739
26740 -mprefergot
26741 When generating position-independent code, emit function calls
26742 using the Global Offset Table instead of the Procedure Linkage
26743 Table.
26744
26745 -musermode
26746 -mno-usermode
26747 Don't allow (allow) the compiler generating privileged mode code.
26748 Specifying -musermode also implies -mno-inline-ic_invalidate if the
26749 inlined code would not work in user mode. -musermode is the
26750 default when the target is "sh*-*-linux*". If the target is SH1*
26751 or SH2* -musermode has no effect, since there is no user mode.
26752
26753 -multcost=number
26754 Set the cost to assume for a multiply insn.
26755
26756 -mdiv=strategy
26757 Set the division strategy to be used for integer division
26758 operations. strategy can be one of:
26759
26760 call-div1
26761 Calls a library function that uses the single-step division
26762 instruction "div1" to perform the operation. Division by zero
26763 calculates an unspecified result and does not trap. This is
26764 the default except for SH4, SH2A and SHcompact.
26765
26766 call-fp
26767 Calls a library function that performs the operation in double
26768 precision floating point. Division by zero causes a floating-
26769 point exception. This is the default for SHcompact with FPU.
26770 Specifying this for targets that do not have a double precision
26771 FPU defaults to "call-div1".
26772
26773 call-table
26774 Calls a library function that uses a lookup table for small
26775 divisors and the "div1" instruction with case distinction for
26776 larger divisors. Division by zero calculates an unspecified
26777 result and does not trap. This is the default for SH4.
26778 Specifying this for targets that do not have dynamic shift
26779 instructions defaults to "call-div1".
26780
26781 When a division strategy has not been specified the default
26782 strategy is selected based on the current target. For SH2A the
26783 default strategy is to use the "divs" and "divu" instructions
26784 instead of library function calls.
26785
26786 -maccumulate-outgoing-args
26787 Reserve space once for outgoing arguments in the function prologue
26788 rather than around each call. Generally beneficial for performance
26789 and size. Also needed for unwinding to avoid changing the stack
26790 frame around conditional code.
26791
26792 -mdivsi3_libfunc=name
26793 Set the name of the library function used for 32-bit signed
26794 division to name. This only affects the name used in the call
26795 division strategies, and the compiler still expects the same sets
26796 of input/output/clobbered registers as if this option were not
26797 present.
26798
26799 -mfixed-range=register-range
26800 Generate code treating the given register range as fixed registers.
26801 A fixed register is one that the register allocator cannot use.
26802 This is useful when compiling kernel code. A register range is
26803 specified as two registers separated by a dash. Multiple register
26804 ranges can be specified separated by a comma.
26805
26806 -mbranch-cost=num
26807 Assume num to be the cost for a branch instruction. Higher numbers
26808 make the compiler try to generate more branch-free code if
26809 possible. If not specified the value is selected depending on the
26810 processor type that is being compiled for.
26811
26812 -mzdcbranch
26813 -mno-zdcbranch
26814 Assume (do not assume) that zero displacement conditional branch
26815 instructions "bt" and "bf" are fast. If -mzdcbranch is specified,
26816 the compiler prefers zero displacement branch code sequences. This
26817 is enabled by default when generating code for SH4 and SH4A. It
26818 can be explicitly disabled by specifying -mno-zdcbranch.
26819
26820 -mcbranch-force-delay-slot
26821 Force the usage of delay slots for conditional branches, which
26822 stuffs the delay slot with a "nop" if a suitable instruction cannot
26823 be found. By default this option is disabled. It can be enabled
26824 to work around hardware bugs as found in the original SH7055.
26825
26826 -mfused-madd
26827 -mno-fused-madd
26828 Generate code that uses (does not use) the floating-point multiply
26829 and accumulate instructions. These instructions are generated by
26830 default if hardware floating point is used. The machine-dependent
26831 -mfused-madd option is now mapped to the machine-independent
26832 -ffp-contract=fast option, and -mno-fused-madd is mapped to
26833 -ffp-contract=off.
26834
26835 -mfsca
26836 -mno-fsca
26837 Allow or disallow the compiler to emit the "fsca" instruction for
26838 sine and cosine approximations. The option -mfsca must be used in
26839 combination with -funsafe-math-optimizations. It is enabled by
26840 default when generating code for SH4A. Using -mno-fsca disables
26841 sine and cosine approximations even if -funsafe-math-optimizations
26842 is in effect.
26843
26844 -mfsrra
26845 -mno-fsrra
26846 Allow or disallow the compiler to emit the "fsrra" instruction for
26847 reciprocal square root approximations. The option -mfsrra must be
26848 used in combination with -funsafe-math-optimizations and
26849 -ffinite-math-only. It is enabled by default when generating code
26850 for SH4A. Using -mno-fsrra disables reciprocal square root
26851 approximations even if -funsafe-math-optimizations and
26852 -ffinite-math-only are in effect.
26853
26854 -mpretend-cmove
26855 Prefer zero-displacement conditional branches for conditional move
26856 instruction patterns. This can result in faster code on the SH4
26857 processor.
26858
26859 -mfdpic
26860 Generate code using the FDPIC ABI.
26861
26862 Solaris 2 Options
26863 These -m options are supported on Solaris 2:
26864
26865 -mclear-hwcap
26866 -mclear-hwcap tells the compiler to remove the hardware
26867 capabilities generated by the Solaris assembler. This is only
26868 necessary when object files use ISA extensions not supported by the
26869 current machine, but check at runtime whether or not to use them.
26870
26871 -mimpure-text
26872 -mimpure-text, used in addition to -shared, tells the compiler to
26873 not pass -z text to the linker when linking a shared object. Using
26874 this option, you can link position-dependent code into a shared
26875 object.
26876
26877 -mimpure-text suppresses the "relocations remain against
26878 allocatable but non-writable sections" linker error message.
26879 However, the necessary relocations trigger copy-on-write, and the
26880 shared object is not actually shared across processes. Instead of
26881 using -mimpure-text, you should compile all source code with -fpic
26882 or -fPIC.
26883
26884 These switches are supported in addition to the above on Solaris 2:
26885
26886 -pthreads
26887 This is a synonym for -pthread.
26888
26889 SPARC Options
26890 These -m options are supported on the SPARC:
26891
26892 -mno-app-regs
26893 -mapp-regs
26894 Specify -mapp-regs to generate output using the global registers 2
26895 through 4, which the SPARC SVR4 ABI reserves for applications.
26896 Like the global register 1, each global register 2 through 4 is
26897 then treated as an allocable register that is clobbered by function
26898 calls. This is the default.
26899
26900 To be fully SVR4 ABI-compliant at the cost of some performance
26901 loss, specify -mno-app-regs. You should compile libraries and
26902 system software with this option.
26903
26904 -mflat
26905 -mno-flat
26906 With -mflat, the compiler does not generate save/restore
26907 instructions and uses a "flat" or single register window model.
26908 This model is compatible with the regular register window model.
26909 The local registers and the input registers (0--5) are still
26910 treated as "call-saved" registers and are saved on the stack as
26911 needed.
26912
26913 With -mno-flat (the default), the compiler generates save/restore
26914 instructions (except for leaf functions). This is the normal
26915 operating mode.
26916
26917 -mfpu
26918 -mhard-float
26919 Generate output containing floating-point instructions. This is
26920 the default.
26921
26922 -mno-fpu
26923 -msoft-float
26924 Generate output containing library calls for floating point.
26925 Warning: the requisite libraries are not available for all SPARC
26926 targets. Normally the facilities of the machine's usual C compiler
26927 are used, but this cannot be done directly in cross-compilation.
26928 You must make your own arrangements to provide suitable library
26929 functions for cross-compilation. The embedded targets sparc-*-aout
26930 and sparclite-*-* do provide software floating-point support.
26931
26932 -msoft-float changes the calling convention in the output file;
26933 therefore, it is only useful if you compile all of a program with
26934 this option. In particular, you need to compile libgcc.a, the
26935 library that comes with GCC, with -msoft-float in order for this to
26936 work.
26937
26938 -mhard-quad-float
26939 Generate output containing quad-word (long double) floating-point
26940 instructions.
26941
26942 -msoft-quad-float
26943 Generate output containing library calls for quad-word (long
26944 double) floating-point instructions. The functions called are
26945 those specified in the SPARC ABI. This is the default.
26946
26947 As of this writing, there are no SPARC implementations that have
26948 hardware support for the quad-word floating-point instructions.
26949 They all invoke a trap handler for one of these instructions, and
26950 then the trap handler emulates the effect of the instruction.
26951 Because of the trap handler overhead, this is much slower than
26952 calling the ABI library routines. Thus the -msoft-quad-float
26953 option is the default.
26954
26955 -mno-unaligned-doubles
26956 -munaligned-doubles
26957 Assume that doubles have 8-byte alignment. This is the default.
26958
26959 With -munaligned-doubles, GCC assumes that doubles have 8-byte
26960 alignment only if they are contained in another type, or if they
26961 have an absolute address. Otherwise, it assumes they have 4-byte
26962 alignment. Specifying this option avoids some rare compatibility
26963 problems with code generated by other compilers. It is not the
26964 default because it results in a performance loss, especially for
26965 floating-point code.
26966
26967 -muser-mode
26968 -mno-user-mode
26969 Do not generate code that can only run in supervisor mode. This is
26970 relevant only for the "casa" instruction emitted for the LEON3
26971 processor. This is the default.
26972
26973 -mfaster-structs
26974 -mno-faster-structs
26975 With -mfaster-structs, the compiler assumes that structures should
26976 have 8-byte alignment. This enables the use of pairs of "ldd" and
26977 "std" instructions for copies in structure assignment, in place of
26978 twice as many "ld" and "st" pairs. However, the use of this
26979 changed alignment directly violates the SPARC ABI. Thus, it's
26980 intended only for use on targets where the developer acknowledges
26981 that their resulting code is not directly in line with the rules of
26982 the ABI.
26983
26984 -mstd-struct-return
26985 -mno-std-struct-return
26986 With -mstd-struct-return, the compiler generates checking code in
26987 functions returning structures or unions to detect size mismatches
26988 between the two sides of function calls, as per the 32-bit ABI.
26989
26990 The default is -mno-std-struct-return. This option has no effect
26991 in 64-bit mode.
26992
26993 -mlra
26994 -mno-lra
26995 Enable Local Register Allocation. This is the default for SPARC
26996 since GCC 7 so -mno-lra needs to be passed to get old Reload.
26997
26998 -mcpu=cpu_type
26999 Set the instruction set, register set, and instruction scheduling
27000 parameters for machine type cpu_type. Supported values for
27001 cpu_type are v7, cypress, v8, supersparc, hypersparc, leon, leon3,
27002 leon3v7, leon5, sparclite, f930, f934, sparclite86x, sparclet,
27003 tsc701, v9, ultrasparc, ultrasparc3, niagara, niagara2, niagara3,
27004 niagara4, niagara7 and m8.
27005
27006 Native Solaris and GNU/Linux toolchains also support the value
27007 native, which selects the best architecture option for the host
27008 processor. -mcpu=native has no effect if GCC does not recognize
27009 the processor.
27010
27011 Default instruction scheduling parameters are used for values that
27012 select an architecture and not an implementation. These are v7,
27013 v8, sparclite, sparclet, v9.
27014
27015 Here is a list of each supported architecture and their supported
27016 implementations.
27017
27018 v7 cypress, leon3v7
27019
27020 v8 supersparc, hypersparc, leon, leon3, leon5
27021
27022 sparclite
27023 f930, f934, sparclite86x
27024
27025 sparclet
27026 tsc701
27027
27028 v9 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
27029 niagara7, m8
27030
27031 By default (unless configured otherwise), GCC generates code for
27032 the V7 variant of the SPARC architecture. With -mcpu=cypress, the
27033 compiler additionally optimizes it for the Cypress CY7C602 chip, as
27034 used in the SPARCStation/SPARCServer 3xx series. This is also
27035 appropriate for the older SPARCStation 1, 2, IPX etc.
27036
27037 With -mcpu=v8, GCC generates code for the V8 variant of the SPARC
27038 architecture. The only difference from V7 code is that the
27039 compiler emits the integer multiply and integer divide instructions
27040 which exist in SPARC-V8 but not in SPARC-V7. With
27041 -mcpu=supersparc, the compiler additionally optimizes it for the
27042 SuperSPARC chip, as used in the SPARCStation 10, 1000 and 2000
27043 series.
27044
27045 With -mcpu=sparclite, GCC generates code for the SPARClite variant
27046 of the SPARC architecture. This adds the integer multiply, integer
27047 divide step and scan ("ffs") instructions which exist in SPARClite
27048 but not in SPARC-V7. With -mcpu=f930, the compiler additionally
27049 optimizes it for the Fujitsu MB86930 chip, which is the original
27050 SPARClite, with no FPU. With -mcpu=f934, the compiler additionally
27051 optimizes it for the Fujitsu MB86934 chip, which is the more recent
27052 SPARClite with FPU.
27053
27054 With -mcpu=sparclet, GCC generates code for the SPARClet variant of
27055 the SPARC architecture. This adds the integer multiply,
27056 multiply/accumulate, integer divide step and scan ("ffs")
27057 instructions which exist in SPARClet but not in SPARC-V7. With
27058 -mcpu=tsc701, the compiler additionally optimizes it for the TEMIC
27059 SPARClet chip.
27060
27061 With -mcpu=v9, GCC generates code for the V9 variant of the SPARC
27062 architecture. This adds 64-bit integer and floating-point move
27063 instructions, 3 additional floating-point condition code registers
27064 and conditional move instructions. With -mcpu=ultrasparc, the
27065 compiler additionally optimizes it for the Sun UltraSPARC I/II/IIi
27066 chips. With -mcpu=ultrasparc3, the compiler additionally optimizes
27067 it for the Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
27068 -mcpu=niagara, the compiler additionally optimizes it for Sun
27069 UltraSPARC T1 chips. With -mcpu=niagara2, the compiler
27070 additionally optimizes it for Sun UltraSPARC T2 chips. With
27071 -mcpu=niagara3, the compiler additionally optimizes it for Sun
27072 UltraSPARC T3 chips. With -mcpu=niagara4, the compiler
27073 additionally optimizes it for Sun UltraSPARC T4 chips. With
27074 -mcpu=niagara7, the compiler additionally optimizes it for Oracle
27075 SPARC M7 chips. With -mcpu=m8, the compiler additionally optimizes
27076 it for Oracle M8 chips.
27077
27078 -mtune=cpu_type
27079 Set the instruction scheduling parameters for machine type
27080 cpu_type, but do not set the instruction set or register set that
27081 the option -mcpu=cpu_type does.
27082
27083 The same values for -mcpu=cpu_type can be used for -mtune=cpu_type,
27084 but the only useful values are those that select a particular CPU
27085 implementation. Those are cypress, supersparc, hypersparc, leon,
27086 leon3, leon3v7, leon5, f930, f934, sparclite86x, tsc701,
27087 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
27088 niagara7 and m8. With native Solaris and GNU/Linux toolchains,
27089 native can also be used.
27090
27091 -mv8plus
27092 -mno-v8plus
27093 With -mv8plus, GCC generates code for the SPARC-V8+ ABI. The
27094 difference from the V8 ABI is that the global and out registers are
27095 considered 64 bits wide. This is enabled by default on Solaris in
27096 32-bit mode for all SPARC-V9 processors.
27097
27098 -mvis
27099 -mno-vis
27100 With -mvis, GCC generates code that takes advantage of the
27101 UltraSPARC Visual Instruction Set extensions. The default is
27102 -mno-vis.
27103
27104 -mvis2
27105 -mno-vis2
27106 With -mvis2, GCC generates code that takes advantage of version 2.0
27107 of the UltraSPARC Visual Instruction Set extensions. The default
27108 is -mvis2 when targeting a cpu that supports such instructions,
27109 such as UltraSPARC-III and later. Setting -mvis2 also sets -mvis.
27110
27111 -mvis3
27112 -mno-vis3
27113 With -mvis3, GCC generates code that takes advantage of version 3.0
27114 of the UltraSPARC Visual Instruction Set extensions. The default
27115 is -mvis3 when targeting a cpu that supports such instructions,
27116 such as niagara-3 and later. Setting -mvis3 also sets -mvis2 and
27117 -mvis.
27118
27119 -mvis4
27120 -mno-vis4
27121 With -mvis4, GCC generates code that takes advantage of version 4.0
27122 of the UltraSPARC Visual Instruction Set extensions. The default
27123 is -mvis4 when targeting a cpu that supports such instructions,
27124 such as niagara-7 and later. Setting -mvis4 also sets -mvis3,
27125 -mvis2 and -mvis.
27126
27127 -mvis4b
27128 -mno-vis4b
27129 With -mvis4b, GCC generates code that takes advantage of version
27130 4.0 of the UltraSPARC Visual Instruction Set extensions, plus the
27131 additional VIS instructions introduced in the Oracle SPARC
27132 Architecture 2017. The default is -mvis4b when targeting a cpu
27133 that supports such instructions, such as m8 and later. Setting
27134 -mvis4b also sets -mvis4, -mvis3, -mvis2 and -mvis.
27135
27136 -mcbcond
27137 -mno-cbcond
27138 With -mcbcond, GCC generates code that takes advantage of the
27139 UltraSPARC Compare-and-Branch-on-Condition instructions. The
27140 default is -mcbcond when targeting a CPU that supports such
27141 instructions, such as Niagara-4 and later.
27142
27143 -mfmaf
27144 -mno-fmaf
27145 With -mfmaf, GCC generates code that takes advantage of the
27146 UltraSPARC Fused Multiply-Add Floating-point instructions. The
27147 default is -mfmaf when targeting a CPU that supports such
27148 instructions, such as Niagara-3 and later.
27149
27150 -mfsmuld
27151 -mno-fsmuld
27152 With -mfsmuld, GCC generates code that takes advantage of the
27153 Floating-point Multiply Single to Double (FsMULd) instruction. The
27154 default is -mfsmuld when targeting a CPU supporting the
27155 architecture versions V8 or V9 with FPU except -mcpu=leon.
27156
27157 -mpopc
27158 -mno-popc
27159 With -mpopc, GCC generates code that takes advantage of the
27160 UltraSPARC Population Count instruction. The default is -mpopc
27161 when targeting a CPU that supports such an instruction, such as
27162 Niagara-2 and later.
27163
27164 -msubxc
27165 -mno-subxc
27166 With -msubxc, GCC generates code that takes advantage of the
27167 UltraSPARC Subtract-Extended-with-Carry instruction. The default
27168 is -msubxc when targeting a CPU that supports such an instruction,
27169 such as Niagara-7 and later.
27170
27171 -mfix-at697f
27172 Enable the documented workaround for the single erratum of the
27173 Atmel AT697F processor (which corresponds to erratum #13 of the
27174 AT697E processor).
27175
27176 -mfix-ut699
27177 Enable the documented workarounds for the floating-point errata and
27178 the data cache nullify errata of the UT699 processor.
27179
27180 -mfix-ut700
27181 Enable the documented workaround for the back-to-back store errata
27182 of the UT699E/UT700 processor.
27183
27184 -mfix-gr712rc
27185 Enable the documented workaround for the back-to-back store errata
27186 of the GR712RC processor.
27187
27188 These -m options are supported in addition to the above on SPARC-V9
27189 processors in 64-bit environments:
27190
27191 -m32
27192 -m64
27193 Generate code for a 32-bit or 64-bit environment. The 32-bit
27194 environment sets int, long and pointer to 32 bits. The 64-bit
27195 environment sets int to 32 bits and long and pointer to 64 bits.
27196
27197 -mcmodel=which
27198 Set the code model to one of
27199
27200 medlow
27201 The Medium/Low code model: 64-bit addresses, programs must be
27202 linked in the low 32 bits of memory. Programs can be
27203 statically or dynamically linked.
27204
27205 medmid
27206 The Medium/Middle code model: 64-bit addresses, programs must
27207 be linked in the low 44 bits of memory, the text and data
27208 segments must be less than 2GB in size and the data segment
27209 must be located within 2GB of the text segment.
27210
27211 medany
27212 The Medium/Anywhere code model: 64-bit addresses, programs may
27213 be linked anywhere in memory, the text and data segments must
27214 be less than 2GB in size and the data segment must be located
27215 within 2GB of the text segment.
27216
27217 embmedany
27218 The Medium/Anywhere code model for embedded systems: 64-bit
27219 addresses, the text and data segments must be less than 2GB in
27220 size, both starting anywhere in memory (determined at link
27221 time). The global register %g4 points to the base of the data
27222 segment. Programs are statically linked and PIC is not
27223 supported.
27224
27225 -mmemory-model=mem-model
27226 Set the memory model in force on the processor to one of
27227
27228 default
27229 The default memory model for the processor and operating
27230 system.
27231
27232 rmo Relaxed Memory Order
27233
27234 pso Partial Store Order
27235
27236 tso Total Store Order
27237
27238 sc Sequential Consistency
27239
27240 These memory models are formally defined in Appendix D of the
27241 SPARC-V9 architecture manual, as set in the processor's "PSTATE.MM"
27242 field.
27243
27244 -mstack-bias
27245 -mno-stack-bias
27246 With -mstack-bias, GCC assumes that the stack pointer, and frame
27247 pointer if present, are offset by -2047 which must be added back
27248 when making stack frame references. This is the default in 64-bit
27249 mode. Otherwise, assume no such offset is present.
27250
27251 Options for System V
27252 These additional options are available on System V Release 4 for
27253 compatibility with other compilers on those systems:
27254
27255 -G Create a shared object. It is recommended that -symbolic or
27256 -shared be used instead.
27257
27258 -Qy Identify the versions of each tool used by the compiler, in a
27259 ".ident" assembler directive in the output.
27260
27261 -Qn Refrain from adding ".ident" directives to the output file (this is
27262 the default).
27263
27264 -YP,dirs
27265 Search the directories dirs, and no others, for libraries specified
27266 with -l.
27267
27268 -Ym,dir
27269 Look in the directory dir to find the M4 preprocessor. The
27270 assembler uses this option.
27271
27272 V850 Options
27273 These -m options are defined for V850 implementations:
27274
27275 -mlong-calls
27276 -mno-long-calls
27277 Treat all calls as being far away (near). If calls are assumed to
27278 be far away, the compiler always loads the function's address into
27279 a register, and calls indirect through the pointer.
27280
27281 -mno-ep
27282 -mep
27283 Do not optimize (do optimize) basic blocks that use the same index
27284 pointer 4 or more times to copy pointer into the "ep" register, and
27285 use the shorter "sld" and "sst" instructions. The -mep option is
27286 on by default if you optimize.
27287
27288 -mno-prolog-function
27289 -mprolog-function
27290 Do not use (do use) external functions to save and restore
27291 registers at the prologue and epilogue of a function. The external
27292 functions are slower, but use less code space if more than one
27293 function saves the same number of registers. The -mprolog-function
27294 option is on by default if you optimize.
27295
27296 -mspace
27297 Try to make the code as small as possible. At present, this just
27298 turns on the -mep and -mprolog-function options.
27299
27300 -mtda=n
27301 Put static or global variables whose size is n bytes or less into
27302 the tiny data area that register "ep" points to. The tiny data
27303 area can hold up to 256 bytes in total (128 bytes for byte
27304 references).
27305
27306 -msda=n
27307 Put static or global variables whose size is n bytes or less into
27308 the small data area that register "gp" points to. The small data
27309 area can hold up to 64 kilobytes.
27310
27311 -mzda=n
27312 Put static or global variables whose size is n bytes or less into
27313 the first 32 kilobytes of memory.
27314
27315 -mv850
27316 Specify that the target processor is the V850.
27317
27318 -mv850e3v5
27319 Specify that the target processor is the V850E3V5. The
27320 preprocessor constant "__v850e3v5__" is defined if this option is
27321 used.
27322
27323 -mv850e2v4
27324 Specify that the target processor is the V850E3V5. This is an
27325 alias for the -mv850e3v5 option.
27326
27327 -mv850e2v3
27328 Specify that the target processor is the V850E2V3. The
27329 preprocessor constant "__v850e2v3__" is defined if this option is
27330 used.
27331
27332 -mv850e2
27333 Specify that the target processor is the V850E2. The preprocessor
27334 constant "__v850e2__" is defined if this option is used.
27335
27336 -mv850e1
27337 Specify that the target processor is the V850E1. The preprocessor
27338 constants "__v850e1__" and "__v850e__" are defined if this option
27339 is used.
27340
27341 -mv850es
27342 Specify that the target processor is the V850ES. This is an alias
27343 for the -mv850e1 option.
27344
27345 -mv850e
27346 Specify that the target processor is the V850E. The preprocessor
27347 constant "__v850e__" is defined if this option is used.
27348
27349 If neither -mv850 nor -mv850e nor -mv850e1 nor -mv850e2 nor
27350 -mv850e2v3 nor -mv850e3v5 are defined then a default target
27351 processor is chosen and the relevant __v850*__ preprocessor
27352 constant is defined.
27353
27354 The preprocessor constants "__v850" and "__v851__" are always
27355 defined, regardless of which processor variant is the target.
27356
27357 -mdisable-callt
27358 -mno-disable-callt
27359 This option suppresses generation of the "CALLT" instruction for
27360 the v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the
27361 v850 architecture.
27362
27363 This option is enabled by default when the RH850 ABI is in use (see
27364 -mrh850-abi), and disabled by default when the GCC ABI is in use.
27365 If "CALLT" instructions are being generated then the C preprocessor
27366 symbol "__V850_CALLT__" is defined.
27367
27368 -mrelax
27369 -mno-relax
27370 Pass on (or do not pass on) the -mrelax command-line option to the
27371 assembler.
27372
27373 -mlong-jumps
27374 -mno-long-jumps
27375 Disable (or re-enable) the generation of PC-relative jump
27376 instructions.
27377
27378 -msoft-float
27379 -mhard-float
27380 Disable (or re-enable) the generation of hardware floating point
27381 instructions. This option is only significant when the target
27382 architecture is V850E2V3 or higher. If hardware floating point
27383 instructions are being generated then the C preprocessor symbol
27384 "__FPU_OK__" is defined, otherwise the symbol "__NO_FPU__" is
27385 defined.
27386
27387 -mloop
27388 Enables the use of the e3v5 LOOP instruction. The use of this
27389 instruction is not enabled by default when the e3v5 architecture is
27390 selected because its use is still experimental.
27391
27392 -mrh850-abi
27393 -mghs
27394 Enables support for the RH850 version of the V850 ABI. This is the
27395 default. With this version of the ABI the following rules apply:
27396
27397 * Integer sized structures and unions are returned via a memory
27398 pointer rather than a register.
27399
27400 * Large structures and unions (more than 8 bytes in size) are
27401 passed by value.
27402
27403 * Functions are aligned to 16-bit boundaries.
27404
27405 * The -m8byte-align command-line option is supported.
27406
27407 * The -mdisable-callt command-line option is enabled by default.
27408 The -mno-disable-callt command-line option is not supported.
27409
27410 When this version of the ABI is enabled the C preprocessor symbol
27411 "__V850_RH850_ABI__" is defined.
27412
27413 -mgcc-abi
27414 Enables support for the old GCC version of the V850 ABI. With this
27415 version of the ABI the following rules apply:
27416
27417 * Integer sized structures and unions are returned in register
27418 "r10".
27419
27420 * Large structures and unions (more than 8 bytes in size) are
27421 passed by reference.
27422
27423 * Functions are aligned to 32-bit boundaries, unless optimizing
27424 for size.
27425
27426 * The -m8byte-align command-line option is not supported.
27427
27428 * The -mdisable-callt command-line option is supported but not
27429 enabled by default.
27430
27431 When this version of the ABI is enabled the C preprocessor symbol
27432 "__V850_GCC_ABI__" is defined.
27433
27434 -m8byte-align
27435 -mno-8byte-align
27436 Enables support for "double" and "long long" types to be aligned on
27437 8-byte boundaries. The default is to restrict the alignment of all
27438 objects to at most 4-bytes. When -m8byte-align is in effect the C
27439 preprocessor symbol "__V850_8BYTE_ALIGN__" is defined.
27440
27441 -mbig-switch
27442 Generate code suitable for big switch tables. Use this option only
27443 if the assembler/linker complain about out of range branches within
27444 a switch table.
27445
27446 -mapp-regs
27447 This option causes r2 and r5 to be used in the code generated by
27448 the compiler. This setting is the default.
27449
27450 -mno-app-regs
27451 This option causes r2 and r5 to be treated as fixed registers.
27452
27453 VAX Options
27454 These -m options are defined for the VAX:
27455
27456 -munix
27457 Do not output certain jump instructions ("aobleq" and so on) that
27458 the Unix assembler for the VAX cannot handle across long ranges.
27459
27460 -mgnu
27461 Do output those jump instructions, on the assumption that the GNU
27462 assembler is being used.
27463
27464 -mg Output code for G-format floating-point numbers instead of
27465 D-format.
27466
27467 -mlra
27468 -mno-lra
27469 Enable Local Register Allocation. This is still experimental for
27470 the VAX, so by default the compiler uses standard reload.
27471
27472 Visium Options
27473 -mdebug
27474 A program which performs file I/O and is destined to run on an MCM
27475 target should be linked with this option. It causes the libraries
27476 libc.a and libdebug.a to be linked. The program should be run on
27477 the target under the control of the GDB remote debugging stub.
27478
27479 -msim
27480 A program which performs file I/O and is destined to run on the
27481 simulator should be linked with option. This causes libraries
27482 libc.a and libsim.a to be linked.
27483
27484 -mfpu
27485 -mhard-float
27486 Generate code containing floating-point instructions. This is the
27487 default.
27488
27489 -mno-fpu
27490 -msoft-float
27491 Generate code containing library calls for floating-point.
27492
27493 -msoft-float changes the calling convention in the output file;
27494 therefore, it is only useful if you compile all of a program with
27495 this option. In particular, you need to compile libgcc.a, the
27496 library that comes with GCC, with -msoft-float in order for this to
27497 work.
27498
27499 -mcpu=cpu_type
27500 Set the instruction set, register set, and instruction scheduling
27501 parameters for machine type cpu_type. Supported values for
27502 cpu_type are mcm, gr5 and gr6.
27503
27504 mcm is a synonym of gr5 present for backward compatibility.
27505
27506 By default (unless configured otherwise), GCC generates code for
27507 the GR5 variant of the Visium architecture.
27508
27509 With -mcpu=gr6, GCC generates code for the GR6 variant of the
27510 Visium architecture. The only difference from GR5 code is that the
27511 compiler will generate block move instructions.
27512
27513 -mtune=cpu_type
27514 Set the instruction scheduling parameters for machine type
27515 cpu_type, but do not set the instruction set or register set that
27516 the option -mcpu=cpu_type would.
27517
27518 -msv-mode
27519 Generate code for the supervisor mode, where there are no
27520 restrictions on the access to general registers. This is the
27521 default.
27522
27523 -muser-mode
27524 Generate code for the user mode, where the access to some general
27525 registers is forbidden: on the GR5, registers r24 to r31 cannot be
27526 accessed in this mode; on the GR6, only registers r29 to r31 are
27527 affected.
27528
27529 VMS Options
27530 These -m options are defined for the VMS implementations:
27531
27532 -mvms-return-codes
27533 Return VMS condition codes from "main". The default is to return
27534 POSIX-style condition (e.g. error) codes.
27535
27536 -mdebug-main=prefix
27537 Flag the first routine whose name starts with prefix as the main
27538 routine for the debugger.
27539
27540 -mmalloc64
27541 Default to 64-bit memory allocation routines.
27542
27543 -mpointer-size=size
27544 Set the default size of pointers. Possible options for size are 32
27545 or short for 32 bit pointers, 64 or long for 64 bit pointers, and
27546 no for supporting only 32 bit pointers. The later option disables
27547 "pragma pointer_size".
27548
27549 VxWorks Options
27550 The options in this section are defined for all VxWorks targets.
27551 Options specific to the target hardware are listed with the other
27552 options for that target.
27553
27554 -mrtp
27555 GCC can generate code for both VxWorks kernels and real time
27556 processes (RTPs). This option switches from the former to the
27557 latter. It also defines the preprocessor macro "__RTP__".
27558
27559 -non-static
27560 Link an RTP executable against shared libraries rather than static
27561 libraries. The options -static and -shared can also be used for
27562 RTPs; -static is the default.
27563
27564 -Bstatic
27565 -Bdynamic
27566 These options are passed down to the linker. They are defined for
27567 compatibility with Diab.
27568
27569 -Xbind-lazy
27570 Enable lazy binding of function calls. This option is equivalent
27571 to -Wl,-z,now and is defined for compatibility with Diab.
27572
27573 -Xbind-now
27574 Disable lazy binding of function calls. This option is the default
27575 and is defined for compatibility with Diab.
27576
27577 x86 Options
27578 These -m options are defined for the x86 family of computers.
27579
27580 -march=cpu-type
27581 Generate instructions for the machine type cpu-type. In contrast
27582 to -mtune=cpu-type, which merely tunes the generated code for the
27583 specified cpu-type, -march=cpu-type allows GCC to generate code
27584 that may not run at all on processors other than the one indicated.
27585 Specifying -march=cpu-type implies -mtune=cpu-type, except where
27586 noted otherwise.
27587
27588 The choices for cpu-type are:
27589
27590 native
27591 This selects the CPU to generate code for at compilation time
27592 by determining the processor type of the compiling machine.
27593 Using -march=native enables all instruction subsets supported
27594 by the local machine (hence the result might not run on
27595 different machines). Using -mtune=native produces code
27596 optimized for the local machine under the constraints of the
27597 selected instruction set.
27598
27599 x86-64
27600 A generic CPU with 64-bit extensions.
27601
27602 x86-64-v2
27603 x86-64-v3
27604 x86-64-v4
27605 These choices for cpu-type select the corresponding micro-
27606 architecture level from the x86-64 psABI. On ABIs other than
27607 the x86-64 psABI they select the same CPU features as the
27608 x86-64 psABI documents for the particular micro-architecture
27609 level.
27610
27611 Since these cpu-type values do not have a corresponding -mtune
27612 setting, using -march with these values enables generic tuning.
27613 Specific tuning can be enabled using the -mtune=other-cpu-type
27614 option with an appropriate other-cpu-type value.
27615
27616 i386
27617 Original Intel i386 CPU.
27618
27619 i486
27620 Intel i486 CPU. (No scheduling is implemented for this chip.)
27621
27622 i586
27623 pentium
27624 Intel Pentium CPU with no MMX support.
27625
27626 lakemont
27627 Intel Lakemont MCU, based on Intel Pentium CPU.
27628
27629 pentium-mmx
27630 Intel Pentium MMX CPU, based on Pentium core with MMX
27631 instruction set support.
27632
27633 pentiumpro
27634 Intel Pentium Pro CPU.
27635
27636 i686
27637 When used with -march, the Pentium Pro instruction set is used,
27638 so the code runs on all i686 family chips. When used with
27639 -mtune, it has the same meaning as generic.
27640
27641 pentium2
27642 Intel Pentium II CPU, based on Pentium Pro core with MMX and
27643 FXSR instruction set support.
27644
27645 pentium3
27646 pentium3m
27647 Intel Pentium III CPU, based on Pentium Pro core with MMX, FXSR
27648 and SSE instruction set support.
27649
27650 pentium-m
27651 Intel Pentium M; low-power version of Intel Pentium III CPU
27652 with MMX, SSE, SSE2 and FXSR instruction set support. Used by
27653 Centrino notebooks.
27654
27655 pentium4
27656 pentium4m
27657 Intel Pentium 4 CPU with MMX, SSE, SSE2 and FXSR instruction
27658 set support.
27659
27660 prescott
27661 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2,
27662 SSE3 and FXSR instruction set support.
27663
27664 nocona
27665 Improved version of Intel Pentium 4 CPU with 64-bit extensions,
27666 MMX, SSE, SSE2, SSE3 and FXSR instruction set support.
27667
27668 core2
27669 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
27670 SSSE3, CX16, SAHF and FXSR instruction set support.
27671
27672 nehalem
27673 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
27674 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF and FXSR instruction
27675 set support.
27676
27677 westmere
27678 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2,
27679 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR and
27680 PCLMUL instruction set support.
27681
27682 sandybridge
27683 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
27684 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX,
27685 XSAVE and PCLMUL instruction set support.
27686
27687 ivybridge
27688 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
27689 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX,
27690 XSAVE, PCLMUL, FSGSBASE, RDRND and F16C instruction set
27691 support.
27692
27693 haswell
27694 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE,
27695 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27696 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27697 LZCNT, FMA, MOVBE and HLE instruction set support.
27698
27699 broadwell
27700 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE,
27701 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27702 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27703 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX and PREFETCHW instruction
27704 set support.
27705
27706 skylake
27707 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27708 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27709 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27710 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27711 CLFLUSHOPT, XSAVEC, XSAVES and SGX instruction set support.
27712
27713 bonnell
27714 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE,
27715 SSE2, SSE3 and SSSE3 instruction set support.
27716
27717 silvermont
27718 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE,
27719 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27720 PCLMUL, PREFETCHW and RDRND instruction set support.
27721
27722 goldmont
27723 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE,
27724 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27725 PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE, XSAVEC,
27726 XSAVES, XSAVEOPT, CLFLUSHOPT and FSGSBASE instruction set
27727 support.
27728
27729 goldmont-plus
27730 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX,
27731 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27732 FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE,
27733 XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID
27734 and SGX instruction set support.
27735
27736 tremont
27737 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE,
27738 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27739 PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE, XSAVEC,
27740 XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID, SGX,
27741 CLWB, GFNI-SSE, MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG
27742 instruction set support.
27743
27744 sierraforest
27745 Intel Sierra Forest CPU with 64-bit extensions, MOVBE, MMX,
27746 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
27747 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
27748 PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
27749 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
27750 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL,
27751 WIDEKL, AVX-VNNI, AVXIFMA, AVXVNNIINT8, AVXNECONVERT,
27752 CMPCCXADD, ENQCMD and UINTR instruction set support.
27753
27754 grandridge
27755 Intel Grand Ridge CPU with 64-bit extensions, MOVBE, MMX, SSE,
27756 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
27757 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
27758 PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
27759 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
27760 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL,
27761 WIDEKL, AVX-VNNI, AVXIFMA, AVXVNNIINT8, AVXNECONVERT,
27762 CMPCCXADD, ENQCMD, UINTR and RAOINT instruction set support.
27763
27764 knl Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX,
27765 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27766 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27767 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
27768 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1
27769 instruction set support.
27770
27771 knm Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE,
27772 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27773 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27774 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AVX512PF,
27775 AVX512ER, AVX512F, AVX512CD and PREFETCHWT1, AVX5124VNNIW,
27776 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27777
27778 skylake-avx512
27779 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX,
27780 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27781 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27782 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27783 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
27784 AVX512BW, AVX512DQ and AVX512CD instruction set support.
27785
27786 cannonlake
27787 Intel Cannonlake 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, AVX512VL, AVX512BW,
27792 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA and SHA
27793 instruction set support.
27794
27795 icelake-client
27796 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX,
27797 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27798 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27799 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27800 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
27801 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
27802 AVX512VNNI, GFNI, VAES, AVX512VBMI2 , VPCLMULQDQ, AVX512BITALG,
27803 RDPID and AVX512VPOPCNTDQ instruction set support.
27804
27805 icelake-server
27806 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX,
27807 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27808 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27809 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27810 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
27811 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
27812 AVX512VNNI, GFNI, VAES, AVX512VBMI2 , VPCLMULQDQ, AVX512BITALG,
27813 RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD and CLWB instruction
27814 set support.
27815
27816 cascadelake
27817 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27818 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27819 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27820 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27821 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
27822 AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set
27823 support.
27824
27825 cooperlake
27826 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27827 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27828 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27829 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27830 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
27831 AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16
27832 instruction set support.
27833
27834 tigerlake
27835 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27836 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27837 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27838 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27839 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
27840 AVX512DQ, AVX512CD PKU, AVX512VBMI, AVX512IFMA, SHA,
27841 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
27842 RDPID, AVX512VPOPCNTDQ, MOVDIRI, MOVDIR64B, CLWB,
27843 AVX512VP2INTERSECT and KEYLOCKER instruction set support.
27844
27845 sapphirerapids
27846 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX,
27847 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27848 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27849 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27850 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
27851 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
27852 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
27853 RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB, MOVDIRI,
27854 MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE,
27855 TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI,
27856 AVX512-FP16 and AVX512BF16 instruction set support.
27857
27858 alderlake
27859 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27860 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
27861 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
27862 PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
27863 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
27864 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL,
27865 WIDEKL and AVX-VNNI instruction set support.
27866
27867 rocketlake
27868 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27869 SSE2, SSE3, SSSE3 , SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27870 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27871 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27872 CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL, AVX512BW,
27873 AVX512DQ, AVX512CD PKU, AVX512VBMI, AVX512IFMA, SHA,
27874 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
27875 RDPID and AVX512VPOPCNTDQ instruction set support.
27876
27877 graniterapids
27878 Intel graniterapids CPU with 64-bit extensions, MOVBE, MMX,
27879 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27880 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27881 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27882 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
27883 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
27884 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
27885 RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB, MOVDIRI,
27886 MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE,
27887 TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI,
27888 AVX512-FP16, AVX512BF16, AMX-FP16 and PREFETCHI instruction set
27889 support.
27890
27891 graniterapids-d
27892 Intel graniterapids D CPU with 64-bit extensions, MOVBE, MMX,
27893 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27894 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27895 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27896 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
27897 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
27898 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
27899 RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB, MOVDIRI,
27900 MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE,
27901 TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI,
27902 AVX512FP16, AVX512BF16, AMX-FP16, PREFETCHI and AMX-COMPLEX
27903 instruction set support.
27904
27905 k6 AMD K6 CPU with MMX instruction set support.
27906
27907 k6-2
27908 k6-3
27909 Improved versions of AMD K6 CPU with MMX and 3DNow! instruction
27910 set support.
27911
27912 athlon
27913 athlon-tbird
27914 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow! and SSE
27915 prefetch instructions support.
27916
27917 athlon-4
27918 athlon-xp
27919 athlon-mp
27920 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow! and
27921 full SSE instruction set support.
27922
27923 k8
27924 opteron
27925 athlon64
27926 athlon-fx
27927 Processors based on the AMD K8 core with x86-64 instruction set
27928 support, including the AMD Opteron, Athlon 64, and Athlon 64 FX
27929 processors. (This supersets MMX, SSE, SSE2, 3DNow!, enhanced
27930 3DNow! and 64-bit instruction set extensions.)
27931
27932 k8-sse3
27933 opteron-sse3
27934 athlon64-sse3
27935 Improved versions of AMD K8 cores with SSE3 instruction set
27936 support.
27937
27938 amdfam10
27939 barcelona
27940 CPUs based on AMD Family 10h cores with x86-64 instruction set
27941 support. (This supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!,
27942 enhanced 3DNow!, ABM and 64-bit instruction set extensions.)
27943
27944 bdver1
27945 CPUs based on AMD Family 15h cores with x86-64 instruction set
27946 support. (This supersets FMA4, AVX, XOP, LWP, AES, PCLMUL,
27947 CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM
27948 and 64-bit instruction set extensions.)
27949
27950 bdver2
27951 AMD Family 15h core based CPUs with x86-64 instruction set
27952 support. (This supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP,
27953 LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27954 SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27955
27956 bdver3
27957 AMD Family 15h core based CPUs with x86-64 instruction set
27958 support. (This supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE,
27959 AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27960 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27961 extensions.)
27962
27963 bdver4
27964 AMD Family 15h core based CPUs with x86-64 instruction set
27965 support. (This supersets BMI, BMI2, TBM, F16C, FMA, FMA4,
27966 FSGSBASE, AVX, AVX2, XOP, LWP, AES, PCLMUL, CX16, MOVBE, MMX,
27967 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit
27968 instruction set extensions.)
27969
27970 znver1
27971 AMD Family 17h core based CPUs with x86-64 instruction set
27972 support. (This supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX,
27973 AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL, CX16,
27974 MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM,
27975 XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit instruction set
27976 extensions.)
27977
27978 znver2
27979 AMD Family 17h core based CPUs with x86-64 instruction set
27980 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
27981 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
27982 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27983 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
27984 WBNOINVD, and 64-bit instruction set extensions.)
27985
27986 znver3
27987 AMD Family 19h 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, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set
27993 extensions.)
27994
27995 znver4
27996 AMD Family 19h core based CPUs with x86-64 instruction set
27997 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
27998 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
27999 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
28000 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
28001 WBNOINVD, PKU, VPCLMULQDQ, VAES, AVX512F, AVX512DQ, AVX512IFMA,
28002 AVX512CD, AVX512BW, AVX512VL, AVX512BF16, AVX512VBMI,
28003 AVX512VBMI2, AVX512VNNI, AVX512BITALG, AVX512VPOPCNTDQ, GFNI
28004 and 64-bit instruction set extensions.)
28005
28006 btver1
28007 CPUs based on AMD Family 14h cores with x86-64 instruction set
28008 support. (This supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A,
28009 CX16, ABM and 64-bit instruction set extensions.)
28010
28011 btver2
28012 CPUs based on AMD Family 16h cores with x86-64 instruction set
28013 support. This includes MOVBE, F16C, BMI, AVX, PCLMUL, AES,
28014 SSE4.2, SSE4.1, CX16, ABM, SSE4A, SSSE3, SSE3, SSE2, SSE, MMX
28015 and 64-bit instruction set extensions.
28016
28017 winchip-c6
28018 IDT WinChip C6 CPU, dealt in same way as i486 with additional
28019 MMX instruction set support.
28020
28021 winchip2
28022 IDT WinChip 2 CPU, dealt in same way as i486 with additional
28023 MMX and 3DNow! instruction set support.
28024
28025 c3 VIA C3 CPU with MMX and 3DNow! instruction set support. (No
28026 scheduling is implemented for this chip.)
28027
28028 c3-2
28029 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set
28030 support. (No scheduling is implemented for this chip.)
28031
28032 c7 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction
28033 set support. (No scheduling is implemented for this chip.)
28034
28035 samuel-2
28036 VIA Eden Samuel 2 CPU with MMX and 3DNow! instruction set
28037 support. (No scheduling is implemented for this chip.)
28038
28039 nehemiah
28040 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
28041 (No scheduling is implemented for this chip.)
28042
28043 esther
28044 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction
28045 set support. (No scheduling is implemented for this chip.)
28046
28047 eden-x2
28048 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3
28049 instruction set support. (No scheduling is implemented for
28050 this chip.)
28051
28052 eden-x4
28053 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3,
28054 SSE4.1, SSE4.2, AVX and AVX2 instruction set support. (No
28055 scheduling is implemented for this chip.)
28056
28057 nano
28058 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and
28059 SSSE3 instruction set support. (No scheduling is implemented
28060 for this chip.)
28061
28062 nano-1000
28063 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
28064 instruction set support. (No scheduling is implemented for
28065 this chip.)
28066
28067 nano-2000
28068 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
28069 instruction set support. (No scheduling is implemented for
28070 this chip.)
28071
28072 nano-3000
28073 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and
28074 SSE4.1 instruction set support. (No scheduling is implemented
28075 for this chip.)
28076
28077 nano-x2
28078 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
28079 and SSE4.1 instruction set support. (No scheduling is
28080 implemented for this chip.)
28081
28082 nano-x4
28083 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
28084 and SSE4.1 instruction set support. (No scheduling is
28085 implemented for this chip.)
28086
28087 lujiazui
28088 ZHAOXIN lujiazui CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3,
28089 SSSE3, SSE4.1, SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE,
28090 XSAVEOPT, FSGSBASE, CX16, ABM, BMI, BMI2, F16C, FXSR, RDSEED
28091 instruction set support.
28092
28093 geode
28094 AMD Geode embedded processor with MMX and 3DNow! instruction
28095 set support.
28096
28097 -mtune=cpu-type
28098 Tune to cpu-type everything applicable about the generated code,
28099 except for the ABI and the set of available instructions. While
28100 picking a specific cpu-type schedules things appropriately for that
28101 particular chip, the compiler does not generate any code that
28102 cannot run on the default machine type unless you use a -march=cpu-
28103 type option. For example, if GCC is configured for
28104 i686-pc-linux-gnu then -mtune=pentium4 generates code that is tuned
28105 for Pentium 4 but still runs on i686 machines.
28106
28107 The choices for cpu-type are the same as for -march. In addition,
28108 -mtune supports 2 extra choices for cpu-type:
28109
28110 generic
28111 Produce code optimized for the most common IA32/AMD64/EM64T
28112 processors. If you know the CPU on which your code will run,
28113 then you should use the corresponding -mtune or -march option
28114 instead of -mtune=generic. But, if you do not know exactly
28115 what CPU users of your application will have, then you should
28116 use this option.
28117
28118 As new processors are deployed in the marketplace, the behavior
28119 of this option will change. Therefore, if you upgrade to a
28120 newer version of GCC, code generation controlled by this option
28121 will change to reflect the processors that are most common at
28122 the time that version of GCC is released.
28123
28124 There is no -march=generic option because -march indicates the
28125 instruction set the compiler can use, and there is no generic
28126 instruction set applicable to all processors. In contrast,
28127 -mtune indicates the processor (or, in this case, collection of
28128 processors) for which the code is optimized.
28129
28130 intel
28131 Produce code optimized for the most current Intel processors,
28132 which are Haswell and Silvermont for this version of GCC. If
28133 you know the CPU on which your code will run, then you should
28134 use the corresponding -mtune or -march option instead of
28135 -mtune=intel. But, if you want your application performs
28136 better on both Haswell and Silvermont, then you should use this
28137 option.
28138
28139 As new Intel processors are deployed in the marketplace, the
28140 behavior of this option will change. Therefore, if you upgrade
28141 to a newer version of GCC, code generation controlled by this
28142 option will change to reflect the most current Intel processors
28143 at the time that version of GCC is released.
28144
28145 There is no -march=intel option because -march indicates the
28146 instruction set the compiler can use, and there is no common
28147 instruction set applicable to all processors. In contrast,
28148 -mtune indicates the processor (or, in this case, collection of
28149 processors) for which the code is optimized.
28150
28151 -mcpu=cpu-type
28152 A deprecated synonym for -mtune.
28153
28154 -mfpmath=unit
28155 Generate floating-point arithmetic for selected unit unit. The
28156 choices for unit are:
28157
28158 387 Use the standard 387 floating-point coprocessor present on the
28159 majority of chips and emulated otherwise. Code compiled with
28160 this option runs almost everywhere. The temporary results are
28161 computed in 80-bit precision instead of the precision specified
28162 by the type, resulting in slightly different results compared
28163 to most of other chips. See -ffloat-store for more detailed
28164 description.
28165
28166 This is the default choice for non-Darwin x86-32 targets.
28167
28168 sse Use scalar floating-point instructions present in the SSE
28169 instruction set. This instruction set is supported by Pentium
28170 III and newer chips, and in the AMD line by Athlon-4, Athlon XP
28171 and Athlon MP chips. The earlier version of the SSE
28172 instruction set supports only single-precision arithmetic, thus
28173 the double and extended-precision arithmetic are still done
28174 using 387. A later version, present only in Pentium 4 and AMD
28175 x86-64 chips, supports double-precision arithmetic too.
28176
28177 For the x86-32 compiler, you must use -march=cpu-type, -msse or
28178 -msse2 switches to enable SSE extensions and make this option
28179 effective. For the x86-64 compiler, these extensions are
28180 enabled by default.
28181
28182 The resulting code should be considerably faster in the
28183 majority of cases and avoid the numerical instability problems
28184 of 387 code, but may break some existing code that expects
28185 temporaries to be 80 bits.
28186
28187 This is the default choice for the x86-64 compiler, Darwin
28188 x86-32 targets, and the default choice for x86-32 targets with
28189 the SSE2 instruction set when -ffast-math is enabled.
28190
28191 sse,387
28192 sse+387
28193 both
28194 Attempt to utilize both instruction sets at once. This
28195 effectively doubles the amount of available registers, and on
28196 chips with separate execution units for 387 and SSE the
28197 execution resources too. Use this option with care, as it is
28198 still experimental, because the GCC register allocator does not
28199 model separate functional units well, resulting in unstable
28200 performance.
28201
28202 -masm=dialect
28203 Output assembly instructions using selected dialect. Also affects
28204 which dialect is used for basic "asm" and extended "asm". Supported
28205 choices (in dialect order) are att or intel. The default is att.
28206 Darwin does not support intel.
28207
28208 -mieee-fp
28209 -mno-ieee-fp
28210 Control whether or not the compiler uses IEEE floating-point
28211 comparisons. These correctly handle the case where the result of a
28212 comparison is unordered.
28213
28214 -m80387
28215 -mhard-float
28216 Generate output containing 80387 instructions for floating point.
28217
28218 -mno-80387
28219 -msoft-float
28220 Generate output containing library calls for floating point.
28221
28222 Warning: the requisite libraries are not part of GCC. Normally the
28223 facilities of the machine's usual C compiler are used, but this
28224 cannot be done directly in cross-compilation. You must make your
28225 own arrangements to provide suitable library functions for cross-
28226 compilation.
28227
28228 On machines where a function returns floating-point results in the
28229 80387 register stack, some floating-point opcodes may be emitted
28230 even if -msoft-float is used.
28231
28232 -mno-fp-ret-in-387
28233 Do not use the FPU registers for return values of functions.
28234
28235 The usual calling convention has functions return values of types
28236 "float" and "double" in an FPU register, even if there is no FPU.
28237 The idea is that the operating system should emulate an FPU.
28238
28239 The option -mno-fp-ret-in-387 causes such values to be returned in
28240 ordinary CPU registers instead.
28241
28242 -mno-fancy-math-387
28243 Some 387 emulators do not support the "sin", "cos" and "sqrt"
28244 instructions for the 387. Specify this option to avoid generating
28245 those instructions. This option is overridden when -march
28246 indicates that the target CPU always has an FPU and so the
28247 instruction does not need emulation. These instructions are not
28248 generated unless you also use the -funsafe-math-optimizations
28249 switch.
28250
28251 -malign-double
28252 -mno-align-double
28253 Control whether GCC aligns "double", "long double", and "long long"
28254 variables on a two-word boundary or a one-word boundary. Aligning
28255 "double" variables on a two-word boundary produces code that runs
28256 somewhat faster on a Pentium at the expense of more memory.
28257
28258 On x86-64, -malign-double is enabled by default.
28259
28260 Warning: if you use the -malign-double switch, structures
28261 containing the above types are aligned differently than the
28262 published application binary interface specifications for the
28263 x86-32 and are not binary compatible with structures in code
28264 compiled without that switch.
28265
28266 -m96bit-long-double
28267 -m128bit-long-double
28268 These switches control the size of "long double" type. The x86-32
28269 application binary interface specifies the size to be 96 bits, so
28270 -m96bit-long-double is the default in 32-bit mode.
28271
28272 Modern architectures (Pentium and newer) prefer "long double" to be
28273 aligned to an 8- or 16-byte boundary. In arrays or structures
28274 conforming to the ABI, this is not possible. So specifying
28275 -m128bit-long-double aligns "long double" to a 16-byte boundary by
28276 padding the "long double" with an additional 32-bit zero.
28277
28278 In the x86-64 compiler, -m128bit-long-double is the default choice
28279 as its ABI specifies that "long double" is aligned on 16-byte
28280 boundary.
28281
28282 Notice that neither of these options enable any extra precision
28283 over the x87 standard of 80 bits for a "long double".
28284
28285 Warning: if you override the default value for your target ABI,
28286 this changes the size of structures and arrays containing "long
28287 double" variables, as well as modifying the function calling
28288 convention for functions taking "long double". Hence they are not
28289 binary-compatible with code compiled without that switch.
28290
28291 -mlong-double-64
28292 -mlong-double-80
28293 -mlong-double-128
28294 These switches control the size of "long double" type. A size of 64
28295 bits makes the "long double" type equivalent to the "double" type.
28296 This is the default for 32-bit Bionic C library. A size of 128
28297 bits makes the "long double" type equivalent to the "__float128"
28298 type. This is the default for 64-bit Bionic C library.
28299
28300 Warning: if you override the default value for your target ABI,
28301 this changes the size of structures and arrays containing "long
28302 double" variables, as well as modifying the function calling
28303 convention for functions taking "long double". Hence they are not
28304 binary-compatible with code compiled without that switch.
28305
28306 -malign-data=type
28307 Control how GCC aligns variables. Supported values for type are
28308 compat uses increased alignment value compatible uses GCC 4.8 and
28309 earlier, abi uses alignment value as specified by the psABI, and
28310 cacheline uses increased alignment value to match the cache line
28311 size. compat is the default.
28312
28313 -mlarge-data-threshold=threshold
28314 When -mcmodel=medium is specified, data objects larger than
28315 threshold are placed in the large data section. This value must be
28316 the same across all objects linked into the binary, and defaults to
28317 65535.
28318
28319 -mrtd
28320 Use a different function-calling convention, in which functions
28321 that take a fixed number of arguments return with the "ret num"
28322 instruction, which pops their arguments while returning. This
28323 saves one instruction in the caller since there is no need to pop
28324 the arguments there.
28325
28326 You can specify that an individual function is called with this
28327 calling sequence with the function attribute "stdcall". You can
28328 also override the -mrtd option by using the function attribute
28329 "cdecl".
28330
28331 Warning: this calling convention is incompatible with the one
28332 normally used on Unix, so you cannot use it if you need to call
28333 libraries compiled with the Unix compiler.
28334
28335 Also, you must provide function prototypes for all functions that
28336 take variable numbers of arguments (including "printf"); otherwise
28337 incorrect code is generated for calls to those functions.
28338
28339 In addition, seriously incorrect code results if you call a
28340 function with too many arguments. (Normally, extra arguments are
28341 harmlessly ignored.)
28342
28343 -mregparm=num
28344 Control how many registers are used to pass integer arguments. By
28345 default, no registers are used to pass arguments, and at most 3
28346 registers can be used. You can control this behavior for a
28347 specific function by using the function attribute "regparm".
28348
28349 Warning: if you use this switch, and num is nonzero, then you must
28350 build all modules with the same value, including any libraries.
28351 This includes the system libraries and startup modules.
28352
28353 -msseregparm
28354 Use SSE register passing conventions for float and double arguments
28355 and return values. You can control this behavior for a specific
28356 function by using the function attribute "sseregparm".
28357
28358 Warning: if you use this switch then you must build all modules
28359 with the same value, including any libraries. This includes the
28360 system libraries and startup modules.
28361
28362 -mvect8-ret-in-mem
28363 Return 8-byte vectors in memory instead of MMX registers. This is
28364 the default on VxWorks to match the ABI of the Sun Studio compilers
28365 until version 12. Only use this option if you need to remain
28366 compatible with existing code produced by those previous compiler
28367 versions or older versions of GCC.
28368
28369 -mpc32
28370 -mpc64
28371 -mpc80
28372 Set 80387 floating-point precision to 32, 64 or 80 bits. When
28373 -mpc32 is specified, the significands of results of floating-point
28374 operations are rounded to 24 bits (single precision); -mpc64 rounds
28375 the significands of results of floating-point operations to 53 bits
28376 (double precision) and -mpc80 rounds the significands of results of
28377 floating-point operations to 64 bits (extended double precision),
28378 which is the default. When this option is used, floating-point
28379 operations in higher precisions are not available to the programmer
28380 without setting the FPU control word explicitly.
28381
28382 Setting the rounding of floating-point operations to less than the
28383 default 80 bits can speed some programs by 2% or more. Note that
28384 some mathematical libraries assume that extended-precision (80-bit)
28385 floating-point operations are enabled by default; routines in such
28386 libraries could suffer significant loss of accuracy, typically
28387 through so-called "catastrophic cancellation", when this option is
28388 used to set the precision to less than extended precision.
28389
28390 -mdaz-ftz
28391 The flush-to-zero (FTZ) and denormals-are-zero (DAZ) flags in the
28392 MXCSR register are used to control floating-point calculations.SSE
28393 and AVX instructions including scalar and vector instructions could
28394 benefit from enabling the FTZ and DAZ flags when -mdaz-ftz is
28395 specified. Don't set FTZ/DAZ flags when -mno-daz-ftz or -shared is
28396 specified, -mdaz-ftz will set FTZ/DAZ flags even with -shared.
28397
28398 -mstackrealign
28399 Realign the stack at entry. On the x86, the -mstackrealign option
28400 generates an alternate prologue and epilogue that realigns the run-
28401 time stack if necessary. This supports mixing legacy codes that
28402 keep 4-byte stack alignment with modern codes that keep 16-byte
28403 stack alignment for SSE compatibility. See also the attribute
28404 "force_align_arg_pointer", applicable to individual functions.
28405
28406 -mpreferred-stack-boundary=num
28407 Attempt to keep the stack boundary aligned to a 2 raised to num
28408 byte boundary. If -mpreferred-stack-boundary is not specified, the
28409 default is 4 (16 bytes or 128 bits).
28410
28411 Warning: When generating code for the x86-64 architecture with SSE
28412 extensions disabled, -mpreferred-stack-boundary=3 can be used to
28413 keep the stack boundary aligned to 8 byte boundary. Since x86-64
28414 ABI require 16 byte stack alignment, this is ABI incompatible and
28415 intended to be used in controlled environment where stack space is
28416 important limitation. This option leads to wrong code when
28417 functions compiled with 16 byte stack alignment (such as functions
28418 from a standard library) are called with misaligned stack. In this
28419 case, SSE instructions may lead to misaligned memory access traps.
28420 In addition, variable arguments are handled incorrectly for 16 byte
28421 aligned objects (including x87 long double and __int128), leading
28422 to wrong results. You must build all modules with
28423 -mpreferred-stack-boundary=3, including any libraries. This
28424 includes the system libraries and startup modules.
28425
28426 -mincoming-stack-boundary=num
28427 Assume the incoming stack is aligned to a 2 raised to num byte
28428 boundary. If -mincoming-stack-boundary is not specified, the one
28429 specified by -mpreferred-stack-boundary is used.
28430
28431 On Pentium and Pentium Pro, "double" and "long double" values
28432 should be aligned to an 8-byte boundary (see -malign-double) or
28433 suffer significant run time performance penalties. On Pentium III,
28434 the Streaming SIMD Extension (SSE) data type "__m128" may not work
28435 properly if it is not 16-byte aligned.
28436
28437 To ensure proper alignment of this values on the stack, the stack
28438 boundary must be as aligned as that required by any value stored on
28439 the stack. Further, every function must be generated such that it
28440 keeps the stack aligned. Thus calling a function compiled with a
28441 higher preferred stack boundary from a function compiled with a
28442 lower preferred stack boundary most likely misaligns the stack. It
28443 is recommended that libraries that use callbacks always use the
28444 default setting.
28445
28446 This extra alignment does consume extra stack space, and generally
28447 increases code size. Code that is sensitive to stack space usage,
28448 such as embedded systems and operating system kernels, may want to
28449 reduce the preferred alignment to -mpreferred-stack-boundary=2.
28450
28451 -mmmx
28452 -msse
28453 -msse2
28454 -msse3
28455 -mssse3
28456 -msse4
28457 -msse4a
28458 -msse4.1
28459 -msse4.2
28460 -mavx
28461 -mavx2
28462 -mavx512f
28463 -mavx512pf
28464 -mavx512er
28465 -mavx512cd
28466 -mavx512vl
28467 -mavx512bw
28468 -mavx512dq
28469 -mavx512ifma
28470 -mavx512vbmi
28471 -msha
28472 -maes
28473 -mpclmul
28474 -mclflushopt
28475 -mclwb
28476 -mfsgsbase
28477 -mptwrite
28478 -mrdrnd
28479 -mf16c
28480 -mfma
28481 -mpconfig
28482 -mwbnoinvd
28483 -mfma4
28484 -mprfchw
28485 -mrdpid
28486 -mprefetchwt1
28487 -mrdseed
28488 -msgx
28489 -mxop
28490 -mlwp
28491 -m3dnow
28492 -m3dnowa
28493 -mpopcnt
28494 -mabm
28495 -madx
28496 -mbmi
28497 -mbmi2
28498 -mlzcnt
28499 -mfxsr
28500 -mxsave
28501 -mxsaveopt
28502 -mxsavec
28503 -mxsaves
28504 -mrtm
28505 -mhle
28506 -mtbm
28507 -mmwaitx
28508 -mclzero
28509 -mpku
28510 -mavx512vbmi2
28511 -mavx512bf16
28512 -mavx512fp16
28513 -mgfni
28514 -mvaes
28515 -mwaitpkg
28516 -mvpclmulqdq
28517 -mavx512bitalg
28518 -mmovdiri
28519 -mmovdir64b
28520 -menqcmd
28521 -muintr
28522 -mtsxldtrk
28523 -mavx512vpopcntdq
28524 -mavx512vp2intersect
28525 -mavx5124fmaps
28526 -mavx512vnni
28527 -mavxvnni
28528 -mavx5124vnniw
28529 -mcldemote
28530 -mserialize
28531 -mamx-tile
28532 -mamx-int8
28533 -mamx-bf16
28534 -mhreset
28535 -mkl
28536 -mwidekl
28537 -mavxifma
28538 -mavxvnniint8
28539 -mavxneconvert
28540 -mcmpccxadd
28541 -mamx-fp16
28542 -mprefetchi
28543 -mraoint
28544 -mamx-complex
28545 These switches enable the use of instructions in the MMX, SSE,
28546 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F,
28547 AVX512PF, AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ,
28548 AVX512IFMA, AVX512VBMI, SHA, AES, PCLMUL, CLFLUSHOPT, CLWB,
28549 FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG, WBNOINVD, FMA4,
28550 PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP, 3DNow!,
28551 enhanced 3DNow!, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
28552 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU,
28553 AVX512VBMI2, GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG,
28554 MOVDIRI, MOVDIR64B, AVX512BF16, ENQCMD, AVX512VPOPCNTDQ,
28555 AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE, UINTR, HRESET,
28556 AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512-FP16,
28557 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AMX-FP16, PREFETCHI,
28558 RAOINT, AMX-COMPLEX or CLDEMOTE extended instruction sets. Each has
28559 a corresponding -mno- option to disable use of these instructions.
28560
28561 These extensions are also available as built-in functions: see x86
28562 Built-in Functions, for details of the functions enabled and
28563 disabled by these switches.
28564
28565 To generate SSE/SSE2 instructions automatically from floating-point
28566 code (as opposed to 387 instructions), see -mfpmath=sse.
28567
28568 GCC depresses SSEx instructions when -mavx is used. Instead, it
28569 generates new AVX instructions or AVX equivalence for all SSEx
28570 instructions when needed.
28571
28572 These options enable GCC to use these extended instructions in
28573 generated code, even without -mfpmath=sse. Applications that
28574 perform run-time CPU detection must compile separate files for each
28575 supported architecture, using the appropriate flags. In
28576 particular, the file containing the CPU detection code should be
28577 compiled without these options.
28578
28579 -mdump-tune-features
28580 This option instructs GCC to dump the names of the x86 performance
28581 tuning features and default settings. The names can be used in
28582 -mtune-ctrl=feature-list.
28583
28584 -mtune-ctrl=feature-list
28585 This option is used to do fine grain control of x86 code generation
28586 features. feature-list is a comma separated list of feature names.
28587 See also -mdump-tune-features. When specified, the feature is
28588 turned on if it is not preceded with ^, otherwise, it is turned
28589 off. -mtune-ctrl=feature-list is intended to be used by GCC
28590 developers. Using it may lead to code paths not covered by testing
28591 and can potentially result in compiler ICEs or runtime errors.
28592
28593 -mno-default
28594 This option instructs GCC to turn off all tunable features. See
28595 also -mtune-ctrl=feature-list and -mdump-tune-features.
28596
28597 -mcld
28598 This option instructs GCC to emit a "cld" instruction in the
28599 prologue of functions that use string instructions. String
28600 instructions depend on the DF flag to select between autoincrement
28601 or autodecrement mode. While the ABI specifies the DF flag to be
28602 cleared on function entry, some operating systems violate this
28603 specification by not clearing the DF flag in their exception
28604 dispatchers. The exception handler can be invoked with the DF flag
28605 set, which leads to wrong direction mode when string instructions
28606 are used. This option can be enabled by default on 32-bit x86
28607 targets by configuring GCC with the --enable-cld configure option.
28608 Generation of "cld" instructions can be suppressed with the
28609 -mno-cld compiler option in this case.
28610
28611 -mvzeroupper
28612 This option instructs GCC to emit a "vzeroupper" instruction before
28613 a transfer of control flow out of the function to minimize the AVX
28614 to SSE transition penalty as well as remove unnecessary "zeroupper"
28615 intrinsics.
28616
28617 -mprefer-avx128
28618 This option instructs GCC to use 128-bit AVX instructions instead
28619 of 256-bit AVX instructions in the auto-vectorizer.
28620
28621 -mprefer-vector-width=opt
28622 This option instructs GCC to use opt-bit vector width in
28623 instructions instead of default on the selected platform.
28624
28625 -mmove-max=bits
28626 This option instructs GCC to set the maximum number of bits can be
28627 moved from memory to memory efficiently to bits. The valid bits
28628 are 128, 256 and 512.
28629
28630 -mstore-max=bits
28631 This option instructs GCC to set the maximum number of bits can be
28632 stored to memory efficiently to bits. The valid bits are 128, 256
28633 and 512.
28634
28635 none
28636 No extra limitations applied to GCC other than defined by the
28637 selected platform.
28638
28639 128 Prefer 128-bit vector width for instructions.
28640
28641 256 Prefer 256-bit vector width for instructions.
28642
28643 512 Prefer 512-bit vector width for instructions.
28644
28645 -mcx16
28646 This option enables GCC to generate "CMPXCHG16B" instructions in
28647 64-bit code to implement compare-and-exchange operations on 16-byte
28648 aligned 128-bit objects. This is useful for atomic updates of data
28649 structures exceeding one machine word in size. The compiler uses
28650 this instruction to implement __sync Builtins. However, for
28651 __atomic Builtins operating on 128-bit integers, a library call is
28652 always used.
28653
28654 -msahf
28655 This option enables generation of "SAHF" instructions in 64-bit
28656 code. Early Intel Pentium 4 CPUs with Intel 64 support, prior to
28657 the introduction of Pentium 4 G1 step in December 2005, lacked the
28658 "LAHF" and "SAHF" instructions which are supported by AMD64. These
28659 are load and store instructions, respectively, for certain status
28660 flags. In 64-bit mode, the "SAHF" instruction is used to optimize
28661 "fmod", "drem", and "remainder" built-in functions; see Other
28662 Builtins for details.
28663
28664 -mmovbe
28665 This option enables use of the "movbe" instruction to implement
28666 "__builtin_bswap32" and "__builtin_bswap64".
28667
28668 -mshstk
28669 The -mshstk option enables shadow stack built-in functions from x86
28670 Control-flow Enforcement Technology (CET).
28671
28672 -mcrc32
28673 This option enables built-in functions "__builtin_ia32_crc32qi",
28674 "__builtin_ia32_crc32hi", "__builtin_ia32_crc32si" and
28675 "__builtin_ia32_crc32di" to generate the "crc32" machine
28676 instruction.
28677
28678 -mmwait
28679 This option enables built-in functions "__builtin_ia32_monitor",
28680 and "__builtin_ia32_mwait" to generate the "monitor" and "mwait"
28681 machine instructions.
28682
28683 -mrecip
28684 This option enables use of "RCPSS" and "RSQRTSS" instructions (and
28685 their vectorized variants "RCPPS" and "RSQRTPS") with an additional
28686 Newton-Raphson step to increase precision instead of "DIVSS" and
28687 "SQRTSS" (and their vectorized variants) for single-precision
28688 floating-point arguments. These instructions are generated only
28689 when -funsafe-math-optimizations is enabled together with
28690 -ffinite-math-only and -fno-trapping-math. Note that while the
28691 throughput of the sequence is higher than the throughput of the
28692 non-reciprocal instruction, the precision of the sequence can be
28693 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
28694 0.99999994).
28695
28696 Note that GCC implements "1.0f/sqrtf(x)" in terms of "RSQRTSS" (or
28697 "RSQRTPS") already with -ffast-math (or the above option
28698 combination), and doesn't need -mrecip.
28699
28700 Also note that GCC emits the above sequence with additional Newton-
28701 Raphson step for vectorized single-float division and vectorized
28702 sqrtf(x) already with -ffast-math (or the above option
28703 combination), and doesn't need -mrecip.
28704
28705 -mrecip=opt
28706 This option controls which reciprocal estimate instructions may be
28707 used. opt is a comma-separated list of options, which may be
28708 preceded by a ! to invert the option:
28709
28710 all Enable all estimate instructions.
28711
28712 default
28713 Enable the default instructions, equivalent to -mrecip.
28714
28715 none
28716 Disable all estimate instructions, equivalent to -mno-recip.
28717
28718 div Enable the approximation for scalar division.
28719
28720 vec-div
28721 Enable the approximation for vectorized division.
28722
28723 sqrt
28724 Enable the approximation for scalar square root.
28725
28726 vec-sqrt
28727 Enable the approximation for vectorized square root.
28728
28729 So, for example, -mrecip=all,!sqrt enables all of the reciprocal
28730 approximations, except for square root.
28731
28732 -mveclibabi=type
28733 Specifies the ABI type to use for vectorizing intrinsics using an
28734 external library. Supported values for type are svml for the Intel
28735 short vector math library and acml for the AMD math core library.
28736 To use this option, both -ftree-vectorize and
28737 -funsafe-math-optimizations have to be enabled, and an SVML or ACML
28738 ABI-compatible library must be specified at link time.
28739
28740 GCC currently emits calls to "vmldExp2", "vmldLn2", "vmldLog102",
28741 "vmldPow2", "vmldTanh2", "vmldTan2", "vmldAtan2", "vmldAtanh2",
28742 "vmldCbrt2", "vmldSinh2", "vmldSin2", "vmldAsinh2", "vmldAsin2",
28743 "vmldCosh2", "vmldCos2", "vmldAcosh2", "vmldAcos2", "vmlsExp4",
28744 "vmlsLn4", "vmlsLog104", "vmlsPow4", "vmlsTanh4", "vmlsTan4",
28745 "vmlsAtan4", "vmlsAtanh4", "vmlsCbrt4", "vmlsSinh4", "vmlsSin4",
28746 "vmlsAsinh4", "vmlsAsin4", "vmlsCosh4", "vmlsCos4", "vmlsAcosh4"
28747 and "vmlsAcos4" for corresponding function type when
28748 -mveclibabi=svml is used, and "__vrd2_sin", "__vrd2_cos",
28749 "__vrd2_exp", "__vrd2_log", "__vrd2_log2", "__vrd2_log10",
28750 "__vrs4_sinf", "__vrs4_cosf", "__vrs4_expf", "__vrs4_logf",
28751 "__vrs4_log2f", "__vrs4_log10f" and "__vrs4_powf" for the
28752 corresponding function type when -mveclibabi=acml is used.
28753
28754 -mabi=name
28755 Generate code for the specified calling convention. Permissible
28756 values are sysv for the ABI used on GNU/Linux and other systems,
28757 and ms for the Microsoft ABI. The default is to use the Microsoft
28758 ABI when targeting Microsoft Windows and the SysV ABI on all other
28759 systems. You can control this behavior for specific functions by
28760 using the function attributes "ms_abi" and "sysv_abi".
28761
28762 -mforce-indirect-call
28763 Force all calls to functions to be indirect. This is useful when
28764 using Intel Processor Trace where it generates more precise timing
28765 information for function calls.
28766
28767 -mmanual-endbr
28768 Insert ENDBR instruction at function entry only via the "cf_check"
28769 function attribute. This is useful when used with the option
28770 -fcf-protection=branch to control ENDBR insertion at the function
28771 entry.
28772
28773 -mcet-switch
28774 By default, CET instrumentation is turned off on switch statements
28775 that use a jump table and indirect branch track is disabled. Since
28776 jump tables are stored in read-only memory, this does not result in
28777 a direct loss of hardening. But if the jump table index is
28778 attacker-controlled, the indirect jump may not be constrained by
28779 CET. This option turns on CET instrumentation to enable indirect
28780 branch track for switch statements with jump tables which leads to
28781 the jump targets reachable via any indirect jumps.
28782
28783 -mcall-ms2sysv-xlogues
28784 Due to differences in 64-bit ABIs, any Microsoft ABI function that
28785 calls a System V ABI function must consider RSI, RDI and XMM6-15 as
28786 clobbered. By default, the code for saving and restoring these
28787 registers is emitted inline, resulting in fairly lengthy prologues
28788 and epilogues. Using -mcall-ms2sysv-xlogues emits prologues and
28789 epilogues that use stubs in the static portion of libgcc to perform
28790 these saves and restores, thus reducing function size at the cost
28791 of a few extra instructions.
28792
28793 -mtls-dialect=type
28794 Generate code to access thread-local storage using the gnu or gnu2
28795 conventions. gnu is the conservative default; gnu2 is more
28796 efficient, but it may add compile- and run-time requirements that
28797 cannot be satisfied on all systems.
28798
28799 -mpush-args
28800 -mno-push-args
28801 Use PUSH operations to store outgoing parameters. This method is
28802 shorter and usually equally fast as method using SUB/MOV operations
28803 and is enabled by default. In some cases disabling it may improve
28804 performance because of improved scheduling and reduced
28805 dependencies.
28806
28807 -maccumulate-outgoing-args
28808 If enabled, the maximum amount of space required for outgoing
28809 arguments is computed in the function prologue. This is faster on
28810 most modern CPUs because of reduced dependencies, improved
28811 scheduling and reduced stack usage when the preferred stack
28812 boundary is not equal to 2. The drawback is a notable increase in
28813 code size. This switch implies -mno-push-args.
28814
28815 -mthreads
28816 Support thread-safe exception handling on MinGW. Programs that
28817 rely on thread-safe exception handling must compile and link all
28818 code with the -mthreads option. When compiling, -mthreads defines
28819 -D_MT; when linking, it links in a special thread helper library
28820 -lmingwthrd which cleans up per-thread exception-handling data.
28821
28822 -mms-bitfields
28823 -mno-ms-bitfields
28824 Enable/disable bit-field layout compatible with the native
28825 Microsoft Windows compiler.
28826
28827 If "packed" is used on a structure, or if bit-fields are used, it
28828 may be that the Microsoft ABI lays out the structure differently
28829 than the way GCC normally does. Particularly when moving packed
28830 data between functions compiled with GCC and the native Microsoft
28831 compiler (either via function call or as data in a file), it may be
28832 necessary to access either format.
28833
28834 This option is enabled by default for Microsoft Windows targets.
28835 This behavior can also be controlled locally by use of variable or
28836 type attributes. For more information, see x86 Variable Attributes
28837 and x86 Type Attributes.
28838
28839 The Microsoft structure layout algorithm is fairly simple with the
28840 exception of the bit-field packing. The padding and alignment of
28841 members of structures and whether a bit-field can straddle a
28842 storage-unit boundary are determine by these rules:
28843
28844 1. Structure members are stored sequentially in the order in which
28845 they are
28846 declared: the first member has the lowest memory address and
28847 the last member the highest.
28848
28849 2. Every data object has an alignment requirement. The alignment
28850 requirement
28851 for all data except structures, unions, and arrays is either
28852 the size of the object or the current packing size (specified
28853 with either the "aligned" attribute or the "pack" pragma),
28854 whichever is less. For structures, unions, and arrays, the
28855 alignment requirement is the largest alignment requirement of
28856 its members. Every object is allocated an offset so that:
28857
28858 offset % alignment_requirement == 0
28859
28860 3. Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte
28861 allocation
28862 unit if the integral types are the same size and if the next
28863 bit-field fits into the current allocation unit without
28864 crossing the boundary imposed by the common alignment
28865 requirements of the bit-fields.
28866
28867 MSVC interprets zero-length bit-fields in the following ways:
28868
28869 1. If a zero-length bit-field is inserted between two bit-fields
28870 that
28871 are normally coalesced, the bit-fields are not coalesced.
28872
28873 For example:
28874
28875 struct
28876 {
28877 unsigned long bf_1 : 12;
28878 unsigned long : 0;
28879 unsigned long bf_2 : 12;
28880 } t1;
28881
28882 The size of "t1" is 8 bytes with the zero-length bit-field. If
28883 the zero-length bit-field were removed, "t1"'s size would be 4
28884 bytes.
28885
28886 2. If a zero-length bit-field is inserted after a bit-field, "foo",
28887 and the
28888 alignment of the zero-length bit-field is greater than the
28889 member that follows it, "bar", "bar" is aligned as the type of
28890 the zero-length bit-field.
28891
28892 For example:
28893
28894 struct
28895 {
28896 char foo : 4;
28897 short : 0;
28898 char bar;
28899 } t2;
28900
28901 struct
28902 {
28903 char foo : 4;
28904 short : 0;
28905 double bar;
28906 } t3;
28907
28908 For "t2", "bar" is placed at offset 2, rather than offset 1.
28909 Accordingly, the size of "t2" is 4. For "t3", the zero-length
28910 bit-field does not affect the alignment of "bar" or, as a
28911 result, the size of the structure.
28912
28913 Taking this into account, it is important to note the
28914 following:
28915
28916 1. If a zero-length bit-field follows a normal bit-field, the
28917 type of the
28918 zero-length bit-field may affect the alignment of the
28919 structure as whole. For example, "t2" has a size of 4
28920 bytes, since the zero-length bit-field follows a normal
28921 bit-field, and is of type short.
28922
28923 2. Even if a zero-length bit-field is not followed by a normal
28924 bit-field, it may
28925 still affect the alignment of the structure:
28926
28927 struct
28928 {
28929 char foo : 6;
28930 long : 0;
28931 } t4;
28932
28933 Here, "t4" takes up 4 bytes.
28934
28935 3. Zero-length bit-fields following non-bit-field members are
28936 ignored:
28937 struct
28938 {
28939 char foo;
28940 long : 0;
28941 char bar;
28942 } t5;
28943
28944 Here, "t5" takes up 2 bytes.
28945
28946 -mno-align-stringops
28947 Do not align the destination of inlined string operations. This
28948 switch reduces code size and improves performance in case the
28949 destination is already aligned, but GCC doesn't know about it.
28950
28951 -minline-all-stringops
28952 By default GCC inlines string operations only when the destination
28953 is known to be aligned to least a 4-byte boundary. This enables
28954 more inlining and increases code size, but may improve performance
28955 of code that depends on fast "memcpy" and "memset" for short
28956 lengths. The option enables inline expansion of "strlen" for all
28957 pointer alignments.
28958
28959 -minline-stringops-dynamically
28960 For string operations of unknown size, use run-time checks with
28961 inline code for small blocks and a library call for large blocks.
28962
28963 -mstringop-strategy=alg
28964 Override the internal decision heuristic for the particular
28965 algorithm to use for inlining string operations. The allowed
28966 values for alg are:
28967
28968 rep_byte
28969 rep_4byte
28970 rep_8byte
28971 Expand using i386 "rep" prefix of the specified size.
28972
28973 byte_loop
28974 loop
28975 unrolled_loop
28976 Expand into an inline loop.
28977
28978 libcall
28979 Always use a library call.
28980
28981 -mmemcpy-strategy=strategy
28982 Override the internal decision heuristic to decide if
28983 "__builtin_memcpy" should be inlined and what inline algorithm to
28984 use when the expected size of the copy operation is known. strategy
28985 is a comma-separated list of alg:max_size:dest_align triplets. alg
28986 is specified in -mstringop-strategy, max_size specifies the max
28987 byte size with which inline algorithm alg is allowed. For the last
28988 triplet, the max_size must be -1. The max_size of the triplets in
28989 the list must be specified in increasing order. The minimal byte
28990 size for alg is 0 for the first triplet and "max_size + 1" of the
28991 preceding range.
28992
28993 -mmemset-strategy=strategy
28994 The option is similar to -mmemcpy-strategy= except that it is to
28995 control "__builtin_memset" expansion.
28996
28997 -momit-leaf-frame-pointer
28998 Don't keep the frame pointer in a register for leaf functions.
28999 This avoids the instructions to save, set up, and restore frame
29000 pointers and makes an extra register available in leaf functions.
29001 The option -fomit-leaf-frame-pointer removes the frame pointer for
29002 leaf functions, which might make debugging harder.
29003
29004 -mtls-direct-seg-refs
29005 -mno-tls-direct-seg-refs
29006 Controls whether TLS variables may be accessed with offsets from
29007 the TLS segment register (%gs for 32-bit, %fs for 64-bit), or
29008 whether the thread base pointer must be added. Whether or not this
29009 is valid depends on the operating system, and whether it maps the
29010 segment to cover the entire TLS area.
29011
29012 For systems that use the GNU C Library, the default is on.
29013
29014 -msse2avx
29015 -mno-sse2avx
29016 Specify that the assembler should encode SSE instructions with VEX
29017 prefix. The option -mavx turns this on by default.
29018
29019 -mfentry
29020 -mno-fentry
29021 If profiling is active (-pg), put the profiling counter call before
29022 the prologue. Note: On x86 architectures the attribute
29023 "ms_hook_prologue" isn't possible at the moment for -mfentry and
29024 -pg.
29025
29026 -mrecord-mcount
29027 -mno-record-mcount
29028 If profiling is active (-pg), generate a __mcount_loc section that
29029 contains pointers to each profiling call. This is useful for
29030 automatically patching and out calls.
29031
29032 -mnop-mcount
29033 -mno-nop-mcount
29034 If profiling is active (-pg), generate the calls to the profiling
29035 functions as NOPs. This is useful when they should be patched in
29036 later dynamically. This is likely only useful together with
29037 -mrecord-mcount.
29038
29039 -minstrument-return=type
29040 Instrument function exit in -pg -mfentry instrumented functions
29041 with call to specified function. This only instruments true returns
29042 ending with ret, but not sibling calls ending with jump. Valid
29043 types are none to not instrument, call to generate a call to
29044 __return__, or nop5 to generate a 5 byte nop.
29045
29046 -mrecord-return
29047 -mno-record-return
29048 Generate a __return_loc section pointing to all return
29049 instrumentation code.
29050
29051 -mfentry-name=name
29052 Set name of __fentry__ symbol called at function entry for -pg
29053 -mfentry functions.
29054
29055 -mfentry-section=name
29056 Set name of section to record -mrecord-mcount calls (default
29057 __mcount_loc).
29058
29059 -mskip-rax-setup
29060 -mno-skip-rax-setup
29061 When generating code for the x86-64 architecture with SSE
29062 extensions disabled, -mskip-rax-setup can be used to skip setting
29063 up RAX register when there are no variable arguments passed in
29064 vector registers.
29065
29066 Warning: Since RAX register is used to avoid unnecessarily saving
29067 vector registers on stack when passing variable arguments, the
29068 impacts of this option are callees may waste some stack space,
29069 misbehave or jump to a random location. GCC 4.4 or newer don't
29070 have those issues, regardless the RAX register value.
29071
29072 -m8bit-idiv
29073 -mno-8bit-idiv
29074 On some processors, like Intel Atom, 8-bit unsigned integer divide
29075 is much faster than 32-bit/64-bit integer divide. This option
29076 generates a run-time check. If both dividend and divisor are
29077 within range of 0 to 255, 8-bit unsigned integer divide is used
29078 instead of 32-bit/64-bit integer divide.
29079
29080 -mavx256-split-unaligned-load
29081 -mavx256-split-unaligned-store
29082 Split 32-byte AVX unaligned load and store.
29083
29084 -mstack-protector-guard=guard
29085 -mstack-protector-guard-reg=reg
29086 -mstack-protector-guard-offset=offset
29087 Generate stack protection code using canary at guard. Supported
29088 locations are global for global canary or tls for per-thread canary
29089 in the TLS block (the default). This option has effect only when
29090 -fstack-protector or -fstack-protector-all is specified.
29091
29092 With the latter choice the options -mstack-protector-guard-reg=reg
29093 and -mstack-protector-guard-offset=offset furthermore specify which
29094 segment register (%fs or %gs) to use as base register for reading
29095 the canary, and from what offset from that base register. The
29096 default for those is as specified in the relevant ABI.
29097
29098 -mgeneral-regs-only
29099 Generate code that uses only the general-purpose registers. This
29100 prevents the compiler from using floating-point, vector, mask and
29101 bound registers.
29102
29103 -mrelax-cmpxchg-loop
29104 When emitting a compare-and-swap loop for __sync Builtins and
29105 __atomic Builtins lacking a native instruction, optimize for the
29106 highly contended case by issuing an atomic load before the
29107 "CMPXCHG" instruction, and using the "PAUSE" instruction to save
29108 CPU power when restarting the loop.
29109
29110 -mindirect-branch=choice
29111 Convert indirect call and jump with choice. The default is keep,
29112 which keeps indirect call and jump unmodified. thunk converts
29113 indirect call and jump to call and return thunk. thunk-inline
29114 converts indirect call and jump to inlined call and return thunk.
29115 thunk-extern converts indirect call and jump to external call and
29116 return thunk provided in a separate object file. You can control
29117 this behavior for a specific function by using the function
29118 attribute "indirect_branch".
29119
29120 Note that -mcmodel=large is incompatible with
29121 -mindirect-branch=thunk and -mindirect-branch=thunk-extern since
29122 the thunk function may not be reachable in the large code model.
29123
29124 Note that -mindirect-branch=thunk-extern is compatible with
29125 -fcf-protection=branch since the external thunk can be made to
29126 enable control-flow check.
29127
29128 -mfunction-return=choice
29129 Convert function return with choice. The default is keep, which
29130 keeps function return unmodified. thunk converts function return
29131 to call and return thunk. thunk-inline converts function return to
29132 inlined call and return thunk. thunk-extern converts function
29133 return to external call and return thunk provided in a separate
29134 object file. You can control this behavior for a specific function
29135 by using the function attribute "function_return".
29136
29137 Note that -mindirect-return=thunk-extern is compatible with
29138 -fcf-protection=branch since the external thunk can be made to
29139 enable control-flow check.
29140
29141 Note that -mcmodel=large is incompatible with
29142 -mfunction-return=thunk and -mfunction-return=thunk-extern since
29143 the thunk function may not be reachable in the large code model.
29144
29145 -mindirect-branch-register
29146 Force indirect call and jump via register.
29147
29148 -mharden-sls=choice
29149 Generate code to mitigate against straight line speculation (SLS)
29150 with choice. The default is none which disables all SLS hardening.
29151 return enables SLS hardening for function returns. indirect-jmp
29152 enables SLS hardening for indirect jumps. all enables all SLS
29153 hardening.
29154
29155 -mindirect-branch-cs-prefix
29156 Add CS prefix to call and jmp to indirect thunk with branch target
29157 in r8-r15 registers so that the call and jmp instruction length is
29158 6 bytes to allow them to be replaced with lfence; call *%r8-r15 or
29159 lfence; jmp *%r8-r15 at run-time.
29160
29161 These -m switches are supported in addition to the above on x86-64
29162 processors in 64-bit environments.
29163
29164 -m32
29165 -m64
29166 -mx32
29167 -m16
29168 -miamcu
29169 Generate code for a 16-bit, 32-bit or 64-bit environment. The -m32
29170 option sets "int", "long", and pointer types to 32 bits, and
29171 generates code that runs in 32-bit mode.
29172
29173 The -m64 option sets "int" to 32 bits and "long" and pointer types
29174 to 64 bits, and generates code for the x86-64 architecture. For
29175 Darwin only the -m64 option also turns off the -fno-pic and
29176 -mdynamic-no-pic options.
29177
29178 The -mx32 option sets "int", "long", and pointer types to 32 bits,
29179 and generates code for the x86-64 architecture.
29180
29181 The -m16 option is the same as -m32, except for that it outputs the
29182 ".code16gcc" assembly directive at the beginning of the assembly
29183 output so that the binary can run in 16-bit mode.
29184
29185 The -miamcu option generates code which conforms to Intel MCU
29186 psABI. It requires the -m32 option to be turned on.
29187
29188 -mno-red-zone
29189 Do not use a so-called "red zone" for x86-64 code. The red zone is
29190 mandated by the x86-64 ABI; it is a 128-byte area beyond the
29191 location of the stack pointer that is not modified by signal or
29192 interrupt handlers and therefore can be used for temporary data
29193 without adjusting the stack pointer. The flag -mno-red-zone
29194 disables this red zone.
29195
29196 -mcmodel=small
29197 Generate code for the small code model: the program and its symbols
29198 must be linked in the lower 2 GB of the address space. Pointers
29199 are 64 bits. Programs can be statically or dynamically linked.
29200 This is the default code model.
29201
29202 -mcmodel=kernel
29203 Generate code for the kernel code model. The kernel runs in the
29204 negative 2 GB of the address space. This model has to be used for
29205 Linux kernel code.
29206
29207 -mcmodel=medium
29208 Generate code for the medium model: the program is linked in the
29209 lower 2 GB of the address space. Small symbols are also placed
29210 there. Symbols with sizes larger than -mlarge-data-threshold are
29211 put into large data or BSS sections and can be located above 2GB.
29212 Programs can be statically or dynamically linked.
29213
29214 -mcmodel=large
29215 Generate code for the large model. This model makes no assumptions
29216 about addresses and sizes of sections.
29217
29218 -maddress-mode=long
29219 Generate code for long address mode. This is only supported for
29220 64-bit and x32 environments. It is the default address mode for
29221 64-bit environments.
29222
29223 -maddress-mode=short
29224 Generate code for short address mode. This is only supported for
29225 32-bit and x32 environments. It is the default address mode for
29226 32-bit and x32 environments.
29227
29228 -mneeded
29229 -mno-needed
29230 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
29231 indicate the micro-architecture ISA level required to execute the
29232 binary.
29233
29234 -mno-direct-extern-access
29235 Without -fpic nor -fPIC, always use the GOT pointer to access
29236 external symbols. With -fpic or -fPIC, treat access to protected
29237 symbols as local symbols. The default is -mdirect-extern-access.
29238
29239 Warning: shared libraries compiled with -mno-direct-extern-access
29240 and executable compiled with -mdirect-extern-access may not be
29241 binary compatible if protected symbols are used in shared libraries
29242 and executable.
29243
29244 -munroll-only-small-loops
29245 Controls conservative small loop unrolling. It is default enabled
29246 by O2, and unrolls loop with less than 4 insns by 1 time. Explicit
29247 -f[no-]unroll-[all-]loops would disable this flag to avoid any
29248 unintended unrolling behavior that user does not want.
29249
29250 -mlam=choice
29251 LAM(linear-address masking) allows special bits in the pointer to
29252 be used for metadata. The default is none. With u48, pointer bits
29253 in positions 62:48 can be used for metadata; With u57, pointer bits
29254 in positions 62:57 can be used for metadata.
29255
29256 x86 Windows Options
29257 These additional options are available for Microsoft Windows targets:
29258
29259 -mconsole
29260 This option specifies that a console application is to be
29261 generated, by instructing the linker to set the PE header subsystem
29262 type required for console applications. This option is available
29263 for Cygwin and MinGW targets and is enabled by default on those
29264 targets.
29265
29266 -mdll
29267 This option is available for Cygwin and MinGW targets. It
29268 specifies that a DLL---a dynamic link library---is to be generated,
29269 enabling the selection of the required runtime startup object and
29270 entry point.
29271
29272 -mnop-fun-dllimport
29273 This option is available for Cygwin and MinGW targets. It
29274 specifies that the "dllimport" attribute should be ignored.
29275
29276 -mthreads
29277 This option is available for MinGW targets. It specifies that
29278 MinGW-specific thread support is to be used.
29279
29280 -municode
29281 This option is available for MinGW-w64 targets. It causes the
29282 "UNICODE" preprocessor macro to be predefined, and chooses Unicode-
29283 capable runtime startup code.
29284
29285 -mwin32
29286 This option is available for Cygwin and MinGW targets. It
29287 specifies that the typical Microsoft Windows predefined macros are
29288 to be set in the pre-processor, but does not influence the choice
29289 of runtime library/startup code.
29290
29291 -mwindows
29292 This option is available for Cygwin and MinGW targets. It
29293 specifies that a GUI application is to be generated by instructing
29294 the linker to set the PE header subsystem type appropriately.
29295
29296 -fno-set-stack-executable
29297 This option is available for MinGW targets. It specifies that the
29298 executable flag for the stack used by nested functions isn't set.
29299 This is necessary for binaries running in kernel mode of Microsoft
29300 Windows, as there the User32 API, which is used to set executable
29301 privileges, isn't available.
29302
29303 -fwritable-relocated-rdata
29304 This option is available for MinGW and Cygwin targets. It
29305 specifies that relocated-data in read-only section is put into the
29306 ".data" section. This is a necessary for older runtimes not
29307 supporting modification of ".rdata" sections for pseudo-relocation.
29308
29309 -mpe-aligned-commons
29310 This option is available for Cygwin and MinGW targets. It
29311 specifies that the GNU extension to the PE file format that permits
29312 the correct alignment of COMMON variables should be used when
29313 generating code. It is enabled by default if GCC detects that the
29314 target assembler found during configuration supports the feature.
29315
29316 See also under x86 Options for standard options.
29317
29318 Xstormy16 Options
29319 These options are defined for Xstormy16:
29320
29321 -msim
29322 Choose startup files and linker script suitable for the simulator.
29323
29324 Xtensa Options
29325 These options are supported for Xtensa targets:
29326
29327 -mconst16
29328 -mno-const16
29329 Enable or disable use of "CONST16" instructions for loading
29330 constant values. The "CONST16" instruction is currently not a
29331 standard option from Tensilica. When enabled, "CONST16"
29332 instructions are always used in place of the standard "L32R"
29333 instructions. The use of "CONST16" is enabled by default only if
29334 the "L32R" instruction is not available.
29335
29336 -mfused-madd
29337 -mno-fused-madd
29338 Enable or disable use of fused multiply/add and multiply/subtract
29339 instructions in the floating-point option. This has no effect if
29340 the floating-point option is not also enabled. Disabling fused
29341 multiply/add and multiply/subtract instructions forces the compiler
29342 to use separate instructions for the multiply and add/subtract
29343 operations. This may be desirable in some cases where strict IEEE
29344 754-compliant results are required: the fused multiply add/subtract
29345 instructions do not round the intermediate result, thereby
29346 producing results with more bits of precision than specified by the
29347 IEEE standard. Disabling fused multiply add/subtract instructions
29348 also ensures that the program output is not sensitive to the
29349 compiler's ability to combine multiply and add/subtract operations.
29350
29351 -mserialize-volatile
29352 -mno-serialize-volatile
29353 When this option is enabled, GCC inserts "MEMW" instructions before
29354 "volatile" memory references to guarantee sequential consistency.
29355 The default is -mserialize-volatile. Use -mno-serialize-volatile
29356 to omit the "MEMW" instructions.
29357
29358 -mforce-no-pic
29359 For targets, like GNU/Linux, where all user-mode Xtensa code must
29360 be position-independent code (PIC), this option disables PIC for
29361 compiling kernel code.
29362
29363 -mtext-section-literals
29364 -mno-text-section-literals
29365 These options control the treatment of literal pools. The default
29366 is -mno-text-section-literals, which places literals in a separate
29367 section in the output file. This allows the literal pool to be
29368 placed in a data RAM/ROM, and it also allows the linker to combine
29369 literal pools from separate object files to remove redundant
29370 literals and improve code size. With -mtext-section-literals, the
29371 literals are interspersed in the text section in order to keep them
29372 as close as possible to their references. This may be necessary
29373 for large assembly files. Literals for each function are placed
29374 right before that function.
29375
29376 -mauto-litpools
29377 -mno-auto-litpools
29378 These options control the treatment of literal pools. The default
29379 is -mno-auto-litpools, which places literals in a separate section
29380 in the output file unless -mtext-section-literals is used. With
29381 -mauto-litpools the literals are interspersed in the text section
29382 by the assembler. Compiler does not produce explicit ".literal"
29383 directives and loads literals into registers with "MOVI"
29384 instructions instead of "L32R" to let the assembler do relaxation
29385 and place literals as necessary. This option allows assembler to
29386 create several literal pools per function and assemble very big
29387 functions, which may not be possible with -mtext-section-literals.
29388
29389 -mtarget-align
29390 -mno-target-align
29391 When this option is enabled, GCC instructs the assembler to
29392 automatically align instructions to reduce branch penalties at the
29393 expense of some code density. The assembler attempts to widen
29394 density instructions to align branch targets and the instructions
29395 following call instructions. If there are not enough preceding
29396 safe density instructions to align a target, no widening is
29397 performed. The default is -mtarget-align. These options do not
29398 affect the treatment of auto-aligned instructions like "LOOP",
29399 which the assembler always aligns, either by widening density
29400 instructions or by inserting NOP instructions.
29401
29402 -mlongcalls
29403 -mno-longcalls
29404 When this option is enabled, GCC instructs the assembler to
29405 translate direct calls to indirect calls unless it can determine
29406 that the target of a direct call is in the range allowed by the
29407 call instruction. This translation typically occurs for calls to
29408 functions in other source files. Specifically, the assembler
29409 translates a direct "CALL" instruction into an "L32R" followed by a
29410 "CALLX" instruction. The default is -mno-longcalls. This option
29411 should be used in programs where the call target can potentially be
29412 out of range. This option is implemented in the assembler, not the
29413 compiler, so the assembly code generated by GCC still shows direct
29414 call instructions---look at the disassembled object code to see the
29415 actual instructions. Note that the assembler uses an indirect call
29416 for every cross-file call, not just those that really are out of
29417 range.
29418
29419 -mabi=name
29420 Generate code for the specified ABI. Permissible values are:
29421 call0, windowed. Default ABI is chosen by the Xtensa core
29422 configuration.
29423
29424 -mabi=call0
29425 When this option is enabled function parameters are passed in
29426 registers "a2" through "a7", registers "a12" through "a15" are
29427 caller-saved, and register "a15" may be used as a frame pointer.
29428 When this version of the ABI is enabled the C preprocessor symbol
29429 "__XTENSA_CALL0_ABI__" is defined.
29430
29431 -mabi=windowed
29432 When this option is enabled function parameters are passed in
29433 registers "a10" through "a15", and called function rotates register
29434 window by 8 registers on entry so that its arguments are found in
29435 registers "a2" through "a7". Register "a7" may be used as a frame
29436 pointer. Register window is rotated 8 registers back upon return.
29437 When this version of the ABI is enabled the C preprocessor symbol
29438 "__XTENSA_WINDOWED_ABI__" is defined.
29439
29440 -mextra-l32r-costs=n
29441 Specify an extra cost of instruction RAM/ROM access for "L32R"
29442 instructions, in clock cycles. This affects, when optimizing for
29443 speed, whether loading a constant from literal pool using "L32R" or
29444 synthesizing the constant from a small one with a couple of
29445 arithmetic instructions. The default value is 0.
29446
29447 zSeries Options
29448 These are listed under
29449
29451 This section describes several environment variables that affect how
29452 GCC operates. Some of them work by specifying directories or prefixes
29453 to use when searching for various kinds of files. Some are used to
29454 specify other aspects of the compilation environment.
29455
29456 Note that you can also specify places to search using options such as
29457 -B, -I and -L. These take precedence over places specified using
29458 environment variables, which in turn take precedence over those
29459 specified by the configuration of GCC.
29460
29461 LANG
29462 LC_CTYPE
29463 LC_MESSAGES
29464 LC_ALL
29465 These environment variables control the way that GCC uses
29466 localization information which allows GCC to work with different
29467 national conventions. GCC inspects the locale categories LC_CTYPE
29468 and LC_MESSAGES if it has been configured to do so. These locale
29469 categories can be set to any value supported by your installation.
29470 A typical value is en_GB.UTF-8 for English in the United Kingdom
29471 encoded in UTF-8.
29472
29473 The LC_CTYPE environment variable specifies character
29474 classification. GCC uses it to determine the character boundaries
29475 in a string; this is needed for some multibyte encodings that
29476 contain quote and escape characters that are otherwise interpreted
29477 as a string end or escape.
29478
29479 The LC_MESSAGES environment variable specifies the language to use
29480 in diagnostic messages.
29481
29482 If the LC_ALL environment variable is set, it overrides the value
29483 of LC_CTYPE and LC_MESSAGES; otherwise, LC_CTYPE and LC_MESSAGES
29484 default to the value of the LANG environment variable. If none of
29485 these variables are set, GCC defaults to traditional C English
29486 behavior.
29487
29488 TMPDIR
29489 If TMPDIR is set, it specifies the directory to use for temporary
29490 files. GCC uses temporary files to hold the output of one stage of
29491 compilation which is to be used as input to the next stage: for
29492 example, the output of the preprocessor, which is the input to the
29493 compiler proper.
29494
29495 GCC_COMPARE_DEBUG
29496 Setting GCC_COMPARE_DEBUG is nearly equivalent to passing
29497 -fcompare-debug to the compiler driver. See the documentation of
29498 this option for more details.
29499
29500 GCC_EXEC_PREFIX
29501 If GCC_EXEC_PREFIX is set, it specifies a prefix to use in the
29502 names of the subprograms executed by the compiler. No slash is
29503 added when this prefix is combined with the name of a subprogram,
29504 but you can specify a prefix that ends with a slash if you wish.
29505
29506 If GCC_EXEC_PREFIX is not set, GCC attempts to figure out an
29507 appropriate prefix to use based on the pathname it is invoked with.
29508
29509 If GCC cannot find the subprogram using the specified prefix, it
29510 tries looking in the usual places for the subprogram.
29511
29512 The default value of GCC_EXEC_PREFIX is prefix/lib/gcc/ where
29513 prefix is the prefix to the installed compiler. In many cases
29514 prefix is the value of "prefix" when you ran the configure script.
29515
29516 Other prefixes specified with -B take precedence over this prefix.
29517
29518 This prefix is also used for finding files such as crt0.o that are
29519 used for linking.
29520
29521 In addition, the prefix is used in an unusual way in finding the
29522 directories to search for header files. For each of the standard
29523 directories whose name normally begins with /usr/local/lib/gcc
29524 (more precisely, with the value of GCC_INCLUDE_DIR), GCC tries
29525 replacing that beginning with the specified prefix to produce an
29526 alternate directory name. Thus, with -Bfoo/, GCC searches foo/bar
29527 just before it searches the standard directory /usr/local/lib/bar.
29528 If a standard directory begins with the configured prefix then the
29529 value of prefix is replaced by GCC_EXEC_PREFIX when looking for
29530 header files.
29531
29532 COMPILER_PATH
29533 The value of COMPILER_PATH is a colon-separated list of
29534 directories, much like PATH. GCC tries the directories thus
29535 specified when searching for subprograms, if it cannot find the
29536 subprograms using GCC_EXEC_PREFIX.
29537
29538 LIBRARY_PATH
29539 The value of LIBRARY_PATH is a colon-separated list of directories,
29540 much like PATH. When configured as a native compiler, GCC tries
29541 the directories thus specified when searching for special linker
29542 files, if it cannot find them using GCC_EXEC_PREFIX. Linking using
29543 GCC also uses these directories when searching for ordinary
29544 libraries for the -l option (but directories specified with -L come
29545 first).
29546
29547 LANG
29548 This variable is used to pass locale information to the compiler.
29549 One way in which this information is used is to determine the
29550 character set to be used when character literals, string literals
29551 and comments are parsed in C and C++. When the compiler is
29552 configured to allow multibyte characters, the following values for
29553 LANG are recognized:
29554
29555 C-JIS
29556 Recognize JIS characters.
29557
29558 C-SJIS
29559 Recognize SJIS characters.
29560
29561 C-EUCJP
29562 Recognize EUCJP characters.
29563
29564 If LANG is not defined, or if it has some other value, then the
29565 compiler uses "mblen" and "mbtowc" as defined by the default locale
29566 to recognize and translate multibyte characters.
29567
29568 GCC_EXTRA_DIAGNOSTIC_OUTPUT
29569 If GCC_EXTRA_DIAGNOSTIC_OUTPUT is set to one of the following
29570 values, then additional text will be emitted to stderr when fix-it
29571 hints are emitted. -fdiagnostics-parseable-fixits and
29572 -fno-diagnostics-parseable-fixits take precedence over this
29573 environment variable.
29574
29575 fixits-v1
29576 Emit parseable fix-it hints, equivalent to
29577 -fdiagnostics-parseable-fixits. In particular, columns are
29578 expressed as a count of bytes, starting at byte 1 for the
29579 initial column.
29580
29581 fixits-v2
29582 As "fixits-v1", but columns are expressed as display columns,
29583 as per -fdiagnostics-column-unit=display.
29584
29585 Some additional environment variables affect the behavior of the
29586 preprocessor.
29587
29588 CPATH
29589 C_INCLUDE_PATH
29590 CPLUS_INCLUDE_PATH
29591 OBJC_INCLUDE_PATH
29592 Each variable's value is a list of directories separated by a
29593 special character, much like PATH, in which to look for header
29594 files. The special character, "PATH_SEPARATOR", is target-
29595 dependent and determined at GCC build time. For Microsoft Windows-
29596 based targets it is a semicolon, and for almost all other targets
29597 it is a colon.
29598
29599 CPATH specifies a list of directories to be searched as if
29600 specified with -I, but after any paths given with -I options on the
29601 command line. This environment variable is used regardless of
29602 which language is being preprocessed.
29603
29604 The remaining environment variables apply only when preprocessing
29605 the particular language indicated. Each specifies a list of
29606 directories to be searched as if specified with -isystem, but after
29607 any paths given with -isystem options on the command line.
29608
29609 In all these variables, an empty element instructs the compiler to
29610 search its current working directory. Empty elements can appear at
29611 the beginning or end of a path. For instance, if the value of
29612 CPATH is ":/special/include", that has the same effect as
29613 -I. -I/special/include.
29614
29615 DEPENDENCIES_OUTPUT
29616 If this variable is set, its value specifies how to output
29617 dependencies for Make based on the non-system header files
29618 processed by the compiler. System header files are ignored in the
29619 dependency output.
29620
29621 The value of DEPENDENCIES_OUTPUT can be just a file name, in which
29622 case the Make rules are written to that file, guessing the target
29623 name from the source file name. Or the value can have the form
29624 file target, in which case the rules are written to file file using
29625 target as the target name.
29626
29627 In other words, this environment variable is equivalent to
29628 combining the options -MM and -MF, with an optional -MT switch too.
29629
29630 SUNPRO_DEPENDENCIES
29631 This variable is the same as DEPENDENCIES_OUTPUT (see above),
29632 except that system header files are not ignored, so it implies -M
29633 rather than -MM. However, the dependence on the main input file is
29634 omitted.
29635
29636 SOURCE_DATE_EPOCH
29637 If this variable is set, its value specifies a UNIX timestamp to be
29638 used in replacement of the current date and time in the "__DATE__"
29639 and "__TIME__" macros, so that the embedded timestamps become
29640 reproducible.
29641
29642 The value of SOURCE_DATE_EPOCH must be a UNIX timestamp, defined as
29643 the number of seconds (excluding leap seconds) since 01 Jan 1970
29644 00:00:00 represented in ASCII; identical to the output of "date
29645 +%s" on GNU/Linux and other systems that support the %s extension
29646 in the "date" command.
29647
29648 The value should be a known timestamp such as the last modification
29649 time of the source or package and it should be set by the build
29650 process.
29651
29653 For instructions on reporting bugs, see
29654 <http://bugzilla.redhat.com/bugzilla>.
29655
29657 1. On some systems, gcc -shared needs to build supplementary stub code
29658 for constructors to work. On multi-libbed systems, gcc -shared
29659 must select the correct support libraries to link against. Failing
29660 to supply the correct flags may lead to subtle defects. Supplying
29661 them in cases where they are not necessary is innocuous. -shared
29662 suppresses the addition of startup code to alter the floating-point
29663 environment as done with -ffast-math, -Ofast or
29664 -funsafe-math-optimizations on some targets.
29665
29667 gpl(7), gfdl(7), fsf-funding(7), cpp(1), gcov(1), as(1), ld(1), gdb(1)
29668 and the Info entries for gcc, cpp, as, ld, binutils and gdb.
29669
29671 See the Info entry for gcc, or
29672 <https://gcc.gnu.org/onlinedocs/gcc/Contributors.html>, for
29673 contributors to GCC.
29674
29676 Copyright (c) 1988-2023 Free Software Foundation, Inc.
29677
29678 Permission is granted to copy, distribute and/or modify this document
29679 under the terms of the GNU Free Documentation License, Version 1.3 or
29680 any later version published by the Free Software Foundation; with the
29681 Invariant Sections being "GNU General Public License" and "Funding Free
29682 Software", the Front-Cover texts being (a) (see below), and with the
29683 Back-Cover Texts being (b) (see below). A copy of the license is
29684 included in the gfdl(7) man page.
29685
29686 (a) The FSF's Front-Cover Text is:
29687
29688 A GNU Manual
29689
29690 (b) The FSF's Back-Cover Text is:
29691
29692 You have freedom to copy and modify this GNU Manual, like GNU
29693 software. Copies published by the Free Software Foundation raise
29694 funds for GNU development.
29695
29696
29697
29698gcc-13 2023-10-11 GCC(1)